summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.1/modules
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.5.1/modules')
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/pom.xml141
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java915
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java143
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java95
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java390
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java266
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java83
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java1243
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java108
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java97
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java144
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java83
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java292
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java258
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java257
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver20
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties30
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java148
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MultiplicityReadWriteTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java145
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java207
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java88
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java173
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java148
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java94
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java161
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java97
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java60
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java73
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java214
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java147
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java160
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java91
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite59
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType34
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType31
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite37
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Multiplicity.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite128
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite56
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite129
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml97
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/local.composite27
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml175
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/LICENSE281
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/NOTICE23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/pom.xml49
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema18
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-all.xsd34
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd148
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd36
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-contributions.xsd65
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-core.xsd348
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-definitions.xsd25
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd53
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd25
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd24
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd24
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd24
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd40
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd23
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-policy.xsd77
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca.xsd25
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-core.xsd37
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-corba.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-gdata.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jms.xsd132
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-contributions.xsd62
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd53
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/ws-addr.xsd137
-rw-r--r--branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/wsdli.xsd34
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java77
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java124
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java155
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java43
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java63
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java40
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java132
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java88
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java83
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java59
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java77
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java110
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java37
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java56
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java86
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java72
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java95
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java32
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefinitionElement.java40
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java167
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java44
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java65
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java28
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java27
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java49
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java29
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java33
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java66
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java74
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java27
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java29
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java67
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java29
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java39
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java44
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java33
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java40
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java36
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java80
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java40
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java1515
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java1154
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java170
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java68
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java71
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java165
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java48
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java76
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java105
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java68
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java278
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java118
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java111
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java47
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java46
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java224
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java96
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java71
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java194
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java83
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java133
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java38
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java758
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java273
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java213
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java265
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java88
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java114
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java46
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java121
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java45
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java82
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java174
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java93
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java113
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java71
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java115
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java153
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java53
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java62
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java97
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java105
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java96
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java154
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java50
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java63
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java75
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java59
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java133
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java107
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java96
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages.properties62
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages_it.properties30
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java209
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java56
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java61
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java42
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java41
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java30
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java128
-rw-r--r--branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java229
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/pom.xml233
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java81
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java510
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java914
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java165
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java179
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java112
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomDeleteTestCase.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java202
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomGetTestCase.java119
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPostTestCase.java108
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPutTestCase.java126
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomTestCaseUtils.java96
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ConsumerProviderAtomTestCase.java155
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java241
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java149
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerNonCollectionImpl.java53
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionImpl.java209
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java279
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java421
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java375
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderServiceDocumentTestCase.java204
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Aggregator.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorImpl.java127
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java68
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java38
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptToms.gifbin14205 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptValue.jpgbin21373 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/aggregator/FeedAggregator.composite46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js-dojo/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js-dojo/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js-dojo/pom.xml74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/java/org/apache/tuscany/sca/binding/atom/js/dojo/AtomBindingJavascriptProxyFactoryImpl.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/pom.xml74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/binding-atom.js137
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/pom.xml82
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java132
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/pom.xml143
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java92
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java253
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java65
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java120
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java137
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java497
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java53
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java119
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java92
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java97
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java578
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java564
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java841
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/TestConstants.java87
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java103
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java130
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java124
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java195
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java175
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java167
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java104
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java118
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/Color.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHelper.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHelper.java98
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerOperations.java32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerImplBase.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerStub.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHelper.java98
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcOperations.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/Arguments.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHelper.java94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZero.java52
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupported.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHelper.java93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcImplBase.java102
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcStub.java106
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterOperations.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterOperations.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectOperations.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHelper.java93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHelper.java146
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObject.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHelper.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectOperations.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterImplBase.java232
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterStub.java343
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterImplBase.java230
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterStub.java341
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectImplBase.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectStub.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectImplBase.java149
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectStub.java182
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Helper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Holder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Helper.java83
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Holder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Helper.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Holder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHelper.java80
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHelper.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHelper.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHelper.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHelper.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHelper.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/ArraysTestStruct.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/Calc.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/DummyObject.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidCorbaArray.java38
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum1.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum2.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum3.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct1.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct2.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct3.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion5.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/NonCorbaException.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/RichUnion.java91
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SimpleStruct.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SomeStruct.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObject.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectOperations.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerOperations.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectImplBase.java84
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectStub.java92
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerImplBase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerStub.java94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysSetterServant.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsServant.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsTuscanyServant.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/CalcServant.java52
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/DummyObjectServant.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/EnumManagerServant.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTestObjectServant.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTypesServant.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/NonCorbaServant.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ObjectManagerServant.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/PrimitivesSetterServant.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/TestObjectServant.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestDataType.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java148
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterfaceContract.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestOperation.java195
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java239
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java107
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/arrays_unions.idl69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/enums.idl44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/exceptions.idl58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/general_tests.idl124
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/references.idl50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/pom.xml71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBinding.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBindingFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingFactoryImpl.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingImpl.java132
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java134
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.corba.CorbaBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/pom.xml95
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java81
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java247
-rw-r--r--branches/sca-java-1.5.1/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/pom.xml195
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java365
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java150
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java811
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java154
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java92
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java338
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java483
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java209
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java117
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java157
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java189
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java124
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/binding-ejb-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/BankManagerFacade.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/Customer.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java140
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java138
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/account/account.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jarbin5449 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/pom.xml91
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java95
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java184
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java231
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ejb.EJBBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/impl/ReadWriteAnyAttributeTestCase.java133
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/pom.xml210
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/Collection.java81
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/MediaCollection.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/NotFoundException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java419
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java746
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingUtil.java171
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataReferenceBindingProvider.java229
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataServiceBindingProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Constants.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java136
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java120
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java142
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java141
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java149
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java168
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java115
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/log4j.properties25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/NOTICE8
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/pom.xml79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java141
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java121
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.gdata.GdataBindingFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/pom.xml130
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java129
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java172
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatProviderFactory.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatReferenceProvider.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java122
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JavaToSmd.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/pom.xml94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelector.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelectorFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorFactoryImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorImpl.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormat.java39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormatFactory.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatFactoryImpl.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatImpl.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorProcessorTestCase.java126
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatProcessorTestCase.java130
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/pom.xml120
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java516
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java65
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPRRBListenerServlet.java102
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java265
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java136
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/util/HTTPHeadersParser.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java855
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java147
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/NotModifiedException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/PreconditionFailedException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java241
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/content/test.html21
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/test.composite47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/testCache.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/pom.xml87
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java257
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java139
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java181
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/pom.xml94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/JMSBindingDefinitionsProvider.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java112
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java91
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java131
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java210
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java101
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/binding-jms-policy-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml84
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java91
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/jms/policy/mock_policy_definitions.xml39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/pom.xml142
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java143
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java182
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java196
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java107
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java136
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java124
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java287
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java170
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java228
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java95
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java282
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java230
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java270
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java134
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java129
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java163
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java188
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java96
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java123
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java97
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java101
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java122
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java105
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java109
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java176
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java199
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java176
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java191
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java143
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java116
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java138
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java122
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java125
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java106
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java108
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java72
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java128
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java118
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java115
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java111
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java237
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/client.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/service.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/pom.xml66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java970
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java1560
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserProp.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserPropProcessor.java87
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXML.java40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXMLProcessor.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProcessor.java93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java91
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java48
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java783
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java456
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/pom.xml74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/pom.xml74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/binding-jsonrpc.js492
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/pom.xml164
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java189
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java314
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JavaToSmd.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/ScaDomainScriptServlet.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/provider/jsonrpc.js493
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoBusinessException.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java103
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java193
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java73
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/pom.xml78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingFactoryImpl.java38
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java105
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/pom.xml150
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java68
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java97
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java342
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java126
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java338
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java317
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java669
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java83
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java83
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java85
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java74
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java115
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java87
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java83
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java176
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java470
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/pom.xml99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingProviderFactory.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java80
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceInvoker.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java213
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloException.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldImpl.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiImpl.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiService.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldService.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldImpl.componentType23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldRmiImpl.componentType27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/pom.xml93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingFactoryImpl.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingImpl.java157
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rmi.RMIBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/pom.xml171
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java55
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java397
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java65
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java85
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/pom.xml98
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/pom.xml103
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java184
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java127
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java73
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java105
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java232
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite84
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml23
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/pom.xml114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCABindingProviderFactory.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java111
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAReferenceBindingProvider.java95
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAServiceBindingProvider.java97
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/WrappedSCAException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/pom.xml77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java171
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java108
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadWriteAnyAttributeTestCase.java140
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/Calculator.composite59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/pom.xml93
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java37
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java73
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java116
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java252
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java154
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java224
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java113
-rw-r--r--branches/sca-java-1.5.1/modules/binding-sca/src/test/resources/Calculator.composite52
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/pom.xml149
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java112
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java157
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java99
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java56
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java114
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSSecurityPolicyHandler.java80
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler25
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/pom.xml351
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java300
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java89
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java87
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java503
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java103
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java843
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java356
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java79
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java207
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java105
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java107
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java238
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/AxisJMSException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSConnectionFactory.java605
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSListener.java527
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSMessageReceiver.java270
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSOutTransportInfo.java220
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSSender.java389
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/README14
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java111
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingHeaderConfigurator.java69
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml504
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list1
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.4.marbin2796 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list0
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java83
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java104
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Account.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/AccountService.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/CustomerProfileData.java103
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java29
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java30
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java41
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java96
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java98
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java124
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java68
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java122
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceClient.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java57
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyException.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionAdapter.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionImpl.java26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java64
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java24
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java138
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite61
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd36
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite43
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.wsdl81
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl220
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite42
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml101
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jksbin1366 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite52
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml323
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties20
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jksbin1366 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite50
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml204
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jksbin1352 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl70
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl49
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl94
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite39
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite71
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite40
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/pom.xml108
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java345
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java913
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java316
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLGenerationException.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java542
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/Other.java34
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/package-info.java21
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java66
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestException.java47
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFault.java46
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFaultBean.java54
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaClass.java32
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java67
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/pom.xml100
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/BindingBuilderImpl.java51
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java230
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java484
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java44
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties27
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java127
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadWriteAnyAttributeTestCase.java133
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java78
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite59
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite63
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite60
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl26
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl58
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl45
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd33
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl63
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl76
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/pom.xml85
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java215
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java62
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java321
-rw-r--r--branches/sca-java-1.5.1/modules/binding-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/NOTICE8
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/pom.xml84
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java57
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java69
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java31
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java55
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy27
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java160
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java130
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java469
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java640
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java122
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java701
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java190
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties28
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java46
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java55
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java114
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java126
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java58
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryTestCase.java81
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImplTestCase.java63
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jarbin26901 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository/sample-calculator.jarbin10037 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository3/contribution.zipbin5478 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.composite22
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.ext0
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/pom.xml77
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassLoaderProvider.java44
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassloaderProviderExtensionPoint.java55
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassLoaderProvider.java47
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassloaderProviderExtensionPoint.java144
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java30
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java43
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java58
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java168
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java177
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java390
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java96
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java76
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java163
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java157
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java111
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java62
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java168
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider21
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassloaderProviderExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java262
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java103
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java105
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-java/src/test/resources/deployables/sample-calculator.jarbin26901 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/pom.xml127
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JEEDefinitionsProvider.java73
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEModuleHelper.java63
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoader.java201
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoaderProvider.java49
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEIntrospectorImpl.java421
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoader.java191
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoaderProvider.java49
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/org/apache/tuscany/sca/contribution/jee/definitions.xml35
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/pom.xml100
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java56
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbInfo.java39
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleInfo.java39
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleModelResolver.java70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbReferenceInfo.java33
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EnvEntryInfo.java29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ExternalEarInfo.java31
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationInfo.java38
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationModelResolver.java70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java38
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEIntrospector.java34
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JspReferenceTagInfo.java30
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObject.java32
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObjectModelResolver.java73
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java43
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleInfo.java50
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleModelResolver.java70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java77
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java67
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EarContributionProcessor.java158
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbArchiveProcessor.java69
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbModuleInfoImpl.java66
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEApplicationInfoImpl.java68
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEArchiveProcessor.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java262
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java359
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/ModelObjectImpl.java51
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java36
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebArchiveProcessor.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java60
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java66
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebModuleInfoImpl.java109
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEExtension18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor22
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver21
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/EarContributionProcessorTestCase.java57
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java57
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.earbin19015 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.jarbin11042 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/sample-web-app.warbin12454 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java30
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java46
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java55
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java54
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java182
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java98
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java93
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java186
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java107
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java111
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/pom.xml96
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java161
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java161
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java141
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java154
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java137
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java215
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java119
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java46
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java87
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java59
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportModelResolver.java65
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java162
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java97
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java107
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java168
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/contribution-resource-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java104
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java106
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java76
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java164
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java486
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLEventsStreamReader.java448
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLFragmentStreamReader.java53
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java50
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java132
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java259
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java72
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties24
-rw-r--r--branches/sca-java-1.5.1/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java144
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/pom.xml69
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java74
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java32
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java40
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java132
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java73
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java56
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java32
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java30
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java30
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java130
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java48
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java57
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java54
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java57
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java94
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java67
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java164
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java65
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java46
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java56
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java48
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java58
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java618
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java66
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java129
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java392
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java327
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java244
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java317
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java95
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java99
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java264
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java247
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java143
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java70
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java50
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java61
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java63
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyNamespaceContext.java111
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyXMLStreamReader.java131
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java51
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java29
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java396
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java52
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java107
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java68
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java80
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java69
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java66
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java117
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java213
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java69
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java52
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java45
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java103
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java65
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java50
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java125
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java58
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java44
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java94
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java128
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java137
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java61
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java118
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java77
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java38
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java48
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java42
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java39
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/contribution/src/main/resources/contribution-validation-messages.properties34
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/pom.xml139
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java111
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java141
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java128
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java110
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java75
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java42
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java75
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java61
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java114
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java279
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/OMElementXMLAdapter.java62
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java257
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java100
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java198
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java104
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java80
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java89
-rw-r--r--branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java229
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/pom.xml122
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/doc/Context Model.emx673
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java38
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java50
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java114
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java40
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java33
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java180
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java55
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java57
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java33
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java55
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java37
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java34
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java40
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java112
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java36
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java127
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java69
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java39
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java60
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java509
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java91
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java68
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProvider.java39
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java38
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java41
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java76
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java33
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java30
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java39
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProvider.java54
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java93
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java69
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java83
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java105
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java119
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java138
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java117
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java46
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java96
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java57
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java71
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java71
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java67
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java58
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java59
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint19
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java208
-rw-r--r--branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/core/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/core/pom.xml114
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java37
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java154
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java1101
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java186
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java185
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java101
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java139
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java111
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java155
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java163
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java459
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java605
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java320
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java452
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java48
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java113
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java133
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java40
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java73
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java225
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java29
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java66
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java265
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java89
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java54
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java52
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java52
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java45
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java45
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java47
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java57
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java268
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java48
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java47
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java172
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java74
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java113
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java191
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java110
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java610
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java104
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java36
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java113
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java202
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java298
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java236
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java48
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java87
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java264
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java74
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java72
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java54
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java200
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java90
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java290
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java83
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java41
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java106
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java66
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java159
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java32
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java43
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java62
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java65
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java40
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java67
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java195
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/DefaultWorkScheduler.java191
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java229
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Work.java65
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEvent.java80
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItem.java167
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkListener.java32
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager18
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler18
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java52
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java98
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java69
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java51
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java63
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java69
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java165
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java62
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java93
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java74
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java53
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java43
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java71
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java154
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java240
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java153
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java238
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java86
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java61
-rw-r--r--branches/sca-java-1.5.1/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest24
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/pom.xml58
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java78
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java85
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java159
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java30
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java28
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java31
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java29
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java30
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java31
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java29
-rw-r--r--branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java30
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/pom.xml122
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java62
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java142
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java95
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java79
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java50
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java66
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java267
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java63
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer30
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java129
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xml51
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xsd137
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/order.wsdl76
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/NOTICE14
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/pom.xml87
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java89
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java75
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer22
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer22
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java127
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/pom.xml189
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/AxiomHelper.java140
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXB2OMElement.java78
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBCustomBuilder.java116
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBDataSource.java206
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java90
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer26
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/JAXB2OMTestCase.java109
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/OMElement2JAXBTestCase.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml183
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/AnyTypeXmlAdapter.java39
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DOMElementXmlAdapter.java57
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DataConverter.java378
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DefaultXMLAdapterExtensionPoint.java60
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java75
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java563
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java479
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java131
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBPropertyDescriptor.java302
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java245
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java153
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHelper.java166
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java73
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java74
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java80
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLAdapterExtensionPoint.java52
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLRootElementUtil.java299
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer32
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint17
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/com/example/stock/StockQuoteOffer.java45
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java324
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java84
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCacheTestCase.java123
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java130
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java92
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java175
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java90
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyBean.java162
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterface.java29
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterfaceImpl.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyJaxbBean.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MySubBean.java35
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java268
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-jaxb/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/pom.xml136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java73
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java61
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java74
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java91
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java82
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java139
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java94
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java57
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java176
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer31
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java128
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java170
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java158
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java29
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java87
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-json/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/pom.xml137
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java99
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java153
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java91
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2JavaArrayTransformer.java76
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java41
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java54
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java53
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java87
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java74
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java66
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/collection/ItemList.java34
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding20
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer34
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/pom.xml167
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java142
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java86
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java89
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer20
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java78
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java82
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java63
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/stock.xsd33
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/pom.xml144
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java73
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java82
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java78
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java212
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java218
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java148
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java68
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java236
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java105
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java192
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java61
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java72
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java66
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java246
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java109
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver17
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer27
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java60
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java75
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java89
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelperTestCase.java55
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java114
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java82
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java83
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java63
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java62
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/stock.xsd33
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xml27
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xsd38
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-xmlbeans/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/pom.xml125
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java61
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java82
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansWrapperHandler.java126
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java62
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java60
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java55
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding19
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer22
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java105
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsd136
-rwxr-xr-xbranches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig21
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/LICENSE244
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/pom.xml108
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java91
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java74
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java46
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java29
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java255
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java306
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java153
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java38
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java36
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java46
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java95
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java51
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java81
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java78
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java68
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java56
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java43
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java39
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java111
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java52
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java163
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java452
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java94
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java103
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java585
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java89
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java401
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java125
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java945
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java97
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java79
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java68
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java262
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java163
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java35
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java79
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java329
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java76
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java168
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java88
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java296
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java146
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java36
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java156
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java310
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java403
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java347
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java59
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java279
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java68
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java45
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java61
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java62
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java67
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java60
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java246
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java81
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java71
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java112
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java63
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java68
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java256
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java53
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java86
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java65
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java60
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java61
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java62
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java55
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java100
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java63
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java482
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java53
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java857
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java57
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java75
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java70
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java57
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java287
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java37
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java50
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java69
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java355
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java531
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding25
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator17
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer40
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer26
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java58
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java124
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java64
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java97
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java49
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java125
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java122
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java109
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java57
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java192
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java108
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java93
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java144
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java39
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java55
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java101
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java199
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl76
-rw-r--r--branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml22
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/pom.xml82
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java197
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java264
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java33
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java190
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java75
-rw-r--r--branches/sca-java-1.5.1/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml255
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java82
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java34
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java309
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java71
-rw-r--r--branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java87
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/pom.xml215
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationCollectionImpl.java127
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java657
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeGeneratorServiceImpl.java255
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java671
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionServiceImpl.java77
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java408
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeServiceImpl.java128
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java378
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfiguration.java53
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfigurationImpl.java85
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerUtil.java296
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java136
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java153
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeConfigurationServiceImpl.java96
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeProcessCollectionFacadeImpl.java251
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java242
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java95
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/DomainManager.composite281
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud-gadget.html408
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud.html68
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite-gadget.html277
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite.html66
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files-gadget.html124
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files.html64
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home-gadget.html45
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home.html65
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/icons/feed-icon.pngbin818 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/manager.css104
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/toolbar-gadget.html47
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/utils.js246
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace-gadget.html232
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace.html65
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java117
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/assets/META-INF/sca-contribution.xml26
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/store/META-INF/sca-contribution.xml24
-rw-r--r--branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/workspace.xml21
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/pom.xml122
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java49
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java112
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml26
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorService.java35
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java70
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractService.java28
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java209
-rw-r--r--branches/sca-java-1.5.1/modules/endpoint/src/test/resources/Calculator.composite52
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/NOTICE5
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/pom.xml73
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoverer.java359
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoveryActivator.java45
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscovererTestCase.java123
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/resources/test-bundle.jarbin1797 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/NOTICE5
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/pom.xml50
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java184
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java99
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java184
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java56
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java60
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java53
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java54
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscoverer.java262
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java68
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java37
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java170
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscovererTestCase.java72
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/pom.xml95
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java69
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java32
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java64
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java34
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java195
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java262
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java113
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java99
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java135
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java40
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java58
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java248
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java72
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java153
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java132
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java231
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java96
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java33
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java70
-rw-r--r--branches/sca-java-1.5.1/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator20
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/pom.xml63
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/CorbaRuntimeModuleActivator.java52
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java162
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java208
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java174
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java30
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java100
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java31
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java74
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java73
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java35
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jee/src/test/resources/general.idl45
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/pom.xml71
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/CorbaRuntimeModuleActivator.java53
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/TnsDefaultCorbaHost.java116
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/test/java/org/apache/tuscany/sca/host/corba/testing/TnsDefaultCorbaHostTestCase.java97
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/pom.xml57
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/CorbaRuntimeModuleActivator.java48
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/DefaultCorbaHost.java181
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/NamingContextBase.java863
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameServer.java133
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java203
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNamingContext.java440
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientServiceException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java250
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java30
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java98
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java31
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java74
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java73
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/servants/TestInterfaceServant.java35
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba-jse/src/test/resources/general.idl43
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/pom.xml57
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java56
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java47
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostExtensionPoint.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostUtils.java61
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java202
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/DefaultCorbaHostExtensionPoint.java48
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java55
-rwxr-xr-xbranches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/SocketUtil.java226
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java145
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/pom.xml138
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java228
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java125
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java291
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java120
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java360
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java235
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java389
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java387
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java275
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java34
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java48
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java57
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java56
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainZipsTestCaseFIXME.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java63
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java189
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java104
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java47
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java44
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java37
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java30
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java117
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java96
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java65
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java64
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java47
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java52
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/java/sample/Helloworld.java29
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.jarbin4287 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.zipbin4287 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.txt16
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/pom.xml65
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java86
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java45
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java133
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/SecurityContext.java64
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java124
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/UserContext.java68
-rw-r--r--branches/sca-java-1.5.1/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java90
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java87
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java512
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java77
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java323
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/content/test.html21
-rw-r--r--branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/tuscany.keyStorebin1265 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/pom.xml88
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java236
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSHostExtensionPointImpl.java42
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java56
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java98
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms-asf/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint19
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/pom.xml77
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSHostExtensionPoint.java27
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListener.java29
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerDetails.java40
-rw-r--r--branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerFactory.java27
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/pom.xml57
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java127
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java49
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java73
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java90
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java51
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java46
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java90
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/pom.xml87
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java58
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java114
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatPolicyBaseRealm.java95
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java692
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java69
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java353
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/content/test.html21
-rw-r--r--branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/tuscany.keyStorebin1265 -> 0 bytes
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/LICENSE241
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/NOTICE12
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/pom.xml101
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java57
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java72
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java73
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java67
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java104
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java72
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java114
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java358
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java53
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java45
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java118
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/sca.tld49
-rw-r--r--branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/LICENSE251
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/NOTICE17
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/pom.xml450
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java225
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java270
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java48
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java79
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java44
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java299
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java57
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java75
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java434
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java145
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java251
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java148
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl87
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/log4j.properties36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/LICENSE251
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/NOTICE17
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/pom.xml98
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java91
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java109
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELFactoryImpl.java45
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java132
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java116
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java532
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java518
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java65
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java130
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java112
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java59
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java111
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl82
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/pom.xml93
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java44
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java39
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java151
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java224
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java68
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-ejb/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/pom.xml81
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java43
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java86
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java56
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java39
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java67
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java331
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java50
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java64
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java55
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java46
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java87
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java43
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java47
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java46
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java106
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java405
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java248
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java204
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java76
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java183
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java126
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java56
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java74
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java106
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory17
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java449
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java76
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java80
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java89
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java39
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java120
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java50
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java185
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java48
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/pom.xml112
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java351
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddService.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java73
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideService.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java224
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java88
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml100
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml133
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/pom.xml84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java59
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java60
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java198
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java89
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java141
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java53
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java224
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java86
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java77
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java168
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java85
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java126
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java192
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java64
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java80
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java83
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java82
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java70
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java132
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java61
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java57
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java615
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java61
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java39
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java42
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java48
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java577
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java292
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java46
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java208
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java137
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java61
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java184
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java76
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java169
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java71
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java192
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java157
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java167
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java152
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java201
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java94
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java144
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java117
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java129
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java59
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java71
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java310
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java562
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java148
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java145
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java95
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java99
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java418
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java212
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java221
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java119
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java113
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java183
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java158
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/pom.xml97
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java43
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementationFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationFactoryImpl.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java61
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java313
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java88
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java68
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/Helloworld.java25
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/MockImplementationProviderFactory.java44
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/pom.xml103
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java85
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java149
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java44
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java62
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java119
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java397
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java48
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestComposite.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestNode.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/pom.xml93
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java45
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java42
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java111
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java104
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java44
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java97
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java196
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java119
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java603
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java81
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java65
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite64
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/pom.xml110
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java105
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java112
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java27
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java96
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java99
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java67
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java136
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java56
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/LICENSE203
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/pom.xml164
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java45
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java325
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java293
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java226
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java168
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java1254
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java109
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiInstanceWrapper.java299
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRemotableInvoker.java139
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java199
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java550
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties25
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiPropertyTestCase.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java74
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java116
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java132
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java106
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType28
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgiproptest.composite37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgitest.composite36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/pom.xml86
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java67
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java75
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java47
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java77
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/content/test.html21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/resource.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/pom.xml79
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java57
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java47
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java130
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java167
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/LICENSE251
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/NOTICE12
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/pom.xml197
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java99
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java49
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java172
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java697
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java31
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java28
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js26
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js22
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType30
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy22
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py20
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy22
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py20
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType31
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy22
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js22
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py20
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb21
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/README9
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/pom.xml90
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/SCANamespaceHandlerResolver.java53
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaNamespaceHandler.java38
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaPropertyBeanDefinitionParser.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaReferenceBeanDefinitionParser.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaServiceBeanDefinitionParser.java36
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentNameAnnotationProcessor.java150
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentStub.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ConstructorAnnotationProcessor.java115
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/InitDestroyAnnotationProcessor.java75
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java161
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyValueStub.java55
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java164
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java190
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java207
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java129
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.handlers1
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.schemas1
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/spring-sca.xsd84
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/README9
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/pom.xml109
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanElement.java76
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringConstructorArgElement.java78
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java226
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationConstants.java64
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyElement.java61
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAPropertyElement.java52
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAReferenceElement.java54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAServiceElement.java64
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanIntrospector.java135
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanPojoProcessor.java656
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java861
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java41
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java11
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java53
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java140
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java92
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java147
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java124
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java244
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/impl-spring-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/LICENSE203
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/pom.xml116
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java156
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessor.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessorExtensionPoint.java27
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/DefaultContextScriptProcessorExtensionPoint.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/JSONRPCScripProcessor.java57
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java88
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java78
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.ContextScriptProcessorExtensionPoint19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/jsonrpc.js493
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/pom.xml100
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java42
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementationFactory.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationFactoryImpl.java37
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java135
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/PropertyProcessor.java154
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/ReferenceProcessor.java181
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java196
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.WebImplementationFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java81
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java66
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite29
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/pom.xml67
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java208
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/pom.xml110
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/java/org/apache/tuscany/sca/implementation/widget/tuscany/TuscanyJavaScriptComponentGeneratorImpl.java203
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java48
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/Catalog.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/CatalogImpl.java47
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/ShoppingCartImpl.java124
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html127
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html152
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html250
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widget.composite54
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite58
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/pom.xml92
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java218
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptServlet.java62
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java101
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java126
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java59
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/atomModel.js1590
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/binding-http.js105
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/pom.xml79
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java34
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java40
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java31
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java145
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java172
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java47
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationImpl.java135
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/impl-widget-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/pom.xml105
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java75
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java32
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java166
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java51
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java33
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java318
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java102
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java159
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java328
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/impl-xquery-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/pom.xml303
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java539
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java280
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGenerator.java147
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedClassLoader.java69
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedDataTypeImpl.java143
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java402
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java454
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java49
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java238
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java27
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java40
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java40
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java62
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java119
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java48
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java62
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java52
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java40
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java66
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java79
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/Stock.wsdl142
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl149
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/pom.xml83
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java37
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java227
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java100
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java83
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite53
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType34
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType31
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/pom.xml82
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java99
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java87
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java33
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java82
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java57
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/ClassCachedJavaInterfaceFactoryImpl.java129
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java54
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java84
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java133
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java276
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java225
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java83
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java159
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java39
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java308
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java121
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java98
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java107
-rw-r--r--branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java108
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/pom.xml95
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELExtensionHandler.java140
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELPartnerLinkTypeExt.java79
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java40
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java230
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java315
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java600
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/interface-wsdlxml-validation-messages.properties24
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java68
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java83
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java117
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java87
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java70
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java97
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java86
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java104
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java83
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java53
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite55
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType36
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType33
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl26
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl58
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd136
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl58
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl45
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd33
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl63
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl76
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl62
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl67
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl49
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd29
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd22
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd29
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/pom.xml103
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java140
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java70
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java67
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java44
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java54
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java40
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java35
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java289
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java75
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java64
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java115
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java159
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java61
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java81
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java617
-rw-r--r--branches/sca-java-1.5.1/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/interface/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/interface/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/interface/pom.xml57
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java29
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java119
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java62
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java69
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java111
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java81
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java115
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java34
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java41
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java42
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java226
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java45
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java28
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java229
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java128
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java302
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java331
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java321
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java114
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java82
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java143
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java100
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java140
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java152
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper18
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java380
-rw-r--r--branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java71
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/pom.xml57
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java162
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorRuntimeException.java55
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java49
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java41
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java116
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java132
-rw-r--r--branches/sca-java-1.5.1/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/pom.xml61
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java71
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java54
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java42
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java33
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java203
-rw-r--r--branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java208
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/pom.xml154
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java57
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java63
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java60
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java897
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java427
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java256
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory17
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory17
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorld.java30
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorldImpl.java30
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java119
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java119
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/resources/HelloWorld.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml23
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/pom.xml155
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/Contribution.java48
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/DomainManagerLauncher.java110
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHost.java174
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/JarFileFinder.java348
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherBundleActivator.java475
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherException.java55
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeDaemonLauncher.java100
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncher.java165
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherUtil.java198
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeMain.java44
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeServletFilter.java127
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/OSGiHost.java30
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorld.java30
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorldImpl.java30
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHostTestCase.java95
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherTestCase.java69
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/resources/HelloWorld.composite30
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/pom.xml72
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java48
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java179
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java55
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java168
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java230
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java543
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java44
-rw-r--r--branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java130
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/pom.xml138
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeManagerUtil.java51
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeProcessCollectionImpl.java338
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/PingServiceImpl.java61
-rw-r--r--branches/sca-java-1.5.1/modules/node-manager/src/main/resources/NodeDaemon.composite39
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/LICENSE203
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java117
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java253
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java168
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java252
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java275
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java47
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java78
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/pom.xml77
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java67
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java84
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java130
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java137
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java89
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java87
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml31
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java91
-rw-r--r--branches/sca-java-1.5.1/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml23
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/src/main/java/org/apache/tuscany/sca/policy/reliability/ReliabilityPolicyDefinitionsProvider.java72
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/org/apache/tuscany/sca/policy/reliability/definitions.xml62
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-geronimo/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/java/org/apache/tuscany/sca/policy/security/geronimo/GeronimoLDAPSecurityHandler.java136
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler18
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/pom.xml106
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicy.java45
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicyProcessor.java156
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicy.java132
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicyProcessor.java157
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java71
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java193
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationInterceptor.java66
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicy.java79
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProcessor.java140
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java234
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java133
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandler.java63
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandlerExtensionPoint.java50
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/util/HttpSecurityUtil.java124
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor21
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandlerExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/policy-security-http-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/pom.xml83
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JSR250Activator.java51
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JSR250PolicyProcessor.java178
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCaseFIXME.java418
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/pom.xml74
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/SecurityUtil.java76
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicy.java66
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProcessor.java123
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPrincipal.java80
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java95
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyProvider.java89
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java92
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyProvider.java87
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/TokenPrincipal.java74
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java84
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java152
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyInterceptor.java80
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java88
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicy.java76
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java133
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProviderFactory.java75
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java85
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java90
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java76
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java73
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java72
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java151
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java72
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java110
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor27
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory21
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml65
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml30
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/main/resources/policy-security-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java88
-rw-r--r--branches/sca-java-1.5.1/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml78
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/pom.xml127
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java44
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java61
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java28
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java122
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java243
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java90
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java84
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java46
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java71
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java59
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java96
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java92
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java61
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java61
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java31
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/log4j.properties29
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml66
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml54
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java54
-rw-r--r--branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java194
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/pom.xml142
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java162
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java63
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java74
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java111
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml106
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/pom.xml76
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java68
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java68
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java248
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java75
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java417
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java487
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java45
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java45
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java45
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor24
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties44
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java280
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java74
-rw-r--r--branches/sca-java-1.5.1/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml255
-rw-r--r--branches/sca-java-1.5.1/modules/policy/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/policy/NOTICE5
-rw-r--r--branches/sca-java-1.5.1/modules/policy/pom.xml58
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java29
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java30
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java116
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java52
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java71
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java43
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java89
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java33
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java38
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java155
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java48
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java43
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java36
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java41
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java90
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java88
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java39
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java151
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java73
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java93
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java60
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java149
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java48
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java39
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java50
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java418
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java38
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java87
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java91
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java64
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java38
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java111
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java50
-rw-r--r--branches/sca-java-1.5.1/modules/pom.xml234
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api-extension/LICENSE202
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api-extension/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api-extension/pom.xml62
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api-extension/src/main/java/org/apache/tuscany/sca/api/ComponentContextExtension.java55
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/LICENSE243
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/NOTICE13
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/pom.xml54
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java54
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java100
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Constants.java34
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java30
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java56
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java57
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java55
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java54
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java58
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java54
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java28
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java58
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java39
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java58
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java28
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java46
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java27
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java24
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java26
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java58
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java48
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java35
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java41
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java25
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java40
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java26
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java46
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java38
-rw-r--r--branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java37
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/launcher.bat22
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/pom.xml120
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java105
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java87
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java60
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TracingAspect.java92
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml43
-rw-r--r--branches/sca-java-1.5.1/modules/tracing-aspectj/src/test/java/org/apache/tuscany/sca/aspectj/TracingTestCase.java41
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/LICENSE238
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/NOTICE11
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/build-dojo.xml92
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/pom.xml125
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java84
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoResourceServlet.java73
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator18
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/tuscany/AtomService.js141
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/pom.xml67
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGenerator.java59
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGeneratorExtensionPoint.java56
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java154
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java225
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactory.java69
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactoryExtensionPoint.java52
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGeneratorExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint18
-rw-r--r--branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/web-javascript-validation-messages.properties21
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/pom.xml83
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java145
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java305
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java240
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java107
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java121
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor20
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages_it.properties21
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java100
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-manager/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-manager/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-manager/pom.xml88
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/WorkspaceManager.java106
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/impl/WorkspaceManagerImpl.java190
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/pom.xml70
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java131
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java167
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/workspace-xml-validation-messages.properties22
-rw-r--r--branches/sca-java-1.5.1/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java89
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/pom.xml64
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java32
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java39
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java36
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java42
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java40
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java152
-rw-r--r--branches/sca-java-1.5.1/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory18
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/pom.xml82
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java184
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java102
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java343
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor19
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver18
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/xsd-xml-validation-messages.properties23
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java51
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessorTestCase.java90
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/greeting.xsd29
-rw-r--r--branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/name.xsd29
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/LICENSE205
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/NOTICE6
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/pom.xml79
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/DefaultXSDFactory.java30
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDFactory.java35
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDefinition.java117
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDFactoryImpl.java35
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDefinitionImpl.java232
-rw-r--r--branches/sca-java-1.5.1/modules/xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.xsd.XSDFactory18
3557 files changed, 0 insertions, 353163 deletions
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/LICENSE b/branches/sca-java-1.5.1/modules/assembly-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/NOTICE b/branches/sca-java-1.5.1/modules/assembly-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/pom.xml b/branches/sca-java-1.5.1/modules/assembly-xml/pom.xml
deleted file mode 100644
index 0a272c2b23..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/pom.xml
+++ /dev/null
@@ -1,141 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-assembly-xml</artifactId>
- <name>Apache Tuscany SCA XML Assembly Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0-2</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml-ws</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.assembly.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.assembly.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
deleted file mode 100644
index b76b755dc7..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
+++ /dev/null
@@ -1,915 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
-import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.AbstractProperty;
-import org.apache.tuscany.sca.assembly.AbstractReference;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-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.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * A base class with utility methods for the other artifact processors in this module.
- *
- * @version $Rev$ $Date$
- */
-abstract class BaseAssemblyProcessor extends BaseStAXArtifactProcessor implements Constants {
-
- protected ContributionFactory contributionFactory;
- protected AssemblyFactory assemblyFactory;
- protected ExtensionFactory extensionFactory;
- protected PolicyFactory policyFactory;
- protected StAXArtifactProcessor<Object> extensionProcessor;
- protected StAXAttributeProcessor<Object> extensionAttributeProcessor;
- protected PolicyAttachPointProcessor policyProcessor;
- private DocumentBuilderFactory documentBuilderFactory;
- protected IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private Monitor monitor;
-
-
- /**
- * Constructs a new BaseArtifactProcessor.
- * @param contribFactory
- * @param assemblyFactory
- * @param extensionFactory
- * @param policyFactory
- * @param extensionProcessor
- * @param monitor
- */
- @SuppressWarnings("unchecked")
- public BaseAssemblyProcessor(ContributionFactory contribFactory,
- AssemblyFactory assemblyFactory,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.contributionFactory = contribFactory;
- this.assemblyFactory = assemblyFactory;
- this.extensionFactory = extensionFactory;
- this.policyFactory = policyFactory;
- this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.intentAttachPointTypeFactory = new IntentAttachPointTypeFactoryImpl();
- this.monitor = monitor;
- }
-
- /**
- * Constructs a new BaseArtifactProcessor.
- * @param assemblyfactory
- * @param extensionFactory
- * @param policyFactory
- * @param extensionProcessor
- * @param monitor
- */
- @SuppressWarnings("unchecked")
- public BaseAssemblyProcessor(AssemblyFactory assemblyfactory,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.assemblyFactory = assemblyfactory;
- this.extensionFactory = extensionFactory;
- this.policyFactory = policyFactory;
- this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.monitor = monitor;
- }
-
- /**
- * Marshals warnings into the monitor
- *
- * @param message
- * @param model
- * @param messageParameters
- */
- protected void warning(String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals errors into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals exceptions into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Start an element.
- * @param writer
- * @param name
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeStart(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
- writeStart(writer, SCA10_NS, name, attrs);
- }
-
- /**
- * Start a document.
- * @param writer
- * @throws XMLStreamException
- */
- protected void writeStartDocument(XMLStreamWriter writer, String name, XAttr... attrs) throws XMLStreamException {
- writer.writeStartDocument();
- writer.setDefaultNamespace(SCA10_NS);
- writeStart(writer, SCA10_NS, name, attrs);
- writer.writeDefaultNamespace(SCA10_NS);
- }
-
- /**
- * Read list of reference targets
- * @param reference
- * @param reader
- */
- protected void readTargets(Reference reference, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, TARGET);
- ComponentService target = null;
- if (value != null) {
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- target = assemblyFactory.createComponentService();
- target.setUnresolved(true);
- target.setName(tokens.nextToken());
- reference.getTargets().add(target);
- }
- }
- }
-
- /**
- * Write a list of targets into an attribute
- * @param reference
- * @return
- */
- protected XAttr writeTargets(Reference reference) {
- List<String> targets = new ArrayList<String>();
- for (Service target : reference.getTargets()) {
- targets.add(target.getName());
- }
- return new XAttr(TARGET, targets);
- }
-
- /**
- * Read a multiplicity attribute.
- * @param reference
- * @param reader
- */
- protected void readMultiplicity(AbstractReference reference, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, MULTIPLICITY);
- if (ZERO_ONE.equals(value)) {
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- } else if (ONE_N.equals(value)) {
- reference.setMultiplicity(Multiplicity.ONE_N);
- } else if (ZERO_N.equals(value)) {
- reference.setMultiplicity(Multiplicity.ZERO_N);
- } else if (ONE_ONE.equals(value)) {
- reference.setMultiplicity(Multiplicity.ONE_ONE);
- }
- }
-
- protected XAttr writeMultiplicity(AbstractReference reference) {
- Multiplicity multiplicity = reference.getMultiplicity();
- if (multiplicity != null) {
- String value = null;
- if (Multiplicity.ZERO_ONE.equals(multiplicity)) {
- value = ZERO_ONE;
- } else if (Multiplicity.ONE_N.equals(multiplicity)) {
- value = ONE_N;
- } else if (Multiplicity.ZERO_N.equals(multiplicity)) {
- value = ZERO_N;
- } else if (Multiplicity.ONE_ONE.equals(multiplicity)) {
- value = ONE_ONE;
- return null;
- }
- return new XAttr(MULTIPLICITY, value);
- }
- return null;
- }
-
- /**
- * Returns the value of a constrainingType attribute.
- * @param reader
- * @return
- */
- protected ConstrainingType readConstrainingType(XMLStreamReader reader) {
- QName constrainingTypeName = getQName(reader, Constants.CONSTRAINING_TYPE);
- if (constrainingTypeName != null) {
- ConstrainingType constrainingType = assemblyFactory.createConstrainingType();
- constrainingType.setName(constrainingTypeName);
- constrainingType.setUnresolved(true);
- return constrainingType;
- } else {
- return null;
- }
- }
-
- /**
- * Reads an abstract property element.
- * @param property
- * @param reader
- * @throws XMLStreamException
- * @throws ContributionReadException
- */
- protected void readAbstractProperty(AbstractProperty property, XMLStreamReader reader) throws XMLStreamException,
- ContributionReadException {
-
- property.setName(getString(reader, NAME));
- property.setMany(getBoolean(reader, MANY));
- property.setMustSupply(getBoolean(reader, MUST_SUPPLY));
- property.setXSDElement(getQName(reader, ELEMENT));
- property.setXSDType(getQName(reader, TYPE));
- }
-
- /**
- * Resolve an implementation.
- * @param implementation
- * @param resolver
- * @return
- * @throws ContributionResolveException
- */
- protected Implementation resolveImplementation(Implementation implementation, ModelResolver resolver)
- throws ContributionResolveException, PolicyValidationException {
- if (implementation != null) {
- if (implementation.isUnresolved()) {
- implementation = resolver.resolveModel(Implementation.class, implementation);
-
- // Lazily resolve implementations
- if (implementation.isUnresolved()) {
- extensionProcessor.resolve(implementation, resolver);
- if (!implementation.isUnresolved()) {
- //resolve policies
- if ( implementation instanceof PolicySetAttachPoint ) {
- PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
- resolveIntents(policiedImpl.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
-
- resolvePolicySets(policiedImpl.getPolicySets(), resolver);
- PolicyValidationUtils.validatePolicySets(policiedImpl);
-
- if ( implementation instanceof OperationsConfigurator ) {
- OperationsConfigurator opsConfigurator = (OperationsConfigurator)implementation;
- for ( ConfiguredOperation implOp : opsConfigurator.getConfiguredOperations() ) {
- resolveIntents(implOp.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(implOp, policiedImpl.getType());
-
- resolvePolicySets(implOp.getPolicySets(), resolver);
- PolicyValidationUtils.validatePolicySets(implOp,
- policiedImpl.getType(),
- policiedImpl.getApplicablePolicySets());
- }
- }
-
- for ( Service service : implementation.getServices() ) {
- resolveIntents(service.getRequiredIntents(), resolver);
- resolvePolicySets(service.getPolicySets(), resolver);
-
- for ( ConfiguredOperation svcOp : service.getConfiguredOperations() ) {
- resolveIntents(svcOp.getRequiredIntents(), resolver);
- resolvePolicySets(svcOp.getPolicySets(), resolver);
- }
- }
-
- for ( Reference reference : implementation.getReferences() ) {
- resolveIntents(reference.getRequiredIntents(), resolver);
- resolvePolicySets(reference.getPolicySets(), resolver);
- }
- }
-
- resolver.addModel(implementation);
- }
- }
- }
-
- if ( implementation instanceof IntentAttachPoint &&
- ((IntentAttachPoint)implementation).getType() != null &&
- ((IntentAttachPoint)implementation).getType().isUnresolved() ) {
- ((IntentAttachPoint)implementation).setType(
- resolver.resolveModel(IntentAttachPointType.class,
- ((IntentAttachPoint)implementation).getType()));
- }
- }
- return implementation;
- }
-
- /**
- * Resolve interface, callback interface and bindings on a list of contracts.
- * @param contracts the list of contracts
- * @param resolver the resolver to use to resolve models
- */
- protected <C extends Contract> void resolveContracts(List<C> contracts, ModelResolver resolver)
- throws ContributionResolveException {
- resolveContracts(null, contracts, resolver);
- }
-
-
- /**
- * Resolve interface, callback interface and bindings on a list of contracts.
- * @param parent element for the contracts
- * @param contracts the list of contracts
- * @param resolver the resolver to use to resolve models
- */
- protected <C extends Contract> void resolveContracts(Base parent, List<C> contracts, ModelResolver resolver)
- throws ContributionResolveException {
-
- String parentName = (parent instanceof Composite) ? ((Composite)parent).getName().toString() :
- (parent instanceof Component) ? ((Component)parent).getName() : "UNKNOWN";
-
- for (Contract contract : contracts) {
- try {
- //resolve the intents and policysets as they need to be copied over into the
- //child binding elements
- resolveIntents(contract.getRequiredIntents(), resolver);
- resolvePolicySets(contract.getPolicySets(), resolver);
- resolvePolicySets(contract.getApplicablePolicySets(), resolver);
-
- // Inherit the composite / component level applicable policy sets.
- if ( parent != null && parent instanceof PolicySetAttachPoint ) {
- addInheritedPolicySets(((PolicySetAttachPoint)parent).getApplicablePolicySets(), contract.getApplicablePolicySets());
- }
-
- for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
- resolveIntents(confOp.getRequiredIntents(), resolver);
- resolvePolicySets(confOp.getPolicySets(), resolver);
- resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
-
- //inherit applicable policy sets from parent contract
- addInheritedPolicySets(contract.getApplicablePolicySets(), confOp.getApplicablePolicySets());
- }
-
- // Resolve the interface contract
- InterfaceContract interfaceContract = contract.getInterfaceContract();
- if (interfaceContract != null) {
- extensionProcessor.resolve(interfaceContract, resolver);
- }
-
- // Resolve bindings
- for (int i = 0, n = contract.getBindings().size(); i < n; i++) {
- Binding binding = contract.getBindings().get(i);
- extensionProcessor.resolve(binding, resolver);
-
- if (binding instanceof IntentAttachPoint) {
- IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
-
- if ( policiedBinding.getType() != null && policiedBinding.getType().isUnresolved() ) {
- IntentAttachPointType resolved =
- resolver.resolveModel(IntentAttachPointType.class,
- policiedBinding.getType());
- policiedBinding.setType(resolved);
- }
-
- resolveIntents(policiedBinding.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
- }
-
- if (binding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
- resolvePolicySets(policiedBinding.getPolicySets(), resolver);
- //validate if attached policysets apply to the binding
- resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
- //inherit the applicable policysets from parent contract as whatever applies to that
- //applies to the binding as well
- addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
- PolicyValidationUtils.validatePolicySets(policiedBinding);
- }
-
- if (binding instanceof OperationsConfigurator) {
- OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
- for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
- resolveIntents(confOp.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
-
- resolvePolicySets(confOp.getPolicySets(), resolver);
- resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
- //inherit the applicable policysets from parent binding as whatever applies to that
- //applies to the binding as well
- addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
- confOp.getApplicablePolicySets());
- PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
- }
- }
- }
-
- // Resolve callback bindings
- if (contract.getCallback() != null) {
- resolveIntents(contract.getCallback().getRequiredIntents(), resolver);
- resolvePolicySets(contract.getCallback().getPolicySets(), resolver);
- resolvePolicySets(contract.getCallback().getApplicablePolicySets(), resolver);
- //inherit the contract's policy intents and policysets
- addInheritedPolicySets(contract.getApplicablePolicySets(), contract.getCallback().getApplicablePolicySets());
-
- for (int i = 0, n = contract.getCallback().getBindings().size(); i < n; i++) {
- Binding binding = contract.getCallback().getBindings().get(i);
- extensionProcessor.resolve(binding, resolver);
-
- if (binding instanceof IntentAttachPoint) {
- IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
-
- if ( policiedBinding.getType().isUnresolved() ) {
- IntentAttachPointType resolved =
- resolver.resolveModel(IntentAttachPointType.class,
- policiedBinding.getType());
- policiedBinding.setType(resolved);
- }
-
- resolveIntents(policiedBinding.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(policiedBinding, policiedBinding.getType());
- }
-
- if (binding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
- resolvePolicySets(policiedBinding.getPolicySets(), resolver);
- //validate if attached policysets apply to the binding
- resolvePolicySets(policiedBinding.getApplicablePolicySets(), resolver);
- //inherit the applicable policysets from parent contract as whatever applies to that
- //applies to the binding as well
- addInheritedPolicySets(contract.getApplicablePolicySets(), policiedBinding.getApplicablePolicySets());
- PolicyValidationUtils.validatePolicySets(policiedBinding);
- }
-
- if (binding instanceof OperationsConfigurator) {
- OperationsConfigurator opConfigurator = (OperationsConfigurator)binding;
- for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
- resolveIntents(confOp.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(confOp, ((PolicySetAttachPoint)binding).getType());
-
- resolvePolicySets(confOp.getPolicySets(), resolver);
- resolvePolicySets(confOp.getApplicablePolicySets(), resolver);
- //inherit the applicable policysets from parent binding as whatever applies to that
- //applies to the binding as well
- addInheritedPolicySets(((PolicySetAttachPoint)binding).getApplicablePolicySets(),
- confOp.getApplicablePolicySets());
- PolicyValidationUtils.validatePolicySets(confOp, ((PolicySetAttachPoint)binding).getType());
- }
- }
- }
- }
- } catch ( PolicyValidationException e ) {
- error("PolicyServiceValidationException", contract, contract.getName(), parentName, e.getMessage());
- //throw new ContributionResolveException("PolicyValidation exceptions when processing service/reference '"
- //+ contract.getName() + "' in '" + parentName + "'");
- }
- }
- }
-
- /**
- * Resolve interface and callback interface on a list of abstract contracts.
- * @param contracts the list of contracts
- * @param resolver the resolver to use to resolve models
- */
- protected <C extends AbstractContract> void resolveAbstractContracts(List<C> contracts, ModelResolver resolver)
- throws ContributionResolveException {
- for (AbstractContract contract : contracts) {
-
- // Resolve the interface contract
- InterfaceContract interfaceContract = contract.getInterfaceContract();
- if (interfaceContract != null) {
- extensionProcessor.resolve(interfaceContract, resolver);
- }
- }
- }
-
- /**
- * Returns a constrainingType attribute.
- * @param componentType
- * @return
- */
- protected XAttr writeConstrainingType(ComponentType componentType) {
- ConstrainingType constrainingType = componentType.getConstrainingType();
- if (constrainingType != null)
- return new XAttr(Constants.CONSTRAINING_TYPE, constrainingType.getName());
- else
- return null;
- }
-
- /**
- * Read a property value into a DOM document.
- * @param element
- * @param type
- * @param reader
- * @return
- * @throws XMLStreamException
- * @throws ContributionReadException
- * @throws ParserConfigurationException
- */
- protected Document readPropertyValue(QName element, QName type, XMLStreamReader reader) throws XMLStreamException,
- ContributionReadException {
-
- Document document;
- try {
- if (documentBuilderFactory == null) {
- documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- }
- document = documentBuilderFactory.newDocumentBuilder().newDocument();
- } catch (ParserConfigurationException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", documentBuilderFactory, ce);
- throw ce;
- }
-
- // root element has no namespace and local name "value"
- Element root = document.createElementNS(null, "value");
- if (type != null) {
- org.w3c.dom.Attr xsi = document.createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
- xsi.setValue(W3C_XML_SCHEMA_INSTANCE_NS_URI);
- root.setAttributeNodeNS(xsi);
-
- String prefix = type.getPrefix();
- if (prefix == null || prefix.length() == 0) {
- prefix = "ns";
- }
-
- declareNamespace(root, prefix, type.getNamespaceURI());
-
- org.w3c.dom.Attr xsiType = document.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
- xsiType.setValue(prefix + ":" + type.getLocalPart());
- root.setAttributeNodeNS(xsiType);
- }
- document.appendChild(root);
-
- loadElement(reader, root);
- return document;
- }
-
- /**
- * Create a DOM element
- * @param document
- * @param name
- * @return
- */
- private Element createElement(Document document, QName name) {
- String prefix = name.getPrefix();
- String qname =
- (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name.getLocalPart();
- return document.createElementNS(name.getNamespaceURI(), qname);
- }
-
- /**
- * Declare a namespace.
- * @param element
- * @param prefix
- * @param ns
- */
- private void declareNamespace(Element element, String prefix, String ns) {
- if (ns == null) {
- ns = "";
- }
- if (prefix == null) {
- prefix = "";
- }
- String qname = null;
- if ("".equals(prefix)) {
- qname = "xmlns";
- } else {
- qname = "xmlns:" + prefix;
- }
- Node node = element;
- boolean declared = false;
- while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
- NamedNodeMap attrs = node.getAttributes();
- if (attrs == null) {
- break;
- }
- Node attr = attrs.getNamedItem(qname);
- if (attr != null) {
- declared = ns.equals(attr.getNodeValue());
- break;
- }
- node = node.getParentNode();
- }
- if (!declared) {
- org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
- attr.setValue(ns);
- element.setAttributeNodeNS(attr);
- }
- }
-
- /**
- * Load a property value specification from an StAX stream into a DOM
- * Document. Only elements, text and attributes are processed; all comments
- * and other whitespace are ignored.
- *
- * @param reader the stream to read from
- * @param root the DOM node to load
- * @throws javax.xml.stream.XMLStreamException
- */
- private void loadElement(XMLStreamReader reader, Element root) throws XMLStreamException {
- Document document = root.getOwnerDocument();
- Node current = root;
- while (true) {
- switch (reader.next()) {
- case XMLStreamConstants.START_ELEMENT:
- QName name = reader.getName();
- Element child = createElement(document, name);
-
- // push the new element and make it the current one
- current.appendChild(child);
- current = child;
-
- int count = reader.getNamespaceCount();
- for (int i = 0; i < count; i++) {
- String prefix = reader.getNamespacePrefix(i);
- String ns = reader.getNamespaceURI(i);
- declareNamespace(child, prefix, ns);
- }
-
- if (!"".equals(name.getNamespaceURI())) {
- declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
- }
-
- // add the attributes for this element
- count = reader.getAttributeCount();
- for (int i = 0; i < count; i++) {
- String ns = reader.getAttributeNamespace(i);
- String prefix = reader.getAttributePrefix(i);
- String qname = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
- if (prefix != null && prefix.length() != 0) {
- qname = prefix + ":" + qname;
- }
- child.setAttributeNS(ns, qname, value);
- if (ns != null) {
- declareNamespace(child, prefix, ns);
- }
- }
-
- break;
- case XMLStreamConstants.CDATA:
- current.appendChild(document.createCDATASection(reader.getText()));
- break;
- case XMLStreamConstants.CHARACTERS:
- current.appendChild(document.createTextNode(reader.getText()));
- break;
- case XMLStreamConstants.END_ELEMENT:
- // if we are back at the root then we are done
- if (current == root) {
- return;
- }
-
- // pop the element off the stack
- current = current.getParentNode();
- }
- }
- }
-
- /**
- * Resolve policy intents attached to a specific SCA Artifact
- * @param policyIntents list of policy intents
- * @param resolver
- */
- protected void resolveIntents(List<Intent> policyIntents, ModelResolver resolver) {
- List<Intent> requiredIntents = new ArrayList<Intent>();
- Intent resolvedIntent = null;
- for (Intent intent : policyIntents) {
- resolvedIntent = resolver.resolveModel(Intent.class, intent);
- requiredIntents.add(resolvedIntent);
- }
- policyIntents.clear();
- policyIntents.addAll(requiredIntents);
- }
-
- /**
- * Resolve policy sets attached to a specific SCA Construct
- * @param policySets list of attached policy sets
- * @param resolver
- */
- protected void resolvePolicySets(List<PolicySet> policySets, ModelResolver resolver) {
- List<PolicySet> resolvedPolicySets = new ArrayList<PolicySet>();
- PolicySet resolvedPolicySet = null;
- for (PolicySet policySet : policySets) {
- if (policySet.isUnresolved()) {
- resolvedPolicySet = resolver.resolveModel(PolicySet.class, policySet);
- resolvedPolicySets.add(resolvedPolicySet);
- } else {
- resolvedPolicySets.add(policySet);
- }
- }
- policySets.clear();
- policySets.addAll(resolvedPolicySets);
- }
-
- /**
- * Write the value of a property
- * @param document
- * @param element
- * @param type
- * @param writer
- * @throws XMLStreamException
- */
- protected void writePropertyValue(Object propertyValue, QName element, QName type, XMLStreamWriter writer)
- throws XMLStreamException {
-
- if (propertyValue instanceof Document) {
- Document document = (Document)propertyValue;
- NodeList nodeList = document.getDocumentElement().getChildNodes();
-
- for (int item = 0; item < nodeList.getLength(); ++item) {
- Node node = nodeList.item(item);
- int nodeType = node.getNodeType();
- if (nodeType == Node.ELEMENT_NODE) {
- XMLStreamReader reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(node));
-
- while (reader.hasNext()) {
- switch (reader.next()) {
- case XMLStreamConstants.START_ELEMENT:
- QName name = reader.getName();
- writer.writeStartElement(name.getPrefix(), name.getLocalPart(), name.getNamespaceURI());
-
- int namespaces = reader.getNamespaceCount();
- for (int i = 0; i < namespaces; i++) {
- String prefix = reader.getNamespacePrefix(i);
- String ns = reader.getNamespaceURI(i);
- writer.writeNamespace(prefix, ns);
- }
-
- if (!"".equals(name.getNamespaceURI())) {
- writer.writeNamespace(name.getPrefix(), name.getNamespaceURI());
- }
-
- // add the attributes for this element
- namespaces = reader.getAttributeCount();
- for (int i = 0; i < namespaces; i++) {
- String ns = reader.getAttributeNamespace(i);
- String prefix = reader.getAttributePrefix(i);
- String qname = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
-
- writer.writeAttribute(prefix, ns, qname, value);
- }
-
- break;
- case XMLStreamConstants.CDATA:
- writer.writeCData(reader.getText());
- break;
- case XMLStreamConstants.CHARACTERS:
- writer.writeCharacters(reader.getText());
- break;
- case XMLStreamConstants.END_ELEMENT:
- writer.writeEndElement();
- break;
- }
- }
- } else {
- writer.writeCharacters(node.getTextContent());
- }
- }
- }
- }
-
- protected void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
- if (sourceList != null) {
- targetList.addAll(sourceList);
- }
- }
-
- protected void addInheritedPolicySets(List<PolicySet> sourceList, List<PolicySet> targetList) {
- if (sourceList != null) {
- targetList.addAll(sourceList);
- }
- }
-
- /**
- *
- * @param reader
- * @param elementName
- * @param extensible
- * @param extensionAttributeProcessor
- * @throws ContributionReadException
- * @throws XMLStreamException
- */
- protected void readExtendedAttributes(XMLStreamReader reader, Extensible extensible) throws ContributionReadException, XMLStreamException {
- super.readExtendedAttributes(reader, extensible, extensionAttributeProcessor, extensionFactory);
- }
-
-
- /*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-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.java
deleted file mode 100644
index 7681115149..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeDocumentProcessor.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.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-
-/**
- * A componentType processor.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ComponentType> {
- private XMLInputFactory inputFactory;
-
- /**
- * Constructs a new componentType processor.
- * @param factory
- * @param policyFactory
- * @param registry
- */
- public ComponentTypeDocumentProcessor(StAXArtifactProcessor staxProcessor,
- XMLInputFactory inputFactory,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = inputFactory;
- }
-
- /**
- * Constructs a new componentType processor.
- * @param modelFactories
- * @param staxProcessor
- */
- public ComponentTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
- }
-
- public ComponentType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
-
- // Create a stream reader
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- urlStream = connection.getInputStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
- reader.nextTag();
-
- // Reader the componentType model
- ComponentType componentType = (ComponentType)extensionProcessor.read(reader);
- if (componentType != null) {
- componentType.setURI(uri.toString());
- }
-
- // For debugging purposes, write it back to XML
-// if (componentType != null) {
-// try {
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
-// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
-// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
-// extensionProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
-// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
-// OutputFormat format = new OutputFormat();
-// format.setIndenting(true);
-// format.setIndent(2);
-// XMLSerializer serializer = new XMLSerializer(System.out, format);
-// serializer.serialize(document);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-
- return componentType;
-
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } catch (IOException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ComponentType componentType, ModelResolver resolver) throws ContributionResolveException {
- extensionProcessor.resolve(componentType, resolver);
- }
-
- public String getArtifactType() {
- return ".componentType";
- }
-
- public Class<ComponentType> getModelType() {
- return ComponentType.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeModelResolver.java
deleted file mode 100644
index d0d11cd02b..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ComponentTypeModelResolver implements ModelResolver {
- private Contribution contribution;
- private Map<String, ComponentType> map = new HashMap<String, ComponentType>();
-
- public ComponentTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- ComponentType componentType = (ComponentType)resolved;
- map.put(componentType.getURI(), componentType);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((ComponentType)resolved).getURI());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- //get componentType artifact URI
- String uri = ((ComponentType)unresolved).getURI();
- if (uri == null) {
- return (T)unresolved;
- }
-
- //lookup the componentType
- ComponentType resolved = (ComponentType) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
-
- //If not found, delegate the resolution to the imports (in this case based on the java imports)
- //compute the package name from the componentType URI
- if (unresolved instanceof ComponentType) {
- //FIXME The core assembly model now depends on java imports to
- // resolve componentTypes of all kinds, this is not right at all!!!
- int s = uri.lastIndexOf('/');
- if (s != -1) {
- String packageName = uri.substring(0, uri.lastIndexOf("/"));
- for (Import import_ : this.contribution.getImports()) {
- if (import_ instanceof JavaImport) {
- JavaImport javaImport = (JavaImport)import_;
- //check the import location against the computed package name from the componentType URI
- if (javaImport.getPackage().equals(packageName)) {
- // Delegate the resolution to the import resolver
- resolved = javaImport.getModelResolver().resolveModel(ComponentType.class, (ComponentType)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- }
- }
-
- return (T)unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
deleted file mode 100644
index 964116a0c2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ComponentTypeProcessor.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.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.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.w3c.dom.Document;
-
-/**
- * A componentType processor.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ComponentType> {
-
- /**
- * Constructs a new componentType processor.
- * @param assemblyFactory
- * @param policyFactory
- * @param registry
- */
- public ComponentTypeProcessor(AssemblyFactory assemblyFactory,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- super(assemblyFactory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor);
- }
-
- /**
- * Constructs a new componentType processor.
- *
- * @param modelFactories
- * @param extensionProcessor
- */
- public ComponentTypeProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- super(modelFactories.getFactory(AssemblyFactory.class),
- modelFactories.getFactory(ExtensionFactory.class),
- modelFactories.getFactory(PolicyFactory.class),
- extensionProcessor,
- extensionAttributeProcessor,
- monitor);
- }
-
- public ComponentType read(XMLStreamReader reader) throws ContributionReadException {
- ComponentType componentType = null;
- Service service = null;
- Reference reference = null;
- Contract contract = null;
- Property property = null;
- Callback callback = null;
- QName name = null;
-
- try {
- // Read the componentType document
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
-
- if (Constants.COMPONENT_TYPE_QNAME.equals(name)) {
-
- // Read a <componentType>
- componentType = assemblyFactory.createComponentType();
- componentType.setConstrainingType(readConstrainingType(reader));
-
- } else if (Constants.SERVICE_QNAME.equals(name)) {
-
- // Read a <service>
- service = assemblyFactory.createService();
- contract = service;
- service.setName(getString(reader, Constants.NAME));
- componentType.getServices().add(service);
- policyProcessor.readPolicies(service, reader);
-
- } else if (Constants.REFERENCE_QNAME.equals(name)) {
-
- // Read a <reference>
- reference = assemblyFactory.createReference();
- contract = reference;
- reference.setName(getString(reader, Constants.NAME));
- reference.setWiredByImpl(getBoolean(reader, Constants.WIRED_BY_IMPL));
- readMultiplicity(reference, reader);
- readTargets(reference, reader);
- componentType.getReferences().add(reference);
- policyProcessor.readPolicies(reference, reader);
-
- } else if (Constants.PROPERTY_QNAME.equals(name)) {
-
- // Read a <property>
- property = assemblyFactory.createProperty();
- readAbstractProperty(property, reader);
- policyProcessor.readPolicies(property, reader);
-
- // Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
- property.setValue(value);
-
- componentType.getProperties().add(property);
-
- } else if (Constants.IMPLEMENTATION_QNAME.equals(name)) {
-
- // Read an <implementation> element
- policyProcessor.readPolicies(componentType, reader);
-
- } else if (Constants.CALLBACK_QNAME.equals(name)) {
-
- // Read a <callback>
- callback = assemblyFactory.createCallback();
- contract.setCallback(callback);
- policyProcessor.readPolicies(callback, reader);
-
- } else if (OPERATION_QNAME.equals(name)) {
-
- // Read an <operation>
- Operation operation = new OperationImpl();
- operation.setName(getString(reader, NAME));
- operation.setUnresolved(true);
- if (callback != null) {
- policyProcessor.readPolicies(callback, operation, reader);
- } else {
- policyProcessor.readPolicies(contract, operation, reader);
- }
- } else {
-
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof InterfaceContract) {
-
- // <service><interface> and <reference><interface>
- contract.setInterfaceContract((InterfaceContract)extension);
-
- } else if (extension instanceof Binding) {
-
- // <service><binding> and <reference><binding>
- if (callback != null) {
- callback.getBindings().add((Binding)extension);
- } else {
- contract.getBindings().add((Binding)extension);
- }
- } else {
-
- // Add the extension element to the current element
- if (callback != null) {
- callback.getExtensions().add(extension);
- } else if (contract != null) {
- contract.getExtensions().add(extension);
- } else if (property != null) {
- property.getExtensions().add(extension);
- } else {
- if (componentType instanceof Extensible) {
- ((Extensible)componentType).getExtensions().add(extension);
- }
- }
- }
- }
- }
- break;
-
- case END_ELEMENT:
- name = reader.getName();
-
- // Clear current state when reading reaching end element
- if (SERVICE_QNAME.equals(name)) {
- service = null;
- contract = null;
- } else if (REFERENCE_QNAME.equals(name)) {
- reference = null;
- contract = null;
- } else if (PROPERTY_QNAME.equals(name)) {
- property = null;
- } else if (CALLBACK_QNAME.equals(name)) {
- callback = null;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- 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()),
- writeMultiplicity(reference),
- 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-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
deleted file mode 100644
index 6abc28adde..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.IOException;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-
-/**
- * A composite processor.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<Composite> {
- private XMLInputFactory inputFactory;
- private DocumentBuilderFactory documentBuilderFactory;
- private List scaDefnSink;
- private Collection<PolicySet> domainPolicySets = null;
- private int scaDefnsCount = 0;
-
- /**
- * Construct a new composite processor
- * @param staxProcessor
- * @param inputFactory
- * @param scaDefnsSink
- * @param monitor
- */
- @Deprecated
- public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor,
- XMLInputFactory inputFactory,
- List scaDefnsSink,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = inputFactory;
- this.scaDefnSink = scaDefnsSink;
- }
-
-
- /**
- * Construct a new composite processor
- * @param staxProcessor
- * @param inputFactory
- * @param documentBuilderFactory
- * @param scaDefnsSink
- * @param monitor
- */
- public CompositeDocumentProcessor(StAXArtifactProcessor staxProcessor,
- XMLInputFactory inputFactory,
- DocumentBuilderFactory documentBuilderFactory,
- List scaDefnsSink,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.documentBuilderFactory = documentBuilderFactory;
- this.inputFactory = inputFactory;
- this.scaDefnSink = scaDefnsSink;
- }
-
-
- /**
- * Construct a new composite processor
- * @param modelFactories
- * @param staxProcessor
- * @param monitor
- */
- public CompositeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
- this.documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
- }
-
- public Composite read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream scdlStream = null;
- try {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- try {
- scdlStream = connection.getInputStream();
- } catch (IOException e) {
- if (e.getClass() == IOException.class && connection instanceof HttpURLConnection
- && ((HttpURLConnection)connection).getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) {
- error("HttpServerError", url, ((HttpURLConnection)connection).getResponseMessage());
- }
- throw e;
- }
- } catch (IOException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", url, e);
- throw ce;
- }
- return read(uri, scdlStream);
- }
-
- public Composite read(URI uri, InputStream scdlStream) throws ContributionReadException {
- try {
- if (scaDefnSink != null ) {
- fillDomainPolicySets(scaDefnSink);
- }
-
- Composite composite = null;
-
- byte[] transformedArtifactContent;
- try {
- if ( domainPolicySets != null ) {
- transformedArtifactContent =
- PolicyComputationUtils.addApplicablePolicySets(scdlStream, domainPolicySets, documentBuilderFactory);
- scdlStream = new ByteArrayInputStream(transformedArtifactContent);
-
- // For debugging purposes, write out the XML with applicablePolicySets added
-/*
- try {
- scdlStream.mark(0);
- ByteArrayOutputStream tmpOutput = new ByteArrayOutputStream();
- while(scdlStream.available()!= 0){
- tmpOutput.write(scdlStream.read());
- }
- System.out.println(tmpOutput);
- scdlStream.reset();
-
- } catch (Exception e){
- e.printStackTrace();
- }
-*/
- }
- } catch ( IOException e ) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", scdlStream, e);
- throw ce;
- } catch ( Exception e ) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", scdlStream, e);
- //throw ce;
- }
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(scdlStream);
-
- reader.nextTag();
-
- // Read the composite model
- composite = (Composite)extensionProcessor.read(reader);
- if (composite != null) {
- composite.setURI(uri.toString());
- }
-
- // For debugging purposes, write it back to XML
-/*
- if (composite != null) {
- try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
- extensionProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setIndent(2);
- XMLSerializer serializer = new XMLSerializer(System.out, format);
- serializer.serialize(document);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- */
-
- return composite;
-
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, e);
- throw ce;
- } finally {
- try {
- if (scdlStream != null) {
- scdlStream.close();
- scdlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
- if (composite != null)
- extensionProcessor.resolve(composite, resolver);
- }
-
- public String getArtifactType() {
- return ".composite";
- }
-
- public Class<Composite> getModelType() {
- return Composite.class;
- }
-
- private void fillDomainPolicySets(List scaDefnsSink) {
- Map<QName, PolicySet> domainPolicySetMap = null;
- if ( scaDefnsSink.size() > scaDefnsCount ) {
- //if ( !scaDefnsSink.isEmpty() ) {
- domainPolicySetMap = new Hashtable<QName, PolicySet>();
-
- if ( domainPolicySets != null ) {
- for ( PolicySet policySet : domainPolicySets ) {
- domainPolicySetMap.put(policySet.getName(), policySet);
- }
- }
-
- for ( Object object : scaDefnsSink ) {
- if ( object instanceof SCADefinitions ) {
- for ( PolicySet policySet : ((SCADefinitions)object).getPolicySets() ) {
- domainPolicySetMap.put( policySet.getName(), policySet);
- }
- }
- }
- domainPolicySets = domainPolicySetMap.values();
- //scaDefnsSink.clear();
- scaDefnsCount = scaDefnsSink.size();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeModelResolver.java
deleted file mode 100644
index 72744259f6..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class CompositeModelResolver implements ModelResolver {
-
- private Contribution contribution;
- private Map<QName, Composite> map = new HashMap<QName, Composite>();
-
- public CompositeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- Composite composite = (Composite)resolved;
- map.put(composite.getName(), composite);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((Composite)resolved).getName());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a definition for the given namespace
- QName qname = ((Composite)unresolved).getName();
- Composite resolved = (Composite) map.get(qname);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
-
- // No definition found, delegate the resolution to the imports
- for (Import import_ : this.contribution.getImports()) {
- if (import_ instanceof NamespaceImport) {
- NamespaceImport namespaceImport = (NamespaceImport)import_;
- if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
-
- // Delegate the resolution to the import resolver
- resolved = namespaceImport.getModelResolver().resolveModel(Composite.class, (Composite)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- return (T)unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
deleted file mode 100644
index f34adbc581..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
+++ /dev/null
@@ -1,1243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-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.assembly.impl.CompositeImpl;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
-import org.w3c.dom.Document;
-
-/**
- * A composite processor.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<Composite> {
- // FIXME: to be refactored
- private XPathFactory xPathFactory = XPathFactory.newInstance();
-
- /**
- * Construct a new composite processor
- *
- * @param extensionPoints
- * @param extensionProcessor
- */
- public CompositeProcessor(ExtensionPointRegistry extensionPoints,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
-
- this(modelFactories(extensionPoints),
- extensionProcessor,
- extensionAttributeProcessor,
- monitor(extensionPoints));
-
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- }
-
- /**
- * Constructs a new composite processor
- *
- * @param modelFactories
- * @param extensionProcessor
- * @param monitor
- */
- private CompositeProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
-
- super(modelFactories.getFactory(ContributionFactory.class),
- modelFactories.getFactory(AssemblyFactory.class),
- modelFactories.getFactory(ExtensionFactory.class),
- modelFactories.getFactory(PolicyFactory.class),
- extensionProcessor,
- extensionAttributeProcessor,
- monitor);
-
- this.extensionAttributeProcessor = extensionAttributeProcessor;
-
- }
-
- /**
- * Construct a new composite processor
- *
- * @param contributionFactory
- * @param assemblyFactory
- * @param policyFactory
- * @param extensionProcessor
- */
- public CompositeProcessor(ContributionFactory contributionFactory,
- AssemblyFactory assemblyFactory,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- super(contributionFactory, assemblyFactory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor);
- }
-
- public Composite read(XMLStreamReader reader) throws ContributionReadException {
- Composite composite = null;
- Composite include = null;
- Component component = null;
- Property property = null;
- ComponentService componentService = null;
- ComponentReference componentReference = null;
- ComponentProperty componentProperty = null;
- CompositeService compositeService = null;
- CompositeReference compositeReference = null;
- Contract contract = null;
- Wire wire = null;
- Callback callback = null;
- QName name = null;
-
- try {
- // Read the composite document
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
-
- if (COMPOSITE_QNAME.equals(name)) {
-
- // Read a <composite>
- composite = assemblyFactory.createComposite();
-
- composite.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
-
- if(!isSet(reader, TARGET_NAMESPACE)){
- // spec says that a composite must have a namespace
- warning("NoCompositeNamespace", composite, composite.getName().toString());
- }
-
- if(isSet(reader, AUTOWIRE)) {
- composite.setAutowire(getBoolean(reader, AUTOWIRE));
- }
-
- //handle extension attributes
- this.readExtendedAttributes(reader, composite);
-
- composite.setLocal(getBoolean(reader, LOCAL));
- composite.setConstrainingType(readConstrainingType(reader));
- policyProcessor.readPolicies(composite, reader);
-
- } else if (INCLUDE_QNAME.equals(name)) {
-
- // Read an <include>
- include = assemblyFactory.createComposite();
- include.setName(getQName(reader, NAME));
- include.setURI(getString(reader, URI));
- include.setUnresolved(true);
- composite.getIncludes().add(include);
-
- } else if (SERVICE_QNAME.equals(name)) {
- if (component != null) {
-
- // Read a <component><service>
- componentService = assemblyFactory.createComponentService();
- contract = componentService;
- componentService.setName(getString(reader, NAME));
-
- //handle extension attributes
- this.readExtendedAttributes(reader, componentService);
-
- component.getServices().add(componentService);
- policyProcessor.readPolicies(contract, reader);
- } else {
-
- // Read a <composite><service>
- compositeService = assemblyFactory.createCompositeService();
- contract = compositeService;
- compositeService.setName(getString(reader, NAME));
-
- String promoted = getString(reader, PROMOTE);
- if (promoted != null) {
- String promotedComponentName;
- String promotedServiceName;
- int s = promoted.indexOf('/');
- if (s == -1) {
- promotedComponentName = promoted;
- promotedServiceName = null;
- } else {
- promotedComponentName = promoted.substring(0, s);
- promotedServiceName = promoted.substring(s + 1);
- }
-
- Component promotedComponent = assemblyFactory.createComponent();
- promotedComponent.setUnresolved(true);
- promotedComponent.setName(promotedComponentName);
- compositeService.setPromotedComponent(promotedComponent);
-
- ComponentService promotedService = assemblyFactory.createComponentService();
- promotedService.setUnresolved(true);
- promotedService.setName(promotedServiceName);
- compositeService.setPromotedService(promotedService);
- }
-
- //handle extension attributes
- this.readExtendedAttributes(reader, compositeService);
-
- composite.getServices().add(compositeService);
- policyProcessor.readPolicies(contract, reader);
- }
-
- } else if (REFERENCE_QNAME.equals(name)) {
- if (component != null) {
- // Read a <component><reference>
- componentReference = assemblyFactory.createComponentReference();
- contract = componentReference;
- componentReference.setName(getString(reader, NAME));
- readMultiplicity(componentReference, reader);
- if (isSet(reader, AUTOWIRE)) {
- componentReference.setAutowire(getBoolean(reader, AUTOWIRE));
- }
- readTargets(componentReference, reader);
- componentReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
-
- //handle extension attributes
- this.readExtendedAttributes(reader, componentReference);
-
- component.getReferences().add(componentReference);
- policyProcessor.readPolicies(contract, reader);
- } else {
- // Read a <composite><reference>
- compositeReference = assemblyFactory.createCompositeReference();
- contract = compositeReference;
- compositeReference.setName(getString(reader, NAME));
- readMultiplicity(compositeReference, reader);
- readTargets(compositeReference, reader);
- String promote = reader.getAttributeValue(null, Constants.PROMOTE);
- if (promote != null) {
- for (StringTokenizer tokens = new StringTokenizer(promote); tokens.hasMoreTokens();) {
- ComponentReference promotedReference =
- assemblyFactory.createComponentReference();
- promotedReference.setUnresolved(true);
- promotedReference.setName(tokens.nextToken());
- compositeReference.getPromotedReferences().add(promotedReference);
- }
- }
- compositeReference.setWiredByImpl(getBoolean(reader, WIRED_BY_IMPL));
-
- //handle extension attributes
- this.readExtendedAttributes(reader, compositeReference);
-
- composite.getReferences().add(compositeReference);
- policyProcessor.readPolicies(contract, reader);
- }
-
- } else if (PROPERTY_QNAME.equals(name)) {
- if (component != null) {
-
- // Read a <component><property>
- componentProperty = assemblyFactory.createComponentProperty();
- property = componentProperty;
- String source = getString(reader, SOURCE);
- if(source!=null) {
- source = source.trim();
- }
- componentProperty.setSource(source);
- if (source != null) {
- // $<name>/...
- if (source.charAt(0) == '$') {
- int index = source.indexOf('/');
- if (index == -1) {
- // Tolerating $prop
- source = source + "/";
- index = source.length() - 1;
- }
- source = source.substring(index + 1);
- if ("".equals(source)) {
- source = ".";
- }
- }
- XPath xpath = xPathFactory.newXPath();
- xpath.setNamespaceContext(reader.getNamespaceContext());
- try {
- componentProperty.setSourceXPathExpression(xpath.compile(source));
- } catch (XPathExpressionException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", xpath, ce);
- //throw ce;
- }
- }
- componentProperty.setFile(getString(reader, FILE));
-
- //handle extension attributes
- this.readExtendedAttributes(reader, componentProperty);
-
- policyProcessor.readPolicies(property, reader);
- readAbstractProperty(componentProperty, reader);
-
- // Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
- property.setValue(value);
-
- component.getProperties().add(componentProperty);
- } else {
-
- // Read a <composite><property>
- property = assemblyFactory.createProperty();
- policyProcessor.readPolicies(property, reader);
- readAbstractProperty(property, reader);
-
- // Read the property value
- Document value = readPropertyValue(property.getXSDElement(), property.getXSDType(), reader);
- property.setValue(value);
-
- composite.getProperties().add(property);
- }
-
- // TUSCANY-1949
- // If the property doesn't have a value, the END_ELEMENT event is read by the readPropertyValue
- if (reader.getEventType() == END_ELEMENT && PROPERTY_QNAME.equals(reader.getName())) {
- property = null;
- componentProperty = null;
- }
-
- } else if (COMPONENT_QNAME.equals(name)) {
-
- // Read a <component>
- component = assemblyFactory.createComponent();
- component.setName(getString(reader, NAME));
- if (isSet(reader, AUTOWIRE)) {
- component.setAutowire(getBoolean(reader, AUTOWIRE));
- }
- if (isSet(reader, URI)) {
- component.setURI(getString(reader, URI));
- }
-
- //handle extension attributes
- this.readExtendedAttributes(reader, component);
-
- component.setConstrainingType(readConstrainingType(reader));
- composite.getComponents().add(component);
- policyProcessor.readPolicies(component, reader);
-
- } else if (WIRE_QNAME.equals(name)) {
-
- // Read a <wire>
- wire = assemblyFactory.createWire();
- ComponentReference source = assemblyFactory.createComponentReference();
- source.setUnresolved(true);
- source.setName(getString(reader, SOURCE));
- wire.setSource(source);
-
- ComponentService target = assemblyFactory.createComponentService();
- target.setUnresolved(true);
- target.setName(getString(reader, TARGET));
- wire.setTarget(target);
-
- //handle extension attributes
- this.readExtendedAttributes(reader, wire);
-
- composite.getWires().add(wire);
- policyProcessor.readPolicies(wire, reader);
-
- } else if (CALLBACK_QNAME.equals(name)) {
-
- // Read a <callback>
- callback = assemblyFactory.createCallback();
- contract.setCallback(callback);
-
- //handle extension attributes
- this.readExtendedAttributes(reader, 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);
-
- //handle extension attributes
- this.readExtendedAttributes(reader, implementation);
-
- component.setImplementation(implementation);
- policyProcessor.readPolicies(implementation, reader);
- } else {
-
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof InterfaceContract) {
-
- // <service><interface> and
- // <reference><interface>
- if (contract != null) {
- contract.setInterfaceContract((InterfaceContract)extension);
- } else {
- if (name.getNamespaceURI().equals(SCA10_NS)) {
- error("UnexpectedInterfaceElement", extension);
- //throw new ContributionReadException("Unexpected <interface> element found. It should appear inside a <service> or <reference> element");
- } else {
- composite.getExtensions().add(extension);
- }
- }
- } else if (extension instanceof Binding) {
- if ( extension instanceof PolicySetAttachPoint ) {
- IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
- bindingType.setName(name);
- bindingType.setUnresolved(true);
- ((PolicySetAttachPoint)extension).setType(bindingType);
- }
- // <service><binding> and
- // <reference><binding>
- if (callback != null) {
- callback.getBindings().add((Binding)extension);
- } else {
- if (contract != null) {
- contract.getBindings().add((Binding)extension);
- } else {
- if (name.getNamespaceURI().equals(SCA10_NS)) {
- error("UnexpectedBindingElement", extension);
- //throw new ContributionReadException("Unexpected <binding> element found. It should appear inside a <service> or <reference> element");
- } else {
- composite.getExtensions().add(extension);
- }
- }
- }
-
- } else if (extension instanceof Implementation) {
- if ( extension instanceof PolicySetAttachPoint ) {
- IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
- implType.setName(name);
- implType.setUnresolved(true);
- ((PolicySetAttachPoint)extension).setType(implType);
- }
- // <component><implementation>
- if (component != null) {
- component.setImplementation((Implementation)extension);
- } else {
- if (name.getNamespaceURI().equals(SCA10_NS)) {
- error("UnexpectedImplementationElement", extension);
- //throw new ContributionReadException("Unexpected <implementation> element found. It should appear inside a <component> element");
- } else {
- composite.getExtensions().add(extension);
- }
- }
- } else {
-
- // Add the extension element to the current
- // element
- if (callback != null) {
- callback.getExtensions().add(extension);
- } else if (contract != null) {
- contract.getExtensions().add(extension);
- } else if (property != null) {
- property.getExtensions().add(extension);
- } else if (component != null) {
- component.getExtensions().add(extension);
- } else {
- composite.getExtensions().add(extension);
- }
- }
- }
- }
- break;
-
- case XMLStreamConstants.CHARACTERS:
- break;
-
- case END_ELEMENT:
- name = reader.getName();
-
- // Clear current state when reading reaching end element
- if (SERVICE_QNAME.equals(name)) {
- componentService = null;
- compositeService = null;
- contract = null;
- } else if (INCLUDE_QNAME.equals(name)) {
- include = null;
- } else if (REFERENCE_QNAME.equals(name)) {
- componentReference = null;
- compositeReference = null;
- contract = null;
- } else if (PROPERTY_QNAME.equals(name)) {
- componentProperty = null;
- property = null;
- } else if (COMPONENT_QNAME.equals(name)) {
- component = null;
- } else if (WIRE_QNAME.equals(name)) {
- wire = null;
- } else if (CALLBACK_QNAME.equals(name)) {
- callback = null;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("ContributionReadException", reader, ex);
- }
-
- 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(LOCAL, composite.isLocal() ? Boolean.TRUE : null),
- new XAttr(AUTOWIRE, composite.getAutowire()),
- policyProcessor.writePolicies(composite));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, composite, extensionAttributeProcessor);
-
- // Write <include> elements
- for (Composite include : composite.getIncludes()) {
- String uri = include.isUnresolved()? include.getURI() : null;
- writeStart(writer,
- INCLUDE,
- new XAttr(NAME, include.getName()),
- new XAttr(URI, uri));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, include, extensionAttributeProcessor);
-
- writeEnd(writer);
- }
-
- // Write <service> elements
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
- Component promotedComponent = compositeService.getPromotedComponent();
- ComponentService promotedService = compositeService.getPromotedService();
- String promote;
- if (promotedService != null) {
- if (promotedService.getName() != null) {
- promote = promotedComponent.getName() + '/' + promotedService.getName();
- } else {
- promote = promotedComponent.getName();
- }
- } else {
- promote = null;
- }
- writeStart(writer, SERVICE, new XAttr(NAME, service.getName()), new XAttr(PROMOTE, promote),
- policyProcessor.writePolicies(service));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, service, extensionAttributeProcessor);
-
-
- // Write service interface
- extensionProcessor.write(service.getInterfaceContract(), writer);
-
- // Write bindings
- for (Binding binding : service.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write <callback> element
- if (service.getCallback() != null) {
- Callback callback = service.getCallback();
- writeStart(writer, CALLBACK,
- policyProcessor.writePolicies(callback));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
-
- // Write callback bindings
- for (Binding binding : callback.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write extensions
- for (Object extension : service.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write <component> elements
- for (Component component : composite.getComponents()) {
- writeStart(writer, COMPONENT, new XAttr(NAME, component.getName()),
- new XAttr(URI, component.getURI()),
- new XAttr(AUTOWIRE, component.getAutowire()),
- policyProcessor.writePolicies(component));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, component, extensionAttributeProcessor);
-
- // Write the component implementation
- Implementation implementation = component.getImplementation();
- // check that we really have CompositeImpl and treat this specially. Some
- // extension extend CompositeImpl and we want these to be treated by the extension
- // processor.
- if ((implementation != null ) && (implementation.getClass().equals(CompositeImpl.class))) {
- writeStart(writer, IMPLEMENTATION_COMPOSITE, new XAttr(NAME, ((Composite)implementation).getName()));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, (Composite)implementation, extensionAttributeProcessor);
-
- writeEnd(writer);
- } else {
- extensionProcessor.write(component.getImplementation(), writer);
- }
-
- for (Object extension : component.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- // Write <service> elements
- for (ComponentService service : component.getServices()) {
- if (service.isCallback() == false){
- writeStart(writer, SERVICE, new XAttr(NAME, service.getName()),
- policyProcessor.writePolicies(service));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, service, extensionAttributeProcessor);
-
- // Write service interface
- extensionProcessor.write(service.getInterfaceContract(), writer);
-
- // Write bindings
- for (Binding binding : service.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write <callback> element
- if (service.getCallback() != null) {
- Callback callback = service.getCallback();
- writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
-
- // Write bindings
- for (Binding binding : callback.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write extensions
- for (Object extension : service.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
- }
-
- // Write <reference> elements
- for (ComponentReference reference : component.getReferences()) {
- if (reference.isCallback() == false){
- writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
- new XAttr(AUTOWIRE, reference.getAutowire()),
- writeMultiplicity(reference),
- writeTargets(reference),
- policyProcessor.writePolicies(reference));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, reference, extensionAttributeProcessor);
-
- // Write reference interface
- extensionProcessor.write(reference.getInterfaceContract(), writer);
-
- // Write bindings
- for (Binding binding : reference.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write callback
- if (reference.getCallback() != null) {
- Callback callback = reference.getCallback();
- writeStart(writer, CALLBACK, policyProcessor.writePolicies(callback));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
-
- // Write callback bindings
- for (Binding binding : callback.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write extensions
- for (Object extensions : callback.getExtensions()) {
- extensionProcessor.write(extensions, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write extensions
- for (Object extensions : reference.getExtensions()) {
- extensionProcessor.write(extensions, writer);
- }
-
- writeEnd(writer);
- }
- }
-
- // Write <property> elements
- for (ComponentProperty property : component.getProperties()) {
- writeStart(writer,
- PROPERTY,
- new XAttr(NAME, property.getName()),
- new XAttr(MUST_SUPPLY, property.isMustSupply()),
- new XAttr(MANY, property.isMany()),
- new XAttr(TYPE, property.getXSDType()),
- new XAttr(ELEMENT, property.getXSDElement()),
- new XAttr(SOURCE, property.getSource()),
- new XAttr(FILE, property.getFile()),
- policyProcessor.writePolicies(property));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, property, extensionAttributeProcessor);
-
- // Write property value
- writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
-
- // Write extensions
- for (Object extension : property.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- writeEnd(writer);
- }
-
- // Write <reference> elements
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
-
- // Write list of promoted references
- List<String> promote = new ArrayList<String>();
- for (ComponentReference promoted: compositeReference.getPromotedReferences()) {
- promote.add(promoted.getName());
- }
-
- // Write <reference> element
- writeStart(writer, REFERENCE, new XAttr(NAME, reference.getName()),
- new XAttr(PROMOTE, promote),
- writeMultiplicity(reference),
- policyProcessor.writePolicies(reference));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, reference, extensionAttributeProcessor);
-
- // Write reference interface
- extensionProcessor.write(reference.getInterfaceContract(), writer);
-
- // Write bindings
- for (Binding binding : reference.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write <callback> element
- if (reference.getCallback() != null) {
- Callback callback = reference.getCallback();
- writeStart(writer, CALLBACK);
-
- //write extended attributes
- this.writeExtendedAttributes(writer, callback, extensionAttributeProcessor);
-
- // Write callback bindings
- for (Binding binding : callback.getBindings()) {
- extensionProcessor.write(binding, writer);
- }
-
- // Write extensions
- for (Object extension : callback.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write extensions
- for (Object extension : reference.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write <property> elements
- for (Property property : composite.getProperties()) {
- writeStart(writer,
- PROPERTY,
- new XAttr(NAME, property.getName()),
- new XAttr(MUST_SUPPLY, property.isMustSupply()),
- new XAttr(MANY, property.isMany()),
- new XAttr(TYPE, property.getXSDType()),
- new XAttr(ELEMENT, property.getXSDElement()),
- policyProcessor.writePolicies(property));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, property, extensionAttributeProcessor);
-
- // Write property value
- writePropertyValue(property.getValue(), property.getXSDElement(), property.getXSDType(), writer);
-
- // Write extensions
- for (Object extension : property.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEnd(writer);
- }
-
- // Write <wire> elements
- for (Wire wire : composite.getWires()) {
- writeStart(writer, WIRE, new XAttr(SOURCE, wire.getSource().getName()), new XAttr(TARGET, wire
- .getTarget().getName()));
-
- //write extended attributes
- this.writeExtendedAttributes(writer, wire, extensionAttributeProcessor);
-
- // Write extensions
- for (Object extension : wire.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
- writeEnd(writer);
- }
-
- for (Object extension : composite.getExtensions()) {
- extensionProcessor.write(extension, writer);
- }
-
- writeEndDocument(writer);
- }
-
- public void resolve(Composite composite, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve constraining type
- ConstrainingType constrainingType = composite.getConstrainingType();
- if (constrainingType != null) {
- constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
- composite.setConstrainingType(constrainingType);
- }
-
- // Resolve includes in the composite
- for (int i = 0, n = composite.getIncludes().size(); i < n; i++) {
- Composite include = composite.getIncludes().get(i);
- if (include != null) {
- include = resolver.resolveModel(Composite.class, include);
- composite.getIncludes().set(i, include);
- }
- }
-
- // Resolve extensions
- for (Object extension : composite.getExtensions()) {
- if (extension != null) {
- extensionProcessor.resolve(extension, resolver);
- }
- }
-
- //resolve intents and policy sets
- List<Intent> compositeIntents = null;
- List<PolicySet> compositePolicySets = null;
- List<PolicySet> compositeApplicablePolicySets = null;
- resolveIntents(composite.getRequiredIntents(), resolver);
- resolvePolicySets(composite.getPolicySets(), resolver);
- resolvePolicySets(composite.getApplicablePolicySets(), resolver);
- compositeIntents = composite.getRequiredIntents();
- compositePolicySets = composite.getPolicySets();
- compositeApplicablePolicySets = composite.getApplicablePolicySets();
-
- //Resolve composite services and references
- resolveContracts(composite, composite.getServices(), resolver);
- resolveContracts(composite, composite.getReferences(), resolver);
-
- // Resolve component implementations, services and references
- for (Component component : composite.getComponents()) {
- constrainingType = component.getConstrainingType();
- if (constrainingType != null) {
- constrainingType = resolver.resolveModel(ConstrainingType.class, constrainingType);
- component.setConstrainingType(constrainingType);
- }
-
- //resolve intents and policy sets
- resolveIntents(component.getRequiredIntents(), resolver);
- resolvePolicySets(component.getPolicySets(), resolver);
- resolvePolicySets(component.getApplicablePolicySets(), resolver);
-
- //inherit composite intents and policysets
- PolicyComputationUtils.addDefaultPolicies(compositeIntents,
- compositePolicySets,
- component.getRequiredIntents(),
- component.getPolicySets());
-
- addInheritedPolicySets(compositeApplicablePolicySets, component.getApplicablePolicySets());
-
- //resolve component services and references
- resolveContracts(component, component.getServices(), resolver);
- resolveContracts(component, component.getReferences(), resolver);
-
- for (ComponentProperty componentProperty : component.getProperties()) {
- if (componentProperty.getFile() != null) {
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(componentProperty.getFile());
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() != null) {
- componentProperty.setFile(artifact.getLocation());
- }
- }
- }
-
- //resolve component implementation
- Implementation implementation = component.getImplementation();
- if (implementation != null) {
- try {
- //resolve intents and policysets specified on this implementation
- //before copying them over to the component. Before that, from the component
- //copy over the applicablePolicySets alone as it might have to be
- //used to validate the policysets specified on the implementation
-
- resolveImplIntentsAndPolicySets(implementation,
- component.getApplicablePolicySets(),
- resolver);
-
- copyPoliciesToComponent(component, implementation, resolver, true);
-
- //now resolve the implementation so that even if there is a shared instance
- //for this that is resolved, the specified intents and policysets are safe in the
- //component and not lost
- implementation = resolveImplementation(implementation, resolver);
-
- //resolved implementation may contain intents and policysets specified at
- //componentType (either in the componentType side file or in annotations if its a
- //java implementation). This has to be consolidated in to the component.
- copyPoliciesToComponent(component, implementation, resolver, false);
-
- component.setImplementation(implementation);
- } catch ( PolicyValidationException e ) {
- error("PolicyImplValidationException", resolver, component.getName(), e.getMessage());
- //throw new ContributionResolveException("PolicyValidation exception when processing implementation of component '"
- //+ component.getName() + "' due to " + e.getMessage(), e);
- }
-
- }
-
- //add model resolver to component
- if (component instanceof ResolverExtension) {
- ((ResolverExtension)component).setModelResolver(resolver);
- }
- }
-
- // Add model resolver to promoted components
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
- Component promotedComponent = compositeService.getPromotedComponent();
- if (promotedComponent instanceof ResolverExtension) {
- ((ResolverExtension)promotedComponent).setModelResolver(resolver);
- }
- }
- }
-
- private void resolveImplIntentsAndPolicySets(Implementation implementation,
- List<PolicySet> inheritedApplicablePolicySets,
- ModelResolver resolver) throws ContributionResolveException,
- PolicyValidationException
- {
- if ( implementation instanceof PolicySetAttachPoint ) {
- PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)implementation;
-
- policiedImpl.getApplicablePolicySets().addAll(inheritedApplicablePolicySets);
-
- resolveIntents(policiedImpl.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(policiedImpl, policiedImpl.getType());
-
- resolvePolicySets(policiedImpl.getPolicySets(), resolver);
- resolvePolicySets(policiedImpl.getApplicablePolicySets(), resolver);
-
- PolicyValidationUtils.validatePolicySets(policiedImpl);
-
- if ( implementation instanceof OperationsConfigurator ) {
- for ( ConfiguredOperation implConfOp : ((OperationsConfigurator)implementation).getConfiguredOperations() ) {
- resolveIntents(implConfOp.getRequiredIntents(), resolver);
- PolicyValidationUtils.validateIntents(implConfOp, policiedImpl.getType());
-
- resolvePolicySets(implConfOp.getPolicySets(), resolver);
- resolvePolicySets(implConfOp.getApplicablePolicySets(), resolver);
- //add the inherited applicablePolicysets
- addInheritedPolicySets(policiedImpl.getApplicablePolicySets(), implConfOp.getApplicablePolicySets());
-
- PolicyValidationUtils.validatePolicySets(implConfOp, policiedImpl.getType());
-
- PolicyComputationUtils.addDefaultPolicies(
- ((PolicySetAttachPoint)implementation).getRequiredIntents(),
- ((PolicySetAttachPoint)implementation).getPolicySets(),
- implConfOp.getRequiredIntents(),
- implConfOp.getPolicySets());
- }
- }
- }
- }
-
- private void copyPoliciesToComponent(Component component,
- Implementation implementation,
- ModelResolver resolver,
- boolean clearImplSettings) throws ContributionResolveException {
- if (implementation instanceof PolicySetAttachPoint) {
- // Add implementation policies into component, since implementation instances are
- // reused and it's likely that this implementation instance will not hold after its resolution.
- // On the first call to this method (clearImplSettings=true), we are moving policies from the
- // implementation XML element up to the component. In this case if there are mutually exclusive
- // policies we must clear the component policy so that the implementation policy "wins".
- // On the second call to this method (clearImplSettings=false), we are moving policies from the
- // componentType implementation up to the component. In this case if there are mutually
- // exclusive policies it is an error. This error will be detected later in the PolicyComputer.
- if (clearImplSettings) {
- for (Intent intent : ((PolicySetAttachPoint)implementation).getRequiredIntents()) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (component.getRequiredIntents().contains(excluded)) {
- component.getRequiredIntents().remove(excluded);
- }
- for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
- PolicySet cmpPolicySet = (PolicySet) i.next();
- if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
- i.remove();
- }
- }
- }
- }
- for (PolicySet policySet : ((PolicySetAttachPoint)implementation).getPolicySets()) {
- for (Intent intent : policySet.getProvidedIntents()) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (component.getRequiredIntents().contains(excluded)) {
- component.getRequiredIntents().remove(excluded);
- }
- for (Iterator i = component.getPolicySets().iterator(); i.hasNext(); ) {
- PolicySet cmpPolicySet = (PolicySet) i.next();
- if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
- i.remove();
- }
- }
- }
- }
- }
- }
- component.getRequiredIntents().addAll(((PolicySetAttachPoint)implementation).getRequiredIntents());
- component.getPolicySets().addAll(((PolicySetAttachPoint)implementation).getPolicySets());
- component.getApplicablePolicySets().addAll(((PolicySetAttachPoint)implementation).getApplicablePolicySets());
-
- if ( implementation instanceof OperationsConfigurator ) {
- boolean notFound;
- List<ConfiguredOperation> opsFromImplementation = new ArrayList<ConfiguredOperation>();
- List<ConfiguredOperation> implConfOperations =
- new ArrayList<ConfiguredOperation>(((OperationsConfigurator)implementation).getConfiguredOperations());
- for ( ConfiguredOperation implConfOp : implConfOperations ) {
- notFound = true;
- for ( ConfiguredOperation compConfOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
- if ( implConfOp.getName().equals(compConfOp.getName()) ) {
- notFound = false;
-
- if (clearImplSettings) {
- for (Intent intent : implConfOp.getRequiredIntents()) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (compConfOp.getRequiredIntents().contains(excluded)) {
- compConfOp.getRequiredIntents().remove(excluded);
- }
- }
- }
- for (PolicySet policySet : implConfOp.getPolicySets()) {
- for (Intent intent : policySet.getProvidedIntents()) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (compConfOp.getRequiredIntents().contains(excluded)) {
- compConfOp.getRequiredIntents().remove(excluded);
- }
- for (Iterator i = compConfOp.getPolicySets().iterator(); i.hasNext(); ) {
- PolicySet cmpPolicySet = (PolicySet) i.next();
- if (cmpPolicySet.getProvidedIntents().contains(excluded)) {
- i.remove();
- }
- }
- }
- }
- }
- }
-
- addInheritedIntents(implConfOp.getRequiredIntents(), compConfOp.getRequiredIntents());
- addInheritedPolicySets(implConfOp.getPolicySets(), compConfOp.getPolicySets());
- addInheritedPolicySets(implConfOp.getApplicablePolicySets(), compConfOp.getApplicablePolicySets());
- }
- }
-
- if ( notFound ) {
- opsFromImplementation.add(implConfOp);
- }
-
- if ( clearImplSettings ) {
- ((OperationsConfigurator)implementation).getConfiguredOperations().remove(implConfOp);
- }
- }
- ((OperationsConfigurator)component).getConfiguredOperations().addAll(opsFromImplementation);
- }
-
- if ( clearImplSettings ) {
- ((PolicySetAttachPoint)implementation).getRequiredIntents().clear();
- ((PolicySetAttachPoint)implementation).getPolicySets().clear();
- }
- }
- }
-
-
- public QName getArtifactType() {
- return COMPOSITE_QNAME;
- }
-
- public Class<Composite> getModelType() {
- return Composite.class;
- }
-
- /**
- * Returns the model factory extension point to use.
- *
- * @param extensionPoints
- * @return
- */
- private static ModelFactoryExtensionPoint modelFactories(ExtensionPointRegistry extensionPoints) {
- return extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- }
-
- /**
- * Returns the monitor to use.
- *
- * @param extensionPoints
- * @return
- */
- private static Monitor monitor(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- if (utilities != null) {
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- return monitorFactory.createMonitor();
- }
- }
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
deleted file mode 100644
index 0f062dbda5..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConfiguredOperationProcessor.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Processor for dealing with 'operation' elements from composite definitions
- *
- * @version $Rev$ $Date$
- */
-public class ConfiguredOperationProcessor implements StAXArtifactProcessor<ConfiguredOperation>, Constants{
-
- private AssemblyFactory assemblyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private PolicyFactory policyFactory;
- private Monitor monitor;
-
- public ConfiguredOperationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.monitor = monitor;
- }
-
- public ConfiguredOperation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- ConfiguredOperation configuredOp = assemblyFactory.createConfiguredOperation();
-
- //Read an <operation>
- configuredOp.setName(reader.getAttributeValue(null, NAME));
- configuredOp.setContractName(reader.getAttributeValue(null, SERVICE));
- configuredOp.setUnresolved(true);
-
- // Read policies
- policyProcessor.readPolicies(configuredOp, reader);
-
- //Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && OPERATION_QNAME.equals(reader.getName())) {
- break;
- }
- }
-
- return configuredOp;
- }
-
- public void write(ConfiguredOperation configuredOperation, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
-
- // Write an <operation>
- 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-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
deleted file mode 100644
index 3bf5a1173b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import javax.xml.namespace.QName;
-
-/**
- * Constants used in SCA assembly XML files.
- *
- * @version $Rev$ $Date$
- */
-public interface Constants {
- String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
-
- String COMPONENT_TYPE = "componentType";
- QName COMPONENT_TYPE_QNAME = new QName(SCA10_NS, COMPONENT_TYPE);
-
- String SERVICE = "service";
- QName SERVICE_QNAME = new QName(SCA10_NS, SERVICE);
-
- String REFERENCE = "reference";
- QName REFERENCE_QNAME = new QName(SCA10_NS, REFERENCE);
-
- String PROPERTY = "property";
- QName PROPERTY_QNAME = new QName(SCA10_NS, PROPERTY);
-
- String CONSTRAINING_TYPE = "constrainingType";
- QName CONSTRAINING_TYPE_QNAME = new QName(SCA10_NS, CONSTRAINING_TYPE);
-
- String COMPOSITE = "composite";
- QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
-
- String INCLUDE = "include";
- QName INCLUDE_QNAME = new QName(SCA10_NS, INCLUDE);
-
- String COMPONENT = "component";
- QName COMPONENT_QNAME = new QName(SCA10_NS, COMPONENT);
-
- String WIRE = "wire";
- QName WIRE_QNAME = new QName(SCA10_NS, WIRE);
-
- String OPERATION = "operation";
- QName OPERATION_QNAME = new QName(SCA10_NS, OPERATION);
-
- String CALLBACK = "callback";
- QName CALLBACK_QNAME = new QName(SCA10_NS, CALLBACK);
-
- String IMPLEMENTATION_COMPOSITE = "implementation.composite";
- QName IMPLEMENTATION_COMPOSITE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_COMPOSITE);
-
- String IMPLEMENTATION = "implementation";
- QName IMPLEMENTATION_QNAME = new QName(SCA10_NS, IMPLEMENTATION);
-
- String BINDING_SCA = "binding.sca";
- QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
-
- String NAME = "name";
- String TARGET_NAMESPACE = "targetNamespace";
- String LOCAL = "local";
- String AUTOWIRE = "autowire";
- String REQUIRES = "requires";
- String POLICY_SETS = "policySets";
- String APPLICABLE_POLICY_SETS = "applicablePolicySets";
- String PROMOTE = "promote";
- String TARGET = "target";
- String WIRED_BY_IMPL = "wiredByImpl";
- String MULTIPLICITY = "multiplicity";
- String TYPE = "type";
- String ELEMENT = "element";
- String MANY = "many";
- String MUST_SUPPLY = "mustSupply";
- String SOURCE = "source";
- String FILE = "file";
- String URI = "uri";
- String ZERO_ONE = "0..1";
- String ZERO_N = "0..n";
- String ONE_ONE = "1..1";
- String ONE_N = "1..n";
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
deleted file mode 100644
index 9758d788f4..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeDocumentProcessor.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A contrainingType content handler.
- *
- * @version $Rev$ $Date$
- */
-public class ConstrainingTypeDocumentProcessor extends BaseAssemblyProcessor implements URLArtifactProcessor<ConstrainingType> {
- private XMLInputFactory inputFactory;
-
-
- /**
- * Construct a new constrainingType processor.
- *
- * @param staxProcessor
- * @param inputFactory
- * @param monitor
- */
- public ConstrainingTypeDocumentProcessor(StAXArtifactProcessor staxProcessor,
- XMLInputFactory inputFactory,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = inputFactory;
- }
-
-
- /**
- * Constructs a new constrainingType processor.
- * @param modelFactories
- * @param staxProcessor
- * @param monitor
- */
- public ConstrainingTypeDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(null, null, null, staxProcessor, null, monitor);
- this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
- }
-
- public ConstrainingType read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
-
- // Create a stream reader
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- urlStream = connection.getInputStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
- reader.nextTag();
-
- // Read the constrainingType model
- ConstrainingType constrainingType = (ConstrainingType)extensionProcessor.read(reader);
-
- // For debugging purposes, write it back to XML
-// if (constrainingType != null) {
-// try {
-// ByteArrayOutputStream bos = new ByteArrayOutputStream();
-// XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
-// outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
-// extensionProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
-// Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
-// OutputFormat format = new OutputFormat();
-// format.setIndenting(true);
-// format.setIndent(2);
-// XMLSerializer serializer = new XMLSerializer(System.out, format);
-// serializer.serialize(document);
-// } catch (Exception e) {
-// e.printStackTrace();
-// }
-// }
-
- return constrainingType;
-
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } catch (IOException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ConstrainingType constrainingType, ModelResolver resolver) throws ContributionResolveException {
- extensionProcessor.resolve(constrainingType, resolver);
- }
-
- public String getArtifactType() {
- return ".constrainingType";
- }
-
- public Class<ConstrainingType> getModelType() {
- return ConstrainingType.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeModelResolver.java
deleted file mode 100644
index 7dd95e3944..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ConstrainingTypeModelResolver implements ModelResolver {
-
- private Contribution contribution;
- private Map<QName, ConstrainingType> map = new HashMap<QName, ConstrainingType>();
-
- public ConstrainingTypeModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- ConstrainingType composite = (ConstrainingType)resolved;
- map.put(composite.getName(), composite);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((ConstrainingType)resolved).getName());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a definition for the given namespace
- QName qname = ((ConstrainingType)unresolved).getName();
- ConstrainingType resolved = (ConstrainingType) map.get(qname);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
-
- // No definition found, delegate the resolution to the imports
- for (Import import_ : this.contribution.getImports()) {
- if (import_ instanceof NamespaceImport) {
- NamespaceImport namespaceImport = (NamespaceImport)import_;
- if (namespaceImport.getNamespace().equals(qname.getNamespaceURI())) {
-
- // Delegate the resolution to the import resolver
- resolved = namespaceImport.getModelResolver().resolveModel(ConstrainingType.class, (ConstrainingType)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- return (T)unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
deleted file mode 100644
index 525ffd02e3..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ConstrainingTypeProcessor.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.w3c.dom.Document;
-
-/**
- * A constrainingType processor.
- *
- * @version $Rev$ $Date$
- */
-public class ConstrainingTypeProcessor extends BaseAssemblyProcessor implements StAXArtifactProcessor<ConstrainingType> {
-
- /**
- * Construct a new constrainingType processor.
- * @param assemblyFactory
- * @param policyFactory
- * @param extensionProcessor
- */
- public ConstrainingTypeProcessor(AssemblyFactory assemblyFactory,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- super(assemblyFactory, extensionFactory, policyFactory, extensionProcessor, extensionAttributeProcessor, monitor);
- }
-
- /**
- * Constructs a new constrainingType processor.
- *
- * @param modelFactories
- * @param extensionProcessor
- */
- public ConstrainingTypeProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- super(modelFactories.getFactory(AssemblyFactory.class),
- modelFactories.getFactory(ExtensionFactory.class),
- modelFactories.getFactory(PolicyFactory.class),
- extensionProcessor,
- extensionAttributeProcessor,
- monitor);
- }
-
- public ConstrainingType read(XMLStreamReader reader) throws ContributionReadException {
- ConstrainingType constrainingType = null;
- AbstractService abstractService = null;
- AbstractReference abstractReference = null;
- AbstractProperty abstractProperty = null;
- AbstractContract abstractContract = null;
- QName name = null;
-
- try {
- // Read the constrainingType document
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
-
- case START_ELEMENT:
- name = reader.getName();
-
- // Read a <constrainingType>
- if (Constants.CONSTRAINING_TYPE_QNAME.equals(name)) {
- constrainingType = assemblyFactory.createConstrainingType();
- constrainingType.setName(new QName(getString(reader, TARGET_NAMESPACE), getString(reader, NAME)));
- policyProcessor.readPolicies(constrainingType, reader);
-
- } else if (Constants.SERVICE_QNAME.equals(name)) {
-
- // Read a <service>
- abstractService = assemblyFactory.createAbstractService();
- abstractContract = abstractService;
- abstractService.setName(getString(reader, Constants.NAME));
- constrainingType.getServices().add(abstractService);
- policyProcessor.readPolicies(abstractService, reader);
-
- } else if (Constants.REFERENCE_QNAME.equals(name)) {
-
- // Read a <reference>
- abstractReference = assemblyFactory.createAbstractReference();
- abstractContract = abstractReference;
- abstractReference.setName(getString(reader, Constants.NAME));
- readMultiplicity(abstractReference, reader);
- constrainingType.getReferences().add(abstractReference);
- policyProcessor.readPolicies(abstractReference, reader);
-
- } else if (Constants.PROPERTY_QNAME.equals(name)) {
-
- // Read a <property>
- abstractProperty = assemblyFactory.createAbstractProperty();
- readAbstractProperty(abstractProperty, reader);
-
- // Read the property value
- Document value = readPropertyValue(abstractProperty.getXSDElement(), abstractProperty.getXSDType(), reader);
- abstractProperty.setValue(value);
-
- constrainingType.getProperties().add(abstractProperty);
- policyProcessor.readPolicies(abstractProperty, reader);
-
- } else if (OPERATION_QNAME.equals(name)) {
-
- // Read an <operation>
- Operation operation = new OperationImpl();
- operation.setName(getString(reader, NAME));
- operation.setUnresolved(true);
- policyProcessor.readPolicies(abstractContract, operation, reader);
-
- } else {
-
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension instanceof InterfaceContract) {
-
- // <service><interface> and <reference><interface>
- abstractContract.setInterfaceContract((InterfaceContract)extension);
- } else {
-
- // Add the extension element to the current element
- if (abstractContract != null) {
- abstractContract.getExtensions().add(extension);
- } else {
- constrainingType.getExtensions().add(extension);
- }
-
- }
- }
- break;
-
- case END_ELEMENT:
- name = reader.getName();
-
- // Clear current state when reading reaching end element
- if (SERVICE_QNAME.equals(name)) {
- abstractService = null;
- abstractContract = null;
- } else if (REFERENCE_QNAME.equals(name)) {
- abstractReference = null;
- abstractContract = null;
- } else if (PROPERTY_QNAME.equals(name)) {
- abstractProperty = null;
- }
- break;
- }
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- 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()),
- writeMultiplicity(reference),
- 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-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
deleted file mode 100644
index 467ed37638..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/DefaultBeanModelProcessor.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.ExtensionFactory;
-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.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Default Model Processor for beans.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultBeanModelProcessor<T> extends BaseAssemblyProcessor implements StAXArtifactProcessor<T> {
-
- private QName artifactType;
- private Class<T> 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,
- ExtensionFactory extensionFactory,
- PolicyFactory policyFactory,
- QName artifactType,
- Class<T> modelClass,
- Object modelFactory,
- Monitor monitor) {
- super(assemblyFactory, extensionFactory, policyFactory, null, null, monitor);
- this.artifactType = artifactType;
- this.modelClass = modelClass;
- this.modelFactory = modelFactory;
-
- // Introspect the factory class and bean model class
- if (modelFactory != null) {
-
- // Find the model create method
- for (Method method: modelFactory.getClass().getMethods()) {
- if (method.getName().startsWith("create") && method.getReturnType() == modelClass) {
- factoryMethod = method;
- break;
- }
- }
- }
-
- // Index the bean's setter methods
- for (Method method: modelClass.getMethods()) {
- Method getter;
- String name = method.getName();
- if (name.startsWith("set") && name.length() > 3) {
-
- // Get the corresponding getter method
- try {
- getter = modelClass.getMethod("get" + name.substring(3));
- } catch (Exception e) {
- getter = null;
- continue;
- }
-
- // Get the property name
- name = name.substring(3);
- if (name.length() > 1) {
- if (!name.toUpperCase().equals(name)) {
- name = name.substring(0, 1).toLowerCase() + name.substring(1);
- }
- }
- } else {
- continue;
- }
-
- // Map an uppercase property name to a lowercase attribute name
- if (name.toUpperCase().equals(name)) {
- name = name.toLowerCase();
- }
-
- // Trim trailing _ from property names
- if (name.endsWith("_")) {
- name = name.substring(0, name.length()-1);
- }
- setterMethods.put(name, method);
- getterMethods.put(name, getter);
- }
- }
-
- public T 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 (T) model;
-
- } catch (Exception e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", reader, ce);
- throw ce;
- }
- }
-
- public void write(T bean, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- try {
- // Write the bean properties as attributes
- List<XAttr> attrs = new ArrayList<XAttr>();
- for (Map.Entry<String, Method> entry: getterMethods.entrySet()) {
- if (entry.getValue().getReturnType() == String.class) {
- String value = (String)entry.getValue().invoke(bean);
- attrs.add(new XAttr(entry.getKey(), value));
- }
- }
-
- // Write element
- writeStart(writer, artifactType.getNamespaceURI(), artifactType.getLocalPart(),
- policyProcessor.writePolicies(bean), new XAttr(null, attrs));
-
- writeEnd(writer);
-
- } catch (Exception e) {
- ContributionWriteException ce = new ContributionWriteException(e);
- error("ContributionWriteException", writer, ce);
- throw ce;
- }
- }
-
- public void resolve(T 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<T> getModelType() {
- return modelClass;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.java
deleted file mode 100644
index 44be1b6de1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/PolicyAttachPointProcessor.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 java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * A Policy Attach Point processor.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyAttachPointProcessor extends BaseStAXArtifactProcessor implements Constants {
-
- private PolicyFactory policyFactory;
-
- public PolicyAttachPointProcessor(PolicyFactory policyFactory) {
- this.policyFactory = policyFactory;
- }
-
- /**
- * Read policy intents associated with an operation.
- * @param attachPoint
- * @param operation
- * @param reader
- */
- private void readIntents(Object attachPoint, Operation operation, XMLStreamReader reader) {
- if (!(attachPoint instanceof IntentAttachPoint))
- return;
- IntentAttachPoint intentAttachPoint = (IntentAttachPoint)attachPoint;
- String value = reader.getAttributeValue(null, REQUIRES);
- if (value != null) {
- List<Intent> requiredIntents = intentAttachPoint.getRequiredIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- if (operation != null) {
- //FIXME Don't we need to handle intent specification
- // on an operation basis?
- //intent.getOperations().add(operation);
- }
- requiredIntents.add(intent);
- }
- }
- }
-
- /**
- * Reads policy intents and policy sets associated with an operation.
- * @param attachPoint
- * @param operation
- * @param reader
- */
- public void readPolicies(Object attachPoint, Operation operation, XMLStreamReader reader) {
- readIntents(attachPoint, operation, reader);
- readPolicySets(attachPoint, operation, reader);
- }
-
- /**
- * Reads policy intents and policy sets.
- * @param attachPoint
- * @param reader
- */
- public void readPolicies(Object attachPoint, XMLStreamReader reader) {
- readPolicies(attachPoint, null, reader);
- }
-
- /**
- * Reads policy sets associated with an operation.
- * @param attachPoint
- * @param operation
- * @param reader
- */
- private void readPolicySets(Object attachPoint, Operation operation, XMLStreamReader reader) {
- if (!(attachPoint instanceof PolicySetAttachPoint)) {
- return;
- }
- PolicySetAttachPoint policySetAttachPoint = (PolicySetAttachPoint)attachPoint;
- String value = reader.getAttributeValue(null, POLICY_SETS);
- if (value != null) {
- List<PolicySet> policySets = policySetAttachPoint.getPolicySets();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(qname);
- if (operation != null) {
- //FIXME Don't we need to handle policySet specification
- // on an operation basis?
- //policySet.getOperations().add(operation);
- }
- policySets.add(policySet);
- }
- }
-
- value = reader.getAttributeValue(SCA10_TUSCANY_NS, APPLICABLE_POLICY_SETS);
- if (value != null) {
- List<PolicySet> applicablePolicySets = policySetAttachPoint.getApplicablePolicySets();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(qname);
- if (operation != null) {
- //FIXME Don't we need to handle policySet specification
- // on an operation basis?
- //policySet.getOperations().add(operation);
- }
- applicablePolicySets.add(policySet);
- }
- }
- }
-
- /**
- * Write policies
- * @param attachPoint
- * @return
- */
- XAttr writePolicies(Object attachPoint) throws XMLStreamException {
- return writePolicies(attachPoint, (Operation)null);
- }
-
- /**
- * Write policies
- * @param attachPoint
- * @return
- */
- public void writePolicyAttributes(Object attachPoint, XMLStreamWriter writer) throws XMLStreamException {
- writePolicyAttributes(attachPoint, (Operation)null, writer);
- }
-
- /**
- * Write policies 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-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 7a190dea9c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.ComponentTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#componentType,model=org.apache.tuscany.sca.assembly.ComponentType
-org.apache.tuscany.sca.assembly.xml.ConstrainingTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#constrainingType,model=org.apache.tuscany.sca.assembly.ConstrainingType
-org.apache.tuscany.sca.assembly.xml.CompositeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#composite,model=org.apache.tuscany.sca.assembly.Composite
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 403c049b48..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.ComponentTypeDocumentProcessor;type=.componentType,model=org.apache.tuscany.sca.assembly.ComponentType
-org.apache.tuscany.sca.assembly.xml.ConstrainingTypeDocumentProcessor;type=.constrainingType,model=org.apache.tuscany.sca.assembly.ConstrainingType
-org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;type=.composite,model=org.apache.tuscany.sca.assembly.Composite
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
deleted file mode 100644
index 6fd524716c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties
+++ /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.
-#
-#
-NoCompositeNamespace = No namespace found: Composite = {0}
-UnexpectedInterfaceElement = Unexpected <interface> element found. It should appear inside a <service> or <reference> element.
-UnexpectedBindingElement = Unexpected <binding> element found. It should appear inside a <service> or <reference> element.
-UnexpectedImplementationElement = Unexpected <implementation> element found. It should appear inside a <component> element.
-PolicyImplValidationException = PolicyValidation exception when processing implementation of component {0} due to {1}.
-PolicyServiceValidationException = PolicyValidation exceptions when processing service/reference {0} in {1}. Error is {2}
-ContributionReadException = ContributionReadException occured due to : {0}
-ContributionWriteException = ContributionWriteException occured due to : {0}
-XMLStreamException = XMLStreamException occured due to : {0}
-HttpServerError = HTTP Server Error : {0}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.java
deleted file mode 100644
index 5f8f976b84..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/BuildPolicyTestCase.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.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
- */
-public class BuildPolicyTestCase extends TestCase {
- private URLArtifactProcessor<Object> documentProcessor;
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
- private ModelResolver resolver;
- private CompositeBuilder compositeBuilder;
- private Composite composite;
- private Monitor monitor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- List<SCADefinitions> policyDefinitions = new ArrayList<SCADefinitions>();
- resolver = new DefaultModelResolver();
-
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- monitor = monitorFactory.createMonitor();
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
- URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
-
- URL url = getClass().getResource("CalculatorComponent.constrainingType");
- URI uri = URI.create("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- url = getClass().getResource("TestAllPolicyCalculator.composite");
- uri = URI.create("TestAllCalculator.constrainingType");
- composite = (Composite)documentProcessor.read(null, uri, url);
- assertNotNull(composite);
-
- url = getClass().getResource("another_test_definitions.xml");
- uri = URI.create("another_test_definitions.xml");
- SCADefinitions definitions = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
- assertNotNull(definitions);
- policyDefinitions.add(definitions);
-
- documentProcessor.resolve(definitions, resolver);
- documentProcessor.resolve(composite, resolver);
-
- compositeBuilder.build(composite);
- }
-
- public void testPolicyIntentInheritance() throws Exception {
- String namespaceUri = "http://test";
-
- IntentAttachPoint policiedComposite = (IntentAttachPoint)composite;
- assertEquals(policiedComposite.getRequiredIntents().size(), 1);
- assertEquals(policiedComposite.getRequiredIntents().get(0).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
-
- //1 defined for composite, 2 defined for the service, 1 defined and 3 inherited for the promoted service (4)
- assertEquals(composite.getServices().get(0).getRequiredIntents().size(), 7);
- //1 from the operation defined in this service and 2 from the operation defined in the promoted service
- assertEquals(composite.getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
- assertEquals(composite.getServices().get(0).getRequiredIntents().get(3).getName(), new QName(namespaceUri, "tuscanyIntent_3"));
- //bindings will have only 2 intents since duplications will be cut out
- assertEquals(((IntentAttachPoint)composite.getServices().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
- assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().size(), 1);
- assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0)).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
-
- assertEquals(composite.getReferences().get(0).getRequiredIntents().size(), 5);
- assertEquals(composite.getReferences().get(0).getConfiguredOperations().size(), 1);
- assertEquals(composite.getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
- assertEquals(composite.getReferences().get(0).getRequiredIntents().get(1).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
- assertEquals(((IntentAttachPoint)composite.getReferences().get(0).getBindings().get(0)).getRequiredIntents().size(), 3);
-
- assertEquals(composite.getComponents().get(0).getRequiredIntents().size(), 3);
- assertEquals(composite.getComponents().get(0).getRequiredIntents().get(2).getName(), new QName(namespaceUri, "tuscanyIntent_1"));
- assertEquals(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().size(), 4);
- assertEquals(composite.getComponents().get(0).getServices().get(0).getCallback().getRequiredIntents().size(), 4);
- assertEquals(composite.getComponents().get(0).getServices().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
- assertEquals(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().size(), 5);
- assertEquals(composite.getComponents().get(0).getReferences().get(0).getConfiguredOperations().get(0).getRequiredIntents().size(), 5);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MultiplicityReadWriteTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MultiplicityReadWriteTestCase.java
deleted file mode 100644
index f34ff1f8bc..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/MultiplicityReadWriteTestCase.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.xml;
-
-import static junit.framework.Assert.assertEquals;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test writing SCA XML assemblies.
- *
- * TUSCANY-2662
- *
- * @version $Rev$ $Date$
- */
-public class MultiplicityReadWriteTestCase {
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
-
- @Before
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
-
- @Test
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Multiplicity.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);
-
- }
-
-
- private void verifyComposite(Composite composite) {
- assertEquals(composite.getComponents().get(0).getReferences().get(0).getMultiplicity(), Multiplicity.ZERO_N);
- assertEquals(composite.getReferences().get(0).getMultiplicity(), Multiplicity.ONE_N);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
deleted file mode 100644
index e2aeb85d32..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadAllTestCase.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadAllTestCase extends TestCase {
- private StAXArtifactProcessor<Object> staxProcessor;
- private XMLInputFactory inputFactory;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- inputFactory = XMLInputFactory.newInstance();
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
- assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "CalculatorComponent"));
- assertTrue(composite.isLocal());
- assertFalse(composite.getAutowire() == Boolean.TRUE);
- assertEquals(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getName(), new QName("http://test",
- "confidentiality"));
- assertEquals(((PolicySetAttachPoint)composite).getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
-
- Composite include = composite.getIncludes().get(0);
- assertEquals(include.getName(), new QName("http://calc", "TestAllDivide"));
-
- CompositeService calcCompositeService = (CompositeService)composite.getServices().get(0);
- assertEquals(calcCompositeService.getName(), "CalculatorService");
- assertTrue(calcCompositeService.getPromotedService().isUnresolved());
- assertEquals(calcCompositeService.getPromotedService().getName(),
- "CalculatorService");
- assertEquals(calcCompositeService.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcCompositeService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- // TODO test operations
- Callback calcServiceCallback = calcCompositeService.getCallback();
- assertNotNull(calcServiceCallback);
- assertEquals(calcServiceCallback.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcServiceCallback.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- // TODO test operations
-
- Component calcComponent = composite.getComponents().get(0);
- assertEquals(calcComponent.getName(), "CalculatorServiceComponent");
- assertEquals(calcComponent.getAutowire(), Boolean.FALSE);
- assertEquals(calcComponent.getConstrainingType().getName(), new QName("http://calc",
- "CalculatorComponent"));
- assertEquals(calcComponent.getRequiredIntents().get(0).getName(), new QName("http://test",
- "confidentiality"));
- assertEquals(calcComponent.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
-
- ComponentService calcComponentService = calcComponent.getServices().get(0);
- assertEquals(calcComponentService.getName(), "CalculatorService");
- assertEquals(calcComponentService.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcComponentService.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- // TODO test operations
-
- ComponentReference calcComponentReference = calcComponent.getReferences().get(0);
- assertEquals(calcComponentReference.getName(), "addService");
- assertEquals(calcComponentReference.getAutowire(), Boolean.FALSE);
- assertEquals(calcComponentReference.isWiredByImpl(), false);
- assertEquals(calcComponentReference.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcComponentReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- // TODO test operations
-
- Property property = calcComponent.getProperties().get(0);
- assertEquals(property.getName(), "round");
- Document doc = (Document) property.getValue();
- Element element = doc.getDocumentElement();
- String value = element.getTextContent();
- assertEquals(value, "true");
- assertEquals(property.getXSDType(), new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
- assertEquals(property.isMany(), false);
-
- CompositeReference calcCompositeReference = (CompositeReference)composite.getReferences().get(0);
- assertEquals(calcCompositeReference.getName(), "MultiplyService");
- assertTrue(calcCompositeReference.getPromotedReferences().get(0).isUnresolved());
- assertEquals(calcCompositeReference.getPromotedReferences().get(0).getName(),
- "CalculatorServiceComponent/multiplyService");
- assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- // TODO test operations
- Callback calcCallback = calcCompositeReference.getCallback();
- assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
- new QName("http://test", "confidentiality"));
- assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test", "SecureReliablePolicy"));
- assertNotNull(calcCallback);
- // TODO test operations
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
deleted file mode 100644
index b3760789c8..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadDocumentTestCase.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.ValidatorHandler;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev$ $Date$
- */
-public class ReadDocumentTestCase extends TestCase {
-
- private URLArtifactProcessor<Object> documentProcessor;
- private ModelResolver resolver;
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- inputFactory = XMLInputFactory.newInstance();
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- resolver = new DefaultModelResolver();
- }
-
- public void testValidateAssembly() throws Exception {
-
- SchemaFactory schemaFactory;
- try {
- schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- } catch (Error e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- } catch (Exception e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- }
- Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
- ValidatorHandler handler = schema.newValidatorHandler();
-
- SAXParserFactory parserFactory = SAXParserFactory.newInstance();
- URL url = getClass().getResource("Calculator.composite");
- XMLReader reader = parserFactory.newSAXParser().getXMLReader();
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- reader.setContentHandler(handler);
- reader.parse(new InputSource(url.openStream()));
-
- }
-
- public void testValidateImplementation() throws Exception {
-
- SchemaFactory schemaFactory;
- try {
- schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- } catch (Error e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- } catch (Exception e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- }
- Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
- ValidatorHandler handler = schema.newValidatorHandler();
-
- SAXParserFactory parserFactory = SAXParserFactory.newInstance();
- URL url = getClass().getResource("JavaScriptReference.composite");
- XMLReader reader = parserFactory.newSAXParser().getXMLReader();
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- reader.setContentHandler(handler);
- reader.parse(new InputSource(url.openStream()));
- }
-
- public void testReadImplementation() throws Exception {
-
- ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
- schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
- XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, null);
- CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null, null);
-
- URL url = getClass().getResource("JavaScriptReference.composite");
- URI uri = URI.create("JavaScriptReference.composite");
- Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
- assertNotNull(composite);
- }
-
- public void testValidateBinding() throws Exception {
-
- SchemaFactory schemaFactory;
- try {
- schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- } catch (Error e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- } catch (Exception e) {
- // Some old JDKs don't support XMLSchema validation
- return;
- }
- Schema schema = schemaFactory.newSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd"));
- ValidatorHandler handler = schema.newValidatorHandler();
-
- SAXParserFactory parserFactory = SAXParserFactory.newInstance();
- URL url = getClass().getResource("RMIBindingTest.composite");
- XMLReader reader = parserFactory.newSAXParser().getXMLReader();
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- reader.setContentHandler(handler);
- reader.parse(new InputSource(url.openStream()));
- }
-
- public void testReadBinding() throws Exception {
-
- ValidationSchemaExtensionPoint schemas = new DefaultValidationSchemaExtensionPoint();
- schemas.addSchema(getClass().getClassLoader().getResource("tuscany-sca.xsd").toString());
- XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, null);
- CompositeDocumentProcessor compositeDocumentProcessor = new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, null, null);
-
- URL url = getClass().getResource("RMIBindingTest.composite");
- URI uri = URI.create("RMIBindingTest.composite");
- Composite composite = (Composite)compositeDocumentProcessor.read(null, uri, url);
- assertNotNull(composite);
- }
-
- public void testResolveConstrainingType() throws Exception {
-
- URL url = getClass().getResource("CalculatorComponent.constrainingType");
- URI uri = URI.create("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- url = getClass().getResource("TestAllCalculator.composite");
- uri = URI.create("TestAllCalculator.constrainingType");
- Composite composite = (Composite)documentProcessor.read(null, uri, url);
- assertNotNull(composite);
-
- documentProcessor.resolve(composite, resolver);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- public void testResolveComposite() throws Exception {
- URL url = getClass().getResource("Calculator.composite");
- URI uri = URI.create("Calculator.composite");
- Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- url = getClass().getResource("TestAllCalculator.composite");
- uri = URI.create("TestAllCalculator.composite");
- Composite composite = (Composite)documentProcessor.read(null, uri, url);
-
- documentProcessor.resolve(composite, resolver);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
deleted file mode 100644
index 1aede413a5..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.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.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(staxProcessor.read(reader));
- is.close();
- }
-
- public void testReadConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(staxProcessor.read(reader));
- is.close();
-
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(staxProcessor.read(reader));
- is.close();
-
- }
-
- public void testReadCompositeAndWireIt() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- assertNotNull(staxProcessor.read(reader));
- is.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java
deleted file mode 100644
index 200b7061c6..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyAttributeTestCase.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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 org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.Test;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadWriteAnyAttributeTestCase {
-
- private static final QName EXTENDED_ATTRIBUTE = new QName("http://test", "customAttribute");
-
- private static final String XML = "<?xml version='1.0' encoding='UTF-8'?>"+
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "targetNamespace=\"http://calc\" " +
- "name=\"Calculator\">"+
- "<component name=\"AddServiceComponent\" xmlns:test=\"http://test\" test:customAttribute=\"customValue\">"+
- "<implementation.java class=\"calculator.AddServiceImpl\" />"+
- "</component>"+
- "</composite>";
-
- private static final String XML_WITH_EXTENDED_ATTRIBUTES_IN_BINDINGS =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://temp\" name=\"myComposite\">" +
- "<service name=\"service\">" +
- "<interface.java interface=\"com.ibm.MyInterface\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaInterfaceAnyAttribute=\"Java Interface Value\" />" +
- "<binding.ws xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSAnyAttribute=\"WS Value\" />" +
- "<binding.ejb xmlns:myPrefix=\"http://myPrefix\" myPrefix:myEJBAnyAttribute=\"EJB Value\" />" +
- "<binding.sca xmlns:myPrefix=\"http://myPrefix\" myPrefix:mySCAAnyAttribute=\"SCA Value\" />" +
- "</service>" +
- "<component name=\"component\">" +
- "<implementation.java class=\"com.ibm.test.MyClass\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaImplAnyAttribute=\"Java Impl Value\" />" +
- "</component>" +
- "<component name=\"component1\">" +
- "<implementation.composite xmlns:ns2=\"http://temp\" name=\"ns2:myComposite\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myCompositeImplAnyAttribute=\"Composite Impl Value\" />" +
- "</component>" +
- "<reference name=\"reference\">" +
- "<interface.wsdl interface=\"http://www.example.org/SpaceWarGame/#wsdl.interface(SpaceWarGame)\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSDLInterfaceAnyAttribute=\"WSDL Interface Value\" />" +
- "</reference>" +
- "</composite>";
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
-
- /**
- * Initialize the test environment
- * This takes care to register attribute processors when provided
- *
- * @param attributeProcessor
- * @throws Exception
- */
- private void init(StAXAttributeProcessor<?> attributeProcessor) throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- if(attributeProcessor != null) {
- StAXAttributeProcessorExtensionPoint staxAttributeProcessors = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
- staxAttributeProcessors.addArtifactProcessor(attributeProcessor);
- }
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- /**
- * Read and Write a composite that has a extended attribute
- * and a particular attribute processor
- * @throws Exception
- */
- @Test
- public void testReadWriteCompositeWithAttributeProcessor() throws Exception {
- init(new TestAttributeProcessor());
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML));
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML);
- // System.out.println(bos.toString());
-
- assertEquals(XML, bos.toString());
- }
-
- /**
- * Read and Write a composite that has a extended attribute
- * but no particular processor for it
- * @throws Exception
- */
- @Test
- public void testDefaultReadWriteComposite() throws Exception {
- init(null);
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML));
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML);
- // System.out.println(bos.toString());
-
- assertEquals(XML, bos.toString());
- }
-
-
- @Test
- public void testReadWriteCompositeWithBindings() throws Exception {
- init(null);
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_WITH_EXTENDED_ATTRIBUTES_IN_BINDINGS));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML_WITH_EXTENDED_ATTRIBUTES_IN_BINDINGS);
- // System.out.println(bos.toString());
-
- assertEquals(XML_WITH_EXTENDED_ATTRIBUTES_IN_BINDINGS, bos.toString());
- bos.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.java
deleted file mode 100644
index e99f760e58..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteAnyElementTestCase.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 static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ReadWriteAnyElementTestCase {
- private static final String XML_RECURSIVE_EXTENDED_ELEMENT =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://temp\" name=\"RecursiveExtendedElement\">" +
- "<unknownElement>" +
- "<subUnknownElement1 attribute=\"anyAttribute\" />" +
- "<subUnknownElement2 />" +
- "</unknownElement>" +
- "</composite>";
-
- private static final String XML_UNKNOWN_IMPL =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://temp\" name=\"aaaa\" autowire=\"false\">" +
- "<component name=\"unknownImpl\">" +
- "<implementation.unknown class=\"raymond\" />" +
- "<service name=\"service\">" +
- "<binding.ws name=\"wsName\" />" +
- "<binding.new name=\"newName\" />" +
- "</service>" +
- "</component>" +
- "</composite>";
-
- private static final String XML_UNKNOWN_IMPL_WITH_INVALID_ATTRIBUTE =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://temp\" name=\"aaaa\" autowire=\"false\">" +
- "<component name=\"unknownImpl\">" +
- "<implementation.unknown class=\"raymond\" />" +
- "<service name=\"service\" requires=\"\">" +
- "<binding.ws />" +
- "</service>" +
- "</component>" +
- "</composite>";
-
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, XMLOutputFactory.newInstance(), null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testReadWriteExtendedRecursiveElement() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_RECURSIVE_EXTENDED_ELEMENT));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML_RECURSIVE_EXTENDED_ELEMENT);
- // System.out.println(bos.toString());
-
- assertEquals(XML_RECURSIVE_EXTENDED_ELEMENT, bos.toString());
- bos.close();
- }
-
- @Test
- public void testReadWriteUnknwonImpl() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_UNKNOWN_IMPL));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML_UNKNOWN_IMPL);
- // System.out.println(bos.toString());
-
- assertEquals(XML_UNKNOWN_IMPL, bos.toString());
- bos.close();
- }
-
- // @Test
- @Ignore()
- public void testReadWriteInvalidAttribute() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML_UNKNOWN_IMPL_WITH_INVALID_ATTRIBUTE));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML_UNKNOWN_IMPL);
- // System.out.println(bos.toString());
-
- assertEquals(XML_UNKNOWN_IMPL, bos.toString());
- bos.close();
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.java
deleted file mode 100644
index 312b5c8fab..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadWriteLocalCompositeTestCase.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.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev: 711584 $ $Date: 2008-11-05 15:07:03 +0000 (Wed, 05 Nov 2008) $
- */
-public class ReadWriteLocalCompositeTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
- private static final String LOCAL_COMPOSITE_XML = "<?xml version='1.0' encoding='UTF-8'?>"+
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://localcalc\" name=\"LocalCalculator\" local=\"true\">"+
- "</composite>";
-
- @Override
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- StAXAttributeProcessorExtensionPoint staxAttributeProcessors = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
- staxAttributeProcessors.addArtifactProcessor(new TestAttributeProcessor());
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- @Override
- public void tearDown() throws Exception {
-
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("local.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
- assertTrue(composite.isLocal());
- is.close();
- }
-
- public void testWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("local.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
- assertTrue(composite.isLocal());
- is.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
- System.out.println(bos.toString());
-
- assertEquals(LOCAL_COMPOSITE_XML, bos.toString());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
deleted file mode 100644
index 32a2d94220..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
- */
-public class ResolvePolicyTestCase extends TestCase {
-
- private URLArtifactProcessor<Object> documentProcessor;
- private ModelResolver resolver;
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- resolver = new DefaultModelResolver();
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
-
- // Create StAX processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
- }
-
- public void testResolveConstrainingType() throws Exception {
-
- URL url = getClass().getResource("CalculatorComponent.constrainingType");
- URI uri = URI.create("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- url = getClass().getResource("TestAllCalculator.composite");
- uri = URI.create("TestAllCalculator.constrainingType");
- Composite composite = (Composite)documentProcessor.read(null, uri, url);
- assertNotNull(composite);
-
- url = getClass().getResource("test_definitions.xml");
- uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
-
- preResolvePolicyTests(composite);
- documentProcessor.resolve(scaDefns, resolver);
- documentProcessor.resolve(composite, resolver);
- postResolvePolicyTests(composite);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- private void preResolvePolicyTests(Composite composite) {
- assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
- assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
-
- assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
-
- assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
-
- assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
- assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
- }
-
- private void postResolvePolicyTests(Composite composite) {
- assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
- assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-
- assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
- assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-
- assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
- assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
- assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-
- assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
- assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
- assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
- assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
-
-
- }
-
- public void testResolveComposite() throws Exception {
- URL url = getClass().getResource("Calculator.composite");
- URI uri = URI.create("Calculator.composite");
- Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- url = getClass().getResource("TestAllCalculator.composite");
- uri = URI.create("TestAllCalculator.composite");
- Composite composite = (Composite)documentProcessor.read(null, uri, url);
-
- documentProcessor.resolve(composite, resolver);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
deleted file mode 100644
index df09a56c38..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test resolving SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ResolveTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessorExtensionPoint staxProcessors;
- private ModelResolver resolver;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- resolver = new DefaultModelResolver();
- }
-
- public void testResolveConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- StAXArtifactProcessor<ConstrainingType> constrainingTypeReader = staxProcessors.getProcessor(ConstrainingType.class);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = constrainingTypeReader.read(reader);
- is.close();
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- StAXArtifactProcessor<Composite> compositeReader = staxProcessors.getProcessor(Composite.class);
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
- assertNotNull(composite);
-
- compositeReader.resolve(composite, resolver);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- public void testResolveComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- StAXArtifactProcessor<Composite> compositeReader = staxProcessors.getProcessor(Composite.class);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite nestedComposite = compositeReader.read(reader);
- is.close();
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeReader.read(reader);
- is.close();
-
- compositeReader.resolve(composite, resolver);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java
deleted file mode 100644
index c34e9e3d22..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestAttributeProcessor.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-/**
- * A Attribute Processor used for testing.
- *
- * @version $Rev$ $Date$
- */
-public class TestAttributeProcessor extends BaseStAXArtifactProcessor implements StAXAttributeProcessor<String> {
- private static final QName ATTRIBUTE = new QName("http://test", "customAttribute", "test");
-
- public QName getArtifactType() {
- return ATTRIBUTE;
- }
-
- public String read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- return reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
- }
-
- public void write(String value, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- writer.writeAttribute(ATTRIBUTE.getPrefix(), ATTRIBUTE.getNamespaceURI(),ATTRIBUTE.getLocalPart(), value);
- }
-
- public Class<String> getModelType() {
- return null;
- }
-
- public void resolve(String arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java
deleted file mode 100644
index 16cefc58cf..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestPolicyProcessor.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * A Policy Processor used for testing.
- *
- * @version $Rev$ $Date$
- */
-public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
-
- public QName getArtifactType() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
- return new MockPolicyImplOne();
- }
-
- public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<Policy> getModelType() {
- return Policy.class;
- }
-
- public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
- }
-
-
- public class MockPolicyImplOne implements Policy {
- public QName getSchemaName() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
deleted file mode 100644
index c423df6f7d..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class TestSCABindingFactoryImpl implements SCABindingFactory {
- public SCABinding createSCABinding() {
- return new TestSCABindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
deleted file mode 100644
index 3046f2e630..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.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.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.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * A test cheel for the SCA binding.
- *
- * @version $Rev$ $Date$
- */
-public class TestSCABindingImpl extends ExtensibleImpl implements SCABinding, OptimizableBinding, PolicySetAttachPoint, OperationsConfigurator {
- private String name;
- private String uri;
- private List<Object> extensions = new ArrayList<Object>();
-
- private Component targetComponent;
- private ComponentService targetComponentService;
- private Binding targetBinding;
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType bindingType = new TestSCABindingType();
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- /**
- * Constructs a new SCA binding.
- */
- protected TestSCABindingImpl() {
- }
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- /**
- * @return the targetComponent
- */
- public Component getTargetComponent() {
- return targetComponent;
- }
-
- /**
- * @param targetComponent the targetComponent to set
- */
- public void setTargetComponent(Component targetComponent) {
- this.targetComponent = targetComponent;
- }
-
- /**
- * @return the targetComponentService
- */
- public ComponentService getTargetComponentService() {
- return targetComponentService;
- }
-
- /**
- * @param targetComponentService the targetComponentService to set
- */
- public void setTargetComponentService(ComponentService targetComponentService) {
- this.targetComponentService = targetComponentService;
- }
-
- /**
- * @return the targetBinding
- */
- public Binding getTargetBinding() {
- return targetBinding;
- }
-
- /**
- * @param targetBinding the targetBinding to set
- */
- public void setTargetBinding(Binding targetBinding) {
- this.targetBinding = targetBinding;
- }
-
- public List<PolicySet> getPolicySets() {
- // TODO Auto-generated method stub
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- // TODO Auto-generated method stub
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- // TODO Auto-generated method stub
- return bindingType;
- }
-
- public void setType(IntentAttachPointType type) {
- this.bindingType = type;
- }
-
- private class TestSCABindingType implements IntentAttachPointType {
- private QName name = new QName("http://www.osoa.org/xmlns/sca/1.0","binding");
-
- public List<Intent> getAlwaysProvidedIntents() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<Intent> getMayProvideIntents() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public QName getName() {
- return name;
- }
-
- public boolean isUnresolved() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void setName(QName type) {
- // TODO Auto-generated method stub
-
- }
-
- public void setUnresolved(boolean unresolved) {
- // TODO Auto-generated method stub
-
- }
-
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- this.configuredOperations = configuredOperations;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
deleted file mode 100644
index 76361d4b70..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test the wiring of SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class WireTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private ModelResolver resolver;
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
- private CompositeBuilder compositeBuilder;
- private Monitor monitor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- resolver = new DefaultModelResolver();
-
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- monitor = monitorFactory.createMonitor();
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public void testResolveConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
- is.close();
- assertNotNull(constrainingType);
- resolver.addModel(constrainingType);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- is.close();
- assertNotNull(composite);
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
-
- policyDefinitionsProcessor.resolve(scaDefns, resolver);
-
- staxProcessor.resolve(composite, resolver);
- compositeBuilder.build(composite);
-
- assertEquals(composite.getConstrainingType(), constrainingType);
- assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
- }
-
- public void testResolveComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite nestedComposite = (Composite)staxProcessor.read(reader);
- is.close();
- assertNotNull(nestedComposite);
- resolver.addModel(nestedComposite);
-
- is = getClass().getResourceAsStream("TestAllCalculator.composite");
- reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- is.close();
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
-
- policyDefinitionsProcessor.resolve(scaDefns, resolver);
-
- staxProcessor.resolve(composite, resolver);
- compositeBuilder.build(composite);
-
- assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
deleted file mode 100644
index b859779437..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test writing SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class WriteAllTestCase extends TestCase {
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
- private ModelResolver resolver;
- private CompositeBuilder compositeBuilder;
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
- private Monitor monitor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- resolver = new DefaultModelResolver();
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = new TestSCABindingFactoryImpl();
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- monitor = monitorFactory.createMonitor();
-
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, monitor);
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
- Composite composite = staxProcessor.read(is, Composite.class);
-
- verifyComposite(composite);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
- bos.close();
-
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- composite = staxProcessor.read(bis, Composite.class);
-
- verifyComposite(composite);
-
- }
-
- public void testReadWireWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
- Composite composite = staxProcessor.read(is, Composite.class);
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- SCADefinitions scaDefns = (SCADefinitions)policyDefinitionsProcessor.read(null, uri, url);
- assertNotNull(scaDefns);
- policyDefinitionsProcessor.resolve(scaDefns, resolver);
-
- staxProcessor.resolve(composite, resolver);
- compositeBuilder.build(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
- }
-
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- ComponentType componentType = staxProcessor.read(is, ComponentType.class);
- staxProcessor.resolve(componentType, resolver);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, bos);
- }
-
- public void testReadWriteConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
- staxProcessor.resolve(constrainingType, resolver);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(constrainingType, bos);
- }
-
- private void verifyComposite(Composite composite) {
- assertEquals(composite.getProperties().get(0).getName(),"prop1");
- assertEquals(composite.getProperties().get(0).isMany(), true);
- assertEquals(composite.getProperties().get(1).getName(),"prop2");
- assertEquals(composite.getProperties().get(1).isMustSupply(), true);
- assertEquals(composite.getProperties().get(0).getXSDType(), new QName("http://foo", "MyComplexType"));
- assertEquals(composite.getProperties().get(1).getXSDElement(), new QName("http://www.osoa.org/xmlns/sca/1.0", "MyComplexPropertyValue1"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.java
deleted file mode 100644
index 5188b1c91a..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteNamespacesTestCase.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.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Test writing SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class WriteNamespacesTestCase extends TestCase {
- private StAXArtifactProcessor<Composite> compositeProcessor;
- private XMLOutputFactory outputFactory;
- private XMLInputFactory inputFactory;
-
- @Override
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- //outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
- inputFactory = modelFactories.getFactory(XMLInputFactory.class);
-
- StAXArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = artifactProcessors.getProcessor(Composite.class);
- }
-
- public void testReadWriteComposite() throws Exception {
-
- // Read
- InputStream is = getClass().getResourceAsStream("NestedCalculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = compositeProcessor.read(reader);
- Component component = composite.getComponents().get(0);
- Composite implementation = (Composite)component.getImplementation();
- QName qname = implementation.getName();
-
- // Write
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
- compositeProcessor.write(composite, writer);
- System.out.println(bos);
-
- // Read again
- is = new ByteArrayInputStream(bos.toByteArray());
- reader = inputFactory.createXMLStreamReader(is);
- composite = compositeProcessor.read(reader);
-
- // Compare
- component = composite.getComponents().get(0);
- implementation = (Composite)component.getImplementation();
- assertEquals(qname, implementation.getName());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
deleted file mode 100644
index 602d42a06a..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
+++ /dev/null
@@ -1,59 +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:x="http://x"
- xmlns:calc="http://calc"
- targetNamespace="http://calc"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.java interface="calculator.CalculatorService"/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" multiplicity="0..1" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
- <x:unknownElement uknAttr="attribute1">
- <y:subUnknownElement1 xmlns:y="http://y" uknAttr1="attribute2"/>
- <x:subUnknownElement2 />
- </x:unknownElement>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
deleted file mode 100644
index d6ec9b0ff0..0000000000
--- a/branches/sca-java-1.5.1/modules/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" multiplicity="1..1">
- <interface.java class="calculator.DivideService" />
- </reference>
-
-</constrainingType>
-
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
deleted file mode 100644
index 299eb8c197..0000000000
--- a/branches/sca-java-1.5.1/modules/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 interface="calculator.CalculatorService" />
- </service>
-
- <reference name="divideService">
- <interface.java interface="calculator.DivideService" />
- </reference>
-
-</componentType>
-
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
deleted file mode 100644
index a313dd1e6d..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Multiplicity.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Multiplicity.composite
deleted file mode 100644
index a221c23eec..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Multiplicity.composite
+++ /dev/null
@@ -1,30 +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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" name="composite1" targetNamespace="http://temp">
- <component name="data7">
- <implementation.java class="temp.EchoImpl"/>
- <service name="Echo">
- <interface.wsdl interface="http://echo.webservice#wsdl.interface(Echo)"/>
- </service>
- <reference multiplicity="0..n" name="reference" requires=""/>
- </component>
-
- <reference multiplicity="1..n" name="reference" promote="" requires=""/>
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite
deleted file mode 100644
index 2719ee9162..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/NestedCalculator.composite
+++ /dev/null
@@ -1,29 +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">
-
- <component name="CalculatorServiceComponent">
- <implementation.composite xmlns:n="http://inner" name="n:InnerCalculator"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
deleted file mode 100644
index d29fe85586..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
deleted file mode 100644
index 5091ff700b..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
deleted file mode 100644
index d59e69209d..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
deleted file mode 100644
index 7bc7ccdb83..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml b/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/local.composite b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/local.composite
deleted file mode 100644
index 3bda9ac31c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/local.composite
+++ /dev/null
@@ -1,27 +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://localcalc"
- xmlns:test="http://testlocal"
- targetNamespace="http://localcalc"
- name="LocalCalculator"
- local="true">
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml b/branches/sca-java-1.5.1/modules/assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/test_definitions.xml
deleted file mode 100644
index b79cb6b7b7..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly-xsd/LICENSE b/branches/sca-java-1.5.1/modules/assembly-xsd/LICENSE
deleted file mode 100644
index 646cd58e09..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/LICENSE
+++ /dev/null
@@ -1,281 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-
-
-===============================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-===============================================================================
-
-This module includes XSD files under the following SCA Collaboration license:
-
-License for the Service Component Architecture JavaDoc, Interface Definition files and XSD files.
-
-Permission to copy, make derivative works of, and distribute the Service Component Architecture
-JavaDoc, Interface Definition Files and XSD files in any medium without fee or royalty as part
-of a compliant implementation of the Service Component Architecture Specification is hereby granted.
-The Service Components Architecture Specification may be found at the following location:
-
- http://www.osoa.org/download/attachments/35/SCA_AssemblyModel_V100.pdf
-
-THE SERVICE COMPONENT ARCHITECTURE SPECIFICATION AND THE JAVADOC, INTERFACE DEFINITION FILES AND XSD FILES
-ARE PROVIDED "AS IS," AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS
-SPECIFICATION OR THE JAVADOC, INTERFACE DEFINITION FILES AND XSD FILES AND THE IMPLEMENTATION OF THEIR CONTENTS,
-INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
-NON-INFRINGEMENT OR TITLE. THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL,
-INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR DISTRIBUTION OF THE
-SERVICE COMPONENT ARCHITECTURE SPECIFICATION OR THE JAVADOC, INTERFACE DEFINTION FILES OR XSD FILES.
-
-The name and trademarks of the Authors may NOT be used in any manner, including advertising or
-publicity pertaining to the Service Component Architecture Specification or its contents without specific,
-written prior permission. Title to copyright in the Service Component Architecture Specification and the
-JavaDoc, Interface Definition Files and XSD Files will at all times remain with the Authors.
-
-No other rights are granted by implication, estoppel or otherwise.
-
-===============================================================================
-
-This module includes XSD files under the following W3C(r) Software License:
-
-W3C(r) SOFTWARE NOTICE AND LICENSE
-http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
-This work (and included software, documentation such as READMEs, or other related items)
-is being provided by the copyright holders under the following license. By obtaining,
-using and/or copying this work, you (the licensee) agree that you have read, understood,
-and will comply with the following terms and conditions.
-
-Permission to copy, modify, and distribute this software and its documentation, with or
-without modification, for any purpose and without fee or royalty is hereby granted, provided
-that you include the following on ALL copies of the software and documentation or portions
-thereof, including modifications:
-
- 1. The full text of this NOTICE in a location viewable to users of the redistributed or
- derivative work.
- 2. Any pre-existing intellectual property disclaimers, notices, or terms and conditions.
- If none exist, the W3C Software Short Notice should be included (hypertext is preferred,
- text is permitted) within the body of any redistributed or derivative code.
- 3. Notice of any changes or modifications to the files, including the date changes were
- made. (We recommend you provide URIs to the location from which the code is derived.)
-
-THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
-REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES
-OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
-DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER
-RIGHTS.
-
-COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL
-DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
-
-The name and trademarks of copyright holders may NOT be used in advertising or publicity
-pertaining to the software without specific, written prior permission. Title to copyright
-in this software and any associated documentation will at all times remain with copyright
-holders.
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/NOTICE b/branches/sca-java-1.5.1/modules/assembly-xsd/NOTICE
deleted file mode 100644
index 91c3b75575..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/NOTICE
+++ /dev/null
@@ -1,23 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product also includes software under the SCA Collaboration license
-(see the LICENSE file contained in this distribution), with the following
-copyright:
-
-(c) Copyright SCA Collaboration 2006, 2007
-
-This product also includes software under the W3C(r) Software License
-(see the LICENSE file contained in this distribution), with the following
-copyright:
-
-Copyright (c) 2004 World Wide Web Consortium (Massachusetts Institute of Technology,
-European Research Consortium for Informatics and Mathematics, Keio University).
-All Rights Reserved. This work is distributed under the W3C(r) Software License [1]
-in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
-warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/pom.xml b/branches/sca-java-1.5.1/modules/assembly-xsd/pom.xml
deleted file mode 100644
index 08ddecc516..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/pom.xml
+++ /dev/null
@@ -1,49 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <name>Apache Tuscany SCA Assembly Model XML Schemas</name>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.assembly.xsd</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
deleted file mode 100644
index 69b2701e30..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchema
+++ /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.
-#
-tuscany-sca.xsd \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-all.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-all.xsd
deleted file mode 100644
index 63e83884e0..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-all.xsd
+++ /dev/null
@@ -1,34 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
- <include schemaLocation="sca.xsd"/>
-
- <include schemaLocation="sca-binding-ejb.xsd"/>
-
- <include schemaLocation="sca-implementation-bpel.xsd"/>
- <include schemaLocation="sca-implementation-spring.xsd"/>
- <include schemaLocation="sca-implementation-ejb.xsd"/>
- <include schemaLocation="sca-implementation-jee.xsd"/>
- <include schemaLocation="sca-implementation-web.xsd"/>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
deleted file mode 100644
index b6112f9750..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-ejb.xsd
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="binding.ejb" type="sca:EJBSessionBeanBinding"
- substitutionGroup="sca:binding" />
-
- <simpleType name="BeanType">
- <restriction base="string">
- <enumeration value="stateless"/>
- <enumeration value="stateful"/>
- </restriction>
- </simpleType>
-
- <simpleType name="VersionValue">
- <restriction base="string">
- <enumeration value="EJB2"/>
- <enumeration value="EJB3"/>
- </restriction>
- </simpleType>
-
-
- <complexType name="EJBSessionBeanBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="homeInterface" type="NCName" use="optional"/>
- <attribute name="ejb-link-name" type="string" use="optional"/>
- <attribute name="session-type" type="sca:BeanType" use="optional" default="stateless"/>
- <attribute name="ejb-version" type="sca:VersionValue" use="optional" default="EJB2"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
deleted file mode 100644
index dc8c4c5bd6..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-jms.xsd
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <complexType name="JMSBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <element name="destination" type="sca:Destination" minOccurs="0"/>
- <element name="connectionFactory" type="sca:ConnectionFactory"
- minOccurs="0"/>
- <element name="activationSpec" type="sca:ActivationSpec"
- minOccurs="0"/>
- <element name="response" type="sca:Response" minOccurs="0"/>
- <element name="headers" type="sca:Headers" minOccurs="0"/>
- <element name="resourceAdapter" type="sca:ResourceAdapter"
- minOccurs="0"/>
- <element name="operationProperties" type="sca:OperationProperties"
- minOccurs="0" maxOccurs="unbounded"/>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="correlationScheme"
- default="RequestMsgIDToCorrelID">
- <simpleType>
- <restriction base="string">
- <enumeration value="RequestMsgIDToCorrelID"/>
- <enumeration value="RequestCorrelIDToCorrelID"/>
- <enumeration value="None"/>
- </restriction>
- </simpleType>
- </attribute>
-
- <attribute name="initialContextFactory" type="anyURI"/>
- <attribute name="jndiURL" type="anyURI"/>
- <attribute name="requestConnection" type="QName"/>
- <attribute name="responseConnection" type="QName"/>
- <attribute name="operationProperties" type="QName"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-
- <simpleType name="CreateResource">
- <restriction base="string">
- <enumeration value="always"/>
- <enumeration value="never"/>
- <enumeration value="ifnotexist"/>
- </restriction>
- </simpleType>
-
- <complexType name="Destination">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="anyURI" use="required"/>
- <attribute name="type" use="optional" default="queue">
- <simpleType>
- <restriction base="string">
- <enumeration value="queue"/>
- <enumeration value="topic"/>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="create" type="sca:CreateResource"
- use="optional" default="ifnotexist"/>
- </complexType>
-
- <complexType name="ConnectionFactory">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="anyURI" use="required"/>
- <attribute name="create" type="sca:CreateResource" use="optional"
- default="ifnotexist"/>
- </complexType>
-
- <complexType name="ActivationSpec">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="anyURI" use="required"/>
- <attribute name="create" type="sca:CreateResource"
- use="optional" default="ifnotexist"/>
- </complexType>
-
- <complexType name="Response">
- <sequence>
- <element name="destination" type="sca:Destination" minOccurs="0"/>
- <element name="connectionFactory" type="sca:ConnectionFactory"
- minOccurs="0"/>
- <element name="activationSpec" type="sca:ActivationSpec" minOccurs="0"/>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
-
- <complexType name="Headers">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="JMSType" type="string"/>
- <attribute name="JMSCorrelationID" type="string"/>
- <attribute name="JMSDeliveryMode" type="string"/>
- <attribute name="JMSTimeToLive" type="int"/>
- <attribute name="JMSPriority" type="string"/>
- </complexType>
-
- <complexType name="ResourceAdapter">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="string" use="required"/>
- </complexType>
-
- <complexType name="OperationProperties">
- <sequence>
- <element name="property" type="sca:BindingProperty"
- minOccurs="0" maxOccurs="unbounded"/>
- <element name="headers" type="sca:Headers" minOccurs="0"/>
- </sequence>
- <attribute name="name" type="string" use="required"/>
- <attribute name="nativeOperation" type="string"/>
- </complexType>
-
- <element name="binding.jms" type="sca:JMSBinding"
- substitutionGroup="sca:binding"/>
-
- <complexType name="BindingProperty">
- <simpleContent>
- <extension base="string">
- <attribute name="name" type="NMTOKEN" use="required"/>
- <attribute name="type" type="string" use="optional" default="xs:string"/>
- </extension>
- </simpleContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
deleted file mode 100644
index 02703402ef..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-sca.xsd
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="binding.sca" type="sca:SCABinding"
- substitutionGroup="sca:binding"/>
- <complexType name="SCABinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
deleted file mode 100644
index 53e40f74b1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-binding-webservice.xsd
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- xmlns:wsa="http://www.w3.org/2005/08/addressing"
- elementFormDefault="qualified">
-
- <import namespace="http://www.w3.org/2004/08/wsdl-instance"
- schemaLocation="wsdli.xsd" />
- <import namespace="http://www.w3.org/2005/08/addressing"
- schemaLocation="ws-addr.xsd" />
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="binding.ws" type="sca:WebServiceBinding"
- substitutionGroup="sca:binding"/>
- <complexType name="WebServiceBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <element name="EndpointReference"
- type="wsa:EndpointReferenceType"
- minOccurs="0"
- maxOccurs="unbounded"/>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="wsdlElement" type="anyURI" use="optional"/>
- <attribute ref="wsdli:wsdlLocation" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-contributions.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-contributions.xsd
deleted file mode 100644
index 2da2fedb1f..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-contributions.xsd
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="contribution" type="sca:ContributionType"/>
- <complexType name="ContributionType">
- <sequence>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="deployable" type="sca:DeployableType" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="sca:baseImport"/>
- <element ref="sca:baseExport"/>
- </choice>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##other" processContents="lax"/>
- </complexType>
-
- <complexType name="DeployableType">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="composite" type="QName" use="required"/>
- <anyAttribute namespace="##other" processContents="lax"/>
- </complexType>
-
- <element name="baseImport" type="sca:BaseImportType" abstract="true"/>
- <complexType name="BaseImportType" abstract="true">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="location" type="anyURI" use="optional"/>
- <anyAttribute namespace="##other" processContents="lax"/>
- </complexType>
-
- <element name="import" type="sca:ImportType" substitutionGroup="sca:baseImport"/>
- <complexType name="ImportType">
- <complexContent>
- <extension base="sca:BaseImportType">
- <attribute name="namespace" type="string" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="baseExport" type="sca:BaseExportType" abstract="true"/>
- <complexType name="BaseExportType" abstract="true">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##other" processContents="lax"/>
- </complexType>
-
- <element name="export" type="sca:ExportType" substitutionGroup="sca:baseExport"/>
- <complexType name="ExportType">
- <complexContent>
- <extension base="sca:BaseExportType">
- <attribute name="namespace" type="string" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-core.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-core.xsd
deleted file mode 100644
index f03d0eab01..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-core.xsd
+++ /dev/null
@@ -1,348 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <element name="componentType" type="sca:ComponentType"/>
- <complexType name="ComponentType">
- <sequence>
- <choice minOccurs="0" maxOccurs="1">
- <element ref="sca:implementation"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="service" type="sca:ComponentService" />
- <element name="reference" type="sca:ComponentReference"/>
- <element name="property" type="sca:Property"/>
- </choice>
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- -->
- </sequence>
- <attribute name="constrainingType" type="QName" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="composite" type="sca:Composite"/>
- <complexType name="Composite">
- <sequence>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="include" type="sca:Include"/>
- <element name="service" type="sca:Service"/>
- <element name="property" type="sca:Property"/>
- <element name="component" type="sca:Component"/>
- <element name="reference" type="sca:Reference"/>
- <element name="wire" type="sca:Wire"/>
- <!-- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> -->
- </choice>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="targetNamespace" type="anyURI" use="optional"/>
- <attribute name="local" type="boolean" use="optional" default="false"/>
- <attribute name="autowire" type="boolean" use="optional" default="false"/>
- <attribute name="constrainingType" type="QName" use="optional"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="Service">
- <sequence>
- <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
- <element name="operation" type="sca:Operation" minOccurs="0"
- maxOccurs="unbounded" />
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:binding" />
- <any namespace="##other" processContents="lax"/>
- </choice>
- <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded" />
- -->
- </sequence>
- <attribute name="name" type="NCName" use="required" />
- <attribute name="promote" type="anyURI" use="required" />
- <attribute name="requires" type="sca:listOfQNames" use="optional" />
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax" />
- </complexType>
-
- <element name="interface" type="sca:Interface" abstract="true" />
- <complexType name="Interface" abstract="true"/>
-
- <complexType name="Reference">
- <sequence>
- <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
- <element name="operation" type="sca:Operation" minOccurs="0"
- maxOccurs="unbounded" />
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:binding" />
- <any namespace="##other" processContents="lax" />
- </choice>
- <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded" />
- -->
- </sequence>
- <attribute name="name" type="NCName" use="required" />
- <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
- <attribute name="wiredByImpl" type="boolean" use="optional" default="false"/>
- <attribute name="multiplicity" type="sca:Multiplicity"
- use="optional" default="1..1" />
- <attribute name="promote" type="sca:listOfAnyURIs" use="required" />
- <attribute name="requires" type="sca:listOfQNames" use="optional" />
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax" />
- </complexType>
-
- <complexType name="SCAPropertyBase" mixed="true">
- <!-- mixed="true" to handle simple type -->
- <sequence>
- <any namespace="##any" processContents="lax" minOccurs="0"
- maxOccurs="1" />
- <!-- NOT an extension point; This xsd:any exists to accept
- the element-based or complex type property
- i.e. no element-based extension point under "sca:property" -->
- </sequence>
- </complexType>
-
- <!-- complex type for sca:property declaration -->
- <complexType name="Property" mixed="true">
- <complexContent>
- <extension base="sca:SCAPropertyBase">
- <!-- extension defines the place to hold default value -->
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="type" type="QName" use="optional"/>
- <attribute name="element" type="QName" use="optional"/>
- <attribute name="many" type="boolean" default="false"
- use="optional"/>
- <attribute name="mustSupply" type="boolean" default="false"
- use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- <!-- an extension point ; attribute-based only -->
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="PropertyValue" mixed="true">
- <complexContent>
- <extension base="sca:SCAPropertyBase">
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="type" type="QName" use="optional"/>
- <attribute name="element" type="QName" use="optional"/>
- <attribute name="many" type="boolean" default="false"
- use="optional"/>
- <attribute name="source" type="string" use="optional"/>
- <attribute name="file" type="anyURI" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- <!-- an extension point ; attribute-based only -->
- </extension>
- </complexContent>
- </complexType>
-
- <element name="binding" type="sca:Binding" abstract="true"/>
- <complexType name="Binding" abstract="true">
- <sequence>
- <element name="operation" type="sca:Operation" minOccurs="0"
- maxOccurs="unbounded" />
- </sequence>
- <attribute name="uri" type="anyURI" use="optional"/>
- <attribute name="name" type="QName" use="optional"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- </complexType>
-
- <element name="bindingType" type="sca:BindingType"/>
- <complexType name="BindingType">
- <sequence minOccurs="0" maxOccurs="unbounded">
- <any namespace="##other" processContents="lax" />
- </sequence>
- <attribute name="type" type="QName" use="required"/>
- <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
- <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="callback" type="sca:Callback"/>
- <complexType name="Callback">
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:binding"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="Component">
- <sequence>
- <choice minOccurs="0" maxOccurs="1">
- <element ref="sca:implementation"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="service" type="sca:ComponentService"/>
- <element name="reference" type="sca:ComponentReference"/>
- <element name="property" type="sca:PropertyValue" />
- </choice>
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- -->
- </sequence>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="autowire" type="boolean" use="optional" default="false"/>
- <attribute name="constrainingType" type="QName" use="optional"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="ComponentService">
- <sequence>
- <element ref="sca:interface" minOccurs="0" maxOccurs="1"/>
- <element name="operation" type="sca:Operation" minOccurs="0"
- maxOccurs="unbounded" />
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:binding" />
- <any namespace="##other" processContents="lax"/>
- </choice>
- <element ref="sca:callback" minOccurs="0" maxOccurs="1"/>
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- -->
- </sequence>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="requires" type="sca:listOfQNames"
- use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames"
- use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="ComponentReference">
- <sequence>
- <element ref="sca:interface" minOccurs="0" maxOccurs="1" />
- <element name="operation" type="sca:Operation" minOccurs="0"
- maxOccurs="unbounded" />
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:binding" />
- <any namespace="##other" processContents="lax" />
- </choice>
- <element ref="sca:callback" minOccurs="0" maxOccurs="1" />
- <!--
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded" />
- -->
- </sequence>
- <attribute name="name" type="NCName" use="required" />
- <attribute name="target" type="sca:listOfAnyURIs" use="optional"/>
- <attribute name="multiplicity" type="sca:Multiplicity"
- use="optional" default="1..1" />
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames"
- use="optional"/>
- <anyAttribute namespace="##any" processContents="lax" />
- </complexType>
-
- <element name="implementation" type="sca:Implementation"
- abstract="true" />
- <complexType name="Implementation" abstract="true">
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- </complexType>
-
- <element name="implementationType" type="sca:ImplementationType"/>
- <complexType name="ImplementationType">
- <sequence minOccurs="0" maxOccurs="unbounded">
- <any namespace="##other" processContents="lax" />
- </sequence>
- <attribute name="type" type="QName" use="required"/>
- <attribute name="alwaysProvides" type="sca:listOfQNames" use="optional"/>
- <attribute name="mayProvide" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="Wire">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="source" type="anyURI" use="required"/>
- <attribute name="target" type="anyURI" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="include" type="sca:Include"/>
- <complexType name="Include">
- <attribute name="name" type="QName"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="Operation">
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="constrainingType" type="sca:ConstrainingType"/>
- <complexType name="ConstrainingType">
- <sequence>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="service" type="sca:ComponentService"/>
- <element name="reference" type="sca:ComponentReference"/>
- <element name="property" type="sca:Property" />
- </choice>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="targetNamespace" type="anyURI"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
-
- <simpleType name="Multiplicity">
- <restriction base="string">
- <enumeration value="0..1"/>
- <enumeration value="1..1"/>
- <enumeration value="0..n"/>
- <enumeration value="1..n"/>
- </restriction>
- </simpleType>
-
- <simpleType name="OverrideOptions">
- <restriction base="string">
- <enumeration value="no"/>
- <enumeration value="may"/>
- <enumeration value="must"/>
- </restriction>
- </simpleType>
-
- <!-- Global attribute definition for @requires to permit use of intents
- within WSDL documents -->
- <attribute name="requires" type="sca:listOfQNames"/>
-
- <!-- Global attribute defintion for @endsConversation to mark operations
- as ending a conversation -->
- <attribute name="endsConversation" type="boolean" default="false"/>
-
- <simpleType name="listOfQNames">
- <list itemType="QName"/>
- </simpleType>
-
- <simpleType name="listOfAnyURIs">
- <list itemType="anyURI"/>
- </simpleType>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-definitions.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
deleted file mode 100644
index 0249882a92..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-definitions.xsd
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
- <include schemaLocation="sca-policy.xsd"/>
-
- <element name="definitions">
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="sca:intent"/>
- <element ref="sca:policySet"/>
- <element ref="sca:binding"/>
- <element ref="sca:bindingType"/>
- <element ref="sca:implementationType"/>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- <attribute name="targetNamespace" type="anyURI" use="optional"/>
- </complexType>
- </element>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
deleted file mode 100644
index 87b443fb36..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-bpel.xsd
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<xsd:schema xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified">
-
- <xsd:include schemaLocation="sca-core.xsd" />
-
- <xsd:element name="implementation.bpel" type="BpelImplementation"
- substitutionGroup="implementation" />
-
- <xsd:complexType name="BpelImplementation">
- <xsd:complexContent>
- <xsd:extension base="Implementation">
- <xsd:sequence>
- <xsd:any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="process" type="xsd:QName" use="required" />
- <xsd:anyAttribute namespace="##any" processContents="lax" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
- <xsd:element name="interface.partnerLinkType" type="BpelPartnerLinkType"
- substitutionGroup="interface" />
-
- <xsd:complexType name="BpelPartnerLinkType">
- <xsd:complexContent>
- <xsd:extension base="Interface">
- <xsd:sequence>
- <xsd:any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="type" type="xsd:QName" use="required" />
- <xsd:attribute name="serviceRole" type="xsd:NCName" use="optional" />
- <xsd:anyAttribute namespace="##any" processContents="lax" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
-
-</xsd:schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
deleted file mode 100644
index 99669bc672..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-composite.xsd
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
- <element name="implementation.composite" type="sca:SCAImplementation"
- substitutionGroup="sca:implementation"/>
- <complexType name="SCAImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="QName" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
deleted file mode 100644
index 6f1cf14a4b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-cpp.xsd
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sdo="commonj.sdo/XML"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.cpp" type="sca:CPPImplementation" substitutionGroup="sca:implementation" />
- <complexType name="CPPImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <element name="method" type="sca:CPPImplementationMethod" minOccurs="0" maxOccurs="unbounded" />
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="library" type="NCName" use="required"/>
- <attribute name="header" type="NCName" use="required"/>
- <attribute name="path" type="NCName" use="optional"/>
- <attribute name="class" type="Name" use="optional"/>
- <attribute name="scope" type="sca:CPPImplementationScope" use="optional"/>
- <attribute name="eagerInit" type="boolean" use="optional"/>
- <attribute name="allowsPassByReference" type="boolean" use="optional"/>
- <attribute name="conversationMaxAge" type="string" use="optional"/>
- <attribute name="conversationMaxIdle" type="string" use="optional"/>
- <attribute name="conversationSinglePrincipal" type="boolean" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-
- <simpleType name="CPPImplementationScope">
- <restriction base="string">
- <enumeration value="stateless"/>
- <enumeration value="composite"/>
- <enumeration value="request"/>
- <enumeration value="converstion"/>
- </restriction>
- </simpleType>
-
- <complexType name="CPPImplementationMethod">
- <complexContent>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="allowsPassByReference" type="boolean" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexContent>
- </complexType>
-
-</schema>
-
-
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
deleted file mode 100644
index a7e781b18f..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-ejb.xsd
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.ejb" type="sca:EJBImplementation"
- substitutionGroup="sca:implementation"/>
- <complexType name="EJBImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <!-- we might want to make this refer to the JEE ejb-link type -->
- <attribute name="ejb-link" type="token" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
deleted file mode 100644
index f9d8171b8e..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-java.xsd
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.java" type="sca:JavaImplementation"
- substitutionGroup="sca:implementation"/>
- <complexType name="JavaImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="class" type="NCName" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd
deleted file mode 100644
index 83e6bb75bf..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-jee.xsd
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.jee" type="sca:JEEImplementation" substitutionGroup="sca:implementation" />
- <complexType name="JEEImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0"
- maxOccurs="unbounded" />
- </sequence>
- <attribute name="archive" type="string" use="required" />
- <anyAttribute namespace="##any" processContents="lax" />
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
deleted file mode 100644
index 1cf9fb3ea9..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-spring.xsd
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.spring" type="sca:SpringImplementation"
- substitutionGroup="sca:implementation"/>
- <complexType name="SpringImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="location" type="anyURI" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd
deleted file mode 100644
index a1adf10fd9..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-implementation-web.xsd
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.web" type="sca:WebImplementation"
- substitutionGroup="sca:implementation"/>
- <complexType name="WebImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="web-uri" type="string" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
deleted file mode 100644
index 44f14e5ed5..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-cpp.xsd
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.commonj.org/xmlns/sca/1.0/"
- xmlns:sca="http://www.commonj.org/xmlns/sca/1.0/"
- xmlns:sdo="commonj.sdo/XML"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="interface.cpp" type="sca:CPPInterface" substitutionGroup="sca:interface"/>
-
- <complexType name="CPPInterface">
- <complexContent>
- <extension base="sca:Interface">
- <sequence>
- <element name="method" type="sca:CPPMethod" minOccurs="0" maxOccurs="unbounded" />
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="header" type="NCName" use="required"/>
- <attribute name="class" type="Name" use="required"/>
- <attribute name="callbackHeader" type="NCName" use="optional"/>
- <attribute name="callbackClass" type="Name" use="optional"/>
- <attribute name="remotable" type="boolean" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="CPPMethod">
- <complexContent>
- <attribute name="name" type="NCName" use="required"/>
- <attribute name="oneWay" type="boolean" use="optional"/>
- <attribute name="endConversation" type="boolean" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexContent>
- </complexType>
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
deleted file mode 100644
index 81f939bdb4..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-java.xsd
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="interface.java" type="sca:JavaInterface" substitutionGroup="sca:interface"/>
- <complexType name="JavaInterface">
- <complexContent>
- <extension base="sca:Interface">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="interface" type="NCName" use="required"/>
- <attribute name="callbackInterface" type="NCName" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
deleted file mode 100644
index c1fdfd8f3c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-interface-wsdl.xsd
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="interface.wsdl" type="sca:WSDLPortType" substitutionGroup="sca:interface"/>
- <complexType name="WSDLPortType">
- <complexContent>
- <extension base="sca:Interface">
- <sequence>
- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="interface" type="anyURI" use="required"/>
- <attribute name="callbackInterface" type="anyURI" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-policy.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-policy.xsd
deleted file mode 100644
index 2c4875f36c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca-policy.xsd
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <element name="intent" type="sca:Intent"/>
- <complexType name="Intent">
- <sequence>
- <element name="description" type="string" minOccurs="0" maxOccurs="1" />
- <any namespace="##other" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="QName" use="required"/>
- <attribute name="constrains" type="sca:listOfQNames" use="optional"/>
- <attribute name="requires" type="sca:listOfQNames" use="optional"/>
- <attribute name="excludes" type="sca:listOfQNames" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="policySet" type="sca:PolicySet"/>
- <complexType name="PolicySet">
- <choice minOccurs="0" maxOccurs="unbounded">
- <element name="policySetReference" type="sca:PolicySetReference"/>
- <element name="intentMap" type="sca:IntentMap"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <attribute name="name" type="QName" use="required"/>
- <attribute name="provides" type="sca:listOfQNames" use="optional"/>
- <attribute name="appliesTo" type="string" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="PolicySetReference">
- <attribute name="name" type="QName" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="IntentMap">
- <choice minOccurs="1" maxOccurs="unbounded">
- <element name="qualifier" type="sca:Qualifier"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <attribute name="provides" type="QName" use="required"/>
- <attribute name="default" type="string" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <complexType name="Qualifier">
- <choice minOccurs="1" maxOccurs="unbounded">
- <element name="intentMap" type="sca:IntentMap"/>
- <any namespace="##other" processContents="lax"/>
- </choice>
- <attribute name="name" type="string" use="required"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </complexType>
-
- <element name="allow" type="sca:Allow"/>
- <complexType name="Allow">
- <attribute name="roles" type="string" use="required"/>
- </complexType>
-
- <element name="permitAll" type="sca:PermitAll"/>
- <complexType name="PermitAll"/>
-
- <element name="denyAll" type="sca:DenyAll"/>
- <complexType name="DenyAll"/>
-
- <element name="runAs" type="sca:RunAs"/>
- <complexType name="RunAs">
- <attribute name="role" type="string" use="required"/>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca.xsd
deleted file mode 100644
index b4eae28bfe..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/sca.xsd
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- (c) Copyright SCA Collaboration 2006, 2007 -->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
- <include schemaLocation="sca-core.xsd"/>
-
- <include schemaLocation="sca-interface-java.xsd"/>
- <include schemaLocation="sca-interface-wsdl.xsd"/>
-
- <include schemaLocation="sca-implementation-java.xsd"/>
- <include schemaLocation="sca-implementation-composite.xsd"/>
-
- <include schemaLocation="sca-binding-webservice.xsd"/>
- <include schemaLocation="sca-binding-jms.xsd"/>
- <include schemaLocation="sca-binding-sca.xsd"/>
-
- <include schemaLocation="sca-contributions.xsd"/>
- <include schemaLocation="tuscany-sca-contributions.xsd"/>
-
- <include schemaLocation="sca-definitions.xsd"/>
- <include schemaLocation="sca-policy.xsd"/>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-core.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-core.xsd
deleted file mode 100644
index 325c0c8a59..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-core.xsd
+++ /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.
--->
-
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <!-- wire formats -->
- <element name="wireFormat" type="t:WireFormat" abstract="true"/>
-
- <complexType name="WireFormat" abstract="true"/>
-
- <!-- operation selectors -->
- <element name="operationSelector" type="t:OperationSelector" abstract="true"/>
-
- <complexType name="OperationSelector" abstract="true"/>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd
deleted file mode 100644
index d400810835..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-atom.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.atom" type="t:AtomBinding"/>
-
- <complexType name="AtomBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="title" type="string" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-corba.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-corba.xsd
deleted file mode 100644
index 0baa364f42..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-corba.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.corba" type="t:CorbaBinding"/>
-
- <complexType name="CorbaBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="host" type="string" use="required"/>
- <attribute name="port" type="string" use="optional"/>
- <attribute name="id" type="string" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd
deleted file mode 100644
index 788571de7b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-dwr.xsd
+++ /dev/null
@@ -1,41 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.dwr" type="t:DWRBinding"/>
-
- <complexType name="DWRBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-gdata.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-gdata.xsd
deleted file mode 100644
index 2096a014aa..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-gdata.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.gdata" type="t:GDataBinding"/>
-
- <complexType name="GDataBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="serviceType" type="string" use="required"/>
- <attribute name="username" type="string" use="optional"/>
- <attribute name="password" type="string" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd
deleted file mode 100644
index b5a0d136be..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-http.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <include schemaLocation="tuscany-core.xsd"/>
-
- <element name="binding.http" type="t:HTTPBinding"/>
-
- <complexType name="HTTPBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jms.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jms.xsd
deleted file mode 100644
index e5530105e4..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jms.xsd
+++ /dev/null
@@ -1,132 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-binding-jms.xsd"/>
-
- <include schemaLocation="tuscany-core.xsd"/>
-
- <!-- these schema types are not actually used at the moment as we rely on
- any elements in the underlying JMS binding schema to pull in wireFormat
- and operationSelection elements. However it's useful to keep track of
- what we expect the shape of these elements to be -->
-
-
- <!-- wire formats -->
-
- <complexType name="WireFormatJMSDefaultType">
- <complexContent>
- <extension base="t:WireFormat">
- <attribute name="sendFormat" default="bytes">
- <simpleType>
- <restriction base="string">
- <enumeration value="text"/>
- <enumeration value="bytes"/>
- </restriction>
- </simpleType>
- </attribute>
- </extension>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsdefault"
- type="t:WireFormatJMSDefaultType"
- substitutionGroup="t:wireFormat"/>
-
- <complexType name="WireFormatJMSTextType">
- <complexContent>
- <extension base="t:WireFormat"/>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsText"
- type="t:WireFormatJMSTextType"
- substitutionGroup="t:wireFormat"/>
-
- <complexType name="WireFormatJMSTextXMLType">
- <complexContent>
- <extension base="t:WireFormat"/>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsTextXML"
- type="t:WireFormatJMSTextXMLType"
- substitutionGroup="t:wireFormat"/>
-
- <complexType name="WireFormatJMSBytesType">
- <complexContent>
- <extension base="t:WireFormat"/>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsBytes"
- type="t:WireFormatJMSBytesType"
- substitutionGroup="t:wireFormat"/>
-
- <complexType name="WireFormatJMSBytesXMLType">
- <complexContent>
- <extension base="t:WireFormat"/>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsBytesXML"
- type="t:WireFormatJMSBytesXMLType"
- substitutionGroup="t:wireFormat"/>
-
- <complexType name="WireFormatJMSObjectType">
- <complexContent>
- <extension base="t:WireFormat">
- <attribute name="wrapSingle" default="false">
- <simpleType>
- <restriction base="string">
- <enumeration value="true"/>
- <enumeration value="false"/>
- </restriction>
- </simpleType>
- </attribute>
- </extension>
- </complexContent>
- </complexType>
- <element name="wireFormat.jmsObject"
- type="t:WireFormatJMSObjectType"
- substitutionGroup="t:wireFormat"/>
-
-
- <!-- operation selectors -->
- <complexType name="OperationSelectorJMSDefaultType">
- <complexContent>
- <extension base="t:OperationSelector"/>
- </complexContent>
- </complexType>
- <element name="operationSelector.jmsdefault"
- type="t:OperationSelectorJMSDefaultType"
- substitutionGroup="t:operationSelector"/>
-
- <complexType name="OperationSelectorJMSUserPropType">
- <complexContent>
- <extension base="t:OperationSelector">
- <attribute name="propertyName" type="string"/>
- </extension>
- </complexContent>
- </complexType>
- <element name="operationSelector.jmsUserProp"
- type="t:OperationSelectorJMSUserPropType"
- substitutionGroup="t:operationSelector"/>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd
deleted file mode 100644
index bacfdda781..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-jsonrpc.xsd
+++ /dev/null
@@ -1,41 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.jsonrpc" type="t:JSONRPCBinding"/>
-
- <complexType name="JSONRPCBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd
deleted file mode 100644
index 6d5468b2f9..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-notification.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.notification" type="t:NotificationBinding"/>
-
- <complexType name="NotificationBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="ntm" type="anyURI" use="optional"/>
- <attribute name="notificationType" type="anyURI" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd
deleted file mode 100644
index dbef8fbed6..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rmi.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.rmi" type="t:RMIBinding"/>
-
- <complexType name="RMIBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="host" type="anyURI" use="optional"/>
- <attribute name="port" type="int" use="optional"/>
- <attribute name="serviceName" type="anyURI" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd
deleted file mode 100644
index 5af65aced2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-binding-rss.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="binding.rss" type="t:RSSBinding"/>
-
- <complexType name="RSSBinding">
- <complexContent>
- <extension base="sca:Binding">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax" minOccurs="0"
- maxOccurs="unbounded"/>
- </sequence>
- <attribute name="title" type="string" use="optional"/>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-contributions.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-contributions.xsd
deleted file mode 100644
index 20385e7f2c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-contributions.xsd
+++ /dev/null
@@ -1,62 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <include schemaLocation="sca-contributions.xsd"/>
-
- <element name="import.resource" type="sca:ImportResourceType" substitutionGroup="sca:baseImport"/>
- <complexType name="ImportResourceType">
- <complexContent>
- <extension base="sca:BaseImportType">
- <attribute name="uri" type="anyURI" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="export.resource" type="sca:ExportResourceType" substitutionGroup="sca:baseExport"/>
- <complexType name="ExportResourceType">
- <complexContent>
- <extension base="sca:BaseExportType">
- <attribute name="uri" type="anyURI" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="import.java" type="sca:ImportJavaType" substitutionGroup="sca:baseImport"/>
- <complexType name="ImportJavaType">
- <complexContent>
- <extension base="sca:BaseImportType">
- <attribute name="package" type="string" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="export.java" type="sca:ExportJavaType" substitutionGroup="sca:baseExport"/>
- <complexType name="ExportJavaType">
- <complexContent>
- <extension base="sca:BaseExportType">
- <attribute name="package" type="string" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd
deleted file mode 100644
index 1b5c8aece2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-node.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.node" type="t:NodeImplementation"/>
-
- <complexType name="NodeImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="uri" type="string" use="required"/>
- <attribute name="composite" type="QName" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd
deleted file mode 100644
index f8d437310e..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-notification.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.notification" type="t:NotificationImplementation"/>
-
- <complexType name="NotificationImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="name" type="NCName" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd
deleted file mode 100644
index f8ece54a07..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-osgi.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.osgi" type="t:OSGiImplementation"/>
-
- <!-- TODO Declare the proper attributes and elements -->
- <complexType name="OSGiImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##any" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <anyAttribute namespace="##any" processContents="lax"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd
deleted file mode 100644
index dd596821ea..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-resource.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.resource" type="t:ResourceImplementation"/>
-
- <complexType name="ResourceImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="location" type="anyURI" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd
deleted file mode 100644
index e1723d65f0..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-script.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.script" type="t:ScriptImplementation"/>
-
- <complexType name="ScriptImplementation">
- <complexContent mixed="true">
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="script" type="anyURI" use="optional"/>
- <attribute name="language" type="NCName" use="optional"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd
deleted file mode 100644
index 0c0998595f..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-widget.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.widget" type="t:WidgetImplementation"/>
-
- <complexType name="WidgetImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="location" type="anyURI" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd
deleted file mode 100644
index cdabb697aa..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca-implementation-xquery.xsd
+++ /dev/null
@@ -1,42 +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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- elementFormDefault="qualified">
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-core.xsd"/>
-
- <element name="implementation.xquery" type="t:XQueryImplementation"/>
-
- <complexType name="XQueryImplementation">
- <complexContent>
- <extension base="sca:Implementation">
- <sequence>
- <any namespace="##targetNamespace" processContents="lax"
- minOccurs="0" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="location" type="anyURI" use="required"/>
- </extension>
- </complexContent>
- </complexType>
-
-</schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
deleted file mode 100644
index ba1d8811cc..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/tuscany-sca.xsd
+++ /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.
--->
-<schema xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <import namespace="http://www.w3.org/2004/08/wsdl-instance" schemaLocation="wsdli.xsd"/>
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="sca-all.xsd"/>
- <import namespace="http://data.tuscany.apache.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-data-helper.xsd"/>
-
- <include schemaLocation="tuscany-sca-binding-atom.xsd"/>
- <include schemaLocation="tuscany-sca-binding-corba.xsd"/>
- <include schemaLocation="tuscany-sca-binding-dwr.xsd"/>
- <include schemaLocation="tuscany-sca-binding-gdata.xsd"/>
- <include schemaLocation="tuscany-sca-binding-http.xsd"/>
- <include schemaLocation="tuscany-sca-binding-jsonrpc.xsd"/>
- <include schemaLocation="tuscany-sca-binding-jms.xsd"/>
- <include schemaLocation="tuscany-sca-binding-notification.xsd"/>
- <include schemaLocation="tuscany-sca-binding-rmi.xsd"/>
- <include schemaLocation="tuscany-sca-binding-rss.xsd"/>
-
- <!--
- <include schemaLocation="tuscany-sca-implementation-das.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-data-xml.xsd"/>
- -->
- <include schemaLocation="tuscany-sca-implementation-node.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-notification.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-osgi.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-resource.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-script.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-widget.xsd"/>
- <include schemaLocation="tuscany-sca-implementation-xquery.xsd"/>
-
- <import namespace="http://www.osoa.org/xmlns/sca/1.0" schemaLocation="tuscany-sca-contributions.xsd"/>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/ws-addr.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/ws-addr.xsd
deleted file mode 100644
index 47362edbe2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/ws-addr.xsd
+++ /dev/null
@@ -1,137 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- W3C XML Schema defined in the Web Services Addressing 1.0 specification
- http://www.w3.org/TR/ws-addr-core
-
- Copyright © 2005 World Wide Web Consortium,
-
- (Massachusetts Institute of Technology, European Research Consortium for
- Informatics and Mathematics, Keio University). All Rights Reserved. This
- work is distributed under the W3C® Software License [1] in the hope that
- it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
-
- $Id: ws-addr.xsd,v 1.2 2008/07/23 13:38:16 plehegar Exp $
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
-
- <!-- Constructs from the WS-Addressing Core -->
-
- <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
- <xs:complexType name="EndpointReferenceType" mixed="false">
- <xs:sequence>
- <xs:element name="Address" type="tns:AttributedURIType"/>
- <xs:element ref="tns:ReferenceParameters" minOccurs="0"/>
- <xs:element ref="tns:Metadata" minOccurs="0"/>
- <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
-
- <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType"/>
- <xs:complexType name="ReferenceParametersType" mixed="false">
- <xs:sequence>
- <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
-
- <xs:element name="Metadata" type="tns:MetadataType"/>
- <xs:complexType name="MetadataType" mixed="false">
- <xs:sequence>
- <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
-
- <xs:element name="MessageID" type="tns:AttributedURIType"/>
- <xs:element name="RelatesTo" type="tns:RelatesToType"/>
- <xs:complexType name="RelatesToType" mixed="false">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www.w3.org/2005/08/addressing/reply"/>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:simpleType name="RelationshipTypeOpenEnum">
- <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
- </xs:simpleType>
-
- <xs:simpleType name="RelationshipType">
- <xs:restriction base="xs:anyURI">
- <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
- <xs:element name="From" type="tns:EndpointReferenceType"/>
- <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
- <xs:element name="To" type="tns:AttributedURIType"/>
- <xs:element name="Action" type="tns:AttributedURIType"/>
-
- <xs:complexType name="AttributedURIType" mixed="false">
- <xs:simpleContent>
- <xs:extension base="xs:anyURI">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <!-- Constructs from the WS-Addressing SOAP binding -->
-
- <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
-
- <xs:simpleType name="FaultCodesOpenEnumType">
- <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
- </xs:simpleType>
-
- <xs:simpleType name="FaultCodesType">
- <xs:restriction base="xs:QName">
- <xs:enumeration value="tns:InvalidAddressingHeader"/>
- <xs:enumeration value="tns:InvalidAddress"/>
- <xs:enumeration value="tns:InvalidEPR"/>
- <xs:enumeration value="tns:InvalidCardinality"/>
- <xs:enumeration value="tns:MissingAddressInEPR"/>
- <xs:enumeration value="tns:DuplicateMessageID"/>
- <xs:enumeration value="tns:ActionMismatch"/>
- <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
- <xs:enumeration value="tns:DestinationUnreachable"/>
- <xs:enumeration value="tns:ActionNotSupported"/>
- <xs:enumeration value="tns:EndpointUnavailable"/>
- </xs:restriction>
- </xs:simpleType>
-
- <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
- <xs:complexType name="AttributedUnsignedLongType" mixed="false">
- <xs:simpleContent>
- <xs:extension base="xs:unsignedLong">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
- <xs:complexType name="AttributedQNameType" mixed="false">
- <xs:simpleContent>
- <xs:extension base="xs:QName">
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:extension>
- </xs:simpleContent>
- </xs:complexType>
-
- <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
-
- <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
- <xs:complexType name="ProblemActionType" mixed="false">
- <xs:sequence>
- <xs:element ref="tns:Action" minOccurs="0"/>
- <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
- </xs:sequence>
- <xs:anyAttribute namespace="##other" processContents="lax"/>
- </xs:complexType>
-
-</xs:schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/wsdli.xsd b/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/wsdli.xsd
deleted file mode 100644
index 79af5e9363..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly-xsd/src/main/resources/wsdli.xsd
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "http://www.w3.org/2001/XMLSchema.dtd"-->
-<!-- $Id: wsdl-instance.xsd,v 1.1 2004/08/03 16:02:04 hugo Exp $ -->
-<!--
- W3C XML Schema defined in the Web Services Description (WSDL)
- Version 2.0 specification
- http://www.w3.org/TR/wsdl20
-
- Copyright (c) 2004 World Wide Web Consortium,
-
- (Massachusetts Institute of Technology, European Research Consortium for
- Informatics and Mathematics, Keio University). All Rights Reserved. This
- work is distributed under the W3C(r) Software License [1] in the hope that
- it will be useful, but WITHOUT ANY WARRANTY; without even the implied
- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
--->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance" targetNamespace="http://www.w3.org/2004/08/wsdl-instance" elementFormDefault="qualified" finalDefault="" blockDefault="" attributeFormDefault="unqualified">
-
- <xs:attribute name="wsdlLocation">
- <xs:annotation>
- <xs:documentation>
- This attribute can be used to provide some hints on where
- additional WSDL information for a given namespace can be
- found in order to help with QName resolution
- </xs:documentation>
- </xs:annotation>
- <xs:simpleType>
- <xs:list itemType="xs:anyURI"/>
- </xs:simpleType>
- </xs:attribute>
-
-</xs:schema>
diff --git a/branches/sca-java-1.5.1/modules/assembly/LICENSE b/branches/sca-java-1.5.1/modules/assembly/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly/NOTICE b/branches/sca-java-1.5.1/modules/assembly/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/assembly/pom.xml b/branches/sca-java-1.5.1/modules/assembly/pom.xml
deleted file mode 100644
index 10275c1356..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-assembly</artifactId>
- <name>Apache Tuscany SCA Assembly Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-monitor</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.assembly</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.assembly*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractContract.java
deleted file mode 100644
index b8487d95c5..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface AbstractContract extends Base, Extensible, IntentAttachPoint, OperationsConfigurator {
-
- /**
- * Returns the name of the contract.
- *
- * @return the name of the contract
- */
- String getName();
-
- /**
- * Sets the name of the contract.
- *
- * @param name the name of the contract
- */
- void setName(String name);
-
- /**
- * Returns the interface contract defining the interface and callback
- * interface for the contract.
- *
- * @return the interface contract
- */
- InterfaceContract getInterfaceContract();
-
- /**
- * Sets the interface contract defining the interface and callback
- * interface for the contract.
- *
- * @param interfaceContract the interface contract
- */
- void setInterfaceContract(InterfaceContract interfaceContract);
-
- /**
- * Returns true if this contract is a reference or service created internally
- * to handle a callback interface of another contract, false otherwise.
- *
- * @return true for a callback contract, false otherwise
- */
- boolean isCallback();
-
- /**
- * Sets a flag indicating whether this is a callback contract.
- *
- * @param isCallback true for a callback contract, false otherwise
- */
- void setIsCallback(boolean isCallback);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
deleted file mode 100644
index 05f0e60981..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractProperty.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-
-/**
- * A property allows for the configuration of an implementation with externally
- * set data values. An implementation can have zero or more properties. Each
- * property has a data type, which may be either simple or complex. An
- * implementation may also define a default value for a property.
- *
- * @version $Rev$ $Date$
- */
-public interface AbstractProperty extends Base, Extensible, IntentAttachPoint {
-
- /**
- * Returns the property name.
- *
- * @return the property name
- */
- String getName();
-
- /**
- * Sets the property name.
- *
- * @param name the property name
- */
- void setName(String name);
-
- /**
- * Returns the default value of the property.
- *
- * @return the default value of this property
- */
- Object getValue();
-
- /**
- * Sets the default value of the property.
- *
- * @param defaultValue the default value of this property
- */
- void setValue(Object defaultValue);
-
- /**
- * Returns true if the property allows multiple values.
- *
- * @return true if the property allows multiple values
- */
- boolean isMany();
-
- /**
- * Sets whether or not the property allows multiple values.
- *
- * @param many true if the property should allow multiple values
- */
- void setMany(boolean many);
-
- /**
- * Returns true if a value must be supplied for the property.
- *
- * @return true is a value must be supplied for the property
- */
- boolean isMustSupply();
-
- /**
- * Sets whether a value must be supplied for the property.
- *
- * @param mustSupply set to true to require that a value be supplied for
- * uses of this property
- */
- void setMustSupply(boolean mustSupply);
-
- /**
- * Returns the data type of this property. This is the qualified name of an
- * XML schema type.
- *
- * @return the type of this property
- */
- QName getXSDType();
-
- /**
- * Sets the data type of this property. This is the qualified name of an XML
- * schema type.
- *
- * @param type the type of this property
- */
- void setXSDType(QName type);
-
- /**
- * Returns the element defining the data type of this property. This is the
- * qualified name of an XML schema element.
- *
- * @return the element defining the type of this property
- */
- QName getXSDElement();
-
- /**
- * Sets the element defining the data type of this property. This is the
- * qualified name of an XML schema element.
- *
- * @param element the element defining the type of this property
- */
- void setXSDElement(QName element);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractReference.java
deleted file mode 100644
index a9ef26bbb9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface AbstractReference extends AbstractContract {
-
- /**
- * Returns the multiplicity allowed for wires connected to this reference.
- *
- * @return the multiplicity allowed for wires connected to this reference
- */
- Multiplicity getMultiplicity();
-
- /**
- * Sets the multiplicity allowed for wires connected to this reference.
- *
- * @param multiplicity the multiplicity allowed for wires connected to this
- * reference
- */
- void setMultiplicity(Multiplicity multiplicity);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AbstractService.java
deleted file mode 100644
index 9ae511c07b..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface AbstractService extends AbstractContract {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
deleted file mode 100644
index 8a4fc6dfda..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface AssemblyFactory {
-
- /**
- * Create a new abstract property.
- *
- * @return a new abstract property
- */
- AbstractProperty createAbstractProperty();
-
- /**
- * Create a new abstract reference.
- *
- * @return a new abstract reference
- */
- AbstractReference createAbstractReference();
-
- /**
- * Create a new abstract service.
- *
- * @return a new abstract service
- */
- AbstractService createAbstractService();
-
- /**
- * Create a new callback.
- *
- * @return
- */
- Callback createCallback();
-
- /**
- * Create a new component.
- *
- * @return a new component
- */
- Component createComponent();
-
- /**
- * Create a new component property.
- *
- * @return a new component property
- */
- ComponentProperty createComponentProperty();
-
- /**
- * Create a new component reference.
- *
- * @return a new component reference
- */
- ComponentReference createComponentReference();
-
- /**
- * Create a new component service.
- *
- * @return a new component service
- */
- ComponentService createComponentService();
-
- /**
- * Create a new component type
- *
- * @return a new component type
- */
- ComponentType createComponentType();
-
- /**
- * Create a new composite.
- *
- * @return a new composite
- */
- Composite createComposite();
-
- /**
- * Create a new composite reference.
- *
- * @return a new composite reference
- */
- CompositeReference createCompositeReference();
-
- /**
- * Create a new composite service.
- *
- * @return a new composite service
- */
- CompositeService createCompositeService();
-
- /**
- * Create a new constraining type.
- *
- * @return a new constraining type
- */
- ConstrainingType createConstrainingType();
-
- /**
- * Create a new property.
- *
- * @return a new property
- */
- Property createProperty();
-
- /**
- * Create a new reference.
- *
- * @return a new reference
- */
- Reference createReference();
-
- /**
- * Create a new service.
- *
- * @return a new service
- */
- Service createService();
-
- /**
- * Create a new wire.
- *
- * @return a new wire
- */
- Wire createWire();
-
- /**
- * Create a new configured operation.
- *
- * @return a new ConfiguredOperation
- */
- ConfiguredOperation createConfiguredOperation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Base.java
deleted file mode 100644
index 76511d351d..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Base {
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Binding.java
deleted file mode 100644
index f8b7d4d236..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Binding extends Base, Cloneable {
-
- /**
- * Returns the binding URI.
- *
- * @return the binding URI
- */
- String getURI();
-
- /**
- * Sets the binding URI.
- *
- * @param uri the binding URI
- */
- void setURI(String uri);
-
- /**
- * Returns the binding name.
- *
- * @return the binding name
- */
- String getName();
-
- /**
- * Sets the binding name.
- *
- * @param name the binding name
- */
- void setName(String name);
-
- /**
- * Clone the binding
- *
- * @return
- */
- Object clone() throws CloneNotSupportedException;
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.java
deleted file mode 100644
index 31ff43b5ed..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/BindingRRB.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;
-
-
-/**
- * Represents a binding implemented using Request/Response binding chains
- *
- * @version $Rev$ $Date$
- */
-public interface BindingRRB extends Binding {
-
- public WireFormat getRequestWireFormat();
-
- public void setRequestWireFormat(WireFormat wireFormat);
-
- public WireFormat getResponseWireFormat();
-
- public void setResponseWireFormat(WireFormat wireFormat);
-
- public OperationSelector getOperationSelector();
-
- public void setOperationSelector(OperationSelector operationSelector);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Callback.java
deleted file mode 100644
index f49a653aa9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Callback extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, OperationsConfigurator {
-
- /**
- * Returns the bindings supported for callbacks.
- *
- * @return the bindings supported for callbacks
- */
- List<Binding> getBindings();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
deleted file mode 100644
index 8e1943224c..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Component extends Base, Extensible, PolicySetAttachPoint, Cloneable {
-
- /**
- * Returns the URI of the component.
- *
- * @return the URI of the component
- */
- String getURI();
-
- /**
- * Sets the URI of the component.
- *
- * @param uri the URI of the component
- */
- void setURI(String uri);
-
- /**
- * Returns the name of the component.
- *
- * @return the name of the component
- */
- String getName();
-
- /**
- * Sets the name of the component.
- *
- * @param name the name of the component
- */
- void setName(String name);
-
- /**
- * Returns the component implementation.
- *
- * @return the component implementation
- */
- Implementation getImplementation();
-
- /**
- * Sets the component implementation
- *
- * @param implementation the component implementation
- */
- void setImplementation(Implementation implementation);
-
- /**
- * Returns a list of references used by the component.
- *
- * @return a list of references used by the component
- */
- List<ComponentReference> getReferences();
-
- /**
- * Returns a list of services exposed by the component.
- *
- * @return a list of services exposed by the component
- */
- List<ComponentService> getServices();
-
- /**
- * Returns a list of properties for the component.
- *
- * @return a list of properties
- */
- List<ComponentProperty> getProperties();
-
- /**
- * Returns a constraining type defining the shape of the component.
- *
- * @return a constraining type
- */
- ConstrainingType getConstrainingType();
-
- /**
- * Sets a constraining type defining the shape of the component.
- *
- * @param constrainingType the constraining type
- */
- void setConstrainingType(ConstrainingType constrainingType);
-
- /**
- * Return the Boolean value of autowire
- * @return null/TRUE/FALSE
- */
- Boolean getAutowire();
-
- /**
- * Sets whether component references should be autowired.
- *
- * @param autowire whether component references should be autowired
- */
- void setAutowire(Boolean autowire);
-
-
- /**
- * Returns a clone of the component.
- *
- * @return a clone of the component
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProperty.java
deleted file mode 100644
index 13d19b1757..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface ComponentProperty extends Property {
-
- /**
- * Returns the property defined by the component implementation.
- *
- * @return the property defined by the component implementation
- */
- Property getProperty();
-
- /**
- * Sets the property defined by this component implementation.
- *
- * @param property the property defined by this component implementation
- */
- void setProperty(Property property);
-
- /**
- * Returns an XPath expression referencing a property of the enclosing
- * composite.
- *
- * @return an XPath expression referencing a property of the enclosing
- * composite
- */
- String getSource();
-
- /**
- * Sets an XPath expression referencing a property of the enclosing
- * composite.
- *
- * @param source an XPath expression referencing a property of the enclosing
- * composite
- */
- void setSource(String source);
-
- /**
- * Get the XPath expression for the source attribute
- * @return the XPath expression for the source attribute
- */
- XPathExpression getSourceXPathExpression();
-
- /**
- * Set the XPath expression for the source attribute
- * @param sourceXPathExpression the XPath expression for the source attribute
- */
- void setSourceXPathExpression(XPathExpression sourceXPathExpression);
-
- /**
- * Returns a URI to a file containing the property value.
- *
- * @return a URI to a file containing the property value
- */
- String getFile();
-
- /**
- * Sets a URI to a file containing the property value.
- *
- * @param file a URI to a file containing the property value
- */
- void setFile(String file);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.java
deleted file mode 100644
index ce40bc089b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentReference.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;
-
-import java.util.List;
-
-
-
-/**
- * An instance of a reference associated with a particular component.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentReference extends Reference {
-
- /**
- * Returns the reference defined by the implementation for this reference.
- *
- * @return the implementation reference
- */
- Reference getReference();
-
- /**
- * Sets the reference defined by the implementation for this reference.
- *
- * @param reference the implementation reference
- */
- void setReference(Reference reference);
-
- /**
- * Return the Boolean value of autowire
- * @return null/TRUE/FALSE
- */
- Boolean getAutowire();
-
- /**
- * Sets whether component references should be autowired.
- *
- * @param autowire whether component references should be autowired
- */
- void setAutowire(Boolean autowire);
-
-
- /**
- * Returns the callback service created internally as a target endpoint
- * for callbacks to this reference.
- *
- * @return the callback service
- */
- ComponentService getCallbackService();
-
- /**
- * Sets the callback service created internally as a target endpoint
- * for callbacks to this reference.
- *
- * @param callbackService the callback service
- */
- void setCallbackService(ComponentService callbackService);
-
- /**
- * Returns the endpoints implied by this reference.
- *
- * @return the endpoints implied by this reference
- */
- List<Endpoint> getEndpoints();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentService.java
deleted file mode 100644
index 65945692f1..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface ComponentService extends Service {
-
- /**
- * Returns the service defined by the implementation for this service.
- *
- * @return
- */
- Service getService();
-
- /**
- * Sets the service defined by the implementation for this service.
- *
- * @param service
- */
- void setService(Service service);
-
- /**
- * Returns the callback reference created internally as a source endpoint
- * for callbacks from this service.
- *
- * @return the callback reference
- */
- ComponentReference getCallbackReference();
-
- /**
- * Sets the callback reference created internally as a source endpoint
- * for callbacks from this service.
- *
- * @param callbackReference the callback reference
- */
- void setCallbackReference(ComponentReference callbackReference);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
deleted file mode 100644
index e1ea65ea39..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface ComponentType extends Base {
-
- /**
- * Returns the URI of this component type.
- * @return the URI of the component type
- */
- String getURI();
-
- /**
- * Sets the URI of this component type.
- * @param uri the URI of the component type
- */
- void setURI(String uri);
-
- /**
- * Returns a list of services that are offered.
- *
- * @return a list of services that are offered
- */
- List<Service> getServices();
-
- /**
- * Returns the list of reference types that are used.
- *
- * @return the list of reference types that are used
- */
- List<Reference> getReferences();
-
- /**
- * Returns the list of properties that can be set.
- *
- * @return the list of properties that can be set
- */
- List<Property> getProperties();
-
- /**
- * Returns a constraining type defining the shape of the implementation.
- *
- * @return a constraining type
- */
- ConstrainingType getConstrainingType();
-
- /**
- * Sets a constraining type defining the shape of the implementation.
- *
- * @param constrainingType the constraining type to set
- */
- void setConstrainingType(ConstrainingType constrainingType);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Composite.java
deleted file mode 100644
index 2c7b7c6b9e..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Composite extends Implementation, Extensible, Cloneable, PolicySetAttachPoint {
-
- /**
- * Returns the name of the composite.
- *
- * @return the name of the composite
- */
- QName getName();
-
- /**
- * Sets the name of the composite.
- *
- * @param name the name of the composite
- */
- void setName(QName name);
-
- /**
- * Returns a list of composites included in this composite.
- *
- * @return a list of composites included in this composite.
- */
- List<Composite> getIncludes();
-
- /**
- * Returns a list of components contained in this composite.
- *
- * @return a list of components contained in this composite
- */
- List<Component> getComponents();
-
- /**
- * Returns a list of wires contained in this composite.
- *
- * @return a list of wires contained in this composite
- */
- List<Wire> getWires();
-
- /**
- * Returns true if all the components within the composite must run in the
- * same process.
- *
- * @return true if all the components within the composite must run in the
- * same process
- */
- boolean isLocal();
-
- /**
- * Sets whether all the components within the composite must run in the same
- * process.
- *
- * @param local whether all the components within the composite must run in
- * the same process
- */
- void setLocal(boolean local);
-
- /**
- * Return the Boolean value of autowire
- * @return null/TRUE/FALSE
- */
- Boolean getAutowire();
-
- /**
- * Sets whether component references should be autowired.
- *
- * @param autowire whether component references should be autowired
- */
- void setAutowire(Boolean autowire);
-
-
- /**
- * Returns a clone of the component type.
- *
- * @return a clone of the component type
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeReference.java
deleted file mode 100644
index d3fa80ba74..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface CompositeReference extends Reference {
-
- /**
- * Returns the promoted composite references.
- *
- * @return the promoted composite references
- */
- List<ComponentReference> getPromotedReferences();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeService.java
deleted file mode 100644
index 7143f571f9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface CompositeService extends Service {
-
- /**
- * Returns the promoted component.
- *
- * @return the promoted component.
- */
- Component getPromotedComponent();
-
- /**
- * Sets the promoted component
- *
- * @param promotedComponent the promoted component.
- */
- void setPromotedComponent(Component promotedComponent);
-
- /**
- * Returns the promoted component service .
- *
- * @return the promoted component service.
- */
- ComponentService getPromotedService();
-
- /**
- * Sets the promoted component service
- *
- * @param promotedService the promoted component service.
- */
- void setPromotedService(ComponentService promotedService);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.java
deleted file mode 100644
index 70e873ecf0..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConfiguredOperation.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;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents an Operation. Typically Operation elements are used when there is a
- * need to apply certain facets such as intents and policysets only to a specific
- * operation provided by a service or reference.
- *
- * @version $Rev$ $Date$
- */
-public interface ConfiguredOperation extends Base, Cloneable, PolicySetAttachPoint {
- /**
- * Returns the name of the operation.
- *
- * @return the name of the operation
- */
- String getName();
-
- /**
- * Sets the name of the operation.
- *
- * @param name the name of the operation
- */
- void setName(String name);
-
- /**
- * Returns the name of the service or reference to which this operation belongs.
- * This method is particularly useful when operation elements are specified under implementation
- * elements and it is necessary to identify which of the various services provided by the
- * implementation is referred to by the operation element in question
- *
- * @return the name of the contract to which this operation belongs
- */
- String getContractName();
-
- /**
- * Sets the name of the service or reference to which this operation belongs.
- *
- * @param contractName the name of the contract to which this operation belongs
- */
- void setContractName(String contractName);
-
- /**
- * Sets a list of policy sets.
- *
- * @param policySets
- */
- public void setPolicySets(List<PolicySet> policySets);
-
- /**
- * Sets a list of required intents.
- *
- * @param intents
- */
- public void setRequiredIntents(List<Intent> intents);
-
- /**
- * Clone the ConfiguredOperation
- *
- * @return
- */
- Object clone() throws CloneNotSupportedException;
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ConstrainingType.java
deleted file mode 100644
index 9890bfed68..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface ConstrainingType extends Base, Extensible, IntentAttachPoint {
-
- /**
- * Returns the name of the constrainingType.
- *
- * @return the name of the constrainingType
- */
- QName getName();
-
- /**
- * Sets the name of the constrainingType.
- *
- * @param name the name of the constrainingType
- */
- void setName(QName name);
-
- /**
- * Returns a list of services that are offered.
- *
- * @return a list of services that are offered
- */
- List<AbstractService> getServices();
-
- /**
- * Returns the list of references that are used.
- *
- * @return the list of references that are used
- */
- List<AbstractReference> getReferences();
-
- /**
- * Returns the list of properties that can be set.
- *
- * @return the list of properties that can be set
- */
- List<AbstractProperty> getProperties();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.java
deleted file mode 100644
index f9a62774e6..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Contract.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;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents a contract. A contract can be either a service or a reference.
- *
- * @version $Rev$ $Date$
- */
-public interface Contract extends AbstractContract, PolicySetAttachPoint, Cloneable {
-
- /**
- * Returns the bindings supported by this contract.
- *
- * @return the bindings supported by this contract
- */
- List<Binding> getBindings();
-
- /**
- * Returns a binding of the specified type or null if there is no such
- * binding configured on this contract.
- *
- * @param <B> the binding type
- * @param bindingClass the binding type class
- * @return the binding or null if there is no binding of the specified type
- */
- <B> B getBinding(Class<B> bindingClass);
-
- /**
- * Returns a callback binding of the specified type or null if there is no such
- * callback binding configured on this contract.
- *
- * @param <B> the callback binding type
- * @param bindingClass the callback binding type class
- * @return the callback binding or null if there is no callback binding of the specified type
- */
- <B> B getCallbackBinding(Class<B> bindingClass);
-
- /**
- * Returns a callback definition of the bindings to use for callbacks.
- *
- * @return a definition of the bindings to use for callbacks
- */
- Callback getCallback();
-
- /**
- * Sets a callback definition of the bindings to use for callbacks
- *
- * @param callback a definition of the bindings to use for callbacks
- */
- void setCallback(Callback callback);
-
- /**
- * Returns a clone of the contract.
- *
- * @return a clone of the reference
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
- /**
- * Returns the interface contract given a binding. Important in the case where
- * a reference with multiplicity > 1 has been promoted and has it's list of
- * resolved bindings extended by a promoting reference. Here the binding
- * from the promoting reference may need the interface contract from the
- * promoting reference and not the promoted reference.
- * TODO - remove this wrinkle with better endpoint support.
- *
- * @param binding the binding for which the interface contract is required
- * @return the interface contract
- */
- InterfaceContract getInterfaceContract(Binding binding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultAssemblyFactory.java
deleted file mode 100644
index 5dd256e3c4..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class DefaultAssemblyFactory extends AssemblyFactoryImpl implements AssemblyFactory {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java
deleted file mode 100644
index 6b0c076ee5..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultEndpointFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly;
-
-
-import org.apache.tuscany.sca.assembly.impl.EndpointFactoryImpl;
-
-/**
- * A default factory for the Endpoint model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultEndpointFactory extends EndpointFactoryImpl {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.java
deleted file mode 100644
index 2ed02e214b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefaultExtensionFactory.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;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensionImpl;
-
-public class DefaultExtensionFactory implements ExtensionFactory {
-
- public Extension createExtension() {
- return new ExtensionImpl();
- }
-
- public Extension createExtension(QName name, Object value, boolean isAttribute) {
- return new ExtensionImpl(name, value, isAttribute);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefinitionElement.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefinitionElement.java
deleted file mode 100644
index 366a736ad8..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/DefinitionElement.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;
-
-/**
- * Contains information inherited from an SCA definitions document.
- *
- * @version $Rev$ $Date$
- */
-public interface DefinitionElement {
- /**
- * Returns the target namespace inherited from an SCA definition document
- * @return the namespace
- */
- String getTargetNamespace();
-
- /**
- * Sets the target namespace inherited from an SCA definition document
- *
- * @param ns the target namespace for this SCA Definition
- */
- void setTargetNamespace(String ns);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
deleted file mode 100644
index ee63497fbe..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Endpoint.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * Represents an endpoint (primarily a combination of a target service name and a set of
- * candidate bindings)
- *
- * @version $Rev$ $Date$
- */
-public interface Endpoint extends Base, Cloneable {
-
- /**
- * Get the name of the target service that this endpoint refers to
- *
- * @return target service name
- */
- String getTargetName();
-
- /**
- * Set the name of the target service that this endpoint refers to
- *
- * @param targetName
- */
- void setTargetName(String targetName);
-
- /**
- * Get the source component model object
- *
- * @return source component
- */
- Component getSourceComponent();
-
- /**
- * Set the source component model object
- *
- * @param component the source component for the endpoint
- */
- void setSourceComponent(Component component);
-
- /**
- * Get the source component reference model object
- *
- * @return reference the source component reference for the endpoint
- */
- ComponentReference getSourceComponentReference();
-
- /**
- * Set the source component reference model object
- *
- * @param reference
- */
- void setSourceComponentReference(ComponentReference reference);
-
- /**
- * Get the resolved source binding
- *
- * @return binding the resolved source binding
- */
- Binding getSourceBinding();
-
- /**
- * Set the resolved source binding
- *
- * @param binding the resolved source binding
- */
- void setSourceBinding(Binding binding);
-
- /**
- * Get the resolved source callback binding
- *
- * @return binding the resolved source callback binding
- */
- Binding getSourceCallbackBinding();
-
- /**
- * Set the resolved source callback binding
- *
- * @param binding the resolved source callback binding
- */
- void setSourceCallbackBinding(Binding binding);
-
- /**
- * Get the list of candidate bindings that could be used to
- * communication with the target service
- *
- * @return list of candidate bindings
- */
- List<Binding> getCandidateBindings();
-
-
- /**
- * Get the target component model object
- *
- * @return target component
- */
- Component getTargetComponent();
-
- /**
- * Set the target component model object
- *
- * @param component target component
- */
- void setTargetComponent(Component component);
-
- /**
- * Get the target component service model object
- *
- * @return target component service
- */
- ComponentService getTargetComponentService();
-
- /**
- * Set the target component service model object
- *
- * @param service
- */
- void setTargetComponentService(ComponentService service);
-
- /**
- * Get the resolved target binding
- *
- * @return target binding
- */
- Binding getTargetBinding();
-
- /**
- * Set the resolved target binding
- *
- * @param binding target binding
- */
- void setTargetBinding(Binding binding);
-
- /**
- * Returns the interface contract defining the interface
- *
- * @return the interface contract
- */
- InterfaceContract getInterfaceContract();
-
- /**
- * Sets the interface contract defining the interface
- *
- * @param interfaceContract the interface contract
- */
- void setInterfaceContract(InterfaceContract interfaceContract);
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.java
deleted file mode 100644
index 93e6c4d630..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointFactory.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;
-
-
-
-/**
- * A factory for the endpoint model
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointFactory {
-
- /**
- * Create a new endpoint model object
- *
- * @return a new endpoint
- */
- Endpoint createEndpoint();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.java
deleted file mode 100644
index 593b7de88b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extensible.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;
-
-import java.util.List;
-
-/**
- * Base interface for extensible assembly model objects.
- *
- * @version $Rev$ $Date$
- */
-public interface Extensible {
-
- /**
- * Returns a list of extension objects contained in this model object.
- *
- * @return a list of extension objects container in this model object
- */
- List<Object> getExtensions();
-
- /**
- * Returns a list of attribute extensions contained in this model object
- *
- * @return a list of attribute extensions contained in this model object
- */
- List<Extension> getAttributeExtensions();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
deleted file mode 100644
index 499c97c278..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Extension.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-/**
- * Base interface for storing contents of extensible assembly model objects.
- *
- * @version $Rev$ $Date$
- */
-public interface Extension {
-
- /**
- * Return QName for the extension
- * @return the extension QName
- */
- QName getQName();
-
- /**
- * Set QName for the extension
- * @param qName the extension QName
- */
- void setQName(QName qName);
-
- /**
- * Return the original extension value
- * @return the extension value
- */
- Object getValue();
-
- /**
- * Set the original extension value
- * @param value the extension value
- */
- void setValue(Object value);
-
- /**
- * Return whether or not the extension is an attribute
- * @return
- */
- boolean isAttribute();
-
- /**
- * Set whether or not the extension is an attribute
- * @param value
- */
- void setIsAttribute(boolean isAttribute);
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.java
deleted file mode 100644
index 214cf59748..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ExtensionFactory.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;
-
-import javax.xml.namespace.QName;
-
-public interface ExtensionFactory {
-
- Extension createExtension();
-
- Extension createExtension(QName qName, Object value, boolean isAttribute);
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Implementation.java
deleted file mode 100644
index 720a6801a2..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Implementation extends ComponentType {
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Multiplicity.java
deleted file mode 100644
index 5d15ce9938..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public enum Multiplicity {
-
- /**
- * Zero or one wire can have the reference as a source.
- */
- ZERO_ONE,
-
- /**
- * The default setting, one wire can have the reference as a source.
- */
- ONE_ONE,
-
- /**
- * Zero or more wires can have the reference as a source.
- */
- ZERO_N,
-
- /**
- * One or more wires can have the reference as a source.
- */
- ONE_N
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.java
deleted file mode 100644
index 6770e87ee1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationSelector.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 an operationSelector
- *
- * @version $Rev$ $Date$
- */
-public interface OperationSelector extends Base, Cloneable {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OperationsConfigurator.java
deleted file mode 100644
index 947fcd4c7c..0000000000
--- a/branches/sca-java-1.5.1/modules/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;
-
-/**
- * Interface to be implemented by SCA artifacts that support configuration of 'operation' child
- * elements for policies etc.
- *
- * @version $Rev$ $Date$
- */
-
-public interface OperationsConfigurator {
- List<ConfiguredOperation> getConfiguredOperations();
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/OptimizableBinding.java
deleted file mode 100644
index 98ff92f15b..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- *
- */
-public interface OptimizableBinding extends Binding, Cloneable {
-
- /**
- * @param component
- */
- void setTargetComponent(Component component);
-
- /**
- * @param service
- */
- void setTargetComponentService(ComponentService service);
-
- /**
- * @param binding
- */
- void setTargetBinding(Binding binding);
-
- /**
- * @return
- */
- Binding getTargetBinding();
-
- /**
- * @return
- */
- Component getTargetComponent();
-
- /**
- * @return
- */
- ComponentService getTargetComponentService();
-
- /**
- * Clone the binding
- * @return
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Property.java
deleted file mode 100644
index 683920da58..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Property extends AbstractProperty, PolicySetAttachPoint, Cloneable {
-
- /**
- * Returns a clone of the property.
- *
- * @return a clone of the property
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.java
deleted file mode 100644
index 2eb1bf21b0..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Reference.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;
-
-import java.util.List;
-
-/**
- * Represents a reference. References within an implementation represent links
- * to services that the implementation uses that must be provided by other
- * components.
- *
- * @version $Rev$ $Date$
- */
-public interface Reference extends AbstractReference, Contract {
-
- /**
- * Returns a boolean value, "false" by default, which indicates that the
- * implementation wires this reference dynamically.
- *
- * @return true if the implementation wires this reference dynamically
- */
- boolean isWiredByImpl();
-
- /**
- * Sets a boolean value, "false" by default, which indicates that the
- * implementation wires this reference dynamically.
- *
- * @param wiredByImpl whether the implementation wires this reference
- * dynamically
- */
- void setWiredByImpl(boolean wiredByImpl);
-
- /**
- * Returns a boolean value, "false" by default, which indicates whether
- * the configuration of this reference is a promotion override for
- * another more deeply nested reference.
- *
- * @return true if the reference is a promotion override
- */
- boolean isPromotionOverride();
-
- /**
- * Sets a boolean value, "false" by default, which indicates whether
- * the configuration of this reference is a promotion override for
- * another more deeply nested reference.
- *
- * @param promotionOverride whether the reference is a promotion override
- */
- void setPromotionOverride(boolean promotionOverride);
-
- /**
- * Returns the targets of this reference.
- *
- * @return the targets of this reference.
- */
- List<ComponentService> getTargets();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABinding.java
deleted file mode 100644
index 5afafcbae0..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface SCABinding extends Binding, Extensible {
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/SCABindingFactory.java
deleted file mode 100644
index 0abfd13d10..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface SCABindingFactory {
-
- /**
- * Create a new SCA binding.
- *
- * @return a new SCA binding
- */
- SCABinding createSCABinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Service.java
deleted file mode 100644
index 020870cd34..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Service extends AbstractService, Contract {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Wire.java
deleted file mode 100644
index ee65e5746e..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface Wire extends Base, Extensible, IntentAttachPoint, PolicySetAttachPoint, Cloneable {
-
- /**
- * Returns the source of the wire.
- *
- * @return the source of the wire
- */
- ComponentReference getSource();
-
- /**
- * Sets the source of the wire.
- *
- * @param source the source of the wire
- */
- void setSource(ComponentReference source);
-
- /**
- * Returns the target of the wire.
- *
- * @return the target of the wire
- */
- ComponentService getTarget();
-
- /**
- * Sets the target of the wire.
- *
- * @param target the target of the wire
- */
- void setTarget(ComponentService target);
-
- /**
- * Returns a clone of the wire.
- *
- * @return a clone of the wire
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.java
deleted file mode 100644
index d8c530585e..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/WireFormat.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 wireFormat.
- *
- * @version $Rev$ $Date$
- */
-public interface WireFormat extends Base, Cloneable {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java
deleted file mode 100644
index 97708f9ef5..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/AutomaticBinding.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.builder;
-
-/**
- * Represent a binding that has been added automatically to the model rather
- * than being specified by the user through the composite file
- *
- * @version $Rev$ $Date$
- *
- */
-public interface AutomaticBinding extends Cloneable {
-
- /**
- * @param isAutomatic
- */
- void setIsAutomatic(boolean isAutomatic);
-
- /**
- * @return isAutomatic
- */
- boolean getIsAutomatic();
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.java
deleted file mode 100644
index 7bac630d5b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilder.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.builder;
-
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A builder that handles any build-time configuration needed by bindings.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingBuilder {
-
- /**
- * Configure a binding.
- *
- * @param component The component for the binding's service or reference
- * @param contract The binding's service or reference
- */
- void build(Component component, AbstractContract contract, Binding binding, Monitor monitor);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.java
deleted file mode 100644
index 37ad8af0b3..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/BindingBuilderExtension.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.builder;
-
-/**
- * An extension that can be implemented by bindings to provide a binding builder.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingBuilderExtension {
-
- /**
- * Returns the binding builder.
- *
- * @return the binding builder
- */
- BindingBuilder getBuilder();
-
- /**
- * Sets the binding builder.
- *
- * @param builder the binding builder
- */
- void setBuilder(BindingBuilder builder);
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.java
deleted file mode 100644
index d2fae4d24a..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/ComponentPreProcessor.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.builder;
-
-import org.apache.tuscany.sca.assembly.Component;
-
-/**
- * Interface for Component Pre Processors.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentPreProcessor {
-
- void preProcess(Component component);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilder.java
deleted file mode 100644
index cf38894702..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public interface CompositeBuilder {
-
- /**
- * Build a composite.
- *
- * @param composite
- * @throws CompositeBuilderException
- */
- void build(Composite composite) throws CompositeBuilderException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/CompositeBuilderException.java
deleted file mode 100644
index 5a2015f55e..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class CompositeBuilderException extends Exception {
- private static final long serialVersionUID = -8916323176803443856L;
-
- public CompositeBuilderException() {
- }
-
- public CompositeBuilderException(String message) {
- super(message);
- }
-
- public CompositeBuilderException(Throwable cause) {
- super(cause);
- }
-
- public CompositeBuilderException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.java
deleted file mode 100644
index 13bfbbbeff..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DefaultEndpointBuilder.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;
-
-import java.util.Map;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.builder.impl.EndpointBuilderImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A default builder.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultEndpointBuilder extends EndpointBuilderImpl {
- public DefaultEndpointBuilder (Monitor monitor, Map<Binding, Binding> bindingMap){
- super(monitor, bindingMap);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/DomainBuilder.java
deleted file mode 100644
index 20a17e1bd0..0000000000
--- a/branches/sca-java-1.5.1/modules/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
- */
- List<Composite> wireDomain(Composite domainLevelComposite);
-
- /**
- * Locates the referenced service and updates the URI on the identified binding
- *
- * @param domainLevelComposite
- * @param referenceName
- * @param bindingClassName
- * @param URI
- */
- void updateDomainLevelServiceURI(Composite domainLevelComposite, String referenceName, String bindingClassName, String URI);
-
- /**
- * Get the component name out of the reference name that might look like Component/Service
- *
- * @param referenceName
- * @return
- */
- String getComponentNameFromReference(String referenceName);
-
- /**
- * Get the service name out of the reference name that might look like Component/Service
- *
- * @param referenceName
- * @return
- */
- String getServiceNameFromReference(String referenceName);
-
- /**
- * Find the service object given a reference name
- *
- * @param composite
- * @param referenceName
- * @return
- */
- Service findServiceForReference(Composite composite, String referenceName);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.java
deleted file mode 100644
index eb2977d87a..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/EndpointBuilder.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.Endpoint;
-
-/**
- * A builder that handles the configuration of reference endpoints
- * It collects together the logic so that it can be used at build time
- * or later on during late binding scenarios
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointBuilder {
-
- /**
- * Build an endpoint.
- *
- * @param endpoint
- */
- void build(Endpoint endpoint);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
deleted file mode 100644
index 5e984c3126..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
+++ /dev/null
@@ -1,1515 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
-import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-
-/**
- * Base class for Builder implementations that handles configuration.
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseConfigurationBuilderImpl {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final String BINDING_SCA = "binding.sca";
- private static final QName BINDING_SCA_QNAME = new QName(SCA10_NS, BINDING_SCA);
-
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory;
- private Monitor monitor;
- private InterfaceContractMapper interfaceContractMapper;
- private SCADefinitions policyDefinitions;
- private DocumentBuilderFactory documentBuilderFactory;
- private TransformerFactory transformerFactory;
- private Map<Binding, Binding> bindingMap;
-
- protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- this(assemblyFactory, scaBindingFactory, documentBuilderFactory,
- transformerFactory, interfaceContractMapper, policyDefinitions, monitor, null);
- }
-
- protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor,
- Map<Binding, Binding> bindingMap) {
- this.assemblyFactory = assemblyFactory;
- this.scaBindingFactory = scaBindingFactory;
- this.documentBuilderFactory = documentBuilderFactory;
- this.transformerFactory = transformerFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- this.policyDefinitions = policyDefinitions;
- this.monitor = monitor;
- this.bindingMap = bindingMap;
- }
-
- /**
- * Configure components in the composite.
- *
- * @param composite
- * @param problems
- */
- protected void configureComponents(Composite composite) throws CompositeBuilderException {
- configureComponents(composite, null);
- configureSourcedProperties(composite, null);
- //configureBindingURIs(composite, null, null);
- }
-
- /**
- * Configure components in the composite.
- *
- * @param composite
- * @param uri
- * @param problems
- */
- private void configureComponents(Composite composite, String uri) {
- String parentURI = uri;
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
-
- // Initialize component URI
- String componentURI;
- if (parentURI == null) {
- componentURI = component.getName();
- } else {
- componentURI = URI.create(parentURI + '/').resolve(component.getName()).toString();
- }
- component.setURI(componentURI);
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // Process nested composite
- configureComponents((Composite)implementation, componentURI);
- }
- }
-
- // Initialize service bindings
- List<Service> compositeServices = composite.getServices();
- for (Service service : compositeServices) {
- // Set default binding names
-
- // Create default SCA binding
- if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- service.getBindings().add(scaBinding);
- }
-/*
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
-
- // Binding name defaults to the service name
- if (binding.getName() == null) {
- binding.setName(service.getName());
- }
- }
-
- if (service.getCallback() != null) {
- for (Binding binding : service.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(service.getName());
- }
- }
- }
-*/
- }
-
- // Initialize reference bindings
- for (Reference reference : composite.getReferences()) {
- // Create default SCA binding
- if (reference.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- reference.getBindings().add(scaBinding);
- }
-/*
- // Set binding names
- for (Binding binding : reference.getBindings()) {
- if (binding.getName() == null) {
- binding.setName(reference.getName());
- }
- }
-
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(reference.getName());
- }
- }
- }
-*/
- }
-
- // Initialize all component services and references
- Map<String, Component> components = new HashMap<String, Component>();
- for (Component component : composite.getComponents()) {
-
- // Index all components and check for duplicates
- if (components.containsKey(component.getName())) {
- error("DuplicateComponentName", component, composite.getName().toString(), component.getName());
- } else {
- components.put(component.getName(), component);
- }
-
- // Propagate the autowire flag from the composite to components
- if (component.getAutowire() == null) {
- component.setAutowire(composite.getAutowire());
- }
-
- if (component.getImplementation() instanceof ComponentPreProcessor) {
- ((ComponentPreProcessor)component.getImplementation()).preProcess(component);
- }
-
- // Index properties, services and references
- Map<String, Service> services = new HashMap<String, Service>();
- Map<String, Reference> references = new HashMap<String, Reference>();
- Map<String, Property> properties = new HashMap<String, Property>();
- indexImplementationPropertiesServicesAndReferences(component,
- services,
- references,
- properties);
-
- // Index component services, references and properties
- // Also check for duplicates
- Map<String, ComponentService> componentServices =
- new HashMap<String, ComponentService>();
- Map<String, ComponentReference> componentReferences =
- new HashMap<String, ComponentReference>();
- Map<String, ComponentProperty> componentProperties =
- new HashMap<String, ComponentProperty>();
- indexComponentPropertiesServicesAndReferences(component,
- componentServices,
- componentReferences,
- componentProperties);
-
- // Reconcile component services/references/properties and
- // implementation services/references and create component
- // services/references/properties for the services/references
- // declared by the implementation
- reconcileServices(component, services, componentServices);
- reconcileReferences(component, references, componentReferences);
- reconcileProperties(component, properties, componentProperties);
-
- // Configure or create callback services for component's references
- // with callbacks
- configureCallbackServices(component, componentServices);
-
- // Configure or create callback references for component's services
- // with callbacks
- configureCallbackReferences(component, componentReferences);
-
- // Create self references to the component's services
-// if (!(component.getImplementation() instanceof Composite)) {
-// createSelfReferences(component);
-// }
-
- // Initialize service bindings
- for (ComponentService componentService : component.getServices()) {
-
- // Create default SCA binding
- if (componentService.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- componentService.getBindings().add(scaBinding);
- }
-/*
- // Set binding names
- for (Binding binding : componentService.getBindings()) {
-
- // Binding name defaults to the service name
- if (binding.getName() == null) {
- binding.setName(componentService.getName());
- }
- }
- if (componentService.getCallback() != null) {
- for (Binding binding : componentService.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentService.getName());
- }
- }
- }
-*/
- }
-
- // Initialize reference bindings
- for (ComponentReference componentReference : component.getReferences()) {
-
- // Create default SCA binding
- if (componentReference.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- componentReference.getBindings().add(scaBinding);
- }
-/*
- // Set binding names
- for (Binding binding : componentReference.getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentReference.getName());
- }
- }
- if (componentReference.getCallback() != null) {
- for (Binding binding : componentReference.getCallback().getBindings()) {
- if (binding.getName() == null) {
- binding.setName(componentReference.getName());
- }
- }
- }
-*/
- }
- }
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, String... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, String... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Reconcile component properties and the properties defined by the
- * component type.
- *
- * @param component
- * @param properties
- * @param componentProperties
- * @param problems
- */
- private void reconcileProperties(Component component,
- Map<String, Property> properties,
- Map<String, ComponentProperty> componentProperties) {
-
- // Connect component properties to their properties
- for (ComponentProperty componentProperty : component.getProperties()) {
- Property property = properties.get(componentProperty.getName());
- if (property != null) {
- componentProperty.setProperty(property);
- } else {
- warning("PropertyNotFound", component, component.getName(), componentProperty.getName());
- }
- }
-
- // Create component properties for all properties
- if (component.getImplementation() != null) {
- for (Property property : component.getImplementation().getProperties()) {
- if (!componentProperties.containsKey(property.getName())) {
- ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
- componentProperty.setName(property.getName());
- componentProperty.setMany(property.isMany());
- componentProperty.setXSDElement(property.getXSDElement());
- componentProperty.setXSDType(property.getXSDType());
- componentProperty.setProperty(property);
- component.getProperties().add(componentProperty);
- }
- }
- }
-
- // Reconcile component properties and their properties
- for (ComponentProperty componentProperty : component.getProperties()) {
- Property property = componentProperty.getProperty();
- if (property != null) {
-
- // Check that a component property does not override the
- // mustSupply attribute
- if (!property.isMustSupply() && componentProperty.isMustSupply()) {
- warning("PropertyMustSupplyIncompatible", component, component.getName(), componentProperty.getName());
- }
-
- // Default to the mustSupply attribute specified on the property
- if (!componentProperty.isMustSupply())
- componentProperty.setMustSupply(property.isMustSupply());
-
- // Default to the value specified on the property
- if (componentProperty.getValue() == null) {
- componentProperty.setValue(property.getValue());
- }
-
- // Override the property value for the composite
- if(component.getImplementation() instanceof Composite) {
- property.setValue(componentProperty.getValue());
- }
-
- // Check that a value is supplied
- if (componentProperty.getValue() == null && property.isMustSupply()) {
- warning("PropertyMustSupplyNull", component, component.getName(), componentProperty.getName());
- }
-
- // Check that a a component property does not override the
- // many attribute
- if (!property.isMany() && componentProperty.isMany()) {
-
- warning("PropertyOverrideManyAttribute", component, component.getName(), componentProperty.getName());
- }
-
- // Default to the many attribute defined on the property
- componentProperty.setMany(property.isMany());
-
- // Default to the type and element defined on the property
- if (componentProperty.getXSDType() == null) {
- componentProperty.setXSDType(property.getXSDType());
- }
- if (componentProperty.getXSDElement() == null) {
- componentProperty.setXSDElement(property.getXSDElement());
- }
-
- // Check that a type or element are specified
- if (componentProperty.getXSDElement() == null && componentProperty.getXSDType() == null) {
- warning("NoTypeForComponentProperty", component, component.getName(), componentProperty.getName());
- }
- }
- }
- }
-
- /**
- * Reconcile component references with the references defined on the
- * component type.
- *
- * @param component
- * @param references
- * @param componentReferences
- * @param problems
- */
- private void reconcileReferences(Component component,
- Map<String, Reference> references,
- Map<String, ComponentReference> componentReferences) {
-
- // Connect each component reference to the corresponding reference
- for (ComponentReference componentReference : component.getReferences()) {
- if (componentReference.getReference() != null || componentReference.isCallback()) {
- continue;
- }
- Reference reference = references.get(componentReference.getName());
- if (reference != null) {
- componentReference.setReference(reference);
- } else {
- if (!componentReference.getName().startsWith("$self$.")) {
- error("ReferenceNotFound", component, component.getName(), componentReference.getName());
- }
- }
- }
-
- // Create a component reference for each reference
- if (component.getImplementation() != null) {
- for (Reference reference : component.getImplementation().getReferences()) {
- if (!componentReferences.containsKey(reference.getName())) {
- ComponentReference componentReference =
- assemblyFactory.createComponentReference();
- componentReference.setIsCallback(reference.isCallback());
- componentReference.setName(reference.getName());
- componentReference.setReference(reference);
- component.getReferences().add(componentReference);
- }
- }
- }
-
- // Reconcile each component reference with its reference
- for (ComponentReference componentReference : component.getReferences()) {
- Reference reference = componentReference.getReference();
- if (reference != null) {
- // Reconcile multiplicity
- if (componentReference.getMultiplicity() != null) {
- if (!ReferenceConfigurationUtil.isValidMultiplicityOverride(reference.getMultiplicity(),
- componentReference
- .getMultiplicity())) {
- warning("ReferenceIncompatibleMultiplicity", component, component.getName(), componentReference.getName());
- }
- } else {
- componentReference.setMultiplicity(reference.getMultiplicity());
- }
-
- // Reconcile interface
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- if (componentReference.getInterfaceContract() != null) {
- if (interfaceContract != null && !componentReference.getInterfaceContract().equals(reference
- .getInterfaceContract())) {
- if (!interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
- interfaceContract)) {
- warning("ReferenceIncompatibleComponentInterface", component, component.getName(), componentReference.getName());
- }
- }
- } else {
- componentReference.setInterfaceContract(interfaceContract);
- }
-
- // Reconcile bindings
- if (componentReference.getBindings().isEmpty()) {
- componentReference.getBindings().addAll(reference.getBindings());
- }
-
- // Reconcile callback bindings
- if (componentReference.getCallback() == null) {
- componentReference.setCallback(reference.getCallback());
- if (componentReference.getCallback() == null) {
- // Create an empty callback to avoid null check
- componentReference.setCallback(assemblyFactory.createCallback());
- }
-
- } else if (componentReference.getCallback().getBindings().isEmpty() && reference
- .getCallback() != null) {
- componentReference.getCallback().getBindings().addAll(reference.getCallback()
- .getBindings());
- }
-
- // Propagate autowire setting from the component
- if (componentReference.getAutowire() == null) {
- componentReference.setAutowire(component.getAutowire());
- }
-
- // Reconcile targets
- if (componentReference.getTargets().isEmpty()) {
- componentReference.getTargets().addAll(reference.getTargets());
- }
- }
- }
- }
-
- /**
- * Reconcile component services and services defined on the component type.
- *
- * @param component
- * @param services
- * @param componentServices
- * @param problems
- */
- private void reconcileServices(Component component,
- Map<String, Service> services,
- Map<String, ComponentService> componentServices) {
-
- // Connect each component service to the corresponding service
- for (ComponentService componentService : component.getServices()) {
- if (componentService.getService() != null || componentService.isCallback()) {
- continue;
- }
- Service service = services.get(componentService.getName());
- if (service != null) {
- componentService.setService(service);
- } else {
- warning("ServiceNotFoundForComponentService", component, component.getName(), componentService.getName());
- }
- }
-
- // Create a component service for each service
- if (component.getImplementation() != null) {
- for (Service service : component.getImplementation().getServices()) {
- if (!componentServices.containsKey(service.getName())) {
- ComponentService componentService = assemblyFactory.createComponentService();
- componentService.setIsCallback(service.isCallback());
- String name = service.getName();
- componentService.setName(name);
- componentService.setService(service);
- component.getServices().add(componentService);
- componentServices.put(name, componentService);
- }
- }
- }
-
- //Reconcile each component service with its service
- for (ComponentService componentService : component.getServices()) {
- Service service = componentService.getService();
- if (service != null) {
- // Reconcile interface
- InterfaceContract interfaceContract = service.getInterfaceContract();
- if (componentService.getInterfaceContract() != null) {
- if (interfaceContract != null && !componentService.getInterfaceContract().equals(interfaceContract)) {
- if (!interfaceContractMapper.isCompatible(componentService.getInterfaceContract(),
- interfaceContract)) {
- warning("ServiceIncompatibleComponentInterface", component, component.getName(), componentService.getName());
- }
- }
- } else {
- componentService.setInterfaceContract(interfaceContract);
- }
-
- // Reconcile bindings
- if (componentService.getBindings().isEmpty()) {
- componentService.getBindings().addAll(service.getBindings());
- }
-
- // Reconcile callback bindings
- if (componentService.getCallback() == null) {
- componentService.setCallback(service.getCallback());
- if (componentService.getCallback() == null) {
- // Create an empty callback to avoid null check
- componentService.setCallback(assemblyFactory.createCallback());
- }
- } else if (componentService.getCallback().getBindings().isEmpty() && service
- .getCallback() != null) {
- componentService.getCallback().getBindings().addAll(service.getCallback()
- .getBindings());
- }
- }
- }
- }
-
- private void indexComponentPropertiesServicesAndReferences(Component component,
- Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences,
- Map<String, ComponentProperty> componentProperties) {
- for (ComponentService componentService : component.getServices()) {
- if (componentServices.containsKey(componentService.getName())) {
- warning("DuplicateComponentServiceName", component, component.getName(), componentService.getName());
- } else {
- componentServices.put(componentService.getName(), componentService);
- }
- }
- for (ComponentReference componentReference : component.getReferences()) {
- if (componentReferences.containsKey(componentReference.getName())) {
- error("DuplicateComponentReferenceName", component, component.getName(), componentReference.getName());
- } else {
- componentReferences.put(componentReference.getName(), componentReference);
- }
- }
- for (ComponentProperty componentProperty : component.getProperties()) {
- if (componentProperties.containsKey(componentProperty.getName())) {
- warning("DuplicateComponentPropertyName", component, component.getName(), componentProperty.getName());
- } else {
- componentProperties.put(componentProperty.getName(), componentProperty);
- }
- }
-
- }
-
- private void indexImplementationPropertiesServicesAndReferences(Component component,
- Map<String, Service> services,
- Map<String, Reference> references,
- Map<String, Property> properties) {
- // First check that the component has a resolved implementation
- Implementation implementation = component.getImplementation();
- if (implementation == null) {
- // A component must have an implementation
- warning("NoComponentImplementation", component, component.getName());
-
- } else if (implementation.isUnresolved()) {
-
- // The implementation must be fully resolved
- warning("UnresolvedComponentImplementation", component, component.getName(), implementation.getURI());
-
- } else {
-
- // Index properties, services and references, also check for
- // duplicates
- for (Property property : implementation.getProperties()) {
- if (properties.containsKey(property.getName())) {
- warning("DuplicateImplementationPropertyName", component, component.getName(), property.getName());
- } else {
- properties.put(property.getName(), property);
- }
- }
- for (Service service : implementation.getServices()) {
- if (services.containsKey(service.getName())) {
- warning("DuplicateImplementationServiceName", component, component.getName(), service.getName());
- } else {
- services.put(service.getName(), service);
- }
- }
- for (Reference reference : implementation.getReferences()) {
- if (references.containsKey(reference.getName())) {
- warning("DuplicateImplementationReferenceName", component, component.getName(), reference.getName());
- } else {
- references.put(reference.getName(), reference);
- }
- }
- }
-
- }
-
- /**
- * For all the references with callbacks, create a corresponding callback
- * service.
- *
- * @param component
- */
- private void configureCallbackServices(Component component,
- Map<String, ComponentService> componentServices) {
- for (ComponentReference reference : component.getReferences()) {
- if (reference.getInterfaceContract() != null && // can be null in
- // unit tests
- reference.getInterfaceContract().getCallbackInterface() != null) {
- ComponentService service =
- componentServices.get(reference.getName());
- if (service == null) {
- service = createCallbackService(component, reference);
- }
- if (reference.getCallback() != null) {
- if (service.getBindings().isEmpty()) {
- service.getBindings().addAll(reference.getCallback().getBindings());
- }
- }
- reference.setCallbackService(service);
- }
- }
- }
-
- /**
- * Create a callback service for a component reference
- *
- * @param component
- * @param reference
- */
- private ComponentService createCallbackService(Component component, ComponentReference reference) {
- ComponentService componentService = assemblyFactory.createComponentService();
- componentService.setIsCallback(true);
- componentService.setName(reference.getName());
- try {
- InterfaceContract contract =
- (InterfaceContract)reference.getInterfaceContract().clone();
- contract.setInterface(contract.getCallbackInterface());
- contract.setCallbackInterface(null);
- componentService.setInterfaceContract(contract);
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- Reference implReference = reference.getReference();
- if (implReference != null) {
- Service implService = assemblyFactory.createService();
- implService.setName(implReference.getName());
- try {
- InterfaceContract implContract =
- (InterfaceContract)implReference.getInterfaceContract().clone();
- implContract.setInterface(implContract.getCallbackInterface());
- implContract.setCallbackInterface(null);
- implService.setInterfaceContract(implContract);
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- componentService.setService(implService);
- }
- component.getServices().add(componentService);
- return componentService;
- }
-
- /**
- * For all the services with callbacks, create a corresponding callback
- * reference.
- *
- * @param component
- */
- private void configureCallbackReferences(Component component,
- Map<String, ComponentReference> componentReferences) {
- for (ComponentService service : component.getServices()) {
- if (service.getInterfaceContract() != null && // can be null in
- // unit tests
- service.getInterfaceContract().getCallbackInterface() != null) {
- ComponentReference reference =
- componentReferences.get(service.getName());
- if (reference == null) {
- reference = createCallbackReference(component, service);
- }
- if (service.getCallback() != null) {
- if (reference.getBindings().isEmpty()) {
- reference.getBindings().addAll(service.getCallback().getBindings());
- }
- }
- service.setCallbackReference(reference);
- }
- }
- }
-
- /**
- * Create a callback reference for a component service
- *
- * @param component
- * @param service
- */
- private ComponentReference createCallbackReference(Component component, ComponentService service) {
- return createCallbackReference(component, service, assemblyFactory);
- }
-
- /**
- * Create a callback reference for a component service
- *
- * @param component
- * @param service
- * @param assemblyFactory
- */
- protected static ComponentReference createCallbackReference(Component component,
- ComponentService service,
- AssemblyFactory assemblyFactory) {
- ComponentReference componentReference = assemblyFactory.createComponentReference();
- componentReference.setIsCallback(true);
- componentReference.setName(service.getName());
- try {
- InterfaceContract contract = (InterfaceContract)service.getInterfaceContract().clone();
- contract.setInterface(contract.getCallbackInterface());
- contract.setCallbackInterface(null);
- componentReference.setInterfaceContract(contract);
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- Service implService = service.getService();
- if (implService != null) {
- Reference implReference = assemblyFactory.createReference();
- implReference.setName(implService.getName());
- try {
- InterfaceContract implContract =
- (InterfaceContract)implService.getInterfaceContract().clone();
- implContract.setInterface(implContract.getCallbackInterface());
- implContract.setCallbackInterface(null);
- implReference.setInterfaceContract(implContract);
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- componentReference.setReference(implReference);
- }
- component.getReferences().add(componentReference);
- return componentReference;
- }
-
- /**
- * @param composite
- */
- private void configureSourcedProperties(Composite composite, List<ComponentProperty> propertySettings) {
- // Resolve properties
- Map<String, Property> compositeProperties = new HashMap<String, Property>();
- ComponentProperty componentProperty = null;
- for (Property p : composite.getProperties()) {
- componentProperty = getComponentPropertyByName(p.getName(), propertySettings);
- if (componentProperty != null) {
- compositeProperties.put(p.getName(), componentProperty);
- } else {
- compositeProperties.put(p.getName(), p);
- }
- }
-
- for (Component component : composite.getComponents()) {
- try {
- PropertyConfigurationUtil.sourceComponentProperties(compositeProperties, component,
- documentBuilderFactory, transformerFactory);
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Implementation impl = component.getImplementation();
- if (impl instanceof Composite) {
- configureSourcedProperties((Composite)impl, component.getProperties());
- }
- }
- }
-
- private ComponentProperty getComponentPropertyByName(String propertyName, List<ComponentProperty> properties) {
- if (properties != null) {
- for (ComponentProperty aProperty : properties) {
- if (aProperty.getName().equals(propertyName)) {
- return aProperty;
- }
- }
- }
- return null;
- }
-
- private SCABinding createSCABinding() {
- SCABinding scaBinding = scaBindingFactory.createSCABinding();
-
- // mark the bindings that are added automatically so that they can
- // be disregarded for overriding purposes
- if (scaBinding instanceof AutomaticBinding){
- ((AutomaticBinding)scaBinding).setIsAutomatic(true);
- }
-
- if ( policyDefinitions != null ) {
- for ( IntentAttachPointType attachPointType : policyDefinitions.getBindingTypes() ) {
- if ( attachPointType.getName().equals(BINDING_SCA_QNAME)) {
- ((IntentAttachPoint)scaBinding).setType(attachPointType);
- }
- }
- }
-
- return scaBinding;
- }
-
- /**
- * Called by CompositeBindingURIBuilderImpl
- *
- * @param composite the composite to be configured
- */
- protected void configureBindingURIsAndNames(Composite composite) throws CompositeBuilderException {
- configureBindingURIs(composite, null, null);
- configureBindingNames(composite);
- }
-
- /**
- * Fully resolve the binding URIs based on available information. This includes information
- * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
- * from any associated policies and from the default information for each binding type.
- *
- * @param composite the composite to be configured
- * @param defaultBindings list of default binding configurations
- */
- protected void configureBindingURIs(Composite composite, List<Binding> defaultBindings) throws CompositeBuilderException {
- configureBindingURIs(composite, null, defaultBindings);
- }
-
- /**
- * Fully resolve the binding URIs based on available information. This includes information
- * from the ".composite" files, from resources associated with the binding, e.g. WSDL files,
- * from any associated policies and from the default information for each binding type.
- *
- * NOTE: This method repeats some of the processing performed by the configureComponents()
- * method above. The duplication is needed because NodeConfigurationServiceImpl
- * calls this method without previously calling configureComponents(). In the
- * normal builder sequence used by CompositeBuilderImpl, both of these methods
- * are called.
- *
- * TODO: Share the URL calculation algorithm with the configureComponents() method above
- * although keeping the configureComponents() methods signature as is because when
- * a composite is actually build in a node the node default information is currently
- * available
- *
- * @param composite the composite to be configured
- * @param uri the path to the composite provided through any nested composite component implementations
- * @param defaultBindings list of default binding configurations
- */
- private void configureBindingURIs(Composite composite, String uri, List<Binding> defaultBindings) throws CompositeBuilderException {
-
- String parentComponentURI = uri;
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
-
- // Initialize component URI
- String componentURI;
- if (parentComponentURI == null) {
- componentURI = component.getName();
- } else {
- componentURI = URI.create(parentComponentURI + '/').resolve(component.getName()).toString();
- }
- component.setURI(componentURI);
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // Process nested composite
- configureBindingURIs((Composite)implementation, componentURI, defaultBindings);
- }
- }
-
- // Initialize composite service binding URIs
- List<Service> compositeServices = composite.getServices();
- for (Service service : compositeServices) {
-
- // Create default SCA binding
- if (service.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- service.getBindings().add(scaBinding);
- }
-
- // Create default SCA callback binding
- if (service.getInterfaceContract() != null
- && service.getInterfaceContract().getCallbackInterface() != null
- && service.getCallback() != null
- && service.getCallback().getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- scaBinding.setName(service.getName() + "Callback");
- service.getCallback().getBindings().add(scaBinding);
- }
-
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
- constructBindingName(service, binding);
- constructBindingURI(parentComponentURI, composite, service, binding, defaultBindings);
- }
- }
-
- // Initialize composite reference callback binding URIs
- for (Reference reference : composite.getReferences()) {
-
- // Create default SCA callback binding
- if (reference.getInterfaceContract() != null
- && reference.getInterfaceContract().getCallbackInterface() != null
- && reference.getCallback() != null
- && reference.getCallback().getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- scaBinding.setName(reference.getName() + "Callback");
- reference.getCallback().getBindings().add(scaBinding);
- }
-
- // Initialize binding names and URIs
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
- constructBindingURI(parentComponentURI, composite, reference, 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);
- }
-
- // Create default SCA callback binding
- if (service.getInterfaceContract() != null
- && service.getInterfaceContract().getCallbackInterface() != null
- && service.getCallback() != null
- && service.getCallback().getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- scaBinding.setName(service.getName() + "Callback");
- service.getCallback().getBindings().add(scaBinding);
- }
-
- // Add all SCA bindings for the service callback to the bindingMap
- // so that BindingConfigurationUtil.matchBinding() can identify the node
- // for the target component.
- if (service.getInterfaceContract() != null
- && service.getInterfaceContract().getCallbackInterface() != null
- && service.getCallback() != null
- && bindingMap != null
- && defaultBindings != null) {
- for (Binding binding : service.getCallback().getBindings()) {
- if (binding instanceof SCABinding) {
- for (Binding nodeBinding : defaultBindings) {
- if (nodeBinding instanceof SCABinding) {
- bindingMap.put(binding, nodeBinding);
- break;
- }
- }
- }
- }
- }
-
- // Initialize binding names and URIs
- for (Binding binding : service.getBindings()) {
- constructBindingName(service, binding);
- constructBindingURI(component, service, binding, defaultBindings);
- }
- }
-
- for (ComponentReference reference : component.getReferences()) {
-
- // Create default SCA binding
- if (reference.getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- reference.getBindings().add(scaBinding);
- }
-
- // Add all SCA bindings for the reference to the bindingMap so that
- // BindingConfigurationUtil.matchBinding() can identify the node for
- // the source component.
- if (bindingMap != null && defaultBindings != null) {
- for (Binding binding : reference.getBindings()) {
- if (binding instanceof SCABinding) {
- for (Binding nodeBinding : defaultBindings) {
- if (nodeBinding instanceof SCABinding) {
- bindingMap.put(binding, nodeBinding);
- break;
- }
- }
- }
- }
- }
-
- // Create default SCA callback binding
- if (reference.getInterfaceContract() != null
- && reference.getInterfaceContract().getCallbackInterface() != null
- && reference.getCallback() != null
- && reference.getCallback().getBindings().isEmpty()) {
- SCABinding scaBinding = createSCABinding();
- scaBinding.setName(reference.getName() + "Callback");
- reference.getCallback().getBindings().add(scaBinding);
- }
-
- // Add all SCA bindings for the reference callback to the bindingMap
- // so that BindingConfigurationUtil.matchBinding() can identify the node
- // for the source component.
- if (reference.getInterfaceContract() != null
- && reference.getInterfaceContract().getCallbackInterface() != null
- && reference.getCallback() != null
- && bindingMap != null
- && defaultBindings != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- if (binding instanceof SCABinding) {
- for (Binding nodeBinding : defaultBindings) {
- if (nodeBinding instanceof SCABinding) {
- bindingMap.put(binding, nodeBinding);
- break;
- }
- }
- }
- }
- }
-
- // Initialize binding names and URIs
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
- constructBindingURI(component, reference, binding, defaultBindings);
- }
- }
- }
- }
- }
-
- /**
- * Add default names for callback bindings and reference bindings. Needs to be
- * separate from configureBindingURIs() because configureBindingURIs() is called
- * by NodeConfigurationServiceImpl as well as by CompositeBuilderImpl.
- */
- private void configureBindingNames(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // Process nested composite
- configureBindingNames((Composite)implementation);
- }
- }
-
- // Initialize composite service callback binding names
- for (Service service : composite.getServices()) {
-
- if (service.getCallback() != null) {
- for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
- }
- }
- }
-
- // Initialize composite reference binding names
- for (Reference reference : composite.getReferences()) {
-
- for (Binding binding : reference.getBindings()) {
- constructBindingName(reference, binding);
- }
-
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
- }
- }
- }
-
- // Initialize component service and reference binding names
- for (Component component : composite.getComponents()) {
-
- // Initialize component service callback binding names
- for (ComponentService service : component.getServices()) {
-
- if (service.getCallback() != null) {
- for (Binding binding : service.getCallback().getBindings()) {
- constructBindingName(service, binding);
- }
- }
- }
-
- // Initialize component reference binding names
- for (ComponentReference reference : component.getReferences()) {
-
- // Initialize binding names
- for (Binding binding : reference.getBindings()) {
- constructBindingName(reference, binding);
- }
-
- if (reference.getCallback() != null) {
- for (Binding binding : reference.getCallback().getBindings()) {
- constructBindingName(reference, binding);
- }
- }
- }
- }
- }
-
- /**
- * If a binding name is not provided by the user, construct it based on the service
- * or reference name
- *
- * @param contract the service or reference
- * @param binding
- */
- private void constructBindingName(Contract contract, Binding binding) {
- if(binding == null) {
- warning("Binding is null", binding, contract.getName());
- return;
- }
-
- // set the default binding name if one is required
- // if there is no name on the binding then set it to the service or reference name
- if (binding.getName() == null){
- binding.setName(contract.getName());
- }
-
- // Check that multiple bindings do not have the same name
- for (Binding otherBinding : contract.getBindings()) {
- if (otherBinding == binding) {
- // Skip the current binding
- continue;
- }
- if (binding.getClass() != otherBinding.getClass()) {
- // Look for a binding of the same type
- continue;
- }
- if (binding.getName().equals(otherBinding.getName())) {
- warning(contract instanceof Service ? "MultipleBindingsForService" : "MultipleBindingsForReference",
- binding, contract.getName(), binding.getName());
- }
- }
- }
-
- /**
- * URI construction for composite bindings based on Assembly Specification section 1.7.2, This method
- * assumes that the component URI part of the binding URI is formed from the part to the
- * composite in question and just calls the generic constructBindingURI method with this
- * information
- *
- * @param parentComponentURI
- * @param composite
- * @param service
- * @param binding
- * @param defaultBindings
- */
- private void constructBindingURI(String parentComponentURI, Composite composite, Service service, Binding binding, List<Binding> defaultBindings)
- throws CompositeBuilderException{
- // This is a composite service so there is no component to provide a component URI
- // The path to this composite (through nested composites) is used.
- boolean includeBindingName = composite.getServices().size() != 1;
- constructBindingURI(parentComponentURI, service, binding, includeBindingName, defaultBindings);
- }
-
- private void constructBindingURI(String parentComponentURI, Composite composite, Reference reference, Binding binding, List<Binding> defaultBindings)
- throws CompositeBuilderException{
- // This is a composite reference so there is no component to provide a component URI
- // The path to this composite (through nested composites) is used.
- boolean includeBindingName = true;
- constructBindingURI(parentComponentURI, reference, 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);
- }
-
- private void constructBindingURI(Component component, Reference reference, Binding binding, List<Binding> defaultBindings)
- throws CompositeBuilderException{
- boolean includeBindingName = true;
- constructBindingURI(component.getURI(), reference, 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, Contract contract, 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()){
- // if the domain manager is generating a URI for an SCA binding,
- // tentatively omit the base URI for now. The base URI will be added
- // to the service URI by BindingConfigurationUtil.matchBinding()
- // if the service needs a remote SCA binding because it is a
- // wiring target for a reference running on a different node.
- if (bindingMap != null && binding instanceof SCABinding) {
- bindingMap.put(binding, defaultBinding);
- } else {
- baseURI = new URI(addSlashToPath(defaultBinding.getURI()));
- }
- break;
- }
- }
- }
-
- binding.setURI(constructBindingURI(baseURI, componentURI, bindingURI, includeBindingName, bindingName));
- } catch (URISyntaxException ex) {
- error("URLSyntaxException", binding, componentURIString, contract.getName(), binding.getName());
- }
- }
-
- /**
- * Use to ensure that URI paths end in "/" as here we want to maintain the
- * last path element of an base URI when other URI are resolved against it. This is
- * not the default behaviour of URI resolution as defined in RFC 2369
- *
- * @param path the path string to which the "/" is to be added
- * @return the resulting path with a "/" added if it not already there
- */
- private static String addSlashToPath(String path){
- if (path.endsWith("/") || path.endsWith("#")){
- return path;
- } else {
- return path + "/";
- }
- }
-
- /**
- * Concatenate binding URI parts together based on Assembly Specification section 1.7.2
- *
- * @param baseURI the base of the binding URI
- * @param componentURI the middle part of the binding URI derived from the component name
- * @param bindingURI the end part of the binding URI
- * @param includeBindingName when set true the binding name part should be used
- * @param bindingName the binding name
- * @return the resulting URI as a string
- */
- private static String constructBindingURI(URI baseURI, URI componentURI, URI bindingURI, boolean includeBindingName, URI bindingName){
- String uriString;
-
- if (baseURI == null) {
- if (componentURI == null){
- if (bindingURI != null ) {
- uriString = bindingURI.toString();
- } else {
- uriString = bindingName.toString();
- }
- } else {
- if (bindingURI != null ) {
- uriString = componentURI.resolve(bindingURI).toString();
- } else {
- if (includeBindingName) {
- uriString = componentURI.resolve(bindingName).toString();
- } else {
- uriString = componentURI.toString();
- }
- }
- }
- } else {
- if (componentURI == null) {
- if (bindingURI != null ) {
- uriString = basedURI(baseURI, bindingURI).toString();
- } else {
- if (includeBindingName) {
- uriString = basedURI(baseURI, bindingName).toString();
- } else {
- uriString = baseURI.toString();
- }
- }
- } else {
- if (bindingURI != null ) {
- uriString = basedURI(baseURI, componentURI.resolve(bindingURI)).toString();
- } else {
- if (includeBindingName) {
- uriString = basedURI(baseURI, componentURI.resolve(bindingName)).toString();
- } else {
- uriString = basedURI(baseURI, componentURI).toString();
- }
- }
- }
- }
-
- // tidy up by removing any trailing "/"
- if (uriString.endsWith("/")){
- uriString = uriString.substring(0, uriString.length()-1);
- }
-
- URI uri = URI.create(uriString);
- if (!uri.isAbsolute()) {
- uri = URI.create("/").resolve(uri);
- }
- return uri.toString();
- }
-
- /**
- * Combine a URI with a base URI.
- *
- * @param baseURI
- * @param uri
- * @return
- */
- private static URI basedURI(URI baseURI, URI uri) {
- if (uri.getScheme() != null) {
- return uri;
- }
- String str = uri.toString();
- if (str.startsWith("/")) {
- str = str.substring(1);
- }
- return URI.create(baseURI.toString() + str).normalize();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
deleted file mode 100644
index cc70cbcac8..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
+++ /dev/null
@@ -1,1154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.Wire;
-import org.apache.tuscany.sca.assembly.builder.DefaultEndpointBuilder;
-import org.apache.tuscany.sca.assembly.builder.EndpointBuilder;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-
-/**
- * A composite builder that handles wiring inside a composite.
- *
- * @version $Rev$ $Date$
- */
-class BaseWireBuilderImpl {
-
- private Monitor monitor;
- private AssemblyFactory assemblyFactory;
- private EndpointFactory endpointFactory;
- private InterfaceContractMapper interfaceContractMapper;
- private Map<Binding, Binding> bindingMap;
- private EndpointBuilder endpointBuilder;
-
- protected BaseWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory,
- InterfaceContractMapper interfaceContractMapper, Monitor monitor,
- Map<Binding, Binding> bindingMap) {
- this.assemblyFactory = assemblyFactory;
- this.endpointFactory = endpointFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- this.monitor = monitor;
- this.bindingMap = bindingMap;
- this.endpointBuilder = new DefaultEndpointBuilder(monitor, bindingMap);
- }
-
- /**
- * Wire component references to component services and connect promoted
- * services/references to component services/references inside a composite.
- *
- * @param composite
- */
- protected void wireComponentReferences(Composite composite) {
-
- // Wire nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- wireComponentReferences((Composite)implementation);
- }
- }
-
- // Index components, services and references
- Map<String, Component> components = new HashMap<String, Component>();
- Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
- Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
- indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-
- // Connect composite services and references to the component
- // services and references that they promote
- //connectCompositeServices(composite, components, componentServices);
- //connectCompositeReferences(composite, componentReferences);
-
- // Compute the policies before connecting component references
- //computePolicies(composite);
-
- // Connect component references as described in wires
- connectWires(composite, componentServices, componentReferences);
-
- // Connect component references to their targets
- connectComponentReferences(composite, components, componentServices, componentReferences);
-
- // Validate that references are wired or promoted, according
- // to their multiplicity
- for (ComponentReference componentReference : componentReferences.values()) {
- if (!ReferenceConfigurationUtil.validateMultiplicityAndTargets(componentReference.getMultiplicity(), componentReference
- .getTargets(), componentReference.getBindings())) {
- if (componentReference.getTargets().isEmpty()) {
-
- // No warning if the reference is promoted out of the current composite
- boolean promoted = false;
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- if (compositeReference.getPromotedReferences().contains(componentReference)) {
- promoted = true;
- break;
- }
- }
- if (!promoted && !componentReference.isCallback()) {
- warning("ReferenceWithoutTargets", composite, composite.getName().toString(), componentReference.getName());
- }
- } else {
- warning("TooManyReferenceTargets", composite, componentReference.getName());
- }
- }
- }
-
- // Finally clear the original reference target lists as we now have
- // bindings to represent the targets
- for (ComponentReference componentReference : componentReferences.values()) {
- componentReference.getTargets().clear();
- }
- }
-
- /**
- * Index components, services and references inside a composite.
- * @param composite
- * @param components
- * @param componentServices
- * @param componentReferences
- */
- private void indexComponentsServicesAndReferences(Composite composite,
- Map<String, Component> components,
- Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences) {
-
- for (Component component : composite.getComponents()) {
-
- // Index components by name
- components.put(component.getName(), component);
-
- ComponentService nonCallbackService = null;
- int nonCallbackServices = 0;
- for (ComponentService componentService : component.getServices()) {
-
- // Index component services by component name / service name
- String uri = component.getName() + '/' + componentService.getName();
- componentServices.put(uri, componentService);
-
- boolean promotedService = false;
- if (componentService.getName() != null && componentService.getName().indexOf("$promoted$") > -1) {
- promotedService = true;
- }
-
- // count how many non-callback, non-promoted services there are
- // if there is only one the component name also acts as the service name
- if ((!componentService.isCallback()) && (!promotedService)) {
-
- // Check how many non callback non-promoted services we have
- if (nonCallbackServices == 0) {
- nonCallbackService = componentService;
- }
- nonCallbackServices++;
- }
-
- }
-
- if (nonCallbackServices == 1) {
- // If we have a single non callback service, index it by
- // component name as well
- componentServices.put(component.getName(), nonCallbackService);
- }
-
- // Index references by component name / reference name
- for (ComponentReference componentReference : component.getReferences()) {
- String uri = component.getName() + '/' + componentReference.getName();
- componentReferences.put(uri, componentReference);
- }
- }
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, String... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = null;
- problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Connect composite references and services to the reference and services that they promote.
- *
- * @param composite
- * @param componentServices
- * @param problems
- */
- protected void connectCompositeReferencesAndServices(Composite composite){
- // Wire nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- connectCompositeReferencesAndServices((Composite)implementation);
- }
- }
-
- // Index components, services and references
- Map<String, Component> components = new HashMap<String, Component>();
- Map<String, ComponentService> componentServices = new HashMap<String, ComponentService>();
- Map<String, ComponentReference> componentReferences = new HashMap<String, ComponentReference>();
- indexComponentsServicesAndReferences(composite, components, componentServices, componentReferences);
-
- // Connect composite services and references to the component
- // services and references that they promote
- connectCompositeServices(composite, components, componentServices);
- connectCompositeReferences(composite, componentReferences);
- }
-
- /**
- * Connect composite services to the component services that they promote.
- *
- * @param composite
- * @param componentServices
- * @param problems
- */
- private void connectCompositeServices(Composite composite,
- Map<String, Component> components,
- Map<String, ComponentService> componentServices) {
-
- // Propagate interfaces from inner composite components' services to
- // their component services
- for (Component component : composite.getComponents()) {
- if (component.getImplementation() instanceof Composite) {
- for (ComponentService componentService : component.getServices()) {
- Service service = componentService.getService();
- if (service != null) {
- if (componentService.getInterfaceContract() == null) {
- componentService.setInterfaceContract(service.getInterfaceContract());
- }
- }
- }
- }
- }
-
- // Connect composite services to the component services that they
- // promote
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null && componentService.isUnresolved()) {
-
- String promotedComponentName = compositeService.getPromotedComponent().getName();
- String promotedServiceName;
- if (componentService.getName() != null) {
- promotedServiceName = promotedComponentName + '/' + componentService.getName();
- } else {
- promotedServiceName = promotedComponentName;
- }
- ComponentService promotedService = componentServices.get(promotedServiceName);
- if (promotedService != null) {
-
- // Point to the resolved component
- Component promotedComponent = components.get(promotedComponentName);
- compositeService.setPromotedComponent(promotedComponent);
-
- // Point to the resolved component service
- compositeService.setPromotedService(promotedService);
-
- // Use the interface contract from the component service if
- // none is specified on the composite service
- InterfaceContract compositeServiceInterfaceContract = compositeService.getInterfaceContract();
- InterfaceContract promotedServiceInterfaceContract = promotedService.getInterfaceContract();
- if (compositeServiceInterfaceContract == null) {
- compositeService.setInterfaceContract(promotedServiceInterfaceContract);
- } else if (promotedServiceInterfaceContract != null) {
- // Check the compositeServiceInterfaceContract and promotedServiceInterfaceContract
- boolean isCompatible = interfaceContractMapper.isCompatible(compositeServiceInterfaceContract, promotedServiceInterfaceContract);
- if(!isCompatible){
- warning("ServiceInterfaceNotSubSet", compositeService, promotedServiceName);
- }
- }
-
- } else {
- warning("PromotedServiceNotFound", composite, composite.getName().toString(), promotedServiceName);
- }
- }
- }
-
- }
-
- /**
- * Resolves promoted references.
- *
- * @param composite
- * @param componentReferences
- * @param problems
- */
- private void connectCompositeReferences(Composite composite, Map<String, ComponentReference> componentReferences) {
-
- // Propagate interfaces from inner composite components' references to
- // their component references
- for (Component component : composite.getComponents()) {
- if (component.getImplementation() instanceof Composite) {
- for (ComponentReference componentReference : component.getReferences()) {
- Reference reference = componentReference.getReference();
- if (reference != null) {
- if (componentReference.getInterfaceContract() == null) {
- componentReference.setInterfaceContract(reference.getInterfaceContract());
- }
- }
- }
- }
- }
-
- // Connect composite references to the component references
- // that they promote
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- List<ComponentReference> promotedReferences = compositeReference.getPromotedReferences();
- for (int i = 0, n = promotedReferences.size(); i < n; i++) {
- ComponentReference componentReference = promotedReferences.get(i);
- if (componentReference.isUnresolved()) {
- String componentReferenceName = componentReference.getName();
- componentReference = componentReferences.get(componentReferenceName);
- if (componentReference != null) {
-
- // Point to the resolved component reference
- promotedReferences.set(i, componentReference);
-
- // Use the interface contract from the component
- // reference if none
- // is specified on the composite reference
-
- InterfaceContract compositeReferenceInterfaceContract = compositeReference.getInterfaceContract();
- InterfaceContract componentReferenceInterfaceContract = componentReference.getInterfaceContract();
- if (compositeReferenceInterfaceContract == null) {
- compositeReference.setInterfaceContract(componentReferenceInterfaceContract);
- } else if (componentReferenceInterfaceContract != null) {
- // Check the compositeInterfaceContract and componentInterfaceContract
- boolean isCompatible = interfaceContractMapper.isCompatible(compositeReferenceInterfaceContract, componentReferenceInterfaceContract);
- if (!isCompatible) {
- warning("ReferenceInterfaceNotSubSet", compositeReference, componentReferenceName);
- }
- }
- } else {
- warning("PromotedReferenceNotFound", composite, composite.getName().toString(), componentReferenceName);
- }
- }
- }
- }
- }
-
- private List<Endpoint> createComponentReferenceTargets(Composite composite,
- Map<String, Component> components,
- Map<String, ComponentService> componentServices,
- ComponentReference componentReference) {
-
- List<Endpoint> endpoints = new ArrayList<Endpoint>();
-
- if (!componentReference.getTargets().isEmpty()) {
-
- // Check if the component reference does not mix the use of endpoints specified via
- // binding elements with target endpoints specified via the target attribute
- for (Binding binding : componentReference.getBindings()) {
- if (binding.getURI() != null) {
- warning("ReferenceEndPointMixWithTarget", composite, componentReference.getName());
- }
- }
-
- // Resolve targets specified on the component reference
- for (ComponentService componentService : componentReference.getTargets()) {
-
- // Resolve the target component and service
- String name = componentService.getName();
- ComponentService targetComponentService = componentServices.get(name);
- Component targetComponent;
- int s = name.indexOf('/');
- if (s == -1) {
- targetComponent = components.get(name);
- } else {
- targetComponent = components.get(name.substring(0, s));
- }
-
- if (targetComponentService != null) {
-
- // Check that the target component service provides
- // a superset of the component reference interface
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(targetComponent.getName());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.setTargetComponent(targetComponent);
- endpoint.setTargetComponentService(targetComponentService);
- endpoint.getCandidateBindings().addAll(componentReference.getBindings());
- endpoints.add(endpoint);
-
- // mark the reference target as resolved. Used later when we are looking to
- // see if an sca binding is associated with a resolved target or not
- componentService.setUnresolved(false);
- } else {
- warning("ReferenceIncompatibleInterface", composite, composite.getName().toString(),
- componentReference.getName(), componentService.getName());
- }
- } else {
- // add all the reference bindings into the target so that they
- // can be used for comparison when the target is resolved at runtime
- componentService.getBindings().addAll(componentReference.getBindings());
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(name);
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.getCandidateBindings().addAll(componentReference.getBindings());
- endpoints.add(endpoint);
-
- // The bindings will be cloned back into the reference when the
- // target is finally resolved.
- warning("ComponentReferenceTargetNotFound", composite,
- composite.getName().toString(), componentService.getName());
- }
- }
- } else if ((componentReference.getReference() != null) &&
- (!componentReference.getReference().getTargets().isEmpty())) {
-
- // Resolve targets from the corresponding reference in the
- // componentType
- for (ComponentService componentService : componentReference.getReference().getTargets()) {
-
- // Resolve the target component and service
- String name = componentService.getName();
- ComponentService targetComponentService = componentServices.get(name);
- Component targetComponent;
- int s = name.indexOf('/');
- if (s == -1) {
- targetComponent = components.get(name);
- } else {
- targetComponent = components.get(name.substring(0, s));
- }
-
- if (targetComponentService != null) {
-
- // Check that the target component service provides
- // a superset of
- // the component reference interface
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(targetComponent.getName());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.setTargetComponent(targetComponent);
- endpoint.setTargetComponentService(targetComponentService);
- endpoint.getCandidateBindings().addAll(componentReference.getBindings());
- endpoints.add(endpoint);
-
- // mark the reference target as resolved. Used later when we are looking to
- // see if an sca binding is associated with a resolved target or not
- componentService.setUnresolved(false);
- } else {
- warning("ComponentIncompatibleInterface", composite,
- componentReference.getName(), componentService.getName());
- }
- } else {
- // add all the reference bindings into the target so that they
- // can be used for comparison when the target is resolved at runtime
- componentService.getBindings().addAll(componentReference.getBindings());
-
- // The bindings will be cloned back into the reference when the
- // target is finally resolved.
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(name);
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.getCandidateBindings().addAll(componentReference.getBindings());
- endpoints.add(endpoint);
-
- warning("ComponentReferenceTargetNotFound", composite,
- composite.getName().toString(), componentService.getName());
- }
- }
- } else if (componentReference.getAutowire() == Boolean.TRUE) {
-
- // Find suitable targets in the current composite for an
- // autowired reference
- Multiplicity multiplicity = componentReference.getMultiplicity();
- for (Component targetComponent : composite.getComponents()) {
- // prevent autowire connecting to self
- boolean skipSelf = false;
- for (ComponentReference targetComponentReference : targetComponent.getReferences()) {
- if (componentReference == targetComponentReference){
- skipSelf = true;
- }
- }
-
- if (!skipSelf){
- for (ComponentService targetComponentService : targetComponent.getServices()) {
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(targetComponent.getName());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.setTargetComponent(targetComponent);
- endpoint.setTargetComponentService(targetComponentService);
- endpoint.getCandidateBindings().addAll(componentReference.getBindings());
- endpoints.add(endpoint);
-
- if (multiplicity == Multiplicity.ZERO_ONE || multiplicity == Multiplicity.ONE_ONE) {
- break;
- }
- }
- }
- }
- }
-
- if (multiplicity == Multiplicity.ONE_N || multiplicity == Multiplicity.ONE_ONE) {
- if (endpoints.size() == 0) {
- warning("NoComponentReferenceTarget", componentReference, componentReference.getName());
- }
- }
- }
-
-
- // if no endpoints have found so far retrieve any target names that are in binding URIs
- if (endpoints.isEmpty()){
- for (Binding binding : componentReference.getBindings()) {
-
- String uri = binding.getURI();
-
- // user hasn't put a uri on the binding so it's not a target name
- if (uri == null) {
- continue;
- }
-
- // user might have put a local target name in the uri so get
- // the path part and see if it refers to a target we know about
- // - if it does the reference binding will be matched with a service binding
- // - if it doesn't it is assumed to be an external reference
- Component targetComponent = null;
- ComponentService targetComponentService = null;
- String path = null;
-
- try {
- path = URI.create(uri).getPath();
- } catch(Exception ex){
- // just assume that no target is identified if
- // a URI related exception is thrown
- }
-
- if (path != null) {
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
-
- // Resolve the target component and service
- targetComponentService = componentServices.get(path);
- int s = path.indexOf('/');
- if (s == -1) {
- targetComponent = components.get(path);
- } else {
- targetComponent = components.get(path.substring(0, s));
- }
- }
-
- // if the path of the binding URI matches a component in the
- // composite then configure an endpoint with this component as the target
- // if not then the binding URI will be assumed to reference an external service
- if (targetComponentService != null) {
-
- // Check that the target component service provides
- // a superset of the component reference interface
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(targetComponent.getName());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.setTargetComponent(targetComponent);
- endpoint.setTargetComponentService(targetComponentService);
- endpoint.getCandidateBindings().add(binding);
- endpoints.add(endpoint);
- } else {
- warning("ReferenceIncompatibleInterface",
- composite,
- composite.getName().toString(),
- componentReference.getName(),
- uri);
- }
- } else {
-
- // create endpoints for manually configured bindings
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(uri);
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(componentReference);
- endpoint.setInterfaceContract(componentReference.getInterfaceContract());
- endpoint.setSourceBinding(binding);
- endpoints.add(endpoint);
- }
- }
- }
-
- return endpoints;
- }
-
-
- /**
- * Connect references to their targets.
- *
- * @param composite
- * @param componentServices
- * @param componentReferences
- * @param problems
- */
- private void connectComponentReferences(Composite composite,
- Map<String, Component> components,
- Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences){
-
- for (ComponentReference componentReference : componentReferences.values()) {
-
- List<Endpoint> endpoints = createComponentReferenceTargets(composite,
- components,
- componentServices,
- componentReference);
-
- componentReference.getEndpoints().addAll(endpoints);
-
- // the result of calculating the endpoints is either that bindings have been
- // configured manually using a URI or that targets have been provided and the
- // endpoint remains unresolved. So all endpoints should be either resved or uresolved.
- boolean endpointsRequireAutomaticResolution = false;
- for(Endpoint endpoint : endpoints){
- endpointsRequireAutomaticResolution = endpoint.isUnresolved();
- }
-
- // build each endpoint
- if (endpointsRequireAutomaticResolution) {
-
- for(Endpoint endpoint : endpoints){
- endpointBuilder.build(endpoint);
- }
-
- // TODO - The following step ensures that the reference binding list remains
- // as the record of resolved targets for now. This needs fixing so
- // that the endpoint takes on this responsibility.
- componentReference.getBindings().clear();
-
- if (componentReference.getCallback() != null){
- componentReference.getCallback().getBindings().clear();
- }
-
- for(Endpoint endpoint : endpoints){
- if (endpoint.isUnresolved() == false){
- componentReference.getBindings().add(endpoint.getSourceBinding());
-
- if (componentReference.getCallback() != null){
- componentReference.getCallback().getBindings().add(endpoint.getSourceCallbackBinding());
- }
- }
- }
-
- } else {
- // do nothing as no targets have been specified so the bindings
- // in the reference binding list are assumed to be manually configured
- }
-
-
-/*
- // Select the reference bindings matching the target service bindings
- List<Binding> selectedBindings = new ArrayList<Binding>();
- List<Binding> selectedCallbackBindings = null;
-
- // Handle callback
- boolean bidirectional = false;
-
- if (componentReference.getInterfaceContract() != null && componentReference.getInterfaceContract().getCallbackInterface() != null) {
- bidirectional = true;
- selectedCallbackBindings = new ArrayList<Binding>();
- }
-
- for (Target target : targets) {
-
- Component targetComponent = target.getComponent();
- ComponentService targetComponentService = target.getService();
- if (targetComponentService.getService() instanceof CompositeService) {
- CompositeService compositeService = (CompositeService) targetComponentService.getService();
- // Find the promoted component service
- targetComponentService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- }
-
- try {
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentReference, targetComponentService);
- } catch ( Exception e ) {
- warning("Policy related exception: " + e, e);
- //throw new RuntimeException(e);
- }
-
- // Match the binding against the bindings of the target service
- Binding selected = BindingConfigurationUtil.resolveBindings(componentReference, targetComponent, targetComponentService,
- bindingMap);
- if (selected == null) {
- warning("NoMatchingBinding", componentReference, componentReference.getName(), targetComponentService.getName());
- } else {
- selectedBindings.add(selected);
- }
- if (bidirectional) {
- Binding selectedCallback = BindingConfigurationUtil.resolveCallbackBindings(componentReference, targetComponent,
- targetComponentService, bindingMap);
- if (selectedCallback != null) {
- selectedCallbackBindings.add(selectedCallback);
- }
- }
- }
-*/
-
- // Need to tidy up the reference binding list and add in the bindings that
- // have been selected above. The situation so far...
- // Wired reference (1 or more targets are specified)
- // Binding.uri = null - remove as it's left over from target resolution
- // the binding will have been moved to the target from where
- // it will be resolved later
- // Binding.uri != null - the selected and resolved reference binding
- // Unwired reference (0 targets)
- // Binding.uri = null - Either a callback reference or the reference is yet to be wired
- // by the implementation so leave the binding where it is
- // Binding.uri != null - from the composite file so leave it
-/*
- if ((componentReference.getTargets().size() > 0) ||
- (!targets.isEmpty())) {
-
- // Add all the effective bindings
- componentReference.getBindings().clear();
- componentReference.getBindings().addAll(selectedBindings);
- if (bidirectional) {
- componentReference.getCallback().getBindings().clear();
- componentReference.getCallback().getBindings().addAll(selectedCallbackBindings);
- }
-
- // add in sca bindings to represent all unresolved targets. The sca binding
- // will try to resolve the target at a later date.
- for (ComponentService service : componentReference.getTargets()) {
- if (service.isUnresolved()) {
- SCABinding scaBinding = null;
-
- // find the sca binding amongst the candidate binding list. We want to
- // find this one and clone it as it may have been configured with
- // policies
- for (Binding binding : service.getBindings()) {
-
- if (binding instanceof SCABinding) {
- try {
- scaBinding = (SCABinding)((OptimizableBinding)binding).clone();
- } catch (CloneNotSupportedException ex){
- // we know it is supported on the SCA binding
- }
- break;
- }
- }
-
- if (scaBinding != null) {
- // configure the cloned SCA binding for this reference target
- scaBinding.setName(service.getName());
-
- // this service object holds the list of candidate bindings which
- // can be used for later matching
- ((OptimizableBinding)scaBinding).setTargetComponentService(service);
- componentReference.getBindings().add(scaBinding);
- } else {
- // not sure we need to raise a warning here as a warning will already been
- // thrown previously to indicate the reason why there is no sca binding
- // warning("NoSCABindingAvailableForUnresolvedService", componentReference, componentReference.getName(), service.getName());
- }
- }
- }
- }
-
-*/
- // Connect the optimizable bindings to their target component and
- // service
-/*
- for (Binding binding : componentReference.getBindings()) {
- if (!(binding instanceof OptimizableBinding)) {
- continue;
- }
- OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
- if (optimizableBinding.getTargetComponentService() != null) {
- continue;
- }
- String uri = optimizableBinding.getURI();
- if (uri == null) {
- continue;
- }
- uri = URI.create(uri).getPath();
- if (uri.startsWith("/")) {
- uri = uri.substring(1);
- }
-
- // Resolve the target component and service
- ComponentService targetComponentService = componentServices.get(uri);
- Component targetComponent;
- int s = uri.indexOf('/');
- if (s == -1) {
- targetComponent = components.get(uri);
- } else {
- targetComponent = components.get(uri.substring(0, s));
- }
-
- if (targetComponentService != null) {
-
- // Check that the target component service provides
- // a superset of the component reference interface
- if (componentReference.getInterfaceContract() == null ||
- interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(), targetComponentService.getInterfaceContract())) {
-
- } else {
- warning("ReferenceIncompatibleInterface",
- composite,
- composite.getName().toString(),
- componentReference.getName(),
- uri);
- }
- optimizableBinding.setTargetComponent(targetComponent);
- optimizableBinding.setTargetComponentService(targetComponentService);
- optimizableBinding.setTargetBinding(targetComponentService.getBinding(optimizableBinding.getClass()));
- }
- }
-*/
- }
- }
-
- /**
- * Resolve wires and connect the sources to their targets
- *
- * @param composite
- * @param componentServices
- * @param componentReferences
- * @param problems
- */
- private void connectWires(Composite composite,
- Map<String, ComponentService> componentServices,
- Map<String, ComponentReference> componentReferences) {
-
- // For each wire, resolve the source reference, the target service, and
- // add it to the list of targets of the reference
- List<Wire> wires = composite.getWires();
- for (int i = 0, n = wires.size(); i < n; i++) {
- Wire wire = wires.get(i);
-
- ComponentReference resolvedReference;
- ComponentService resolvedService;
-
- // Resolve the source reference
- ComponentReference source = wire.getSource();
- if (source != null && source.isUnresolved()) {
- resolvedReference = componentReferences.get(source.getName());
- if (resolvedReference != null) {
- wire.setSource(resolvedReference);
- } else {
- warning("WireSourceNotFound", composite, source.getName());
- }
- } else {
- resolvedReference = wire.getSource();
- }
-
- // Resolve the target service
- ComponentService target = wire.getTarget();
- if (target != null && target.isUnresolved()) {
- resolvedService = componentServices.get(target.getName());
- if (resolvedService != null) {
- wire.setTarget(target);
- } else {
- warning("WireTargetNotFound", composite, source.getName());
- }
- } else {
- resolvedService = wire.getTarget();
- }
-
- // Add the target service to the list of targets of the
- // reference
- if (resolvedReference != null && resolvedService != null) {
- // Check that the target component service provides
- // a superset of
- // the component reference interface
- if (resolvedReference.getInterfaceContract() == null || interfaceContractMapper
- .isCompatible(resolvedReference.getInterfaceContract(), resolvedService.getInterfaceContract())) {
-
- //resolvedReference.getTargets().add(resolvedService);
- resolvedReference.getTargets().add(wire.getTarget());
- } else {
- warning("WireIncompatibleInterface", composite, source.getName(), target.getName());
- }
- }
- }
-
- // Clear the list of wires
- composite.getWires().clear();
- }
-
- private void addPoliciesFromPromotedService(CompositeService compositeService) {
- //inherit intents and policies from promoted service
- PolicyComputationUtils.addInheritedIntents(compositeService.getPromotedService().getRequiredIntents(),
- compositeService.getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(compositeService.getPromotedService().getPolicySets(),
- compositeService.getPolicySets(), true);
- addInheritedOperationConfigurations(compositeService.getPromotedService(), compositeService);
- }
-
- private void addPoliciesFromPromotedReference(CompositeReference compositeReference) {
- for ( Reference promotedReference : compositeReference.getPromotedReferences() ) {
- PolicyComputationUtils.addInheritedIntents(promotedReference.getRequiredIntents(),
- compositeReference.getRequiredIntents());
-
- PolicyComputationUtils.addInheritedPolicySets(promotedReference.getPolicySets(),
- compositeReference.getPolicySets(), true);
- addInheritedOperationConfigurations(promotedReference, compositeReference);
- }
- }
-
-
- protected void computePolicies(Composite composite) {
-
- // compute policies recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- computePolicies((Composite)implementation);
- }
- }
-
- for (Component component : composite.getComponents()) {
-
- // Inherit default policies from the component to component-level contracts.
- // This must be done BEFORE computing implementation policies because the
- // implementation policy computer removes from the component any
- // intents and policy sets that don't apply to implementations.
- PolicyConfigurationUtil.inheritDefaultPolicies(component, component.getServices());
- PolicyConfigurationUtil.inheritDefaultPolicies(component, component.getReferences());
-
- Implementation implemenation = component.getImplementation();
- try {
- PolicyConfigurationUtil.computeImplementationIntentsAndPolicySets(implemenation, component);
- } catch ( Exception e ) {
- error("PolicyRelatedException", implemenation, e);
- //throw new RuntimeException(e);
- }
-
- for (ComponentService componentService : component.getServices()) {
- Service service = componentService.getService();
- if (service != null) {
- // reconcile intents and policysets from componentType
- PolicyComputationUtils.addInheritedIntents(service.getRequiredIntents(), componentService.getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(service.getPolicySets(), componentService.getPolicySets(), true);
-
- //reconcile intents and policysets for operations
- boolean notFound;
- List<ConfiguredOperation> opsFromComponentType = new ArrayList<ConfiguredOperation>();
- for ( ConfiguredOperation ctsConfOp : service.getConfiguredOperations() ) {
- notFound = true;
- for ( ConfiguredOperation csConfOp : componentService.getConfiguredOperations() ) {
- if ( csConfOp.getName().equals(ctsConfOp.getName()) ) {
- PolicyComputationUtils.addInheritedIntents(ctsConfOp.getRequiredIntents(), csConfOp.getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(ctsConfOp.getPolicySets(), csConfOp.getPolicySets(), true);
- notFound = false;
- }
- }
-
- if ( notFound ) {
- opsFromComponentType.add(ctsConfOp);
- }
- }
- componentService.getConfiguredOperations().addAll(opsFromComponentType);
- }
-
- try {
- //compute the intents for operations under service element
- PolicyConfigurationUtil.computeIntentsForOperations(componentService);
- //compute intents and policyset for each binding
- //addInheritedOpConfOnBindings(componentService);
- PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(componentService);
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentService, null);
-
- } catch ( Exception e ) {
- error("PolicyRelatedException", componentService, e);
- //throw new RuntimeException(e);
- }
- }
-
- for (ComponentReference componentReference : component.getReferences()) {
- Reference reference = componentReference.getReference();
- if (reference != null) {
- // reconcile intents and policysets
- PolicyComputationUtils.addInheritedIntents(reference.getRequiredIntents(), componentReference.getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(reference.getPolicySets(), componentReference.getPolicySets(), true);
- }
-
-
- try {
- //compute the intents for operations under reference element
- PolicyConfigurationUtil.computeIntentsForOperations(componentReference);
- //compute intents and policyset for each binding
- //addInheritedOpConfOnBindings(componentReference);
- PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(componentReference);
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(componentReference, null);
-
-
- if ( componentReference.getCallback() != null ) {
- PolicyComputationUtils.addInheritedIntents(componentReference.getRequiredIntents(),
- componentReference.getCallback().getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(componentReference.getPolicySets(),
- componentReference.getCallback().getPolicySets(),
- false);
- }
- } catch ( Exception e ) {
- error("PolicyRelatedException", componentReference, e);
- //throw new RuntimeException(e);
- }
- }
- }
-
- PolicyConfigurationUtil.inheritDefaultPolicies(composite, composite.getServices());
- PolicyConfigurationUtil.inheritDefaultPolicies(composite, composite.getReferences());
-
- //compute policies for composite service bindings
- for (Service service : composite.getServices()) {
- addPoliciesFromPromotedService((CompositeService)service);
- try {
- //compute the intents for operations under service element
- PolicyConfigurationUtil.computeIntentsForOperations(service);
- //add or merge service operations to the binding
- //addInheritedOpConfOnBindings(service);
- PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(service);
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(service, null);
- } catch ( Exception e ) {
- error("PolicyRelatedException", service, e);
- //throw new RuntimeException(e);
- }
-
- }
-
- for (Reference reference : composite.getReferences()) {
- CompositeReference compReference = (CompositeReference)reference;
- addPoliciesFromPromotedReference(compReference);
- try {
- //compute the intents for operations under service element
- PolicyConfigurationUtil.computeIntentsForOperations(reference);
- //addInheritedOpConfOnBindings(reference);
-
- if (compReference.getCallback() != null) {
- PolicyComputationUtils.addInheritedIntents(compReference.getRequiredIntents(),
- compReference.getCallback().getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(compReference.getPolicySets(),
- compReference.getCallback().getPolicySets(),
- false);
- }
-
- PolicyConfigurationUtil.computeBindingIntentsAndPolicySets(reference);
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(reference, null);
- } catch ( Exception e ) {
- error("PolicyRelatedException", reference, e);
- //throw new RuntimeException(e);
- }
- }
-
- }
-
- private void addInheritedOperationConfigurations(OperationsConfigurator source,
- OperationsConfigurator target) {
- boolean found = false;
-
- List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
- for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
- for ( ConfiguredOperation targetConfOp : target.getConfiguredOperations() ) {
- if ( sourceConfOp.getName().equals(targetConfOp.getName())) {
- PolicyComputationUtils.addInheritedIntents(sourceConfOp.getRequiredIntents(),
- targetConfOp.getRequiredIntents());
- PolicyComputationUtils.addInheritedPolicySets(sourceConfOp.getPolicySets(),
- targetConfOp.getPolicySets(), true);
- found = true;
- break;
- }
- }
-
- if ( !found ) {
- additionalOperations.add(sourceConfOp);
- }
- }
-
- if ( !additionalOperations.isEmpty() ) {
- target.getConfiguredOperations().addAll(additionalOperations);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
deleted file mode 100644
index 2842ae82bb..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingConfigurationUtil.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.Map;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * This class encapsulates utility methods to deal with binding definitions
- *
- * @version $Rev$ $Date$
- */
-abstract class BindingConfigurationUtil {
- private static boolean hasCompatiblePolicySets(Binding refBinding, Binding svcBinding) {
- boolean isCompatible = true;
- if ( refBinding instanceof PolicySetAttachPoint && svcBinding instanceof PolicySetAttachPoint ) {
- //TODO : need to add more compatibility checks at the policy attachment levels
- for ( PolicySet svcPolicySet : ((PolicySetAttachPoint)svcBinding).getPolicySets() ) {
- isCompatible = false;
- for ( PolicySet refPolicySet : ((PolicySetAttachPoint)refBinding).getPolicySets() ) {
- if ( svcPolicySet.equals(refPolicySet) ) {
- isCompatible = true;
- break;
- }
- }
- //if there exists no matching policy set in the reference binding
- if ( !isCompatible ) {
- return isCompatible;
- }
- }
- }
- return isCompatible;
- }
-
-
- static Binding matchBinding(Component targetComponent, ComponentService targetComponentService,
- List<Binding> source, List<Binding> target,
- Map<Binding, Binding> bindingMap, boolean isCallback) {
- 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 {
- // If the service binding or callback binding was given a tentative URI by
- // constructBindingURI() and the target component is running on a different node
- // than the source component, add host/port information to the binding URI
- if (bindingMap != null) {
- Binding sourceNodeBinding = bindingMap.get(binding);
- Binding targetNodeBinding = bindingMap.get(serviceBinding);
- if (targetNodeBinding != null
- && sourceNodeBinding != null
- && targetNodeBinding != sourceNodeBinding) {
- if (!isCallback) {
- serviceBinding.setURI(targetNodeBinding.getURI() + serviceBinding.getURI());
- bindingMap.remove(serviceBinding); // don't add this again
- } else {
- binding.setURI(sourceNodeBinding.getURI() + binding.getURI());
- bindingMap.remove(binding); // don't add this again
- }
- }
- }
-
- Binding cloned = (Binding)binding.clone();
-
- //Customise the binding name to make it unique
- // regardless of how many bindings or targets there are
- if ( targetComponent != null){
- cloned.setName(binding.getName() + "--" + targetComponent.getName() + ".." + serviceBinding.getName());
- } else {
- cloned.setName(binding.getName() + "--" + serviceBinding.getName());
- }
-
- // Set the binding URI to the URI of the target service
- // that has been matched
- if (binding.getURI() == null) {
- cloned.setURI(serviceBinding.getURI());
- }
-
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding endpoint = ((OptimizableBinding)cloned);
- endpoint.setTargetComponent(targetComponent);
- endpoint.setTargetComponentService(targetComponentService);
- endpoint.setTargetBinding(serviceBinding);
- }
-
- matched.add(cloned);
- break;
- } catch (Exception ex) {
- // do nothing
- }
- }
- }
- }
- if (matched.isEmpty()) {
- // No matching binding
- return null;
- } else {
- for (Binding binding : matched) {
- // If binding.sca is present, use it
- if (SCABinding.class.isInstance(binding)) {
- return binding;
- }
- }
- // Use the first one
- return matched.get(0);
- }
- }
-
- /**
- * Choose a binding for the reference based on the bindings available on the
- * service
- *
- * @param reference The component reference
- * @param service The component service
- * @return Resolved binding
- */
- static Binding resolveBindings(ComponentReference reference, Component component, ComponentService service,
- Map<Binding, Binding> bindingMap) {
- List<Binding> source = reference.getBindings();
- List<Binding> target = service.getBindings();
-
- return matchBinding(component, service, source, target, bindingMap, false);
-
- }
-
-
- /**
- * @param reference
- * @param service
- * @return
- */
- static Binding resolveCallbackBindings(ComponentReference reference, Component component, ComponentService service,
- Map<Binding, Binding> bindingMap) {
- List<Binding> source = reference.getCallback().getBindings();
- List<Binding> target = service.getCallback().getBindings();
-
- return matchBinding(component, service, source, target, bindingMap, true);
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
deleted file mode 100644
index 0643421a45..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.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.builder.impl;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that handles the configuration of components.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentConfigurationBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
-
- @Deprecated
- public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
- null, null,
- interfaceContractMapper, policyDefinitions, monitor);
- }
-
- public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- configureComponents(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.java
deleted file mode 100644
index 4913705e91..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceBindingBuilderImpl.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.builder.impl;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that performs any additional building steps that
- * component reference bindings may need. Used for WSDL generation.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentReferenceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
-
- public ComponentReferenceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- buildReferenceBindings(composite);
- }
-
- private void buildReferenceBindings(Composite composite) {
-
- // find all the component reference bindings (starting at top level)
- for (Component component : composite.getComponents()) {
- for (ComponentReference componentReference : component.getReferences()) {
- for (Binding binding : componentReference.getBindings()) {
- if (binding instanceof BindingBuilderExtension) {
- ((BindingBuilderExtension)binding).getBuilder().build(component, componentReference, binding, monitor);
- }
- }
- }
- }
-
- // build bindings recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- buildReferenceBindings((Composite)implementation);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
deleted file mode 100644
index c0702c87b3..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferencePromotionWireBuilderImpl.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that handles the creation of promoted composite services.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentReferencePromotionWireBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
- private EndpointFactory endpointFactory;
- private Monitor monitor;
-
- public ComponentReferencePromotionWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.endpointFactory = endpointFactory;
- this.monitor = monitor;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- wireCompositeReferences(composite);
- }
-
- /**
- * Wire composite references in nested composites.
- *
- * @param composite
- * @param problems
- */
- private void wireCompositeReferences(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- wireCompositeReferences((Composite)implementation);
- }
- }
-
- // Process component references declared on components in this composite
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- for (ComponentReference componentReference : component.getReferences()) {
- Reference implReference = componentReference.getReference();
- if (implReference != null && implReference instanceof CompositeReference) {
-
- // If the component reference is wired, it is a promotion override
- if (!componentReference.getEndpoints().isEmpty()) {
- componentReference.setPromotionOverride(true);
- }
-
- // If the component reference is a promotion override, override the
- // configuration of the promoted reference
- if (componentReference.isPromotionOverride()) {
- CompositeReference compositeReference = (CompositeReference)implReference;
- List<ComponentReference> promotedReferences =
- ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
- ReferenceConfigurationUtil.reconcileReferenceBindings(
- componentReference, promotedReference, assemblyFactory, endpointFactory, monitor);
- if (componentReference.getInterfaceContract() != null && // can be null in unit tests
- componentReference.getInterfaceContract().getCallbackInterface() != null) {
- SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
- if (promotedReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().clear();
- } else {
- promotedReference.setCallback(assemblyFactory.createCallback());
- }
- if (scaCallbackBinding != null) {
- promotedReference.getCallback().getBindings().add(scaCallbackBinding);
- }
- if (componentReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().addAll(componentReference
- .getCallback().getBindings());
- }
- }
-
- // Wire the promoted reference to the actual non-composite component services
- if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE) {
- // promotedReference.getTargets().clear();
- }
- for (ComponentService target : componentReference.getTargets()) {
- if (target.getService() instanceof CompositeService) {
-
- // Wire to the actual component service
- // promoted by a composite service
- CompositeService compositeService = (CompositeService)target.getService();
- // Find the promoted component service
- ComponentService componentService =
- ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (componentService != null) {
- promotedReference.getTargets().add(componentService);
- }
- } else {
-
- // Wire to a non-composite target service
- promotedReference.getTargets().add(target);
- }
- }
- }
- }
- }
- }
- } else {
- for (ComponentReference componentReference : component.getReferences()) {
-
- // Wire the component reference to the actual
- // non-composite component services
- List<ComponentService> targets = componentReference.getTargets();
- for (int i = 0, n = targets.size(); i < n; i++) {
- ComponentService target = targets.get(i);
- if (target.getService() instanceof CompositeService) {
-
- // Wire to the actual component service
- // promoted by a composite service
- CompositeService compositeService = (CompositeService)target.getService();
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- targets.set(i, componentService);
- }
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
deleted file mode 100644
index 723b478889..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentReferenceWireBuilderImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.Map;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that wires component references.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentReferenceWireBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
-
- public ComponentReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory,
- InterfaceContractMapper interfaceContractMapper, Monitor monitor,
- Map<Binding, Binding> bindingMap) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, bindingMap);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- wireComponentReferences(composite);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
deleted file mode 100644
index 12ea86eac3..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServiceBindingBuilderImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that performs any additional building steps that
- * component service bindings may need. Used for WSDL generation.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentServiceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
-
- public ComponentServiceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- buildServiceBindings(composite);
- }
-
- private void buildServiceBindings(Composite composite) {
-
- // build bindings recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- buildServiceBindings((Composite)implementation);
- }
- }
-
- // find all the component service bindings
- for (Component component : composite.getComponents()) {
- for (ComponentService componentService : component.getServices()) {
- for (Binding binding : componentService.getBindings()) {
- if (binding instanceof BindingBuilderExtension) {
- BindingBuilder builder = ((BindingBuilderExtension)binding).getBuilder();
- if (builder != null) {
- builder.build(component, componentService, binding, monitor);
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.java
deleted file mode 100644
index ce3f817acf..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentServicePromotionBuilderImpl.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.builder.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-
-/**
- * A composite builder that handles the creation of promoted services.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentServicePromotionBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
-
- public ComponentServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Process nested composites recursively
- configureNestedCompositeServices(composite);
- }
-
- private void configureNestedCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // First process nested composites
- configureNestedCompositeServices((Composite)implementation);
-
- // Process the component services declared on components in this composite
- for (ComponentService componentService : component.getServices()) {
- Service implService = componentService.getService();
- if (implService != null && implService instanceof CompositeService) {
- CompositeService compositeService = (CompositeService)implService;
-
- // Get the innermost promoted service
- ComponentService promotedService =
- ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
-
- // Create a new component service to represent this
- // component service on the promoted component
- ComponentService newComponentService = assemblyFactory.createComponentService();
- newComponentService.setName("$promoted$" + component.getName() + "$slash$" + componentService.getName());
- promotedComponent.getServices().add(newComponentService);
- newComponentService.setService(promotedService.getService());
- newComponentService.getBindings().addAll(componentService.getBindings());
- newComponentService.setInterfaceContract(componentService.getInterfaceContract());
-
- if (componentService.getInterfaceContract() != null &&
- componentService.getInterfaceContract().getCallbackInterface() != null) {
- newComponentService.setCallback(assemblyFactory.createCallback());
- newComponentService.getCallback().getBindings()
- .addAll(componentService.getCallback().getBindings());
- ComponentReference callbackReference =
- BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService,
- assemblyFactory);
- callbackReference.getBindings().addAll(componentService.getCallback().getBindings());
- newComponentService.setCallbackReference(callbackReference);
- }
-
- // Change the composite service to now promote the
- // newly created component service directly
- compositeService.setPromotedComponent(promotedComponent);
- compositeService.setPromotedService(newComponentService);
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
deleted file mode 100644
index 85af173c0d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.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.builder.impl;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that handles the configuration of binding URIs.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeBindingURIBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
-
- @Deprecated
- public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
- null, null,
- interfaceContractMapper, policyDefinitions, monitor);
- }
-
- public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- configureBindingURIsAndNames(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
deleted file mode 100644
index 5eedcae190..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.Map;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * A builder that handles the configuration of the components inside a composite
- * and the wiring of component references to component services.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeBuilderImpl implements CompositeBuilder {
- private static final Logger logger = Logger.getLogger(CompositeBuilderImpl.class.getName());
- private CompositeBuilder compositeIncludeBuilder;
- private CompositeBuilder componentReferenceWireBuilder;
- private CompositeBuilder componentReferencePromotionWireBuilder;
- private CompositeBuilder compositeReferenceWireBuilder;
- private CompositeBuilder compositeCloneBuilder;
- private CompositeBuilder componentConfigurationBuilder;
- private CompositeBuilder compositeServiceConfigurationBuilder;
- private CompositeBuilder compositeReferenceConfigurationBuilder;
- private CompositeBuilder compositeBindingURIBuilder;
- private CompositeBuilder componentServicePromotionBuilder;
- private CompositeBuilder compositeServicePromotionBuilder;
- private CompositeBuilder compositePromotionBuilder;
- private CompositeBuilder compositePolicyBuilder;
- private CompositeBuilder componentServiceBindingBuilder;
- private CompositeBuilder componentReferenceBindingBuilder;
- private Map<Binding, Binding> bindingMap = null;
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param endpointFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param interfaceContractMapper
- * @param policyDefinitions
- * @param monitor
- */
- @Deprecated
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- EndpointFactory endpointFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, policyDefinitions, monitor, null);
- }
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param interfaceContractMapper
- * @param monitor
- */
- @Deprecated
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- InterfaceContractMapper interfaceContractMapper,
- Monitor monitor) {
- this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- null, null, interfaceContractMapper, null, monitor, null);
- }
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param documentBuilderFactory
- * @param transformerFactory
- * @param interfaceContractMapper
- * @param monitor
- */
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- Monitor monitor) {
- this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor, null);
- }
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param documentBuilderFactory
- * @param transformerFactory
- * @param interfaceContractMapper
- * @param monitor
- * @param bindingMap
- */
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- Monitor monitor,
- Map<Binding, Binding> bindingMap) {
- this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
- documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor, bindingMap);
- }
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param endpointFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param documentBuilderFactory
- * @param transformerFactory
- * @param interfaceContractMapper
- * @param policyDefinitions
- * @param monitor
- */
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- EndpointFactory endpointFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
- documentBuilderFactory, transformerFactory, interfaceContractMapper,
- policyDefinitions, monitor, null);
- }
-
- /**
- * Constructs a new composite builder.
- *
- * @param assemblyFactory
- * @param endpointFactory
- * @param scaBindingFactory
- * @param intentAttachPointTypeFactory
- * @param documentBuilderFactory
- * @param transformerFactory
- * @param interfaceContractMapper
- * @param policyDefinitions
- * @param bindingMap
- */
- public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
- EndpointFactory endpointFactory,
- SCABindingFactory scaBindingFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor,
- Map<Binding, Binding> bindingMap) {
-
- if (endpointFactory == null){
- endpointFactory = new DefaultEndpointFactory();
- }
-
- compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- componentReferenceWireBuilder = new ComponentReferenceWireBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, bindingMap);
- componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
- compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
- compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
- componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
- compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
- compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
- compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
- componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
- compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
- compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- compositePolicyBuilder = new CompositePolicyBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
- componentServiceBindingBuilder = new ComponentServiceBindingBuilderImpl(monitor);
- componentReferenceBindingBuilder = new ComponentReferenceBindingBuilderImpl(monitor);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Collect and fuse includes
- compositeIncludeBuilder.build(composite);
-
- // Expand nested composites
- compositeCloneBuilder.build(composite);
-
- // Configure all components
- componentConfigurationBuilder.build(composite);
-
- // Connect composite services/references to promoted services/references
- compositePromotionBuilder.build(composite);
-
- // Compute the policies across the model hierarchy
- compositePolicyBuilder.build(composite);
-
- // Configure composite services
- compositeServiceConfigurationBuilder.build(composite);
-
- // Configure composite references
- compositeReferenceConfigurationBuilder.build(composite);
-
- // Configure binding URIs
- compositeBindingURIBuilder.build(composite);
-
- // Create promoted component services
- componentServicePromotionBuilder.build(composite);
-
- // Create promoted composite services
- compositeServicePromotionBuilder.build(composite);
-
- // Build component service binding-related information
- componentServiceBindingBuilder.build(composite);
-
- // Wire the components
- componentReferenceWireBuilder.build(composite);
-
- // Wire the promoted component references
- componentReferencePromotionWireBuilder.build(composite);
-
- // Wire the composite references
- compositeReferenceWireBuilder.build(composite);
-
- // Build component reference binding-related information
- componentReferenceBindingBuilder.build(composite);
-
- // Fuse nested composites
- //FIXME do this later
- //cloneBuilder.fuseCompositeImplementations(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
deleted file mode 100644
index 5779ddbc78..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeCloneBuilderImpl.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that clones nested composites.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeCloneBuilderImpl implements CompositeBuilder {
-
- public CompositeCloneBuilderImpl(Monitor monitor) {
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- expandCompositeImplementations(composite);
- }
-
- /**
- * Expand composite component implementations.
- *
- * @param composite
- * @param problems
- */
- private void expandCompositeImplementations(Composite composite) {
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- Composite compositeImplementation = (Composite)implementation;
- Composite clone;
- try {
- clone = (Composite)compositeImplementation.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
- component.setImplementation(clone);
- expandCompositeImplementations(clone);
- }
- }
- }
-
- /**
- * Collect all nested composite implementations in a graph of composites.
- *
- * @param composite
- * @param nested
- */
- private void collectNestedComposites(Composite composite, List<Composite> nested) {
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- Composite nestedComposite = (Composite)implementation;
- nested.add(nestedComposite);
- collectNestedComposites(nestedComposite, nested);
- }
- }
- }
-
- /**
- * Fuse nested composites into a top level composite.
- *
- * @param composite
- */
- private void fuseCompositeImplementations(Composite composite) {
-
- // First collect all nested composites
- List<Composite> nested = new ArrayList<Composite>();
- collectNestedComposites(composite, nested);
-
- // Then add all the non-composite components they contain
- for (Composite nestedComposite : nested) {
- for (Component component: nestedComposite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (!(implementation instanceof Composite)) {
- composite.getComponents().add(component);
- }
- }
- }
-
- // Clear the initial list of composite components
- for (Iterator<Component> i = composite.getComponents().iterator(); i.hasNext();) {
- Component component = i.next();
- if (component.getImplementation() instanceof Composite) {
- i.remove();
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.java
deleted file mode 100644
index 28f40a077d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeIncludeBuilderImpl.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.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implementation of a CompositeBuilder.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeIncludeBuilderImpl implements CompositeBuilder {
-
- private Monitor monitor;
-
- public CompositeIncludeBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- fuseIncludes(composite);
- }
-
- private void warning(String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Collect all includes in a graph of includes.
- *
- * @param composite
- * @param includes
- */
- private void collectIncludes(Composite composite, List<Composite> includes, Set<Composite> visited) {
- for (Composite include : composite.getIncludes()) {
- if (visited.contains(include)) {
- warning("CompositeAlreadyIncluded", composite, include.getName().toString());
- continue;
- }
-
- includes.add(include);
- visited.add(include);
- collectIncludes(include, includes, visited);
- }
- }
-
- /**
- * Copy a list of includes into a composite.
- *
- * @param composite
- */
- private void fuseIncludes(Composite composite) {
-
- // First collect all includes
- List<Composite> includes = new ArrayList<Composite>();
- Set<Composite> visited = new HashSet<Composite>();
- visited.add(composite);
- collectIncludes(composite, includes, visited);
- // Then clone them
- for (Composite include : includes) {
- Composite clone;
- try {
- clone = (Composite)include.clone();
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException(e);
- }
- composite.getComponents().addAll(clone.getComponents());
- composite.getServices().addAll(clone.getServices());
- composite.getReferences().addAll(clone.getReferences());
- composite.getProperties().addAll(clone.getProperties());
- composite.getWires().addAll(clone.getWires());
- composite.getPolicySets().addAll(clone.getPolicySets());
- composite.getRequiredIntents().addAll(clone.getRequiredIntents());
- }
-
- // Clear the list of includes
- composite.getIncludes().clear();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
deleted file mode 100644
index a7c9a87038..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePolicyBuilderImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that computes policy sets based on attached intents and policy sets.
- * Useful if you want to build the model without making any runtime decisions such as
- * reference/services matching
- *
- * @version $Rev$ $Date$
- */
-public class CompositePolicyBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
-
- public CompositePolicyBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, null);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- computePolicies(composite);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.java
deleted file mode 100644
index 9add794a81..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositePromotionBuilderImpl.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.builder.impl;
-
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that makes the connections between composite services and references
- * and the services and references that they promote
- *
- * @version $Rev$ $Date$
- */
-public class CompositePromotionBuilderImpl extends BaseWireBuilderImpl implements CompositeBuilder {
-
- public CompositePromotionBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, InterfaceContractMapper interfaceContractMapper, Monitor monitor) {
- super(assemblyFactory, endpointFactory, interfaceContractMapper, monitor, null);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- connectCompositeReferencesAndServices(composite);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
deleted file mode 100644
index 41462b151d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceConfigurationBuilderImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.List;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-
-/**
- * A composite builder that handles the configuration of composite references.
- *
- * @version $Rev: 651179 $ $Date: 2008-04-24 08:21:13 +0100 (Thu, 24 Apr 2008) $
- */
-public class CompositeReferenceConfigurationBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
-
- public CompositeReferenceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Process nested composites recursively
- configureNestedCompositeReferences(composite);
-
- // Process top level composite references
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
-
- // Get the next lower level promoted reference
- List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
- if (!promotedRefs.isEmpty()) {
- if (promotedRefs.size() == 1) {
- ComponentReference promotedReference = promotedRefs.get(0);
-
- // Set the bindings using the top level bindings to override the lower level bindings
- if (bindingsSpecifiedManually(compositeReference.getBindings())) {
- compositeReference.setPromotionOverride(true);
- } else if (bindingsSpecifiedManually(promotedReference.getBindings()) ) {
- compositeReference.getBindings().clear();
- for (Binding binding : promotedReference.getBindings()) {
- try {
- compositeReference.getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted reference
- }
- }
- }
- if (compositeReference.getInterfaceContract() != null &&
- compositeReference.getInterfaceContract().getCallbackInterface() != null) {
- if (compositeReference.getCallback() != null &&
- bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
- compositeReference.setPromotionOverride(true);
- } else if (promotedReference.getCallback() != null &&
- bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
- if (compositeReference.getCallback() != null) {
- compositeReference.getCallback().getBindings().clear();
- } else {
- compositeReference.setCallback(assemblyFactory.createCallback());
- }
- for (Binding binding : promotedReference.getCallback().getBindings()) {
- try {
- compositeReference.getCallback().getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted reference
- }
- }
- }
- }
- } else {
- // This composite reference promotes multiple component references.
- // Because the component reference bindings can all be different, we don't
- // copy any of them up to this composite reference, which will therefore always
- // have its own binding, even if it's only the default SCA binding.
- if (bindingsSpecifiedManually(compositeReference.getBindings()) ||
- (compositeReference.getCallback() != null &&
- bindingsSpecifiedManually(compositeReference.getCallback().getBindings()))) {
- compositeReference.setPromotionOverride(true);
- }
- }
- }
- }
- }
-
- private void configureNestedCompositeReferences(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // First process nested composites
- configureNestedCompositeReferences((Composite)implementation);
-
- // Process the component references declared on components in this composite
- for (ComponentReference componentReference : component.getReferences()) {
- Reference implReference = componentReference.getReference();
- if (implReference != null && implReference instanceof CompositeReference) {
- CompositeReference compositeReference = (CompositeReference)implReference;
-
- // Get the next lower level promoted reference
- List<ComponentReference> promotedRefs = compositeReference.getPromotedReferences();
- if (!promotedRefs.isEmpty()) {
- if (promotedRefs.size() == 1) {
- ComponentReference promotedReference = promotedRefs.get(0);
-
- // Set the bindings using the top level bindings to override the lower level bindings
- if (!bindingsSpecifiedManually(compositeReference.getBindings()) &&
- bindingsSpecifiedManually(promotedReference.getBindings()) ) {
- compositeReference.getBindings().clear();
- for (Binding binding : promotedReference.getBindings()) {
- try {
- compositeReference.getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted reference
- }
- }
- }
- if (bindingsSpecifiedManually(componentReference.getBindings())) {
- componentReference.setPromotionOverride(true);
- } else if (bindingsSpecifiedManually(compositeReference.getBindings()) ) {
- componentReference.getBindings().clear();
- componentReference.getBindings().addAll(compositeReference.getBindings());
- }
- if (componentReference.getInterfaceContract() != null &&
- componentReference.getInterfaceContract().getCallbackInterface() != null) {
- if (!(compositeReference.getCallback() != null &&
- bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) &&
- promotedReference.getCallback() != null &&
- bindingsSpecifiedManually(promotedReference.getCallback().getBindings())) {
- if (compositeReference.getCallback() != null) {
- compositeReference.getCallback().getBindings().clear();
- } else {
- compositeReference.setCallback(assemblyFactory.createCallback());
- }
- compositeReference.getCallback().getBindings().addAll(
- promotedReference.getCallback().getBindings());
- }
- if (componentReference.getCallback() != null &&
- bindingsSpecifiedManually(componentReference.getCallback().getBindings())) {
- componentReference.setPromotionOverride(true);
- } else if (compositeReference.getCallback() != null &&
- bindingsSpecifiedManually(compositeReference.getCallback().getBindings())) {
- if (componentReference.getCallback() != null) {
- componentReference.getCallback().getBindings().clear();
- } else {
- componentReference.setCallback(assemblyFactory.createCallback());
- }
- for (Binding binding : compositeReference.getCallback().getBindings()) {
- try {
- componentReference.getCallback().getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted reference
- }
- }
- }
- }
- } else {
- // This component reference promotes multiple lower-level component references.
- // Because the lower-level component reference bindings can all be different,
- // we don't copy any of them up to this component reference, which will therefore
- // always have its own binding, even if it's only the default SCA binding.
- if (bindingsSpecifiedManually(componentReference.getBindings()) ||
- (componentReference.getCallback() != null &&
- bindingsSpecifiedManually(componentReference.getCallback().getBindings()))) {
- componentReference.setPromotionOverride(true);
- }
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * If the bindings are specified in the composite file return true as they should
- * otherwise return false
- *
- * @param bindings
- * @return true if the bindings were specified manually
- */
- private boolean bindingsSpecifiedManually(List<Binding> bindings) {
-
- if (bindings.size() > 1) {
- return true;
- } else if (bindings.size() == 1 &&
- bindings.get(0) instanceof AutomaticBinding &&
- ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
- return false;
- } else if (bindings.size() == 1) {
- return true;
- } else {
- return false;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.java
deleted file mode 100644
index 8aa1897311..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeReferenceWireBuilderImpl.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.builder.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that wires composite references.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeReferenceWireBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
- private EndpointFactory endpointFactory;
- private Monitor monitor;
-
- public CompositeReferenceWireBuilderImpl(AssemblyFactory assemblyFactory, EndpointFactory endpointFactory, Monitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.endpointFactory = endpointFactory;
- this.monitor = monitor;
- }
-
- /**
- * Wire composite references in a deployment composite.
- *
- * @param composite
- */
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Process composite references declared in this composite
- for (Reference reference : composite.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
-
- // If the composite reference is a promotion override, override the
- // configuration of the promoted reference.
- //FIXME: Policy configuration or wiring of domain-level composite references
- // doesn't cause a promotion override, unless the composite reference has
- // additional bindings. Do we need to detect this and force an override?
- if (compositeReference.isPromotionOverride()) {
- List<ComponentReference> promotedReferences =
- ReferenceConfigurationUtil.getPromotedComponentReferences(compositeReference);
- for (ComponentReference promotedReference : promotedReferences) {
- ReferenceConfigurationUtil.reconcileReferenceBindings(
- compositeReference, promotedReference, assemblyFactory, endpointFactory, monitor);
- if (compositeReference.getInterfaceContract() != null && // can be null in unit tests
- compositeReference.getInterfaceContract().getCallbackInterface() != null) {
- SCABinding scaCallbackBinding = promotedReference.getCallbackBinding(SCABinding.class);
- if (promotedReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().clear();
- } else {
- promotedReference.setCallback(assemblyFactory.createCallback());
- }
- if (scaCallbackBinding != null) {
- promotedReference.getCallback().getBindings().add(scaCallbackBinding);
- }
- if (compositeReference.getCallback() != null) {
- promotedReference.getCallback().getBindings().addAll(compositeReference.getCallback()
- .getBindings());
- }
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.java
deleted file mode 100644
index 3aa9f3bf85..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceBindingBuilderImpl.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.builder.impl;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that performs any additional building steps that
- * composite service bindings may need. Used for WSDL generation.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeServiceBindingBuilderImpl implements CompositeBuilder {
- private Monitor monitor;
-
- public CompositeServiceBindingBuilderImpl(Monitor monitor) {
- this.monitor = monitor;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- buildServiceBindings(composite);
- }
-
- private void buildServiceBindings(Composite composite) {
-
- // build bindings recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- buildServiceBindings((Composite)implementation);
- }
- }
-
- // find all the composite service bindings
- for (Service service : composite.getServices()) {
- for (Binding binding : service.getBindings()) {
- if (binding instanceof BindingBuilderExtension) {
- Component component = ServiceConfigurationUtil.getPromotedComponent((CompositeService)service);
- ((BindingBuilderExtension)binding).getBuilder().build(component, service, binding, monitor);
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
deleted file mode 100644
index a3f31ea2fa..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServiceConfigurationBuilderImpl.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.List;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-
-/**
- * A composite builder that handles the configuration of composite services.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeServiceConfigurationBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
-
- public CompositeServiceConfigurationBuilderImpl(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Process nested composites recursively
- configureNestedCompositeServices(composite);
-
- // Process top level composite services
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
-
- // Get the next lower level promoted service
- ComponentService promotedService = compositeService.getPromotedService();
- if (promotedService != null) {
-
- // Set the bindings using the top level bindings to override the lower level bindings
- if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
- bindingsSpecifiedManually(promotedService.getBindings())) {
- compositeService.getBindings().clear();
- for (Binding binding : promotedService.getBindings()) {
- try {
- compositeService.getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted service
- }
- }
- }
- if (compositeService.getInterfaceContract() != null &&
- compositeService.getInterfaceContract().getCallbackInterface() != null) {
- if (!(compositeService.getCallback() != null &&
- bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
- promotedService.getCallback() != null &&
- bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
- if (compositeService.getCallback() != null) {
- compositeService.getCallback().getBindings().clear();
- } else {
- compositeService.setCallback(assemblyFactory.createCallback());
- }
- for (Binding binding : promotedService.getCallback().getBindings()) {
- try {
- compositeService.getCallback().getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted service
- }
- }
- }
- }
- }
- }
- }
-
- private void configureNestedCompositeServices(Composite composite) {
-
- // Process nested composites recursively
- for (Component component : composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
-
- // First process nested composites
- configureNestedCompositeServices((Composite)implementation);
-
- // Process the component services declared on components in this composite
- for (ComponentService componentService : component.getServices()) {
- Service implService = componentService.getService();
- if (implService != null && implService instanceof CompositeService) {
- CompositeService compositeService = (CompositeService)implService;
-
- // Get the next lower level promoted service
- ComponentService promotedService = compositeService.getPromotedService();
- if (promotedService != null) {
-
- // Set the bindings using the top level bindings to override the lower level bindings
- if (!bindingsSpecifiedManually(compositeService.getBindings()) &&
- bindingsSpecifiedManually(promotedService.getBindings()) ) {
- compositeService.getBindings().clear();
- for (Binding binding : promotedService.getBindings()) {
- try {
- compositeService.getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted service
- }
- }
- }
- if (!bindingsSpecifiedManually(componentService.getBindings()) &&
- bindingsSpecifiedManually(compositeService.getBindings()) ) {
- componentService.getBindings().clear();
- componentService.getBindings().addAll(compositeService.getBindings());
- }
- if (componentService.getInterfaceContract() != null &&
- componentService.getInterfaceContract().getCallbackInterface() != null) {
- if (!(compositeService.getCallback() != null &&
- bindingsSpecifiedManually(compositeService.getCallback().getBindings())) &&
- promotedService.getCallback() != null &&
- bindingsSpecifiedManually(promotedService.getCallback().getBindings())) {
- if (compositeService.getCallback() != null) {
- compositeService.getCallback().getBindings().clear();
- } else {
- compositeService.setCallback(assemblyFactory.createCallback());
- }
- for (Binding binding : promotedService.getCallback().getBindings()) {
- try {
- compositeService.getCallback().getBindings().add((Binding)binding.clone());
- } catch (CloneNotSupportedException ex) {
- // this binding can't be used in the promoted service
- }
- }
- }
- if (!(componentService.getCallback() != null &&
- bindingsSpecifiedManually(componentService.getCallback().getBindings())) &&
- compositeService.getCallback() != null &&
- bindingsSpecifiedManually(compositeService.getCallback().getBindings())) {
- if (componentService.getCallback() != null) {
- componentService.getCallback().getBindings().clear();
- } else {
- componentService.setCallback(assemblyFactory.createCallback());
- }
- componentService.getCallback().getBindings().addAll(
- compositeService.getCallback().getBindings());
- }
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * If the bindings are specified in the composite file return true as they should
- * otherwise return false
- *
- * @param bindings
- * @return true if the bindings were specified manually
- */
- private boolean bindingsSpecifiedManually(List<Binding> bindings) {
-
- if (bindings.size() > 1) {
- return true;
- } else if (bindings.size() == 1 &&
- bindings.get(0) instanceof AutomaticBinding &&
- ((AutomaticBinding)bindings.get(0)).getIsAutomatic()) {
- return false;
- } else if (bindings.size() == 1) {
- return true;
- } else {
- return false;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.java
deleted file mode 100644
index 38cbaf7744..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeServicePromotionBuilderImpl.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.builder.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-
-/**
- * A composite builder that handles the creation of promoted composite services.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeServicePromotionBuilderImpl implements CompositeBuilder {
- private AssemblyFactory assemblyFactory;
-
- public CompositeServicePromotionBuilderImpl(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
-
- // Process top level composite services
- for (Service service : composite.getServices()) {
- CompositeService compositeService = (CompositeService)service;
-
- // Get the innermost promoted service
- ComponentService promotedService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (promotedService != null) {
- Component promotedComponent = ServiceConfigurationUtil.getPromotedComponent(compositeService);
-
- // Create a new component service to represent this composite
- // service on the promoted component
- ComponentService newComponentService = assemblyFactory.createComponentService();
- newComponentService.setName("$promoted$" + compositeService.getName());
- promotedComponent.getServices().add(newComponentService);
- newComponentService.setService(promotedService.getService());
- newComponentService.getBindings().addAll(compositeService.getBindings());
- newComponentService.setInterfaceContract(compositeService.getInterfaceContract());
- if (compositeService.getInterfaceContract() != null &&
- compositeService.getInterfaceContract().getCallbackInterface() != null) {
- newComponentService.setCallback(assemblyFactory.createCallback());
- newComponentService.getCallback().getBindings()
- .addAll(compositeService.getCallback().getBindings());
- ComponentReference callbackReference =
- BaseConfigurationBuilderImpl.createCallbackReference(promotedComponent, newComponentService,
- assemblyFactory);
- callbackReference.getBindings().addAll(compositeService.getCallback().getBindings());
- newComponentService.setCallbackReference(callbackReference);
- }
-
- // Change the composite service to now promote the newly
- // created component service directly
- compositeService.setPromotedComponent(promotedComponent);
- compositeService.setPromotedService(newComponentService);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
deleted file mode 100644
index c261ba82f1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/EndpointBuilderImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, 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.Map;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.builder.EndpointBuilder;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * A factory for the Endpoint model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class EndpointBuilderImpl implements EndpointBuilder {
-
- private Monitor monitor;
- private Map<Binding, Binding> bindingMap;
-
- public EndpointBuilderImpl (Monitor monitor, Map<Binding, Binding> bindingMap) {
- this.monitor = monitor;
- this.bindingMap = bindingMap;
- }
-
- private void warning(String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- private void error(String message, Object model, Exception ex) {
- if (monitor != null){
- Problem problem = null;
- problem = new ProblemImpl(this.getClass().getName(), "assembly-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Resolve an endpoint against the provided target information and the
- * set of candidate bindings.
- */
- public void build(Endpoint endpoint) {
-
- // If this endpoint is not fully configured then don't try and resolve it
- if (endpoint.getTargetComponentService() == null){
- return;
- }
-
- // Does the reference expect callbacks
- boolean bidirectional = false;
-
- if (endpoint.getSourceComponentReference().getInterfaceContract() != null &&
- endpoint.getSourceComponentReference().getInterfaceContract().getCallbackInterface() != null) {
- bidirectional = true;
- }
-
- // if the target service is a promoted service then find the
- // service it promotes
- if (endpoint.getTargetComponentService().getService() instanceof CompositeService) {
- CompositeService compositeService = (CompositeService) endpoint.getTargetComponentService().getService();
- // Find the promoted component service
- ComponentService promotedComponentService = ServiceConfigurationUtil.getPromotedComponentService(compositeService);
- if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
- endpoint.setTargetComponentService(promotedComponentService);
- }
- }
-
- try {
- PolicyConfigurationUtil.determineApplicableBindingPolicySets(endpoint.getSourceComponentReference(),
- endpoint.getTargetComponentService());
- } catch ( Exception e ) {
- error("PolicyRelatedException", endpoint, e);
- }
-
-
- // Match the binding against the bindings of the target service
- Binding resolvedBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
- endpoint.getTargetComponentService(),
- endpoint.getCandidateBindings(),
- endpoint.getTargetComponentService().getBindings(),
- bindingMap, false);
- if (resolvedBinding == null) {
- warning("NoMatchingBinding",
- endpoint.getSourceComponentReference(),
- endpoint.getSourceComponentReference().getName(),
- endpoint.getTargetComponentService().getName());
- } else {
- endpoint.setSourceBinding(resolvedBinding);
- }
-
- if (bidirectional) {
- Binding resolvedCallbackBinding = BindingConfigurationUtil.matchBinding(endpoint.getTargetComponent(),
- endpoint.getTargetComponentService(),
- endpoint.getSourceComponentReference().getCallback().getBindings(),
- endpoint.getTargetComponentService().getCallback().getBindings(),
- bindingMap, true);
- if (resolvedBinding == null) {
- warning("NoMatchingCallbackBinding",
- endpoint.getSourceComponentReference(),
- endpoint.getSourceComponentReference().getName(),
- endpoint.getTargetComponentService().getName());
- } else {
- endpoint.setSourceCallbackBinding(resolvedCallbackBinding);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
deleted file mode 100644
index 944cf2cf36..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-/**
- * Exception to be throw for invalid policy intents / policysets
- *
- * @version $Rev$ $Date$
- */
-public class PolicyConfigurationException extends Exception {
- private static final long serialVersionUID = 506979037642587755L;
-
- public PolicyConfigurationException(String message) {
- super(message);
- }
-
- public PolicyConfigurationException(Throwable e) {
- super(e);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
deleted file mode 100644
index 9adfaa2c56..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PolicyConfigurationUtil.java
+++ /dev/null
@@ -1,758 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-import org.apache.tuscany.sca.policy.util.PolicyComputationUtils;
-import org.apache.tuscany.sca.policy.util.PolicyValidationException;
-import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
-
-/**
- * This class contains policy computation methods common to computing implementation and binding policies
- *
- * @version $Rev$ $Date$
- */
-abstract class PolicyConfigurationUtil {
-
- private static List<Intent> computeInheritableIntents(IntentAttachPointType attachPointType,
- List<Intent> inheritableIntents) throws PolicyValidationException {
- List<Intent> validInheritableIntents = new ArrayList<Intent>();
-
- //expand profile intents in inherited intents
- PolicyComputationUtils.expandProfileIntents(inheritableIntents);
-
- //validate if inherited intent applies to the attachpoint (binding / implementation) and
- //only add such intents to the attachpoint (binding / implementation)
- for (Intent intent : inheritableIntents) {
- if ( !intent.isUnresolved() ) {
- for (QName constrained : intent.getConstrains()) {
- if ( PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
- validInheritableIntents.add(intent);
- break;
- }
- }
- } else {
- throw new PolicyValidationException("Policy Intent '" + intent.getName() + "' is not defined in this domain");
- }
- }
-
- return validInheritableIntents;
- }
-
- private static void normalizeIntents(IntentAttachPoint intentAttachPoint) {
- //expand profile intents specified in the attachpoint (binding / implementation)
- PolicyComputationUtils.expandProfileIntents(intentAttachPoint.getRequiredIntents());
-
- //remove duplicates and ...
- //where qualified form of intent exists retain it and remove the qualifiable intent
- filterDuplicatesAndQualifiableIntents(intentAttachPoint);
- }
-
- private static void trimInherentlyProvidedIntents(IntentAttachPointType attachPointType, List<Intent>intents) {
- //exclude intents that are inherently supported by the
- //attachpoint-type (binding-type / implementation-type)
- List<Intent> requiredIntents = new ArrayList<Intent>(intents);
- for ( Intent intent : requiredIntents ) {
- if ( isProvidedInherently(attachPointType, intent) ) {
- intents.remove(intent);
- }
- }
- }
-
-
- static void computeIntentsForOperations(IntentAttachPoint intentAttachPoint) throws PolicyValidationException {
- if ( intentAttachPoint instanceof OperationsConfigurator ) {
- computeIntentsForOperations((OperationsConfigurator)intentAttachPoint,
- intentAttachPoint,
- intentAttachPoint.getRequiredIntents());
- }
- }
-
- private static void computeIntentsForOperations(OperationsConfigurator opConfigurator,
- IntentAttachPoint intentAttachPoint,
- List<Intent> parentIntents) throws PolicyValidationException {
- IntentAttachPointType attachPointType = intentAttachPoint.getType();
-
- boolean found = false;
- for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
- //expand profile intents specified on operations
- PolicyComputationUtils.expandProfileIntents(confOp.getRequiredIntents());
-
- //validateIntents(confOp, attachPointType);
-
- //add intents specified for parent intent attach point (binding / implementation)
- //wherever its not overridden in the operation
- Intent tempIntent = null;
- List<Intent> attachPointOpIntents = new ArrayList<Intent>();
- for (Intent anIntent : parentIntents) {
- found = false;
-
- tempIntent = anIntent;
- while ( tempIntent instanceof QualifiedIntent ) {
- tempIntent = ((QualifiedIntent)tempIntent).getQualifiableIntent();
- }
-
- for ( Intent opIntent : confOp.getRequiredIntents() ) {
- if ( opIntent.getName().getLocalPart().startsWith(tempIntent.getName().getLocalPart())) {
- found = true;
- break;
- }
- }
-
- if ( !found ) {
- boolean conflict = false;
- for (Intent excluded : anIntent.getExcludedIntents()) {
- if (confOp.getRequiredIntents().contains(excluded)) {
- conflict = true;
- break;
- }
- }
- if (!conflict) {
- attachPointOpIntents.add(anIntent);
- }
- }
- }
-
- confOp.getRequiredIntents().addAll(attachPointOpIntents);
-
- //remove duplicates and ...
- //where qualified form of intent exists retain it and remove the qualifiable intent
- filterDuplicatesAndQualifiableIntents(confOp);
-
- }
- }
-
- private static List<PolicySet> computeInheritablePolicySets(List<PolicySet> inheritablePolicySets,
- List<PolicySet> applicablePolicySets)
- throws PolicyValidationException {
- List<PolicySet> validInheritablePolicySets = new ArrayList<PolicySet>();
- for (PolicySet policySet : inheritablePolicySets) {
- if ( !policySet.isUnresolved() ) {
- if ( applicablePolicySets.contains(policySet) ) {
- validInheritablePolicySets.add(policySet);
- }
- } else {
- throw new PolicyValidationException("Policy Set '" + policySet.getName()
- + "' is not defined in this domain ");
- }
- }
-
- return validInheritablePolicySets;
- }
-
- private static void normalizePolicySets(PolicySetAttachPoint policySetAttachPoint ) {
- //get rid of duplicate entries
- HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
- for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
- policySetTable.put(policySet.getName(), policySet);
- }
-
- policySetAttachPoint.getPolicySets().clear();
- policySetAttachPoint.getPolicySets().addAll(policySetTable.values());
-
- //expand profile intents
- for ( PolicySet policySet : policySetAttachPoint.getPolicySets() ) {
- PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
- }
- }
-
- private static void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
- PolicySetAttachPoint policySetAttachPoint)
- throws PolicyValidationException {
- if ( policySetAttachPoint instanceof OperationsConfigurator ) {
- computePolicySetsForOperations(applicablePolicySets,
- (OperationsConfigurator)policySetAttachPoint,
- policySetAttachPoint);
- }
-
- }
-
- private static void computePolicySetsForOperations(List<PolicySet> applicablePolicySets,
- OperationsConfigurator opConfigurator,
- PolicySetAttachPoint policySetAttachPoint)
- throws PolicyValidationException {
- //String appliesTo = null;
- //String scdlFragment = "";
- HashMap<QName, PolicySet> policySetTable = new HashMap<QName, PolicySet>();
- IntentAttachPointType attachPointType = policySetAttachPoint.getType();
-
- for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
- //validate policysets specified for the attachPoint
- for (PolicySet policySet : confOp.getPolicySets()) {
- if ( !policySet.isUnresolved() ) {
- //appliesTo = policySet.getAppliesTo();
-
- //if (!PolicyValidationUtils.isPolicySetApplicable(scdlFragment, appliesTo, attachPointType)) {
- if (!applicablePolicySets.contains(policySet)) {
- throw new PolicyValidationException("Policy Set '" + policySet.getName()
- + " specified for operation " + confOp.getName()
- + "' does not constrain extension type "
- + attachPointType.getName());
-
- }
- } else {
- throw new PolicyValidationException("Policy Set '" + policySet.getName()
- + " specified for operation " + confOp.getName()
- + "' is not defined in this domain ");
- }
- }
-
- //get rid of duplicate entries
- for ( PolicySet policySet : confOp.getPolicySets() ) {
- policySetTable.put(policySet.getName(), policySet);
- }
-
- confOp.getPolicySets().clear();
- confOp.getPolicySets().addAll(policySetTable.values());
- policySetTable.clear();
-
- //expand profile intents
- for ( PolicySet policySet : confOp.getPolicySets() ) {
- PolicyComputationUtils.expandProfileIntents(policySet.getProvidedIntents());
- }
- }
- }
-
-
- private static void trimProvidedIntents(List<Intent> requiredIntents, List<PolicySet> policySets) {
- for ( PolicySet policySet : policySets ) {
- trimProvidedIntents(requiredIntents, policySet);
- }
- }
-
- private static void determineApplicableDomainPolicySets(List<PolicySet> applicablePolicySets,
- PolicySetAttachPoint policySetAttachPoint,
- IntentAttachPointType intentAttachPointType) {
-
- if (policySetAttachPoint.getRequiredIntents().size() > 0) {
-
- // form a list of all intents required by the attach point
- List<Intent> combinedTargetIntents = new ArrayList<Intent>();
- combinedTargetIntents.addAll(policySetAttachPoint.getRequiredIntents());
- for (PolicySet targetPolicySet : policySetAttachPoint.getPolicySets()) {
- combinedTargetIntents.addAll(PolicyComputationUtils.findAndExpandProfileIntents(targetPolicySet.getProvidedIntents()));
- }
-
- //since the set of applicable policysets for this attachpoint is known
- //we only need to check in that list if there is a policyset that matches
- for (PolicySet policySet : applicablePolicySets) {
- // do not use the policy set if it provides intents that conflict with required intents
- boolean conflict = false;
- List<Intent> providedIntents = PolicyComputationUtils.findAndExpandProfileIntents(policySet.getProvidedIntents());
- checkConflict: for (Intent intent : providedIntents) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (combinedTargetIntents.contains(excluded)) {
- conflict = true;
- break checkConflict;
- }
- }
- }
- if (conflict)
- continue;
- int prevSize = policySetAttachPoint.getRequiredIntents().size();
- trimProvidedIntents(policySetAttachPoint.getRequiredIntents(), policySet);
- // if any intent was trimmed off, then this policyset must
- // be attached to the intent attachpoint's policyset
- if (prevSize != policySetAttachPoint.getRequiredIntents().size()) {
- policySetAttachPoint.getPolicySets().add(policySet);
- }
- }
- }
- }
-
- private static boolean isProvidedInherently(IntentAttachPointType attachPointType, Intent intent) {
- return ( attachPointType != null &&
- (( attachPointType.getAlwaysProvidedIntents() != null &&
- attachPointType.getAlwaysProvidedIntents().contains(intent) ) ||
- ( attachPointType.getMayProvideIntents() != null &&
- attachPointType.getMayProvideIntents().contains(intent) )
- ) );
- }
-
- private static void trimProvidedIntents(List<Intent> requiredIntents, PolicySet policySet) {
- for ( Intent providedIntent : policySet.getProvidedIntents() ) {
- if ( requiredIntents.contains(providedIntent) ) {
- requiredIntents.remove(providedIntent);
- }
- }
-
- for ( Intent mappedIntent : policySet.getMappedPolicies().keySet() ) {
- if ( requiredIntents.contains(mappedIntent) ) {
- requiredIntents.remove(mappedIntent);
- }
- }
- }
-
- private static void filterDuplicatesAndQualifiableIntents(IntentAttachPoint intentAttachPoint) {
- //remove duplicates
- Map<QName, Intent> intentsTable = new HashMap<QName, Intent>();
- for ( Intent intent : intentAttachPoint.getRequiredIntents() ) {
- intentsTable.put(intent.getName(), intent);
- }
-
- //where qualified form of intent exists retain it and remove the qualifiable intent
- Map<QName, Intent> intentsTableCopy = new HashMap<QName, Intent>(intentsTable);
- //if qualified form of intent exists remove the unqualified form
- for ( Intent intent : intentsTableCopy.values() ) {
- if ( intent instanceof QualifiedIntent ) {
- QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
- if ( intentsTable.get(qualifiedIntent.getQualifiableIntent().getName()) != null ) {
- intentsTable.remove(qualifiedIntent.getQualifiableIntent().getName());
- }
- }
- }
- intentAttachPoint.getRequiredIntents().clear();
- intentAttachPoint.getRequiredIntents().addAll(intentsTable.values());
- }
-
- private static void validateIntents(ConfiguredOperation confOp, IntentAttachPointType attachPointType) throws PolicyValidationException {
- boolean found = false;
- if ( attachPointType != null ) {
- //validate intents specified against the parent (binding / implementation)
- found = false;
- for (Intent intent : confOp.getRequiredIntents()) {
- if ( !intent.isUnresolved() ) {
- for (QName constrained : intent.getConstrains()) {
- if (PolicyValidationUtils.isConstrained(constrained, attachPointType)) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- throw new PolicyValidationException("Policy Intent '" + intent.getName()
- + " specified for operation " + confOp.getName()
- + "' does not constrain extension type "
- + attachPointType.getName());
- }
- } else {
- throw new PolicyValidationException("Policy Intent '" + intent.getName()
- + " specified for operation " + confOp.getName()
- + "' is not defined in this domain ");
- }
- }
- }
- }
-
- static void computeBindingIntentsAndPolicySets(Contract contract) throws PolicyValidationException {
- for (Binding binding : contract.getBindings()) {
- if (binding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
- computeIntents((IntentAttachPoint)binding, contract.getRequiredIntents());
-
- aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
- policiedBinding.getApplicablePolicySets());
-
- computePolicySets(policiedBinding, contract.getPolicySets());
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(
- policiedBinding.getRequiredIntents(),
- policiedBinding.getPolicySets(),
- policiedBinding.getType(),
- contract.getName());
-
- if ( binding instanceof OperationsConfigurator &&
- contract instanceof OperationsConfigurator ) {
- //add or merge service operations to the binding
- addInheritedOpConfOnBindings((OperationsConfigurator)contract,
- (OperationsConfigurator)binding,
- (PolicySetAttachPoint)binding);
-
- computeIntentsForOperations((IntentAttachPoint)binding);
- computePolicySetsForOperations(contract.getApplicablePolicySets(),
- policiedBinding);
-
- for ( ConfiguredOperation confOp : ((OperationsConfigurator)binding).getConfiguredOperations() ) {
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(
- confOp.getRequiredIntents(),
- confOp.getPolicySets(),
- policiedBinding.getType(),
- contract.getName() + "." + confOp.getName());
- }
-
- }
- }
- }
-
- if ( contract.getCallback() != null ) {
- for (Binding binding : contract.getCallback().getBindings()) {
- if (binding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)binding;
- computeIntents((IntentAttachPoint)binding, contract.getCallback().getRequiredIntents());
-
- aggregateAndPruneApplicablePolicySets(contract.getApplicablePolicySets(),
- policiedBinding.getApplicablePolicySets());
-
- computePolicySets(policiedBinding, contract.getCallback().getPolicySets());
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(
- policiedBinding.getRequiredIntents(),
- policiedBinding.getPolicySets(),
- policiedBinding.getType(),
- contract.getName() + " callback");
-
- }
- }
- }
- }
-
- private static void computeIntents(IntentAttachPoint policiedBinding, List<Intent> inheritedIntents)
- throws PolicyValidationException {
- //since the parent component could also contain intents that apply to implementation
- //and binding elements within, we filter out only those that apply to this binding type
- List<Intent> prunedIntents = computeInheritableIntents(policiedBinding.getType(),
- inheritedIntents);
- policiedBinding.getRequiredIntents().addAll(prunedIntents);
-
- normalizeIntents(policiedBinding);
- }
-
- private static void computePolicySets(PolicySetAttachPoint policiedBinding,
- List<PolicySet> inheritedPolicySets) throws PolicyValidationException {
-
- List<PolicySet> prunedPolicySets = computeInheritablePolicySets(inheritedPolicySets,
- policiedBinding.getApplicablePolicySets());
- policiedBinding.getPolicySets().addAll(prunedPolicySets);
- normalizePolicySets(policiedBinding);
- }
-
- static void determineApplicableBindingPolicySets(Contract source, Contract target) throws PolicyConfigurationException {
- List<Intent> intentsCopy = null;
- for (Binding aBinding : source.getBindings()) {
- if (aBinding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)aBinding;
- IntentAttachPointType bindingType = policiedBinding.getType();
-
-
- intentsCopy = new ArrayList<Intent>(policiedBinding.getRequiredIntents());
- // add the target component's intents to the reference binding
- if (target != null) {
- for (Intent intent : target.getRequiredIntents()) {
- if (!policiedBinding.getRequiredIntents().contains(intent)) {
- for (QName constrained : intent.getConstrains()) {
- if (bindingType != null && bindingType.getName().getNamespaceURI()
- .equals(constrained.getNamespaceURI())
- && bindingType.getName().getLocalPart().startsWith(constrained
- .getLocalPart())) {
- policiedBinding.getRequiredIntents().add(intent);
- break;
- }
- }
- }
- }
- }
-
- //trim intents specified in operations. First check for policysets specified on the operation
- //and then in the parent implementation
- if ( aBinding instanceof OperationsConfigurator ) {
- OperationsConfigurator opConfigurator = (OperationsConfigurator)aBinding;
-
- for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
- List<Intent> opsIntentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
-
- trimInherentlyProvidedIntents(policiedBinding.getType(),
- confOp.getRequiredIntents());
- trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
- trimProvidedIntents(confOp.getRequiredIntents(), policiedBinding.getPolicySets());
-
- determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
- confOp,
- policiedBinding.getType());
-
- if (confOp.getRequiredIntents().size() > 0) {
- throw new PolicyConfigurationException("The following are unfulfilled intents for operations configured in "
- + "binding - " + aBinding.getName() + "\nUnfulfilled Intents = " +
- confOp.getRequiredIntents());
- }
-
- //the intents list could have been trimmed when matching for policysets
- //since the bindings may need the original set of intents we copy that back
- confOp.getRequiredIntents().clear();
- confOp.getRequiredIntents().addAll(opsIntentsCopy);
-
- }
- }
-
- trimInherentlyProvidedIntents(policiedBinding.getType(),
- policiedBinding.getRequiredIntents());
- trimProvidedIntents(policiedBinding.getRequiredIntents(), policiedBinding
- .getPolicySets());
-
- // determine additional policysets that match remaining intents
- // TODO: resolved to domain policy registry and attach suitable
- // policy sets to the binding
- // for now using the SCA Definitions instead of registry
- // if there are intents that are not provided by any policy set
- // throw a warning
- determineApplicableDomainPolicySets(source, policiedBinding);
-
- //the intents list could have been trimmed when matching for policysets
- //since the bindings may need the original set of intents we copy that back
- policiedBinding.getRequiredIntents().clear();
- policiedBinding.getRequiredIntents().addAll(intentsCopy);
-
- }
- }
- }
-
- private static void determineApplicableDomainPolicySets(Contract contract,
- PolicySetAttachPoint policiedBinding)
- throws PolicyConfigurationException {
- //if ( domainPolicySets != null) {
- determineApplicableDomainPolicySets(policiedBinding.getApplicablePolicySets(),
- policiedBinding,
- policiedBinding.getType());
-
- if ( policiedBinding.getRequiredIntents().size() > 0 ) {
- if ( contract instanceof Service ) {
- throw new PolicyConfigurationException("The following are unfulfilled intents for " +
- "binding in service - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- } else {
- throw new PolicyConfigurationException("The are unfulfilled intents for " +
- "binding in reference - " + contract.getName() + "\nUnfulfilled Intents = " +
- policiedBinding.getRequiredIntents());
- }
- }
- //}
- }
-
- private static void addInheritedOpConfOnBindings(OperationsConfigurator source,
- OperationsConfigurator target,
- PolicySetAttachPoint attachPoint) throws PolicyValidationException {
-
- List<ConfiguredOperation> additionalOperations = new ArrayList<ConfiguredOperation>();
- for ( ConfiguredOperation sourceConfOp : source.getConfiguredOperations() ) {
- boolean found = false;
- ConfiguredOperation targetConfOp = null;
- for ( ConfiguredOperation confOp : target.getConfiguredOperations() ) {
- if ( sourceConfOp.getName().equals(confOp.getName())) {
- targetConfOp = confOp;
- found = true;
- break;
- }
- }
- if ( !found ) {
- // Create a new target configured operation and copy everything from the source
- // except the intents and policy sets (which must be computed below).
- try {
- targetConfOp = (ConfiguredOperation) sourceConfOp.clone();
- targetConfOp.setRequiredIntents(new ArrayList<Intent>());
- targetConfOp.setPolicySets(new ArrayList<PolicySet>());
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- }
-
-
- 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);
-
- // If this is a new target configured operation, we will add it to the target list
- // if it has required intents or policy sets.
- if (!found && (!targetConfOp.getRequiredIntents().isEmpty() || !targetConfOp.getPolicySets().isEmpty())) {
- additionalOperations.add(targetConfOp);
- }
- }
-
- if ( !additionalOperations.isEmpty() ) {
- target.getConfiguredOperations().addAll(additionalOperations);
- }
- }
-
- private static void aggregateAndPruneApplicablePolicySets(List<PolicySet> source, List<PolicySet> target) {
- target.addAll(source);
- //strip duplicates
- Hashtable<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
- for ( PolicySet policySet : target ) {
- policySetTable.put(policySet.getName(), policySet);
- }
-
- target.clear();
- target.addAll(policySetTable.values());
- }
-
- static <C extends Contract> void inheritDefaultPolicies(Base parent, List<C> contracts) {
-
- for (Contract contract : contracts) {
-
- // The contract inherits default policies from the parent composite/component.
- if ( parent instanceof PolicySetAttachPoint ) {
- PolicyComputationUtils.addDefaultPolicies(
- ((PolicySetAttachPoint)parent).getRequiredIntents(),
- ((PolicySetAttachPoint)parent).getPolicySets(),
- contract.getRequiredIntents(),
- contract.getPolicySets());
- }
-
- // The contract's configured operations inherit default policies from the contract.
- for ( ConfiguredOperation confOp : contract.getConfiguredOperations() ) {
- PolicyComputationUtils.addDefaultPolicies(
- contract.getRequiredIntents(),
- contract.getPolicySets(),
- confOp.getRequiredIntents(),
- confOp.getPolicySets());
- }
-
- // The contract's callback inherits default policies from the contract.
- if (contract.getCallback() != null) {
- PolicyComputationUtils.addDefaultPolicies(
- contract.getRequiredIntents(),
- contract.getPolicySets(),
- contract.getCallback().getRequiredIntents(),
- contract.getCallback().getPolicySets());
- }
-
- }
- }
-
- static void computeImplementationIntentsAndPolicySets(Implementation implementation, Component parent)
- throws PolicyValidationException, PolicyConfigurationException {
- if ( implementation instanceof PolicySetAttachPoint ) {
- PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)implementation;
- //since for an implementation the component has its policy intents and policysets its possible
- //that there are some intents there that does not constrain the implementation.. so prune
- List<Intent> prunedIntents = computeInheritableIntents(policiedImplementation.getType(),
- parent.getRequiredIntents());
- parent.getRequiredIntents().clear();
- parent.getRequiredIntents().addAll(prunedIntents);
- normalizeIntents(parent);
-
- computeIntentsForOperations((OperationsConfigurator)parent,
- (IntentAttachPoint)implementation,
- parent.getRequiredIntents());
-
-
- List<PolicySet> prunedPolicySets = computeInheritablePolicySets(parent.getPolicySets(),
- parent.getApplicablePolicySets());
- parent.getPolicySets().clear();
- parent.getPolicySets().addAll(prunedPolicySets);
- normalizePolicySets(parent);
-
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(
- parent.getRequiredIntents(),
- parent.getPolicySets(),
- policiedImplementation.getType(),
- parent.getName());
-
- computePolicySetsForOperations(parent.getApplicablePolicySets(),
- (OperationsConfigurator)parent,
- (PolicySetAttachPoint)implementation);
-
- for ( ConfiguredOperation confOp : ((OperationsConfigurator)parent).getConfiguredOperations() ) {
- PolicyComputationUtils.checkForMutuallyExclusiveIntents(
- confOp.getRequiredIntents(),
- confOp.getPolicySets(),
- policiedImplementation.getType(),
- parent.getName() + "." + confOp.getName());
- }
-
- determineApplicableImplementationPolicySets(parent);
-
- }
- }
-
- private static void determineApplicableImplementationPolicySets(Component component) throws PolicyConfigurationException {
- List<Intent> intentsCopy = null;
- if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
- PolicySetAttachPoint policiedImplementation = (PolicySetAttachPoint)component.getImplementation();
-
- //trim intents specified in operations. First check for policysets specified on the operation
- //and then in the parent implementation
- if ( component instanceof OperationsConfigurator ) {
- OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
-
- for ( ConfiguredOperation confOp : opConfigurator.getConfiguredOperations() ) {
- intentsCopy = new ArrayList<Intent>(confOp.getRequiredIntents());
- trimInherentlyProvidedIntents(policiedImplementation.getType(),
- confOp.getRequiredIntents());
- trimProvidedIntents(confOp.getRequiredIntents(), confOp.getPolicySets());
- trimProvidedIntents(confOp.getRequiredIntents(), component.getPolicySets());
-
- determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
- confOp,
- policiedImplementation.getType());
-
- if (confOp.getRequiredIntents().size() > 0) {
- throw new PolicyConfigurationException("The following are unfulfilled intents for operations configured in "
- + "component implementation - " + component.getName() + "\nUnfulfilled Intents = " +
- confOp.getRequiredIntents());
- }
-
- //the intents list could have been trimmed when matching for policysets
- //since the implementation may need the original set of intents we copy that back
- confOp.getRequiredIntents().clear();
- confOp.getRequiredIntents().addAll(intentsCopy);
- }
- }
-
- intentsCopy = new ArrayList<Intent>(component.getRequiredIntents());
- trimInherentlyProvidedIntents(policiedImplementation.getType(),
- component.getRequiredIntents());
- trimProvidedIntents(component.getRequiredIntents(), component.getPolicySets());
-
- //determine additional policysets that match remaining intents
- //if there are intents that are not provided by any policy set throw a warning
- //TODO: resolved to domain policy registry and attach suitable policy sets to the implementation
- //...for now using the SCA Definitions instead of registry
- //if ( domainPolicySets != null) {
- determineApplicableDomainPolicySets(component.getApplicablePolicySets(),
- component,
- policiedImplementation.getType());
-
- if (component.getRequiredIntents().size() > 0) {
- throw new PolicyConfigurationException("The following are unfulfilled intents for component implementation - " + component
- .getName() + "\nUnfulfilled Intents = " + component.getRequiredIntents());
- }
- //}
-
- //the intents list could have been trimmed when matching for policysets
- //since the bindings may need the original set of intents we copy that back
- component.getRequiredIntents().clear();
- component.getRequiredIntents().addAll(intentsCopy);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtil.java
deleted file mode 100644
index e85aec8cea..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-class PrintUtil {
- private boolean useGetters = false;
- private PrintWriter out;
- private int indent;
-
- public PrintUtil(PrintWriter out, boolean useGetters) {
- this.out = out;
- this.useGetters = useGetters;
- }
-
- public PrintUtil(OutputStream out) {
- this.out = new PrintWriter(new OutputStreamWriter(out), true);
- }
-
- void indent() {
- for (int i = 0; i < indent; i++) {
- out.print(" ");
- }
- }
-
- /**
- * Print an object.
- *
- * @param object
- */
- public void print(Object object) {
- Set<Integer> objects = new HashSet<Integer>();
- print(object, objects);
- }
-
- /**
- * Print an object.
- *
- * @param object
- */
- private void print(Object object, Set<Integer> printed) {
- if (object == null) {
- return;
- }
- int id = System.identityHashCode(object);
- if (printed.contains(id)) {
-
- // If we've already printed an object, print just it's HashCode
- indent();
- out.println(object.getClass().getName() + "@" + id);
- } else {
- printed.add(id);
- try {
-
- // Print the object class name
- indent();
- out.println(object.getClass().getSimpleName() + " {");
-
- // Get the object's properties
- ValueAccessor accessor = useGetters ? new PropertyAccessor(object) : new FieldAccessor(object);
- for (int i = 0; i < accessor.size(); i++) {
- try {
-
- // Get the value of each property
- Object value = accessor.getValue(i);
- if (value != null) {
-
- // Convert array value into a list
- if (value.getClass().isArray()) {
- value = Arrays.asList((Object[])value);
- }
-
- // Print elements in a list
- if (value instanceof List) {
- if (!((List)value).isEmpty()) {
- indent++;
- indent();
- out.println(accessor.getName(i) + "= [");
-
- // Print each element, recursively
- for (Object element : (List)value) {
- indent++;
- print(element, printed);
- indent--;
- }
- indent();
- out.println(" ]");
- indent--;
- }
- } else {
- Class<?> valueClass = value.getClass();
-
- // Print a primitive, java built in type or
- // enum, using toString()
- if (valueClass.isPrimitive() || valueClass.getName().startsWith("java.")
- || valueClass.getName().startsWith("javax.")
- || valueClass.isEnum()) {
- if (!accessor.getName(i).equals("class")) {
- if (!(Boolean.FALSE.equals(value))) {
- indent++;
- indent();
- out.println(accessor.getName(i) + "=" + value.toString());
- indent--;
- }
- }
- } else if (value instanceof Node) {
- indent++;
- indent();
- out.println(accessor.getName(i) + "=" + value.toString());
- indent--;
- } else {
-
- // Print an object, recursively
- indent++;
- indent();
- out.println(accessor.getName(i) + "= {");
- indent++;
- print(value, printed);
- indent--;
- indent();
- out.println("}");
- indent--;
- }
- }
- }
- } catch (Exception e) {
- }
- }
- indent();
- out.println("}");
- } catch (Exception e) {
- indent();
- out.println(e);
- }
- }
- }
-
- public static interface ValueAccessor {
- int size();
-
- String getName(int i);
-
- Object getValue(int i) throws Exception;
- }
-
- /**
- * Java field reflection based value accessor
- */
- private static class FieldAccessor implements ValueAccessor {
-
- private Object object;
- private List<Field> fields;
-
- public FieldAccessor(Object object) {
- this.fields = getAllFields(object.getClass());
- this.object = object;
- }
-
- public String getName(int i) {
- return fields.get(i).getName();
- }
-
- public Object getValue(int i) throws Exception {
- return fields.get(i).get(object);
- }
-
- public int size() {
- return fields.size();
- }
-
- }
-
- /**
- * JavaBean-based value accessor
- */
- private static class PropertyAccessor implements ValueAccessor {
-
- private Object object;
- private PropertyDescriptor[] fields;
-
- public PropertyAccessor(Object object) throws IntrospectionException {
- BeanInfo beanInfo = Introspector.getBeanInfo(object.getClass());
- this.fields = beanInfo.getPropertyDescriptors();
- this.object = object;
- }
-
- public String getName(int i) {
- return fields[i].getName();
- }
-
- public Object getValue(int i) throws Exception {
- Method getter = fields[i].getReadMethod();
- if (getter != null) {
- return getter.invoke(object);
- }
- return null;
- }
-
- public int size() {
- return fields.length;
- }
-
- }
-
- /**
- * Returns a collection of fields declared by a class
- * or one of its supertypes
- */
- private static List<Field> getAllFields(Class<?> clazz) {
- return getAllFields(clazz, new ArrayList<Field>());
- }
-
- /**
- * Recursively evaluates the type hierarchy to return all fields
- */
- private static List<Field> getAllFields(Class<?> clazz, List<Field> fields) {
- if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
- return fields;
- }
- fields = getAllFields(clazz.getSuperclass(), fields);
- Field[] declaredFields = clazz.getDeclaredFields();
- for (final Field field : declaredFields) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- field.setAccessible(true); // ignore Java accessibility
- return null;
- }
- });
- fields.add(field);
- }
- return fields;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.java
deleted file mode 100644
index 0105d4af50..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/PropertyConfigurationUtil.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.builder.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * Utility class to deal with processing of component properties that are taking values from the parent
- * composite's properties or an external file.
- *
- * @version $Rev$ $Date$
- */
-abstract class PropertyConfigurationUtil {
-
- private static Document evaluate(Document node, XPathExpression expression, DocumentBuilderFactory documentBuilderFactory)
- throws XPathExpressionException, ParserConfigurationException {
-
- Node value = node.getDocumentElement();
- Node result = (Node)expression.evaluate(value, XPathConstants.NODE);
- if (result == null) {
- return null;
- }
-
- // TODO: How to wrap the result into a Document?
- Document document = documentBuilderFactory.newDocumentBuilder().newDocument();
- if (result instanceof Document) {
- return (Document)result;
- } else {
- //Element root = document.createElementNS(null, "value");
- //document.appendChild(root);
- document.appendChild(document.importNode(result, true));
- return document;
- }
- }
-
- private static Document loadFromFile(String file, TransformerFactory transformerFactory) throws MalformedURLException, IOException,
- TransformerException, ParserConfigurationException {
- URI uri = URI.create(file);
- // URI resolution for relative URIs is done when the composite is resolved.
- URL url = uri.toURL();
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- InputStream is = null;
- try {
- is = connection.getInputStream();
-
- Source streamSource = new SAXSource(new InputSource(is));
- DOMResult result = new DOMResult();
- javax.xml.transform.Transformer transformer = transformerFactory.newTransformer();
- transformer.transform(streamSource, result);
-
- Document document = (Document)result.getNode();
-
- // TUSCANY-2377, Add a fake value element so it's consistent with
- // the DOM tree loaded from inside SCDL
- Element root = document.createElementNS(null, "value");
- root.appendChild(document.getDocumentElement());
- document.appendChild(root);
- return document;
- } finally {
- if (is != null) {
- is.close();
- }
- }
- }
-
- static void sourceComponentProperties(Map<String, Property> compositeProperties,
- Component componentDefinition,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory) throws CompositeBuilderException,
- ParserConfigurationException,
- XPathExpressionException,
- TransformerException,
- IOException {
-
- List<ComponentProperty> componentProperties = componentDefinition.getProperties();
- for (ComponentProperty aProperty : componentProperties) {
- String source = aProperty.getSource();
- String file = aProperty.getFile();
- if (source != null) {
- // $<name>/...
- int index = source.indexOf('/');
- if (index == -1) {
- // Tolerating $prop
- source = source + "/";
- index = source.length() - 1;
- }
- if (source.charAt(0) == '$') {
- String name = source.substring(1, index);
- Property compositeProp = compositeProperties.get(name);
- if (compositeProp == null) {
- throw new CompositeBuilderException("The 'source' cannot be resolved to a composite property: " + source);
- }
-
- Document compositePropDefValues = (Document)compositeProp.getValue();
-
- // FIXME: How to deal with namespaces?
- Document node = evaluate(compositePropDefValues, aProperty.getSourceXPathExpression(), documentBuilderFactory);
-
- if (node != null) {
- aProperty.setValue(node);
- }
- } else {
- throw new CompositeBuilderException("The 'source' has an invalid value: " + source);
- }
- } else if (file != null) {
- aProperty.setValue(loadFromFile(aProperty.getFile(), transformerFactory));
-
- }
- }
- }
-
- private static class DOMNamespaceContext implements NamespaceContext {
- private Node node;
-
- /**
- * @param node
- */
- public DOMNamespaceContext(Node node) {
- super();
- this.node = node;
- }
-
- public String getNamespaceURI(String prefix) {
- if (prefix == null) {
- throw new IllegalArgumentException("Prefix is null");
- } else if (XMLConstants.XML_NS_PREFIX.equals(prefix)) {
- return XMLConstants.XML_NS_URI;
- } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) {
- return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
- }
- String ns = node.lookupNamespaceURI(prefix);
- return ns == null ? XMLConstants.NULL_NS_URI : ns;
- }
-
- public String getPrefix(String namespaceURI) {
- if (namespaceURI == null) {
- throw new IllegalArgumentException("Namespace URI is null");
- } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
- return XMLConstants.XML_NS_PREFIX;
- } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- return XMLConstants.XMLNS_ATTRIBUTE;
- }
- return node.lookupPrefix(namespaceURI);
- }
-
- public Iterator<?> getPrefixes(String namespaceURI) {
- // Not implemented
- if (namespaceURI == null) {
- throw new IllegalArgumentException("Namespace URI is null");
- } else if (XMLConstants.XML_NS_URI.equals(namespaceURI)) {
- return Arrays.asList(XMLConstants.XML_NS_PREFIX).iterator();
- } else if (XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) {
- return Arrays.asList(XMLConstants.XMLNS_ATTRIBUTE).iterator();
- }
- String prefix = getPrefix(namespaceURI);
- if (prefix == null) {
- return Collections.emptyList().iterator();
- }
- return Arrays.asList(prefix).iterator();
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
deleted file mode 100644
index 20a964a08d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ReferenceConfigurationUtil.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.builder.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * This class encapsulates utility methods to deal with reference definitions
- *
- * @version $Rev$ $Date$
- */
-abstract class ReferenceConfigurationUtil {
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private static void warning(Monitor monitor, String message, Object model, String... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(ReferenceConfigurationUtil.class.getName(), "assembly-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- static boolean isValidMultiplicityOverride(Multiplicity definedMul, Multiplicity overridenMul) {
- if (definedMul != overridenMul) {
- switch (definedMul) {
- case ZERO_N:
- return overridenMul == Multiplicity.ZERO_ONE;
- case ONE_N:
- return overridenMul == Multiplicity.ONE_ONE;
- default:
- return false;
- }
- } else {
- return true;
- }
- }
-
- static boolean validateMultiplicityAndTargets(Multiplicity multiplicity,
- List<?> targets, List<Binding> bindings) {
-
- // Count targets
- int count = targets.size();
-
- //FIXME workaround, this validation is sometimes invoked too early
- // before we get a chance to init the multiplicity attribute
- if (multiplicity == null) {
- return true;
- }
-
- switch (multiplicity) {
- case ZERO_N:
- break;
- case ZERO_ONE:
- if (count > 1) {
- return false;
- }
- break;
- case ONE_ONE:
- if (count != 1) {
- if (count == 0) {
- for (Binding binding: bindings) {
- if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) {
- return true;
- }
- }
- }
- return false;
- }
- break;
- case ONE_N:
- if (count < 1) {
- if (count == 0) {
- for (Binding binding: bindings) {
- if (!(binding instanceof OptimizableBinding) || binding.getURI()!=null) {
- return true;
- }
- }
- }
- return false;
- }
- break;
- }
- return true;
- }
-
- /**
- * Follow a reference promotion chain down to the innermost (non composite)
- * component references.
- *
- * @param compositeReference
- * @return
- */
- static List<ComponentReference> getPromotedComponentReferences(CompositeReference compositeReference) {
- List<ComponentReference> componentReferences = new ArrayList<ComponentReference>();
- collectPromotedComponentReferences(compositeReference, componentReferences);
- return componentReferences;
- }
-
- /**
- * Follow a reference promotion chain down to the innermost (non composite)
- * component references.
- *
- * @param compositeReference
- * @param componentReferences
- * @return
- */
- private static void collectPromotedComponentReferences(CompositeReference compositeReference,
- List<ComponentReference> componentReferences) {
- for (ComponentReference componentReference : compositeReference.getPromotedReferences()) {
- Reference reference = componentReference.getReference();
- if (reference instanceof CompositeReference) {
-
- // Continue to follow the reference promotion chain
- collectPromotedComponentReferences((CompositeReference)reference, componentReferences);
-
- } else if (reference != null) {
-
- // Found a non-composite reference
- componentReferences.add(componentReference);
- }
- }
- }
-
- /**
- * Override the bindings for a promoted reference from an outer component
- * reference
- *
- * @param reference
- * @param promotedReference
- */
- static void reconcileReferenceBindings(Reference reference,
- ComponentReference promotedReference,
- AssemblyFactory assemblyFactory,
- EndpointFactory endpointFactory,
- Monitor monitor) {
-
- if (promotedReference.getMultiplicity() == Multiplicity.ONE_ONE ||
- promotedReference.getMultiplicity() == Multiplicity.ZERO_ONE) {
-
- // if necessary override the promoted endpoints (and bindings) with the top level bindings
- if (reference.getBindings().size() > 0 ){
-
- List<Binding> bindingsToCopyDown = new ArrayList<Binding>();
- List<Endpoint> endpointsToCopyDown = new ArrayList<Endpoint>();
-
- for (Binding binding : reference.getBindings()) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- bindingsToCopyDown.add(binding);
-
- if (reference instanceof ComponentReference){
- for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){
- if ( endpoint.getSourceBinding() == binding){
- endpointsToCopyDown.add(endpoint);
- break;
- }
- }
- } else {
- // create a new endpoint to represent this promoted binding
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(binding.getURI());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(promotedReference);
- endpoint.setInterfaceContract(reference.getInterfaceContract());
- endpoint.setSourceBinding(binding);
- endpointsToCopyDown.add(endpoint);
- }
- }
- }
-
- if (bindingsToCopyDown.size() > 0) {
- promotedReference.getBindings().clear();
- promotedReference.getBindings().addAll(bindingsToCopyDown);
-
- promotedReference.getEndpoints().clear();
- promotedReference.getEndpoints().addAll(endpointsToCopyDown);
- }
- }
-
- if (promotedReference.getBindings().size() > 1) {
- warning(monitor, "ComponentReferenceMoreWire", promotedReference, promotedReference.getName());
- }
- } else {
- // if necessary merge the promoted endpoints (and bindings) with the top level bindings
- if (reference.getBindings().size() > 0 ){
-
- for (Binding binding : reference.getBindings()) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- promotedReference.getBindings().add(binding);
-
- if (reference instanceof ComponentReference){
- for (Endpoint endpoint : ((ComponentReference)reference).getEndpoints()){
- if ( endpoint.getSourceBinding() == binding){
- promotedReference.getEndpoints().add(endpoint);
- break;
- }
- }
- } else {
- // create a new endpoint to represent this promoted binding
- Endpoint endpoint = endpointFactory.createEndpoint();
- endpoint.setTargetName(binding.getURI());
- endpoint.setSourceComponent(null); // TODO - fixed up at start
- endpoint.setSourceComponentReference(promotedReference);
- endpoint.setInterfaceContract(reference.getInterfaceContract());
- endpoint.setSourceBinding(binding);
- promotedReference.getEndpoints().add(endpoint);
- }
- }
- }
- }
- }
-
- Set<Binding> callbackBindings = new HashSet<Binding>();
- if (promotedReference.getCallback() != null) {
- callbackBindings.addAll(promotedReference.getCallback().getBindings());
- }
- if (reference.getCallback() != null) {
- callbackBindings.addAll(reference.getCallback().getBindings());
- }
- promotedReference.setCallback(assemblyFactory.createCallback());
- for (Binding binding : callbackBindings) {
- if ((!(binding instanceof OptimizableBinding)) || binding.getURI() != null) {
- promotedReference.getCallback().getBindings().add(binding);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.java
deleted file mode 100644
index 41a8b3f8ba..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ServiceConfigurationUtil.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.builder.impl;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Service;
-
-/**
- * This class encapsulates utility methods to deal with service definitions.
- *
- * @version $Rev$ $Date$
- */
-abstract class ServiceConfigurationUtil {
-
- /**
- * Follow a service promotion chain down to the inner most (non composite)
- * component service.
- *
- * @param topCompositeService
- * @return
- */
- static ComponentService getPromotedComponentService(CompositeService compositeService) {
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- Service service = componentService.getService();
- if (componentService.getName() != null && service instanceof CompositeService) {
-
- // Continue to follow the service promotion chain
- return getPromotedComponentService((CompositeService)service);
-
- } else {
-
- // Found a non-composite service
- return componentService;
- }
- } else {
-
- // No promoted service
- return null;
- }
- }
-
- /**
- * Follow a service promotion chain down to the innermost (non-composite) component.
- *
- * @param compositeService
- * @return
- */
- static Component getPromotedComponent(CompositeService compositeService) {
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- Service service = componentService.getService();
- if (componentService.getName() != null && service instanceof CompositeService) {
-
- // Continue to follow the service promotion chain
- return getPromotedComponent((CompositeService)service);
-
- } else {
-
- // Found a non-composite service
- return compositeService.getPromotedComponent();
- }
- } else {
-
- // No promoted service
- return null;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractPropertyImpl.java
deleted file mode 100644
index b7c63dc2b4..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class AbstractPropertyImpl extends ExtensibleImpl implements AbstractProperty {
- private Object value;
- private String name;
- private QName xsdType;
- private QName xsdElement;
- private boolean many;
- private boolean mustSupply;
- private List<Intent> requiredIntents = new ArrayList<Intent>();
-
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- /**
- * Constructs a new abstract property.
- */
- protected AbstractPropertyImpl() {
- }
-
- public Object getValue() {
- return value;
- }
-
- public String getName() {
- return name;
- }
-
- public QName getXSDElement() {
- return xsdElement;
- }
-
- public QName getXSDType() {
- return xsdType;
- }
-
- public boolean isMany() {
- return many;
- }
-
- public boolean isMustSupply() {
- return mustSupply;
- }
-
- public void setValue(Object defaultValue) {
- this.value = defaultValue;
- }
-
- public void setMany(boolean many) {
- this.many = many;
- }
-
- public void setMustSupply(boolean mustSupply) {
- this.mustSupply = mustSupply;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setXSDElement(QName element) {
- this.xsdElement = element;
- }
-
- public void setXSDType(QName type) {
- this.xsdType = type;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractReferenceImpl.java
deleted file mode 100644
index d0ee3832c5..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class AbstractReferenceImpl extends ContractImpl implements AbstractReference {
- private Multiplicity multiplicity = Multiplicity.ONE_ONE;
-
- /**
- * Constructs a new abstract reference.
- */
- protected AbstractReferenceImpl() {
- }
-
- public Multiplicity getMultiplicity() {
- return multiplicity;
- }
-
- public void setMultiplicity(Multiplicity multiplicity) {
- this.multiplicity = multiplicity;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AbstractServiceImpl.java
deleted file mode 100644
index 346764b1b4..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class AbstractServiceImpl extends ContractImpl implements AbstractService {
-
- /**
- * Constructs a new abstract service.
- */
- protected AbstractServiceImpl() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
deleted file mode 100644
index 016a9a5b05..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public abstract class AssemblyFactoryImpl implements AssemblyFactory {
-
- public AbstractProperty createAbstractProperty() {
- return new AbstractPropertyImpl();
- }
-
- public AbstractReference createAbstractReference() {
- return new AbstractReferenceImpl();
- }
-
- public AbstractService createAbstractService() {
- return new AbstractServiceImpl();
- }
-
- public Callback createCallback() {
- return new CallbackImpl();
- }
-
- public Component createComponent() {
- return new ComponentImpl();
- }
-
- public ComponentProperty createComponentProperty() {
- return new ComponentPropertyImpl();
- }
-
- public ComponentReference createComponentReference() {
- return new ComponentReferenceImpl();
- }
-
- public ComponentService createComponentService() {
- return new ComponentServiceImpl();
- }
-
- public ComponentType createComponentType() {
- return new ComponentTypeImpl();
- }
-
- public Composite createComposite() {
- return new CompositeImpl();
- }
-
- public CompositeReference createCompositeReference() {
- return new CompositeReferenceImpl();
- }
-
- public CompositeService createCompositeService() {
- return new CompositeServiceImpl();
- }
-
- public ConstrainingType createConstrainingType() {
- return new ConstrainingTypeImpl();
- }
-
- public Property createProperty() {
- return new PropertyImpl();
- }
-
- public Reference createReference() {
- return new ReferenceImpl();
- }
-
- public Service createService() {
- return new ServiceImpl();
- }
-
- public Wire createWire() {
- return new WireImpl();
- }
-
- public ConfiguredOperation createConfiguredOperation() {
- return new ConfiguredOperationImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/BaseImpl.java
deleted file mode 100644
index 553e600bc9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public abstract class BaseImpl implements Base {
- private boolean unresolved;
-
- /**
- * Constructs a new base model object.
- */
- protected BaseImpl() {
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CallbackImpl.java
deleted file mode 100644
index 4082d81fdb..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class CallbackImpl extends ExtensibleImpl implements Callback {
- private List<Binding> bindings = new ArrayList<Binding>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- protected CallbackImpl() {
- }
-
- public List<Binding> getBindings() {
- return bindings;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
deleted file mode 100644
index 34429a6703..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ComponentImpl extends ExtensibleImpl implements Component, Cloneable, OperationsConfigurator {
- private ConstrainingType constrainingType;
- private Implementation implementation;
- private String name;
- private String uri;
- private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
- private List<ComponentReference> references = new ArrayList<ComponentReference>();
- private List<ComponentService> services = new ArrayList<ComponentService>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private Boolean autowire;
- private IntentAttachPointType type;
- private List<ConfiguredOperation> configuredImplOperations = new ArrayList<ConfiguredOperation>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- /**
- * Constructs a new component.
- */
- protected ComponentImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- ComponentImpl clone = (ComponentImpl)super.clone();
-
- clone.properties = new ArrayList<ComponentProperty>();
- for (ComponentProperty property : getProperties()) {
- clone.properties.add((ComponentProperty)property.clone());
- }
- clone.references = new ArrayList<ComponentReference>();
- for (ComponentReference reference : getReferences()) {
- clone.references.add((ComponentReference)reference.clone());
- }
- clone.services = new ArrayList<ComponentService>();
- for (ComponentService service : getServices()) {
- clone.services.add((ComponentService)service.clone());
- }
- return clone;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ConstrainingType getConstrainingType() {
- return constrainingType;
- }
-
- public Implementation getImplementation() {
- return implementation;
- }
-
- public String getName() {
- return name;
- }
-
- public List<ComponentProperty> getProperties() {
- return properties;
- }
-
- public List<ComponentReference> getReferences() {
- return references;
- }
-
- public List<ComponentService> getServices() {
- return services;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- this.constrainingType = constrainingType;
- }
-
- public void setImplementation(Implementation implementation) {
- this.implementation = implementation;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public boolean isAutowire() {
- return (autowire == null) ? false : autowire.booleanValue();
- }
-
- public void setAutowire(Boolean autowire) {
- this.autowire = autowire;
- }
-
- public Boolean getAutowire() {
- return autowire;
- }
-
- public IntentAttachPointType getType() {
- return type;
- }
-
- public void setType(IntentAttachPointType type) {
- this.type = type;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
-
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
-
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredImplOperations;
- }
-
- public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- this.configuredImplOperations = configuredOperations;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentPropertyImpl.java
deleted file mode 100644
index e2e7b59896..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ComponentPropertyImpl extends PropertyImpl implements ComponentProperty, Cloneable {
- private String file;
- private Property property;
- private String source;
- private XPathExpression sourceXPathExpression;
-
- /**
- * Constructs a new component property.
- */
- protected ComponentPropertyImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- // FIXME getValue should not delegate to property.getValue()
- // Doing this violates the setValue/getValue semantics, as you
- // can call setValue() then get a different value from getValue()
- @Override
- public Object getValue() {
- if (super.getValue() == null && property != null) {
- return property.getValue();
- } else {
- return super.getValue();
- }
- }
-
- public String getFile() {
- return file;
- }
-
- public Property getProperty() {
- return property;
- }
-
- public String getSource() {
- return source;
- }
-
- public void setFile(String file) {
- this.file = file;
- }
-
- public void setProperty(Property property) {
- this.property = property;
- }
-
- public void setSource(String source) {
- this.source = source;
- }
-
- public XPathExpression getSourceXPathExpression() {
- return sourceXPathExpression;
- }
-
- public void setSourceXPathExpression(XPathExpression sourceXPathExpression) {
- this.sourceXPathExpression = sourceXPathExpression;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
deleted file mode 100644
index 488023090c..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentReferenceImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * Represents a component reference
- *
- * @version $Rev$ $Date$
- */
-public class ComponentReferenceImpl extends ReferenceImpl implements ComponentReference, Cloneable {
- private Reference reference;
- private Boolean autowire;
- private List<CompositeReference> promotedAs = new ArrayList<CompositeReference>();
- private ComponentService callbackService;
- private List<Endpoint> endpoints = new ArrayList<Endpoint>();
-
- /**
- * Constructs a new component reference.
- */
- protected ComponentReferenceImpl() {
- // Set multiplicity to null so that by default it'll inherit from the Reference
- setMultiplicity(null);
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public Reference getReference() {
- return reference;
- }
-
- public void setReference(Reference reference) {
- this.reference = reference;
- }
-
- public boolean isAutowire() {
- return (autowire == null) ? false : autowire.booleanValue();
- }
-
- public void setAutowire(Boolean autowire) {
- this.autowire = autowire;
- }
-
- public Boolean getAutowire() {
- return autowire;
- }
-
- public List<CompositeReference> promotedAs() {
- return promotedAs;
- }
-
- public ComponentService getCallbackService() {
- return callbackService;
- }
-
- public void setCallbackService(ComponentService callbackService) {
- this.callbackService = callbackService;
- }
-
- public List<Endpoint> getEndpoints(){
- return endpoints;
- }
-
- /**
- * Use endpoint information to work out what the interface contract for the
- * binding is.
- */
- @Override
- public InterfaceContract getInterfaceContract(Binding binding){
- InterfaceContract interfaceContract = null;
-
- for (Endpoint theEndpoint : endpoints){
- if (theEndpoint.getSourceBinding() == binding){
- interfaceContract = theEndpoint.getInterfaceContract();
- }
- }
-
- if (interfaceContract == null){
- interfaceContract = getInterfaceContract();
- }
- return interfaceContract;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentServiceImpl.java
deleted file mode 100644
index 0c78a2505f..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ComponentServiceImpl extends ServiceImpl implements ComponentService, Cloneable {
- private Service service;
- private List<CompositeService> promotedAs = new ArrayList<CompositeService>();
- private ComponentReference callbackReference;
-
- /**
- * Constructs a new component service.
- */
- protected ComponentServiceImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public Service getService() {
- return service;
- }
-
- public void setService(Service service) {
- this.service = service;
- }
-
- public List<CompositeService> promotedAs() {
- return promotedAs;
- }
-
- public ComponentReference getCallbackReference() {
- return callbackReference;
- }
-
- public void setCallbackReference(ComponentReference callbackReference) {
- this.callbackReference = callbackReference;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
deleted file mode 100644
index bbe665d52f..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ComponentTypeImpl extends ExtensibleImpl implements ComponentType, Cloneable {
- private String uri;
- private ConstrainingType constrainingType;
- private List<Property> properties = new ArrayList<Property>();
- private List<Reference> references = new ArrayList<Reference>();
- private List<Service> services = new ArrayList<Service>();
- /**
- * Constructs a new component type.
- */
- protected ComponentTypeImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- ComponentTypeImpl clone = (ComponentTypeImpl)super.clone();
-
- clone.services = new ArrayList<Service>();
- for (Service service : getServices()) {
- clone.services.add((Service)service.clone());
- }
- clone.references = new ArrayList<Reference>();
- for (Reference reference : getReferences()) {
- clone.references.add((Reference)reference.clone());
- }
- clone.properties = new ArrayList<Property>();
- for (Property property : getProperties()) {
- clone.properties.add((Property)property.clone());
- }
- return clone;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ConstrainingType getConstrainingType() {
- return constrainingType;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public List<Reference> getReferences() {
- return references;
- }
-
- public List<Service> getServices() {
- return services;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- this.constrainingType = constrainingType;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getURI()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof ComponentType) {
- if (getURI() != null) {
- return getURI().equals(((ComponentType)obj).getURI());
- } else {
- return ((ComponentType)obj).getURI() == null;
- }
- } else {
- return false;
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
deleted file mode 100644
index 9dd26b5e8e..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.Wire;
-
-/**
- * Implementation of a Composite.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeImpl extends ImplementationImpl implements Composite, Cloneable {
- private List<Component> components = new ArrayList<Component>();
- private List<Composite> includes = new ArrayList<Composite>();
- private QName name;
- private List<Wire> wires = new ArrayList<Wire>();
- private Boolean autowire;
- private boolean local = true;
-
- /**
- * Constructs a new composite.
- */
- protected CompositeImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- CompositeImpl clone = (CompositeImpl)super.clone();
-
- clone.components = new ArrayList<Component>();
- for (Component component : getComponents()) {
- Component clonedComponent = (Component)component.clone();
- for (Service service : clone.getServices()) {
- CompositeService compositeService = (CompositeService)service;
- // Force the promoted component/service to be rebuilt against the clone
- if (compositeService.getPromotedComponent() != null) {
- compositeService.getPromotedComponent().setUnresolved(true);
- }
- if (compositeService.getPromotedService() != null) {
- compositeService.getPromotedService().setUnresolved(true);
- }
- }
- for (Reference reference : clone.getReferences()) {
- CompositeReference compositeReference = (CompositeReference)reference;
- for (ComponentReference ref : compositeReference.getPromotedReferences()) {
- // Force the promoted reference to be rebuilt against the clone
- ref.setUnresolved(true);
- }
- }
-
- clone.components.add(clonedComponent);
- }
- clone.wires = new ArrayList<Wire>();
- for (Wire wire : getWires()) {
- clone.wires.add((Wire)wire.clone());
- }
- return clone;
- }
-
- public List<Component> getComponents() {
- return components;
- }
-
- public List<Composite> getIncludes() {
- return includes;
- }
-
- public QName getName() {
- return name;
- }
-
- public List<Wire> getWires() {
- return wires;
- }
-
- public boolean isLocal() {
- return local;
- }
-
- public void setLocal(boolean local) {
- this.local = local;
- }
-
- public boolean isAutowire() {
- return (autowire == null) ? false : autowire.booleanValue();
- }
-
- public void setAutowire(Boolean autowire) {
- this.autowire = autowire;
- }
-
- public Boolean getAutowire() {
- return autowire;
- }
-
- public void setName(QName name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof Composite) {
- if (getName() != null) {
- return getName().equals(((Composite)obj).getName());
- } else {
- return ((Composite)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-
- @Override
- public String toString(){
- return ( this.name != null ) ? getName().toString() : "null";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
deleted file mode 100644
index bebc9e3619..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.CompositeReference;
-
-/**
- * Represents a composite reference.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeReferenceImpl extends ReferenceImpl implements CompositeReference, Cloneable {
- private List<ComponentReference> promotedReferences = new ArrayList<ComponentReference>();
-
- /**
- * Constructs a new composite reference.
- */
- protected CompositeReferenceImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- CompositeReferenceImpl copy = (CompositeReferenceImpl)super.clone();
- copy.promotedReferences = new ArrayList<ComponentReference>(promotedReferences);
- return copy;
- }
-
- public List<ComponentReference> getPromotedReferences() {
- return promotedReferences;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeServiceImpl.java
deleted file mode 100644
index 6777a96982..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class CompositeServiceImpl extends ServiceImpl implements CompositeService, Cloneable {
- private ComponentService promotedService;
- private Component promotedComponent;
-
- /**
- * Constructs a new composite service.
- */
- protected CompositeServiceImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public ComponentService getPromotedService() {
- return promotedService;
- }
-
- public void setPromotedService(ComponentService promotedService) {
- this.promotedService = promotedService;
- }
-
- public Component getPromotedComponent() {
- return promotedComponent;
- }
-
- public void setPromotedComponent(Component promotedComponent) {
- this.promotedComponent = promotedComponent;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
deleted file mode 100644
index ca88e39750..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConfiguredOperationImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents an Operation.
- *
- * @version $Rev$ $Date$
- */
-public class ConfiguredOperationImpl extends BaseImpl implements ConfiguredOperation {
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- private String name;
- private String contractName;
-
- /**
- * Constructs a new Operation.
- */
- protected ConfiguredOperationImpl() {
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public String getContractName() {
- return contractName;
- }
-
- public void setContractName(String contractName) {
- this.contractName = contractName;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- // Note this is a shallow copy.
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ConstrainingTypeImpl.java
deleted file mode 100644
index d5701df74e..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class ConstrainingTypeImpl extends ExtensibleImpl implements ConstrainingType {
- private QName name;
- private List<AbstractProperty> properties = new ArrayList<AbstractProperty>();
- private List<AbstractReference> references = new ArrayList<AbstractReference>();
- private List<AbstractService> services = new ArrayList<AbstractService>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
-
- /**
- * Constructs a new ConstrainingType
- */
- protected ConstrainingTypeImpl() {
- }
-
- public QName getName() {
- return name;
- }
-
- public void setName(QName name) {
- this.name = name;
- }
-
- public List<AbstractProperty> getProperties() {
- return properties;
- }
-
- public List<AbstractReference> getReferences() {
- return references;
- }
-
- public List<AbstractService> getServices() {
- return services;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof ConstrainingType) {
- if (getName() != null) {
- return getName().equals(((ConstrainingType)obj).getName());
- } else {
- return ((ConstrainingType)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.java
deleted file mode 100644
index 491c835246..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ContractImpl.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.AbstractContract;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-
-/**
- * Implementation of a Contract.
- *
- * @version $Rev$ $Date$
- */
-public class ContractImpl extends ExtensibleImpl implements AbstractContract {
- private InterfaceContract interfaceContract;
- private String name;
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
-
- private boolean isCallback = false;
-
- /**
- * Constructs a new contract.
- */
- protected ContractImpl() {
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public InterfaceContract getInterfaceContract() {
- return interfaceContract;
- }
-
- public void setInterfaceContract(InterfaceContract interfaceContract) {
- this.interfaceContract = interfaceContract;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public boolean isCallback() {
- return isCallback;
- }
-
- public void setIsCallback(boolean isCallback) {
- this.isCallback = isCallback;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- this.configuredOperations = configuredOperations;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.java
deleted file mode 100644
index ece51cbe9b..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointFactoryImpl.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.impl;
-
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-
-/**
- * A factory for the Endpoint model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class EndpointFactoryImpl implements EndpointFactory {
-
- public EndpointFactoryImpl (){
-
- }
-
- public Endpoint createEndpoint() {
- return new EndpointImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
deleted file mode 100644
index 5748abb07d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointImpl.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * The assembly model object for an endpoint.
- *
- * @version $Rev$ $Date$
- */
-public class EndpointImpl implements Endpoint {
-
- private String targetName;
-
- private Component sourceComponent;
- private ComponentReference sourceComponentReference;
- private Binding resolvedBinding;
- private Binding resolvedCallbackBinding;
-
- private List<Binding> candidateBindings = new ArrayList<Binding>();
-
- private Component targetComponent;
- private ComponentService targetComponentService;
- private Binding targetBinding;
- private Binding targetCallbackBinding;
-
- private InterfaceContract interfaceContract;
-
- protected EndpointImpl() {
- }
-
- public boolean isUnresolved() {
- return resolvedBinding == null;
- }
-
- public void setUnresolved(boolean unresolved) {
- // do nothing as the status is determined by having
- // a resolved source binding
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public String getTargetName(){
- return targetName;
- }
-
- public void setTargetName(String targetName){
- this.targetName = targetName;
- }
-
- public Component getSourceComponent() {
- return sourceComponent;
- }
-
- public void setSourceComponent(Component sourceComponent) {
- this.sourceComponent = sourceComponent;
- }
-
- public ComponentReference getSourceComponentReference() {
- return sourceComponentReference;
- }
-
- public void setSourceComponentReference(ComponentReference sourceComponentReference) {
- this.sourceComponentReference = sourceComponentReference;
- }
-
- public Binding getSourceBinding() {
- return resolvedBinding;
- }
-
- public void setSourceBinding(Binding resolvedBinding) {
- this.resolvedBinding = resolvedBinding;
- }
-
- public Binding getSourceCallbackBinding(){
- return resolvedCallbackBinding;
- }
-
- public void setSourceCallbackBinding(Binding resolvedCallbackBinding){
- this.resolvedCallbackBinding = resolvedCallbackBinding;
- }
-
- public List<Binding> getCandidateBindings() {
- return candidateBindings;
- }
-
- public Component getTargetComponent() {
- return targetComponent;
- }
-
- public void setTargetComponent(Component targetComponent) {
- this.targetComponent = targetComponent;
- }
-
- public ComponentService getTargetComponentService() {
- return targetComponentService;
- }
-
- public void setTargetComponentService(ComponentService targetComponentService) {
- this.targetComponentService = targetComponentService;
- }
-
- public Binding getTargetBinding() {
- return targetBinding;
- }
-
- public void setTargetBinding(Binding targetBinding) {
- this.targetBinding = targetBinding;
- }
-
- public Binding getTargetCallbackBinding(){
- return targetCallbackBinding;
- }
-
- public void setTargetCallbackBinding(Binding targetCallbackBinding){
- this.targetCallbackBinding = targetCallbackBinding;
- }
-
- public InterfaceContract getInterfaceContract() {
- return interfaceContract;
- }
-
- public void setInterfaceContract(InterfaceContract interfaceContract) {
- this.interfaceContract = interfaceContract;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
deleted file mode 100644
index 0a2e25aa43..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensibleImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Extension;
-
-/**
- * Convenience base class for extensible assembly model objects.
- *
- * @version $Rev$ $Date$
- */
-public abstract class ExtensibleImpl extends BaseImpl implements Extensible {
- private List<Object> extensions = new ArrayList<Object>();
- private List<Extension> attributeExtensions = new ArrayList<Extension>();
-
- /**
- * Constructs a new base model object.
- */
- protected ExtensibleImpl() {
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public List<Extension> getAttributeExtensions() {
- return attributeExtensions;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.java
deleted file mode 100644
index 2753bcc091..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ExtensionImpl.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.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Extension;
-
-public class ExtensionImpl implements Extension {
- private QName qName;
- private Object value;
- boolean isAttribute = false;
-
- public ExtensionImpl() {
-
- }
-
- public ExtensionImpl(QName qName, Object value, boolean isAttribute) {
- this.qName = qName;
- this.value = value;
- this.isAttribute = isAttribute;
- }
-
- public QName getQName() {
- return qName;
- }
-
- public void setQName(QName qName) {
- this.qName = qName;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- public boolean isAttribute() {
- return isAttribute;
- }
-
- public void setIsAttribute(boolean isAttribute) {
- this.isAttribute = isAttribute;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
deleted file mode 100644
index aa75922489..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ImplementationImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Base implementation class of Implementation model interface
- *
- * @version $Rev$ $Date$
- */
-public abstract class ImplementationImpl extends ComponentTypeImpl implements Implementation, PolicySetAttachPoint,
- OperationsConfigurator {
-
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
- private IntentAttachPointType type;
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
-
- protected ImplementationImpl() {
- super();
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return type;
- }
-
- public void setType(IntentAttachPointType type) {
- this.type = type;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/PropertyImpl.java
deleted file mode 100644
index 0c1051199f..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class PropertyImpl extends AbstractPropertyImpl implements Property, Cloneable {
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- /**
- * Constructs a new property.
- */
- protected PropertyImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
deleted file mode 100644
index 1800222bfb..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ReferenceImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.assembly.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a reference.
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceImpl extends AbstractReferenceImpl implements Reference, Cloneable {
- private List<Binding> bindings = new ArrayList<Binding>();
- private boolean wiredByImpl;
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<ComponentService> targets = new ArrayList<ComponentService>();
- private Callback callback;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private boolean promotionOverride;
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- /**
- * Constructs a new reference.
- */
- protected ReferenceImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- ReferenceImpl clone = (ReferenceImpl)super.clone();
- clone.bindings = new ArrayList<Binding>();
- clone.bindings.addAll(getBindings());
- clone.targets = new ArrayList<ComponentService>();
- clone.targets.addAll(getTargets());
- return clone;
- }
-
- public List<Binding> getBindings() {
- return bindings;
- }
-
- public <B> B getBinding(Class<B> bindingClass) {
- for (Binding binding : bindings) {
- if (bindingClass.isInstance(binding)) {
- return bindingClass.cast(binding);
- }
- }
- return null;
- }
-
- public <B> B getCallbackBinding(Class<B> bindingClass) {
- if (callback != null) {
- for (Binding binding : callback.getBindings()) {
- if (bindingClass.isInstance(binding)) {
- return bindingClass.cast(binding);
- }
- }
- }
- return null;
- }
-
- public boolean isWiredByImpl() {
- return wiredByImpl;
- }
-
- public void setWiredByImpl(boolean wiredByImpl) {
- this.wiredByImpl = wiredByImpl;
- }
-
- public boolean isPromotionOverride() {
- return promotionOverride;
- }
-
- public void setPromotionOverride(boolean promotionOverride) {
- this.promotionOverride = promotionOverride;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<ComponentService> getTargets() {
- return targets;
- }
-
- public Callback getCallback() {
- return callback;
- }
-
- public void setCallback(Callback callback) {
- this.callback = callback;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- /**
- * By default return the interface contract for the reference
- */
- public InterfaceContract getInterfaceContract(Binding binding){
- return getInterfaceContract();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.java
deleted file mode 100644
index 8d745cb7e1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ServiceImpl.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.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a reference.
- *
- * @version $Rev$ $Date$
- */
-public class ServiceImpl extends AbstractServiceImpl implements Service, Cloneable {
- private List<Binding> bindings = new ArrayList<Binding>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private Callback callback;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- /**
- * Constructs a new service.
- */
- protected ServiceImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- ServiceImpl clone = (ServiceImpl)super.clone();
- clone.bindings = new ArrayList<Binding>();
- clone.bindings.addAll(getBindings());
- return clone;
- }
-
- public List<Binding> getBindings() {
- return bindings;
- }
-
- public <B> B getBinding(Class<B> bindingClass) {
- for (Binding binding : bindings) {
- if (bindingClass.isInstance(binding)) {
- return bindingClass.cast(binding);
- }
- }
- return null;
- }
-
- public <B> B getCallbackBinding(Class<B> bindingClass) {
- if (callback != null) {
- for (Binding binding : callback.getBindings()) {
- if (bindingClass.isInstance(binding)) {
- return bindingClass.cast(binding);
- }
- }
- }
- return null;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public Callback getCallback() {
- return callback;
- }
-
- public void setCallback(Callback callback) {
- this.callback = callback;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- /**
- * By default return the interface contract for the service
- */
- public InterfaceContract getInterfaceContract(Binding binding){
- return getInterfaceContract();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java b/branches/sca-java-1.5.1/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/WireImpl.java
deleted file mode 100644
index 1a7abc8564..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class WireImpl extends ExtensibleImpl implements Wire, Cloneable {
- private ComponentReference source;
- private ComponentService target;
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- /**
- * Constructs a new wire.
- */
- protected WireImpl() {
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public ComponentReference getSource() {
- return source;
- }
-
- public ComponentService getTarget() {
- return target;
- }
-
- public void setSource(ComponentReference source) {
- this.source = source;
- }
-
- public void setTarget(ComponentService target) {
- this.target = target;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory b/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.AssemblyFactory
deleted file mode 100644
index 859c4bde4b..0000000000
--- a/branches/sca-java-1.5.1/modules/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-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory b/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory
deleted file mode 100644
index 8dbff76ad9..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EndpointFactory
+++ /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.DefaultEndpointFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory b/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory
deleted file mode 100644
index bea25da958..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.ExtensionFactory
+++ /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.DefaultExtensionFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages.properties b/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages.properties
deleted file mode 100644
index e827f7e78a..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages.properties
+++ /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.
-#
-#
-DuplicateComponentName = Duplicate component name: Composite = {0} Component = {1}
-DuplicateComponentServiceName = Duplicate component service name: Component = {0} Service = {1}
-DuplicateComponentReferenceName = Duplicate component reference name: Component = {0} Reference = {1}
-DuplicateComponentPropertyName = Duplicate component property name: Component = {0} Property = {1}
-NoComponentImplementation = No implementation for component: Component = {0}
-ServiceNotFoundForComponentService = Service not found for component service: Component = {0} Service = {1}
-UnresolvedComponentImplementation = Component implementation not found: Component = {0} Uri = {1}
-DuplicateImplementationPropertyName = Duplicate property name: Component = {0} Property = {1}
-DuplicateImplementationServiceName = Duplicate service name: Component = {0} Service = {1}
-DuplicateImplementationReferenceName = Duplicate reference name: Component = {0} Reference = {1}
-PropertyNotFound = Property not found for component property: Component = {0} Property = {1}
-PropertyMustSupplyIncompatible = Component property mustSupply attribute incompatible with property: Component = {0} Property = {1}
-PropertyMustSupplyNull = No value configured on a mustSupply property: Component = {0} Property = {1}
-PropertyOverrideManyAttribute = Component property many attribute incompatible with property: Component = {0} Property = {1}
-ReferenceNotFound = Reference not found for component reference: Component = {0} Reference = {1}
-ReferenceIncompatibleMultiplicity = Component reference multiplicity incompatible with reference multiplicity: Component = {0} Reference = {1}
-ReferenceIncompatibleInterface = Incompatible interfaces on component reference and target: Composite = {0} Reference = {1} Service = {2}
-ReferenceIncompatibleComponentInterface = Component reference interface incompatible with reference interface: Component = {0} Reference = {1}
-ServiceIncompatibleComponentInterface = Component service interface incompatible with service interface: Component = {0} Service = {1}
-MultipleBindingsForService = Multiple bindings with the same name for a service: Service = {0} Binding name = {1}
-MultipleBindingsForReference = Multiple bindings with the same name for a reference: Reference = {0} Binding name = {1}
-ReferenceWithoutTargets = No targets for reference: Composite = {0} Reference = {1}
-PromotedReferenceNotFound = Promoted component reference not found: Composite = {0} Reference = {1}
-PromotedServiceNotFound = Promoted component service not found: Composite = {0} Service = {1}
-ComponentReferenceTargetNotFound = Component reference target not found, it might be a remote service running elsewhere in the SCA Domain: Composite = {0} Service = {1}
-NoSCABindingAvailableForUnresolvedService = A local service cannot be found for reference {0} target {1} and there is no SCA binding available to represent the unresolved target
-NoMatchingBinding = Component reference {0} does not have a binding which matches the bindings of service {1}
-NoMatchingCallbackBinding = Component reference {0} does not have a callback binding which matches the callback bindings of service {1}
-ReferenceEndPointMixWithTarget = Reference {0} must not specify endpoints using both target attribute and with binding uri attribute
-PolicyRelatedException = Policy Related Exception occured due to : {0}
-CompositeAlreadyIncluded = Composite {0} has already been included.
-ComponentReferenceMoreWire = Component reference {0} has more than one wires
-WireTargetNotFound = Wire target not found : {0}
-WireSourceNotFound = Wire source not found : {0}
-WireIncompatibleInterface = Incompatible interfaces on wire source and target : source = {0} target = {1}
-ComponentIncompatibleInterface = Incompatible interfaces on component reference and target : reference = {0} target = {1}
-TooManyReferenceTargets = Too many targets on reference: {0}
-ReferenceInterfaceNotSubSet = Interface of composite reference must be compatible with the interface declared by promoted component reference {0}
-ServiceInterfaceNotSubSet = Interface of composite service must be a subset of the interface declared by promoted component service {0}
-NoComponentReferenceTarget = No target services found for the component reference to be autowired: {0}
-NoTypeForComponentProperty = No type specified on component property: Component = {0} Property = {1}
-URLSyntaxException = URLSyntaxException when creating binding URI at component = {0} service = {1} binding = {2} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages_it.properties b/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages_it.properties
deleted file mode 100644
index b94d37ba2d..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/main/resources/assembly-validation-messages_it.properties
+++ /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.
-#
-#
-DuplicateComponentName = Nome del componente duplicato: Composite = {0} Component = {1}
-DuplicateComponentServiceName = Nome del servizio del componente duplicato: Component = {0} Service = {1}
-DuplicateComponentReferenceName = Nome del reference del componente duplicato: Component = {0} Reference = {1}
-DuplicateComponentPropertyName = Nome della property del componente duplicato: Component = {0} Property = {1}
-NoComponentImplementation = Implementazione insistente per il componente: Component = {0}
-ServiceNotFoundForComponentService = Servizio non trovato per il componente: Component = {0} Service = {1}
-UnresolvedComponentImplementation = Implementazione del componente non trovata: Component = {0} Uri = {1}
-DuplicateImplementationPropertyName = Nome della property del componente duplicata: Component = {0} Property = {1}
-DuplicateImplementationReferenceName = Nome del riferimento duplicato: Component = {0} Reference = {1}
-PropertyNotFound = Property non trovata per il componente: Component = {0} Property = {1}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
deleted file mode 100644
index 8a3a89aba4..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.assembly;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-
-/**
- * Test building of assembly model instances using the assembly factory.
- *
- * @version $Rev$ $Date$
- */
-public class AssemblyFactoryTestCase extends TestCase {
-
- private AssemblyFactory assemblyFactory;
-
- @Override
- public void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- }
-
- public void testCreateComponent() {
- createComponent("AccountServiceComponent1");
- }
-
- public void testCreateComponentType() {
- createComponentType();
- }
-
- public void testCreateComposite() {
- createComposite();
- }
-
- public void testCreateConstrainingType() {
- createConstrainingType();
- }
-
- /**
- * Create a composite
- */
- Composite createComposite() {
- Composite c = assemblyFactory.createComposite();
-
- Component c1 = createComponent("AccountServiceComponent1");
- c.getComponents().add(c1);
- Component c2 = createComponent("AccountServiceComponent2");
- c.getComponents().add(c2);
-
- Wire w = assemblyFactory.createWire();
- w.setSource(c1.getReferences().get(0));
- w.setTarget(c2.getServices().get(0));
- c.getWires().add(w);
-
- CompositeService cs = assemblyFactory.createCompositeService();
- cs.setName("AccountService");
- cs.setPromotedService(c1.getServices().get(0));
- cs.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- c.getServices().add(cs);
- cs.getBindings().add(new TestBinding(assemblyFactory));
-
- CompositeReference cr = assemblyFactory.createCompositeReference();
- cr.setName("StockQuoteService");
- cr.getPromotedReferences().add(c2.getReferences().get(1));
- cr.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- c.getReferences().add(cr);
- cr.getBindings().add(new TestBinding(assemblyFactory));
-
- return c;
- }
-
- /**
- * Create a new component
- */
- Component createComponent(String name) {
- Component c = assemblyFactory.createComponent();
- c.setName(name);
-
- ConstrainingType constraint = createConstrainingType();
- c.setConstrainingType(constraint);
-
- Implementation i = new TestImplementation(assemblyFactory);
- c.setImplementation(i);
-
- ComponentProperty p = assemblyFactory.createComponentProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- p.setProperty(i.getProperties().get(0));
- c.getProperties().add(p);
-
- ComponentReference ref1 = assemblyFactory.createComponentReference();
- ref1.setName("accountDataService");
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref1.setReference(i.getReferences().get(0));
- c.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(assemblyFactory));
-
- ComponentReference ref2 = assemblyFactory.createComponentReference();
- ref2.setName("stockQuoteService");
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref2.setReference(i.getReferences().get(1));
- c.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(assemblyFactory));
-
- ComponentService s = assemblyFactory.createComponentService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- s.setService(i.getServices().get(0));
- c.getServices().add(s);
- s.getBindings().add(new TestBinding(assemblyFactory));
-
- return c;
- }
-
- /**
- * Create a new component type
- *
- * @return
- */
- ComponentType createComponentType() {
- ComponentType ctype = assemblyFactory.createComponentType();
-
- Property p = assemblyFactory.createProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- Reference ref1 = assemblyFactory.createReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(assemblyFactory));
-
- Reference ref2 = assemblyFactory.createReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(assemblyFactory));
-
- Service s = assemblyFactory.createService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ctype.getServices().add(s);
- s.getBindings().add(new TestBinding(assemblyFactory));
-
- return ctype;
- }
-
- /**
- * Create a new constraining type
- *
- * @return
- */
- ConstrainingType createConstrainingType() {
- ConstrainingType ctype = assemblyFactory.createConstrainingType();
-
- AbstractProperty p = assemblyFactory.createAbstractProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- AbstractReference ref1 = assemblyFactory.createAbstractReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
-
- AbstractReference ref2 = assemblyFactory.createAbstractReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
-
- AbstractService s = assemblyFactory.createAbstractService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(assemblyFactory));
- ctype.getServices().add(s);
-
- return ctype;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java
deleted file mode 100644
index 5e0a2335d1..0000000000
--- a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.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;
-
-
-/**
- * A test interface model.
- *
- * @version $Rev$ $Date$
- */
-public class TestBinding implements Binding {
- public TestBinding(AssemblyFactory factory) {
- }
-
- public String getName() {
- return null;
- }
-
- public String getURI() {
- return "http://test";
- }
-
- public void setName(String name) {
- }
-
- public void setURI(String uri) {
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java
deleted file mode 100644
index 19702954c9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class TestImplementation extends ImplementationImpl implements Implementation {
- public TestImplementation(AssemblyFactory factory) {
-
- Property p = factory.createProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- getProperties().add(p);
-
- Reference ref1 = factory.createReference();
- ref1.setName("accountDataService");
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(factory));
-
- Reference ref2 = factory.createReference();
- ref2.setName("stockQuoteService");
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(factory));
-
- Service s = factory.createService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- getServices().add(s);
- s.getBindings().add(new TestBinding(factory));
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java
deleted file mode 100644
index dbe0cb8225..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class TestInterface extends InterfaceImpl implements Interface {
-
- public TestInterface(AssemblyFactory factory) {
-
- setRemotable(true);
-
- Operation operation = new TestOperation();
- operation.setName("test");
- getOperations().add(operation);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java
deleted file mode 100644
index ee6b95edc9..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class TestInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
-
- public TestInterfaceContract(AssemblyFactory factory) {
-
- TestInterface testInterface = new TestInterface(factory);
- setInterface(testInterface);
-
- TestInterface testCallbackInterface = new TestInterface(factory);
- setCallbackInterface(testCallbackInterface);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java
deleted file mode 100644
index d94a7e93a3..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class TestOperation extends OperationImpl {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java
deleted file mode 100644
index fabafc998b..0000000000
--- a/branches/sca-java-1.5.1/modules/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;
-
-/**
- * Test the CompositeBuilder.
- *
- * @version $Rev$ $Date$
- */
-public class CompositeBuilderTestCase extends TestCase {
-
- private AssemblyFactory assemblyFactory;
-
- @Override
- protected void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- }
-
- public void testFuseIncludes() throws Exception {
- Composite c1 = assemblyFactory.createComposite();
- c1.setName(new QName("http://foo", "C1"));
- Component a = assemblyFactory.createComponent();
- a.setName("a");
- c1.getComponents().add(a);
- CompositeService s = assemblyFactory.createCompositeService();
- s.setName("s");
- c1.getServices().add(s);
- CompositeReference r = assemblyFactory.createCompositeReference();
- r.setName("r");
- c1.getReferences().add(r);
-
- Composite c2 = assemblyFactory.createComposite();
- c2.setName(new QName("http://foo", "C2"));
- c1.getIncludes().add(c2);
- Component b = assemblyFactory.createComponent();
- b.setName("b");
- c2.getComponents().add(b);
-
- Composite c = assemblyFactory.createComposite();
- c.setName(new QName("http://foo", "C"));
- c.getIncludes().add(c1);
-
- new CompositeIncludeBuilderImpl(null).build(c);
-
- assertTrue(c.getComponents().get(0).getName().equals("a"));
- assertTrue(c.getComponents().get(1).getName().equals("b"));
- assertTrue(c.getServices().get(0).getName().equals("s"));
- assertTrue(c.getReferences().get(0).getName().equals("r"));
- }
-
- public void testExpandComposites() throws Exception {
- Composite c1 = assemblyFactory.createComposite();
- c1.setName(new QName("http://foo", "C1"));
- Component a = assemblyFactory.createComponent();
- a.setName("a");
- c1.getComponents().add(a);
- CompositeService s = assemblyFactory.createCompositeService();
- s.setName("s");
- c1.getServices().add(s);
- CompositeReference r = assemblyFactory.createCompositeReference();
- r.setName("r");
- c1.getReferences().add(r);
-
- Composite c2 = assemblyFactory.createComposite();
- c2.setName(new QName("http://foo", "C2"));
- Component b = assemblyFactory.createComponent();
- b.setName("b");
- c2.getComponents().add(b);
-
- Composite c = assemblyFactory.createComposite();
- c.setName(new QName("http://foo", "C"));
- Component x = assemblyFactory.createComponent();
- x.setName("x");
- x.setImplementation(c1);
- c.getComponents().add(x);
- Component y = assemblyFactory.createComponent();
- y.setName("y");
- y.setImplementation(c2);
- c.getComponents().add(y);
- Component z = assemblyFactory.createComponent();
- z.setName("z");
- z.setImplementation(c1);
- c.getComponents().add(z);
-
- new CompositeCloneBuilderImpl(null).build(c);
-
- assertTrue(c.getComponents().get(0).getImplementation() != c1);
- assertTrue(c.getComponents().get(1).getImplementation() != c2);
- assertTrue(c.getComponents().get(2).getImplementation() != c1);
-
- Composite i = (Composite)c.getComponents().get(0).getImplementation();
- assertTrue(i.getComponents().get(0) != a);
- assertTrue(i.getComponents().get(0).getName().equals("a"));
- assertTrue(i.getServices().get(0).getName().equals("s"));
- assertTrue(i.getServices().get(0) != s);
- assertTrue(i.getReferences().get(0).getName().equals("r"));
- assertTrue(i.getReferences().get(0) != r);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/branches/sca-java-1.5.1/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java
deleted file mode 100644
index 82b1fd8665..0000000000
--- a/branches/sca-java-1.5.1/modules/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$ $Date$
- */
-public class PrintUtilTestCase {
-
- private AssemblyFactory factory = new DefaultAssemblyFactory();
-
- /**
- * Create a composite
- */
- Composite createComposite() {
- Composite c = factory.createComposite();
-
- Component c1 = createComponent("AccountServiceComponent1");
- c.getComponents().add(c1);
- Component c2 = createComponent("AccountServiceComponent2");
- c.getComponents().add(c2);
-
- Wire w = factory.createWire();
- w.setSource(c1.getReferences().get(0));
- w.setTarget(c2.getServices().get(0));
- c.getWires().add(w);
-
- CompositeService cs = factory.createCompositeService();
- cs.setName("AccountService");
- cs.setPromotedService(c1.getServices().get(0));
- cs.setInterfaceContract(new TestInterfaceContract(factory));
- c.getServices().add(cs);
- cs.getBindings().add(new TestBinding(factory));
-
- CompositeReference cr = factory.createCompositeReference();
- cr.setName("StockQuoteService");
- cr.getPromotedReferences().add(c2.getReferences().get(1));
- cr.setInterfaceContract(new TestInterfaceContract(factory));
- c.getReferences().add(cr);
- cr.getBindings().add(new TestBinding(factory));
-
- return c;
- }
-
- /**
- * Create a new component
- */
- Component createComponent(String name) {
- Component c = factory.createComponent();
- c.setName(name);
-
- ConstrainingType constraint = createConstrainingType();
- c.setConstrainingType(constraint);
-
- Implementation i = new TestImplementation(factory);
- c.setImplementation(i);
-
- ComponentProperty p = factory.createComponentProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- p.setProperty(i.getProperties().get(0));
- c.getProperties().add(p);
-
- ComponentReference ref1 = factory.createComponentReference();
- ref1.setName("accountDataService");
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setReference(i.getReferences().get(0));
- c.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(factory));
-
- ComponentReference ref2 = factory.createComponentReference();
- ref2.setName("stockQuoteService");
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setReference(i.getReferences().get(1));
- c.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(factory));
-
- ComponentService s = factory.createComponentService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- s.setService(i.getServices().get(0));
- c.getServices().add(s);
- s.getBindings().add(new TestBinding(factory));
-
- return c;
- }
-
- /**
- * Create a new component type
- *
- * @return
- */
- ComponentType createComponentType() {
- ComponentType ctype = factory.createComponentType();
-
- Property p = factory.createProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- Reference ref1 = factory.createReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
- ref1.getBindings().add(new TestBinding(factory));
-
- Reference ref2 = factory.createReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
- ref2.getBindings().add(new TestBinding(factory));
-
- Service s = factory.createService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- ctype.getServices().add(s);
- s.getBindings().add(new TestBinding(factory));
-
- return ctype;
- }
-
- /**
- * Create a new constraining type
- *
- * @return
- */
- ConstrainingType createConstrainingType() {
- ConstrainingType ctype = factory.createConstrainingType();
-
- AbstractProperty p = factory.createAbstractProperty();
- p.setName("currency");
- p.setValue("USD");
- p.setMustSupply(true);
- p.setXSDType(new QName("", ""));
- ctype.getProperties().add(p);
-
- AbstractReference ref1 = factory.createAbstractReference();
- ref1.setName("accountDataService");
- ref1.setInterfaceContract(new TestInterfaceContract(factory));
- ref1.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref1);
-
- AbstractReference ref2 = factory.createAbstractReference();
- ref2.setName("stockQuoteService");
- ref2.setInterfaceContract(new TestInterfaceContract(factory));
- ref2.setMultiplicity(Multiplicity.ONE_ONE);
- ctype.getReferences().add(ref2);
-
- AbstractService s = factory.createAbstractService();
- s.setName("AccountService");
- s.setInterfaceContract(new TestInterfaceContract(factory));
- ctype.getServices().add(s);
-
- return ctype;
- }
-
- @Test
- public void testPrint1() {
- Composite composite = createComposite();
- StringWriter sw = new StringWriter();
- PrintUtil p = new PrintUtil(new PrintWriter(sw), true);
- p.print(composite);
- // System.out.println(sw.toString());
- }
-
- @Test
- public void testPrint2() {
- Composite composite = createComposite();
- StringWriter sw = new StringWriter();
- PrintUtil p = new PrintUtil(new PrintWriter(sw), false);
- p.print(composite);
- // System.out.println(sw.toString());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/LICENSE b/branches/sca-java-1.5.1/modules/binding-atom-abdera/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/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-java-1.5.1/modules/binding-atom-abdera/NOTICE b/branches/sca-java-1.5.1/modules/binding-atom-abdera/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/pom.xml b/branches/sca-java-1.5.1/modules/binding-atom-abdera/pom.xml
deleted file mode 100644
index e0fee17a8b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/pom.xml
+++ /dev/null
@@ -1,233 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-atom-abdera</artifactId>
- <name>Apache Tuscany SCA Abdera Atom Feed Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-core</artifactId>
- <version>0.4.0-incubating</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-activation_1.0.2_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-parser</artifactId>
- <version>0.4.0-incubating</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-client</artifactId>
- <version>0.4.0-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-extensions-main</artifactId>
- <version>0.4.0-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-extensions-json</artifactId>
- <version>0.4.0-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom.abdera</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.java
deleted file mode 100644
index 7356cd0d2a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/Collection.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.binding.atom.collection;
-
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of resources using Atom.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Collection {
-
- /**
- * Get an Atom feed for a collection of resources.
- *
- * @return the Atom feed
- */
- Feed getFeed();
-
- /**
- * Get an Atom feed for a collection of resources resulting
- * from a query.
- *
- * @param queryString a query string
- * @return the Atom feed
- */
- Feed query(String queryString);
-
- /**
- * Creates a new entry.
- *
- * @param entry
- * @return
- */
- Entry post(Entry entry);
-
- /**
- * Retrieves an entry.
- *
- * @param id
- * @return
- */
- Entry get(String id) throws NotFoundException;
-
- /**
- * Update an entry.
- *
- * @param id
- * @param entry
- * @return
- */
- void put(String id, Entry entry) throws NotFoundException;
-
- /**
- * Delete an entry.
- *
- * @param id
- */
- void delete(String id) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.java
deleted file mode 100644
index cc351442e7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/MediaCollection.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.binding.atom.collection;
-
-import java.io.InputStream;
-
-import org.osoa.sca.annotations.Remotable;
-
-import org.apache.abdera.model.Entry;
-
-/**
- * Provides access to a collection of resources using Atom.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface MediaCollection extends Collection {
-
- /**
- * Creates a new media entry
- *
- * @param title
- * @param slug
- * @param contentType
- * @param media
- */
- Entry postMedia(String title, String slug, String contentType, InputStream media);
-
- /**
- * Update a media entry.
- *
- * @param id
- * @param contentType
- * @param media
- * @return
- */
- void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.java
deleted file mode 100644
index b457840922..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/collection/NotFoundException.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.binding.atom.collection;
-
-/**
- * Indicates that a resource could not be found.
- *
- * @version $Rev$ $Date$
- */
-public class NotFoundException extends Exception {
- private static final long serialVersionUID = -5046027674128627383L;
-
- public NotFoundException() {
- }
-
- public NotFoundException(String message) {
- super(message);
- }
-
- public NotFoundException(Throwable cause) {
- super(cause);
- }
-
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
deleted file mode 100644
index 91072067ea..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingInvoker.java
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom.provider;
-
-import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry;
-import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry;
-
-import java.io.InputStreamReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.parser.Parser;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.commons.httpclient.methods.StringRequestEntity;
-import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Invoker for the Atom binding.
- *
- * @version $Rev$ $Date$
- */
-class AtomBindingInvoker implements Invoker {
-
- private static final Factory abderaFactory = Abdera.getNewFactory();
- private static final Parser abderaParser = Abdera.getNewParser();
-
- Operation operation;
- String uri;
- HttpClient httpClient;
- String authorizationHeader;
- AtomReferenceBindingProvider provider;
-
- AtomBindingInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- this.operation = operation;
- this.uri = uri;
- this.httpClient = httpClient;
- this.authorizationHeader = authorizationHeader;
- this.provider = bindingProvider;
- }
-
- public Message invoke(Message msg) {
- // Shouldn't get here, as the only supported methods are
- // defined in the ResourceCollection interface, and implemented
- // by specific invoker subclasses
- throw new UnsupportedOperationException(operation.getName());
- }
-
- /**
- * Get operation invoker
- */
- public static class GetInvoker extends AtomBindingInvoker {
-
- public GetInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Get an entry
- String id = (String)((Object[])msg.getBody())[0];
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri + "/" + id);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
- boolean parsing = false;
- try {
- httpClient.executeMethod(getMethod);
- int status = getMethod.getStatusCode();
-
- // Read the Atom entry
- if (status == 200) {
- Document<org.apache.abdera.model.Entry> doc =
- abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
- parsing = true;
- org.apache.abdera.model.Entry feedEntry = doc.getRoot();
-
- if (provider.supportsFeedEntries()) {
-
- // Return the Atom entry
- msg.setBody(feedEntry);
-
- } else {
-
- // Convert the feed entry to a data entry and return the data item
- Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
- provider.getItemXMLType(), provider.getMediator());
- msg.setBody(entry.getData());
- }
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries())
- msg.setFaultBody(new NotFoundException());
- else
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- getMethod.releaseConnection();
- }
- }
-
- return msg;
- }
- }
-
- /**
- * Post operation invoker
- */
- public static class PostInvoker extends AtomBindingInvoker {
-
- public PostInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Post an entry
- Object[] args = (Object[])msg.getBody();
- org.apache.abdera.model.Entry feedEntry;
- if (provider.supportsFeedEntries()) {
-
- // Expect an Atom entry
- feedEntry = (org.apache.abdera.model.Entry)args[0];
- } else {
-
- // Expect a key and data item
- Entry<Object, Object> entry = new Entry<Object, Object>(args[0], args[1]);
- feedEntry = feedEntry(entry, provider.getItemClassType(),
- provider.getItemXMLType(), provider.getMediator(), abderaFactory);
- }
-
- // Send an HTTP POST
- PostMethod postMethod = new PostMethod(uri);
- postMethod.setRequestHeader("Authorization", authorizationHeader);
- boolean parsing = false;
- try {
-
- // Write the Atom entry
- StringWriter writer = new StringWriter();
- feedEntry.writeTo(writer);
- // postMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
- postMethod.setRequestHeader("Content-type", "application/atom+xml;type=entry");
- postMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
-
- httpClient.executeMethod(postMethod);
- int status = postMethod.getStatusCode();
-
- // Read the Atom entry
- if (status == 200 || status == 201) {
- Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(new InputStreamReader(postMethod.getResponseBodyAsStream()));
- parsing = true;
- org.apache.abdera.model.Entry createdEntry = doc.getRoot();
-
- // Returns the created Atom entry ID
- if (provider.supportsFeedEntries()) {
-
- // Returns the created entry
- msg.setBody(createdEntry);
-
- } else {
-
- // Returns the id of the created entry
- msg.setBody(createdEntry.getId().toString());
- }
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries())
- msg.setFaultBody(new NotFoundException());
- else
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- postMethod.releaseConnection();
- }
- }
-
- return msg;
- }
- }
-
- /**
- * Put operation invoker
- */
- public static class PutInvoker extends AtomBindingInvoker {
-
- public PutInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Put an entry
- Object[] args = (Object[])msg.getBody();
- String id;
- org.apache.abdera.model.Entry feedEntry;
- if (provider.supportsFeedEntries()) {
-
- // Expect a key and Atom entry
- id = (String)args[0];
- feedEntry = (org.apache.abdera.model.Entry)args[1];
- } else {
-
- // Expect a key and data item
- id = (String)args[0];
- Entry<Object, Object> entry = new Entry<Object, Object>(id, args[1]);
- feedEntry = feedEntry(entry, provider.getItemClassType(),
- provider.getItemXMLType(), provider.getMediator(), abderaFactory);
- }
-
- // Send an HTTP PUT
- PutMethod putMethod = new PutMethod(uri + "/" + id);
- putMethod.setRequestHeader("Authorization", authorizationHeader);
-
- try {
-
- // Write the Atom entry
- StringWriter writer = new StringWriter();
- feedEntry.writeTo(writer);
- putMethod.setRequestHeader("Content-type", "application/atom+xml; charset=utf-8");
- putMethod.setRequestEntity(new StringRequestEntity(writer.toString()));
-
- httpClient.executeMethod(putMethod);
- int status = putMethod.getStatusCode();
- if (status == 200 || status == 201 || status == 412) {
-
- msg.setBody(null);
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries())
- msg.setFaultBody(new NotFoundException());
- else
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- putMethod.releaseConnection();
- }
-
- return msg;
- }
- }
-
- /**
- * Delete operation invoker
- */
- public static class DeleteInvoker extends AtomBindingInvoker {
-
- public DeleteInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Delete an entry
- String id = (String)((Object[])msg.getBody())[0];
-
- // Send an HTTP DELETE
- DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id);
- deleteMethod.setRequestHeader("Authorization", authorizationHeader);
- try {
- httpClient.executeMethod(deleteMethod);
- int status = deleteMethod.getStatusCode();
- if (status == 200) {
- msg.setBody(null);
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries())
- msg.setFaultBody(new NotFoundException());
- else
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- deleteMethod.releaseConnection();
- }
-
- return msg;
- }
- }
-
- /**
- * GetAll operation invoker
- */
- public static class GetAllInvoker extends AtomBindingInvoker {
-
- public GetAllInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Get a feed
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
- boolean parsing = false;
- try {
- httpClient.executeMethod(getMethod);
- int status = getMethod.getStatusCode();
- // AtomBindingInvoker.printResponseHeader( getMethod );
-
- // Read the Atom feed
- if (status == 200) {
- Document<Feed> doc = abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
- parsing = true;
-
- Feed feed = null;
- try {
- feed = doc.getRoot();
- } catch(Exception e) {
- throw new IllegalArgumentException("Invalid feed format :" + uri);
- }
-
- if (provider.supportsFeedEntries()) {
-
- // Returns the Atom feed
- msg.setBody(feed);
-
- } else {
-
- // Returns an array of data entries
- List<Entry<Object, Object>> entries = new ArrayList<Entry<Object,Object>>();
- for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) {
- Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
- provider.getItemXMLType(), provider.getMediator());
- entries.add(entry);
- }
- msg.setBody(entries.toArray(new Entry[entries.size()]));
- }
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries()) {
- msg.setFaultBody(new NotFoundException());
- } else {
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- }
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- getMethod.releaseConnection();
- }
- }
-
- return msg;
- }
- }
-
- /**
- * Query operation invoker
- */
- public static class QueryInvoker extends AtomBindingInvoker {
-
- public QueryInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // Get a feed from a query
- String queryString = (String)((Object[])msg.getBody())[0];
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
- getMethod.setQueryString(queryString);
- boolean parsing = false;
- try {
- httpClient.executeMethod(getMethod);
- int status = getMethod.getStatusCode();
-
- // Read the Atom feed
- if (status == 200) {
- Document<Feed> doc = abderaParser.parse(new InputStreamReader(getMethod.getResponseBodyAsStream()));
- parsing = true;
- Feed feed = doc.getRoot();
-
- if (provider.supportsFeedEntries()) {
-
- // Returns the Atom feed
- msg.setBody(feed);
-
- } else {
-
- // Returns an array of data entries
- List<Entry<Object, Object>> entries = new ArrayList<Entry<Object,Object>>();
- for (org.apache.abdera.model.Entry feedEntry: feed.getEntries()) {
- Entry<Object, Object> entry = entry(feedEntry, provider.getItemClassType(),
- provider.getItemXMLType(), provider.getMediator());
- entries.add(entry);
- }
- msg.setBody(entries.toArray(new Entry[entries.size()]));
- }
-
- } else if (status == 404) {
- if ( provider.supportsFeedEntries())
- msg.setFaultBody(new NotFoundException());
- else
- msg.setFaultBody(new org.apache.tuscany.sca.data.collection.NotFoundException());
- } else {
- msg.setFaultBody(new ServiceRuntimeException("HTTP status code: " + status));
- }
-
- } catch (Exception e) {
- msg.setFaultBody(new ServiceRuntimeException(e));
- } finally {
- if (!parsing) {
- // Release the connection unless the Abdera parser is
- // parsing the response, in this case it will release it
- getMethod.releaseConnection();
- }
- }
-
- return msg;
- }
- }
-
- /**
- * PostMedia operation invoker
- */
- public static class PostMediaInvoker extends AtomBindingInvoker {
-
- public PostMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // PostInvoker can detect media by content type (non-Feed, non-Entry)
- return super.invoke(msg);
- }
- }
-
- /**
- * PutMedia operation invoker
- */
- public static class PutMediaInvoker extends AtomBindingInvoker {
-
- public PutMediaInvoker(Operation operation, String uri, HttpClient httpClient, String authorizationHeader, AtomReferenceBindingProvider bindingProvider) {
- super(operation, uri, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // PutInvoker can detect media by content type (non-Feed, non-Entry)
- return super.invoke(msg);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
deleted file mode 100644
index 5ba07f5e22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingListenerServlet.java
+++ /dev/null
@@ -1,914 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom.provider;
-
-import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.entry;
-import static org.apache.tuscany.sca.binding.atom.provider.AtomBindingUtil.feedEntry;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.URLDecoder;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Category;
-import org.apache.abdera.model.Collection;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.model.Link;
-import org.apache.abdera.model.Service;
-import org.apache.abdera.model.Workspace;
-import org.apache.abdera.parser.ParseException;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.writer.WriterFactory;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.tuscany.sca.binding.http.HTTPCacheContext;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * A resource collection binding listener, implemented as a Servlet and
- * registered in a Servlet host provided by the SCA hosting runtime.
- *
- * @version $Rev$ $Date$
- */
-class AtomBindingListenerServlet extends HttpServlet {
- private static final Logger logger = Logger.getLogger(AtomBindingListenerServlet.class.getName());
- private static final long serialVersionUID = 1L;
-
- private static final Factory abderaFactory = Abdera.getNewFactory();
- private static final Parser abderaParser = Abdera.getNewParser();
- private static final String ETAG = "ETag";
- private static final String LASTMODIFIED = "Last-Modified";
- private static final String LOCATION = "Location";
- private static final String CONTENTLOCATION = "Content-Location";
- private static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
-
- private RuntimeWire wire;
- private Invoker getFeedInvoker;
- private Invoker getAllInvoker;
- private Invoker queryInvoker;
- private Invoker getInvoker;
- private Invoker postInvoker;
- private Invoker postMediaInvoker;
- private Invoker putInvoker;
- private Invoker putMediaInvoker;
- private Invoker deleteInvoker;
- private MessageFactory messageFactory;
- private String title;
- private String description;
- private Mediator mediator;
- private DataType<?> itemClassType;
- private DataType<?> itemXMLType;
- private boolean supportsFeedEntries;
-
- /**
- * Constructs a new binding listener.
- *
- * @param wire
- * @param messageFactory
- * @param feedType
- */
- AtomBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title, String description) {
- this.wire = wire;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
- this.title = title;
- this.description = description;
-
- // Get the invokers for the supported operations
- Operation getOperation = null;
- for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
- invocationChain.setAllowsPassByReference(true);
- Operation operation = invocationChain.getTargetOperation();
- String operationName = operation.getName();
- if (operationName.equals("getFeed")) {
- getFeedInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("getAll")) {
- getAllInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("query")) {
- queryInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("get")) {
- getInvoker = invocationChain.getHeadInvoker();
- getOperation = operation;
- } else if (operationName.equals("put")) {
- putInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("putMedia")) {
- putMediaInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("post")) {
- postInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("postMedia")) {
- postMediaInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("delete")) {
- deleteInvoker = invocationChain.getHeadInvoker();
- }
- }
-
- // Determine the collection item type
- if (getOperation != null) {
- itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
- Class<?> itemClass = getOperation.getOutputType().getPhysical();
- if (itemClass == org.apache.abdera.model.Entry.class) {
- supportsFeedEntries = true;
- }
- //We assume that the item type is the same for both input and
- //ouput for all operations on the interface
- itemClassType = getOperation.getOutputType();
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // No authentication required for a get request
-
- // Test for any cache info in the request
- HTTPCacheContext cacheContext = null;
- try {
- cacheContext = HTTPCacheContext.getCacheContextFromRequest( request );
- } catch ( java.text.ParseException e ) {
- }
- // System.out.println( "AtomBindingListener.doGet cache context=" + cacheContext );
-
- // Get the request path
- //int servletPathLength = request.getContextPath().length() + request.getServletPath().length();
- //String path = URLDecoder.decode(request.getRequestURI().substring(servletPathLength), "UTF-8");
-
- String path = URLDecoder.decode(getRequestPath(request), "UTF-8");
-
- logger.fine("get " + request.getRequestURI());
-
- // Handle an Atom request
- if (path != null && path.equals("/atomsvc")) {
- /*
- <?xml version='1.0' encoding='UTF-8'?>
- <service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom">
- <workspace>
- <atom:title type="text">resource</atom:title>
- <collection href="http://luck.ibm.com:8084/customer">
- <atom:title type="text">entries</atom:title>
- <accept>application/atom+xml;type=entry</accept>
- <categories />
- </collection>
- </workspace>
- </service>
- */
-
- // Return the Atom service document
- response.setContentType("application/atomsvc+xml; charset=utf-8");
-
- String href = request.getRequestURL().toString();
- href = href.substring(0, href.length() - "/atomsvc".length());
-
- String workspaceURL = new String( href );
- int pathIndex = workspaceURL.indexOf( request.getServletPath() );
- if ( -1 != pathIndex ) {
- workspaceURL = workspaceURL.substring( 0, pathIndex ) + "/";
- }
-
- Service service = abderaFactory.newService();
- //service.setText("service");
-
- Workspace workspace = abderaFactory.newWorkspace();
- if ( title != null ) {
- workspace.setTitle(title);
- } else {
- workspace.setTitle("workspace");
- }
- workspace.setBaseUri( new IRI( workspaceURL ));
-
- Collection collection = workspace.addCollection("collection", href );
- Feed feed = getFeed( request );
- if ( feed != null ) {
- String title = feed.getTitle();
- if ( title != null ) {
- collection.setTitle(title);
- } else {
- collection.setTitle("entries");
- }
- collection.addAccepts("application/atom+xml;type=feed");
- collection.addAccepts("application/json;type=feed");
- collection.addAccepts("application/atom+xml;type=entry");
- collection.addAccepts("application/json;type=entry");
- List<Category> categories = feed.getCategories();
- if ( categories != null ) {
- collection.addCategories(categories, false, null);
- } else {
- collection.addCategories().setFixed(false);
- }
-
- } else {
- collection.setTitle("entries");
- // collection.addAccepts("application/atom+xml;type=feed");
- collection.addAccepts("application/atom+xml; type=entry");
- collection.addAccepts("application/json;type=entry");
- collection.addCategories().setFixed(false);
- }
- workspace.addCollection(collection);
- service.addWorkspace(workspace);
-
- //FIXME add prettyPrint support
- try {
- service.getDocument().writeTo(response.getOutputStream());
- } catch (IOException ioe) {
- throw new ServletException(ioe);
- }
-
- } else if (path == null || path.length() == 0 || path.equals("/")) {
-
- // Return a feed containing the entries in the collection
- Feed feed = getFeed( request );
- if (feed != null) {
- String feedETag = null;
- if (feed.getId() != null)
- feedETag = "\"" + feed.getId().toString() + "\"";
- Date feedUpdated = feed.getUpdated();
- // Test request for predicates.
- String predicate = request.getHeader( "If-Match" );
- if (( predicate != null ) && ( !predicate.equals(feedETag) )) {
- // No match, should short circuit
- response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
- return;
- }
- predicate = request.getHeader( "If-None-Match" );
- if (( predicate != null ) && ( predicate.equals(feedETag) )) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- if ( feedUpdated != null ) {
- predicate = request.getHeader( "If-Unmodified-Since" );
- if ( predicate != null ) {
- try {
- Date predicateDate = dateFormat.parse( predicate );
- if ( predicateDate.compareTo( feedUpdated ) < 0 ) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- } catch ( java.text.ParseException e ) {
- // Ignore and move on
- }
- }
- predicate = request.getHeader( "If-Modified-Since" );
- if ( predicate != null ) {
- try {
- Date predicateDate = dateFormat.parse( predicate );
- if ( predicateDate.compareTo( feedUpdated ) > 0 ) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- } catch ( java.text.ParseException e ) {
- // Ignore and move on
- }
- }
- }
- // Provide Etag based on Id and time if given.
- // Ignore if not given. (Browser may cache if trivial ETag is given.)
- if ( feedETag != null ) {
- response.addHeader(ETAG, feedETag);
- }
- if ( feedUpdated != null ) {
- response.addHeader(LASTMODIFIED, dateFormat.format( feedUpdated ));
- }
-
- // Content negotiation
- String acceptType = request.getHeader( "Accept" );
- String preferredType = getContentPreference( acceptType );
- if (( preferredType != null ) && ((preferredType.indexOf( "json") > -1) || (preferredType.indexOf( "JSON") > -1 ))) {
- // JSON response body
- response.setContentType("application/json;type=feed");
-
- try {
- Abdera abdera = new Abdera();
- WriterFactory wf = abdera.getWriterFactory();
- org.apache.abdera.writer.Writer json = wf.getWriter("json");
- feed.writeTo(json, response.getWriter());
- } catch (Exception e) {
- throw new ServletException(e);
- }
-
- } else {
- // Write the Atom feed
- response.setContentType("application/atom+xml;type=feed");
- try {
- feed.getDocument().writeTo(response.getOutputStream());
- } catch (IOException ioe) {
- throw new ServletException(ioe);
- }
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- } else if (path.startsWith("/")) {
- // Return a specific entry in the collection
- org.apache.abdera.model.Entry feedEntry;
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- String id = path.substring(1);
- requestMessage.setBody(new Object[] {id});
- Message responseMessage = getInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- }
- if (supportsFeedEntries) {
- // The service implementation returns a feed entry
- feedEntry = responseMessage.getBody();
- } else {
- // The service implementation only returns a data item, create an entry
- // from it
- Entry<Object, Object> entry = new Entry<Object, Object>(id, responseMessage.getBody());
- feedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
- }
- // Write the Atom entry
- if (feedEntry != null) {
- String entryETag = null;
- if (feedEntry.getId() != null)
- entryETag = feedEntry.getId().toString();
- Date entryUpdated = feedEntry.getUpdated();
- if ( entryUpdated != null )
- response.addHeader(LASTMODIFIED, dateFormat.format( entryUpdated ));
- // TODO Check If-Modified-Since If-Unmodified-Since predicates against LASTMODIFIED.
- // If true return 304 and null body.
-
- Link link = feedEntry.getSelfLink();
- if (link != null) {
- response.addHeader(LOCATION, link.getHref().toString());
- } else {
- link = feedEntry.getLink( "Edit" );
- if (link != null) {
- response.addHeader(LOCATION, link.getHref().toString());
- }
- }
-
- // Test request for predicates.
- String predicate = request.getHeader( "If-Match" );
- if (( predicate != null ) && ( !predicate.equals(entryETag) )) {
- // No match, should short circuit
- response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);
- return;
- }
- predicate = request.getHeader( "If-None-Match" );
- if (( predicate != null ) && ( predicate.equals(entryETag) )) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- if ( entryUpdated != null ) {
- predicate = request.getHeader( "If-Unmodified-Since" );
- if ( predicate != null ) {
- try {
- Date predicateDate = dateFormat.parse( predicate );
- if ( predicateDate.compareTo( entryUpdated ) < 0 ) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- } catch ( java.text.ParseException e ) {
- // Ignore and move on
- }
- }
- predicate = request.getHeader( "If-Modified-Since" );
- if ( predicate != null ) {
- try {
- Date predicateDate = dateFormat.parse( predicate );
- if ( predicateDate.compareTo( entryUpdated ) > 0 ) {
- // Match, should short circuit
- response.sendError(HttpServletResponse.SC_NOT_MODIFIED);
- return;
- }
- } catch ( java.text.ParseException e ) {
- // Ignore and move on
- }
- }
- }
- // Provide Etag based on Id and time if given.
- // Ignore if not given. (Browser may cache if trivial ETag is given.)
- if (entryETag != null) {
- response.addHeader(ETAG, entryETag );
- }
- if ( entryUpdated != null ) {
- response.addHeader(LASTMODIFIED, dateFormat.format( entryUpdated ));
- }
-
- // Content negotiation
- String acceptType = request.getHeader( "Accept" );
- String preferredType = getContentPreference( acceptType );
- if (( preferredType != null ) && ((preferredType.indexOf( "json") > -1) || (preferredType.indexOf( "JSON") > -1 ))) {
- // JSON response body
- response.setContentType("application/json;type=entry");
- try {
- Abdera abdera = new Abdera();
- WriterFactory wf = abdera.getWriterFactory();
- org.apache.abdera.writer.Writer json = wf.getWriter("json");
- feedEntry.writeTo(json, response.getWriter());
- } catch (Exception e) {
- throw new ServletException(e);
- }
- } else {
- // XML response body
- response.setContentType("application/atom+xml;type=entry");
- try {
- feedEntry.writeTo(getWriter(response));
- } catch (IOException ioe) {
- throw new ServletException(ioe);
- }
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- } else {
- // Path doesn't match any known pattern
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- }
-
- protected Feed getFeed( HttpServletRequest request ) throws ServletException {
- if (supportsFeedEntries) {
- // The service implementation supports feed entries, invoke its getFeed operation
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage;
- if (request.getQueryString() != null) {
- requestMessage.setBody(new Object[] {request.getQueryString()});
- responseMessage = queryInvoker.invoke(requestMessage);
- } else {
- responseMessage = getFeedInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- return (Feed)responseMessage.getBody();
- } else {
-
- // The service implementation does not support feed entries,
- // invoke its getAll operation to get the data item collection, then create
- // feed entries from the items
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage;
- if (request.getQueryString() != null) {
- requestMessage.setBody(new Object[] {request.getQueryString()});
- responseMessage = queryInvoker.invoke(requestMessage);
- } else {
- responseMessage = getAllInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- Entry<Object, Object>[] collection = (Entry<Object, Object>[])responseMessage.getBody();
- if (collection != null) {
-
- // Create the feed
- Feed feed = abderaFactory.newFeed();
-
- // Set the feed title
- if (title != null) {
- feed.setTitle(title);
- } else {
- feed.setTitle("Feed");
- }
- if (description != null) {
- feed.setSubtitle(description);
- }
- // All feeds must provide Id and updated elements.
- // However, some do not, so provide some program protection.
- feed.setId( "Feed" + feed.hashCode());
- Date responseLastModified = new Date( 0 );
-
- // Add entries to the feed
- for (Entry<Object, Object> entry: collection) {
- org.apache.abdera.model.Entry feedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
- // Use the most recent entry update as the feed update
- Date entryUpdated = feedEntry.getUpdated();
- if (( entryUpdated != null ) && (entryUpdated.compareTo( responseLastModified ) > 0 )) {
- responseLastModified = entryUpdated;
- }
- feed.addEntry(feedEntry);
- }
- // If no entries were newly updated,
- if ( responseLastModified.compareTo( new Date( 0 ) ) == 0 ) {
- responseLastModified = new Date();
- }
- return feed;
- }
- }
- return null;
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
- IOException {
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = URLDecoder.decode(getRequestPath(request), "UTF-8");
-
- if (path == null || path.length() == 0 || path.equals("/")) {
- org.apache.abdera.model.Entry createdFeedEntry = null;
-
- // Create a new Atom entry
- String contentType = request.getContentType();
- if (contentType != null && contentType.startsWith("application/atom+xml")) {
-
- // Read the entry from the request
- org.apache.abdera.model.Entry feedEntry;
- try {
- Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(request.getReader());
- feedEntry = doc.getRoot();
- } catch (ParseException pe) {
- throw new ServletException(pe);
- }
-
- // Let the component implementation create it
- if (supportsFeedEntries) {
-
- // The service implementation supports feed entries, pass the entry to it
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {feedEntry});
- Message responseMessage = postInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- createdFeedEntry = responseMessage.getBody();
- } else {
-
- // The service implementation does not support feed entries, pass the data item to it
- Message requestMessage = messageFactory.createMessage();
- Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
- requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
- Message responseMessage = postInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- entry.setKey(responseMessage.getBody());
- createdFeedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator, abderaFactory);
- }
-
- } else if (contentType != null) {
- // Create a new media entry
-
- // Get incoming headers
- String title = request.getHeader("Title");
- String slug = request.getHeader("Slug");
-
- // Let the component implementation create the media entry
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {title, slug, contentType, request.getInputStream()});
- Message responseMessage = postMediaInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- createdFeedEntry = responseMessage.getBody();
-
- // Transfer media info to response header.
- // Summary is a comma separated list of header properties.
- String summary = createdFeedEntry.getSummary();
- addPropertiesToHeader( response, summary );
-
- } else {
- response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- }
-
- // A new entry for non-media was created successfully.
- if (createdFeedEntry != null) {
- // Set location of the created entry in the Location header
- IRI feedId = createdFeedEntry.getId();
- if ( feedId != null ) {
- response.addHeader(ETAG, "\"" + feedId.toString() + "\"" );
- }
- Date entryUpdated = createdFeedEntry.getUpdated();
- if ( entryUpdated != null ) {
- response.addHeader(LASTMODIFIED, dateFormat.format( entryUpdated ));
- }
- Link link = createdFeedEntry.getSelfLink();
- if (link != null) {
- response.addHeader(LOCATION, link.getHref().toString());
- }
- Link editLink = createdFeedEntry.getEditLink();
- if (editLink != null) {
- response.addHeader(LOCATION, editLink.getHref().toString());
- }
- Link editMediaLink = createdFeedEntry.getEditMediaLink();
- if (editMediaLink != null) {
- response.addHeader(CONTENTLOCATION, editMediaLink.getHref().toString());
- }
-
- // Write the created Atom entry
- response.setStatus(HttpServletResponse.SC_CREATED);
- response.setContentType("application/atom+xml;type=entry");
- try {
- createdFeedEntry.writeTo(getWriter(response));
- } catch (ParseException pe) {
- throw new ServletException(pe);
- }
-
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
- private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
- Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
- return writer;
- }
-
- @Override
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = URLDecoder.decode(getRequestPath(request), "UTF-8");
-
- if (path != null && path.startsWith("/")) {
- String id = path.substring(1);
-
- // Update an Atom entry
- String contentType = request.getContentType();
- if (contentType != null && contentType.startsWith("application/atom+xml")) {
-
- // Read the entry from the request
- org.apache.abdera.model.Entry feedEntry;
- try {
- Document<org.apache.abdera.model.Entry> doc = abderaParser.parse(request.getReader());
- feedEntry = doc.getRoot();
- } catch (ParseException pe) {
- throw new ServletException(pe);
- }
-
- // Let the component implementation create it
- if (supportsFeedEntries) {
- // The service implementation supports feed entries, pass the entry to it
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id, feedEntry});
- Message responseMessage = putInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- } else {
- // The service implementation does not support feed entries, pass the data item to it
- Message requestMessage = messageFactory.createMessage();
- Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
- requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
- Message responseMessage = putInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- }
-
- } else if (contentType != null) {
-
- // Update a media entry
-
- // Let the component implementation create the media entry
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id, contentType, request.getInputStream()});
- Message responseMessage = putMediaInvoker.invoke(requestMessage);
-
- Object body = responseMessage.getBody();
- if (responseMessage.isFault()) {
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
-
- // Transfer content to response header.
-
- } else {
- response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
- @Override
- protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = URLDecoder.decode(getRequestPath(request), "UTF-8");
-
- String id;
- if (path != null && path.startsWith("/")) {
- id = path.substring(1);
- } else {
- id = "";
- }
-
- // Delete a specific entry from the collection
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id});
- Message responseMessage = deleteInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- }
-
-
- /**
- *
- * @param request
- * @return
- */
- private static String getRequestPath(HttpServletRequest request) {
- // Get the request path
- String contextPath = request.getContextPath();
- String servletPath = request.getServletPath();
- String requestURI = request.getRequestURI();
-
- int contextPathLength = request.getContextPath().length();
- int servletPathLenght = servletPath.contains(contextPath) ? servletPath.length() - contextPath.length() : servletPath.length();
-
- String requestPath = requestURI.substring(contextPathLength + servletPathLenght);
-
- return requestPath;
- }
-
- /**
- * Process the authorization header
- *
- * @param request
- * @return
- * @throws ServletException
- */
- private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
-
- // FIXME temporarily disabling this as it doesn't work with all browsers
- if (true)
- return "admin";
-
- try {
- String authorization = request.getHeader("Authorization");
- if (authorization != null) {
- StringTokenizer tokens = new StringTokenizer(authorization);
- if (tokens.hasMoreTokens()) {
- String basic = tokens.nextToken();
- if (basic.equalsIgnoreCase("Basic")) {
- String credentials = tokens.nextToken();
- String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
- int colon = userAndPassword.indexOf(":");
- if (colon != -1) {
- String user = userAndPassword.substring(0, colon);
- String password = userAndPassword.substring(colon + 1);
-
- // Authenticate the User.
- if (authenticate(user, password)) {
- return user;
- }
- }
- }
- }
- }
- } catch (Exception e) {
- throw new ServletException(e);
- }
- return null;
- }
-
- /**
- * Authenticate a user.
- *
- * @param user
- * @param password
- * @return
- */
- private boolean authenticate(String user, String password) {
- // TODO Handle this using SCA security policies
- return ("admin".equals(user) && "admin".equals(password));
- }
-
- /**
- * Reject an unauthorized request.
- *
- * @param response
- */
- private void unauthorized(HttpServletResponse response) throws IOException {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
-
- /**
- * Get content-type preference using application/atom-xml as default
- * @param acceptType content-type preference using application/atom-xml as default
- * @return
- */
- private static String getContentPreference( String acceptType ) {
- if (( acceptType == null ) || ( acceptType.length() < 1 )) {
- return "application/atom+xml";
- }
- StringTokenizer st = new StringTokenizer( acceptType, "," );
- if ( st.hasMoreTokens() ) {
- return st.nextToken();
- }
- return "application/atom+xml";
- }
-
- /** Take a list of key values and add them to the header.
- * For instance "Content-Type=image/gif,Content-Length=14201"
- * @param response
- * @param properties
- */
- private static void addPropertiesToHeader( HttpServletResponse response, String properties ) {
- if ( properties == null ) return;
- StringTokenizer props = new StringTokenizer( properties, ",");
- while( props.hasMoreTokens()) {
- String prop = props.nextToken();
- StringTokenizer keyVal = new StringTokenizer( prop, "=");
- String key = null;
- String val = null;
- if ( keyVal.hasMoreTokens() )
- key = keyVal.nextToken();
- if ( keyVal.hasMoreTokens() )
- val = keyVal.nextToken();
- if (( key != null ) && ( val != null )) {
- response.addHeader(key, val);
- }
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.java
deleted file mode 100644
index 00df45a49e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingProviderFactory.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.binding.atom.provider;
-
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Implementation of a Binding provider factory for the Atom binding.
- *
- * @version $Rev$ $Date$
- */
-public class AtomBindingProviderFactory implements BindingProviderFactory<AtomBinding> {
-
- private MessageFactory messageFactory;
- private Mediator mediator;
- private ServletHost servletHost;
-
- public AtomBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- AtomBinding binding) {
- return new AtomReferenceBindingProvider(component, reference, binding, mediator);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- AtomBinding binding) {
- return new AtomServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
- }
-
- public Class<AtomBinding> getModelType() {
- return AtomBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java
deleted file mode 100644
index fad06a0c99..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomBindingUtil.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom.provider;
-
-import java.util.Date;
-
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Link;
-import org.apache.abdera.model.Content.Type;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-/**
- * Utility methods used in this package.
- *
- * @version $Rev$ $Date$
- */
-class AtomBindingUtil {
-
- /**
- * Create a data item from an Atom entry.
- * @param feedEntry
- * @param itemClassType
- * @param itemXMLType
- * @param mediator
- * @return
- */
- static Entry<Object, Object> entry(org.apache.abdera.model.Entry feedEntry,
- DataType<?> itemClassType, DataType<?> itemXMLType, Mediator mediator) {
- if (feedEntry != null) {
- if (itemClassType.getPhysical() == Item.class || feedEntry.getContentType() == Type.HTML ) {
- String key = feedEntry.getId().toString();
-
- Item item = new Item();
- item.setTitle(feedEntry.getTitle());
- item.setContents(feedEntry.getContent());
-
- for (Link link : feedEntry.getLinks()) {
- if (link.getRel() == null || "self".equals(link.getRel())) {
- if (item.getLink() == null) {
- item.setLink(link.getHref().toString());
- }
- } else if ("related".equals(link.getRel())) {
- item.setRelated(link.getHref().toString());
- } else if ("alternate".equals(link.getRel())) {
- item.setAlternate(link.getHref().toString());
- }
- }
-
- item.setDate(feedEntry.getUpdated());
-
- return new Entry<Object, Object>(key, item);
-
- } else {
- String key = null;
- if ( feedEntry.getId() != null) {
- key = feedEntry.getId().toString();
- }
-
- // Create the item from XML
- if (feedEntry.getContentElement().getElements().size() == 0) {
- return null;
- }
-
- String value = feedEntry.getContent();
- Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
-
- return new Entry<Object, Object>(key, data);
- }
- } else {
- return null;
- }
- }
-
- /**
- * Create an Atom entry for a key and item from a collection.
- * @param entry
- * @param itemClassType
- * @param itemXMLType
- * @param mediator
- * @param factory
- * @return
- */
- static org.apache.abdera.model.Entry feedEntry(Entry<Object, Object> entry,
- DataType<?> itemClassType, DataType<?> itemXMLType, Mediator mediator,
- Factory factory) {
- Object key = entry.getKey();
- Object data = entry.getData();
- if (data instanceof Item) {
- Item item = (Item)data;
-
- org.apache.abdera.model.Entry feedEntry = factory.newEntry();
- if (key != null) {
- feedEntry.setId(key.toString());
- }
- feedEntry.setTitle(item.getTitle());
- feedEntry.setContentAsHtml(item.getContents());
-
- String href = item.getLink();
- if (href == null && key != null) {
- href = key.toString();
- }
-
- if (href != null) {
- feedEntry.addLink(href);
- }
- String related = item.getRelated();
- if (related != null) {
- feedEntry.addLink(related, "related");
- }
- String alternate = item.getAlternate();
- if (alternate != null) {
- feedEntry.addLink(alternate, "alternate");
- }
-
- Date date = item.getDate();
- if (date != null) {
- feedEntry.setUpdated(date);
- }
- return feedEntry;
-
- } else if (data != null) {
- org.apache.abdera.model.Entry feedEntry = factory.newEntry();
- feedEntry.setId(key.toString());
- feedEntry.setTitle("item");
-
-
- // Convert the item to XML
- String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
-
- Content content = factory.newContent();
- content.setContentType(Content.Type.XML);
- content.setValue(value);
-
- feedEntry.setContentElement(content);
-
- feedEntry.addLink(key.toString());
-
- return feedEntry;
- } else {
- return null;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
deleted file mode 100644
index 65331af34c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom.provider;
-
-import java.net.URI;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * Implementation of the Atom binding provider.
- *
- * @version $Rev$ $Date$
- */
-class AtomReferenceBindingProvider implements ReferenceBindingProvider {
-
- private RuntimeComponentReference reference;
- private AtomBinding binding;
- private String authorizationHeader;
- private HttpClient httpClient;
- private Mediator mediator;
- private DataType<?> itemClassType;
- private DataType<?> itemXMLType;
- private boolean supportsFeedEntries;
-
- /**
- * Constructs a new AtomReferenceBindingProvider
- * @param component
- * @param reference
- * @param binding
- * @param mediator
- */
- AtomReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- AtomBinding binding,
- Mediator mediator) {
- this.reference = reference;
- this.binding = binding;
- this.mediator = mediator;
-
- // Prepare authorization header
- String authorization = "admin" + ":" + "admin";
- authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
-
- // Create an HTTP client
- HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
- connectionManager.getParams().setDefaultMaxConnectionsPerHost(10);
- connectionManager.getParams().setConnectionTimeout(60000);
- httpClient = new HttpClient(connectionManager);
- }
-
- public Invoker createInvoker(Operation operation) {
-
- String operationName = operation.getName();
- if (operationName.equals("get")) {
-
- // Determine the collection item type
- itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
- Class<?> itemClass = operation.getOutputType().getPhysical();
- DataType<XMLType> outputType = operation.getOutputType();
- itemClassType = outputType;
- if (itemClassType.getPhysical() == org.apache.abdera.model.Entry.class) {
- supportsFeedEntries = true;
- }
-
- return new AtomBindingInvoker.GetInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("post")) {
- return new AtomBindingInvoker.PostInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("put")) {
- return new AtomBindingInvoker.PutInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("delete")) {
- return new AtomBindingInvoker.DeleteInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("getFeed") || operationName.equals("getAll")) {
- return new AtomBindingInvoker.GetAllInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("postMedia")) {
- return new AtomBindingInvoker.PostMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("putMedia")) {
- return new AtomBindingInvoker.PutMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- } else if (operationName.equals("query")) {
- return new AtomBindingInvoker.QueryInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- }
-
- return new AtomBindingInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public void start() {
-
- // Configure the HTTP client credentials
- Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
- httpClient.getParams().setAuthenticationPreemptive(true);
- URI uri = URI.create(binding.getURI());
- httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
-
- // Find the get operation on the reference interface
- if (true) {
- return;
- }
- }
-
- public void stop() {
-
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- /**
- * Returns the mediator.
- * @return
- */
- Mediator getMediator() {
- return mediator;
- }
-
- /**
- * Returns the item class type.
- * @return
- */
- DataType<?> getItemClassType() {
- return itemClassType;
- }
-
- /**
- * Returns the item XML type.
- * @return
- */
- DataType<?> getItemXMLType() {
- return itemXMLType;
- }
-
- /**
- * Returns true if the invoker should work with Atom
- * feed entries.
- * @return
- */
- boolean supportsFeedEntries() {
- return supportsFeedEntries;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.java
deleted file mode 100644
index d794dd4ee8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomServiceBindingProvider.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.binding.atom.provider;
-
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of the Atom binding provider.
- *
- * @version $Rev$ $Date$
- */
-class AtomServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeComponentService service;
- private InterfaceContract serviceContract;
- private AtomBinding binding;
- private ServletHost servletHost;
- private MessageFactory messageFactory;
- private Mediator mediator;
-
- private String servletMapping;
- private String bindingURI;
-
- AtomServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- AtomBinding binding,
- ServletHost servletHost,
- MessageFactory messageFactory,
- Mediator mediator) {
- this.service = service;
- this.binding = binding;
- this.servletHost = servletHost;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
-
- // TUSCANY-3166
- this.serviceContract = service.getInterfaceContract();
- if (this.serviceContract instanceof WSDLInterfaceContract) {
- for (Service componentService : component.getImplementation().getServices()) {
- if (componentService.getName().equals(service.getName())) {
- this.serviceContract = (InterfaceContract) componentService.getInterfaceContract();
- break;
- }
- }
-
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return serviceContract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- RuntimeComponentService componentService = (RuntimeComponentService)service;
- RuntimeWire wire = componentService.getRuntimeWire(binding);
-
- AtomBindingListenerServlet servlet =
- new AtomBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle(), binding.getDescription());
-
- servletMapping = binding.getURI();
- if (!servletMapping.endsWith("/")) {
- servletMapping += "/";
- }
- if (!servletMapping.endsWith("*")) {
- servletMapping += "*";
- }
- servletHost.addServletMapping(servletMapping, servlet);
-
- bindingURI = binding.getURI();
- if (!bindingURI.endsWith("/")) {
- bindingURI += "/";
- }
-
- servletHost.addServletMapping(bindingURI, servlet);
- }
-
- public void stop() {
- servletHost.removeServletMapping(servletMapping);
- servletHost.removeServletMapping(bindingURI);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 1b9052299c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.atom.provider.AtomBindingProviderFactory;model=org.apache.tuscany.sca.binding.atom.AtomBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomDeleteTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomDeleteTestCase.java
deleted file mode 100644
index a427a076cd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomDeleteTestCase.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.binding.atom;
-
-import java.util.UUID;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AtomDeleteTestCase {
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomDeleteTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- abdera = new Abdera();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- // System.out.println(">>>AtomDeleteTestCase.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- Assert.assertNotNull(abdera);
- }
-
- @Test
- public void testAtomDelete() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- Entry newEntry = resourceCollection.post(postEntry);
- System.out.println("<<< Entry posted for " + newEntry.getTitle());
-
- System.out.println(">>> get id=" + newEntry.getId());
-
- resourceCollection.delete(newEntry.getId().toString());
-
- }
-
- @Test
- public void testAtomDeleteException() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- try {
- // Generates custom ID
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
- resourceCollection.delete(id);
- } catch (Exception e) {
- // ID doesn't match with the existing IDs and NotFoundException is
- // thrown
- Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
- }
-
- }
-
- private Entry postEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java
deleted file mode 100644
index 4f91ff492a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomFeedNonCollectionTest.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom;
-
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.model.Link;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test cases for using an Atom feed that does not implement
- * the Collections interface but does have a getAll() method.
- */
-public class AtomFeedNonCollectionTest {
- /**
- * Used to generate unique IDs for the feed entries.
- */
- private static final AtomicInteger ID_GEN = new AtomicInteger();
-
- /**
- * Data used for creating test feed entries.
- */
- private static final String[] FEED_ENTRY_TITLES = {"Apache Tuscany", "Apache"};
-
- /**
- * Data used for creating test feed entries.
- */
- private static final String[] FEED_ENTRY_CONTENT = {"This is Apache Tuscany", "This is Apache"};
-
- /**
- * Data used for creating test feed entries.
- */
- private static final String[] FEED_ENTRY_LINK = {"http://tuscany.apache.org", "http://www.apache.org"};
-
- /**
- * The number of test feed entries.
- */
- private static final int FEED_ENTRY_COUNT = FEED_ENTRY_TITLES.length;
-
- private static SCADomain scaConsumerDomain;
- private static SCADomain scaProviderDomain;
- private static CustomerClient testService;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomFeedNonCollectionTest.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>AtomFeedNonCollectionTest.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- /**
- * Make sure everything has been initialised correctly.
- */
- @Before
- public void testPrelim() {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
-
- // Add some entries to the Atom feed
- final Entry<Object, Object>[] testEntries = new Entry[FEED_ENTRY_COUNT];
- for (int i = 0; i < FEED_ENTRY_COUNT; i++) {
- testEntries[i] = createFeedEntry(FEED_ENTRY_TITLES[i], FEED_ENTRY_CONTENT[i], FEED_ENTRY_LINK[i]);
- }
- CustomerNonCollectionImpl.entries = testEntries;
- }
-
- /**
- * Post test cleanup
- */
- @After
- public void testPostCleanup()
- {
- // Clear any old feed entries that have been added by previous tests
- CustomerNonCollectionImpl.entries = null;
- }
-
- /**
- * Test that we can retrieve entries from a feed that does not implement
- * the Collection interface.
- */
- @Test
- public void testThatCanGetFeedEntriesFromNonCollectionImplementation() {
- // Get the entries from the feed
- final Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
- final List<org.apache.abdera.model.Entry> entries = resourceCollection.getFeed().getEntries();
-
- // Validate the feed entries
- Assert.assertNotNull(entries);
- Assert.assertEquals(FEED_ENTRY_COUNT, entries.size());
- for (int i = 0; i < FEED_ENTRY_COUNT; i++) {
- final org.apache.abdera.model.Entry entry = entries.get(i);
- Assert.assertEquals(FEED_ENTRY_TITLES[i], entry.getTitle());
- Assert.assertEquals(FEED_ENTRY_CONTENT[i], entry.getContent());
- final List<Link> links = entry.getLinks();
- Assert.assertNotNull(links);
- Assert.assertEquals(1, links.size());
- final Link link = links.get(0);
- final String linkStr = link.getHref().toString();
- Assert.assertEquals(FEED_ENTRY_LINK[i], linkStr);
- }
- }
-
- /**
- * Creates a feed entry.
- *
- * @param title Title for the feed entry
- * @param content Contents of the feed entry
- * @param link Link for the feed entry
- * @return A new feed entry.
- */
- private Entry<Object, Object> createFeedEntry(String title, String content, String link) {
- final Item item = new Item(title, content, link, null, new Date());
- final Entry<Object, Object> entry = new Entry<Object, Object>(nextFeedID(), item);
- return entry;
- }
-
- /**
- * Generates the feed entry ID.
- *
- * @return Next feed entry ID
- */
- private String nextFeedID() {
- return Integer.toString(ID_GEN.incrementAndGet());
- }
-
- /**
- * Tests that the title of the feed can be set by the title
- * attribute on the binding.atom
- */
- @Test
- public void testThatFeedTitleSet() {
- final String expectedFeedTitle = "Atom binding Non Collection";
-
- // Get the title of the feed
- final Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
- final String feedTitle = resourceCollection.getFeed().getTitle();
-
- // Validate the title
- Assert.assertEquals(expectedFeedTitle, feedTitle);
- }
-
- /**
- * Tests that the description of the feed can be set by the description
- * attribute on the binding.atom
- */
- @Test
- public void testThatFeedDescriptionSet() {
- final String expectedFeedDescription = "Feed used for unit testing";
-
- // Get the description of the feed
- final Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
- final String feedDescription = resourceCollection.getFeed().getSubtitle();
-
- // Validate the description
- Assert.assertEquals(expectedFeedDescription, feedDescription);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomGetTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomGetTestCase.java
deleted file mode 100644
index 32a01ebe2a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomGetTestCase.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AtomGetTestCase {
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomGetTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- abdera = new Abdera();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- // System.out.println(">>>AtomGetTestCase.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- Assert.assertNotNull(abdera);
- }
-
- @Test
- public void testAtomGet() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- Entry newEntry = resourceCollection.post(postEntry);
- System.out.println("<<< Entry posted for " + newEntry.getTitle());
-
- System.out.println(">>> get id=" + newEntry.getId());
-
- Entry getEntry = resourceCollection.get(newEntry.getId().toString());
-
- Assert.assertEquals(newEntry.getTitle(), getEntry.getTitle());
- System.out.println("<<< get id=" + getEntry.getId() + " entry=" + getEntry.getTitle());
- }
-
- @Test
- public void testAtomGetException() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- Entry newEntry = resourceCollection.post(postEntry);
- System.out.println("<<< Entry posted for " + newEntry.getTitle());
- System.out.println(newEntry.getId());
-
- // Delete the entry to force the Collection to throw NotFoundException
- resourceCollection.delete(newEntry.getId().toString());
-
- try {
- resourceCollection.get(newEntry.getId().toString());
- } catch (Exception e) {
- Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
- }
- }
-
- private Entry postEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPostTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPostTestCase.java
deleted file mode 100644
index 49e9c2f25f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPostTestCase.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AtomPostTestCase {
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomPostTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- abdera = new Abdera();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>AtomPostTestCase.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- Assert.assertNotNull(abdera);
- }
-
- @Test
- public void testAtomPost() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- Entry newEntry = resourceCollection.post(postEntry);
-
- Assert.assertEquals(postEntry.getTitle(), newEntry.getTitle());
-
- System.out.println("<<< new entry= " + newEntry.getTitle());
-
- }
-
- @Test
- public void testAtomPostException() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Exception_Test");
-
- try {
- resourceCollection.post(postEntry);
- } catch (Exception e) {
- Assert.assertEquals("HTTP status code: 500", e.getMessage());
- }
- }
-
- private Entry postEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPutTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPutTestCase.java
deleted file mode 100644
index 3aaad681f4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomPutTestCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.util.UUID;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AtomPutTestCase {
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomPutTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- abdera = new Abdera();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- // System.out.println(">>>AtomPutTestCase.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- Assert.assertNotNull(abdera);
- }
-
- @Test
- public void testAtomPut() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- Entry newEntry = resourceCollection.post(postEntry);
- System.out.println("<<< Entry posted for " + newEntry.getTitle());
- System.out.println(newEntry.getId());
-
- System.out.println(">>> put id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
- resourceCollection.put(newEntry.getId().toString(), updateEntry(newEntry, "James Bond"));
- System.out.println("<<< put id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
- }
-
- @Test
- public void testAtomPutException() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- System.out.println(">>> post entry= " + postEntry.getTitle());
-
- // Generate random ID to pass as parameter in PUT() --
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
- try {
- // ID doesn't match with the existing IDs and NotFoundException is thrown
- resourceCollection.put(id, updateEntry(postEntry, "James Bond"));
- } catch (Exception e) {
- Assert.assertEquals("NotFoundException", e.getClass().getSimpleName());
- }
- }
-
- private Entry postEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
- private Entry updateEntry(Entry entry, String value) {
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomTestCaseUtils.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomTestCaseUtils.java
deleted file mode 100644
index 6beed6881f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/AtomTestCaseUtils.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.binding.atom;
-
-import java.io.IOException;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Base;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.RequestOptions;
-import org.apache.abdera.writer.Writer;
-import org.apache.abdera.writer.WriterFactory;
-
-/**
- * Utilities to help print and test various aspects of entity tag support.
- */
-public class AtomTestCaseUtils {
-
- public static void prettyPrint(Abdera abdera, Base doc) throws IOException {
- WriterFactory factory = abdera.getWriterFactory();
- Writer writer = factory.getWriter("prettyxml");
- writer.writeTo(doc, System.out);
- System.out.println();
- }
-
- public static void printRequestHeaders( String title, String indent, RequestOptions request ) {
- System.out.println( title );
- if ( request == null ) {
- System.out.println( indent + " request is null");
- return;
- }
- String [] headerNames = request.getHeaderNames();
- for ( String headerName: headerNames) {
- String header = request.getHeader(headerName);
- System.out.println( indent + " header name,value=" + headerName + "," + header );
- }
- }
-
- public static void printResponseHeaders( String title, String indent, ClientResponse response ) {
- System.out.println( title );
- if ( response == null ) {
- System.out.println( indent + " response is null");
- return;
- }
- String [] headerNames = response.getHeaderNames();
- for ( String headerName: headerNames) {
- String header = response.getHeader(headerName);
- System.out.println( indent + " header name,value=" + headerName + "," + header );
- }
-
- }
-
- public static Entry newEntry(String value) {
- Abdera abdera = new Abdera();
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
- public static Entry updateEntry(Entry entry, String value) {
- Abdera abdera = new Abdera();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.java
deleted file mode 100644
index 34d3ed1d1c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Consumer.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.binding.atom;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Consumer {
-
- public static void main(String[] args) throws Exception {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
-
- CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
- testService.testCustomerCollection();
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ConsumerProviderAtomTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ConsumerProviderAtomTestCase.java
deleted file mode 100644
index 9af85a970c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ConsumerProviderAtomTestCase.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.binding.atom;
-
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test case for the given package.
- */
-public class ConsumerProviderAtomTestCase {
-
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>AtomBindingIntegratedTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class,"CustomerClient");
- abdera = new Abdera();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>AtomBindingIntegratedTestCase.destroy entry");
- scaConsumerDomain.close();
- scaProviderDomain.close();
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- Assert.assertNotNull(abdera);
- }
-
- @Test
- public void testEntry() throws Exception {
- // System.out.println( getClass().getName() + ".testEntry entry" );
- Entry entry = abdera.newEntry();
- Assert.assertNotNull(entry);
-
- String testTitle = "Sponge Bob";
- entry.setTitle(testTitle);
- Assert.assertEquals(testTitle, entry.getTitle());
-
- String testContent = "This is the content";
- entry.setContent(testContent);
- Assert.assertEquals(testContent, entry.getContent());
-
- Date now = new Date();
- entry.setEdited(now);
- Assert.assertEquals(now, entry.getEdited());
-
- Date later = new Date();
- entry.setPublished(later);
- Assert.assertEquals(later, entry.getPublished());
-
- String testSummary = "This is the summary";
- entry.setSummary(testSummary);
- Assert.assertEquals(testSummary, entry.getSummary());
- }
-
- @Test
- public void testCustomerCollection() throws Exception {
- System.out.println(getClass().getName() + ".testCustomerCollection entry");
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry newEntry = newEntry("Sponge Bob");
- System.out.println(">>> post entry=" + newEntry.getTitle());
- newEntry = resourceCollection.post(newEntry);
- System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
-
- newEntry = newEntry("Jane Bond");
- System.out.println(">>> post entry=" + newEntry.getTitle());
- newEntry = resourceCollection.post(newEntry);
- System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
-
- System.out.println(">>> get id=" + newEntry.getId());
- Entry entry = resourceCollection.get(newEntry.getId().toString());
- System.out.println("<<< get id=" + entry.getId() + " entry=" + entry.getTitle());
-
- System.out.println(">>> put id=" + newEntry.getId() + " entry=" + entry.getTitle());
- resourceCollection.put(entry.getId().toString(), updateEntry(entry, "James Bond"));
- System.out.println("<<< put id=" + entry.getId() + " entry=" + entry.getTitle());
-
- System.out.println(">>> delete id=" + entry.getId());
- resourceCollection.delete(entry.getId().toString());
- System.out.println("<<< delete id=" + entry.getId());
-
- System.out.println(">>> get collection");
- Feed feed = resourceCollection.getFeed();
- System.out.println("<<< get collection");
- for (Object o : feed.getEntries()) {
- Entry e = (Entry)o;
- System.out.println("id = " + e.getId() + " entry = " + e.getTitle());
- }
- }
-
- private Entry newEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
- private Entry updateEntry(Entry entry, String value) {
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java
deleted file mode 100644
index 72101f1531..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ContentNegotiationTest.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.protocol.Response.ResponseType;
-import org.apache.abdera.protocol.client.AbderaClient;
-import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.RequestOptions;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
- * Tests use of content negotiation for Atom binding in Tuscany.
- * Uses the SCA provided Provider composite to act as a server.
- * Uses the Abdera provided Client to act as a client.
- */
-public class ContentNegotiationTest {
- public final static String providerURI = "http://localhost:8084/customer";
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
- protected static AbderaClient client;
- protected static Parser abderaParser;
- protected static String lastId;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>ContentNegotiationTest.init");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- abdera = new Abdera();
- client = new AbderaClient(abdera);
- abderaParser = Abdera.getNewParser();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>ContentNegotiationTest.destroy");
- scaProviderDomain.close();
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull( client );
- }
-
- @Test
- public void testPost() throws Exception {
- System.out.println(">>>ContentNegotiationTest.testPost");
- // Testing of entry creation
- Factory factory = abdera.getFactory();
- String customerName = "Fred Farkle";
- Entry entry = factory.newEntry();
- entry.setTitle("customer " + customerName);
- entry.setUpdated(new Date());
- entry.addAuthor("Apache Tuscany");
- // ID created by collection.
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(customerName);
- entry.setContentElement(content);
-
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- // AtomTestCaseUtils.printRequestHeaders( "Post request headers", " ", opts );
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- ClientResponse res = client.post(colUri.toString(), entry, opts);
-
- // Assert response status code is 201-OK.
- // Assert response header Content-Type: application/atom+xml; charset=UTF-8
- Assert.assertEquals(201, res.getStatus());
- String returnedContentType = res.getContentType().toString().trim();
- Assert.assertEquals(contentType, returnedContentType );
-
- String eTag = res.getHeader( "ETag" );
- if ( eTag != null)
- lastId = eTag.substring( 1, eTag.length()-1);
-
- // AtomTestCaseUtils.printResponseHeaders( "Entry post response headers:", " ", res );
- // System.out.println("Entry post response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
- }
-
- @Test
- public void testXMLEntryGet() throws Exception {
- System.out.println(">>>ContentNegotiationTest.testXMLEntryGet");
- RequestOptions opts = new RequestOptions();
- opts.setHeader( "Accept", "application/atom+xml" );
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
- Assert.assertEquals(200, res.getStatus());
- String returnedContentType = res.getContentType().toString().trim();
- // Assert.assertEquals(contentType, returnedContentType );
- res.release();
- }
-
- @Test
- public void testJSONEntryGet() throws Exception {
- System.out.println(">>>ContentNegotiationTest.testJSONEntryGet");
- RequestOptions opts = new RequestOptions();
- opts.setHeader( "Accept", "application/json" );
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- ClientResponse res = client.get(colUri.toString() + "/" + lastId, opts);
- try {
- Assert.assertEquals(200, res.getStatus());
- // Abdera 0.4 throws exception on getContentType with application/json.
- // System.out.println( "ContentNegotiationTest.testJSONEntryGet contentType=" + res.getContentType());
- String contentType = res.getHeader( "Content-Type");
- Assert.assertTrue( -1 < contentType.indexOf( "application/json" ));
- // Following is a poor man's JSONObject test to avoid dependency on JSON libs.
- // JSONObject jsonResp = new JSONObject(res.);
- // Assert.assertEquals(12345, jsonResp.getInt("result"));
- String responseBody = readResponse( res.getReader() );
- Assert.assertTrue( responseBody.startsWith( "{") );
- Assert.assertTrue( responseBody.endsWith( "}") );
- Assert.assertTrue( -1 < responseBody.indexOf( "\"id\"" ));
- Assert.assertTrue( -1 < responseBody.indexOf( "\"title\"" ));
- Assert.assertTrue( -1 < responseBody.indexOf( "\"updated\"" ));
- // AtomTestCaseUtils.printResponseHeaders( "JSON Entry response headers:", " ", res );
- // System.out.println( "ContentNegotiationTest.testJSONEntryGet JSON entry body=" + responseBody );
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testXMLFeedGet() throws Exception {
- System.out.println(">>>ContentNegotiationTest.testXMLFeedGet");
- RequestOptions opts = new RequestOptions();
- opts.setHeader( "Accept", "application/atom+xml" );
-
- // Atom feed request
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Asser feed provided since no predicates
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
- // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
-
- // Perform other tests on feed.
- Document<Feed> doc = res.getDocument();
- Assert.assertNotNull( doc );
- Feed feed = doc.getRoot();
- Assert.assertNotNull( feed );
- // RFC 4287 requires non-null id, title, updated elements
- Assert.assertNotNull( feed.getId() );
- Assert.assertNotNull( feed.getTitle() );
- Assert.assertNotNull( feed.getUpdated() );
- // AtomTestCaseUtils.printFeed( "Feed values", " ", feed );
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testJSONFeedGet() throws Exception {
- System.out.println(">>>ContentNegotiationTest.testJSONFeedGet");
- RequestOptions opts = new RequestOptions();
- opts.setHeader( "Accept", "application/json" );
-
- // JSON feed request
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Assert feed provided since no predicates
- Assert.assertEquals(200, res.getStatus());
- // Abdera 0.4 throws exception on getContentType with application/json.
- // System.out.println( "ContentNegotiationTest.testJSONEntryGet contentType=" + res.getContentType());
- String contentType = res.getHeader( "Content-Type");
- Assert.assertTrue( -1 < contentType.indexOf( "application/json" ));
- // Following is a poor man's JSONObject test to avoid dependency on JSON libs.
- // JSONObject jsonResp = new JSONObject(res.);
- // Assert.assertEquals(12345, jsonResp.getInt("result"));
- String responseBody = readResponse( res.getReader() );
- Assert.assertTrue( responseBody.startsWith( "{") );
- Assert.assertTrue( responseBody.endsWith( "}") );
- Assert.assertTrue( -1 < responseBody.indexOf( "\"id\"" ));
- Assert.assertTrue( -1 < responseBody.indexOf( "\"title\"" ));
- Assert.assertTrue( -1 < responseBody.indexOf( "\"updated\"" ));
- Assert.assertTrue( -1 < responseBody.indexOf( "\"entries\"" ));
- // AtomTestCaseUtils.printResponseHeaders( "JSON Entry response headers:", " ", res );
- // System.out.println( "ContentNegotiationTest.testJSONEntryGet JSON entry body=" + responseBody );
- } finally {
- res.release();
- }
- }
-
- protected String readResponse( Reader responseReader ) {
- if ( responseReader == null ) return "";
- StringBuffer sb = new StringBuffer(1024);
- try {
- int charValue = 0;
- while ((charValue = responseReader.read()) != -1) {
- //result = result + (char) charValue;
- sb.append((char)charValue);
- }
- } catch ( IOException e ) {
- }
- return sb.toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.java
deleted file mode 100644
index bc32b91367..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClient.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.binding.atom;
-
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-
-public interface CustomerClient {
-
- void testCustomerCollection() throws Exception;
-
- Collection getCustomerCollection();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.java
deleted file mode 100644
index 3e5705b14c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerClientImpl.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.binding.atom;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.osoa.sca.annotations.Reference;
-
-public class CustomerClientImpl implements CustomerClient {
-
- protected final Abdera abdera = new Abdera();
-
- @Reference
- public Collection customerCollection;
-
- public void testCustomerCollection() throws Exception {
-
- Entry newEntry = newEntry("Sponge Bob");
- System.out.println(">>> post entry=" + newEntry.getTitle());
- newEntry = customerCollection.post(newEntry);
- System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
-
- newEntry = newEntry("Jane Bond");
- System.out.println(">>> post entry=" + newEntry.getTitle());
- newEntry = customerCollection.post(newEntry);
- System.out.println("<<< post id=" + newEntry.getId() + " entry=" + newEntry.getTitle());
-
- System.out.println(">>> get id=" + newEntry.getId());
- Entry entry = customerCollection.get(newEntry.getId().toString());
- System.out.println("<<< get id=" + entry.getId() + " entry=" + entry.getTitle());
-
- System.out.println(">>> put id=" + newEntry.getId() + " entry=" + entry.getTitle());
- customerCollection.put(entry.getId().toString(), updateEntry(entry, "James Bond"));
- System.out.println("<<< put id=" + entry.getId() + " entry=" + entry.getTitle());
-
- System.out.println(">>> delete id=" + entry.getId());
- customerCollection.delete(entry.getId().toString());
- System.out.println("<<< delete id=" + entry.getId());
-
- System.out.println(">>> get collection");
- Feed feed = customerCollection.getFeed();
- System.out.println("<<< get collection");
- for (Object o : feed.getEntries()) {
- Entry e = (Entry)o;
- System.out.println("id = " + e.getId() + " entry = " + e.getTitle());
- }
- }
-
- public Collection getCustomerCollection() {
- return customerCollection;
- }
-
- private Entry newEntry(String value) {
-
- Entry entry = this.abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = this.abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
-
- entry.setContentElement(content);
-
- return entry;
- }
-
- private Entry updateEntry(Entry entry, String value) {
-
- entry.setTitle("customer " + value);
-
- Content content = this.abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
-
- entry.setContentElement(content);
-
- return entry;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
deleted file mode 100644
index db66b00a50..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerCollectionImpl.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("COMPOSITE")
-public class CustomerCollectionImpl implements Collection {
- private final Abdera abdera = new Abdera();
- private Map<String, Entry> entries = new HashMap<String, Entry>();
- public Date lastModified = new Date();
-
- /**
- * Default constructor
- */
- public CustomerCollectionImpl() {
-
- }
-
- public Entry post(Entry entry) {
- System.out.println(">>> CustomerCollectionImpl.post entry=" + entry.getTitle());
-
- if(!("Exception_Test".equalsIgnoreCase(entry.getTitle())))
- {
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
- entry.setId(id);
-
- entry.addLink("" + id, "edit");
- entry.addLink("" + id, "alternate");
- Date now = new Date();
- entry.setUpdated(now);
- lastModified = now;
- entries.put(id, entry);
-
- System.out.println(">>> CustomerCollectionImpl.post return id=" + id);
-
- return entry;
-
- }
- else
- {
- throw new IllegalArgumentException("Exception in Post method");
- }
- }
-
- public Entry get(String id) {
- System.out.println(">>> CustomerCollectionImpl.get id=" + id);
- return entries.get(id);
- }
-
- public void put(String id, Entry entry) throws NotFoundException {
- System.out.println(">>> CustomerCollectionImpl.put id=" + id + " entry=" + entry.getTitle());
- if(entries.containsKey(id)){
- Date now = new Date();
- entry.setUpdated(now);
- lastModified = now;
- entries.put(id, entry);
- }
- else {
- throw new NotFoundException();
- }
- }
-
- public void delete(String id) throws NotFoundException {
- System.out.println(">>> CustomerCollectionImpl.delete id=" + id);
- if(entries.containsKey(id)){
- entries.remove(id);
- lastModified = new Date();
- }
- else {
- throw new NotFoundException();
- }
- }
-
- public Feed getFeed() {
- System.out.println(">>> CustomerCollectionImpl.getFeed");
-
- Feed feed = this.abdera.getFactory().newFeed();
- feed.setId("customers" + this.hashCode() ); // provide unique id for feed instance.
- feed.setTitle("customers");
- feed.setSubtitle("This is a sample feed");
- feed.setUpdated(lastModified);
- feed.addLink("");
- feed.addLink("", "self");
-
- for (Entry entry : entries.values()) {
- feed.addEntry(entry);
- }
-
- return feed;
- }
-
- public Feed query(String queryString) {
- System.out.println(">>> CustomerCollectionImpl.query collection " + queryString);
- return getFeed();
- }
-
- // This method used for testing.
- protected void testPut(String value) {
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
-
- Entry entry = abdera.getFactory().newEntry();
- entry.setId(id);
- entry.setTitle("customer " + value);
-
- Content content = this.abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
-
- entry.setContentElement(content);
-
- entry.addLink("" + id, "edit");
- entry.addLink("" + id, "alternate");
-
- entry.setUpdated(new Date());
-
- entries.put(id, entry);
- System.out.println(">>> id=" + id);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerNonCollectionImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerNonCollectionImpl.java
deleted file mode 100644
index a25e19838f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/CustomerNonCollectionImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * Implementation of an Atom feed that does not implement the Collections
- * interface but does have a getAll() method that will be used by the Atom
- * binding to get the feed entries.
- */
-@Scope("COMPOSITE")
-public class CustomerNonCollectionImpl {
- /**
- * All feed entries.
- * This is set directly by the unit tests.
- * @see AtomFeedNonCollectionTest
- */
- public static Entry<Object, Object>[] entries;
-
- /**
- * Default constructor
- */
- public CustomerNonCollectionImpl() {
- }
-
- /**
- * Get all entries for this feed.
- *
- * @return All entries for this feed
- */
- public Entry<Object, Object>[] getAll() {
- return entries;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionImpl.java
deleted file mode 100644
index 385510b93f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionImpl.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.tuscany.sca.binding.atom.collection.MediaCollection;
-import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("COMPOSITE")
-public class MediaCollectionImpl implements MediaCollection {
- private final Abdera abdera = new Abdera();
- private Map<String, Entry> entries = new HashMap<String, Entry>();
- private Map<String, String> mediaFiles = new HashMap<String, String>();
- public Date lastModified = new Date();
-
- public Entry post(Entry entry) {
- System.out.println(">>> MediaCollectionImpl.post entry=" + entry.getTitle());
-
- if(!("Exception_Test".equalsIgnoreCase(entry.getTitle())))
- {
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
- entry.setId(id);
-
- entry.addLink("" + id, "edit");
- entry.addLink("" + id, "alternate");
- Date now = new Date();
- entry.setUpdated(now);
- lastModified = now;
- entries.put(id, entry);
-
- System.out.println(">>> MediaCollectionImpl.post return id=" + id);
-
- return entry;
-
- }
- else
- {
- throw new IllegalArgumentException("Exception in Post method");
- }
- }
-
- public Entry get(String id) {
- System.out.println(">>> MediaCollectionImpl.get id=" + id);
- return entries.get(id);
- }
-
- public void put(String id, Entry entry) throws NotFoundException {
- System.out.println(">>> MediaCollectionImpl.put id=" + id + " entry=" + entry.getTitle());
- if(entries.containsKey(id)){
- Date now = new Date();
- entry.setUpdated(now);
- lastModified = now;
- entries.put(id, entry);
- }
- else {
- throw new NotFoundException();
- }
- }
-
- public void delete(String id) throws NotFoundException {
- System.out.println(">>> MediaCollectionImpl.delete id=" + id);
- if(entries.containsKey(id)){
- entries.remove(id);
- lastModified = new Date();
- }
- else {
- throw new NotFoundException();
- }
- }
-
- public Feed getFeed() {
- System.out.println(">>> MediaCollectionImpl.getFeed");
-
- Feed feed = this.abdera.getFactory().newFeed();
- feed.setId("customers" + this.hashCode() ); // provide unique id for feed instance.
- feed.setTitle("customers");
- feed.setSubtitle("This is a sample feed");
- feed.setUpdated(lastModified);
- feed.addLink("");
- feed.addLink("", "self");
-
- for (Entry entry : entries.values()) {
- feed.addEntry(entry);
- }
-
- return feed;
- }
-
- public Feed query(String queryString) {
- System.out.println(">>> MediaCollectionImpl.query collection " + queryString);
- return getFeed();
- }
-
- // This method used for testing.
- protected void testPut(String value) {
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
-
- Entry entry = abdera.getFactory().newEntry();
- entry.setId(id);
- entry.setTitle("customer " + value);
-
- Content content = this.abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
-
- entry.setContentElement(content);
-
- entry.addLink("" + id, "edit");
- entry.addLink("" + id, "alternate");
-
- entry.setUpdated(new Date());
-
- entries.put(id, entry);
- System.out.println(">>> id=" + id);
- }
-
- // MediaCollection role
- public Entry postMedia(String title, String slug, String contentType, InputStream media) {
- System.out.println(">>> MediaCollectionImpl.postMedia title=" + title + ", slug=" + slug + ", contentType=" + contentType );
-
- Factory factory = abdera.getFactory();
- Entry entry = factory.newEntry();
- // Must provide entry to media as per Atom Pub spec (http://tools.ietf.org/html/rfc5023#section-9.6)
- // <?xml version="1.0"?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>The Beach</title> (REQUIRED)
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> (REQUIRED)
- // <updated>2005-10-07T17:17:08Z</updated>
- // <summary type="text" /> (REQUIRED, OPTIONAL to populate
- // <content type="image/png" src="http://media.example.org/the_beach.png"/>
- // <link rel="edit-media" href="http://media.example.org/edit/the_beach.png" />
- // <link rel="edit" href="http://example.org/media/edit/the_beach.atom" />
- // </entry>
-
- // Normalize title
- entry.setTitle( title );
- String normalTitle = title.replace( " ", "_" );
- String hostURL = "http://media.example.org/";
- int lastDelimiterPos = contentType != null ? contentType.lastIndexOf( "/" ) : -1;
- String extension = "";
- if ( lastDelimiterPos != -1 ) {
- extension = contentType.substring( lastDelimiterPos + 1 );
- } else {
- extension = contentType;
- }
- long mediaLength = -1;
- try {
- mediaLength = media.skip( Long.MAX_VALUE );
- } catch ( IOException e ){}
-
- // A true implementation would store the media to a repository, e.g. file system.
- // This implementation record's the id and the location.
- String id = "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a-" + mediaFiles.size();
- String reposLocation = hostURL + "edit/" + normalTitle;
- mediaFiles.put( id, reposLocation );
-
- // Build entry for media link.
- entry.setUpdated( new Date() );
- entry.setId( id );
- // Convention. Return header properties as key values.
- entry.setSummary( "Content-Type=" + contentType + ",Content-Length=" + mediaLength );
- entry.setContent( new IRI( hostURL + normalTitle + "." + extension ), contentType );
- entry.addLink( reposLocation + ".atom", "edit" );
- entry.addLink( reposLocation + "." + extension, "edit-media" );
- return entry;
- }
-
- public void putMedia(String id, String contentType, InputStream media) throws NotFoundException {
- System.out.println(">>> MediaCollectionImpl.putMedia id=" + id + ", contentType=" + contentType );
-
- // Must responsd with success or not found as per Atom Pub spec (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Body is null.
- if ( !id.endsWith( "0" ) )
- throw new NotFoundException( "Media at id=" + id + " not found." );
-
- // A true implementation would update the media in the media repository.
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java
deleted file mode 100644
index 2ed0729b00..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/MediaCollectionTestCase.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Link;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.protocol.client.AbderaClient;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
-import org.apache.commons.httpclient.methods.PostMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests use of server provided entry entity tags for Atom binding in Tuscany.
- * Tests conditional gets (e.g. get if-none-match) or conditional posts (post if-match)
- * using entity tags or last modified header entries.
- * Uses the SCA provided Provider composite to act as a server.
- * Uses the Abdera provided Client to act as a client.
- */
-public class MediaCollectionTestCase {
- public final static String providerURI = "http://localhost:8084/receipt";
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
- protected static AbderaClient client;
- protected static Parser abderaParser;
- protected static String eTag;
- protected static Date lastModified;
- protected static String mediaId;
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>MediaCollectionTestCase.init");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite");
- abdera = new Abdera();
- client = new AbderaClient(abdera);
- abderaParser = Abdera.getNewParser();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>MediaCollectionTestCase.destroy");
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull( client );
- }
-
- @Test
- public void testMediaEntryPost() throws Exception {
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Post request
- // POST /edit/ HTTP/1.1
- // Host: media.example.org
- // Content-Type: image/png
- // Slug: The Beach
- // Content-Length: nnn
- // ...binary data...
-
- // Testing of entry creation
- String receiptName = "Auto Repair Bill";
- String fileName = "target/test-classes/ReceiptToms.gif";
- File input = new File( fileName );
- boolean exists = input.exists();
- Assert.assertTrue( exists );
-
- // Prepare HTTP post
- // PostMethod post = new PostMethod( colUri.toString() );
- PostMethod post = new PostMethod( providerURI );
- post.addRequestHeader( "Content-Type", "image/gif" );
- post.addRequestHeader( "Title", "Title " + receiptName + "" );
- post.addRequestHeader( "Slug", "Slug " + receiptName + "" );
- post.setRequestEntity( new InputStreamRequestEntity( new FileInputStream( input ), "image/gif" ) );
-
- // Get HTTP client
- HttpClient httpclient = new HttpClient();
- try {
- // Execute request
- int result = httpclient.executeMethod(post);
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Post response
- // Tuscany responds with proper media links. Note that the media is
- // stored in a different location than the media information which is
- // stored in the Atom feed.
- // HTTP/1.1 201 Created
- // Display status code
- // System.out.println("Response status code: " + result + ", status text=" + post.getStatusText() );
- Assert.assertEquals(201, result );
- // Display response
- // System.out.println("Response body: ");
- // System.out.println(post.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream
-
- // Location: http://example.org/media/edit/the_beach.atom (REQUIRED)
- // System.out.println( "Response Location=" + post.getResponseHeader( "Location" ).getValue() + "." );
- Header header = post.getResponseHeader( "Location" );
- Assert.assertNotNull( header );
- Assert.assertNotNull( header.getValue() );
- // ContentLocation: http://example.org/media/edit/the_beach.jpg (REQUIRED)
- // System.out.println( "Response Content-Location=" + post.getResponseHeader( "Content-Location" ).getValue() );
- header = post.getResponseHeader( "Content-Location" );
- Assert.assertNotNull( header );
- Assert.assertNotNull( header.getValue() );
- // Content-Type: application/atom+xml;type=entry;charset="utf-8"
- // System.out.println( "Response Content-Type=" + post.getResponseHeader( "Content-Type" ).getValue());
- header = post.getResponseHeader( "Content-Type" );
- Assert.assertNotNull( header );
- Assert.assertNotNull( header.getValue() );
- // Content-Length: nnn (OPTIONAL)
- // System.out.println( "Response Content-Length=" + post.getResponseHeader( "Content-Length" ).getValue() );
- header = post.getResponseHeader( "Content-Length" );
- Assert.assertNotNull( header );
- Assert.assertNotNull( header.getValue() );
- // <?xml version="1.0"?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>The Beach</title> (REQUIRED)
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> (REQUIRED)
- // <updated>2005-10-07T17:17:08Z</updated>
- // <author><name>Daffy</name></author>
- // <summary type="text" /> (REQUIRED, OPTIONAL to populate
- // <content type="image/png" src="http://media.example.org/the_beach.png"/>
- // <link rel="edit-media" href="http://media.example.org/edit/the_beach.png" />
- // <link rel="edit" href="http://example.org/media/edit/the_beach.atom" />
- // </entry>
- Document<Entry> document = abderaParser.parse( post.getResponseBodyAsStream() );
- Entry entry = document.getRoot();
- String title = entry.getTitle();
- // System.out.println( "mediaPost entry.title=" + title );
- Assert.assertNotNull( title );
- IRI id = entry.getId();
- // System.out.println( "mediaPost entry.id=" + id );
- Assert.assertNotNull( id );
- mediaId = id.toString();
- Assert.assertNotNull( mediaId ); // Save for put/update request
- Date updated = entry.getUpdated();
- // System.out.println( "mediaPost entry.updated=" + updated);
- Assert.assertNotNull( updated );
- String summary = entry.getSummary();
- // System.out.println( "mediaPost entry.summary=" + summary);
- Assert.assertNotNull( summary );
- IRI contentSrc = entry.getContentSrc();
- // System.out.println( "mediaPost entry.content.src=" + contentSrc + ", type=" + entry.getContentType());
- Assert.assertNotNull( contentSrc );
- Link editLink = entry.getEditLink();
- // System.out.println( "mediaPost entry.editLink" + " rel=" + editLink.getRel() + ", href=" + editLink.getHref() );
- Assert.assertNotNull( editLink );
- Assert.assertNotNull( editLink.getRel() );
- Assert.assertNotNull( editLink.getHref() );
- Link editMediaLink = entry.getEditMediaLink();
- // System.out.println( "mediaPost entry.editMediaLink" + " rel=" + editMediaLink.getRel() + ", href=" + editMediaLink.getHref() );
- Assert.assertNotNull( editMediaLink );
- Assert.assertNotNull( editMediaLink.getRel() );
- Assert.assertNotNull( editMediaLink.getHref() );
-
- } finally {
- // Release current connection to the connection pool once you are done
- post.releaseConnection();
- }
- }
-
- @Test
- public void testMediaEntryPutFound() throws Exception {
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Testing of entry update
- String receiptName = "Value Autoglass Bill";
- String fileName = "target/test-classes/ReceiptValue.jpg";
- File input = new File( fileName );
- boolean exists = input.exists();
- Assert.assertTrue( exists );
-
- // Prepare HTTP put request
- // PUT /edit/the_beach.png HTTP/1.1
- // Host: media.example.org
- // Content-Type: image/png
- // Content-Length: nnn
- // ...binary data...
- PutMethod put = new PutMethod( providerURI + "/" + mediaId );
- put.addRequestHeader( "Content-Type", "image/jpg" );
- put.addRequestHeader( "Title", "Title " + receiptName + "" );
- put.addRequestHeader( "Slug", "Slug " + receiptName + "" );
- put.setRequestEntity(
- new InputStreamRequestEntity( new FileInputStream( input ), "image/jpg" ) );
-
- // Get HTTP client
- HttpClient httpclient = new HttpClient();
- try {
- // Execute request
- int result = httpclient.executeMethod(put);
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Display status code
- // System.out.println("Response status code: " + result + ", status text=" + put.getStatusText() );
- Assert.assertEquals(200, result );
- // Display response. Should be empty for put.
- // System.out.println("Response body: ");
- // System.out.println(put.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream
- } finally {
- // Release current connection to the connection pool once you are done
- put.releaseConnection();
- }
- }
-
- @Test
- public void testMediaEntryPutNotFound() throws Exception {
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Testing of entry update
- String receiptName = "Value Autoglass Bill";
- String fileName = "target/test-classes/ReceiptValue.jpg";
- File input = new File( fileName );
- boolean exists = input.exists();
- Assert.assertTrue( exists );
-
- // Prepare HTTP put request
- // PUT /edit/the_beach.png HTTP/1.1
- // Host: media.example.org
- // Content-Type: image/png
- // Content-Length: nnn
- // ...binary data...
- PutMethod put = new PutMethod( providerURI + "/" + mediaId + "-bogus" ); // Does not exist.
- put.addRequestHeader( "Content-Type", "image/jpg" );
- put.addRequestHeader( "Title", "Title " + receiptName + "" );
- put.addRequestHeader( "Slug", "Slug " + receiptName + "" );
- put.setRequestEntity(
- new InputStreamRequestEntity( new FileInputStream( input ), "image/jpg" ) );
-
- // Get HTTP client
- HttpClient httpclient = new HttpClient();
- try {
- // Execute request
- int result = httpclient.executeMethod(put);
- // Pseudo Code (see APP (http://tools.ietf.org/html/rfc5023#section-9.6)
- // Display status code
- // System.out.println("Response status code: " + result + ", status text=" + put.getStatusText() );
- Assert.assertEquals(404, result );
- // Display response. Should be empty for put.
- // System.out.println("Response body: ");
- // System.out.println(put.getResponseBodyAsString()); // Warning: BodyAsString recommends BodyAsStream
- } finally {
- // Release current connection to the connection pool once you are done
- put.releaseConnection();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.java
deleted file mode 100644
index 3e1bf543e5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/Provider.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.binding.atom;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Provider {
-
- public static void main(String[] args) {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- System.out.println("Provider.composite ready...");
-
- try {
- System.in.read();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java
deleted file mode 100644
index c209e2dfe6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderEntryEntityTagsTestCase.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.protocol.client.AbderaClient;
-import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.RequestOptions;
-import org.apache.abdera.protocol.client.util.BaseRequestEntity;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests use of server provided entry entity tags for Atom binding in Tuscany.
- * Tests conditional gets (e.g. get if-none-match) or conditional posts (post if-match)
- * using entity tags or last modified header entries.
- * Uses the SCA provided Provider composite to act as a server.
- * Uses the Abdera provided Client to act as a client.
- */
-public class ProviderEntryEntityTagsTestCase {
- public final static String providerURI = "http://localhost:8084/customer";
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
- protected static AbderaClient client;
- protected static Parser abderaParser;
- protected static String eTag;
- protected static Date lastModified;
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>ProviderEntryEntityTagsTestCase.init");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- abdera = new Abdera();
- client = new AbderaClient(abdera);
- abderaParser = Abdera.getNewParser();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>ProviderEntryEntityTagsTestCase.destroy");
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull( client );
- }
-
- @Test
- public void testEmptyCachePost() throws Exception {
- // Pseudo-code
- // 1) Example HTTP POST request (new entry put, new etag response)
- // User client post request
- // POST /myblog/entries HTTP/1.1
- // Slug: First Post
- //
- // <?xml version="1.0" ?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>Atom-Powered Robots Run Amok</title>
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- // <updated>2007-02-123T17:09:02Z</updated>
- // <author><name>Captain Lansing</name></author>
- // <content>It's something moving... solid metal</content>
- // </entry>
-
- // Expected Atom server response (note unique ETag)
- // HTTP/1.1 201 Created
- // Date: Fri, 23 Feb 2007 21:17:11 GMT
- // Content-Length: nnn
- // Content-Type: application/atom+xml;type=entry
- // Location: http://example.org/edit/first-post.atom
- // Content-Location: http://example.org/edit/first-post.atom
- // ETag: "e180ee84f0671b1"
- // Last-Modified: Fri, 25 Jul 2008 14:36:44 -0500
- //
- // <?xml version="1.0" ?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>Atom-Powered Robots Run Amok</title>
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- // <updated>2007-02-123T17:09:02Z</updated>
- // <author><name>Captain Lansing</name></author>
- // <content>It's something moving... solid metal</content>
- // </entry>
-
- // Testing of entry creation
- Factory factory = abdera.getFactory();
- String customerName = "Fred Farkle";
- Entry entry = factory.newEntry();
- entry.setTitle("customer " + customerName);
- entry.setUpdated(new Date());
- entry.addAuthor("Apache Tuscany");
- // ID created by collection.
- // entry.setId(id); // auto-provided
- // entry.addLink("" + id, "edit"); // auto-provided
- // entry.addLink("" + id, "alternate"); // auto-provided
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(customerName);
- entry.setContentElement(content);
-
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- // AtomTestCaseUtils.printRequestHeaders( "Post request headers", " ", opts );
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- ClientResponse res = client.post(colUri.toString(), entry, opts);
-
- // Assert response status code is 201-OK.
- // Assert response header Content-Type: application/atom+xml; charset=UTF-8
- // Assert response header Location: http://example.org/edit/first-post.atom
- // Assert response header Content-Location: http://example.org/edit/first-post.atom
- // Assert response header ETag: "e180ee84f0671b1"
- // Assert response header Last-Modified: Fri, 25 Jul 2008 14:36:44 -0500
- // Assert collection size is 1.
- Assert.assertEquals(201, res.getStatus());
- Assert.assertEquals(contentType, res.getContentType().toString().trim());
- // Assert.assertNotNull( res.getLocation().toString() );
- // Assert.assertEquals( "", res.getContentLocation().toString() );
- // Save eTag for subsequent tests;
- eTag = res.getHeader( "ETag" );
- Assert.assertNotNull( eTag );
- lastModified = res.getLastModified();
- Assert.assertNotNull(lastModified);
- }
-
- @Test
- public void testDirtyCachePut() throws Exception {
- // 2) Conditional PUT request (post with etag. entry provided is stale)
- // User client PUT request
- // PUT /edit/first-post.atom HTTP/1.1
- // > If-Match: "e180ee84f0671b1"
- //
- // <?xml version="1.0" ?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>Atom-Powered Robots Run Amok</title>
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- // <updated>2007-02-24T16:34:06Z</updated>
- // <author><name>Captain Lansing</name></author>
- // <content>Update: it's a hoax!</content>
- // </entry>
- // Testing of entry creation
- Factory factory = abdera.getFactory();
- String customerName = "Molly Ringwald";
- Entry entry = factory.newEntry();
- entry.setTitle("customer " + customerName);
- entry.setUpdated( new Date());
- entry.addAuthor("Apache Tuscany");
- String id = eTag.substring( 1, eTag.length()-1);
- entry.setId(id); // auto-provided
- // entry.addLink("" + id, "edit"); // auto-provided
- // entry.addLink("" + id, "alternate"); // auto-provided
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(customerName);
- entry.setContentElement(content);
-
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-None-Match", eTag);
-
- // AtomTestCaseUtils.printRequestHeaders( "Put request headers", " ", opts );
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.put(colUri.toString() + "/" + id, new BaseRequestEntity( entry ), opts);
- // Expected Atom server response (item was edited by another user)
- // > HTTP/1.1 412 Precondition Failed
- // Date: Sat, 24 Feb 2007 16:34:11 GMT
-
- // If-Match Assert response status code is 412. Precondition failed.
- // If-None-Match Assert response status code is 200. OK
- Assert.assertEquals(200, res.getStatus());
- // Put provides null body and no etags.
- res.release();
- }
-
- @Test
- public void testETagMissGet() throws Exception {
- // 4) Conditional GET example (get with etag. etag not in cache)
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // > If-None-Match: "e180ee84f0671b1"
-
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-None-Match", "123456");
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
- // Expected Atom server response (item was edited by another user)
- // > HTTP/1.1 412 Precondition Failed
- // Date: Sat, 24 Feb 2007 16:34:11 GMT
-
- // Atom server response (item was up to date)
- // > HTTP/1.1 200 OK
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
- // > ETag: "bb4f5e86e92ddb8549604a0df0763581"
- // > Last-Modified: Mon, 28 Jul 2008 10:25:37 -0500
-
- // Assert response status code is 200 OK.
- // Assert header Content-Type: application/atom+xml;type=entry
- // Assert header Location: http://example.org/edit/first-post.atom
- // Assert header Content-Location: http://example.org/edit/first-post.atom
- // Assert header ETag: "555555" (etag response != etag request)
- // Assert header Last-Modified: Fri, 25 Jul 2008 14:36:44 -0500
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(contentType, res.getContentType().toString().trim());
- // Assert.assertNotNull( res.getLocation().toString() );
- // Assert.assertEquals( "", res.getContentLocation().toString() );
- Assert.assertNotNull( res.getHeader( "ETag" ) );
- lastModified = res.getLastModified();
- Assert.assertNotNull(lastModified);
- res.release();
- }
-
- @Test
- public void testETagHitGet() throws Exception {
- // 3) Conditional GET example (get with etag. etag match)
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // > If-None-Match: "e180ee84f0671b1"
-
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-None-Match", eTag);
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
- // Atom server response (item was up to date)
- // > HTTP/1.1 304 Not Modified
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
-
- // Assert response status code is 304 Not Modified.
- // Assert header ETag: "e180ee84f0671b1"
- // Assert header Last-Modified: Fri, 25 Jul 2008 14:36:44 -0500
- // Assert.assertEquals(304, res.getStatus());
- res.release();
- }
-
-
- @Test
- public void testUpToDateGet() throws Exception {
- // 3) Conditional GET example (get with If-Mod. entry is up to date)
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // > If-Modified-Since: Sat, 29 Oct 2025 19:43:31 GMT
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-Modified-Since", "Sat, 29 Oct 2025 19:43:31 GMT"); // "EEE, dd MMM yyyy HH:mm:ss Z // RFC 822 Date
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
- ClientResponse res = client.execute( "GET", colUri.toString(), (BaseRequestEntity)null, opts);
-
- // Atom server response (item was up to date)
- // > HTTP/1.1 304 Not Modified
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
-
- // Assert response status code is 304 Not Modified.
- Assert.assertEquals(304, res.getStatus());
- res.release();
- }
-
- @Test
- public void testOutOfDateGet() throws Exception {
- // 4) Conditional GET example (get with If-Mod. entry is not to date)
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // > If-Modified-Since: Sat, 29 Oct 1844 19:43:31 GMT
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-Modified-Since", "Sat, 29 Oct 1844 19:43:31 GMT"); // "EEE, dd MMM yyyy HH:mm:ss Z // RFC 822 Date
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
-
- // Atom server response (item was up to date)
- // > HTTP/1.1 200 OK
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
- // > ETag: "bb4f5e86e92ddb8549604a0df0763581"
- // > Last-Modified: Mon, 28 Jul 2008 10:25:37 -0500
-
- // Assert response status code is 200 OK.
- // Assert header ETag: "e180ee84f0671b1"
- // Assert header Last-Modified: Greater than If-Mod
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(contentType, res.getContentType().toString().trim());
- // Assert.assertNotNull( res.getLocation().toString() );
- // Assert.assertEquals( "", res.getContentLocation().toString() );
- Assert.assertNotNull( res.getHeader( "ETag" ) );
- lastModified = res.getLastModified();
- Assert.assertNotNull(lastModified);
- res.release();
- }
-
- @Test
- public void testUpToDateUnModGet() throws Exception {
- // 3) Conditional GET example (get with If-Unmod. entry is not modified (< predicate date).
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // > If-Unmodified-Since: Sat, 29 Oct 2025 19:43:31 GMT
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 2050 19:43:31 GMT" );
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
-
- // Atom server response (item was up to date)
- // > HTTP/1.1 200 OK
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
- // > ETag: "bb4f5e86e92ddb8549604a0df0763581"
- // > Last-Modified: Mon, 28 Jul 2008 10:25:37 -0500
-
- // Assert response status code is 200 OK.
- // Assert header Content-Type: application/atom+xml;type=entry
- // Assert header Location: http://example.org/edit/first-post.atom
- // Assert header Content-Location: http://example.org/edit/first-post.atom
- // Assert header ETag: "e180ee84f0671b1"
- // Assert header Last-Modified: Less than If-Unmod
- Assert.assertEquals(200, res.getStatus());
- res.release();
- }
-
- @Test
- public void testOutOfDateUnModGet() throws Exception {
- // 4) Conditional GET example (get with If-Unmod. entry is modified (> predicate date)
- // User client GET request
- // GET /edit/first-post.atom HTTP/1.1
- // Host: example.org
- // > If-Unmodified-Since: Sat, 29 Oct 1844 19:43:31 GMT
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- opts.setHeader( "If-Unmodified-Since", "Sat, 29 Oct 1844 19:43:31 GMT" );
- opts.setHeader( "Pragma", "no-cache"); // turn off client caching
-
- IRI colUri = new IRI(providerURI).resolve("customer");
- // res = client.post(colUri.toString() + "?test=foo", entry, opts);
- String id = eTag.substring( 1, eTag.length()-1);
- // Warning. AbderaClient.put(String uri,Base base,RequestOptions options) caches on the client side.
- // ClientResponse res = client.put(colUri.toString() + id, entry, opts);
- ClientResponse res = client.get(colUri.toString() + "/" + id, opts);
-
- // Atom server response (item was up to date)
- // > HTTP/1.1 304 Not Modified
- // Date: Sat, 24 Feb 2007 13:17:11 GMT
-
- // Assert response status code is 304 Not Modified.
- Assert.assertEquals(304, res.getStatus());
- res.release();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java
deleted file mode 100644
index 42edeb8f0d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderFeedEntityTagsTestCase.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.factory.Factory;
-import org.apache.abdera.i18n.iri.IRI;
-import org.apache.abdera.model.Collection;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.protocol.Response.ResponseType;
-import org.apache.abdera.protocol.client.AbderaClient;
-import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.abdera.protocol.client.RequestOptions;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests use of server provided feed entity tags for Atom binding in Tuscany.
- * Tests conditional gets (e.g. get if-none-match) or conditional posts (post if-match)
- * using entity tags and last modified entries in headers.
- * Uses the SCA provided Provider composite to act as a server.
- * Uses the Abdera provided Client to act as a client.
- */
-public class ProviderFeedEntityTagsTestCase {
- public final static String providerURI = "http://localhost:8084/customer";
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
- protected static AbderaClient client;
- protected static Parser abderaParser;
- protected static String eTag;
- protected static Date lastModified;
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.init");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- abdera = new Abdera();
- client = new AbderaClient(abdera);
- abderaParser = Abdera.getNewParser();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.destroy");
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull( client );
- }
-
- @Test
- public void testFeedBasics() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedBasics");
- // Normal feed request
- ClientResponse res = client.get(providerURI);
- Assert.assertNotNull(res);
- try {
- // Assert feed provided since no predicates
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
- // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
-
- // Perform other tests on feed.
- // Warning. AbderaClient.getEntityTag is very particular on tag pattern.
- // Document<Feed> doc = res.getDocument();
- String body = read( res.getInputStream() );
- // RFC 4287 requires non-null id, title, updated elements
- Assert.assertTrue( -1 != body.indexOf( "</id>" ));
- Assert.assertTrue( -1 != body.indexOf( "</title>" ));
- Assert.assertTrue( -1 != body.indexOf( "</updated>" ));
-
- eTag = res.getHeader("ETag");
- Assert.assertNotNull( eTag );
- lastModified = res.getLastModified();
- Assert.assertNotNull( lastModified );
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testUnmodifiedGetIfMatch() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfMatch");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Match", eTag);
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- String thisETag = res.getHeader("ETag");
- Assert.assertNotNull( thisETag );
- Date thisLastModified = res.getLastModified();
- Assert.assertNotNull( thisLastModified );
-
- // Should return 200 - Feed provided since it matches etag.
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
- // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testUnmodifiedGetIfNoneMatch() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfNoneMatch");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-None-Match", eTag);
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 304 - Feed not provided since it matches ETag.
- Assert.assertEquals(304, res.getStatus());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testUnmodifiedGetIfUnModified() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfUnModified");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date() ));
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 304 - Feed not provided since feed is modified since.
- Assert.assertEquals(304, res.getStatus());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testUnmodifiedGetIfModified() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfModified");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Modified-Since", dateFormat.format( new Date( 0 ) ));
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 200 - Feed provided since feed is changed.
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
-
- String thisETag = res.getHeader("ETag");
- Assert.assertNotNull( thisETag );
- Date thisLastModified = res.getLastModified();
- Assert.assertNotNull( thisLastModified );
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testModifiedGetIfNoneMatch() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfNoneMatch");
- // Post some new content to the feed.
- Factory factory = abdera.getFactory();
- String customerName = "Fred Farkle";
- Entry entry = factory.newEntry();
- entry.setTitle("customer " + customerName);
- entry.setUpdated(new Date());
- entry.addAuthor("Apache Tuscany");
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(customerName);
- entry.setContentElement(content);
-
- RequestOptions opts = new RequestOptions();
- String contentType = "application/atom+xml; type=entry";
- opts.setContentType(contentType);
- IRI colUri = new IRI(providerURI).resolve("customer");
- ClientResponse res = client.post(colUri.toString(), entry, opts);
-
- // Feed request with predicates
- opts = new RequestOptions();
- contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-None-Match", eTag);
-
- res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 304 - Feed not provided since it matches ETag.
- Assert.assertEquals(304, res.getStatus());
- // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testModifiedGetIfMatch() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedModifiedGetIfMatch");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Match", eTag);
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- String thisETag = res.getHeader("ETag");
- Assert.assertNotNull( thisETag );
- Date thisLastModified = res.getLastModified();
- Assert.assertNotNull( thisLastModified );
-
- // Should return 200 - value since feed is changed
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
-
- // AtomTestCaseUtils.printResponseHeaders( "Feed modified if-none-match response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testModifiedGetIfUnModified() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfUnModified");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Unmodified-Since", dateFormat.format( new Date() ));
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 304 - Feed not provided since feed is modified since.
- Assert.assertEquals(304, res.getStatus());
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testModifiedGetIfModified() throws Exception {
- System.out.println(">>>ProviderFeedEntityTagsTestCase.testFeedUnmodifiedGetIfModified");
- // Feed request with predicates
- RequestOptions opts = new RequestOptions();
- final String contentType = "application/atom+xml";
- opts.setContentType(contentType);
- opts.setHeader( "If-Modified-Since", dateFormat.format( lastModified ));
-
- ClientResponse res = client.get(providerURI, opts);
- Assert.assertNotNull(res);
- try {
- // Should return 200 - Feed provided since feed is changed.
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
-
- String thisETag = res.getHeader("ETag");
- Assert.assertNotNull( thisETag );
- Date thisLastModified = res.getLastModified();
- Assert.assertNotNull( thisLastModified );
- } finally {
- res.release();
- }
- }
-
-
- public static void printFeed( String title, String indent, Feed feed ) {
- if ( feed == null ) {
- System.out.println( title + " feed is null");
- return;
- }
-
- System.out.println( title );
- System.out.println( indent + "id=" + feed.getId() );
- System.out.println( indent + "title=" + feed.getTitle() );
- System.out.println( indent + "updated=" + feed.getUpdated() );
- System.out.println( indent + "author=" + feed.getAuthor() );
- Collection collection = feed.getCollection();
- if ( collection == null ) {
- System.out.println( indent + "collection=null" );
- } else {
- System.out.println( indent + "collection=" + collection );
- }
- // System.out.println( indent + "collection size=" + feed.getCollection() );
- // for (Collection collection : workspace.getCollections()) {
- // if (collection.getTitle().equals("customers")) {
- // String expected = uri + "customers";
- // String actual = collection.getResolvedHref().toString();
- // assertEquals(expected, actual);
- // }
- // }
-
- }
-
- /**
- * Read response ream from the given socket.
- * @param socket
- * @return
- * @throws IOException
- */
- private static String read(InputStream inputStream) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader( inputStream ));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderServiceDocumentTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderServiceDocumentTestCase.java
deleted file mode 100644
index 0d4194070d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/ProviderServiceDocumentTestCase.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import junit.framework.Assert;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Content;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.model.Service;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.protocol.Response.ResponseType;
-import org.apache.abdera.protocol.client.AbderaClient;
-import org.apache.abdera.protocol.client.ClientResponse;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests use of service documents provided by atom binding based collections.
- * Uses the SCA provided Provider composite to act as a server.
- * Uses the Abdera provided Client to act as a client.
- */
-public class ProviderServiceDocumentTestCase {
- public final static String providerURI = "http://localhost:8084/customer";
- protected static SCADomain scaProviderDomain;
- protected static SCADomain scaConsumerDomain;
- protected static CustomerClient testService;
- protected static Abdera abdera;
- protected static AbderaClient client;
- protected static Parser abderaParser;
-
- @BeforeClass
- public static void init() throws Exception {
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- abdera = new Abdera();
- client = new AbderaClient(abdera);
- abderaParser = Abdera.getNewParser();
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull( client );
- }
-
- @Test
- public void testFeedBasics() throws Exception {
- // Normal feed request
- ClientResponse res = client.get(providerURI);
- Assert.assertNotNull(res);
- try {
- // Assert feed provided since no predicates
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
- // AtomTestCaseUtils.printResponseHeaders( "Feed response headers:", " ", res );
- // System.out.println("Feed response content:");
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
-
- // Perform other tests on feed.
- // Warning. AbderaClient.getEntityTag is very particular on tag pattern.
- // Document<Feed> doc = res.getDocument();
- String body = read( res.getInputStream() );
- // RFC 4287 requires non-null id, title, updated elements
- Assert.assertTrue( -1 != body.indexOf( "</id>" ));
- Assert.assertTrue( -1 != body.indexOf( "</title>" ));
- Assert.assertTrue( -1 != body.indexOf( "</updated>" ));
- } finally {
- res.release();
- }
- }
-
- @Test
- public void testServiceDocumentGet() throws Exception {
- Collection resourceCollection = testService.getCustomerCollection();
- Assert.assertNotNull(resourceCollection);
-
- Entry postEntry = postEntry("Sponge Bob");
- Entry newEntry = resourceCollection.post(postEntry);
- postEntry = postEntry("Austin Powers");
- newEntry = resourceCollection.post(postEntry);
- postEntry = postEntry("Count Dracula");
- newEntry = resourceCollection.post(postEntry);
-
- // Service document
- ClientResponse res = client.get(providerURI + "/atomsvc");
- Assert.assertNotNull(res);
- try {
- // Asser feed provided since no predicates
- Assert.assertEquals(200, res.getStatus());
- Assert.assertEquals(ResponseType.SUCCESS, res.getType());
-
- // Perform other tests on feed.
- // AtomTestCaseUtils.prettyPrint(abdera, res.getDocument());
- Document<Service> serviceDoc = res.getDocument();
- Service service = serviceDoc.getRoot();
- Assert.assertNotNull( service );
- org.apache.abdera.model.Collection collection = service.getCollection( "workspace", "customers" );
- String title = collection.getTitle();
- Assert.assertEquals("customers", title);
- String href = collection.getHref().toString();
- Assert.assertTrue( href.contains( "customer") );
- } finally {
- res.release();
- }
- }
-
- public static void printFeed( String title, String indent, Feed feed ) {
- if ( feed == null ) {
- System.out.println( title + " feed is null");
- return;
- }
-
- System.out.println( title );
- System.out.println( indent + "id=" + feed.getId() );
- System.out.println( indent + "title=" + feed.getTitle() );
- System.out.println( indent + "updated=" + feed.getUpdated() );
- System.out.println( indent + "author=" + feed.getAuthor() );
- // Collection collection = feed.getCollection();
- // if ( collection == null ) {
- // System.out.println( indent + "collection=null" );
- // } else {
- // System.out.println( indent + "collection=" + collection );
- // }
- // System.out.println( indent + "collection size=" + feed.getCollection() );
- // for (Collection collection : workspace.getCollections()) {
- // if (collection.getTitle().equals("customers")) {
- // String expected = uri + "customers";
- // String actual = collection.getResolvedHref().toString();
- // assertEquals(expected, actual);
- // }
- // }
-
- }
-
- private Entry postEntry(String value) {
- Entry entry = abdera.newEntry();
- entry.setTitle("customer " + value);
-
- Content content = abdera.getFactory().newContent();
- content.setContentType(Content.Type.TEXT);
- content.setValue(value);
- entry.setContentElement(content);
-
- return entry;
- }
-
- /**
- * Read response ream from the given socket.
- * @param socket
- * @return
- * @throws IOException
- */
- private static String read(InputStream inputStream) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader( inputStream ));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Aggregator.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Aggregator.java
deleted file mode 100644
index 213ae53527..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Aggregator.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.binding.atom.aggregator;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface Aggregator extends Collection<String, Item>{
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorImpl.java
deleted file mode 100644
index 4037babd13..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom.aggregator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-
-public class AggregatorImpl implements Aggregator {
-
- @Reference(required = false)
- public Collection<String, Item> atomFeed1;
-
- @Reference(required = false)
- public Collection<String, Item> atomFeed2;
-
- @Reference(required = false)
- public Sort sort;
-
- @Property
- public String feedTitle = "Aggregated Feed";
- @Property
- public String feedDescription = "Anonymous Aggregated Feed";
- @Property
- public String feedAuthor = "anonymous";
-
- public Item get(String id) {
-
- try {
- if (atomFeed1.get(id) != null)
- return atomFeed1.get(id);
- } catch (NotFoundException ex) {
- ex.printStackTrace();
- }
-
- try {
- if (atomFeed2.get(id) != null)
- return atomFeed2.get(id);
- } catch (NotFoundException ex) {
- ex.printStackTrace();
- }
-
- return null;
-
- }
-
- public Entry<String, Item>[] getAll() {
-
- // Aggregate entries from atomFeed1, atomFeed2, rssFeed1 and rssFeed2
- List<Entry> entries = new ArrayList<Entry>();
- if (atomFeed1 != null) {
- try {
- for (Entry entry : atomFeed1.getAll()) {
- entries.add(entry);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- if (atomFeed2 != null) {
- try {
- for (Entry entry : atomFeed2.getAll()) {
- entries.add(entry);
- }
- } catch (Exception e) {
- }
- }
-
- // Sort entries by published date
- if (sort != null) {
- entries = sort.sort(entries);
- }
-
- return entries.toArray(new Entry[entries.size()]);
-
- }
-
- public String post(String key, Item entry) {
- return null;
- }
-
- public void put(String id, Item entry) {
- }
-
- public Entry<String, Item>[] query(String queryString) {
- ArrayList<Entry> entries = new ArrayList<Entry>();
-
- Entry<String, Item>[] allFeed = getAll();
- if (queryString.startsWith("title=")) {
- String title = queryString.substring(6);
-
- for (Entry<String, Item> entry : allFeed) {
- if (entry.getData().getTitle().contains(title)) {
- entries.add(entry);
- }
- }
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public void delete(String id) {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.java
deleted file mode 100644
index 9cd94b2bd7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/AggregatorTestCase.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.binding.atom.aggregator;
-
-import java.net.Socket;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-public class AggregatorTestCase {
- private static SCADomain domain;
- private static Aggregator aggregatorService;
-
- @BeforeClass
- public static void init() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/atom/aggregator/FeedAggregator.composite");
- Assert.assertNotNull(domain);
- aggregatorService = domain.getService(Aggregator.class, "AtomAggregator");
- Assert.assertNotNull(aggregatorService);
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- if(domain != null) {
- domain.close();
- }
- }
-
- @Test
- public void testPing() throws Exception {
- new Socket("127.0.0.1", 8085);
- }
-
- @Test
- public void testAggregator() throws Exception {
- Entry<String, Item>[] entries = aggregatorService.getAll();
-
- Assert.assertNotNull(entries);
- Assert.assertTrue(entries.length > 0);
-
- for(int pos = 0; pos < entries.length; pos++) {
- System.out.println(">>> Entry[" + pos + "] - " + entries[pos].getData().getTitle());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java
deleted file mode 100644
index 8b22dd3efa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/Sort.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.atom.aggregator;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-
-/**
- * The Sort service business interface.
- *
- * @version $Rev: 639931 $ $Date: 2008-03-21 18:13:05 -0700 (Fri, 21 Mar 2008) $
- */
-public interface Sort {
-
- /**
- * Sort feed entries by published date.
- * @param entries
- * @return
- */
- List<Entry> sort(List<Entry> entries);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.java
deleted file mode 100644
index 8745683f6e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/java/org/apache/tuscany/sca/binding/atom/aggregator/SortImpl.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.binding.atom.aggregator;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.osoa.sca.annotations.Property;
-
-/**
- * Implementation of a Feed Sort service component.
- *
- * @version $Rev: 685663 $ $Date: 2008-08-13 13:11:20 -0700 (Wed, 13 Aug 2008) $
- */
-public class SortImpl implements Sort {
-
- @Property
- public boolean newFirst = true;
-
- @SuppressWarnings("unchecked")
- public List<Entry> sort(List<Entry> entries) {
- Entry[] entriesArray = new Entry[entries.size()];
- entriesArray = (Entry<String,Item>[])entries.toArray(entriesArray);
- Arrays.sort(entriesArray, new Comparator() {
- public int compare(final Object xObj, final Object yObj) {
- Entry x = (Entry) xObj;
- Entry y = (Entry) yObj;
- Item xItem = (Item) x.getData();
- Item yItem = (Item) y.getData();
- Date xDate = xItem.getDate();
- Date yDate = yItem.getDate();
- if (xDate == null)
- return -1;
- if (newFirst)
- return yDate.compareTo(xDate);
- else
- return xDate.compareTo(yDate);
- }
- });
- return Arrays.asList(entriesArray);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptToms.gif b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptToms.gif
deleted file mode 100644
index bfeee9b2f4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptToms.gif
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptValue.jpg b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptValue.jpg
deleted file mode 100644
index 584f39ea8d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/ReceiptValue.jpg
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite
deleted file mode 100644
index a2c50f872e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Consumer.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.CustomerClientImpl"/>
- <reference name="customerCollection">
- <tuscany:binding.atom uri="http://localhost:8084/customer"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite
deleted file mode 100644
index 60097ee0f7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/Provider.composite
+++ /dev/null
@@ -1,33 +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"
- targetNamespace = "http://customer"
- name="Provider">
-
- <service name="customer" promote="CustomerCollection">
- <tuscany:binding.atom uri = "http://localhost:8084/customer"/>
- </service>
-
- <component name="CustomerCollection">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.CustomerCollectionImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite
deleted file mode 100644
index ddb660cada..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ProviderNonCollection.composite
+++ /dev/null
@@ -1,34 +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"
- targetNamespace = "http://customer"
- name="ProviderNonCollection">
-
- <service name="customer" promote="CustomerCollection">
- <tuscany:binding.atom uri = "http://localhost:8084/customer"
- title="Atom binding Non Collection" description="Feed used for unit testing"/>
- </service>
-
- <component name="CustomerCollection">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.CustomerNonCollectionImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite
deleted file mode 100644
index 71aa932a12..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/ReceiptProvider.composite
+++ /dev/null
@@ -1,33 +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"
- targetNamespace = "http://receipt"
- name="ReceiptProvider">
-
- <service name="receipt" promote="MediaCollection">
- <tuscany:binding.atom uri = "http://localhost:8084/receipt"/>
- </service>
-
- <component name="MediaCollection">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.MediaCollectionImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/aggregator/FeedAggregator.composite b/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/aggregator/FeedAggregator.composite
deleted file mode 100644
index 64c84c5440..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-abdera/src/test/resources/org/apache/tuscany/sca/binding/atom/aggregator/FeedAggregator.composite
+++ /dev/null
@@ -1,46 +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"
- targetNamespace="http://aggregator"
- name="FeedAggregator">
-
- <service name="atomSample" promote="AtomAggregator">
- <tuscany:binding.atom uri="http://localhost:8085/atomAggregator"/>
- </service>
-
- <component name="AtomAggregator">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.aggregator.AggregatorImpl"/>
- <reference name="sort" target="Sort"/>
- <reference name="atomFeed1">
- <tuscany:binding.atom uri="http://www.ibm.com/developerworks/blogs/rss/lresende?flavor=atomdw"/>
- </reference>
- <reference name="atomFeed2">
- <tuscany:binding.atom uri="https://blogs.apache.org/foundation/feed/entries/atom"/>
- </reference>
- <property name="feedTitle">Atom Aggregator Sample</property>
- </component>
-
- <component name="Sort">
- <implementation.java class="org.apache.tuscany.sca.binding.atom.aggregator.SortImpl"/>
- <property name="newFirst">true</property>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/LICENSE b/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/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-java-1.5.1/modules/binding-atom-js-dojo/NOTICE b/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/pom.xml b/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/pom.xml
deleted file mode 100644
index 2c226ff84b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/pom.xml
+++ /dev/null
@@ -1,74 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-atom-js-dojo</artifactId>
- <name>Apache Tuscany SCA Atom Feed Binding JavaScript using Dojo</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-web-javascript</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom-js-dojo</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom.js.dojo</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/java/org/apache/tuscany/sca/binding/atom/js/dojo/AtomBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/java/org/apache/tuscany/sca/binding/atom/js/dojo/AtomBindingJavascriptProxyFactoryImpl.java
deleted file mode 100644
index 050ef91767..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/java/org/apache/tuscany/sca/binding/atom/js/dojo/AtomBindingJavascriptProxyFactoryImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom.js.dojo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-
-public class AtomBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.atom");
-
- public Class<?> getModelType() {
- return AtomBinding.class;
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public String getJavascriptProxyFile() {
- return null;
- }
-
- public InputStream getJavascriptProxyFileAsStream() throws IOException {
- return null;
- }
-
- public String createJavascriptReference(ComponentReference componentReference) throws IOException {
- Binding binding = componentReference.getBindings().get(0);
- URI targetURI = URI.create(binding.getURI());
- String targetPath = targetURI.getPath();
-
- return "tuscany.AtomService(\"" + targetPath + "\")";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
deleted file mode 100644
index 80a63e76ee..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Proxy Factory
-org.apache.tuscany.sca.binding.atom.js.dojo.AtomBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.atom,model=org.apache.tuscany.sca.binding.atom.AtomBinding,model=org.apache.tuscany.sca.binding.atom.AtomBinding \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js/LICENSE b/branches/sca-java-1.5.1/modules/binding-atom-js/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/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-java-1.5.1/modules/binding-atom-js/NOTICE b/branches/sca-java-1.5.1/modules/binding-atom-js/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js/pom.xml b/branches/sca-java-1.5.1/modules/binding-atom-js/pom.xml
deleted file mode 100644
index d9ecf25e1c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/pom.xml
+++ /dev/null
@@ -1,74 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-atom-js</artifactId>
- <name>Apache Tuscany SCA Atom Feed Binding JavaScript</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-web-javascript</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom-js</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom.js*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.java
deleted file mode 100644
index 6e2ce1895a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/java/org/apache/tuscany/sca/binding/atom/js/AtomBindingJavascriptProxyFactoryImpl.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.binding.atom.js;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-
-public class AtomBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.atom");
- private static final String JAVASCRIPT_FILE_NAME = "binding-atom.js";
-
- public Class<?> getModelType() {
- return AtomBinding.class;
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public String getJavascriptProxyFile() {
- return JAVASCRIPT_FILE_NAME;
- }
-
- public InputStream getJavascriptProxyFileAsStream() throws IOException {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(JAVASCRIPT_FILE_NAME);
- if (is == null) {
- throw new IOException("Could not find Javascript '" + JAVASCRIPT_FILE_NAME + "'" );
- }
-
- return is;
- }
-
- public String createJavascriptReference(ComponentReference componentReference) throws IOException {
- Binding binding = componentReference.getBindings().get(0);
- URI targetURI = URI.create(binding.getURI());
- String targetPath = targetURI.getPath();
-
- return "AtomClient(\"" + targetPath + "\")";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
deleted file mode 100644
index 5ee927e586..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Proxy Factory
-org.apache.tuscany.sca.binding.atom.js.AtomBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.atom,model=org.apache.tuscany.sca.binding.atom.AtomBinding,model=org.apache.tuscany.sca.binding.atom.AtomBinding \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/binding-atom.js b/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/binding-atom.js
deleted file mode 100644
index 2719e9a9b9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom-js/src/main/resources/binding-atom.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function AtomClient(uri) {
-
- this.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
- "MSXML2.XMLHTTP.4.0",
- "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP",
- "Microsoft.XMLHTTP" ];
-
- this.uri=uri;
-
- this.get = function(id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var strDocument = xhr.responseText;
- var xmlDocument = xhr.responseXML;
- if(!xmlDocument || xmlDocument.childNodes.length==0){
- xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
- }
- if (responseFunction != null) responseFunction(xmlDocument);
- } else {
- alert("get - Error getting data from the server");
- }
- }
- }
- xhr.open("GET", uri + '/' + id, true);
- xhr.send(null);
- }
-
- this.post = function (entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 201) {
- var strDocument = xhr.responseText;
- var xmlDocument = xhr.responseXML;
- if(!xmlDocument || xmlDocument.childNodes.length==0){
- xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
- }
- if (responseFunction != null) responseFunction(xmlDocument);
- } else {
- alert("post - Error getting data from the server");
- }
- }
- }
- xhr.open("POST", uri, true);
- xhr.setRequestHeader("Content-Type", "application/atom+xml");
- xhr.send(entry);
- }
-
- this.put = function (id, entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var strDocument = xhr.responseText;
- var xmlDocument = xhr.responseXML;
- if(!xmlDocument || xmlDocument.childNodes.length==0){
- xmlDocument = (new DOMParser()).parseFromString(strDocument, "text/xml");
- }
- if (responseFunction != null) responseFunction(xmlDocument);
- } else {
- alert("put - Error getting data from the server");
- }
- }
- }
- xhr.open("PUT", uri + '/' + id, true);
- xhr.setRequestHeader("Content-Type", "application/atom+xml");
- xhr.send(entry);
- }
-
- this.del = function (id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (responseFunction != null) responseFunction();
- } else {
- alert("delete - Error getting data from the server");
- }
- }
- }
- xhr.open("DELETE", uri + '/' + id, true);
- xhr.send(null);
- }
- this.createXMLHttpRequest = function () {
- /* Mozilla XMLHttpRequest */
- try {return new XMLHttpRequest();} catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i=0;i < this.msxmlNames.length; i++) {
- try {return new ActiveXObject(this.msxmlNames[i]);} catch (e) {}
- }
- alert("XML http request not supported");
- return null;
- }
- if (typeof DOMParser == "undefined") {
- DOMParser = function () {}
-
- DOMParser.prototype.parseFromString = function (str, contentType) {
- if (typeof ActiveXObject != "undefined") {
- var d = new ActiveXObject("MSXML.DomDocument");
- d.loadXML(str);
- return d;
- } else if (typeof XMLHttpRequest != "undefined") {
- var req = new XMLHttpRequest;
- req.open("GET", "data:" + (contentType || "application/xml") +
- ";charset=utf-8," + encodeURIComponent(str), false);
- if (req.overrideMimeType) {
- req.overrideMimeType(contentType);
- }
- req.send(null);
- return req.responseXML;
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/LICENSE b/branches/sca-java-1.5.1/modules/binding-atom/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/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-java-1.5.1/modules/binding-atom/NOTICE b/branches/sca-java-1.5.1/modules/binding-atom/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/pom.xml b/branches/sca-java-1.5.1/modules/binding-atom/pom.xml
deleted file mode 100644
index 700bb4892c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/pom.xml
+++ /dev/null
@@ -1,82 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-atom</artifactId>
- <name>Apache Tuscany SCA Atom Feed Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java b/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.java
deleted file mode 100644
index f81100087c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBinding.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.binding.atom;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * Atom binding model.
- *
- * @version $Rev$ $Date$
- */
-public interface AtomBinding extends Binding {
-
- /**
- * Returns the title of the Atom collection.
- * @return
- */
- String getTitle();
-
- /**
- * Sets the title of the Atom collection.
- * @param title
- */
- void setTitle(String title);
-
- /**
- * Returns the description of the Atom collection.
- *
- * @return The description of the Atom collection
- */
- String getDescription();
-
- /**
- * Sets the description of the Atom collection.
- *
- * @param description The description of the Atom collection
- */
- void setDescription(String description);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.java
deleted file mode 100644
index 6e5623e1a2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/AtomBindingFactory.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.binding.atom;
-
-/**
- * Factory for the Atom binding
- *
- * @version $Rev$ $Date$
- */
-public interface AtomBindingFactory {
-
- /**
- * Creates a new Atom binding.
- * @return the new Atom binding
- */
- AtomBinding createAtomBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.java
deleted file mode 100644
index ea06625d34..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingFactoryImpl.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.binding.atom.impl;
-
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-import org.apache.tuscany.sca.binding.atom.AtomBindingFactory;
-
-/**
- * Factory for the Atom binding model.
- *
- * @version $Rev$ $Date$
- */
-public class AtomBindingFactoryImpl implements AtomBindingFactory {
-
- public AtomBinding createAtomBinding() {
- return new AtomBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.java
deleted file mode 100644
index a7c3997b22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/java/org/apache/tuscany/sca/binding/atom/impl/AtomBindingImpl.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.binding.atom.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.binding.atom.AtomBinding;
-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;
-
-/**
- * Implementation of the Atom Feed binding model.
- *
- * @version $Rev$ $Date$
- */
-class AtomBindingImpl implements AtomBinding, PolicySetAttachPoint {
-
- private String name;
- private String uri;
- private String title;
- private String description;
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- 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 String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- public boolean isUnresolved() {
- // The binding is always resolved
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The binding is always resolved
- }
-
- //Policy related getters/setters
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory b/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory
deleted file mode 100644
index a8117db8f3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.atom.AtomBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the model factory
-org.apache.tuscany.sca.binding.atom.impl.AtomBindingFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 52e0e916f5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.atom,model=org.apache.tuscany.sca.binding.atom.AtomBinding,factory=org.apache.tuscany.sca.binding.atom.AtomBindingFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java b/branches/sca-java-1.5.1/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java
deleted file mode 100644
index 63dffd5522..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-atom/src/test/java/org/apache/tuscany/sca/binding/atom/AtomBindingProcessorTestCase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.atom;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public class AtomBindingProcessorTestCase extends TestCase {
-
- private static final String COMPOSITE =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-atom\" name=\"binding-atom\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <tuscany:binding.atom uri=\"http://localhost:8080/feed\" title=\"Feed Title\"/>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- AtomBinding binding = (AtomBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("Feed Title", binding.getTitle());
- assertEquals("http://localhost:8080/feed", binding.getURI());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-corba-runtime/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/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-java-1.5.1/modules/binding-corba-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-corba-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-corba-runtime/pom.xml
deleted file mode 100644
index 02229176cc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/pom.xml
+++ /dev/null
@@ -1,143 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-corba-runtime</artifactId>
- <name>Apache Tuscany SCA CORBA Binding Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jse</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <!-- Unfortunately the idlj maven plugin only works with SUN JDK -->
- <!--
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/idl-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>idlj-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <debug>true</debug>
- <compiler>idlj</compiler>
- <sources>
- <source>
- <includes>
- <include>tester.idl</include>
- </includes>
- <emitStubs>true</emitStubs>
- <emitSkeletons>true</emitSkeletons>
- </source>
- </sources>
- <sourceDirectory>${basedir}/src/test/resources</sourceDirectory>
- <outputDirectory>${project.build.directory}/idl-source</outputDirectory>
- </configuration>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.5.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </plugin>
- -->
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.corba</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.corba*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java
deleted file mode 100644
index 99c9d7736e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProviderFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-import org.apache.tuscany.sca.host.corba.ExtensibleCorbaHost;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaBindingProviderFactory implements BindingProviderFactory<CorbaBinding> {
-
- private CorbaHostExtensionPoint chep;
- private ExtensibleCorbaHost host;
-
- public CorbaBindingProviderFactory(ExtensionPointRegistry registry) {
- chep = registry.getExtensionPoint(CorbaHostExtensionPoint.class);
- host = new ExtensibleCorbaHost(chep);
- }
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createReferenceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- CorbaBinding binding) {
- return new CorbaReferenceBindingProvider(binding, host, reference);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.BindingProviderFactory#createServiceBindingProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- CorbaBinding binding) {
- return new CorbaServiceBindingProvider(binding, host, service);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<CorbaBinding> getModelType() {
- return CorbaBinding.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
deleted file mode 100644
index 1577184b48..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaInvoker.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.Object;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaInvoker implements Invoker {
-
- private Object remoteObject;
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap;
- private Map<Operation, Method> operationMethodMapping;
-
- public CorbaInvoker(RuntimeComponentReference reference, Object remoteObject, Class<?> referenceClass, Map<Method, String> operationsMap) {
- this.remoteObject = remoteObject;
- this.referenceClass = referenceClass;
- this.operationsMap = operationsMap;
- this.operationMethodMapping = OperationMapper.mapOperationToMethod(reference.getInterfaceContract().getInterface().getOperations(), referenceClass);
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(remoteObject, msg.getOperation().getName());
- request.setReferenceClass(referenceClass);
- request.setOperationsMap(operationsMap);
- if (msg.getOperation().getOutputType() != null) {
- Annotation[] notes = operationMethodMapping.get(msg.getOperation()).getAnnotations();
- request.setOutputType(msg.getOperation().getOutputType().getPhysical(), notes);
- }
- java.lang.Object[] args = msg.getBody();
- if (args != null) {
- Annotation[][] notes = operationMethodMapping.get(msg.getOperation()).getParameterAnnotations();
- for (int i = 0; i < args.length; i++) {
- request.addArgument(args[i], notes[i]);
- }
- }
- if (msg.getOperation().getFaultTypes() != null) {
- for (DataType<?> type : msg.getOperation().getFaultTypes()) {
- request.addExceptionType(type.getPhysical());
- }
- }
- DynaCorbaResponse response = request.invoke();
- msg.setBody(response.getContent());
- } catch (RequestConfigurationException e) {
- throw new ServiceRuntimeException(e);
- } catch (Exception e) {
- msg.setFaultBody(e);
- }
- return msg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
deleted file mode 100644
index 43bf984440..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaReferenceBindingProvider.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaReferenceBindingProvider implements ReferenceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(CorbaReferenceBindingProvider.class.getName());
- private CorbaBinding binding;
- private CorbaHost host;
- private RuntimeComponentReference reference;
- private Object remoteObject;
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap = null;
-
- public CorbaReferenceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentReference reference) {
- this.binding = binding;
- this.host = host;
- this.reference = reference;
- this.referenceClass = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
- operationsMap = OperationMapper.mapMethodToOperationName(referenceClass);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#createInvoker(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Invoker createInvoker(Operation operation) {
- try {
- if (remoteObject == null) {
- remoteObject = host.lookup(binding.getCorbaname());
- }
- return new CorbaInvoker(reference, remoteObject, referenceClass, operationsMap);
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during creating CORBA invoker", e);
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#getBindingInterfaceContract()
- */
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#start()
- */
- public void start() {
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#stop()
- */
- public void stop() {
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ReferenceBindingProvider#supportsOneWayInvocation()
- */
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
deleted file mode 100644
index 0465dbe7e9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaServiceBindingProvider.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.binding.corba.impl.service.ComponentInvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaServiceBindingProvider implements ServiceBindingProvider {
-
- private CorbaBinding binding;
- private CorbaHost host;
- private RuntimeComponentService service;
- private DynaCorbaServant servant;
-
- public CorbaServiceBindingProvider(CorbaBinding binding, CorbaHost host, RuntimeComponentService service) {
- this.binding = binding;
- this.host = host;
- this.service = service;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#getBindingInterfaceContract()
- */
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#start()
- */
- public void start() {
- try {
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(binding), javaClass);
- servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- servant.setIds(new String[] {binding.getId()});
- host.registerServant(binding.getCorbaname(), servant);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#stop()
- */
- public void stop() {
- try {
- host.unregisterServant(binding.getCorbaname());
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ServiceBindingProvider#supportsOneWayInvocation()
- */
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java
deleted file mode 100644
index 6e54556a2c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/CorbaException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.exceptions;
-
-/**
- * @version $Rev$ $Date$
- * Represents CORBA SystemException
- */
-public class CorbaException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public CorbaException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.java
deleted file mode 100644
index 9a11d205f2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/exceptions/RequestConfigurationException.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.binding.corba.impl.exceptions;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestConfigurationException extends Exception {
-
- private static final long serialVersionUID = 1L;
- private String objectId;
-
- public RequestConfigurationException(String message, String objectId) {
- super(message + ", object id was: " + objectId);
- this.objectId = objectId;
- }
-
- public RequestConfigurationException(String message) {
- super(message);
- }
-
- public String getType() {
- return objectId;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
deleted file mode 100644
index 3936bed9f6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaRequest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.reference;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.CorbaException;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.apache.tuscany.sca.binding.corba.impl.util.MethodFinder;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$ Represents single CORBA request
- */
-public class DynaCorbaRequest {
-
- private TypeTree returnTree;
- private Map<String, TypeTree> exceptions = new HashMap<String, TypeTree>();
- private InputStream inputStream;
- private ObjectImpl remoteObject;
- private String operation;
- private List<java.lang.Object> arguments = new ArrayList<java.lang.Object>();
- private List<TypeTree> argumentsTypes = new ArrayList<TypeTree>();
- private Class<?> referenceClass;
- private Map<Method, String> operationsMap;
-
- /**
- * Creates request.
- *
- * @param ObjectremoteObject remote object reference
- * @param operation operation to invoke
- * @param scaBindingRules apply SCA default binding mapping rules
- */
- public DynaCorbaRequest(Object remoteObject, String operation) {
- this.remoteObject = (ObjectImpl)remoteObject;
- this.operation = operation;
- }
-
- /**
- * Sets class which will be backed by this reference request
- * @param referenceClass
- */
- public void setReferenceClass(Class<?> referenceClass) {
- this.referenceClass = referenceClass;
- }
-
- /**
- * Sets method to operation names mapping
- * @param operationsMap
- */
- public void setOperationsMap(Map<Method, String> operationsMap) {
- this.operationsMap = operationsMap;
- }
-
- /**
- * Adds operation argument - stores arguments and caches its TypeTree. Annotations will be set to null by default.
- *
- * @param argument
- */
- public void addArgument(java.lang.Object argument) throws RequestConfigurationException {
- addArgument(argument, null);
- }
-
- /**
- * Adds operation argument - stores arguments and caches its TypeTree
- *
- * @param argument
- */
- public void addArgument(java.lang.Object argument, Annotation[] notes) throws RequestConfigurationException {
- TypeTree tree = TypeTreeCreator.createTypeTree(argument.getClass(), notes);
- argumentsTypes.add(tree);
- arguments.add(argument);
- }
-
- /**
- * Passing stored arguments to CORBA communication output stream
- *
- * @param outputStream
- * @throws RequestConfigurationException
- */
- private void passArguments(OutputStream outputStream) throws RequestConfigurationException {
- for (int i = 0; i < arguments.size(); i++) {
- TypeTree tree = argumentsTypes.get(i);
- TypeHelpersProxy.write(tree.getRootNode(), outputStream, arguments.get(i));
- }
- }
-
- /**
- * Sets return type for operation. Annotations will be set to null by default.
- *
- * @param forClass
- */
- public void setOutputType(Class<?> forClass) throws RequestConfigurationException {
- setOutputType(forClass, null);
- }
-
- /**
- * Sets return type for operation
- *
- * @param forClass
- */
- public void setOutputType(Class<?> forClass, Annotation[] notes) throws RequestConfigurationException {
- returnTree = TypeTreeCreator.createTypeTree(forClass, notes);
- }
-
- /**
- * Configures possible exceptions
- *
- * @param forClass
- */
- public void addExceptionType(Class<?> forClass) throws RequestConfigurationException {
- TypeTree tree = TypeTreeCreator.createTypeTree(forClass, null);
- String exceptionId = Utils.getTypeId(forClass);
- exceptions.put(exceptionId, tree);
- }
-
- /**
- * Handles application excpeition.
- *
- * @param ae occured exception
- * @throws Exception
- */
- private void handleApplicationException(ApplicationException ae) throws Exception {
- try {
- if (exceptions.size() == 0) {
- RequestConfigurationException exception =
- new RequestConfigurationException(
- "ApplicationException occured, but no exception type was specified.",
- ae.getId());
- throw exception;
- }
- InputStream is = ae.getInputStream();
- String exceptionId = is.read_string();
- TypeTree tree = exceptions.get(exceptionId);
- if (tree == null) {
- RequestConfigurationException exception =
- new RequestConfigurationException(
- "ApplicationException occured, but no such exception was defined",
- ae.getId());
- throw exception;
- } else {
- Exception ex = (Exception)TypeHelpersProxy.read(tree.getRootNode(), is);
- throw ex;
- }
- } catch (Exception e) {
- throw e;
- }
- }
-
- /**
- * Handles exceptions generated by CORBA API
- *
- * @param se
- */
- private void handleSystemException(SystemException se) throws Exception {
- if (se instanceof BAD_OPERATION) {
- throw new CorbaException("Bad operation name: " + operation, se);
- } else if (se instanceof BAD_PARAM) {
- throw new CorbaException("Bad parameter", se);
- } else {
- // TODO: handle more system exception types
- throw new CorbaException(se.getMessage(), se);
- }
- }
-
- /**
- * Gets operation name which is includes mapping rules
- * @return
- */
- private String getFinalOperationName() {
- String result = operation;
- if (referenceClass != null) {
- Class<?>[] argumentTypes = new Class<?>[arguments.size()];
- for (int i = 0; i < arguments.size(); i++) {
- argumentTypes[i] = arguments.get(i).getClass();
- }
- Method method = MethodFinder.findMethod(referenceClass, operation, argumentTypes);
- String newOperation = (String)operationsMap.get(method);
- if (newOperation != null) {
- result = newOperation;
- }
- }
- return result;
- }
-
- /**
- * Invokes previously configured request
- *
- * @return
- */
- public DynaCorbaResponse invoke() throws Exception {
- DynaCorbaResponse response = new DynaCorbaResponse();
- String finalOperationName = getFinalOperationName();
- OutputStream outputStream = ((ObjectImpl)remoteObject)._request(finalOperationName, true);
- passArguments(outputStream);
- try {
- inputStream = remoteObject._invoke(outputStream);
- if (inputStream != null && returnTree != null) {
- response.setContent(TypeHelpersProxy.read(returnTree.getRootNode(), inputStream));
- }
- } catch (ApplicationException ae) {
- handleApplicationException(ae);
- } catch (SystemException se) {
- handleSystemException(se);
- } catch (Exception e) {
- throw e;
- } finally {
- release();
- }
- return response;
- }
-
- /**
- * Releases request resources
- */
- private void release() {
- remoteObject._releaseReply(inputStream);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java
deleted file mode 100644
index 25463a7a8a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/DynaCorbaResponse.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.reference;
-
-/**
- * @version $Rev$ $Date$
- * Holder for content returned from DynaCorbaRequest
- *
- */
-public class DynaCorbaResponse {
-
- private Object content;
-
- public Object getContent() {
- return content;
- }
-
- public void setContent(Object content) {
- this.content = content;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
deleted file mode 100644
index 514d7055a8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceInstanceCreator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.reference;
-
-import java.lang.reflect.Method;
-
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.CallbackFilter;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.NoOp;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InterfaceInstanceCreator {
-
- private static final CallbackFilter FILTER = new CallbackFilter() {
- public int accept(Method method) {
- return 1;
- }
- };
-
- /**
- * Dynamically creates instance of user defined interface. Instance is
- * enhanced by RemoteMethodInterceptor
- *
- * @param reference
- * CORBA reference
- * @param forClass
- * user defined interface
- * @return dynamic implementation instance
- */
- public static java.lang.Object createInstance(Object reference, Class<?> forClass) {
- java.lang.Object result = null;
- try {
- Enhancer enhancer = new Enhancer();
- enhancer.setInterfaces(new Class[] {forClass});
- enhancer.setCallbackFilter(FILTER);
- enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class});
- Class<?> newClass = enhancer.createClass();
- Enhancer.registerStaticCallbacks(newClass, new Callback[] {NoOp.INSTANCE,
- new InterfaceMethodInterceptor(reference, forClass)});
- result = newClass.newInstance();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
deleted file mode 100644
index 7fba091b41..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/reference/InterfaceMethodInterceptor.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.reference;
-
-import java.lang.reflect.Method;
-
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- * Interceptor for CORBA reference methods
- */
-public class InterfaceMethodInterceptor implements MethodInterceptor {
-
- private Object reference;
- private Class<?> javaClass;
-
- public InterfaceMethodInterceptor(Object reference, Class<?> javaClass) {
- this.reference = reference;
- this.javaClass = javaClass;
- }
-
- /**
- * Create and execute DynaCorbaRequest instance, basing on intercepted
- * method arguments, return types, exceptions
- */
- public java.lang.Object intercept(java.lang.Object object,
- Method method,
- java.lang.Object[] arguments,
- MethodProxy arg3) throws Throwable {
- DynaCorbaRequest request = new DynaCorbaRequest(reference, method.getName());
- request.setReferenceClass(javaClass);
- for (int i = 0; i < arguments.length; i++) {
- request.addArgument(arguments[i]);
- }
- request.setOutputType(method.getReturnType());
- Class<?>[] exceptions = method.getExceptionTypes();
- for (int i = 0; i < exceptions.length; i++) {
- request.addExceptionType(exceptions[i]);
- }
- DynaCorbaResponse response = request.invoke();
- return response.getContent();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java
deleted file mode 100644
index ff4732cfdb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/ComponentInvocationProxy.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.service;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * @version $Rev$ $Date$
- * Invocation proxy for SCA components
- */
-public class ComponentInvocationProxy implements InvocationProxy {
-
- private RuntimeWire wire;
- private Map<Method, Operation> methodOperationMapping;
- private Map<Operation, Method> operationMethodMapping;
- private Map<String, Method> operationsMap;
- private Map<Operation, OperationTypes> operationsCache = new HashMap<Operation, OperationTypes>();
-
- public ComponentInvocationProxy(RuntimeComponentService service, RuntimeWire wire, Class<?> javaClass)
- throws RequestConfigurationException {
- this.wire = wire;
- operationsMap = OperationMapper.mapOperationNameToMethod(javaClass);
- operationMethodMapping = OperationMapper.mapOperationToMethod(service.getInterfaceContract().getInterface().getOperations(), javaClass);
- methodOperationMapping = OperationMapper.mapMethodToOperation(service.getInterfaceContract().getInterface().getOperations(), javaClass);
- cacheOperationTypes(service.getInterfaceContract().getInterface().getOperations());
- }
-
- /**
- * Caches TypeTree for every operation in backed component
- *
- * @param operations
- * @throws RequestConfigurationException
- */
- private void cacheOperationTypes(List<Operation> operations) throws RequestConfigurationException {
- for (Operation operation : operations) {
- try {
- OperationTypes operationTypes = new OperationTypes();
- List<TypeTree> inputInstances = new ArrayList<TypeTree>();
- // cache output type tree
- if (operation.getOutputType() != null && operation.getOutputType().getPhysical() != null
- && !operation.getOutputType().getPhysical().equals(void.class)) {
- Annotation[] notes = operationMethodMapping.get(operation).getAnnotations();
- TypeTree outputType =
- TypeTreeCreator.createTypeTree(operation.getOutputType().getPhysical(), notes);
- operationTypes.setOutputType(outputType);
- }
- // cache input types trees
- if (operation.getInputType() != null) {
- Method method = operationMethodMapping.get(operation);
- Annotation[][] notes = method.getParameterAnnotations();
- int i = 0;
- for (DataType<List<DataType<?>>> type : operation.getInputType().getLogical()) {
- Class<?> forClass = type.getPhysical();
- TypeTree inputType = TypeTreeCreator.createTypeTree(forClass, notes[i]);
- inputInstances.add(inputType);
- i++;
- }
-
- }
- operationTypes.setInputType(inputInstances);
- operationsCache.put(operation, operationTypes);
- } catch (RequestConfigurationException e) {
- throw e;
- }
- }
- }
-
- private Operation getOperation4Name(String operationName) {
- Method method = operationsMap.get(operationName);
- return methodOperationMapping.get(method);
- }
-
- public OperationTypes getOperationTypes(String operationName) {
- return operationsCache.get(getOperation4Name(operationName));
- }
-
- public Object invoke(String operationName, List<Object> arguments) throws InvocationException {
- Object result = null;
- try {
- result = wire.invoke(getOperation4Name(operationName), arguments.toArray());
- } catch (InvocationTargetException e) {
- InvocationException exception = new InvocationException(e.getCause());
- throw exception;
- }
- return result;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
deleted file mode 100644
index 2a032f5d25..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/DynaCorbaServant.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.TypeHelpersProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.omg.CORBA.MARSHAL;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.InvokeHandler;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.OutputStream;
-import org.omg.CORBA.portable.ResponseHandler;
-
-/**
- * @version $Rev$ $Date$
- * General servant which provides target component implementation via CORBA
- */
-public class DynaCorbaServant extends ObjectImpl implements InvokeHandler {
-
- private static final Logger logger = Logger.getLogger(DynaCorbaServant.class.getName());
-
- private String[] ids;
- private InvocationProxy invocationProxy;
- private String typeId;
-
- /**
- * Creates servant object
- * @param invocationProxy
- * @param typeId
- * @throws RequestConfigurationException
- */
- public DynaCorbaServant(InvocationProxy invocationProxy, String typeId) throws RequestConfigurationException {
- this.invocationProxy = invocationProxy;
- this.typeId = typeId;
- setDefaultIds();
- }
-
- /**
- * Sets CORBA object ID
- * @param ids
- */
- public void setIds(String[] ids) {
- for (int i = 0; i < ids.length; i++) {
- if (ids[i] == null || ids[i].length() == 0) {
- // if invalid id was passed then set to default
- setDefaultIds();
- return;
- }
- }
- this.ids = ids;
- }
-
- public OutputStream _invoke(String operationName, InputStream in, ResponseHandler rh) {
- OperationTypes types = invocationProxy.getOperationTypes(operationName);
- if (types == null) {
- // operation wasn't found
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- } else {
- List<Object> inputInstances = new ArrayList<Object>();
- try {
- // retrieving in arguments
- for (TypeTree tree : types.getInputType()) {
- Object o = TypeHelpersProxy.read(tree.getRootNode(), in);
- inputInstances.add(o);
- }
- } catch (MARSHAL e) {
- // parameter passed by user was not compatible with Java to
- // Corba mapping
- throw new org.omg.CORBA.BAD_PARAM(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
- try {
- // invocation and sending result
- Object result = invocationProxy.invoke(operationName, inputInstances);
- OutputStream out = rh.createReply();
- if (types.getOutputType() != null) {
- TypeTree tree = types.getOutputType();
- TypeHelpersProxy.write(tree.getRootNode(), out, result);
- }
- return out;
- } catch (InvocationException ie) {
- // handling user exception
- try {
- OutputStream out = rh.createExceptionReply();
- Class<?> exceptionClass = ie.getTargetException().getClass();
- TypeTree tree = TypeTreeCreator.createTypeTree(exceptionClass, null);
- String exceptionId = Utils.getTypeId(exceptionClass);
- out.write_string(exceptionId);
- TypeHelpersProxy.write(tree.getRootNode(), out, ie.getTargetException());
- return out;
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during handling invocation exception", e);
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Unexpected exception during sending CORBA result to client", e);
- }
- }
- return null;
- }
-
- @Override
- public String[] _ids() {
- return ids;
- }
-
- /**
- * Sets servant ID to default, based on Java class name
- */
- private void setDefaultIds() {
- this.ids = new String[] {typeId};
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.java
deleted file mode 100644
index a82e43e42e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationException.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.binding.corba.impl.service;
-
-/**
- * @version $Rev$ $Date$
- * Wrapper for exception thrown during target invocation
- */
-public class InvocationException extends Exception {
-
- private static final long serialVersionUID = 1L;
- private Throwable targetException;
-
- public InvocationException(Throwable targetException) {
- this.targetException = targetException;
- }
-
- public Throwable getTargetException() {
- return targetException;
- }
-
- public void setTargetException(Throwable target) {
- this.targetException = target;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.java
deleted file mode 100644
index 5ad9068b8d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/InvocationProxy.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.binding.corba.impl.service;
-
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- * Target proxy interface for service bindings
- */
-public interface InvocationProxy {
-
- /**
- * Gets operations types for target
- * @param operationName
- * @return
- */
- public OperationTypes getOperationTypes(String operationName);
-
- /**
- * Invokes target operation
- * @param operationName
- * @param arguments
- * @return
- * @throws InvocationException
- */
- public Object invoke(String operationName, List<Object> arguments) throws InvocationException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.java
deleted file mode 100644
index d93036d6d9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/service/OperationTypes.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.binding.corba.impl.service;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-
-/**
- * @version $Rev$ $Date$
- * Holder for Java type trees for one method
- */
-public class OperationTypes {
-
- private TypeTree outputType;
- private List<TypeTree> inputType;
-
- public TypeTree getOutputType() {
- return outputType;
- }
-
- public void setOutputType(TypeTree outputType) {
- this.outputType = outputType;
- }
-
- public List<TypeTree> getInputType() {
- return inputType;
- }
-
- public void setInputType(List<TypeTree> inputType) {
- this.inputType = inputType;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.java
deleted file mode 100644
index d2b48d22c7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/AnnotationAttributes.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.binding.corba.impl.types;
-
-/**
- * Holds information retrieved from objects annotations
- */
-public class AnnotationAttributes {
-
- private boolean corbaArray;
- private int[] corbaArrayLength;
-
- public boolean isCorbaArray() {
- return corbaArray;
- }
-
- public void setCorbaArray(boolean isCorbaArray) {
- this.corbaArray = isCorbaArray;
- }
-
- public int[] getCorbaArrayLength() {
- return corbaArrayLength;
- }
-
- public void setCorbaArrayLength(int[] corbaArrayLength) {
- this.corbaArrayLength = corbaArrayLength;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.java
deleted file mode 100644
index 4080a836bc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/NodeType.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.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Types of CORBA objects.
- */
-public enum NodeType {
- primitive, struct, union, array, sequence, reference, idl_enum, exception
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java
deleted file mode 100644
index b8c4f88324..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTree.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Helper tree for Java object hierarchy. It's closer to CORBA types
- * structure than plain Java hierarchy - it helps reading and writing
- * complex structures.
- */
-public class TypeTree {
-
- private TypeTreeNode rootNode;
-
- /**
- * Returns root node.
- *
- * @return root of type tree
- */
- public TypeTreeNode getRootNode() {
- return rootNode;
- }
-
- /**
- * Sets root of the type tree.
- *
- * @param rootNode root node.
- */
- public void setRootNode(TypeTreeNode rootNode) {
- this.rootNode = rootNode;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
deleted file mode 100644
index e8441ed177..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeCreator.java
+++ /dev/null
@@ -1,497 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * @version $Rev$ $Date$
- * Creator of types tree.
- */
-public class TypeTreeCreator {
-
- /**
- * Helps to determine if type is a primitive.
- */
- private static List<Class<?>> primitives = new ArrayList<Class<?>>();
-
- static {
- primitives.add(boolean.class);
- primitives.add(byte.class);
- primitives.add(short.class);
- primitives.add(int.class);
- primitives.add(long.class);
- primitives.add(double.class);
- primitives.add(float.class);
- primitives.add(char.class);
- primitives.add(String.class);
- primitives.add(Boolean.class);
- primitives.add(Byte.class);
- primitives.add(Short.class);
- primitives.add(Integer.class);
- primitives.add(Long.class);
- primitives.add(Double.class);
- primitives.add(Float.class);
- primitives.add(Character.class);
- }
-
- /**
- * Creates class for given string argument.
- *
- * @param name name of type
- * @return type
- */
- private static Class<?> createClassFromString(String name) {
- Class<?> result = null;
- try {
- if (name.length() == 1) {
- // primitives
- switch (name.charAt(0)) {
- case 'Z':
- result = boolean.class;
- break;
- case 'C':
- result = char.class;
- break;
- case 'B':
- result = byte.class;
- break;
- case 'S':
- result = short.class;
- break;
- case 'I':
- result = int.class;
- break;
- case 'J':
- result = long.class;
- break;
- case 'F':
- result = float.class;
- break;
- case 'D':
- result = double.class;
- break;
- }
- } else {
- // class
- name = name.substring(1, name.length() - 1);
- result = Class.forName(name);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return result;
- }
-
- /**
- * Reduces dimension of array.
- *
- * @param forClass array class
- * @return reduced array
- */
- private static Class<?> reduceArrayDimension(Class<?> forClass) {
- String name = forClass.getName();
- try {
- String reduced = name.substring(1, name.length());
- if (reduced.startsWith("[")) {
- // reduced class is still an array
- return Class.forName(reduced);
- } else {
- // reduced class may be primitive or class
- return createClassFromString(reduced);
- }
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Return given array without first element
- *
- * @param array
- * @return
- */
- private static int[] removeFirstElement(int[] array) {
- int[] result = new int[array.length - 1];
- System.arraycopy(array, 1, result, 0, result.length);
- return result;
- }
-
- /**
- * Converts objects annotations to structure which will be used by this
- * class
- *
- * @param notes
- * @return
- */
- private static AnnotationAttributes createAnnotationAttributes(Annotation[] notes) {
- AnnotationAttributes attrs = new AnnotationAttributes();
- for (int i = 0; notes != null && i < notes.length; i++) {
- if (notes[i].annotationType().equals(CorbaArray.class)) {
- attrs.setCorbaArray(true);
- attrs.setCorbaArrayLength(((CorbaArray)notes[i]).value());
- }
- }
- return attrs;
- }
-
- /**
- * Creates tree for given type.
- *
- * @param forClass
- * @return type tree
- */
- public static TypeTree createTypeTree(Class<?> forClass, Annotation[] notes) throws RequestConfigurationException {
- TypeTree tree = new TypeTree();
- TypeTreeNode rootNode = null;
- AnnotationAttributes attrs = createAnnotationAttributes(notes);
- rootNode = inspectClassHierarchy(forClass, attrs, tree);
- tree.setRootNode(rootNode);
- return tree;
-
- }
-
- /**
- * Recurrent method which builds type tree.
- *
- * @param forClass
- * @param tree
- * @return
- */
- private static TypeTreeNode inspectClassHierarchy(Class<?> forClass, AnnotationAttributes attributes, TypeTree tree)
- throws RequestConfigurationException {
-
- TypeTreeNode node = null;
- node = createTypeNode(forClass, attributes);
-
- NodeType nodeType = node.getNodeType();
- TypeTreeNode[] children = null;
-
- if (nodeType.equals(NodeType.primitive)) {
- // stop condition for recurrent method
- } else if (nodeType.equals(NodeType.array)) {
- Class<?> reduced = reduceArrayDimension(node.getJavaClass());
- children = new TypeTreeNode[1];
- int[] newLengths = removeFirstElement(attributes.getCorbaArrayLength());
- attributes.setCorbaArrayLength(newLengths);
- children[0] = inspectClassHierarchy(reduced, attributes, tree);
- } else if (nodeType.equals(NodeType.sequence)) {
- // reducing sequence dimension
- Class<?> reduced = reduceArrayDimension(node.getJavaClass());
- children = new TypeTreeNode[1];
- children[0] = inspectClassHierarchy(reduced, attributes, tree);
- // System.arraycopy(src, srcPos, dest, destPos, length)
- } else if (nodeType.equals(NodeType.struct) || nodeType.equals(NodeType.exception)) {
- // inspect types for every structure member
- Field[] fields = node.getJavaClass().getFields();
- children = new TypeTreeNode[fields.length];
- for (int i = 0; i < fields.length; i++) {
- Class<?> field = fields[i].getType();
- AnnotationAttributes fAttrs = createAnnotationAttributes(fields[i].getAnnotations());
- TypeTreeNode child = inspectClassHierarchy(field, fAttrs, tree);
- child.setName(fields[i].getName());
- children[i] = child;
- }
- } else if (nodeType.equals(NodeType.idl_enum)) {
-
- } else if (nodeType.equals(NodeType.union)) {
- // inspect types for every structure member
- Field[] fields = node.getJavaClass().getDeclaredFields();
- children = new TypeTreeNode[fields.length];
- for (int i = 0; i < fields.length; i++) {
- Class<?> field = fields[i].getType();
- AnnotationAttributes fAttrs = createAnnotationAttributes(fields[i].getAnnotations());
- TypeTreeNode child = inspectClassHierarchy(field, fAttrs, tree);
- child.setName(fields[i].getName());
- children[i] = child;
- }
- } else if (nodeType.equals(NodeType.reference)) {
- // TODO: CORBA references
- }
-
- node.setChildren(children);
- return node;
- }
-
- /**
- * Creating and configuring TypeTreeNode for given class.
- *
- * @param forClass class
- * @return node
- * @throws RequestConfigurationException
- */
- private static TypeTreeNode createTypeNode(Class<?> forClass, AnnotationAttributes attributes)
- throws RequestConfigurationException {
- TypeTreeNode node = new TypeTreeNode();
- if (forClass.isArray() && !attributes.isCorbaArray()) {
- node.setNodeType(NodeType.sequence);
- node.setJavaClass(forClass);
- } else if (forClass.isArray() && attributes.isCorbaArray()) {
- node.setNodeType(NodeType.array);
- node.setJavaClass(forClass);
- try {
- // set the actual array size for further use by ArrayTypeHelper
- node.setAttributes(attributes.getCorbaArrayLength()[0]);
- } catch (ArrayIndexOutOfBoundsException e) {
- RequestConfigurationException exc =
- new RequestConfigurationException("Annotated array size doesn't match declared arrays size");
- throw exc;
- }
- } else if (primitives.contains(forClass)) {
- node.setNodeType(NodeType.primitive);
- node.setJavaClass(forClass);
- node.setChildren(null);
- } else if (forClass.isInterface()) {
- node.setNodeType(NodeType.reference);
- node.setJavaClass(forClass);
- node.setChildren(null);
- } else if (isStructType(forClass)) {
- node.setNodeType(NodeType.struct);
- node.setJavaClass(forClass);
- } else if (isEnumType(forClass)) {
- node.setNodeType(NodeType.idl_enum);
- node.setJavaClass(forClass);
- } else if (isUserException(forClass)) {
- node.setNodeType(NodeType.exception);
- node.setJavaClass(forClass);
- } else if (isUnionType(forClass)) {
- node.setNodeType(NodeType.union);
- node.setJavaClass(forClass);
- node.setAttributes(getUnionAttributes(forClass));
- } else {
- RequestConfigurationException e =
- new RequestConfigurationException("User defined type which cannot be handled: " + forClass
- .getCanonicalName());
- throw e;
- }
- return node;
- }
-
- /**
- * Tells whether given class is structure
- *
- * @param forClass
- * @return
- */
- private static boolean isStructType(Class<?> forClass) {
- int classMods = forClass.getModifiers();
- if (!Modifier.isFinal(classMods)) {
- return false;
- }
- boolean areCtorsValid = false;
- Class<?>[] fieldsTypes = null;
- Constructor<?>[] ctors = forClass.getConstructors();
- /*
- * Do we have 2 ctors and one of them is null ctor?
- */
- if (ctors.length != 2) {
- return false;
- }
- for (int i = 0; i < ctors.length; i++) {
- Class<?>[] params = ctors[i].getParameterTypes();
- if (params.length == 0) {
- areCtorsValid = true;
- } else {
- fieldsTypes = params;
- }
- }
- if (!areCtorsValid) {
- return false;
- }
- /*
- * Are constructor args declared as class fields?
- */
- Field[] fields = forClass.getFields();
- Set<Class<?>> fieldsSet = new HashSet<Class<?>>(Arrays.asList(fieldsTypes));
- for (int i = 0; i < fields.length && !fieldsSet.isEmpty(); i++) {
- int mods = fields[i].getModifiers();
- if (Modifier.isPublic(mods) && !Modifier.isStatic(mods) && !Modifier.isFinal(mods)) {
- fieldsSet.remove(fields[i].getType());
- }
-
- }
- return fieldsSet.isEmpty();
- }
-
- /**
- * Tells whether given class is enum
- *
- * @param forClass
- * @return
- */
- private static boolean isEnumType(Class<?> forClass) {
- boolean isValueMethod = false;
- boolean isFromIntMethod = false;
- /*
- * enum type should have value and from_int methods
- */
- try {
- Method valueMet = forClass.getMethod("value", new Class[] {});
- int modValueMet = valueMet.getModifiers();
- if (valueMet.getReturnType().equals(int.class) && Modifier.isPublic(modValueMet)) {
- isValueMethod = true;
- }
- Method fromIntMet = forClass.getMethod("from_int", new Class[] {int.class});
- int modFromIntMet = fromIntMet.getModifiers();
- if ((fromIntMet.getReturnType().equals(forClass) && Modifier.isPublic(modFromIntMet) && Modifier
- .isStatic(modFromIntMet))) {
- isFromIntMethod = true;
- }
- } catch (NoSuchMethodException e) {
- }
- if (!isFromIntMethod || !isValueMethod) {
- return false;
- }
- /*
- * enum type should also contain minimum one pair of fields: EnumType
- * field and int _field
- */
- int enumCount = 0;
- Field[] fields = forClass.getFields();
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].getType().equals(forClass)) {
- int modifiers = fields[i].getModifiers();
- if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers) && Modifier.isFinal(modifiers)) {
- try {
- Field field = forClass.getField("_" + fields[i].getName());
- if (field.getType().equals(int.class)) {
- enumCount++;
- }
- } catch (NoSuchFieldException e) {
- }
-
- }
- }
- }
- return enumCount > 0;
- }
-
- /**
- * Tells whether given class is CORBA user exception
- *
- * @param forClass
- * @return
- */
- private static boolean isUserException(Class<?> forClass) {
- do {
- if (forClass.equals(Exception.class)) {
- return true;
- } else {
- forClass = forClass.getSuperclass();
- }
- } while (forClass != null && !forClass.equals(Object.class));
- return false;
- }
-
- /**
- * Tells whether given class is CORBA union. This method validates usage of
- * unions annotations.
- *
- * @param forClass
- * @return
- * @throws RequestConfigurationException
- */
- private static boolean isUnionType(Class<?> forClass) throws RequestConfigurationException {
- int classMods = forClass.getModifiers();
- if (!Modifier.isFinal(classMods)) {
- return false;
- }
- boolean atLeastOneOption = false;
- boolean discriminatorPresent = false;
- for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
- CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
- if (note != null) {
- int fieldMod = forClass.getDeclaredFields()[i].getModifiers();
- if (Modifier.isPrivate(fieldMod) && !Modifier.isFinal(fieldMod) && !Modifier.isStatic(fieldMod)) {
- if (note.type().equals(CorbaUnionElementType.discriminator)) {
- if (discriminatorPresent) {
- throw new RequestConfigurationException(
- "More than one discriminators declared on: " + forClass);
- }
- discriminatorPresent = true;
- } else {
- atLeastOneOption = true;
- }
- } else {
- throw new RequestConfigurationException(
- "Annotated union field should be private, not final and no static on class: " + forClass);
- }
- }
- }
- if (atLeastOneOption && !discriminatorPresent) {
- throw new RequestConfigurationException("No discriminator annotation found on: " + forClass);
- } else if (!atLeastOneOption && discriminatorPresent) {
- throw new RequestConfigurationException("No union option found on: " + forClass);
- } else if (discriminatorPresent && atLeastOneOption) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Gets union attributes - discriminator field name, option fields etc. This
- * method relies that previously scanned class is valid (method isUnionType)
- *
- * @param forClass
- * @return
- * @throws RequestConfigurationException
- */
- private static UnionAttributes getUnionAttributes(Class<?> forClass) throws RequestConfigurationException {
- UnionAttributes attributes = new UnionAttributes();
- for (int i = 0; i < forClass.getDeclaredFields().length; i++) {
- CorbaUnionElement note = forClass.getDeclaredFields()[i].getAnnotation(CorbaUnionElement.class);
- if (note != null) {
- if (note.type().equals(CorbaUnionElementType.discriminator)) {
- attributes.setDiscriminatorName(forClass.getDeclaredFields()[i].getName());
- } else if (note.type().equals(CorbaUnionElementType.defaultOption)) {
- attributes.setDefaultOptionName(forClass.getDeclaredFields()[i].getName());
- } else if (note.type().equals(CorbaUnionElementType.option)) {
- if (attributes.getOptionsMapping().containsKey(note.optionNumber())) {
- throw new RequestConfigurationException("In " + forClass
- + ": field \""
- + forClass.getDeclaredFields()[i].getName()
- + "\" uses already used option id: "
- + note.optionNumber());
- } else {
- attributes.getOptionsMapping().put(note.optionNumber(),
- forClass.getDeclaredFields()[i].getName());
- }
- }
- }
- }
- return attributes;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java
deleted file mode 100644
index 7d2183fb01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/TypeTreeNode.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types;
-
-/**
- * @version $Rev$ $Date$
- * Represents single tree node.
- *
- */
-public class TypeTreeNode {
-
- private NodeType nodeType;
- private TypeTreeNode[] children;
- private Class<?> javaClass;
- private String name;
- private Object attributes;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public NodeType getNodeType() {
- return nodeType;
- }
-
- public void setNodeType(NodeType nodeType) {
- this.nodeType = nodeType;
- }
-
- public TypeTreeNode[] getChildren() {
- return children;
- }
-
- public void setChildren(TypeTreeNode[] children) {
- this.children = children;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-
- public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
- }
-
- public Object getAttributes() {
- return attributes;
- }
-
- public void setAttributes(Object attributes) {
- this.attributes = attributes;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.java
deleted file mode 100644
index df6358d118..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/UnionAttributes.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.binding.corba.impl.types;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- * Stores attributes for previously scanned CORBA union type
- */
-public class UnionAttributes {
-
- public String discriminatorName;
- public String defaultOptionName;
- public Map<Integer, String> optionsMapping = new HashMap<Integer, String>();
-
- public String getDiscriminatorName() {
- return discriminatorName;
- }
-
- public void setDiscriminatorName(String discriminatorName) {
- this.discriminatorName = discriminatorName;
- }
-
- public String getDefaultOptionName() {
- return defaultOptionName;
- }
-
- public void setDefaultOptionName(String defaultOptionName) {
- this.defaultOptionName = defaultOptionName;
- }
-
- public Map<Integer, String> getOptionsMapping() {
- return optionsMapping;
- }
-
- public void setOptionsMapping(Map<Integer, String> optionsMapping) {
- this.optionsMapping = optionsMapping;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java
deleted file mode 100644
index 6dbeda3b7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ArrayTypeHelper.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Array;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ArrayTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object array = null;
- try {
- int size = (Integer)node.getAttributes();
- array = Array.newInstance(node.getChildren()[0].getJavaClass(), size);
- for (int i = 0; i < size; i++) {
- Array.set(array, i, TypeHelpersProxy.read(node.getChildren()[0], is));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return array;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- for (int i = 0; i < (Integer)node.getAttributes(); i++) {
- TypeHelpersProxy.write(node.getChildren()[0], os, Array.get(data, i));
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java
deleted file mode 100644
index 87d3e93d22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/BooleanTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BooleanTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_boolean();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_boolean((Boolean)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java
deleted file mode 100644
index eb02f1cbcb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ByteTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ByteTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_octet();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_octet((Byte)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java
deleted file mode 100644
index 71f8fbfc47..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/CharTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CharTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_char();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_char((Character)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java
deleted file mode 100644
index c5019c5c0b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/DoubleTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DoubleTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_double();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_double((Double)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.java
deleted file mode 100644
index 6220802ce6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/EnumTypeHelper.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.binding.corba.impl.types.util;
-
-import java.lang.reflect.Method;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EnumTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(EnumTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- int value = is.read_long();
- Object result = null;
- try {
- Method method = node.getJavaClass().getMethod("from_int", new Class[] {int.class});
- result = method.invoke(null, new Object[] {value});
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA enum data", e);
- e.printStackTrace();
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- int value = 0;
- try {
- Method method = data.getClass().getMethod("value", new Class[] {});
- value = (Integer)method.invoke(data, new Object[] {});
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA enum data", e);
- }
- os.write_long(value);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java
deleted file mode 100644
index 3214f8b30d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/FloatTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FloatTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_float();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_float((Float)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java
deleted file mode 100644
index b11175064c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/IntTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class IntTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_long();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_long((Integer)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java
deleted file mode 100644
index 7b4300a1da..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/LongTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class LongTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_longlong();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_longlong((Long)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.java
deleted file mode 100644
index 4e0c2893d2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ReferenceTypeHelper.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.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.reference.InterfaceInstanceCreator;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.Object;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferenceTypeHelper implements TypeHelper {
-
- public java.lang.Object read(TypeTreeNode node, InputStream is) {
- Object reference = is.read_Object();
- return (java.lang.Object)InterfaceInstanceCreator.createInstance(reference, node.getJavaClass());
- }
-
- public void write(TypeTreeNode node, OutputStream os, java.lang.Object data) {
- os.write_Object((Object)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java
deleted file mode 100644
index 5862838cd5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/SequenceTypeHelper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SequenceTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object sequence = null;
- try {
- int size = is.read_long();
- sequence = Array.newInstance(node.getChildren()[0].getJavaClass(), size);
- for (int i = 0; i < size; i++) {
- Array.set(sequence, i, TypeHelpersProxy.read(node.getChildren()[0], is));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return sequence;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- int sum = 0;
- // determine length of array
- List<Object> array = new ArrayList<Object>();
- while (true) {
- try {
- array.add(Array.get(data, sum));
- sum++;
- } catch (ArrayIndexOutOfBoundsException e) {
- break;
- }
- }
- os.write_long(sum);
- Iterator<Object> iter = array.iterator();
- while (iter.hasNext()) {
- Object elem = iter.next();
- TypeHelpersProxy.write(node.getChildren()[0], os, elem);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java
deleted file mode 100644
index 9130db65e4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/ShortTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ShortTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_short();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_short((Short)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java
deleted file mode 100644
index 4d782efcc5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StringTypeHelper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StringTypeHelper implements TypeHelper {
-
- public Object read(TypeTreeNode node, InputStream is) {
- return is.read_string();
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- os.write_string((String)data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
deleted file mode 100644
index 365d62fb73..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/StructTypeHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Field;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StructTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(StructTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- TypeTreeNode[] children = node.getChildren();
- Object result = null;
- if (children != null) {
- try {
- result = node.getJavaClass().newInstance();
- for (int i = 0; i < children.length; i++) {
- Object childResult = TypeHelpersProxy.read(children[i], is);
- Field childField = result.getClass().getField(children[i].getName());
- childField.set(result, childResult);
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA struct data", e);
- }
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- TypeTreeNode[] children = node.getChildren();
- if (children != null) {
- try {
- for (int i = 0; i < children.length; i++) {
- Field childField = node.getJavaClass().getField(children[i].getName());
- TypeHelpersProxy.write(children[i], os, childField.get(data));
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA struct data", e);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java
deleted file mode 100644
index c9d0dd263f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelper.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface TypeHelper {
-
- /**
- * Reads CORBA object
- * @param node
- * @param is
- * @return
- */
- Object read(TypeTreeNode node, InputStream is);
-
- /**
- * Writes CORBA object
- * @param node
- * @param os
- * @param data
- */
- void write(TypeTreeNode node, OutputStream os, Object data);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
deleted file mode 100644
index 72e4ccc6fb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/TypeHelpersProxy.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.NodeType;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- * Proxies getType(), write(), read() methods to appropriate TypeHelper implementation.
- */
-public class TypeHelpersProxy {
-
- /**
- * Maps primitive types to its TypeHelper implementations
- */
- private static Map<Class<?>, TypeHelper> primitiveTypes = null;
-
- /**
- * Maps other types to its TypeHelper implementations
- */
- private static Map<NodeType, TypeHelper> complexTypes = null;
-
- static {
- // initiate type helpers
- primitiveTypes = new HashMap<Class<?>, TypeHelper>();
- complexTypes = new HashMap<NodeType, TypeHelper>();
-
- primitiveTypes.put(boolean.class, new BooleanTypeHelper());
- primitiveTypes.put(char.class, new CharTypeHelper());
- primitiveTypes.put(byte.class, new ByteTypeHelper());
- primitiveTypes.put(short.class, new ShortTypeHelper());
- primitiveTypes.put(int.class, new IntTypeHelper());
- primitiveTypes.put(long.class, new LongTypeHelper());
- primitiveTypes.put(float.class, new FloatTypeHelper());
- primitiveTypes.put(double.class, new DoubleTypeHelper());
- primitiveTypes.put(String.class, new StringTypeHelper());
- primitiveTypes.put(Boolean.class, primitiveTypes.get(boolean.class));
- primitiveTypes.put(Character.class, primitiveTypes.get(char.class));
- primitiveTypes.put(Byte.class, primitiveTypes.get(byte.class));
- primitiveTypes.put(Short.class, primitiveTypes.get(short.class));
- primitiveTypes.put(Integer.class, primitiveTypes.get(int.class));
- primitiveTypes.put(Long.class, primitiveTypes.get(long.class));
- primitiveTypes.put(Float.class, primitiveTypes.get(float.class));
- primitiveTypes.put(Double.class, primitiveTypes.get(double.class));
- primitiveTypes.put(String.class, primitiveTypes.get(String.class));
- complexTypes.put(NodeType.array, new ArrayTypeHelper());
- complexTypes.put(NodeType.struct, new StructTypeHelper());
- complexTypes.put(NodeType.reference, new ReferenceTypeHelper());
- complexTypes.put(NodeType.sequence, new SequenceTypeHelper());
- complexTypes.put(NodeType.idl_enum, new EnumTypeHelper());
- complexTypes.put(NodeType.exception, new StructTypeHelper());
- complexTypes.put(NodeType.union, new UnionTypeHelper());
- }
-
- /**
- * Gets type helper basing on given type
- *
- * @param node
- * @return
- */
- private static TypeHelper getTypeHelper(TypeTreeNode node) {
- TypeHelper typeHelper = null;
- NodeType type = node.getNodeType();
- if (type.equals(NodeType.primitive)) {
- typeHelper = primitiveTypes.get(node.getJavaClass());
- } else {
- typeHelper = complexTypes.get(type);
- }
- return typeHelper;
- }
-
- /**
- * Proxies read method invocation to appropriate TypeHelper implementation.
- *
- * @param node
- * @param is
- * @return
- */
- public static final Object read(TypeTreeNode node, InputStream is) {
- TypeHelper helper = getTypeHelper(node);
- return helper.read(node, is);
- }
-
- /**
- * Proxies write method invocation to appropriate TypeHelper implementation.
- *
- * @param node
- * @param os
- * @param data
- */
- public static final void write(TypeTreeNode node, OutputStream os, Object data) {
- TypeHelper helper = getTypeHelper(node);
- helper.write(node, os, data);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
deleted file mode 100644
index 66c928acec..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/UnionTypeHelper.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.types.util;
-
-import java.lang.reflect.Field;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeNode;
-import org.apache.tuscany.sca.binding.corba.impl.types.UnionAttributes;
-import org.omg.CORBA.portable.InputStream;
-import org.omg.CORBA.portable.OutputStream;
-
-/**
- * @version $Rev$ $Date$
- */
-public class UnionTypeHelper implements TypeHelper {
-
- private static final Logger logger = Logger.getLogger(UnionTypeHelper.class.getName());
-
- public Object read(TypeTreeNode node, InputStream is) {
- Object result = null;
- try {
- int discriminator = is.read_long();
- UnionAttributes attrs = (UnionAttributes)node.getAttributes();
- String childName = attrs.getOptionsMapping().get(discriminator);
- if (childName == null) {
- // get default if option numbers field not found
- childName = attrs.getDefaultOptionName();
- }
- result = node.getJavaClass().newInstance();
- Field discField = result.getClass().getDeclaredField(attrs.getDiscriminatorName());
- discField.setAccessible(true);
- discField.set(result, discriminator);
- for (int i = 0; i < node.getChildren().length; i++) {
- if (node.getChildren()[i].getName().equals(childName)) {
- Object unionValue = TypeHelpersProxy.read(node.getChildren()[i], is);
- Field childField = result.getClass().getDeclaredField(childName);
- childField.setAccessible(true);
- childField.set(result, unionValue);
- break;
- }
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during reading CORBA union data", e);
- }
- return result;
- }
-
- public void write(TypeTreeNode node, OutputStream os, Object data) {
- try {
- UnionAttributes attrs = (UnionAttributes)node.getAttributes();
- Field discriminatorField = data.getClass().getDeclaredField(attrs.getDiscriminatorName());
- discriminatorField.setAccessible(true);
- int discriminator = discriminatorField.getInt(data);
- os.write_long(discriminator);
- String childName = attrs.getOptionsMapping().get(discriminator);
- if (childName == null) {
- // get default if option numbers field not found
- childName = attrs.getDefaultOptionName();
- }
- for (int i = 0; i < node.getChildren().length; i++) {
- if (node.getChildren()[i].getName().equals(childName)) {
- Field childField = data.getClass().getDeclaredField(childName);
- childField.setAccessible(true);
- TypeHelpersProxy.write(node.getChildren()[i], os, childField.get(data));
- break;
- }
- }
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception during writing CORBA union data", e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.java
deleted file mode 100644
index 68f71b7169..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/types/util/Utils.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.binding.corba.impl.types.util;
-
-/**
- * @version $Rev$ $Date$
- * Class for type utilities
- */
-public class Utils {
-
- /**
- * Creates CORBA id for Java class
- * @param forClass
- * @return
- */
- public static String getTypeId(Class<?> forClass) {
- String result = forClass.getName().replace('.', '/');
- result = result.replaceAll("Package", "");
- result = "IDL:" + result + ":1.0";
- return result;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
deleted file mode 100644
index 912d355641..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/MethodFinder.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.impl.util;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- * Utility for finding method in given class.
- */
-public class MethodFinder {
-
- private static Map<Class<?>, Class<?>> boxingMapping;
-
- static {
- boxingMapping = new HashMap<Class<?>, Class<?>>();
- boxingMapping.put(boolean.class, Boolean.class);
- boxingMapping.put(byte.class, Byte.class);
- boxingMapping.put(short.class, Short.class);
- boxingMapping.put(char.class, Character.class);
- boxingMapping.put(int.class, Integer.class);
- boxingMapping.put(long.class, Long.class);
- boxingMapping.put(float.class, Float.class);
- boxingMapping.put(double.class, Double.class);
- }
-
- /**
- * Converts primitive class to its object equivalent.
- *
- * @param parameter class to convert
- * @return object equivalent for primitive type. If parameter wasn't
- * primitive then returns parameter.
- */
- private static Class<?> normalizePrimitive(Class<?> parameter) {
- Class<?> result = boxingMapping.get(parameter);
- if (result != null) {
- return result;
- } else {
- // not a primitive - no need to normalize
- return parameter;
- }
- }
-
- /**
- * Finds appropriate method. This method ignores difference between
- * primitive types and theirs object equivalents. Ie. if we want to find
- * method "get" in java.util.List with only one parameter, which type is
- * Integer then we'll obtain method get(int).
- *
- * @param forClass class which possibly contains desired method
- * @param methodName desired methods name
- * @param parameterTypes desired methods parameter types
- * @return desired method, if no method was found then null will be returned
- */
- public static Method findMethod(Class<?> forClass, String methodName, Class<?>[] parameterTypes) {
- Method[] methods = forClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(methodName)) {
- Class<?>[] methodPTypes = methods[i].getParameterTypes();
- if (methodPTypes.length == parameterTypes.length) {
- boolean parameterMatch = true;
- for (int j = 0; j < methodPTypes.length; j++) {
- Class<?> nMethodPType = normalizePrimitive(methodPTypes[j]);
- Class<?> nParameterType = normalizePrimitive(parameterTypes[j]);
- if (!nMethodPType.equals(nParameterType)) {
- parameterMatch = false;
- break;
- }
- }
- if (parameterMatch) {
- return methods[i];
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
deleted file mode 100644
index a9fabcb82a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/impl/util/OperationMapper.java
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.impl.util;
-
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.omg.CORBA.portable.IDLEntity;
-
-/**
- * @version $Rev$ $Date$
- */
-public final class OperationMapper {
-
- private static Set<Class<?>> getAllInterfaces(Class<?> intfClass) {
- Set<Class<?>> allInterfaces = new LinkedHashSet<Class<?>>();
-
- LinkedList<Class<?>> stack = new LinkedList<Class<?>>();
- stack.addFirst(intfClass);
-
- while (!stack.isEmpty()) {
- Class<?> intf = stack.removeFirst();
- allInterfaces.add(intf);
- for (Class<?> i : intf.getInterfaces()) {
- stack.add(0, i);
- }
- }
-
- return allInterfaces;
- }
-
- /**
- * Maps Java methods to operation names
- * @param intfClass
- * @return
- */
- @SuppressWarnings("unchecked")
- public static Map<Method, String> mapMethodToOperationName(Class<?> intfClass) {
- return iiopMap(intfClass, false);
- }
-
- /**
- * Maps operation names to Java methods
- * @param intfClass
- * @return
- */
- @SuppressWarnings("unchecked")
- public static Map<String, Method> mapOperationNameToMethod(Class<?> intfClass) {
- return iiopMap(intfClass, true);
- }
-
- @SuppressWarnings("unchecked")
- private static Map iiopMap(Class<?> intfClass, boolean operationToMethod) {
- Method[] methods = getAllMethods(intfClass);
-
- // find every valid getter
- Map<Method, String> getterByMethod = new HashMap<Method, String>(methods.length);
- Map<String, Method> getterByName = new HashMap<String, Method>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // no arguments allowed
- if (method.getParameterTypes().length != 0) {
- continue;
- }
-
- // must start with get or is
- String verb;
- if (methodName.startsWith("get") && methodName.length() > 3 && method.getReturnType() != void.class) {
- verb = "get";
- } else if (methodName.startsWith("is") && methodName.length() > 2 && method.getReturnType() == boolean.class) {
- verb = "is";
- } else {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class<?> exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > verb.length() + 1 && Character.isUpperCase(methodName.charAt(verb.length() + 1))) {
- propertyName = methodName.substring(verb.length());
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(verb.length())) + methodName.substring(verb.length() + 1);
- }
- getterByMethod.put(method, propertyName);
- getterByName.put(propertyName, method);
- }
-
- Map<Method, String> setterByMethod = new HashMap<Method, String>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // must have exactally one arg
- if (method.getParameterTypes().length != 1) {
- continue;
- }
-
- // must return non void
- if (method.getReturnType() != void.class) {
- continue;
- }
-
- // must start with set
- if (!methodName.startsWith("set") || methodName.length() <= 3) {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class<?>[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class<?> exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > 4 && Character.isUpperCase(methodName.charAt(4))) {
- propertyName = methodName.substring(3);
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
- }
-
- // must have a matching getter
- Method getter = (Method) getterByName.get(propertyName);
- if (getter == null) {
- continue;
- }
-
- // setter property must match getter return value
- if (!method.getParameterTypes()[0].equals(getter.getReturnType())) {
- continue;
- }
- setterByMethod.put(method, propertyName);
- }
-
- // index the methods by name... used to determine which methods are overloaded
- HashMap<String, List<Method>> overloadedMethods = new HashMap<String, List<Method>>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String methodName = method.getName();
- List<Method> methodList = overloadedMethods.get(methodName);
- if (methodList == null) {
- methodList = new LinkedList<Method>();
- overloadedMethods.put(methodName, methodList);
- }
- methodList.add(method);
- }
-
- // index the methods by lower case name... used to determine which methods differ only by case
- Map<String, Set<String>> caseCollisionMethods = new HashMap<String, Set<String>>(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String lowerCaseMethodName = method.getName().toLowerCase();
- Set<String> methodSet = caseCollisionMethods.get(lowerCaseMethodName);
- if (methodSet == null) {
- methodSet = new HashSet<String>();
- caseCollisionMethods.put(lowerCaseMethodName, methodSet);
- }
- methodSet.add(method.getName());
- }
-
- String className = getClassName(intfClass);
- Map iiopMap = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
-
- String iiopName = (String) getterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_get_" + iiopName.substring(1);
- } else {
- iiopName = "_get_" + iiopName;
- }
- } else {
- iiopName = (String) setterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_set_" + iiopName.substring(1);
- } else {
- iiopName = "_set_" + iiopName;
- }
- } else {
- iiopName = method.getName();
-
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J" + iiopName;
- }
- }
- }
-
- // if this name only differs by case add the case index to the end
- Set<String> caseCollisions = caseCollisionMethods.get(method.getName().toLowerCase());
- if (caseCollisions != null && caseCollisions.size() > 1) {
- iiopName += upperCaseIndexString(iiopName);
- }
-
- // if this is an overloaded method append the parameter string
- List<Method> overloads = overloadedMethods.get(method.getName());
- if (overloads != null && overloads.size() > 1) {
- iiopName += buildOverloadParameterString(method.getParameterTypes());
- }
-
- // if we have a leading underscore prepend with J
- iiopName = replace(iiopName, '$', "U0024");
-
- // if we have matched a keyword prepend with an underscore
- if (keywords.contains(iiopName.toLowerCase())) {
- iiopName = "_" + iiopName;
- }
-
- // if the name is the same as the class name, append an underscore
- if (iiopName.equalsIgnoreCase(className)) {
- iiopName += "_";
- }
-
- if (operationToMethod) {
- iiopMap.put(iiopName, method);
- } else {
- iiopMap.put(method, iiopName);
- }
- }
-
- return iiopMap;
- }
-
- private static Method[] getAllMethods(Class<?> intfClass) {
- List<Method> methods = new LinkedList<Method>();
- for (Iterator<Class<?>> iterator = getAllInterfaces(intfClass).iterator(); iterator.hasNext();) {
- Class<?> intf = iterator.next();
- methods.addAll(Arrays.asList(intf.getDeclaredMethods()));
- }
-
- return (Method[]) methods.toArray(new Method[methods.size()]);
- }
-
- /**
- * Return the a string containing an underscore '_' index of each uppercase
- * character in the IIOP name. This is used for distinction of names that
- * only differ by case, since CORBA does not support case sensitive names.
- */
- private static String upperCaseIndexString(String iiopName) {
- StringBuffer stringBuffer = new StringBuffer();
- for (int i = 0; i < iiopName.length(); i++) {
- char c = iiopName.charAt(i);
- if (Character.isUpperCase(c)) {
- stringBuffer.append('_').append(i);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Replaces any occurances of the specified "oldChar" with the new string.
- * This is used to replace occurances if '$' in CORBA names since '$' is a
- * special character
- */
- private static String replace(String source, char oldChar, String newString) {
- StringBuffer stringBuffer = new StringBuffer(source.length());
- for (int i = 0; i < source.length(); i++) {
- char c = source.charAt(i);
- if (c == oldChar) {
- stringBuffer.append(newString);
- } else {
- stringBuffer.append(c);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Return the a string containing a double underscore '__' list of parameter
- * types encoded using the Java to IDL rules. This is used for distinction
- * of methods that only differ by parameter lists.
- */
- private static String buildOverloadParameterString(Class<?>[] parameterTypes) {
- String name = "";
- if (parameterTypes.length == 0) {
- name += "__";
- } else {
- for (int i = 0; i < parameterTypes.length; i++) {
- Class<?> parameterType = parameterTypes[i];
- name += buildOverloadParameterString(parameterType);
- }
- }
- return name.replace('.', '_');
- }
-
- /**
- * Returns a single parameter type encoded using the Java to IDL rules.
- */
- private static String buildOverloadParameterString(Class<?> parameterType) {
- String name = "_";
-
- int arrayDimensions = 0;
- while (parameterType.isArray()) {
- arrayDimensions++;
- parameterType = parameterType.getComponentType();
- }
-
- // arrays start with org_omg_boxedRMI_
- if (arrayDimensions > 0) {
- name += "_org_omg_boxedRMI";
- }
-
- // IDLEntity types must be prefixed with org_omg_boxedIDL_
- if (IDLEntity.class.isAssignableFrom(parameterType)) {
- name += "_org_omg_boxedIDL";
- }
-
- // add package... some types have special mappings in corba
- String packageName = (String)specialTypePackages.get(parameterType.getName());
- if (packageName == null) {
- packageName = getPackageName(parameterType.getName());
- }
- if (packageName.length() > 0) {
- name += "_" + packageName;
- }
-
- // arrays now contain a dimension indicator
- if (arrayDimensions > 0) {
- name += "_" + "seq" + arrayDimensions;
- }
-
- // add the class name
- String className = (String)specialTypeNames.get(parameterType.getName());
- if (className == null) {
- className = buildClassName(parameterType);
- }
- name += "_" + className;
-
- return name;
- }
-
- /**
- * Returns a string containing an encoded class name.
- */
- private static String buildClassName(Class<?> type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- StringBuffer className = new StringBuffer(typeName.substring(endIndex + 1));
-
- // for innerclasses replace the $ separator with two underscores
- // we can't just blindly replace all $ characters since class names can
- // contain the $ character
- if (type.getDeclaringClass() != null) {
- String declaringClassName = getClassName(type.getDeclaringClass());
- assert className.toString().startsWith(declaringClassName + "$");
- className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
- }
-
- // if we have a leading underscore prepend with J
- if (className.charAt(0) == '_') {
- className.insert(0, "J");
- }
- return className.toString();
- }
-
- private static String getClassName(Class<?> type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- return typeName.substring(endIndex + 1);
- }
-
- private static String getPackageName(String interfaceName) {
- int endIndex = interfaceName.lastIndexOf('.');
- if (endIndex < 0) {
- return "";
- }
- return interfaceName.substring(0, endIndex);
- }
-
- private static final Map<String, String> specialTypeNames;
- private static final Map<String, String> specialTypePackages;
- private static final Set<String> keywords;
-
- static {
- specialTypeNames = new HashMap<String, String>();
- specialTypeNames.put("boolean", "boolean");
- specialTypeNames.put("char", "wchar");
- specialTypeNames.put("byte", "octet");
- specialTypeNames.put("short", "short");
- specialTypeNames.put("int", "long");
- specialTypeNames.put("long", "long_long");
- specialTypeNames.put("float", "float");
- specialTypeNames.put("double", "double");
- specialTypeNames.put("java.lang.Class", "ClassDesc");
- specialTypeNames.put("java.lang.String", "WStringValue");
- specialTypeNames.put("org.omg.CORBA.Object", "Object");
-
- specialTypePackages = new HashMap<String, String>();
- specialTypePackages.put("boolean", "");
- specialTypePackages.put("char", "");
- specialTypePackages.put("byte", "");
- specialTypePackages.put("short", "");
- specialTypePackages.put("int", "");
- specialTypePackages.put("long", "");
- specialTypePackages.put("float", "");
- specialTypePackages.put("double", "");
- specialTypePackages.put("java.lang.Class", "javax.rmi.CORBA");
- specialTypePackages.put("java.lang.String", "CORBA");
- specialTypePackages.put("org.omg.CORBA.Object", "");
-
- keywords = new HashSet<String>();
- keywords.add("abstract");
- keywords.add("any");
- keywords.add("attribute");
- keywords.add("boolean");
- keywords.add("case");
- keywords.add("char");
- keywords.add("const");
- keywords.add("context");
- keywords.add("custom");
- keywords.add("default");
- keywords.add("double");
- keywords.add("enum");
- keywords.add("exception");
- keywords.add("factory");
- keywords.add("false");
- keywords.add("fixed");
- keywords.add("float");
- keywords.add("in");
- keywords.add("inout");
- keywords.add("interface");
- keywords.add("long");
- keywords.add("module");
- keywords.add("native");
- keywords.add("object");
- keywords.add("octet");
- keywords.add("oneway");
- keywords.add("out");
- keywords.add("private");
- keywords.add("public");
- keywords.add("raises");
- keywords.add("readonly");
- keywords.add("sequence");
- keywords.add("short");
- keywords.add("string");
- keywords.add("struct");
- keywords.add("supports");
- keywords.add("switch");
- keywords.add("true");
- keywords.add("truncatable");
- keywords.add("typedef");
- keywords.add("union");
- keywords.add("unsigned");
- keywords.add("valuebase");
- keywords.add("valuetype");
- keywords.add("void");
- keywords.add("wchar");
- keywords.add("wstring");
- }
-
- @SuppressWarnings("unchecked")
- public static Map<Operation, Method> mapOperationToMethod(List<Operation> operations, Class<?> forClass) {
- return (Map<Operation, Method>)createMethod2OperationMapping(operations, forClass, false);
- }
-
- @SuppressWarnings("unchecked")
- public static Map<Method, Operation> mapMethodToOperation(List<Operation> operations, Class<?> forClass) {
- return (Map<Method, Operation>)createMethod2OperationMapping(operations, forClass, true);
- }
-
- /**
- * Maps Java methods to Tuscany operations
- */
- @SuppressWarnings("unchecked")
- private static Map createMethod2OperationMapping(List<Operation> operations, Class<?> forClass, boolean method2operation) {
- // for every operation find all methods with the same name, then
- // compare operations and methods parameters
- Map mapping = new HashMap();
- for (Operation operation : operations) {
- List<DataType> inputTypes = operation.getInputType().getLogical();
- Method[] methods = forClass.getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(operation.getName()) && inputTypes.size() == methods[i]
- .getParameterTypes().length) {
- Class<?>[] parameterTypes = methods[i].getParameterTypes();
- int j = 0;
- boolean parameterMatch = true;
- for (DataType dataType : inputTypes) {
- if (!dataType.getPhysical().equals(parameterTypes[j])) {
- parameterMatch = false;
- break;
- }
- j++;
- }
- if (parameterMatch) {
- // match found
- if (method2operation) {
- mapping.put(methods[i], operation);
- } else {
- mapping.put(operation, methods[i]);
- }
- break;
- }
- }
- }
- }
- return mapping;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java
deleted file mode 100644
index 24661323be..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaArray.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.meta;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev$ $Date$
- * Declares CORBA arrays lengths
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface CorbaArray {
-
- int[] value();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.java
deleted file mode 100644
index 101bda1ba2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElement.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.binding.corba.meta;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * @version $Rev$ $Date$ Declares CORBA union object
- */
-@Retention(RetentionPolicy.RUNTIME)
-public @interface CorbaUnionElement {
-
- // number of option in switch clause
- int optionNumber() default -1;
-
- // type of element
- CorbaUnionElementType type();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.java
deleted file mode 100644
index 3a46fc2b5f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/meta/CorbaUnionElementType.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.binding.corba.meta;
-
-/**
- * @version $Rev$ $Date$
- * Types for union element
- */
-public enum CorbaUnionElementType {
- discriminator, defaultOption, option;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 394e7bbd05..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.corba.impl.CorbaBindingProviderFactory;model=org.apache.tuscany.sca.binding.corba.CorbaBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java
deleted file mode 100644
index 7fc58c9b96..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaServantTestCase.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing;
-
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.lang.reflect.Array;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.CorbaException;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
-import org.apache.tuscany.sca.binding.corba.impl.service.ComponentInvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.types.util.Utils;
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests;
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTestsHelper;
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct;
-import org.apache.tuscany.sca.binding.corba.testing.enums.Color;
-import org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager;
-import org.apache.tuscany.sca.binding.corba.testing.enums.EnumManagerHelper;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcHelper;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported;
-import org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter;
-import org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetterHelper;
-import org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter;
-import org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetterHelper;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct;
-import org.apache.tuscany.sca.binding.corba.testing.generated.TestObject;
-import org.apache.tuscany.sca.binding.corba.testing.generated.TestObjectHelper;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.NonCorbaException;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysSetterServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysUnionsTuscanyServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.CalcServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.EnumManagerServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.InvalidTestObjectServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.InvalidTypesServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.NonCorbaServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.PrimitivesSetterServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.TestObjectServant;
-import org.apache.tuscany.sca.binding.corba.testing.service.mocks.TestRuntimeComponentService;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.omg.CORBA.BAD_OPERATION;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextHelper;
-
-/**
- * @version $Rev$ $Date$
- * Tests API for dynamic CORBA servants
- */
-public class CorbaServantTestCase {
-
- private static ORB orb;
- private static TransientNameServer server;
-
- @BeforeClass
- public static void start() {
- try {
- server =
- new TransientNameServer(TestConstants.TEST2_HOST, TestConstants.TEST2_PORT,
- TransientNameService.DEFAULT_SERVICE_NAME);
- Thread t = server.start();
- if (t == null) {
- Assert.fail("The naming server cannot be started");
- }
- orb = server.getORB();
- } catch (Throwable e) {
- e.printStackTrace();
- Assert.fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void stop() {
- server.stop();
- }
-
- /**
- * Binds servant implementation to name
- */
- private void bindServant(DynaCorbaServant servant, String name) {
- try {
- Object nameService = orb.resolve_initial_references("NameService");
- NamingContext namingContext = NamingContextHelper.narrow(nameService);
-
- NameComponent nc = new NameComponent(name, "");
- NameComponent[] path = new NameComponent[] {nc};
- namingContext.rebind(path, servant);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Returns object reference which is binded to given name
- *
- * @param name
- * @return
- */
- private org.omg.CORBA.Object bindReference(String name) {
- try {
- org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
- NamingContext ncRef = NamingContextHelper.narrow(objRef);
- NameComponent nc = new NameComponent(name, "");
- NameComponent path[] = {nc};
- return ncRef.resolve(path);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Tests primitives (arguments, return types)
- */
- @Test
- public void test_primitivesSetter() {
- try {
- PrimitivesSetter primitivesSetter = new PrimitivesSetterServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(primitivesSetter);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids =
- new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter:1.0"};
- servant.setIds(ids);
- bindServant(servant, "PrimitivesSetter");
- PrimitivesSetter psClient = PrimitivesSetterHelper.narrow(bindReference("PrimitivesSetter"));
- assertTrue(psClient.setBoolean(true) == true);
- assertTrue(psClient.setChar('A') == 'A');
- assertTrue(psClient.setString("SomeTest").equals("SomeTest"));
- assertTrue(psClient.setDouble(2d) == 2d);
- assertTrue(psClient.setFloat(3f) == 3f);
- assertTrue(psClient.setLong(1) == 1);
- assertTrue(psClient.setLongLong(0L) == 0L);
- assertTrue(psClient.setOctet((byte)8) == (byte)8);
- assertTrue(psClient.setShort((short)6) == (short)6);
- assertTrue(psClient.setUnsignedLong(9) == 9);
- assertTrue(psClient.setUnsignedLongLong(11L) == 11L);
- assertTrue(psClient.setUnsignedShort((short)15) == (short)15);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests if array values are equal
- */
- private boolean areArraysEqual(java.lang.Object arr1, java.lang.Object arr2, int arrLen) {
- try {
- for (int i = 0; i < arrLen; i++) {
- if (!Array.get(arr1, i).equals(Array.get(arr2, i))) {
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return false;
- }
-
- /**
- * Tests arrays (arguments, return types)
- */
- @Test
- public void test_arraysSetter() {
- try {
- ArraysSetter arraysSetter = new ArraysSetterServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(arraysSetter);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter:1.0"};
- servant.setIds(ids);
- java.lang.Object result = null;
- bindServant(servant, "ArraysSetter");
- ArraysSetter asClient = ArraysSetterHelper.narrow(bindReference("ArraysSetter"));
-
- boolean[] bArr = new boolean[] {true, false};
- result = (java.lang.Object)asClient.setBoolean(bArr);
- assertTrue(areArraysEqual(bArr, result, bArr.length));
-
- byte[] byArr = new byte[] {1, 2};
- result = (java.lang.Object)asClient.setOctet(byArr);
- assertTrue(areArraysEqual(byArr, result, byArr.length));
-
- short[] shArr = new short[] {1, 2};
- result = (java.lang.Object)asClient.setShort(shArr);
- assertTrue(areArraysEqual(shArr, result, shArr.length));
-
- int[] iArr = new int[] {1, 2};
- result = (java.lang.Object)asClient.setLong(iArr);
- assertTrue(areArraysEqual(iArr, result, iArr.length));
-
- long[] lArr = new long[] {1, 2};
- result = (java.lang.Object)asClient.setLongLong(lArr);
- assertTrue(areArraysEqual(lArr, result, lArr.length));
-
- String[] strArr = new String[] {"Some", "Test"};
- result = (java.lang.Object)asClient.setString(strArr);
- assertTrue(areArraysEqual(strArr, result, strArr.length));
-
- char[] chArr = new char[] {'A', 'B'};
- result = (java.lang.Object)asClient.setChar(chArr);
- assertTrue(areArraysEqual(chArr, result, chArr.length));
-
- float[] flArr = new float[] {1, 2};
- result = (java.lang.Object)asClient.setFloat(flArr);
- assertTrue(areArraysEqual(flArr, result, flArr.length));
-
- double[] dbArr = new double[] {1, 2};
- result = (java.lang.Object)asClient.setDouble(dbArr);
- assertTrue(areArraysEqual(dbArr, result, dbArr.length));
-
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests structures (arguments, return types)
- */
- @Test
- public void test_TestObject_setStruct() {
- try {
- TestObject to = new TestObjectServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(to);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
- servant.setIds(ids);
- bindServant(servant, "TestObject");
- TestObject testObject = TestObjectHelper.narrow(bindReference("TestObject"));
- SomeStruct ss = new SomeStruct();
- SimpleStruct inner = new SimpleStruct();
- inner.field1 = TestConstants.STR_1;
- inner.field2 = TestConstants.INT_1;
- ss.innerStruct = inner;
- ss.str = TestConstants.STR_2;
- ss.str_list = TestConstants.STR_ARR_1;
- ss.threeDimSeq = TestConstants.INT_ARRAY_3_DIM;
- ss.twoDimSeq = TestConstants.INT_ARRAY_2_DIM;
- SomeStruct result = testObject.setStruct(ss);
- assertTrue(TestConstants.are2DimArraysEqual(result.twoDimSeq, TestConstants.INT_ARRAY_2_DIM));
- assertTrue(TestConstants.are3DimArraysEqual(result.threeDimSeq, TestConstants.INT_ARRAY_3_DIM));
- assertTrue(result.str.equals(ss.str));
- assertTrue(result.innerStruct.field1.equals(ss.innerStruct.field1));
- assertTrue(result.innerStruct.field2 == ss.innerStruct.field2);
- assertTrue(areArraysEqual(result.str_list, ss.str_list, ss.str_list.length));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests handling BAD_OPERATION system exception
- */
- @Test
- public void test_systemException_BAD_OPERATION() {
- try {
- TestObjectServant tos = new TestObjectServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
- servant.setIds(ids);
- bindServant(servant, "TestObject");
- DynaCorbaRequest request =
- new DynaCorbaRequest(bindReference("TestObject"), "methodThatSurelyDoesNotExist");
- request.invoke();
- fail();
- } catch (Exception e) {
- if (e instanceof CorbaException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- }
- }
-
- try {
- InvalidTestObjectServant tos = new InvalidTestObjectServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(tos);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
- servant.setIds(ids);
- bindServant(servant, "InvalidTestObject");
- TestObject to = TestObjectHelper.narrow(bindReference("InvalidTestObject"));
- SomeStruct str = new SomeStruct();
- str.innerStruct = new SimpleStruct();
- str.innerStruct.field1 = "Whatever";
- str.str = "Whatever";
- str.str_list = new String[] {};
- str.threeDimSeq = new int[][][] {};
- str.twoDimSeq = new int[][] {};
- to.setStruct(str);
- } catch (Exception e) {
- if (e instanceof BAD_OPERATION) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- }
- }
- }
-
- /**
- * Tests handling user exceptions
- */
- @Test
- public void test_userExceptions() {
- try {
- CalcServant calc = new CalcServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
- servant.setIds(ids);
- bindServant(servant, "Calc");
- Calc calcClient = CalcHelper.narrow(bindReference("Calc"));
- calcClient.div(1, 0);
- fail();
- } catch (Exception e) {
- if (e instanceof DivByZero) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
-
- try {
- CalcServant calc = new CalcServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
- servant.setIds(ids);
- bindServant(servant, "Calc");
- Calc calcClient = CalcHelper.narrow(bindReference("Calc"));
- calcClient.divForSmallArgs(255, 255);
- fail();
- } catch (Exception e) {
- if (e instanceof NotSupported) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
- }
-
- /**
- * Tests enums (arguments, return types)
- */
- @Test
- public void test_enums() {
- try {
- EnumManagerServant ems = new EnumManagerServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(ems);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager:1.0"};
- servant.setIds(ids);
- bindServant(servant, "Enum");
- EnumManager em = EnumManagerHelper.narrow(bindReference("Enum"));
- Color color = Color.red;
- assertTrue(em.getColor(color).value() == color.value());
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- @Test
- public void test_nonCorbaServants() {
- try {
- NonCorbaServant ncs = new NonCorbaServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(ncs);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- bindServant(servant, "NonCorbaServant");
- // it's non corba servant so we don't have stubs to test them
- DynaCorbaRequest request = new DynaCorbaRequest(bindReference("NonCorbaServant"), "setString");
- request.addArgument(TestConstants.STR_1);
- request.setOutputType(String.class);
- DynaCorbaResponse response = request.invoke();
- assertTrue(response.getContent().equals(TestConstants.STR_1));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
-
- try {
- NonCorbaServant ncs = new NonCorbaServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(ncs);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- bindServant(servant, "NonCorbaServant");
- // it's non corba servant so we don't have stubs to test them
- DynaCorbaRequest request = new DynaCorbaRequest(bindReference("NonCorbaServant"), "throwException");
- request.addExceptionType(NonCorbaException.class);
- request.invoke();
- fail();
- } catch (Exception e) {
- if (e instanceof NonCorbaException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
- }
-
- /**
- * Tests handling BAD_PARAM system exception
- */
- @Test
- public void test_systemException_BAD_PARAM() {
- try {
- CalcServant calc = new CalcServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(calc);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
- servant.setIds(ids);
- bindServant(servant, "Calc");
- DynaCorbaRequest request = new DynaCorbaRequest(bindReference("Calc"), "div");
- request.addArgument(2d);
- request.setOutputType(double.class);
- request.invoke();
- fail();
- } catch (Exception e) {
- if (e instanceof CorbaException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
- }
-
- /**
- * Tests handling BAD_PARAM system exception
- */
- @Test
- public void test_invalidServantConfiguraion() {
- try {
- InvalidTypesServant its = new InvalidTypesServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(its);
- //expecting exception...
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- fail();
- } catch (Exception e) {
- if (e instanceof RequestConfigurationException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
- }
-
- /**
- * Tests serving CORBA arrays by Tuscany CORBA servants
- */
- @Test
- public void test_arraysPassing() {
- try {
- ArraysUnionsTuscanyServant arraysUnions = new ArraysUnionsTuscanyServant();
- TestRuntimeComponentService service = new TestRuntimeComponentService(arraysUnions);
- Class<?> javaClass = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
- InvocationProxy proxy = new ComponentInvocationProxy(service, service.getRuntimeWire(null), javaClass);
- DynaCorbaServant servant = new DynaCorbaServant(proxy, Utils.getTypeId(javaClass));
- String[] ids = new String[] {"IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0"};
- servant.setIds(ids);
- bindServant(servant, "ArraysUnions");
- Object reference = bindReference("ArraysUnions");
- ArraysUnionsTests objRef = ArraysUnionsTestsHelper.narrow(reference);
- String[][] stringArray = {{"Hello", "World"}, {"Hi", "Again"}};
- String[][] result = objRef.passStringArray(stringArray);
- for (int i = 0; i < stringArray.length; i++) {
- for (int j = 0; j < stringArray[i].length; j++) {
- assertEquals(stringArray[i][j], result[i][j]);
- }
- }
- TestStruct struct = new TestStruct();
- String[] field1 = {"Hello", "World"};
- int[][] field2 = { {4, 2, 2, 5}, {6, 12, 5, 8}};
- float[][][] field3 = { { {2, 6}, {2, 7}, {9, 3}, {4, 6}}, { {3, 7}, {6, 6}, {3, 5}, {6, 2}}};
- struct.oneDimArray = field1;
- struct.twoDimArray = field2;
- struct.threeDimArray = field3;
-
- TestStruct structResult = objRef.passTestStruct(struct);
- for (int i = 0; i < struct.oneDimArray.length; i++) {
- assertEquals(struct.oneDimArray[i], structResult.oneDimArray[i]);
- }
- for (int i = 0; i < struct.twoDimArray.length; i++) {
- for (int j = 0; j < struct.twoDimArray[i].length; j++) {
- assertEquals(struct.twoDimArray[i][j], structResult.twoDimArray[i][j]);
- }
- }
- for (int i = 0; i < struct.threeDimArray.length; i++) {
- for (int j = 0; j < struct.threeDimArray[i].length; j++) {
- for (int k = 0; k < struct.threeDimArray[i][j].length; k++) {
- assertEquals(struct.threeDimArray[i][j][k], structResult.threeDimArray[i][j][k], 0.0);
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
deleted file mode 100644
index 6521255d3b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/CorbaTypesTestCase.java
+++ /dev/null
@@ -1,841 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Array;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.CorbaException;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
-import org.apache.tuscany.sca.binding.corba.testing.enums.Color;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.ArraysTestStruct;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.DummyObject;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InnerUnion;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidCorbaArray;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidEnum1;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidEnum2;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidEnum3;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct1;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct2;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct3;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion1;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion2;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion3;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion4;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidUnion5;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.RichUnion;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysSetterServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysUnionsServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ArraysUnionsTuscanyServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.CalcServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.EnumManagerServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.ObjectManagerServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.PrimitivesSetterServant;
-import org.apache.tuscany.sca.binding.corba.testing.servants.TestObjectServant;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
-
-/**
- * @version $Rev$ $Date$
- * Tests API for dynamic CORBA requests. Tests handling various Java
- * types.
- */
-public class CorbaTypesTestCase {
- private static TransientNameServer server;
- private static ORB orb;
-
- private static Object refPrimitivesSetter;
- private static Object refArraysSetter;
- private static Object refTestObject;
- private static Object refCalcObject;
- private static Object refObjectManager;
- private static Object refEnumManager;
- private static Object refArraysUnions;
-
- /**
- * Spawns tnameserv process (must be in PATH). Initializes test servants and
- * stores it's references so tests can use it.
- */
- @BeforeClass
- public static void setUp() {
- try {
- try {
- server =
- new TransientNameServer(TestConstants.TEST1_HOST, TestConstants.TEST1_PORT,
- TransientNameService.DEFAULT_SERVICE_NAME);
- Thread t = server.start();
- if (t == null) {
- Assert.fail("The naming server cannot be started");
- }
- orb = server.getORB();
- } catch (Throwable e) {
- e.printStackTrace();
- Assert.fail(e.getMessage());
- }
-
- Object nameService = orb.resolve_initial_references("NameService");
- NamingContext namingContext = NamingContextHelper.narrow(nameService);
-
- PrimitivesSetterServant singleSetter = new PrimitivesSetterServant();
- ArraysSetterServant arraysSetter = new ArraysSetterServant();
- TestObjectServant complexObject = new TestObjectServant();
- CalcServant calcObject = new CalcServant();
- ObjectManagerServant objectManager = new ObjectManagerServant();
- EnumManagerServant enumManager = new EnumManagerServant();
- ArraysUnionsServant arraysUnions = new ArraysUnionsServant();
-
- orb.connect(singleSetter);
- orb.connect(arraysSetter);
-
- NameComponent nc;
- NameComponent[] path;
-
- nc = new NameComponent("PrimitivesSetter", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, singleSetter);
-
- nc = new NameComponent("ArraysSetter", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, arraysSetter);
-
- nc = new NameComponent("TestObject", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, complexObject);
-
- nc = new NameComponent("CalcObject", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, calcObject);
-
- nc = new NameComponent("ObjectManager", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, objectManager);
-
- nc = new NameComponent("EnumManager", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, enumManager);
-
- nc = new NameComponent("ArraysUnions", "");
- path = new NameComponent[] {nc};
- namingContext.rebind(path, arraysUnions);
-
- NamingContextExt nce = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
-
- refArraysSetter = nce.resolve(nce.to_name("ArraysSetter"));
- refPrimitivesSetter = nce.resolve(nce.to_name("PrimitivesSetter"));
- refTestObject = nce.resolve(nce.to_name("TestObject"));
- refCalcObject = nce.resolve(nce.to_name("CalcObject"));
- refObjectManager = nce.resolve(nce.to_name("ObjectManager"));
- refEnumManager = nce.resolve(nce.to_name("EnumManager"));
- refArraysUnions = nce.resolve(nce.to_name("ArraysUnions"));
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void stop() {
- server.stop();
- }
-
- /**
- * Tests remote operation, basing on given reference, operation name,
- * arguments, expected return type and content
- *
- * @param ref remote object
- * @param operationName operation to invoke
- * @param clazz expected return type
- * @param arguments array of operation arguments
- * @param equalTo expected return content
- */
- private void dynaTestInvoker(Object ref,
- String operationName,
- Class<?> clazz,
- java.lang.Object[] arguments,
- java.lang.Object equalTo) {
-
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(ref, operationName);
- request.setOutputType(clazz);
- for (int i = 0; arguments != null && i < arguments.length; i++) {
- request.addArgument(arguments[i]);
- }
-
- DynaCorbaResponse response = request.invoke();
- java.lang.Object content = (java.lang.Object)response.getContent();
- assertTrue(content.getClass().equals(clazz));
- if (equalTo != null && equalTo.getClass().isArray()) {
- for (int i = 0; i < Array.getLength(equalTo); i++) {
- assertTrue(Array.get(content, i).equals(Array.get(equalTo, i)));
- }
- } else {
- assertTrue(content.equals(equalTo));
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail("Error while invoking " + operationName);
- }
- }
-
- /**
- * Tests passing (and getting as result) varied primitives
- */
- @Test
- public void test_setPrimitives() {
-
- dynaTestInvoker(refPrimitivesSetter, "setBoolean", Boolean.class, new Boolean[] {true}, true);
- dynaTestInvoker(refPrimitivesSetter, "setOctet", Byte.class, new Byte[] {1}, (byte)1);
- dynaTestInvoker(refPrimitivesSetter, "setChar", Character.class, new Character[] {'A'}, 'A');
- dynaTestInvoker(refPrimitivesSetter, "setShort", Short.class, new Short[] {1}, (short)1);
- dynaTestInvoker(refPrimitivesSetter, "setLong", Integer.class, new Integer[] {1}, (int)1);
- dynaTestInvoker(refPrimitivesSetter, "setLongLong", Long.class, new Long[] {(long)1}, (long)1);
- dynaTestInvoker(refPrimitivesSetter, "setFloat", Float.class, new Float[] {(float)1}, (float)1);
- dynaTestInvoker(refPrimitivesSetter, "setDouble", Double.class, new Double[] {(double)1}, (double)1);
- dynaTestInvoker(refPrimitivesSetter, "setString", String.class, new String[] {"1"}, "1");
-
- }
-
- /**
- * Tests passing (and getting as result) varied types sequences
- */
- @Test
- public void test_setArrays() {
-
- dynaTestInvoker(refArraysSetter,
- "setBoolean",
- Boolean[].class,
- new Boolean[][] {new Boolean[] {false, true}},
- new Boolean[] {false, true});
-
- dynaTestInvoker(refArraysSetter,
- "setChar",
- Character[].class,
- new Character[][] {new Character[] {'A', 'B'}},
- new Character[] {'A', 'B'});
-
- dynaTestInvoker(refArraysSetter, "setOctet", Byte[].class, new Byte[][] {new Byte[] {1, 2}}, new Byte[] {1, 2});
-
- dynaTestInvoker(refArraysSetter, "setShort", Short[].class, new Short[][] {new Short[] {1, 2}}, new Short[] {1,
- 2});
-
- dynaTestInvoker(refArraysSetter,
- "setLong",
- Integer[].class,
- new Integer[][] {new Integer[] {1, 2}},
- new Integer[] {1, 2});
-
- dynaTestInvoker(refArraysSetter,
- "setLongLong",
- Long[].class,
- new Long[][] {new Long[] {new Long(1), new Long(2)}},
- new Long[] {new Long(1), new Long(2)});
-
- dynaTestInvoker(refArraysSetter,
- "setFloat",
- Float[].class,
- new Float[][] {new Float[] {new Float(1.0), new Float(2.0)}},
- new Float[] {new Float(1.0), new Float(2.0)});
-
- dynaTestInvoker(refArraysSetter,
- "setDouble",
- Double[].class,
- new Double[][] {new Double[] {new Double(1.0), new Double(2.0)}},
- new Double[] {new Double(1.0), new Double(2.0)});
-
- dynaTestInvoker(refArraysSetter,
- "setString",
- String[].class,
- new String[][] {new String[] {"A", "B"}},
- new String[] {"A", "B"});
-
- }
-
- /**
- * Tests passing (and getting as result) complex structure
- */
- @Test
- public void test_TestObject_setStruct() {
- DynaCorbaRequest request = new DynaCorbaRequest(refTestObject, "setStruct");
-
- SomeStruct struct = new SomeStruct();
- SimpleStruct inner = new SimpleStruct();
- inner.field1 = TestConstants.STR_1;
- inner.field2 = TestConstants.INT_1;
- struct.innerStruct = inner;
- struct.str_list = TestConstants.STR_ARR_2;
- struct.twoDimSeq = TestConstants.INT_ARRAY_2_DIM;
- struct.threeDimSeq = TestConstants.INT_ARRAY_3_DIM;
- struct.str = TestConstants.STR_1;
-
- try {
- request.addArgument(struct);
- request.setOutputType(SomeStruct.class);
- DynaCorbaResponse response = request.invoke();
- SomeStruct result = (SomeStruct)response.getContent();
- assertTrue(TestConstants.are2DimArraysEqual(result.twoDimSeq, TestConstants.INT_ARRAY_2_DIM));
- assertTrue(TestConstants.are3DimArraysEqual(result.threeDimSeq, TestConstants.INT_ARRAY_3_DIM));
- assertEquals(TestConstants.STR_1, result.str);
- assertEquals(TestConstants.STR_ARR_2[0], result.str_list[0]);
- assertEquals(TestConstants.STR_ARR_2[1], result.str_list[1]);
- assertEquals(TestConstants.STR_1, result.innerStruct.field1);
- assertEquals(TestConstants.INT_1, result.innerStruct.field2);
- } catch (Exception e) {
- e.printStackTrace();
- fail("Exception occured during tests: " + e);
- }
- }
-
- /**
- * Test passing (and getting as result) simple two-field structure
- */
- @Test
- public void test_TestObject_setSimpleStruct() {
- SimpleStruct struct = new SimpleStruct();
- struct.field1 = TestConstants.STR_1;
- struct.field2 = TestConstants.INT_1;
- DynaCorbaRequest request = new DynaCorbaRequest(refTestObject, "setSimpleStruct");
- try {
- request.setOutputType(SimpleStruct.class);
- request.addArgument(struct);
- DynaCorbaResponse response = request.invoke();
- SimpleStruct retStruct = (SimpleStruct)response.getContent();
- assertTrue(retStruct.field1.equals(struct.field1) && retStruct.field2 == struct.field2);
- } catch (Exception e) {
- e.printStackTrace();
- fail("Exception occured during tests: " + e);
- }
- }
-
- /**
- * Tests passing (and getting as result) two dim. sequence of long.
- */
- @Test
- public void test_TestObject_setLongSeq2() {
- int[][] arr1 = new int[2][2];
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++) {
- arr1[i][j] = (int)(Math.random() * 1000);
- }
- }
- DynaCorbaRequest request = new DynaCorbaRequest(refTestObject, "setLongSeq2");
- try {
- request.setOutputType(arr1.getClass());
- request.addArgument(arr1);
- DynaCorbaResponse response = request.invoke();
- int[][] arr2 = (int[][])response.getContent();
- for (int i = 0; i < 2; i++) {
- for (int j = 0; j < 2; j++) {
- assertEquals(arr1[i][j], arr2[i][j]);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail("Exception occured during tests: " + e);
- }
- }
-
- /**
- * Tests passing multiple complex attributes.
- */
- @Test
- public void test_TestObject_pickStructFromArgs() {
- SomeStruct arg1 = new SomeStruct();
- SomeStruct arg2 = new SomeStruct();
- SomeStruct arg3 = new SomeStruct();
-
- SimpleStruct inner = new SimpleStruct();
- inner.field1 = TestConstants.STR_1;
- inner.field2 = TestConstants.INT_1;
-
- arg1.innerStruct = inner;
- arg2.innerStruct = inner;
- arg3.innerStruct = inner;
-
- arg1.str = TestConstants.STR_1;
- arg2.str = TestConstants.STR_2;
- arg3.str = TestConstants.STR_3;
-
- arg1.str_list = TestConstants.STR_ARR_1;
- arg2.str_list = TestConstants.STR_ARR_2;
- arg3.str_list = TestConstants.STR_ARR_2;
-
- arg1.threeDimSeq = TestConstants.INT_ARRAY_3_DIM;
- arg2.threeDimSeq = TestConstants.INT_ARRAY_3_DIM;
- arg3.threeDimSeq = TestConstants.INT_ARRAY_3_DIM;
-
- arg1.twoDimSeq = TestConstants.INT_ARRAY_2_DIM;
- arg2.twoDimSeq = TestConstants.INT_ARRAY_2_DIM;
- arg3.twoDimSeq = TestConstants.INT_ARRAY_2_DIM;
-
- DynaCorbaRequest request = new DynaCorbaRequest(refTestObject, "pickStructFromArgs");
- try {
-
- request.setOutputType(SomeStruct.class);
- request.addArgument(arg1);
- request.addArgument(arg2);
- request.addArgument(arg3);
- request.addArgument(1);
- DynaCorbaResponse response = request.invoke();
- SomeStruct result = (SomeStruct)response.getContent();
-
- // just make sure that servant returned right structure
- assertTrue(result.str.equals(TestConstants.STR_1));
- } catch (Exception e) {
- fail("Exception occured during tests " + e);
- e.printStackTrace();
- }
-
- }
-
- /**
- * Tests handling user defined remote exception (single declared)
- */
- @Test
- public void test_singleException() {
- DynaCorbaRequest request1 = new DynaCorbaRequest(refCalcObject, "div");
- try {
- request1.addArgument(2d);
- request1.addArgument(2d);
- request1.setOutputType(Double.class);
- request1.addExceptionType(DivByZero.class);
- request1.invoke();
- } catch (Exception e) {
- fail();
- }
-
- DynaCorbaRequest request2 = new DynaCorbaRequest(refCalcObject, "div");
- try {
- request2.addArgument(2d);
- request2.addArgument(0d);
- request2.setOutputType(Double.class);
- request2.addExceptionType(DivByZero.class);
- request2.invoke();
- } catch (DivByZero e) {
- assertTrue(e.info != null && e.arguments != null && e.arguments.arg1 == 2 && e.arguments.arg2 == 0);
- } catch (Exception exc) {
- exc.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests handling user defined multiple exceptions
- */
- @Test
- public void test_multipleExceptions() {
- DynaCorbaRequest request = new DynaCorbaRequest(refCalcObject, "divForSmallArgs");
- try {
- request.addArgument(101d);
- request.addArgument(101d);
- request.setOutputType(Double.class);
- request.addExceptionType(DivByZero.class);
- request.addExceptionType(NotSupported.class);
- request.invoke();
- } catch (Exception e) {
- assertTrue(e instanceof NotSupported);
- }
- }
-
- /**
- * Tests handling exceptions while user defined no exceptions
- */
- @Test
- public void test_noExceptionsDeclared() {
- DynaCorbaRequest request = new DynaCorbaRequest(refCalcObject, "div");
- try {
- request.addArgument(1d);
- request.addArgument(0d);
- request.setOutputType(Double.class);
- request.invoke();
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
- }
-
- /**
- * Tests handling exceptions while user defined no such exception
- */
- @Test
- public void test_noSuchExceptionDeclared() {
- DynaCorbaRequest request = new DynaCorbaRequest(refCalcObject, "div");
- try {
- request.addArgument(1d);
- request.addArgument(0d);
- request.addExceptionType(NotSupported.class);
- request.setOutputType(Double.class);
- request.invoke();
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
- }
-
- /**
- * Tests handling non existing operation situation
- */
- @Test
- public void test_systemException_BAD_OPERATION() {
- DynaCorbaRequest request = new DynaCorbaRequest(refCalcObject, "thisOperationSurelyDoesNotExist");
- try {
- request.invoke();
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof CorbaException);
- }
- }
-
- /**
- * Tests obtaining references to other objects and using them with specified
- * user interface
- */
- @Test
- @Ignore("Cause of tnameservice hang on stop")
- public void test_enchancedReferences() {
- DynaCorbaRequest request = null;
- try {
- request = new DynaCorbaRequest(refObjectManager, "getDummyObject");
- request.setOutputType(DummyObject.class);
- DynaCorbaResponse response = request.invoke();
- DummyObject dummy = (DummyObject)response.getContent();
- DummyObject dummy2 = dummy.cloneObject();
- dummy2.cloneObject();
- assertNotSame(dummy.getLong(), dummy2.getLong());
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Test passing enums as arguments and retrieving them as a result
- */
- @Test
- public void test_enums() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refEnumManager, "getColor");
- Color color = Color.green;
- request.addArgument(color);
- request.setOutputType(Color.class);
- DynaCorbaResponse response = request.invoke();
- Color result = (Color)response.getContent();
- assertEquals(color.value(), result.value());
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests recognizing structures
- */
- @Test
- public void test_structValidation() {
- DynaCorbaRequest request = null;
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidStruct1.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidStruct2.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidStruct3.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(SomeStruct.class);
- } catch (Exception e) {
- fail();
- }
- }
-
- /**
- * Tests recognizing enums
- */
- @Test
- public void test_enumValidation() {
- DynaCorbaRequest request = null;
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidEnum1.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidEnum2.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(InvalidEnum3.class);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof RequestConfigurationException);
- }
-
- try {
- request = new DynaCorbaRequest(refArraysSetter, "whatever");
- request.setOutputType(Color.class);
- } catch (Exception e) {
- fail();
- }
- }
-
- /**
- * Tests handling passing wrong params
- */
- @Test
- public void test_systemException_BAD_PARAM() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refCalcObject, "div");
- request.setOutputType(Double.class);
- request.addArgument(3d);
- request.invoke();
- fail();
- } catch (Exception e) {
- if (e instanceof CorbaException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- fail();
- }
- }
- }
-
- /**
- * Tests passing CORBA arrays
- */
- @Test
- public void test_arraysPassing() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passStringArray");
- Annotation[] notes =
- ArraysUnionsTuscanyServant.class.getMethod("passStringArray", new Class<?>[] {String[][].class})
- .getAnnotations();
- request.setOutputType(String[][].class, notes);
- String[][] argument = { {"Hello", "World"}, {"Hi", "again"}};
- request.addArgument(argument, notes);
- DynaCorbaResponse response = request.invoke();
- String[][] result = (String[][])response.getContent();
- for (int i = 0; i < argument.length; i++) {
- for (int j = 0; j < argument[i].length; j++) {
- assertEquals(argument[i][j], result[i][j]);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
-
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passTestStruct");
- ArraysTestStruct arg = new ArraysTestStruct();
- String[] field1 = {"Hello", "World"};
- arg.field1 = field1;
- int[][] field2 = { {4, 2, 2, 5}, {6, 12, 5, 8}};
- arg.field2 = field2;
- float[][][] field3 = { { {2, 6}, {2, 7}, {9, 3}, {4, 6}}, { {3, 7}, {6, 6}, {3, 5}, {6, 2}}};
- arg.field3 = field3;
- request.addArgument(arg);
- request.setOutputType(ArraysTestStruct.class);
- DynaCorbaResponse response = request.invoke();
- ArraysTestStruct result = (ArraysTestStruct)response.getContent();
- for (int i = 0; i < arg.field1.length; i++) {
- assertEquals(arg.field1[i], result.field1[i]);
- }
- for (int i = 0; i < arg.field2.length; i++) {
- for (int j = 0; j < arg.field2[i].length; j++) {
- assertEquals(arg.field2[i][j], result.field2[i][j]);
- }
- }
- for (int i = 0; i < arg.field2.length; i++) {
- for (int j = 0; j < arg.field2[i].length; j++) {
- for (int k = 0; k < arg.field3[i][j].length; k++) {
- assertEquals(arg.field3[i][j][k], result.field3[i][j][k], 0.0);
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests situation when CORBA array dimension size doesn't match
- * CORBA array annotation arguments (which sets dimension lengths)
- */
- @Test
- public void test_invalidArrayAnnotationSize() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passStringArray");
- Annotation[] notes =
- ArraysUnionsTuscanyServant.class.getMethod("passStringArray", new Class<?>[] {String[][].class})
- .getAnnotations();
- request.setOutputType(String[][][].class, notes);
- fail();
- } catch (RequestConfigurationException e) {
- // expected
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passStringArray");
- Annotation[] notes =
- ArraysUnionsTuscanyServant.class.getMethod("passStringArray", new Class<?>[] {String[][].class})
- .getAnnotations();
- request.addArgument(new String[0][0][0], notes);
- fail();
- } catch (RequestConfigurationException e) {
- // expected
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passStringArray");
- request.addArgument(new InvalidCorbaArray(), null);
- fail();
- } catch (RequestConfigurationException e) {
- // expected
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests passing CORBA unions
- */
- @Test
- public void test_passingUnions() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passRichUnion");
- request.setOutputType(RichUnion.class);
- RichUnion arg = new RichUnion();
- InnerUnion argIu = new InnerUnion();
- argIu.setX(10);
- arg.setIu(argIu);
- request.addArgument(arg);
- DynaCorbaResponse response = request.invoke();
- RichUnion result = (RichUnion)response.getContent();
- assertEquals(arg.getIu().getX(), result.getIu().getX());
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "passRichUnion");
- request.setOutputType(RichUnion.class);
- RichUnion arg = new RichUnion();
- arg.setDef(true);
- request.addArgument(arg);
- DynaCorbaResponse response = request.invoke();
- RichUnion result = (RichUnion)response.getContent();
- assertEquals(arg.isDef(), result.isDef());
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests handling invalid union declarations
- */
- @Test
- public void test_testInvalidUnionClasses() {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
- request.setOutputType(InvalidUnion1.class);
- } catch (Exception e) {
- assertEquals(RequestConfigurationException.class, e.getClass());
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
- request.setOutputType(InvalidUnion2.class);
- } catch (Exception e) {
- assertEquals(RequestConfigurationException.class, e.getClass());
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
- request.setOutputType(InvalidUnion3.class);
- } catch (Exception e) {
- assertEquals(RequestConfigurationException.class, e.getClass());
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
- request.setOutputType(InvalidUnion4.class);
- } catch (Exception e) {
- assertEquals(RequestConfigurationException.class, e.getClass());
- }
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(refArraysUnions, "whatever");
- request.setOutputType(InvalidUnion5.class);
- } catch (Exception e) {
- assertEquals(RequestConfigurationException.class, e.getClass());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.java
deleted file mode 100644
index f0dccd9e7e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MappingTestInterface.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.binding.corba.testing;
-
-/**
- * @version $Rev$ $Date$
- * Interface that can be tested for operations mapping
- */
-public interface MappingTestInterface {
-
- int getIntField();
-
- void setIntField(int intField);
-
- boolean isBoolField();
-
- void setBoolField(boolean boolField);
-
- void overloadedName();
-
- void overloadedName(String arg1);
-
- void overloadedName(String arg1, int arg2);
-
- void caseCollision();
-
- void CaseCollision();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java
deleted file mode 100644
index 725ce0ec41..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/MethodFinderTestCase.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.binding.corba.impl.util.MethodFinder;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- * Various tests for MethodFinder
- */
-public class MethodFinderTestCase {
-
- /**
- * Tests finding existing methods
- */
- @Test
- public void test_findExistingMethod() {
- try {
- String methodName = "rotateLeft";
- Method sample = Integer.class.getMethod(methodName, new Class<?>[] {int.class, int.class});
- Method m1 = MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {int.class, int.class});
- Method m2 =
- MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {Integer.class, Integer.class});
- assertEquals(sample, m1);
- assertEquals(sample, m2);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests null result value for not existing method
- */
- @Test
- public void test_findNotExistingMethod() {
- try {
- String methodName = "rotateLeft";
- Method method = MethodFinder.findMethod(Integer.class, methodName, new Class<?>[] {});
- assertEquals(null, method);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.java
deleted file mode 100644
index 0dd34c26e8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/OperationMappingTestCase.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.binding.corba.testing;
-
-import static org.junit.Assert.assertEquals;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.corba.impl.util.OperationMapper;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- * Various tests for OperationsMapping
- */
-public class OperationMappingTestCase {
-
- /**
- * Tests if Java2IDLUtil maps methods to operations correctly
- */
- @Test
- public void test_mappingRules() {
- Map<Method, String> met2op = OperationMapper.mapMethodToOperationName(MappingTestInterface.class);
- for (Method method : met2op.keySet()) {
- String name = method.getName();
- String translatedName = met2op.get(method);
- if (name.equals("getIntField")) {
- assertEquals("_get_intField", translatedName);
- } else if (name.equals("setIntField")) {
- assertEquals("_set_intField", translatedName);
- } else if (name.equals("isBoolField")) {
- assertEquals("_get_boolField", translatedName);
- } else if (name.equals("setBoolField")) {
- assertEquals("_set_boolField", translatedName);
- } else if (name.equals("overloadedName") && method.getParameterTypes().length == 0) {
- assertEquals("overloadedName__", translatedName);
- } else if (name.equals("overloadedName") && method.getParameterTypes().length == 1) {
- assertEquals("overloadedName__CORBA_WStringValue", translatedName);
- } else if (name.equals("overloadedName") && method.getParameterTypes().length == 2) {
- assertEquals("overloadedName__CORBA_WStringValue__long", translatedName);
- } else if (name.equals("caseCollision")) {
- assertEquals("caseCollision_4", translatedName);
- } else if (name.equals("CaseCollision")) {
- assertEquals("CaseCollision_0_4", translatedName);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/TestConstants.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/TestConstants.java
deleted file mode 100644
index 962a00d002..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/TestConstants.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing;
-
-/**
- * Some constants and utilities for module tests
- * @version $Rev$ $Date$
- */
-public class TestConstants {
-
- public static final String STR_1 = "Hello world!";
- public static final String STR_2 = "2nd string";
- public static final String STR_3 = "Other string";
- public static final String[] STR_ARR_1 = {"Hello", "World"};
- public static final String[] STR_ARR_2 = {"Another", "string", "array"};
- public static final int INT_1 = 0;
-
- public static final int TEST1_PORT = 11100;
- public static final String TEST1_HOST = "localhost";
-
- public static final int TEST2_PORT = 11101;
- public static final String TEST2_HOST = "localhost";
-
- public static final int[][] INT_ARRAY_2_DIM = { {1, 2}, {3, 4}};
- public static final int[][][] INT_ARRAY_3_DIM = { { {1, 2}, {3, 4}}, { {5, 6}, {7, 8}}};
-
- public static final long TNAMESERV_SPAWN_WAIT = 300;
-
- /**
- * Tests if given 2D arrays values are equal
- * @param arr1
- * @param arr2
- * @return
- */
- public static boolean are2DimArraysEqual(int[][] arr1, int[][] arr2) {
- int sum = 0;
- int expSum = 0;
- for (int i = 0; i < arr1.length; i++) {
- for (int j = 0; j < arr1[i].length; j++) {
- expSum++;
- if (arr1[i][j] == arr2[i][j]) {
- sum++;
- }
- }
- }
- return sum == expSum;
- }
-
- /**
- * Tests if given 3D arrays values are equal
- * @param arr1
- * @param arr2
- * @return
- */
- public static boolean are3DimArraysEqual(int[][][] arr1, int[][][] arr2) {
- int sum = 0;
- int expSum = 0;
- for (int i = 0; i < arr1.length; i++) {
- for (int j = 0; j < arr1[i].length; j++) {
- for (int k = 0; k < arr1[i][j].length; k++) {
- expSum++;
- if (arr1[i][j][k] == arr2[i][j][k]) {
- sum++;
- }
- }
- }
- }
- return sum == expSum;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java
deleted file mode 100644
index 154ca31645..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.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.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public interface ArraysUnionsTests extends ArraysUnionsTestsOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
-{
-} // interface ArraysUnionsTests
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java
deleted file mode 100644
index 9f97a6075a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-abstract public class ArraysUnionsTestsHelper
-{
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTestsHelper.id (), "ArraysUnionsTests");
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests read (org.omg.CORBA.portable.InputStream istream)
- {
- return narrow (istream.read_Object (_ArraysUnionsTestsStub.class));
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests value)
- {
- ostream.write_Object ((org.omg.CORBA.Object) value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests narrow (org.omg.CORBA.Object obj)
- {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests)
- return (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests)obj;
- else if (!obj._is_a (id ()))
- throw new org.omg.CORBA.BAD_PARAM ();
- else
- {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions._ArraysUnionsTestsStub stub = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions._ArraysUnionsTestsStub ();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests unchecked_narrow (org.omg.CORBA.Object obj)
- {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests)
- return (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests)obj;
- else
- {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions._ArraysUnionsTestsStub stub = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions._ArraysUnionsTestsStub ();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java
deleted file mode 100644
index e0afdde639..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.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.binding.corba.testing.arrays_unions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class ArraysUnionsTestsHolder implements org.omg.CORBA.portable.Streamable
-{
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests value = null;
-
- public ArraysUnionsTestsHolder ()
- {
- }
-
- public ArraysUnionsTestsHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests initialValue)
- {
- value = initialValue;
- }
-
- public void _read (org.omg.CORBA.portable.InputStream i)
- {
- value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTestsHelper.read (i);
- }
-
- public void _write (org.omg.CORBA.portable.OutputStream o)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTestsHelper.write (o, value);
- }
-
- public org.omg.CORBA.TypeCode _type ()
- {
- return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTestsHelper.type ();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java
deleted file mode 100644
index 1a515b613a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTestsOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public interface ArraysUnionsTestsOperations
-{
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct passTestStruct (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct arg);
- String[][] passStringArray (String[][] arg);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion passRichUnion (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg);
-} // interface ArraysUnionsTestsOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java
deleted file mode 100644
index c590ebb082..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class InnerUnion implements org.omg.CORBA.portable.IDLEntity
-{
- private int ___x;
- private float ___y;
- private int __discriminator;
- private boolean __uninitialized = true;
-
- public InnerUnion ()
- {
- }
-
- public int discriminator ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- return __discriminator;
- }
-
- public int x ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyx (__discriminator);
- return ___x;
- }
-
- public void x (int value)
- {
- __discriminator = 1;
- ___x = value;
- __uninitialized = false;
- }
-
- public void x (int discriminator, int value)
- {
- verifyx (discriminator);
- __discriminator = discriminator;
- ___x = value;
- __uninitialized = false;
- }
-
- private void verifyx (int discriminator)
- {
- if (discriminator != 1)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public float y ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyy (__discriminator);
- return ___y;
- }
-
- public void y (float value)
- {
- __discriminator = 2;
- ___y = value;
- __uninitialized = false;
- }
-
- public void y (int discriminator, float value)
- {
- verifyy (discriminator);
- __discriminator = discriminator;
- ___y = value;
- __uninitialized = false;
- }
-
- private void verifyy (int discriminator)
- {
- if (discriminator != 2)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public void _default ()
- {
- __discriminator = -2147483648;
- __uninitialized = false;
- }
-
- public void _default (int discriminator)
- {
- verifyDefault( discriminator ) ;
- __discriminator = discriminator ;
- __uninitialized = false;
- }
-
- private void verifyDefault( int value )
- {
- switch (value) {
- case 1:
- case 2:
- throw new org.omg.CORBA.BAD_OPERATION() ;
-
- default:
- return;
- }
- }
-
-} // class InnerUnion
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java
deleted file mode 100644
index 977cd6aa4d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-abstract public class InnerUnionHelper
-{
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnion/InnerUnion:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- org.omg.CORBA.TypeCode _disTypeCode0;
- _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
- org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [2];
- org.omg.CORBA.TypeCode _tcOf_members0;
- org.omg.CORBA.Any _anyOf_members0;
-
- // Branch for x (case label 1)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)1);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
- _members0[0] = new org.omg.CORBA.UnionMember (
- "x",
- _anyOf_members0,
- _tcOf_members0,
- null);
-
- // Branch for y (case label 2)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)2);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
- _members0[1] = new org.omg.CORBA.UnionMember (
- "y",
- _anyOf_members0,
- _tcOf_members0,
- null);
- __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.id (), "InnerUnion", _disTypeCode0, _members0);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion read (org.omg.CORBA.portable.InputStream istream)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion ();
- int _dis0 = (int)0;
- _dis0 = istream.read_long ();
- switch (_dis0)
- {
- case 1:
- int _x = (int)0;
- _x = istream.read_long ();
- value.x (_x);
- break;
- case 2:
- float _y = (float)0;
- _y = istream.read_float ();
- value.y (_y);
- break;
- default:
- value._default( _dis0 ) ;
- break;
- }
- return value;
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
- {
- ostream.write_long (value.discriminator ());
- switch (value.discriminator ())
- {
- case 1:
- ostream.write_long (value.x ());
- break;
- case 2:
- ostream.write_float (value.y ());
- break;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java
deleted file mode 100644
index a5f65930a9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.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.binding.corba.testing.arrays_unions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/InnerUnionHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class InnerUnionHolder implements org.omg.CORBA.portable.Streamable
-{
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value = null;
-
- public InnerUnionHolder ()
- {
- }
-
- public InnerUnionHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion initialValue)
- {
- value = initialValue;
- }
-
- public void _read (org.omg.CORBA.portable.InputStream i)
- {
- value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.read (i);
- }
-
- public void _write (org.omg.CORBA.portable.OutputStream o)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.write (o, value);
- }
-
- public org.omg.CORBA.TypeCode _type ()
- {
- return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.type ();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java
deleted file mode 100644
index c1742b4ae3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class RichUnion implements org.omg.CORBA.portable.IDLEntity
-{
- private int ___x;
- private float ___y;
- private String ___z;
- private org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion ___iu;
- private boolean ___a;
- private int __discriminator;
- private boolean __uninitialized = true;
-
- public RichUnion ()
- {
- }
-
- public int discriminator ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- return __discriminator;
- }
-
- public int x ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyx (__discriminator);
- return ___x;
- }
-
- public void x (int value)
- {
- __discriminator = 1;
- ___x = value;
- __uninitialized = false;
- }
-
- public void x (int discriminator, int value)
- {
- verifyx (discriminator);
- __discriminator = discriminator;
- ___x = value;
- __uninitialized = false;
- }
-
- private void verifyx (int discriminator)
- {
- if (discriminator != 1)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public float y ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyy (__discriminator);
- return ___y;
- }
-
- public void y (float value)
- {
- __discriminator = 2;
- ___y = value;
- __uninitialized = false;
- }
-
- public void y (int discriminator, float value)
- {
- verifyy (discriminator);
- __discriminator = discriminator;
- ___y = value;
- __uninitialized = false;
- }
-
- private void verifyy (int discriminator)
- {
- if (discriminator != 2)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public String z ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyz (__discriminator);
- return ___z;
- }
-
- public void z (String value)
- {
- __discriminator = 3;
- ___z = value;
- __uninitialized = false;
- }
-
- public void z (int discriminator, String value)
- {
- verifyz (discriminator);
- __discriminator = discriminator;
- ___z = value;
- __uninitialized = false;
- }
-
- private void verifyz (int discriminator)
- {
- if (discriminator != 3)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion iu ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifyiu (__discriminator);
- return ___iu;
- }
-
- public void iu (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
- {
- __discriminator = 4;
- ___iu = value;
- __uninitialized = false;
- }
-
- public void iu (int discriminator, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion value)
- {
- verifyiu (discriminator);
- __discriminator = discriminator;
- ___iu = value;
- __uninitialized = false;
- }
-
- private void verifyiu (int discriminator)
- {
- if (discriminator != 4)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
- public boolean a ()
- {
- if (__uninitialized)
- throw new org.omg.CORBA.BAD_OPERATION ();
- verifya (__discriminator);
- return ___a;
- }
-
- public void a (boolean value)
- {
- __discriminator = -2147483648;
- ___a = value;
- __uninitialized = false;
- }
-
- public void a (int discriminator, boolean value)
- {
- verifya (discriminator);
- __discriminator = discriminator;
- ___a = value;
- __uninitialized = false;
- }
-
- private void verifya (int discriminator)
- {
- if (discriminator == 1 || discriminator == 2 || discriminator == 3 || discriminator == 4)
- throw new org.omg.CORBA.BAD_OPERATION ();
- }
-
-} // class RichUnion
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java
deleted file mode 100644
index a6682c6f5f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-abstract public class RichUnionHelper
-{
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnion/RichUnion:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- org.omg.CORBA.TypeCode _disTypeCode0;
- _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
- org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [5];
- org.omg.CORBA.TypeCode _tcOf_members0;
- org.omg.CORBA.Any _anyOf_members0;
-
- // Branch for x (case label 1)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)1);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
- _members0[0] = new org.omg.CORBA.UnionMember (
- "x",
- _anyOf_members0,
- _tcOf_members0,
- null);
-
- // Branch for y (case label 2)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)2);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
- _members0[1] = new org.omg.CORBA.UnionMember (
- "y",
- _anyOf_members0,
- _tcOf_members0,
- null);
-
- // Branch for z (case label 3)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)3);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
- _members0[2] = new org.omg.CORBA.UnionMember (
- "z",
- _anyOf_members0,
- _tcOf_members0,
- null);
-
- // Branch for iu (case label 4)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_long ((int)4);
- _tcOf_members0 = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.type ();
- _members0[3] = new org.omg.CORBA.UnionMember (
- "iu",
- _anyOf_members0,
- _tcOf_members0,
- null);
-
- // Branch for a (Default case)
- _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
- _anyOf_members0.insert_octet ((byte)0); // default member label
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean);
- _members0[4] = new org.omg.CORBA.UnionMember (
- "a",
- _anyOf_members0,
- _tcOf_members0,
- null);
- __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.id (), "RichUnion", _disTypeCode0, _members0);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion read (org.omg.CORBA.portable.InputStream istream)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion ();
- int _dis0 = (int)0;
- _dis0 = istream.read_long ();
- switch (_dis0)
- {
- case 1:
- int _x = (int)0;
- _x = istream.read_long ();
- value.x (_x);
- break;
- case 2:
- float _y = (float)0;
- _y = istream.read_float ();
- value.y (_y);
- break;
- case 3:
- String _z = null;
- _z = istream.read_string ();
- value.z (_z);
- break;
- case 4:
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnion _iu = null;
- _iu = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.read (istream);
- value.iu (_iu);
- break;
- default:
- boolean _a = false;
- _a = istream.read_boolean ();
- value.a (_dis0, _a);
- break;
- }
- return value;
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value)
- {
- ostream.write_long (value.discriminator ());
- switch (value.discriminator ())
- {
- case 1:
- ostream.write_long (value.x ());
- break;
- case 2:
- ostream.write_float (value.y ());
- break;
- case 3:
- ostream.write_string (value.z ());
- break;
- case 4:
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.InnerUnionHelper.write (ostream, value.iu ());
- break;
- default:
- ostream.write_boolean (value.a ());
- break;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java
deleted file mode 100644
index c04df97113..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.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.binding.corba.testing.arrays_unions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/RichUnionHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class RichUnionHolder implements org.omg.CORBA.portable.Streamable
-{
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion value = null;
-
- public RichUnionHolder ()
- {
- }
-
- public RichUnionHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion initialValue)
- {
- value = initialValue;
- }
-
- public void _read (org.omg.CORBA.portable.InputStream i)
- {
- value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read (i);
- }
-
- public void _write (org.omg.CORBA.portable.OutputStream o)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write (o, value);
- }
-
- public org.omg.CORBA.TypeCode _type ()
- {
- return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.type ();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java
deleted file mode 100644
index 2ff28612c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.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.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-abstract public class StringArrayHelper
-{
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArray:1.0";
-
- public static void insert (org.omg.CORBA.Any a, String[][] that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static String[][] extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
- __typeCode = org.omg.CORBA.ORB.init ().create_array_tc (2, __typeCode );
- __typeCode = org.omg.CORBA.ORB.init ().create_array_tc (2, __typeCode );
- __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.id (), "StringArray", __typeCode);
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static String[][] read (org.omg.CORBA.portable.InputStream istream)
- {
- String value[][] = null;
- value = new String[2][];
- for (int _o0 = 0;_o0 < (2); ++_o0)
- {
- value[_o0] = new String[2];
- for (int _o1 = 0;_o1 < (2); ++_o1)
- {
- value[_o0][_o1] = istream.read_string ();
- }
- }
- return value;
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, String[][] value)
- {
- if (value.length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i0 = 0;_i0 < (2); ++_i0)
- {
- if (value[_i0].length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i1 = 0;_i1 < (2); ++_i1)
- {
- ostream.write_string (value[_i0][_i1]);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java
deleted file mode 100644
index 5c95a673b0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/StringArrayHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class StringArrayHolder implements org.omg.CORBA.portable.Streamable
-{
- public String value[][] = null;
-
- public StringArrayHolder ()
- {
- }
-
- public StringArrayHolder (String[][] initialValue)
- {
- value = initialValue;
- }
-
- public void _read (org.omg.CORBA.portable.InputStream i)
- {
- value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.read (i);
- }
-
- public void _write (org.omg.CORBA.portable.OutputStream o)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.write (o, value);
- }
-
- public org.omg.CORBA.TypeCode _type ()
- {
- return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.type ();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java
deleted file mode 100644
index a07079b369..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.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.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class TestStruct implements org.omg.CORBA.portable.IDLEntity
-{
- public String oneDimArray[] = null;
- public int twoDimArray[][] = null;
- public float threeDimArray[][][] = null;
-
- public TestStruct ()
- {
- } // ctor
-
- public TestStruct (String[] _oneDimArray, int[][] _twoDimArray, float[][][] _threeDimArray)
- {
- oneDimArray = _oneDimArray;
- twoDimArray = _twoDimArray;
- threeDimArray = _threeDimArray;
- } // ctor
-
-} // class TestStruct
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java
deleted file mode 100644
index 36453797d5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-abstract public class TestStructHelper
-{
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStruct/TestStruct:1.0";
-
- public static void insert (org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct that)
- {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
- a.type (type ());
- write (out, that);
- a.read_value (out.create_input_stream (), type ());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct extract (org.omg.CORBA.Any a)
- {
- return read (a.create_input_stream ());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
- synchronized public static org.omg.CORBA.TypeCode type ()
- {
- if (__typeCode == null)
- {
- synchronized (org.omg.CORBA.TypeCode.class)
- {
- if (__typeCode == null)
- {
- if (__active)
- {
- return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
- _members0[0] = new org.omg.CORBA.StructMember (
- "oneDimArray",
- _tcOf_members0,
- null);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (4, _tcOf_members0 );
- _members0[1] = new org.omg.CORBA.StructMember (
- "twoDimArray",
- _tcOf_members0,
- null);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float);
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (4, _tcOf_members0 );
- _tcOf_members0 = org.omg.CORBA.ORB.init ().create_array_tc (2, _tcOf_members0 );
- _members0[2] = new org.omg.CORBA.StructMember (
- "threeDimArray",
- _tcOf_members0,
- null);
- __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.id (), "TestStruct", _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id ()
- {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct read (org.omg.CORBA.portable.InputStream istream)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct value = new org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct ();
- value.oneDimArray = new String[2];
- for (int _o0 = 0;_o0 < (2); ++_o0)
- {
- value.oneDimArray[_o0] = istream.read_string ();
- }
- value.twoDimArray = new int[2][];
- for (int _o1 = 0;_o1 < (2); ++_o1)
- {
- value.twoDimArray[_o1] = new int[4];
- for (int _o2 = 0;_o2 < (4); ++_o2)
- {
- value.twoDimArray[_o1][_o2] = istream.read_long ();
- }
- }
- value.threeDimArray = new float[2][][];
- for (int _o3 = 0;_o3 < (2); ++_o3)
- {
- value.threeDimArray[_o3] = new float[4][];
- for (int _o4 = 0;_o4 < (4); ++_o4)
- {
- value.threeDimArray[_o3][_o4] = new float[2];
- for (int _o5 = 0;_o5 < (2); ++_o5)
- {
- value.threeDimArray[_o3][_o4][_o5] = istream.read_float ();
- }
- }
- }
- return value;
- }
-
- public static void write (org.omg.CORBA.portable.OutputStream ostream, org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct value)
- {
- if (value.oneDimArray.length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i0 = 0;_i0 < (2); ++_i0)
- {
- ostream.write_string (value.oneDimArray[_i0]);
- }
- if (value.twoDimArray.length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i1 = 0;_i1 < (2); ++_i1)
- {
- if (value.twoDimArray[_i1].length != (4))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i2 = 0;_i2 < (4); ++_i2)
- {
- ostream.write_long (value.twoDimArray[_i1][_i2]);
- }
- }
- if (value.threeDimArray.length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i3 = 0;_i3 < (2); ++_i3)
- {
- if (value.threeDimArray[_i3].length != (4))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i4 = 0;_i4 < (4); ++_i4)
- {
- if (value.threeDimArray[_i3][_i4].length != (2))
- throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- for (int _i5 = 0;_i5 < (2); ++_i5)
- {
- ostream.write_float (value.threeDimArray[_i3][_i4][_i5]);
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java
deleted file mode 100644
index f46ac436be..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.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.binding.corba.testing.arrays_unions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/TestStructHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public final class TestStructHolder implements org.omg.CORBA.portable.Streamable
-{
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct value = null;
-
- public TestStructHolder ()
- {
- }
-
- public TestStructHolder (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct initialValue)
- {
- value = initialValue;
- }
-
- public void _read (org.omg.CORBA.portable.InputStream i)
- {
- value = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.read (i);
- }
-
- public void _write (org.omg.CORBA.portable.OutputStream o)
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.write (o, value);
- }
-
- public org.omg.CORBA.TypeCode _type ()
- {
- return org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.type ();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java
deleted file mode 100644
index 0d25b36786..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.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.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public abstract class _ArraysUnionsTestsImplBase extends org.omg.CORBA.portable.ObjectImpl
- implements org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests, org.omg.CORBA.portable.InvokeHandler
-{
-
- // Constructors
- public _ArraysUnionsTestsImplBase ()
- {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable ();
- static
- {
- _methods.put ("passTestStruct", new java.lang.Integer (0));
- _methods.put ("passStringArray", new java.lang.Integer (1));
- _methods.put ("passRichUnion", new java.lang.Integer (2));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke (String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh)
- {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue ())
- {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests/passTestStruct
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct arg = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.read (in);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct $result = null;
- $result = this.passTestStruct (arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.write (out, $result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests/passStringArray
- {
- String arg[][] = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.read (in);
- String $result[][] = null;
- $result = this.passStringArray (arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.write (out, $result);
- break;
- }
-
- case 2: // org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests/passRichUnion
- {
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read (in);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion $result = null;
- $result = this.passRichUnion (arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write (out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {
- "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0"};
-
- public String[] _ids ()
- {
- return (String[])__ids.clone ();
- }
-
-
-} // class _ArraysUnionsTestsImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java
deleted file mode 100644
index 5046e3d450..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.corba.testing.arrays_unions;
-
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/arrays_unions/_ArraysUnionsTestsStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from arrays_unions.idl
-* niedziela, 17 sierpie 2008 15:45:39 CEST
-*/
-
-public class _ArraysUnionsTestsStub extends org.omg.CORBA.portable.ObjectImpl implements org.apache.tuscany.sca.binding.corba.testing.arrays_unions.ArraysUnionsTests
-{
-
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct passTestStruct (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct arg)
- {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request ("passTestStruct", true);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.write ($out, arg);
- $in = _invoke ($out);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct $result = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStructHelper.read ($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream ();
- String _id = $ex.getId ();
- throw new org.omg.CORBA.MARSHAL (_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return passTestStruct (arg );
- } finally {
- _releaseReply ($in);
- }
- } // passTestStruct
-
- public String[][] passStringArray (String[][] arg)
- {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request ("passStringArray", true);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.write ($out, arg);
- $in = _invoke ($out);
- String $result[][] = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.StringArrayHelper.read ($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream ();
- String _id = $ex.getId ();
- throw new org.omg.CORBA.MARSHAL (_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return passStringArray (arg );
- } finally {
- _releaseReply ($in);
- }
- } // passStringArray
-
- public org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion passRichUnion (org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion arg)
- {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request ("passRichUnion", true);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.write ($out, arg);
- $in = _invoke ($out);
- org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion $result = org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnionHelper.read ($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream ();
- String _id = $ex.getId ();
- throw new org.omg.CORBA.MARSHAL (_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return passRichUnion (arg );
- } finally {
- _releaseReply ($in);
- }
- } // passRichUnion
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {
- "IDL:org/apache/tuscany/sca/binding/corba/testing/arrays_unions/ArraysUnionsTests:1.0"};
-
- public String[] _ids ()
- {
- return (String[])__ids.clone ();
- }
-
- private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
- {
- String str = s.readUTF ();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
- _set_delegate (delegate);
- }
-
- private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
- {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
- s.writeUTF (str);
- }
-} // class _ArraysUnionsTestsStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/Color.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/Color.java
deleted file mode 100644
index e3c28f8b91..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/Color.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/Color.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public class Color implements org.omg.CORBA.portable.IDLEntity {
- private int __value;
- private static int __size = 3;
- private static org.apache.tuscany.sca.binding.corba.testing.enums.Color[] __array =
- new org.apache.tuscany.sca.binding.corba.testing.enums.Color[__size];
-
- public static final int _red = 0;
- public static final org.apache.tuscany.sca.binding.corba.testing.enums.Color red =
- new org.apache.tuscany.sca.binding.corba.testing.enums.Color(_red);
- public static final int _yellow = 1;
- public static final org.apache.tuscany.sca.binding.corba.testing.enums.Color yellow =
- new org.apache.tuscany.sca.binding.corba.testing.enums.Color(_yellow);
- public static final int _green = 2;
- public static final org.apache.tuscany.sca.binding.corba.testing.enums.Color green =
- new org.apache.tuscany.sca.binding.corba.testing.enums.Color(_green);
-
- public int value() {
- return __value;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.Color from_int(int value) {
- if (value >= 0 && value < __size)
- return __array[value];
- else
- throw new org.omg.CORBA.BAD_PARAM();
- }
-
- protected Color(int value) {
- __value = value;
- __array[__value] = this;
- }
-} // class Color
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHelper.java
deleted file mode 100644
index 775cac8e16..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/ColorHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-abstract public class ColorHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/enums/Color:1.0";
-
- public static void insert(org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.enums.Color that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.Color extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init().create_enum_tc(org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper
- .id(),
- "Color",
- new String[] {"red", "yellow", "green"});
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.Color read(org.omg.CORBA.portable.InputStream istream) {
- return org.apache.tuscany.sca.binding.corba.testing.enums.Color.from_int(istream.read_long());
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.enums.Color value) {
- ostream.write_long(value.value());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHolder.java
deleted file mode 100644
index 32cd9c8df6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/ColorHolder.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.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/ColorHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public final class ColorHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.enums.Color value = null;
-
- public ColorHolder() {
- }
-
- public ColorHolder(org.apache.tuscany.sca.binding.corba.testing.enums.Color initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager.java
deleted file mode 100644
index 3f73557952..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager.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.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public interface EnumManager extends EnumManagerOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface EnumManager
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHelper.java
deleted file mode 100644
index a6160a7643..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHelper.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-abstract public class EnumManagerHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager:1.0";
-
- public static void insert(org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.enums.EnumManagerHelper.id(),
- "EnumManager");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_EnumManagerStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager)
- return (org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.enums._EnumManagerStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.enums._EnumManagerStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager)
- return (org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.enums._EnumManagerStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.enums._EnumManagerStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHolder.java
deleted file mode 100644
index 6afa6bc806..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHolder.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.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public final class EnumManagerHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager value = null;
-
- public EnumManagerHolder() {
- }
-
- public EnumManagerHolder(org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.enums.EnumManagerHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.enums.EnumManagerHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.enums.EnumManagerHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerOperations.java
deleted file mode 100644
index bab0c27f77..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerOperations.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/EnumManagerOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public interface EnumManagerOperations {
-
- org.apache.tuscany.sca.binding.corba.testing.enums.Color getColor(org.apache.tuscany.sca.binding.corba.testing.enums.Color color);
-} // interface EnumManagerOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerImplBase.java
deleted file mode 100644
index 514627ff4b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerImplBase.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public abstract class _EnumManagerImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _EnumManagerImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("getColor", new java.lang.Integer(0));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager/getColor
- {
- org.apache.tuscany.sca.binding.corba.testing.enums.Color color =
- org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.enums.Color $result = null;
- $result = this.getColor(color);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.write(out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _EnumManagerImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerStub.java
deleted file mode 100644
index 4629ca9cff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerStub.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.enums;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/enums/_EnumManagerStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from enums.idl
-* czwartek, 19 czerwiec 2008 15:46:10 CEST
-*/
-
-public class _EnumManagerStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.enums.EnumManager {
-
- public org.apache.tuscany.sca.binding.corba.testing.enums.Color getColor(org.apache.tuscany.sca.binding.corba.testing.enums.Color color) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getColor", true);
- org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.write($out, color);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.enums.Color $result =
- org.apache.tuscany.sca.binding.corba.testing.enums.ColorHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getColor(color);
- } finally {
- _releaseReply($in);
- }
- } // getColor
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/enums/EnumManager:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _EnumManagerStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc.java
deleted file mode 100644
index aa480f93ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc.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.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public interface Calc extends CalcOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface Calc
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHelper.java
deleted file mode 100644
index 5ed36ca19b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHelper.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-abstract public class CalcHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0";
-
- public static void insert(org.omg.CORBA.Any a, org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcHelper.id(),
- "Calc");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_CalcStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc)
- return (org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.exceptions._CalcStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.exceptions._CalcStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc)
- return (org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.exceptions._CalcStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.exceptions._CalcStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHolder.java
deleted file mode 100644
index ec1cfadd1e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHolder.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.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class CalcHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc value = null;
-
- public CalcHolder() {
- }
-
- public CalcHolder(org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcOperations.java
deleted file mode 100644
index 29865ace06..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcOperations.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.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public interface CalcOperations {
- double div(double arg1, double arg2)
- throws org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero;
-
- double divForSmallArgs(double arg1, double arg2)
- throws org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported;
-} // interface CalcOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/Arguments.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/Arguments.java
deleted file mode 100644
index d7839ec4db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/Arguments.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/Arguments.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class Arguments implements org.omg.CORBA.portable.IDLEntity {
- public double arg1 = (double)0;
- public double arg2 = (double)0;
-
- public Arguments() {
- } // ctor
-
- public Arguments(double _arg1, double _arg2) {
- arg1 = _arg1;
- arg2 = _arg2;
- } // ctor
-
-} // class Arguments
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHelper.java
deleted file mode 100644
index c47d63208f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHelper.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-abstract public class ArgumentsHelper {
- private static String _id =
- "IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/Arguments/Arguments:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- synchronized (org.omg.CORBA.TypeCode.class) {
- if (__typeCode == null) {
- if (__active) {
- return org.omg.CORBA.ORB.init().create_recursive_tc(_id);
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[2];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_double);
- _members0[0] = new org.omg.CORBA.StructMember("arg1", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_double);
- _members0[1] = new org.omg.CORBA.StructMember("arg2", _tcOf_members0, null);
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_struct_tc(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper
- .id(),
- "Arguments",
- _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments value =
- new org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments();
- value.arg1 = istream.read_double();
- value.arg2 = istream.read_double();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments value) {
- ostream.write_double(value.arg1);
- ostream.write_double(value.arg2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHolder.java
deleted file mode 100644
index f767e8c11a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHolder.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/ArgumentsHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class ArgumentsHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments value = null;
-
- public ArgumentsHolder() {
- }
-
- public ArgumentsHolder(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZero.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZero.java
deleted file mode 100644
index e7cbb4b8ca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZero.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZero.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class DivByZero extends org.omg.CORBA.UserException {
- public org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments arguments = null;
- public String info = null;
-
- public DivByZero() {
- super(DivByZeroHelper.id());
- } // ctor
-
- public DivByZero(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments _arguments,
- String _info) {
- super(DivByZeroHelper.id());
- arguments = _arguments;
- info = _info;
- } // ctor
-
- public DivByZero(String $reason,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments _arguments,
- String _info) {
- super(DivByZeroHelper.id() + " " + $reason);
- arguments = _arguments;
- info = _info;
- } // ctor
-
-} // class DivByZero
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHelper.java
deleted file mode 100644
index 5d27f9969c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-abstract public class DivByZeroHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/DivByZero:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- synchronized (org.omg.CORBA.TypeCode.class) {
- if (__typeCode == null) {
- if (__active) {
- return org.omg.CORBA.ORB.init().create_recursive_tc(_id);
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[2];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 =
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.type();
- _members0[0] = new org.omg.CORBA.StructMember("arguments", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0);
- _members0[1] = new org.omg.CORBA.StructMember("info", _tcOf_members0, null);
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_exception_tc(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper
- .id(),
- "DivByZero",
- _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero value =
- new org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero();
- // read and discard the repository ID
- istream.read_string();
- value.arguments =
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.read(istream);
- value.info = istream.read_string();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero value) {
- // write the repository ID
- ostream.write_string(id());
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.ArgumentsHelper.write(ostream,
- value.arguments);
- ostream.write_string(value.info);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHolder.java
deleted file mode 100644
index ab01c66675..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHolder.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/DivByZeroHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class DivByZeroHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero value = null;
-
- public DivByZeroHolder() {
- }
-
- public DivByZeroHolder(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupported.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupported.java
deleted file mode 100644
index f4ea58e55e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupported.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupported.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class NotSupported extends org.omg.CORBA.UserException {
- public String info = null;
-
- public NotSupported() {
- super(NotSupportedHelper.id());
- } // ctor
-
- public NotSupported(String _info) {
- super(NotSupportedHelper.id());
- info = _info;
- } // ctor
-
- public NotSupported(String $reason, String _info) {
- super(NotSupportedHelper.id() + " " + $reason);
- info = _info;
- } // ctor
-
-} // class NotSupported
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHelper.java
deleted file mode 100644
index 82609a36c1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHelper.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-abstract public class NotSupportedHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/NotSupported:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- synchronized (org.omg.CORBA.TypeCode.class) {
- if (__typeCode == null) {
- if (__active) {
- return org.omg.CORBA.ORB.init().create_recursive_tc(_id);
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[1];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0);
- _members0[0] = new org.omg.CORBA.StructMember("info", _tcOf_members0, null);
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_exception_tc(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper
- .id(),
- "NotSupported",
- _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported value =
- new org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported();
- // read and discard the repository ID
- istream.read_string();
- value.info = istream.read_string();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported value) {
- // write the repository ID
- ostream.write_string(id());
- ostream.write_string(value.info);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHolder.java
deleted file mode 100644
index 1389bd33d9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHolder.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.binding.corba.testing.exceptions.CalcPackage;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/CalcPackage/NotSupportedHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public final class NotSupportedHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported value = null;
-
- public NotSupportedHolder() {
- }
-
- public NotSupportedHolder(org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcImplBase.java
deleted file mode 100644
index a73e252129..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcImplBase.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public abstract class _CalcImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _CalcImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("div", new java.lang.Integer(0));
- _methods.put("divForSmallArgs", new java.lang.Integer(1));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/div
- {
- try {
- double arg1 = in.read_double();
- double arg2 = in.read_double();
- double $result = (double)0;
- $result = this.div(arg1, arg2);
- out = $rh.createReply();
- out.write_double($result);
- } catch (org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero $ex) {
- out = $rh.createExceptionReply();
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.write(out, $ex);
- }
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/divForSmallArgs
- {
- try {
- double arg1 = in.read_double();
- double arg2 = in.read_double();
- double $result = (double)0;
- $result = this.divForSmallArgs(arg1, arg2);
- out = $rh.createReply();
- out.write_double($result);
- } catch (org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero $ex) {
- out = $rh.createExceptionReply();
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.write(out, $ex);
- } catch (org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported $ex) {
- out = $rh.createExceptionReply();
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper.write(out,
- $ex);
- }
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _CalcImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcStub.java
deleted file mode 100644
index 65ce051129..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcStub.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.exceptions;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/exceptions/_CalcStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from exceptions.idl
-* sobota, 7 czerwiec 2008 16:12:31 CEST
-*/
-
-public class _CalcStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.exceptions.Calc {
-
- public double div(double arg1, double arg2)
- throws org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("div", true);
- $out.write_double(arg1);
- $out.write_double(arg2);
- $in = _invoke($out);
- double $result = $in.read_double();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- if (_id.equals("IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/DivByZero:1.0"))
- throw org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.read($in);
- else
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return div(arg1, arg2);
- } finally {
- _releaseReply($in);
- }
- } // div
-
- public double divForSmallArgs(double arg1, double arg2)
- throws org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero,
- org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("divForSmallArgs", true);
- $out.write_double(arg1);
- $out.write_double(arg2);
- $in = _invoke($out);
- double $result = $in.read_double();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- if (_id.equals("IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/DivByZero:1.0"))
- throw org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZeroHelper.read($in);
- else if (_id.equals("IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc/NotSupported:1.0"))
- throw org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupportedHelper.read($in);
- else
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return divForSmallArgs(arg1, arg2);
- } finally {
- _releaseReply($in);
- }
- } // divForSmallArgs
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/exceptions/Calc:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _CalcStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter.java
deleted file mode 100644
index fde204edf8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public interface ArraysSetter extends ArraysSetterOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface ArraysSetter
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHelper.java
deleted file mode 100644
index 71b4fbbdb6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class ArraysSetterHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetterHelper.id(),
- "ArraysSetter");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_ArraysSetterStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._ArraysSetterStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._ArraysSetterStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._ArraysSetterStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._ArraysSetterStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHolder.java
deleted file mode 100644
index d758a560a9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class ArraysSetterHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter value = null;
-
- public ArraysSetterHolder() {
- }
-
- public ArraysSetterHolder(org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetterHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetterHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetterHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterOperations.java
deleted file mode 100644
index 464c2ccbc3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterOperations.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetterOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public interface ArraysSetterOperations {
- boolean[] setBoolean(boolean[] arg);
-
- char[] setChar(char[] arg);
-
- char[] setWchar(char[] arg);
-
- byte[] setOctet(byte[] arg);
-
- short[] setShort(short[] arg);
-
- short[] setUnsignedShort(short[] arg);
-
- int[] setLong(int[] arg);
-
- int[] setUnsignedLong(int[] arg);
-
- long[] setLongLong(long[] arg);
-
- long[] setUnsignedLongLong(long[] arg);
-
- float[] setFloat(float[] arg);
-
- double[] setDouble(double[] arg);
-
- String[] setString(String[] arg);
-
- String[] setWstring(String[] arg);
-
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] setRemoteObject(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] obj);
-} // interface ArraysSetterOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter.java
deleted file mode 100644
index c053f12a02..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface PrimitivesSetter extends PrimitivesSetterOperations, org.omg.CORBA.Object,
- org.omg.CORBA.portable.IDLEntity {
-} // interface PrimitivesSetter
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHelper.java
deleted file mode 100644
index 566689960e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class PrimitivesSetterHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetterHelper
- .id(),
- "PrimitivesSetter");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_PrimitivesSetterStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._PrimitivesSetterStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._PrimitivesSetterStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._PrimitivesSetterStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._PrimitivesSetterStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHolder.java
deleted file mode 100644
index 6564957081..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class PrimitivesSetterHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter value = null;
-
- public PrimitivesSetterHolder() {
- }
-
- public PrimitivesSetterHolder(org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetterHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetterHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetterHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterOperations.java
deleted file mode 100644
index 26669de95a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterOperations.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetterOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface PrimitivesSetterOperations {
- boolean setBoolean(boolean arg);
-
- char setChar(char arg);
-
- char setWchar(char arg);
-
- byte setOctet(byte arg);
-
- short setShort(short arg);
-
- short setUnsignedShort(short arg);
-
- int setLong(int arg);
-
- int setUnsignedLong(int arg);
-
- long setLongLong(long arg);
-
- long setUnsignedLongLong(long arg);
-
- float setFloat(float arg);
-
- double setDouble(double arg);
-
- String setString(String arg);
-
- String setWstring(String arg);
-
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject setRemoteObject(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject obj);
-} // interface PrimitivesSetterOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject.java
deleted file mode 100644
index 5a140f5ecc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface RemoteObject extends RemoteObjectOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface RemoteObject
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHelper.java
deleted file mode 100644
index 2a8fe73417..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class RemoteObjectHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.id(),
- "RemoteObject");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_RemoteObjectStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._RemoteObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._RemoteObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._RemoteObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._RemoteObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHolder.java
deleted file mode 100644
index 63e3926dd2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class RemoteObjectHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject value = null;
-
- public RemoteObjectHolder() {
- }
-
- public RemoteObjectHolder(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectOperations.java
deleted file mode 100644
index a8231236eb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectOperations.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObjectOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface RemoteObjectOperations {
-} // interface RemoteObjectOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct.java
deleted file mode 100644
index ca86420240..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class SimpleStruct implements org.omg.CORBA.portable.IDLEntity {
- public String field1 = null;
- public int field2 = (int)0;
-
- public SimpleStruct() {
- } // ctor
-
- public SimpleStruct(String _field1, int _field2) {
- field1 = _field1;
- field2 = _field2;
- } // ctor
-
-} // class SimpleStruct
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHelper.java
deleted file mode 100644
index 2a8898d38f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class SimpleStructHelper {
- private static String _id =
- "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStruct/SimpleStruct:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- synchronized (org.omg.CORBA.TypeCode.class) {
- if (__typeCode == null) {
- if (__active) {
- return org.omg.CORBA.ORB.init().create_recursive_tc(_id);
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[2];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0);
- _members0[0] = new org.omg.CORBA.StructMember("field1", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- _members0[1] = new org.omg.CORBA.StructMember("field2", _tcOf_members0, null);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_struct_tc(org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper
- .id(),
- "SimpleStruct",
- _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct value =
- new org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct();
- value.field1 = istream.read_string();
- value.field2 = istream.read_long();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct value) {
- ostream.write_string(value.field1);
- ostream.write_long(value.field2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHolder.java
deleted file mode 100644
index bed30e00ca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SimpleStructHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class SimpleStructHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct value = null;
-
- public SimpleStructHolder() {
- }
-
- public SimpleStructHolder(org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct.java
deleted file mode 100644
index 73dbd6c198..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class SomeStruct implements org.omg.CORBA.portable.IDLEntity {
- public org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct innerStruct = null;
- public String str = null;
- public String str_list[] = null;
- public int twoDimSeq[][] = null;
- public int threeDimSeq[][][] = null;
-
- public SomeStruct() {
- } // ctor
-
- public SomeStruct(org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct _innerStruct,
- String _str,
- String[] _str_list,
- int[][] _twoDimSeq,
- int[][][] _threeDimSeq) {
- innerStruct = _innerStruct;
- str = _str;
- str_list = _str_list;
- twoDimSeq = _twoDimSeq;
- threeDimSeq = _threeDimSeq;
- } // ctor
-
-} // class SomeStruct
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHelper.java
deleted file mode 100644
index 8f524ffeb1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class SomeStructHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/SomeStruct/SomeStruct:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
- private static boolean __active = false;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- synchronized (org.omg.CORBA.TypeCode.class) {
- if (__typeCode == null) {
- if (__active) {
- return org.omg.CORBA.ORB.init().create_recursive_tc(_id);
- }
- __active = true;
- org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember[5];
- org.omg.CORBA.TypeCode _tcOf_members0 = null;
- _tcOf_members0 = org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.type();
- _members0[0] = new org.omg.CORBA.StructMember("innerStruct", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0);
- _members0[1] = new org.omg.CORBA.StructMember("str", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_string_tc(0);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper
- .id(),
- "string_list",
- _tcOf_members0);
- _members0[2] = new org.omg.CORBA.StructMember("str_list", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper
- .id(),
- "long_seq1",
- _tcOf_members0);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper
- .id(),
- "long_seq2",
- _tcOf_members0);
- _members0[3] = new org.omg.CORBA.StructMember("twoDimSeq", _tcOf_members0, null);
- _tcOf_members0 = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper
- .id(),
- "long_seq1",
- _tcOf_members0);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper
- .id(),
- "long_seq2",
- _tcOf_members0);
- _tcOf_members0 = org.omg.CORBA.ORB.init().create_sequence_tc(0, _tcOf_members0);
- _tcOf_members0 =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper
- .id(),
- "long_seq3",
- _tcOf_members0);
- _members0[4] = new org.omg.CORBA.StructMember("threeDimSeq", _tcOf_members0, null);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_struct_tc(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper
- .id(),
- "SomeStruct",
- _members0);
- __active = false;
- }
- }
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct value =
- new org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct();
- value.innerStruct = org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.read(istream);
- value.str = istream.read_string();
- value.str_list = org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.read(istream);
- value.twoDimSeq = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read(istream);
- value.threeDimSeq = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.read(istream);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct value) {
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.write(ostream, value.innerStruct);
- ostream.write_string(value.str);
- org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.write(ostream, value.str_list);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write(ostream, value.twoDimSeq);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.write(ostream, value.threeDimSeq);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHolder.java
deleted file mode 100644
index 3231a136dc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/SomeStructHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class SomeStructHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct value = null;
-
- public SomeStructHolder() {
- }
-
- public SomeStructHolder(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObject.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObject.java
deleted file mode 100644
index 28d3ecdc91..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObject.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/TestObject.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface TestObject extends TestObjectOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface TestObject
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHelper.java
deleted file mode 100644
index 29ff2edfd2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class TestObjectHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.TestObject that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.TestObject extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.generated.TestObjectHelper.id(),
- "TestObject");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.TestObject read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_TestObjectStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.TestObject value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.TestObject narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.TestObject)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.TestObject)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._TestObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._TestObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.TestObject unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.generated.TestObject)
- return (org.apache.tuscany.sca.binding.corba.testing.generated.TestObject)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.generated._TestObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.generated._TestObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHolder.java
deleted file mode 100644
index b8aea13c8d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class TestObjectHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.TestObject value = null;
-
- public TestObjectHolder() {
- }
-
- public TestObjectHolder(org.apache.tuscany.sca.binding.corba.testing.generated.TestObject initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.TestObjectHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.TestObjectHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.TestObjectHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectOperations.java
deleted file mode 100644
index 0bacb6746a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectOperations.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/TestObjectOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public interface TestObjectOperations {
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct pickStructFromArgs(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg1,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg2,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg3,
- int structNumber);
-
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct setStruct(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg);
-
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct setSimpleStruct(org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHolder arg);
-
- int[] setLongSeq1(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Holder arg);
-
- int[][] setLongSeq2(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Holder arg);
-
- int[][][] setLongSeq3(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Holder arg);
-} // interface TestObjectOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterImplBase.java
deleted file mode 100644
index c6e8c2a4e0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterImplBase.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public abstract class _ArraysSetterImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _ArraysSetterImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("setBoolean", new java.lang.Integer(0));
- _methods.put("setChar", new java.lang.Integer(1));
- _methods.put("setWchar", new java.lang.Integer(2));
- _methods.put("setOctet", new java.lang.Integer(3));
- _methods.put("setShort", new java.lang.Integer(4));
- _methods.put("setUnsignedShort", new java.lang.Integer(5));
- _methods.put("setLong", new java.lang.Integer(6));
- _methods.put("setUnsignedLong", new java.lang.Integer(7));
- _methods.put("setLongLong", new java.lang.Integer(8));
- _methods.put("setUnsignedLongLong", new java.lang.Integer(9));
- _methods.put("setFloat", new java.lang.Integer(10));
- _methods.put("setDouble", new java.lang.Integer(11));
- _methods.put("setString", new java.lang.Integer(12));
- _methods.put("setWstring", new java.lang.Integer(13));
- _methods.put("setRemoteObject", new java.lang.Integer(14));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setBoolean
- {
- boolean arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.read(in);
- boolean $result[] = null;
- $result = this.setBoolean(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.write(out, $result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setChar
- {
- char arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.read(in);
- char $result[] = null;
- $result = this.setChar(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.write(out, $result);
- break;
- }
-
- case 2: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setWchar
- {
- char arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.read(in);
- char $result[] = null;
- $result = this.setWchar(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.write(out, $result);
- break;
- }
-
- case 3: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setOctet
- {
- byte arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.read(in);
- byte $result[] = null;
- $result = this.setOctet(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.write(out, $result);
- break;
- }
-
- case 4: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setShort
- {
- short arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.read(in);
- short $result[] = null;
- $result = this.setShort(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.write(out, $result);
- break;
- }
-
- case 5: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setUnsignedShort
- {
- short arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.read(in);
- short $result[] = null;
- $result = this.setUnsignedShort(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.write(out, $result);
- break;
- }
-
- case 6: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setLong
- {
- int arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.read(in);
- int $result[] = null;
- $result = this.setLong(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.write(out, $result);
- break;
- }
-
- case 7: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setUnsignedLong
- {
- int arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.read(in);
- int $result[] = null;
- $result = this.setUnsignedLong(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.write(out, $result);
- break;
- }
-
- case 8: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setLongLong
- {
- long arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.read(in);
- long $result[] = null;
- $result = this.setLongLong(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.write(out, $result);
- break;
- }
-
- case 9: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setUnsignedLongLong
- {
- long arg[] =
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.read(in);
- long $result[] = null;
- $result = this.setUnsignedLongLong(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper
- .write(out, $result);
- break;
- }
-
- case 10: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setFloat
- {
- float arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.read(in);
- float $result[] = null;
- $result = this.setFloat(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.write(out, $result);
- break;
- }
-
- case 11: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setDouble
- {
- double arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.read(in);
- double $result[] = null;
- $result = this.setDouble(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.write(out, $result);
- break;
- }
-
- case 12: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setString
- {
- String arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.read(in);
- String $result[] = null;
- $result = this.setString(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.write(out, $result);
- break;
- }
-
- case 13: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setWstring
- {
- String arg[] = org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.read(in);
- String $result[] = null;
- $result = this.setWstring(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.write(out, $result);
- break;
- }
-
- case 14: // org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter/setRemoteObject
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject obj[] =
- org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject $result[] = null;
- $result = this.setRemoteObject(obj);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.write(out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _ArraysSetterImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterStub.java
deleted file mode 100644
index 079cc6e899..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterStub.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_ArraysSetterStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public class _ArraysSetterStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.ArraysSetter {
-
- public boolean[] setBoolean(boolean[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setBoolean", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.write($out, arg);
- $in = _invoke($out);
- boolean $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setBoolean(arg);
- } finally {
- _releaseReply($in);
- }
- } // setBoolean
-
- public char[] setChar(char[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setChar", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.write($out, arg);
- $in = _invoke($out);
- char $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setChar(arg);
- } finally {
- _releaseReply($in);
- }
- } // setChar
-
- public char[] setWchar(char[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setWchar", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.write($out, arg);
- $in = _invoke($out);
- char $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setWchar(arg);
- } finally {
- _releaseReply($in);
- }
- } // setWchar
-
- public byte[] setOctet(byte[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setOctet", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.write($out, arg);
- $in = _invoke($out);
- byte $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setOctet(arg);
- } finally {
- _releaseReply($in);
- }
- } // setOctet
-
- public short[] setShort(short[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setShort", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.write($out, arg);
- $in = _invoke($out);
- short $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setShort(arg);
- } finally {
- _releaseReply($in);
- }
- } // setShort
-
- public short[] setUnsignedShort(short[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedShort", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.write($out, arg);
- $in = _invoke($out);
- short $result[] =
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedShort(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedShort
-
- public int[] setLong(int[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLong", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.write($out, arg);
- $in = _invoke($out);
- int $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLong
-
- public int[] setUnsignedLong(int[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedLong", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.write($out, arg);
- $in = _invoke($out);
- int $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedLong
-
- public long[] setLongLong(long[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLongLong", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.write($out, arg);
- $in = _invoke($out);
- long $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLongLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLongLong
-
- public long[] setUnsignedLongLong(long[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedLongLong", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.write($out, arg);
- $in = _invoke($out);
- long $result[] =
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedLongLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedLongLong
-
- public float[] setFloat(float[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setFloat", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.write($out, arg);
- $in = _invoke($out);
- float $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setFloat(arg);
- } finally {
- _releaseReply($in);
- }
- } // setFloat
-
- public double[] setDouble(double[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setDouble", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.write($out, arg);
- $in = _invoke($out);
- double $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setDouble(arg);
- } finally {
- _releaseReply($in);
- }
- } // setDouble
-
- public String[] setString(String[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setString", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.write($out, arg);
- $in = _invoke($out);
- String $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setString(arg);
- } finally {
- _releaseReply($in);
- }
- } // setString
-
- public String[] setWstring(String[] arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setWstring", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.write($out, arg);
- $in = _invoke($out);
- String $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setWstring(arg);
- } finally {
- _releaseReply($in);
- }
- } // setWstring
-
- public org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] setRemoteObject(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] obj) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setRemoteObject", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.write($out, obj);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject $result[] =
- org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setRemoteObject(obj);
- } finally {
- _releaseReply($in);
- }
- } // setRemoteObject
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/ArraysSetter:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _ArraysSetterStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterImplBase.java
deleted file mode 100644
index b444ce68d8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterImplBase.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public abstract class _PrimitivesSetterImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _PrimitivesSetterImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("setBoolean", new java.lang.Integer(0));
- _methods.put("setChar", new java.lang.Integer(1));
- _methods.put("setWchar", new java.lang.Integer(2));
- _methods.put("setOctet", new java.lang.Integer(3));
- _methods.put("setShort", new java.lang.Integer(4));
- _methods.put("setUnsignedShort", new java.lang.Integer(5));
- _methods.put("setLong", new java.lang.Integer(6));
- _methods.put("setUnsignedLong", new java.lang.Integer(7));
- _methods.put("setLongLong", new java.lang.Integer(8));
- _methods.put("setUnsignedLongLong", new java.lang.Integer(9));
- _methods.put("setFloat", new java.lang.Integer(10));
- _methods.put("setDouble", new java.lang.Integer(11));
- _methods.put("setString", new java.lang.Integer(12));
- _methods.put("setWstring", new java.lang.Integer(13));
- _methods.put("setRemoteObject", new java.lang.Integer(14));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setBoolean
- {
- boolean arg = in.read_boolean();
- boolean $result = false;
- $result = this.setBoolean(arg);
- out = $rh.createReply();
- out.write_boolean($result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setChar
- {
- char arg = in.read_char();
- char $result = (char)0;
- $result = this.setChar(arg);
- out = $rh.createReply();
- out.write_char($result);
- break;
- }
-
- case 2: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setWchar
- {
- char arg = in.read_wchar();
- char $result = (char)0;
- $result = this.setWchar(arg);
- out = $rh.createReply();
- out.write_wchar($result);
- break;
- }
-
- case 3: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setOctet
- {
- byte arg = in.read_octet();
- byte $result = (byte)0;
- $result = this.setOctet(arg);
- out = $rh.createReply();
- out.write_octet($result);
- break;
- }
-
- case 4: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setShort
- {
- short arg = in.read_short();
- short $result = (short)0;
- $result = this.setShort(arg);
- out = $rh.createReply();
- out.write_short($result);
- break;
- }
-
- case 5: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setUnsignedShort
- {
- short arg = in.read_ushort();
- short $result = (short)0;
- $result = this.setUnsignedShort(arg);
- out = $rh.createReply();
- out.write_ushort($result);
- break;
- }
-
- case 6: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setLong
- {
- int arg = in.read_long();
- int $result = (int)0;
- $result = this.setLong(arg);
- out = $rh.createReply();
- out.write_long($result);
- break;
- }
-
- case 7: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setUnsignedLong
- {
- int arg = in.read_ulong();
- int $result = (int)0;
- $result = this.setUnsignedLong(arg);
- out = $rh.createReply();
- out.write_ulong($result);
- break;
- }
-
- case 8: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setLongLong
- {
- long arg = in.read_longlong();
- long $result = (long)0;
- $result = this.setLongLong(arg);
- out = $rh.createReply();
- out.write_longlong($result);
- break;
- }
-
- case 9: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setUnsignedLongLong
- {
- long arg = in.read_ulonglong();
- long $result = (long)0;
- $result = this.setUnsignedLongLong(arg);
- out = $rh.createReply();
- out.write_ulonglong($result);
- break;
- }
-
- case 10: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setFloat
- {
- float arg = in.read_float();
- float $result = (float)0;
- $result = this.setFloat(arg);
- out = $rh.createReply();
- out.write_float($result);
- break;
- }
-
- case 11: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setDouble
- {
- double arg = in.read_double();
- double $result = (double)0;
- $result = this.setDouble(arg);
- out = $rh.createReply();
- out.write_double($result);
- break;
- }
-
- case 12: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setString
- {
- String arg = in.read_string();
- String $result = null;
- $result = this.setString(arg);
- out = $rh.createReply();
- out.write_string($result);
- break;
- }
-
- case 13: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setWstring
- {
- String arg = in.read_wstring();
- String $result = null;
- $result = this.setWstring(arg);
- out = $rh.createReply();
- out.write_wstring($result);
- break;
- }
-
- case 14: // org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter/setRemoteObject
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject obj =
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject $result = null;
- $result = this.setRemoteObject(obj);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.write(out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _PrimitivesSetterImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterStub.java
deleted file mode 100644
index 0b08e1fb67..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterStub.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_PrimitivesSetterStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public class _PrimitivesSetterStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.PrimitivesSetter {
-
- public boolean setBoolean(boolean arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setBoolean", true);
- $out.write_boolean(arg);
- $in = _invoke($out);
- boolean $result = $in.read_boolean();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setBoolean(arg);
- } finally {
- _releaseReply($in);
- }
- } // setBoolean
-
- public char setChar(char arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setChar", true);
- $out.write_char(arg);
- $in = _invoke($out);
- char $result = $in.read_char();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setChar(arg);
- } finally {
- _releaseReply($in);
- }
- } // setChar
-
- public char setWchar(char arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setWchar", true);
- $out.write_wchar(arg);
- $in = _invoke($out);
- char $result = $in.read_wchar();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setWchar(arg);
- } finally {
- _releaseReply($in);
- }
- } // setWchar
-
- public byte setOctet(byte arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setOctet", true);
- $out.write_octet(arg);
- $in = _invoke($out);
- byte $result = $in.read_octet();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setOctet(arg);
- } finally {
- _releaseReply($in);
- }
- } // setOctet
-
- public short setShort(short arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setShort", true);
- $out.write_short(arg);
- $in = _invoke($out);
- short $result = $in.read_short();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setShort(arg);
- } finally {
- _releaseReply($in);
- }
- } // setShort
-
- public short setUnsignedShort(short arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedShort", true);
- $out.write_ushort(arg);
- $in = _invoke($out);
- short $result = $in.read_ushort();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedShort(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedShort
-
- public int setLong(int arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLong", true);
- $out.write_long(arg);
- $in = _invoke($out);
- int $result = $in.read_long();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLong
-
- public int setUnsignedLong(int arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedLong", true);
- $out.write_ulong(arg);
- $in = _invoke($out);
- int $result = $in.read_ulong();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedLong
-
- public long setLongLong(long arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLongLong", true);
- $out.write_longlong(arg);
- $in = _invoke($out);
- long $result = $in.read_longlong();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLongLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLongLong
-
- public long setUnsignedLongLong(long arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setUnsignedLongLong", true);
- $out.write_ulonglong(arg);
- $in = _invoke($out);
- long $result = $in.read_ulonglong();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setUnsignedLongLong(arg);
- } finally {
- _releaseReply($in);
- }
- } // setUnsignedLongLong
-
- public float setFloat(float arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setFloat", true);
- $out.write_float(arg);
- $in = _invoke($out);
- float $result = $in.read_float();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setFloat(arg);
- } finally {
- _releaseReply($in);
- }
- } // setFloat
-
- public double setDouble(double arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setDouble", true);
- $out.write_double(arg);
- $in = _invoke($out);
- double $result = $in.read_double();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setDouble(arg);
- } finally {
- _releaseReply($in);
- }
- } // setDouble
-
- public String setString(String arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setString", true);
- $out.write_string(arg);
- $in = _invoke($out);
- String $result = $in.read_string();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setString(arg);
- } finally {
- _releaseReply($in);
- }
- } // setString
-
- public String setWstring(String arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setWstring", true);
- $out.write_wstring(arg);
- $in = _invoke($out);
- String $result = $in.read_wstring();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setWstring(arg);
- } finally {
- _releaseReply($in);
- }
- } // setWstring
-
- public org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject setRemoteObject(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject obj) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setRemoteObject", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.write($out, obj);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject $result =
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setRemoteObject(obj);
- } finally {
- _releaseReply($in);
- }
- } // setRemoteObject
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/PrimitivesSetter:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _PrimitivesSetterStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectImplBase.java
deleted file mode 100644
index a87534f88b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectImplBase.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public abstract class _RemoteObjectImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _RemoteObjectImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _RemoteObjectImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectStub.java
deleted file mode 100644
index e219dfa338..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectStub.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_RemoteObjectStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public class _RemoteObjectStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject {
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/RemoteObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _RemoteObjectStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectImplBase.java
deleted file mode 100644
index c0bc0d6ebd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectImplBase.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public abstract class _TestObjectImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.TestObject, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _TestObjectImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("pickStructFromArgs", new java.lang.Integer(0));
- _methods.put("setStruct", new java.lang.Integer(1));
- _methods.put("setSimpleStruct", new java.lang.Integer(2));
- _methods.put("setLongSeq1", new java.lang.Integer(3));
- _methods.put("setLongSeq2", new java.lang.Integer(4));
- _methods.put("setLongSeq3", new java.lang.Integer(5));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/pickStructFromArgs
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg1 =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg2 =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg3 =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read(in);
- int structNumber = in.read_long();
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct $result = null;
- $result = this.pickStructFromArgs(arg1, arg2, arg3, structNumber);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write(out, $result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/setStruct
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct $result = null;
- $result = this.setStruct(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write(out, $result);
- break;
- }
-
- case 2: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/setSimpleStruct
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHolder arg =
- new org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHolder();
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct $result = null;
- $result = this.setSimpleStruct(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.write(out, $result);
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.write(out, arg.value);
- break;
- }
-
- case 3: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/setLongSeq1
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Holder arg =
- new org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Holder();
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.read(in);
- int $result[] = null;
- $result = this.setLongSeq1(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.write(out, $result);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.write(out, arg.value);
- break;
- }
-
- case 4: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/setLongSeq2
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Holder arg =
- new org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Holder();
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read(in);
- int $result[][] = null;
- $result = this.setLongSeq2(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write(out, $result);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write(out, arg.value);
- break;
- }
-
- case 5: // org/apache/tuscany/sca/binding/corba/testing/generated/TestObject/setLongSeq3
- {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Holder arg =
- new org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Holder();
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.read(in);
- int $result[][][] = null;
- $result = this.setLongSeq3(arg);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.write(out, $result);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.write(out, arg.value);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _TestObjectImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectStub.java
deleted file mode 100644
index ad47595ddf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectStub.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/_TestObjectStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public class _TestObjectStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.generated.TestObject {
-
- public org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct pickStructFromArgs(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg1,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg2,
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg3,
- int structNumber) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("pickStructFromArgs", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write($out, arg1);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write($out, arg2);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write($out, arg3);
- $out.write_long(structNumber);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct $result =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return pickStructFromArgs(arg1, arg2, arg3, structNumber);
- } finally {
- _releaseReply($in);
- }
- } // pickStructFromArgs
-
- public org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct setStruct(org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setStruct", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.write($out, arg);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct $result =
- org.apache.tuscany.sca.binding.corba.testing.generated.SomeStructHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setStruct(arg);
- } finally {
- _releaseReply($in);
- }
- } // setStruct
-
- public org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct setSimpleStruct(org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHolder arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setSimpleStruct", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.write($out, arg.value);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct $result =
- org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.read($in);
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setSimpleStruct(arg);
- } finally {
- _releaseReply($in);
- }
- } // setSimpleStruct
-
- public int[] setLongSeq1(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Holder arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLongSeq1", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.write($out, arg.value);
- $in = _invoke($out);
- int $result[] = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.read($in);
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLongSeq1(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLongSeq1
-
- public int[][] setLongSeq2(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Holder arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLongSeq2", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write($out, arg.value);
- $in = _invoke($out);
- int $result[][] = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read($in);
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLongSeq2(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLongSeq2
-
- public int[][][] setLongSeq3(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Holder arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("setLongSeq3", true);
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.write($out, arg.value);
- $in = _invoke($out);
- int $result[][][] = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.read($in);
- arg.value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return setLongSeq3(arg);
- } finally {
- _releaseReply($in);
- }
- } // setLongSeq3
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/generated/TestObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _TestObjectStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHelper.java
deleted file mode 100644
index f3d96e8fd7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class boolean_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/boolean_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, boolean[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static boolean[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.id(),
- "boolean_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static boolean[] read(org.omg.CORBA.portable.InputStream istream) {
- boolean value[] = null;
- int _len0 = istream.read_long();
- value = new boolean[_len0];
- istream.read_boolean_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, boolean[] value) {
- ostream.write_long(value.length);
- ostream.write_boolean_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHolder.java
deleted file mode 100644
index cb0ab8bcfd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/boolean_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class boolean_listHolder implements org.omg.CORBA.portable.Streamable {
- public boolean value[] = null;
-
- public boolean_listHolder() {
- }
-
- public boolean_listHolder(boolean[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.boolean_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHelper.java
deleted file mode 100644
index 0bde1e701c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/char_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class char_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/char_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, char[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static char[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_char);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.id(),
- "char_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static char[] read(org.omg.CORBA.portable.InputStream istream) {
- char value[] = null;
- int _len0 = istream.read_long();
- value = new char[_len0];
- istream.read_char_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, char[] value) {
- ostream.write_long(value.length);
- ostream.write_char_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHolder.java
deleted file mode 100644
index 19b2942cfe..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/char_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/char_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class char_listHolder implements org.omg.CORBA.portable.Streamable {
- public char value[] = null;
-
- public char_listHolder() {
- }
-
- public char_listHolder(char[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.char_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHelper.java
deleted file mode 100644
index 8bb5a9c69d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/double_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class double_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/double_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, double[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static double[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_double);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.id(),
- "double_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static double[] read(org.omg.CORBA.portable.InputStream istream) {
- double value[] = null;
- int _len0 = istream.read_long();
- value = new double[_len0];
- istream.read_double_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, double[] value) {
- ostream.write_long(value.length);
- ostream.write_double_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHolder.java
deleted file mode 100644
index dc89e71092..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/double_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/double_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class double_listHolder implements org.omg.CORBA.portable.Streamable {
- public double value[] = null;
-
- public double_listHolder() {
- }
-
- public double_listHolder(double[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.double_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHelper.java
deleted file mode 100644
index 7b71aa0a9f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/float_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class float_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/float_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, float[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static float[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_float);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.id(),
- "float_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static float[] read(org.omg.CORBA.portable.InputStream istream) {
- float value[] = null;
- int _len0 = istream.read_long();
- value = new float[_len0];
- istream.read_float_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, float[] value) {
- ostream.write_long(value.length);
- ostream.write_float_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHolder.java
deleted file mode 100644
index 513bab37cc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/float_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/float_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class float_listHolder implements org.omg.CORBA.portable.Streamable {
- public float value[] = null;
-
- public float_listHolder() {
- }
-
- public float_listHolder(float[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.float_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHelper.java
deleted file mode 100644
index c1d06e2ba9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class long_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/long_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, int[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static int[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.id(),
- "long_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static int[] read(org.omg.CORBA.portable.InputStream istream) {
- int value[] = null;
- int _len0 = istream.read_long();
- value = new int[_len0];
- istream.read_long_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, int[] value) {
- ostream.write_long(value.length);
- ostream.write_long_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHolder.java
deleted file mode 100644
index f9ad7b77ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class long_listHolder implements org.omg.CORBA.portable.Streamable {
- public int value[] = null;
-
- public long_listHolder() {
- }
-
- public long_listHolder(int[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.long_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHelper.java
deleted file mode 100644
index cfb292fc01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-abstract public class long_long_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/long_long_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, long[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static long[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_longlong);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.id(),
- "long_long_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static long[] read(org.omg.CORBA.portable.InputStream istream) {
- long value[] = null;
- int _len0 = istream.read_long();
- value = new long[_len0];
- istream.read_longlong_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, long[] value) {
- ostream.write_long(value.length);
- ostream.write_longlong_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHolder.java
deleted file mode 100644
index 02f46a7d85..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_long_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 14:12:28 CEST
-*/
-
-public final class long_long_listHolder implements org.omg.CORBA.portable.Streamable {
- public long value[] = null;
-
- public long_long_listHolder() {
- }
-
- public long_long_listHolder(long[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.long_long_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Helper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Helper.java
deleted file mode 100644
index 505aa3f026..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Helper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Helper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class long_seq1Helper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1:1.0";
-
- public static void insert(org.omg.CORBA.Any a, int[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static int[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.id(),
- "long_seq1",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static int[] read(org.omg.CORBA.portable.InputStream istream) {
- int value[] = null;
- int _len0 = istream.read_long();
- value = new int[_len0];
- istream.read_long_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, int[] value) {
- ostream.write_long(value.length);
- ostream.write_long_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Holder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Holder.java
deleted file mode 100644
index 5cbaa109ee..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Holder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq1Holder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class long_seq1Holder implements org.omg.CORBA.portable.Streamable {
- public int value[] = null;
-
- public long_seq1Holder() {
- }
-
- public long_seq1Holder(int[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Helper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Helper.java
deleted file mode 100644
index 2f792888fb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Helper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Helper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class long_seq2Helper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2:1.0";
-
- public static void insert(org.omg.CORBA.Any a, int[][] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static int[][] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.id(),
- "long_seq1",
- __typeCode);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.id(),
- "long_seq2",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static int[][] read(org.omg.CORBA.portable.InputStream istream) {
- int value[][] = null;
- int _len0 = istream.read_long();
- value = new int[_len0][];
- for (int _o1 = 0; _o1 < value.length; ++_o1)
- value[_o1] = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.read(istream);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, int[][] value) {
- ostream.write_long(value.length);
- for (int _i0 = 0; _i0 < value.length; ++_i0)
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.write(ostream, value[_i0]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Holder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Holder.java
deleted file mode 100644
index 8b2ccc1f73..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Holder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq2Holder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class long_seq2Holder implements org.omg.CORBA.portable.Streamable {
- public int value[][] = null;
-
- public long_seq2Holder() {
- }
-
- public long_seq2Holder(int[][] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Helper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Helper.java
deleted file mode 100644
index 67e224f0be..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Helper.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Helper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class long_seq3Helper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3:1.0";
-
- public static void insert(org.omg.CORBA.Any a, int[][][] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static int[][][] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_long);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Helper.id(),
- "long_seq1",
- __typeCode);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.id(),
- "long_seq2",
- __typeCode);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.id(),
- "long_seq3",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static int[][][] read(org.omg.CORBA.portable.InputStream istream) {
- int value[][][] = null;
- int _len0 = istream.read_long();
- value = new int[_len0][][];
- for (int _o1 = 0; _o1 < value.length; ++_o1)
- value[_o1] = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.read(istream);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, int[][][] value) {
- ostream.write_long(value.length);
- for (int _i0 = 0; _i0 < value.length; ++_i0)
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Helper.write(ostream, value[_i0]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Holder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Holder.java
deleted file mode 100644
index 5d4adfba2d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Holder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/long_seq3Holder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class long_seq3Holder implements org.omg.CORBA.portable.Streamable {
- public int value[][][] = null;
-
- public long_seq3Holder() {
- }
-
- public long_seq3Holder(int[][][] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Helper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHelper.java
deleted file mode 100644
index c7d86d9179..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class octet_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/octet_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, byte[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static byte[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_octet);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.id(),
- "octet_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static byte[] read(org.omg.CORBA.portable.InputStream istream) {
- byte value[] = null;
- int _len0 = istream.read_long();
- value = new byte[_len0];
- istream.read_octet_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, byte[] value) {
- ostream.write_long(value.length);
- ostream.write_octet_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHolder.java
deleted file mode 100644
index 09b2b85c6a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/octet_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class octet_listHolder implements org.omg.CORBA.portable.Streamable {
- public byte value[] = null;
-
- public octet_listHolder() {
- }
-
- public octet_listHolder(byte[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.octet_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHelper.java
deleted file mode 100644
index e88b1e06c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class remote_object_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.type();
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper
- .id(),
- "remote_object_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] read(org.omg.CORBA.portable.InputStream istream) {
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject value[] = null;
- int _len0 = istream.read_long();
- value = new org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[_len0];
- for (int _o1 = 0; _o1 < value.length; ++_o1)
- value[_o1] = org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.read(istream);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] value) {
- ostream.write_long(value.length);
- for (int _i0 = 0; _i0 < value.length; ++_i0)
- org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObjectHelper.write(ostream, value[_i0]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHolder.java
deleted file mode 100644
index d3f996c5b4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/remote_object_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class remote_object_listHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject value[] = null;
-
- public remote_object_listHolder() {
- }
-
- public remote_object_listHolder(org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.remote_object_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHelper.java
deleted file mode 100644
index 7c58d47f7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/short_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class short_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/short_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, short[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static short[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_short);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.id(),
- "short_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static short[] read(org.omg.CORBA.portable.InputStream istream) {
- short value[] = null;
- int _len0 = istream.read_long();
- value = new short[_len0];
- istream.read_short_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, short[] value) {
- ostream.write_long(value.length);
- ostream.write_short_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHolder.java
deleted file mode 100644
index 5be5a65c43..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/short_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/short_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class short_listHolder implements org.omg.CORBA.portable.Streamable {
- public short value[] = null;
-
- public short_listHolder() {
- }
-
- public short_listHolder(short[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.short_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHelper.java
deleted file mode 100644
index a40d5fa8de..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/string_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class string_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/string_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, String[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static String[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().create_string_tc(0);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.id(),
- "string_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static String[] read(org.omg.CORBA.portable.InputStream istream) {
- String value[] = null;
- int _len0 = istream.read_long();
- value = new String[_len0];
- for (int _o1 = 0; _o1 < value.length; ++_o1)
- value[_o1] = istream.read_string();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, String[] value) {
- ostream.write_long(value.length);
- for (int _i0 = 0; _i0 < value.length; ++_i0)
- ostream.write_string(value[_i0]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHolder.java
deleted file mode 100644
index 76f99408f2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/string_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/string_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class string_listHolder implements org.omg.CORBA.portable.Streamable {
- public String value[] = null;
-
- public string_listHolder() {
- }
-
- public string_listHolder(String[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.string_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHelper.java
deleted file mode 100644
index d7594b0815..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHelper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class unsigned_long_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, int[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static int[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper
- .id(),
- "unsigned_long_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static int[] read(org.omg.CORBA.portable.InputStream istream) {
- int value[] = null;
- int _len0 = istream.read_long();
- value = new int[_len0];
- istream.read_ulong_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, int[] value) {
- ostream.write_long(value.length);
- ostream.write_ulong_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHolder.java
deleted file mode 100644
index e9fbcccc36..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class unsigned_long_listHolder implements org.omg.CORBA.portable.Streamable {
- public int value[] = null;
-
- public unsigned_long_listHolder() {
- }
-
- public unsigned_long_listHolder(int[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHelper.java
deleted file mode 100644
index 6ef187c4e5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHelper.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class unsigned_long_long_listHelper {
- private static String _id =
- "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, long[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static long[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulonglong);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper
- .id(),
- "unsigned_long_long_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static long[] read(org.omg.CORBA.portable.InputStream istream) {
- long value[] = null;
- int _len0 = istream.read_long();
- value = new long[_len0];
- istream.read_ulonglong_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, long[] value) {
- ostream.write_long(value.length);
- ostream.write_ulonglong_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHolder.java
deleted file mode 100644
index 59bc015c38..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_long_long_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class unsigned_long_long_listHolder implements org.omg.CORBA.portable.Streamable {
- public long value[] = null;
-
- public unsigned_long_long_listHolder() {
- }
-
- public unsigned_long_long_listHolder(long[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_long_long_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHelper.java
deleted file mode 100644
index ec4526cebf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHelper.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class unsigned_short_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, short[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static short[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ushort);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper
- .id(),
- "unsigned_short_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static short[] read(org.omg.CORBA.portable.InputStream istream) {
- short value[] = null;
- int _len0 = istream.read_long();
- value = new short[_len0];
- istream.read_ushort_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, short[] value) {
- ostream.write_long(value.length);
- ostream.write_ushort_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHolder.java
deleted file mode 100644
index 56ab28f0be..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/unsigned_short_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class unsigned_short_listHolder implements org.omg.CORBA.portable.Streamable {
- public short value[] = null;
-
- public unsigned_short_listHolder() {
- }
-
- public unsigned_short_listHolder(short[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.unsigned_short_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHelper.java
deleted file mode 100644
index 73a10d3b7f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class wchar_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/wchar_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, char[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static char[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_wchar);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.id(),
- "wchar_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static char[] read(org.omg.CORBA.portable.InputStream istream) {
- char value[] = null;
- int _len0 = istream.read_long();
- value = new char[_len0];
- istream.read_wchar_array(value, 0, _len0);
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, char[] value) {
- ostream.write_long(value.length);
- ostream.write_wchar_array(value, 0, value.length);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHolder.java
deleted file mode 100644
index c5c1e87756..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/wchar_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class wchar_listHolder implements org.omg.CORBA.portable.Streamable {
- public char value[] = null;
-
- public wchar_listHolder() {
- }
-
- public wchar_listHolder(char[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.wchar_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHelper.java
deleted file mode 100644
index 3e45568f01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHelper.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-abstract public class wstring_listHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/generated/wstring_list:1.0";
-
- public static void insert(org.omg.CORBA.Any a, String[] that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static String[] extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode = org.omg.CORBA.ORB.init().create_wstring_tc(0);
- __typeCode = org.omg.CORBA.ORB.init().create_sequence_tc(0, __typeCode);
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_alias_tc(org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.id(),
- "wstring_list",
- __typeCode);
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static String[] read(org.omg.CORBA.portable.InputStream istream) {
- String value[] = null;
- int _len0 = istream.read_long();
- value = new String[_len0];
- for (int _o1 = 0; _o1 < value.length; ++_o1)
- value[_o1] = istream.read_wstring();
- return value;
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream, String[] value) {
- ostream.write_long(value.length);
- for (int _i0 = 0; _i0 < value.length; ++_i0)
- ostream.write_wstring(value[_i0]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHolder.java
deleted file mode 100644
index bdbf9d995b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHolder.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.binding.corba.testing.generated;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/generated/wstring_listHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* monday, 23 june 2008 2008 14:12:28 CEST
-*/
-
-public final class wstring_listHolder implements org.omg.CORBA.portable.Streamable {
- public String value[] = null;
-
- public wstring_listHolder() {
- }
-
- public wstring_listHolder(String[] initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.generated.wstring_listHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/ArraysTestStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/ArraysTestStruct.java
deleted file mode 100644
index 7f90520d67..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/ArraysTestStruct.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
-
-public final class ArraysTestStruct {
-
- public ArraysTestStruct() {
-
- }
-
- public ArraysTestStruct(String[] field1, int[][] field2, float[][][] field3) {
- this.field1 = field1;
- this.field2 = field2;
- this.field3 = field3;
- }
-
- @CorbaArray( {2})
- public String[] field1;
-
- @CorbaArray( {2, 4})
- public int[][] field2;
-
- @CorbaArray( {2, 4, 2})
- public float[][][] field3;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/Calc.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/Calc.java
deleted file mode 100644
index 7c33b1d449..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/Calc.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero;
-
-public interface Calc {
-
- public double div(double arg1, double arg2) throws DivByZero;
-
- public double divForSmallArgs(double arg1, double arg2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/DummyObject.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/DummyObject.java
deleted file mode 100644
index d0ebff5fec..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/DummyObject.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.binding.corba.testing.hierarchy;
-
-public interface DummyObject {
-
- int getLong();
-
- DummyObject cloneObject();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.java
deleted file mode 100644
index baf5043bc2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InnerUnion.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-public final class InnerUnion {
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
- private int x;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
- private float y;
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int discriminator;
-
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- discriminator = 1;
- this.x = x;
- }
-
- public float getY() {
- return y;
- }
-
- public void setY(float y) {
- discriminator = 2;
- this.y = y;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidCorbaArray.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidCorbaArray.java
deleted file mode 100644
index 9ad637fc55..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidCorbaArray.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
-
-public final class InvalidCorbaArray {
-
- // annotation argument array is not equal to declared arrays dimension
- @CorbaArray( {1})
- public String[][] array;
-
- public InvalidCorbaArray() {
-
- }
-
- public InvalidCorbaArray(String[][] arg) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum1.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum1.java
deleted file mode 100644
index 0c9de5bb31..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum1.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.binding.corba.testing.hierarchy;
-
-public class InvalidEnum1 {
-
- public static final InvalidEnum1 red = new InvalidEnum1(0);
-
- public int value() {
- return 0;
- }
-
- public static InvalidEnum1 from_int(int value) {
- return null;
- }
-
- protected InvalidEnum1(int value) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum2.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum2.java
deleted file mode 100644
index 8746eb7f9b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum2.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.binding.corba.testing.hierarchy;
-
-public class InvalidEnum2 {
-
- public static final int _red = 0;
- public static final InvalidEnum2 red = new InvalidEnum2(_red);
-
- public static InvalidEnum2 from_int(int value) {
- return null;
- }
-
- protected InvalidEnum2(int value) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum3.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum3.java
deleted file mode 100644
index 6d124b0485..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidEnum3.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.binding.corba.testing.hierarchy;
-
-public class InvalidEnum3 {
-
- public static final int _red = 0;
- public static final InvalidEnum2 red = new InvalidEnum2(_red);
-
- public int value() {
- return 0;
- }
-
- protected InvalidEnum3(int value) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct1.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct1.java
deleted file mode 100644
index 8cf66e2fac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct1.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.binding.corba.testing.hierarchy;
-
-public final class InvalidStruct1 {
-
- public InvalidStruct1() {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct2.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct2.java
deleted file mode 100644
index 5f361512f0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct2.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.binding.corba.testing.hierarchy;
-
-public final class InvalidStruct2 {
-
- public int f1;
- public String f2;
-
- public InvalidStruct2(int f1, String f2) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct3.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct3.java
deleted file mode 100644
index adc81ea5a2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidStruct3.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.binding.corba.testing.hierarchy;
-
-public final class InvalidStruct3 {
-
- public int f1;
- public String f2;
- public static byte f3;
-
- public InvalidStruct3() {
-
- }
-
- public InvalidStruct3(int f1, String f2, byte f3) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.java
deleted file mode 100644
index c3fd45d5f4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion1.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * More than one discriminators
- */
-public final class InvalidUnion1 {
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int a;
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int b;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java
deleted file mode 100644
index f6d5421a56..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion2.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * Discriminator is missing
- */
-public final class InvalidUnion2 {
-
- @CorbaUnionElement(type=CorbaUnionElementType.defaultOption)
- @SuppressWarnings("unused")
- private int a;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.java
deleted file mode 100644
index 0d1bdd0a13..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion3.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * No option, only discriminator
- */
-public final class InvalidUnion3{
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int a;
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java
deleted file mode 100644
index 3afe702f87..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion4.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * Invalid field modifiers
- */
-public final class InvalidUnion4{
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private static int a;
-
- @CorbaUnionElement(type = CorbaUnionElementType.defaultOption)
- @SuppressWarnings("unused")
- private static int b;
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion5.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion5.java
deleted file mode 100644
index 9d30e5ced1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/InvalidUnion5.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-/**
- * Reused option id
- */
-public final class InvalidUnion5 {
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int a;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
- @SuppressWarnings("unused")
- private int b;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
- @SuppressWarnings("unused")
- private int c;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/NonCorbaException.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/NonCorbaException.java
deleted file mode 100644
index a514b5e222..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/NonCorbaException.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.binding.corba.testing.hierarchy;
-
-public class NonCorbaException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public String someField;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/RichUnion.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/RichUnion.java
deleted file mode 100644
index 2ea40e345f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/RichUnion.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.binding.corba.testing.hierarchy;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElement;
-import org.apache.tuscany.sca.binding.corba.meta.CorbaUnionElementType;
-
-public final class RichUnion {
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 1)
- private int x;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 2)
- private float y;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 3)
- private String z;
-
- @CorbaUnionElement(type = CorbaUnionElementType.option, optionNumber = 4)
- private InnerUnion iu;
-
- @CorbaUnionElement(type = CorbaUnionElementType.defaultOption)
- private boolean def;
-
- @CorbaUnionElement(type = CorbaUnionElementType.discriminator)
- @SuppressWarnings("unused")
- private int discriminator = -1;
-
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- this.discriminator = 1;
- this.x = x;
- }
-
- public float getY() {
- return y;
- }
-
- public void setY(float y) {
- this.discriminator = 2;
- this.y = y;
- }
-
- public String getZ() {
- return z;
- }
-
- public void setZ(String z) {
- this.discriminator = 3;
- this.z = z;
- }
-
- public boolean isDef() {
- return def;
- }
-
- public void setDef(boolean def) {
- this.discriminator = -1;
- this.def = def;
- }
-
- public InnerUnion getIu() {
- return iu;
- }
-
- public void setIu(InnerUnion iu) {
- this.discriminator = 4;
- this.iu = iu;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SimpleStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SimpleStruct.java
deleted file mode 100644
index 85ca3798f4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SimpleStruct.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.binding.corba.testing.hierarchy;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SimpleStruct {
-
- public String field1;
- public int field2;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SomeStruct.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SomeStruct.java
deleted file mode 100644
index d8cdf1835a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/hierarchy/SomeStruct.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.binding.corba.testing.hierarchy;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SomeStruct {
-
- public SimpleStruct innerStruct;
- public String str;
- public String[] str_list;
- public int[][] twoDimSeq;
- public int[][][] threeDimSeq;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObject.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObject.java
deleted file mode 100644
index bb72fdbbf3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObject.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/DummyObject.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public interface DummyObject extends DummyObjectOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface DummyObject
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHelper.java
deleted file mode 100644
index 606d333bb3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-abstract public class DummyObjectHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/references/DummyObject:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.DummyObject extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.id(),
- "DummyObject");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.DummyObject read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_DummyObjectStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.DummyObject narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.references.DummyObject)
- return (org.apache.tuscany.sca.binding.corba.testing.references.DummyObject)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.references._DummyObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.references._DummyObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.DummyObject unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.references.DummyObject)
- return (org.apache.tuscany.sca.binding.corba.testing.references.DummyObject)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.references._DummyObjectStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.references._DummyObjectStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHolder.java
deleted file mode 100644
index 0ff9540502..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHolder.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public final class DummyObjectHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.references.DummyObject value = null;
-
- public DummyObjectHolder() {
- }
-
- public DummyObjectHolder(org.apache.tuscany.sca.binding.corba.testing.references.DummyObject initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectOperations.java
deleted file mode 100644
index 912bd16f9b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectOperations.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/DummyObjectOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public interface DummyObjectOperations {
- int getLong();
-
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject cloneObject();
-} // interface DummyObjectOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager.java
deleted file mode 100644
index 79f7959c72..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public interface ObjectManager extends ObjectManagerOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface ObjectManager
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHelper.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHelper.java
deleted file mode 100644
index 495a614d84..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-abstract public class ObjectManagerHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.binding.corba.testing.references.ObjectManagerHelper
- .id(),
- "ObjectManager");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_ObjectManagerStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager)
- return (org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.references._ObjectManagerStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.references._ObjectManagerStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager)
- return (org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.binding.corba.testing.references._ObjectManagerStub stub =
- new org.apache.tuscany.sca.binding.corba.testing.references._ObjectManagerStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHolder.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHolder.java
deleted file mode 100644
index 11cfc82ac2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHolder.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public final class ObjectManagerHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager value = null;
-
- public ObjectManagerHolder() {
- }
-
- public ObjectManagerHolder(org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.binding.corba.testing.references.ObjectManagerHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.binding.corba.testing.references.ObjectManagerHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.binding.corba.testing.references.ObjectManagerHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerOperations.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerOperations.java
deleted file mode 100644
index e0e56d1017..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerOperations.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/ObjectManagerOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public interface ObjectManagerOperations {
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject getDummyObject();
-
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject getObjectByArgument(org.apache.tuscany.sca.binding.corba.testing.references.DummyObject dummy);
-} // interface ObjectManagerOperations
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectImplBase.java
deleted file mode 100644
index c706661eaa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectImplBase.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public abstract class _DummyObjectImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _DummyObjectImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("getLong", new java.lang.Integer(0));
- _methods.put("cloneObject", new java.lang.Integer(1));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/references/DummyObject/getLong
- {
- int $result = (int)0;
- $result = this.getLong();
- out = $rh.createReply();
- out.write_long($result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/references/DummyObject/cloneObject
- {
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result = null;
- $result = this.cloneObject();
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.write(out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/references/DummyObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _DummyObjectImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectStub.java
deleted file mode 100644
index c9a31deb27..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectStub.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/_DummyObjectStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public class _DummyObjectStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject {
-
- public int getLong() {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getLong", true);
- $in = _invoke($out);
- int $result = $in.read_long();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getLong();
- } finally {
- _releaseReply($in);
- }
- } // getLong
-
- public org.apache.tuscany.sca.binding.corba.testing.references.DummyObject cloneObject() {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("cloneObject", true);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result =
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return cloneObject();
- } finally {
- _releaseReply($in);
- }
- } // cloneObject
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/references/DummyObject:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _DummyObjectStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerImplBase.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerImplBase.java
deleted file mode 100644
index a6b55b8bae..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerImplBase.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public abstract class _ObjectManagerImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _ObjectManagerImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("getDummyObject", new java.lang.Integer(0));
- _methods.put("getObjectByArgument", new java.lang.Integer(1));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager/getDummyObject
- {
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result = null;
- $result = this.getDummyObject();
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.write(out, $result);
- break;
- }
-
- case 1: // org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager/getObjectByArgument
- {
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject dummy =
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.read(in);
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result = null;
- $result = this.getObjectByArgument(dummy);
- out = $rh.createReply();
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.write(out, $result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _ObjectManagerImplBase
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerStub.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerStub.java
deleted file mode 100644
index e06a078a93..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerStub.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.binding.corba.testing.references;
-
-/**
-* org/apache/tuscany/sca/binding/corba/testing/references/_ObjectManagerStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from remote_objects.idl
-* niedziela, 8 czerwiec 2008 16:43:12 CEST
-*/
-
-public class _ObjectManagerStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.binding.corba.testing.references.ObjectManager {
-
- public org.apache.tuscany.sca.binding.corba.testing.references.DummyObject getDummyObject() {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getDummyObject", true);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result =
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getDummyObject();
- } finally {
- _releaseReply($in);
- }
- } // getDummyObject
-
- public org.apache.tuscany.sca.binding.corba.testing.references.DummyObject getObjectByArgument(org.apache.tuscany.sca.binding.corba.testing.references.DummyObject dummy) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getObjectByArgument", true);
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.write($out, dummy);
- $in = _invoke($out);
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObject $result =
- org.apache.tuscany.sca.binding.corba.testing.references.DummyObjectHelper.read($in);
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getObjectByArgument(dummy);
- } finally {
- _releaseReply($in);
- }
- } // getObjectByArgument
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/binding/corba/testing/references/ObjectManager:1.0"};
-
- @Override
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _ObjectManagerStub
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysSetterServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysSetterServant.java
deleted file mode 100644
index 0aec4d278d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysSetterServant.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject;
-import org.apache.tuscany.sca.binding.corba.testing.generated._ArraysSetterImplBase;
-
-public class ArraysSetterServant extends _ArraysSetterImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public boolean[] setBoolean(boolean[] arg) {
- return arg;
- }
-
- public char[] setChar(char[] arg) {
- return arg;
- }
-
- public double[] setDouble(double[] arg) {
- return arg;
- }
-
- public float[] setFloat(float[] arg) {
- return arg;
- }
-
- public int[] setLong(int[] arg) {
- return arg;
- }
-
- public long[] setLongLong(long[] arg) {
- return arg;
- }
-
- public byte[] setOctet(byte[] arg) {
- return arg;
- }
-
- public RemoteObject[] setRemoteObject(RemoteObject[] obj) {
- return obj;
- }
-
- public short[] setShort(short[] arg) {
- return arg;
- }
-
- public String[] setString(String[] arg) {
- return arg;
- }
-
- public int[] setUnsignedLong(int[] arg) {
- return arg;
- }
-
- public long[] setUnsignedLongLong(long[] arg) {
- return arg;
- }
-
- public short[] setUnsignedShort(short[] arg) {
- return arg;
- }
-
- public char[] setWchar(char[] arg) {
- return arg;
- }
-
- public String[] setWstring(String[] arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsServant.java
deleted file mode 100644
index d9bde48a5a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions.RichUnion;
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions.TestStruct;
-import org.apache.tuscany.sca.binding.corba.testing.arrays_unions._ArraysUnionsTestsImplBase;
-
-public class ArraysUnionsServant extends _ArraysUnionsTestsImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public TestStruct passTestStruct(TestStruct arg) {
- return arg;
- }
-
- public String[][] passStringArray(String[][] arg) {
- return arg;
- }
-
- public RichUnion passRichUnion(RichUnion arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsTuscanyServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsTuscanyServant.java
deleted file mode 100644
index cd78588363..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ArraysUnionsTuscanyServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.meta.CorbaArray;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.ArraysTestStruct;
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.RichUnion;
-
-public class ArraysUnionsTuscanyServant {
-
- private static final long serialVersionUID = 1L;
-
- public ArraysTestStruct passTestStruct(ArraysTestStruct arg) {
- return arg;
- }
-
- @CorbaArray( {2, 2})
- public String[][] passStringArray(@CorbaArray( {2, 2})String[][] arg) {
- return arg;
- }
-
- public RichUnion passRichUnion(RichUnion arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/CalcServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/CalcServant.java
deleted file mode 100644
index fd789e19cb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/CalcServant.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.exceptions._CalcImplBase;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.Arguments;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.DivByZero;
-import org.apache.tuscany.sca.binding.corba.testing.exceptions.CalcPackage.NotSupported;
-
-public class CalcServant extends _CalcImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public double div(double arg1, double arg2) throws DivByZero {
- if (arg2 == 0) {
- DivByZero exception = new DivByZero();
- exception.arguments = new Arguments(arg1, arg2);
- exception.info = "Error occured during div: div by zero";
- throw exception;
- } else {
- return arg1 / arg2;
- }
- }
-
- public double divForSmallArgs(double arg1, double arg2) throws DivByZero, NotSupported {
- if (arg1 > 100 || arg2 > 100) {
- NotSupported exception = new NotSupported();
- exception.info = "arg1: " + arg1 + ", arg2: " + arg2;
- throw exception;
- } else {
- return div(arg1, arg2);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/DummyObjectServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/DummyObjectServant.java
deleted file mode 100644
index 2e205f1d0f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/DummyObjectServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.references.DummyObject;
-import org.apache.tuscany.sca.binding.corba.testing.references._DummyObjectImplBase;
-
-public class DummyObjectServant extends _DummyObjectImplBase {
-
- private static final long serialVersionUID = 1L;
- private int retVal;
-
- public DummyObjectServant() {
- retVal = (int)System.currentTimeMillis();
- }
-
- public int getLong() {
- return retVal;
- }
-
- public DummyObject cloneObject() {
- return new DummyObjectServant();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/EnumManagerServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/EnumManagerServant.java
deleted file mode 100644
index 52386aeef7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/EnumManagerServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.enums.Color;
-import org.apache.tuscany.sca.binding.corba.testing.enums._EnumManagerImplBase;
-
-public class EnumManagerServant extends _EnumManagerImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public Color getColor(Color color) {
- return color;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTestObjectServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTestObjectServant.java
deleted file mode 100644
index b7fbb69627..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTestObjectServant.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.servants;
-
-public class InvalidTestObjectServant {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTypesServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTypesServant.java
deleted file mode 100644
index dda8203f79..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/InvalidTypesServant.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.InvalidStruct1;
-
-public class InvalidTypesServant {
-
- public InvalidStruct1 firstMethodWithInvalidArg() {
- return null;
- }
-
- public void secondMethodWithInvalidArg(InvalidStruct1 arg) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/NonCorbaServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/NonCorbaServant.java
deleted file mode 100644
index 20700a0392..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/NonCorbaServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.hierarchy.NonCorbaException;
-
-public class NonCorbaServant {
-
- public String setString(String arg) {
- return arg;
- }
-
- public void throwException() throws NonCorbaException {
- NonCorbaException e = new NonCorbaException();
- e.someField = "test";
- throw e;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ObjectManagerServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ObjectManagerServant.java
deleted file mode 100644
index 213c7fbd7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/ObjectManagerServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.references.DummyObject;
-import org.apache.tuscany.sca.binding.corba.testing.references._ObjectManagerImplBase;
-
-public class ObjectManagerServant extends _ObjectManagerImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public DummyObject getObjectByArgument(DummyObject arg) {
- return arg;
- }
-
- public DummyObject getDummyObject() {
- return new DummyObjectServant();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/PrimitivesSetterServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/PrimitivesSetterServant.java
deleted file mode 100644
index 92e18741ae..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/PrimitivesSetterServant.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.generated.RemoteObject;
-import org.apache.tuscany.sca.binding.corba.testing.generated._PrimitivesSetterImplBase;
-
-public class PrimitivesSetterServant extends _PrimitivesSetterImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public boolean setBoolean(boolean arg) {
- return arg;
- }
-
- public char setChar(char arg) {
- return arg;
- }
-
- public double setDouble(double arg) {
- return arg;
- }
-
- public float setFloat(float arg) {
- return arg;
- }
-
- public int setLong(int arg) {
- return arg;
- }
-
- public long setLongLong(long arg) {
- return arg;
- }
-
- public byte setOctet(byte arg) {
- return arg;
- }
-
- public RemoteObject setRemoteObject(RemoteObject obj) {
- return obj;
- }
-
- public short setShort(short arg) {
- return arg;
- }
-
- public String setString(String arg) {
- return arg;
- }
-
- public int setUnsignedLong(int arg) {
- return arg;
- }
-
- public long setUnsignedLongLong(long arg) {
- return arg;
- }
-
- public short setUnsignedShort(short arg) {
- return arg;
- }
-
- public char setWchar(char arg) {
- return arg;
- }
-
- public String setWstring(String arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/TestObjectServant.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/TestObjectServant.java
deleted file mode 100644
index 153268983f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/servants/TestObjectServant.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.binding.corba.testing.servants;
-
-import org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStruct;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SimpleStructHolder;
-import org.apache.tuscany.sca.binding.corba.testing.generated.SomeStruct;
-import org.apache.tuscany.sca.binding.corba.testing.generated._TestObjectImplBase;
-import org.apache.tuscany.sca.binding.corba.testing.generated.long_seq1Holder;
-import org.apache.tuscany.sca.binding.corba.testing.generated.long_seq2Holder;
-import org.apache.tuscany.sca.binding.corba.testing.generated.long_seq3Holder;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TestObjectServant extends _TestObjectImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public int[] setLongSeq1(long_seq1Holder arg) {
- return arg.value;
- }
-
- public int[][] setLongSeq2(long_seq2Holder arg) {
-
- return arg.value;
- }
-
- public int[][][] setLongSeq3(long_seq3Holder arg) {
- return arg.value;
- }
-
- public SimpleStruct setSimpleStruct(SimpleStructHolder arg) {
- return arg.value;
- }
-
- public SomeStruct setStruct(SomeStruct arg) {
- return arg;
- }
-
- public SomeStruct pickStructFromArgs(SomeStruct arg1, SomeStruct arg2, SomeStruct arg3, int structNumber) {
- switch (structNumber) {
- case 1:
- return arg1;
- case 2:
- return arg2;
- case 3:
- return arg3;
- default:
- return arg1;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestDataType.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestDataType.java
deleted file mode 100644
index 7ebc3fce85..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestDataType.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.binding.corba.testing.service.mocks;
-
-import java.lang.reflect.Type;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-/**
- * Mock DataType implementation. Only few methods needs to be implemented.
- */
-public class TestDataType<L> implements DataType<L> {
-
- public Class<?> typeClass;
- public L logical;
-
- public TestDataType(Class<?> typeClass) {
- this.typeClass = typeClass;
- }
-
- public TestDataType(Class<?> typeClass, L logical) {
- this.typeClass = typeClass;
- this.logical = logical;
- }
-
- public String getDataBinding() {
- return null;
- }
-
- public Type getGenericType() {
- return null;
- }
-
- public L getLogical() {
- return logical;
- }
-
- public <T> T getMetaData(Class<T> arg0) {
- return null;
- }
-
- public Class<?> getPhysical() {
- return typeClass;
- }
-
- public void setDataBinding(String arg0) {
-
- }
-
- public void setGenericType(Type arg0) {
-
- }
-
- public void setLogical(L arg0) {
-
- }
-
- public <T> void setMetaData(Class<T> arg0, T arg1) {
-
- }
-
- public void setPhysical(Class<?> arg0) {
-
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.java
deleted file mode 100644
index 296fa0a454..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterface.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.binding.corba.testing.service.mocks;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Mock TestInterface implementation. Only few methods needs to be implemented.
- */
-public class TestInterface implements JavaInterface {
-
- private List<Operation> operations;
- private Class<?> javaClass;
-
- public TestInterface(List<Operation> opearations, Class<?> javaClass) {
- this.operations = opearations;
- this.javaClass = javaClass;
- }
-
- public List<Operation> getOperations() {
- return operations;
- }
-
- public boolean isConversational() {
- return false;
- }
-
- public boolean isDynamic() {
- return false;
- }
-
- public boolean isRemotable() {
- return false;
- }
-
- public void resetDataBinding(String dataBinding) {
-
- }
-
- public void resetInterfaceInputTypes(Interface newInterface) {
-
- }
-
- public void resetInterfaceOutputTypes(Interface newInterface) {
-
- }
-
- public void setConversational(boolean conversational) {
-
- }
-
- public void setDefaultDataBinding(String dataBinding) {
-
- }
-
- public void setRemotable(boolean remotable) {
-
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return null;
- }
-
- public List<PolicySet> getPolicySets() {
- return null;
- }
-
- public List<Intent> getRequiredIntents() {
- return null;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
-
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
- public Class<?> getCallbackClass() {
- return null;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-
- public String getName() {
- return null;
- }
-
- public QName getQName() {
- return null;
- }
-
- public void setCallbackClass(Class<?> arg0) {
- }
-
- public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
- }
-
- public void setName(String arg0) {
- }
-
- public void setQName(QName arg0) {
-
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean arg0) {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterfaceContract.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterfaceContract.java
deleted file mode 100644
index d691705955..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestInterfaceContract.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.service.mocks;
-
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * Mock InterfaceContract implementation. Only few methods needs to be
- * implemented.
- */
-public class TestInterfaceContract implements InterfaceContract {
-
- private Interface iface;
-
- public Interface getCallbackInterface() {
- return null;
- }
-
- public Interface getInterface() {
- return iface;
- }
-
- public InterfaceContract makeUnidirectional(boolean isCallback) {
- return null;
- }
-
- public void setCallbackInterface(Interface callbackInterface) {
-
- }
-
- public void setInterface(Interface callInterface) {
- this.iface = callInterface;
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestOperation.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestOperation.java
deleted file mode 100644
index 07a9119afb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestOperation.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.service.mocks;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Mock Operation implementation. Only few methods needs to be implemented.
- */
-public class TestOperation implements Operation {
-
- private DataType<List<DataType>> inputType;
- private DataType outputType;
- private String name;
-
- public ConversationSequence getConversationSequence() {
- return null;
- }
-
- public String getDataBinding() {
- return null;
- }
-
- public Map<QName, List<DataType<XMLType>>> getFaultBeans() {
- return null;
- }
-
- public List<DataType> getFaultTypes() {
- return null;
- }
-
- public DataType<List<DataType>> getInputType() {
- return inputType;
- }
-
- public Interface getInterface() {
- return null;
- }
-
- public String getName() {
- return name;
- }
-
- public DataType getOutputType() {
- return outputType;
- }
-
- public WrapperInfo getInputWrapper() {
- return null;
- }
-
- public WrapperInfo getOutputWrapper() {
- return null;
- }
-
- public boolean isDynamic() {
- return false;
- }
-
- public boolean isNonBlocking() {
- return false;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public boolean isInputWrapperStyle() {
- return false;
- }
-
- public boolean isOutputWrapperStyle() {
- return false;
- }
-
- public void setConversationSequence(ConversationSequence sequence) {
-
- }
-
- public void setDataBinding(String dataBinding) {
-
- }
-
- public void setDynamic(boolean b) {
-
- }
-
- public void setFaultBeans(Map<QName, List<DataType<XMLType>>> faultBeans) {
-
- }
-
- public void setFaultTypes(List<DataType> faultTypes) {
-
- }
-
- public void setInputType(DataType<List<DataType>> inputType) {
- this.inputType = inputType;
- }
-
- public void setInterface(Interface interfaze) {
-
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setNonBlocking(boolean nonBlocking) {
-
- }
-
- public void setOutputType(DataType outputType) {
- this.outputType = outputType;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
- public void setInputWrapper(WrapperInfo wrapperInfo) {
-
- }
-
- public void setOutputWrapper(WrapperInfo wrapperInfo) {
-
- }
-
- public void setInputWrapperStyle(boolean wrapperStyle) {
-
- }
-
- public void setOutputWrapperStyle(boolean wrapperStyle) {
-
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return null;
- }
-
- public List<PolicySet> getPolicySets() {
- return null;
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
- public List<Intent> getRequiredIntents() {
- return null;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
- }
-
- public List<ParameterMode> getParameterModes() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
deleted file mode 100644
index a99b829e9c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeComponentService.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.corba.testing.service.mocks;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-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.ComponentReference;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-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.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Mock RuntimeComponentService implementation. Only few methods needs to be
- * implemented.
- */
-public class TestRuntimeComponentService implements RuntimeComponentService {
-
- private InterfaceContract interfaceContract;
- private RuntimeWire runtimeWire;
-
- public TestRuntimeComponentService(Object invocationTarget) {
- runtimeWire = new TestRuntimeWire(invocationTarget);
- List<Operation> operations = new ArrayList<Operation>();
- Method[] methods = invocationTarget.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- int mod = methods[i].getModifiers();
- if (methods[i].getDeclaringClass().equals(invocationTarget.getClass()) && Modifier.isPublic(mod)
- && !methods[i].getName().startsWith("_")) {
- Operation operation = new TestOperation();
- DataType returnType = new TestDataType(methods[i].getReturnType());
- operation.setOutputType(returnType);
- Class<?>[] argTypes = methods[i].getParameterTypes();
- List<DataType> argDataTypes = new ArrayList<DataType>();
- for (int j = 0; j < argTypes.length; j++) {
- argDataTypes.add(new TestDataType(argTypes[j]));
- }
- TestDataType<List<DataType>> inputDataType = new TestDataType<List<DataType>>(null, argDataTypes);
- operation.setInputType(inputDataType);
- operations.add(operation);
- operation.setName(methods[i].getName());
- }
- }
- TestInterface iface = new TestInterface(operations, invocationTarget.getClass());
- interfaceContract = new TestInterfaceContract();
- interfaceContract.setInterface(iface);
- }
-
- public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
-
- }
-
- public ServiceBindingProvider getBindingProvider(Binding binding) {
- return null;
- }
-
- public List<RuntimeWire> getCallbackWires() {
- return null;
- }
-
- public InvocationChain getInvocationChain(Binding binding, Operation operation) {
- return null;
- }
-
- public InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation) {
- return null;
- }
-
- public Invoker getInvoker(Binding binding, Operation operation) {
- return null;
- }
-
- public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
- return null;
- }
-
- public List<PolicyProvider> getPolicyProviders(Binding binding) {
- return null;
- }
-
- public RuntimeWire getRuntimeWire(Binding binding) {
- return runtimeWire;
- }
-
- public RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract) {
- return null;
- }
-
- public List<RuntimeWire> getRuntimeWires() {
- return null;
- }
-
- public void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider) {
-
- }
-
- public ComponentReference getCallbackReference() {
- return null;
- }
-
- public Service getService() {
- return null;
- }
-
- public void setCallbackReference(ComponentReference callbackReference) {
-
- }
-
- public void setService(Service service) {
-
- }
-
- public InterfaceContract getInterfaceContract() {
- return interfaceContract;
- }
-
- public InterfaceContract getInterfaceContract(Binding binding) {
- return getInterfaceContract();
- }
-
- public String getName() {
- return null;
- }
-
- public boolean isCallback() {
- return false;
- }
-
- public void setInterfaceContract(InterfaceContract interfaceContract) {
- this.interfaceContract = interfaceContract;
- }
-
- public void setIsCallback(boolean isCallback) {
-
- }
-
- public void setName(String name) {
-
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
- public List<Object> getExtensions() {
- return null;
- }
-
- public List<Extension> getAttributeExtensions() {
- return null;
- }
-
- public List<Intent> getRequiredIntents() {
- return null;
- }
-
- public IntentAttachPointType getType() {
- return null;
- }
-
- public void setType(IntentAttachPointType type) {
-
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return null;
- }
-
- public <B> B getBinding(Class<B> bindingClass) {
- return null;
- }
-
- public List<Binding> getBindings() {
- return null;
- }
-
- public Callback getCallback() {
- return null;
- }
-
- public <B> B getCallbackBinding(Class<B> bindingClass) {
- return null;
- }
-
- public void setCallback(Callback callback) {
-
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return null;
- }
-
- public List<PolicySet> getPolicySets() {
- return null;
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.java
deleted file mode 100644
index 5b7caf1010..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/java/org/apache/tuscany/sca/binding/corba/testing/service/mocks/TestRuntimeWire.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.binding.corba.testing.service.mocks;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Mock RuntimeWire implementation. Only few methods needs to be implemented.
- */
-public class TestRuntimeWire implements RuntimeWire {
- private Object invocationTarget;
-
- public TestRuntimeWire(Object invocationTarget) {
- this.invocationTarget = invocationTarget;
- }
-
- public InvocationChain getInvocationChain(Operation arg0) {
- return null;
- }
-
- public List<InvocationChain> getInvocationChains() {
- return null;
- }
-
- public EndpointReference getSource() {
- return null;
- }
-
- public EndpointReference getTarget() {
- return null;
- }
-
- public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
- Class<?>[] types = new Class<?>[args.length];
- for (int i = 0; i < args.length; i++) {
- types[i] = args[i].getClass();
- }
- Object result = null;
- try {
- Method[] methods = invocationTarget.getClass().getMethods();
- for (int i = 0; i < methods.length; i++) {
- if (methods[i].getName().equals(operation.getName())) {
- result = methods[i].invoke(invocationTarget, args);
- break;
- }
- }
- } catch (InvocationTargetException e) {
- throw e;
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
-
- return result;
- }
-
- public Object invoke(Operation operation, Message arg1) throws InvocationTargetException {
-
- return null;
- }
-
- public Object invoke(Message arg1) throws InvocationTargetException {
-
- return null;
- }
-
- public void rebuild() {
-
- }
-
- public void setTarget(EndpointReference arg0) {
-
- }
-
- @Override
- public Object clone() {
- return null;
- }
-
- public InvocationChain getBindingInvocationChain() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/arrays_unions.idl b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/arrays_unions.idl
deleted file mode 100644
index 0f4ed03b4e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/arrays_unions.idl
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase arrays_unions.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module binding {
- module corba {
- module testing {
- module arrays_unions {
-
- struct TestStruct {
- string oneDimArray[2];
- long twoDimArray[2][4];
- float threeDimArray[2][4][2];
- };
-
- typedef string StringArray[2][2];
-
- union InnerUnion switch (long) {
- case 1: long x;
- case 2: float y;
- };
-
- union RichUnion switch (long) {
- case 1: long x;
- case 2: float y;
- case 3: string z;
- case 4: InnerUnion iu;
- default: boolean a;
- };
-
- interface ArraysUnionsTests {
- TestStruct passTestStruct(in TestStruct arg);
- StringArray passStringArray(in StringArray arg);
- RichUnion passRichUnion(in RichUnion arg);
- };
-
- };
- };
- };
- };
- };
- };
- };
-};
-
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/enums.idl b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/enums.idl
deleted file mode 100644
index 2e4e829b0f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/enums.idl
+++ /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.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase enums.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module binding {
- module corba {
- module testing {
- module enums {
- enum Color {red, yellow, green};
- interface EnumManager {
- Color getColor(in Color color);
- };
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/exceptions.idl b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/exceptions.idl
deleted file mode 100644
index b34ec46458..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/exceptions.idl
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase exceptions.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module binding {
- module corba {
- module testing {
- module exceptions {
- interface Calc {
- struct Arguments {
- double arg1;
- double arg2;
- };
-
- exception DivByZero{
- Arguments arguments;
- string info;
- };
-
- exception NotSupported {
- string info;
- };
-
- double div(in double arg1, in double arg2) raises(DivByZero);
- double divForSmallArgs(in double arg1, in double arg2) raises(DivByZero, NotSupported);
- };
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/general_tests.idl b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/general_tests.idl
deleted file mode 100644
index db253338c3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/general_tests.idl
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase general_tests.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module binding {
- module corba {
- module testing {
- module generated {
-
- interface RemoteObject {
-
- };
-
- typedef sequence<RemoteObject> remote_object_list;
- typedef sequence<boolean> boolean_list;
- typedef sequence<char> char_list;
- typedef sequence<wchar> wchar_list;
- typedef sequence<octet> octet_list;
- typedef sequence<short> short_list;
- typedef sequence<unsigned short> unsigned_short_list;
- typedef sequence<long> long_list;
- typedef sequence<unsigned long> unsigned_long_list;
- typedef sequence<long long> long_long_list;
- typedef sequence<unsigned long long> unsigned_long_long_list;
- typedef sequence<float> float_list;
- typedef sequence<double> double_list;
- typedef sequence<string> string_list;
- typedef sequence<wstring> wstring_list;
-
- interface PrimitivesSetter {
- boolean setBoolean(in boolean arg);
- char setChar(in char arg);
- wchar setWchar(in wchar arg);
- octet setOctet(in octet arg);
- short setShort(in short arg);
- unsigned short setUnsignedShort(in unsigned short arg);
- long setLong(in long arg);
- unsigned long setUnsignedLong(in unsigned long arg);
- long long setLongLong(in long long arg);
- unsigned long long setUnsignedLongLong(in unsigned long long arg);
- float setFloat(in float arg);
- double setDouble(in double arg);
- string setString(in string arg);
- wstring setWstring(in wstring arg);
- RemoteObject setRemoteObject(in RemoteObject obj);
- };
-
- interface ArraysSetter {
- boolean_list setBoolean(in boolean_list arg);
- char_list setChar(in char_list arg);
- wchar_list setWchar(in wchar_list arg);
- octet_list setOctet(in octet_list arg);
- short_list setShort(in short_list arg);
- unsigned_short_list setUnsignedShort(in unsigned_short_list arg);
- long_list setLong(in long_list arg);
- unsigned_long_list setUnsignedLong(in unsigned_long_list arg);
- long_long_list setLongLong(in long_long_list arg);
- unsigned_long_long_list setUnsignedLongLong(in unsigned_long_long_list arg);
- float_list setFloat(in float_list arg);
- double_list setDouble(in double_list arg);
- string_list setString(in string_list arg);
- wstring_list setWstring(in wstring_list arg);
- remote_object_list setRemoteObject(in remote_object_list obj);
- };
-
- typedef sequence<long> long_seq1;
- typedef sequence<long_seq1> long_seq2;
- typedef sequence<long_seq2> long_seq3;
-
- struct SimpleStruct {
- string field1;
- long field2;
- };
-
-
- struct SomeStruct {
- SimpleStruct innerStruct;
- string str;
- string_list str_list;
- long_seq2 twoDimSeq;
- long_seq3 threeDimSeq;
- };
-
- interface TestObject {
- SomeStruct pickStructFromArgs(in SomeStruct arg1, in SomeStruct arg2, in SomeStruct arg3, in long structNumber);
- SomeStruct setStruct(in SomeStruct arg);
- SimpleStruct setSimpleStruct(inout SimpleStruct arg);
- long_seq1 setLongSeq1(inout long_seq1 arg);
- long_seq2 setLongSeq2(inout long_seq2 arg);
- long_seq3 setLongSeq3(inout long_seq3 arg);
- };
-
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/references.idl b/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/references.idl
deleted file mode 100644
index 72b58806e6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba-runtime/src/test/resources/references.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase remote_objects.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module binding {
- module corba {
- module testing {
- module references {
-
- interface DummyObject {
- long getLong();
- DummyObject cloneObject();
- };
-
- interface ObjectManager {
- DummyObject getDummyObject();
- DummyObject getObjectByArgument(in DummyObject dummy);
- };
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/LICENSE b/branches/sca-java-1.5.1/modules/binding-corba/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/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-java-1.5.1/modules/binding-corba/NOTICE b/branches/sca-java-1.5.1/modules/binding-corba/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/pom.xml b/branches/sca-java-1.5.1/modules/binding-corba/pom.xml
deleted file mode 100644
index bcb30ab7ab..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/pom.xml
+++ /dev/null
@@ -1,71 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-corba</artifactId>
- <name>Apache Tuscany SCA CORBA Binding Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.corba</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.corba*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBinding.java b/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBinding.java
deleted file mode 100644
index 0b79065cc3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBinding.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.binding.corba;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface CorbaBinding extends Binding {
- QName BINDING_CORBA_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "binding.corba");
-
- String getHost();
-
- void setHost(String host);
-
- int getPort();
-
- void setPort(int port);
-
- String getId();
-
- void setId(String id);
-
- String getCorbaname();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBindingFactory.java
deleted file mode 100644
index 67e3bdcf74..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/CorbaBindingFactory.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.binding.corba;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface CorbaBindingFactory {
- /**
- * Create a CorbaBinding model
- * @return The CorbaBinding model
- */
- CorbaBinding createCorbaBinding();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingFactoryImpl.java
deleted file mode 100644
index cecb4fb567..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingFactoryImpl.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.binding.corba.impl;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.binding.corba.CorbaBindingFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaBindingFactoryImpl implements CorbaBindingFactory {
-
- /**
- * @see org.apache.tuscany.sca.binding.corba.CorbaBindingFactory#createCorbaBinding()
- */
- public CorbaBinding createCorbaBinding() {
- return new CorbaBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingImpl.java
deleted file mode 100644
index 54e98d4117..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingImpl.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.binding.corba.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaBindingImpl implements CorbaBinding, PolicySetAttachPoint {
- private String name;
- private String uri;
- private String host;
- private int port;
- private String id;
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- 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 boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCorbaname() {
- return CorbaHostUtils.isValidCorbanameURI(getURI()) ? getURI(): CorbaHostUtils.createCorbanameURI(getHost(), getPort(), getName());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.java
deleted file mode 100644
index 0bb38d3682..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/java/org/apache/tuscany/sca/binding/corba/impl/CorbaBindingProcessor.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.binding.corba.impl;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.corba.CorbaBinding;
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaBindingProcessor implements StAXArtifactProcessor<CorbaBinding> {
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
-
- public CorbaBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#getArtifactType()
- */
- public QName getArtifactType() {
- return CorbaBinding.BINDING_CORBA_QNAME;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#read(javax.xml.stream.XMLStreamReader)
- */
- public CorbaBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- CorbaBinding binding = new CorbaBindingImpl();
-
- // Read the policies
- policyProcessor.readPolicies(binding, reader);
-
- binding.setHost(reader.getAttributeValue(null, "host"));
- String port = reader.getAttributeValue(null, "port");
- if (port != null) {
- binding.setPort(Integer.parseInt(port));
- }
-
- // Read the name
- String name = reader.getAttributeValue(null, "name");
- if (name != null) {
- binding.setName(name);
- }
-
- // Read binding URI
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null) {
- binding.setURI(uri);
- }
-
- // Read CORBA id
- String id = reader.getAttributeValue(null, "id");
- if (id != null) {
- binding.setId(id);
- }
- return binding;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#write(java.lang.Object, javax.xml.stream.XMLStreamWriter)
- */
- public void write(CorbaBinding model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- // Write a <binding.corba>
- writer.writeStartElement(Constants.SCA10_TUSCANY_NS, "binding.corba");
-
- if (model.getName() != null) {
- writer.writeAttribute("name", model.getName());
- }
-
- if (model.getURI() != null) {
- writer.writeAttribute("uri", model.getURI());
- }
-
- if (model.getHost() != null) {
- writer.writeAttribute("host", model.getHost());
- }
-
- if (model.getPort() != -1) {
- writer.writeAttribute("port", String.valueOf(model.getPort()));
- }
-
- if (model.getId() != null) {
- writer.writeAttribute("id", model.getId());
- }
- writer.writeEndElement();
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#getModelType()
- */
- public Class<CorbaBinding> getModelType() {
- return CorbaBinding.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#resolve(java.lang.Object, org.apache.tuscany.sca.contribution.resolver.ModelResolver)
- */
- public void resolve(CorbaBinding model, ModelResolver resolver) throws ContributionResolveException {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.corba.CorbaBindingFactory b/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.corba.CorbaBindingFactory
deleted file mode 100644
index 57959840d4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.corba.CorbaBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the model factory
-org.apache.tuscany.sca.binding.corba.impl.CorbaBindingFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 71d14bc077..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.corba.impl.CorbaBindingProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.corba,model=org.apache.tuscany.sca.binding.corba.CorbaBinding,factory=org.apache.tuscany.sca.binding.corba.CorbaBindingFactory
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/LICENSE b/branches/sca-java-1.5.1/modules/binding-dwr/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/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-java-1.5.1/modules/binding-dwr/NOTICE b/branches/sca-java-1.5.1/modules/binding-dwr/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/pom.xml b/branches/sca-java-1.5.1/modules/binding-dwr/pom.xml
deleted file mode 100644
index 29a1ddf240..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/pom.xml
+++ /dev/null
@@ -1,95 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-dwr</artifactId>
- <name>Apache Tuscany SCA AJAX DWR Binding Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extension-helper</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.directwebremoting</groupId>
- <artifactId>dwr</artifactId>
- <version>2.0.3</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.dwr</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.dwr*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.java
deleted file mode 100644
index ae5cf327ab..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBinding.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.binding.dwr;
-
-/**
- * The runtime representation of the <binding.dwr> SCDL
- *
- * @version $Rev$ $Date$
- */
-public class DWRBinding {
-
- // Empty as <binding.dwr> doesn't use any additional attributes or elements (yet).
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.java
deleted file mode 100644
index d14751f235..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRBindingActivator.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.binding.dwr;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.extension.helper.BindingActivator;
-import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The Binding Activator for the DWR Binding.
- *
- * @version $Rev$ $Date$
- */
-public class DWRBindingActivator implements BindingActivator<DWRBinding>{
-
- private ServletHost servletHost;
-
- public DWRBindingActivator(ServletHost servletHost) {
- this.servletHost = servletHost;
- }
-
- public Class<DWRBinding> getBindingClass() {
- return DWRBinding.class;
- }
-
- public InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, DWRBinding ab) {
- return new DWRInvokerFactory(rc, rcr, b, ab, servletHost);
- }
-
- public ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, DWRBinding ab) {
- return new DWRService(rc, rcs, b, ab, servletHost);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.java
deleted file mode 100644
index 24e6dbbcd4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvoker.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.binding.dwr;
-
-import java.util.Collection;
-
-import org.apache.tuscany.sca.core.invocation.MessageImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.directwebremoting.ScriptBuffer;
-import org.directwebremoting.WebContext;
-import org.directwebremoting.WebContextFactory;
-import org.directwebremoting.proxy.dwr.Util;
-
-/**
- * The invoker for a DWR Binding.
- *
- * @version $Rev$ $Date$
- */
-public class DWRInvoker implements Invoker {
-
- private String referenceFunction;
-
- public DWRInvoker(String referenceName, Operation operation) {
- this.referenceFunction = referenceName + "." + operation.getName();
- }
-
- public Message invoke(Message requestMsg) {
-
- invoke((Object[])requestMsg.getBody());
-
- // DWR references can not return anything
- return new MessageImpl();
- }
-
- public void invoke(Object[] args) {
-
- // TODO: this only works if its the same thread as request
- WebContext wctx = WebContextFactory.get();
- String currentPage = wctx.getCurrentPage();
-
- // Get a DWR Util proxy for all the browsers on the current page:
- Collection sessions = wctx.getScriptSessionsByPage(currentPage);
- Util utilAll = new Util(sessions);
-
- ScriptBuffer referenceInvoke = getInvokeFragment(args, wctx);
-
- // add the reference call to the Util proxy which will cause DWR to
- // asynchronously send it to be run on each active browser client
- utilAll.addScript(referenceInvoke);
- }
-
- /**
- * Creates a fragment of JavaScript code to invoke the reference function
- * Eg: "<referenceName>.<operationName>(arg1, arg2,...);"
- */
- protected ScriptBuffer getInvokeFragment(Object[] args, WebContext wctx) {
-
- ScriptBuffer sb = new ScriptBuffer();
- sb.appendScript(referenceFunction);
- sb.appendScript("(");
- if (args != null) {
- for (int i = 0; i < args.length; i++) {
- sb.appendData(args[i]);
- if (i < (args.length - 1)) {
- sb.appendScript(", ");
- }
- }
- }
- sb.appendScript(");");
-
- return sb;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.java
deleted file mode 100644
index 1d073c9ecf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRInvokerFactory.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.binding.dwr;
-
-import static org.apache.tuscany.sca.binding.dwr.DWRService.SERVLET_PATH;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * InvokerFactory for the DWRBinding.
- *
- * @version $Rev$ $Date$
- */
-public class DWRInvokerFactory implements InvokerFactory, ComponentLifecycle {
-
- private Binding binding;
- private ServletHost servletHost;
-
- public DWRInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, DWRBinding ab, ServletHost servletHost) {
- this.binding = b;
- this.servletHost = servletHost;
- }
-
- public Invoker createInvoker(Operation operation) {
- return new DWRInvoker(binding.getName(), operation);
- }
-
- public void start() {
-
- DWRServlet servlet = (DWRServlet) servletHost.getServletMapping(SERVLET_PATH);
- if (servlet == null) {
- servlet = new DWRServlet();
- servletHost.addServletMapping(SERVLET_PATH, servlet);
- }
-
- servlet.addReference(binding.getName());
- }
-
- public void stop() {
- servletHost.removeServletMapping(SERVLET_PATH);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.java
deleted file mode 100644
index 7d5a7f1677..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRService.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.binding.dwr;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * DWR Service.
- *
- * @version $Rev$ $Date$
- */
-public class DWRService implements ComponentLifecycle {
-
- private RuntimeComponent rc;
- private RuntimeComponentService rcs;
- private Binding binding;
- private ServletHost servletHost;
-
- static final String SERVLET_PATH = "/SCADomain/*";
-
- public DWRService(RuntimeComponent rc, RuntimeComponentService rcs, Binding binding, DWRBinding ab, ServletHost servletHost) {
- this.rc = rc;
- this.rcs = rcs;
- this.binding = binding;
- this.servletHost = servletHost;
- }
-
- public void start() {
-
- DWRServlet servlet = (DWRServlet) servletHost.getServletMapping(SERVLET_PATH);
- if (servlet == null) {
- servlet = new DWRServlet();
- servletHost.addServletMapping(SERVLET_PATH, servlet);
- }
-
- // Create a Java proxy to the target service
- Class<?> type = ((JavaInterface)rcs.getInterfaceContract().getInterface()).getJavaClass();
- Object proxy = Proxy.newProxyInstance(type.getClassLoader(), new Class[]{type}, new InvocationHandler() {
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- RuntimeWire wire = rcs.getRuntimeWire(binding);
- Operation op = JavaInterfaceUtil.findOperation(method, rcs.getInterfaceContract().getInterface().getOperations());
- return wire.invoke(op, args);
- }});
-
- servlet.addService(binding.getName(), type, proxy);
- }
-
- public void stop() {
- servletHost.removeServletMapping(SERVLET_PATH);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
deleted file mode 100644
index 3a2471d8f3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/java/org/apache/tuscany/sca/binding/dwr/DWRServlet.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.dwr;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.directwebremoting.Container;
-import org.directwebremoting.create.AbstractCreator;
-import org.directwebremoting.extend.CreatorManager;
-import org.directwebremoting.extend.Handler;
-import org.directwebremoting.extend.Remoter;
-import org.directwebremoting.servlet.DwrServlet;
-import org.directwebremoting.servlet.EngineHandler;
-import org.directwebremoting.servlet.PathConstants;
-import org.directwebremoting.servlet.UrlProcessor;
-
-/**
- * Tuscany customized DWR Servlet to implement support for the DWR binding
- *
- * Handles requests for SCA services and references that use <binding.dwr>,
- * and also the HTTP GET for the Tuscany DWR system script "scaDomain.js"
- *
- * @version $Rev$ $Date$
- */
-public class DWRServlet extends DwrServlet {
- private static final long serialVersionUID = 1L;
-
- private transient Map<String, ServiceHolder> services;
- private transient List<String> referenceNames;
- private transient boolean initialized;
- private transient Map<String, String> initParams;
-
- private static final String SCADOMAIN_SCRIPT_PATH = "/scaDomain.js";
-
- public DWRServlet() {
- this.services = new HashMap<String, ServiceHolder>();
- this.referenceNames = new ArrayList<String>();
-
- this.initParams = new HashMap<String, String>();
- // maybe use <binding.dwr> attributes to define the init params
- initParams.put("activeReverseAjaxEnabled", "true");
- }
-
- @Override
- public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
- super.service(req, res);
- }
-
- /**
- * Initialize the Servlet
- * There is a single instance of this Servlet which is registered
- * for multiple path mappings, but the init should only run once.
- */
- @Override
- public void init(ServletConfig servletConfig) throws ServletException {
- if (!initialized) {
- super.init(patchConfig(servletConfig));
- addScriptHandler();
- initServices();
- initialized = true;
- }
- }
-
- /**
- * Add in the handler to process the HTTP get for /sca/scaDomain.js
- *
- * This wrappers the DWR Engine handler which returns the DWR engine.js script,
- * this wrappers that handler so as to add Tuscany specific header and footer code
- * to the DWR engine.js to define the Tuscany SCADomain control functions and
- * functions for each SCA service and reference that use <binding.dwr>.
- */
- private void addScriptHandler() {
-
- UrlProcessor urlProcessor = (UrlProcessor)getContainer().getBean(UrlProcessor.class.getName());
-
- final EngineHandler engineHandler =
- (EngineHandler)getContainer().getBean(PathConstants.URL_PREFIX + "/engine.js");
-
- final Handler scaDomainScriptHandler = new Handler() {
- public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException {
- PrintWriter out = response.getWriter();
- out.println("/** Apache Tuscany scaDomain.js Header */");
-
- engineHandler.handle(request, response);
-
- tuscanyFooter(request, out);
- }
-
- };
-
- // add the scaDomainScriptHandler to the urlProcessor
- // bit of a hack, there's probably cleaner way to get it registered
- urlProcessor.afterContainerSetup(new Container() {
- public Object getBean(String name) {
- return scaDomainScriptHandler;
- }
- public Collection getBeanNames() {
- return Arrays.asList(new String[] {PathConstants.URL_PREFIX + SCADOMAIN_SCRIPT_PATH});
- }
- });
- }
-
- /**
- * Adds the JavaScript defining SCADomain, its control functions,
- * and functions for all the available SCA services and references.
- */
- private void tuscanyFooter(HttpServletRequest request, PrintWriter out) {
- out.println("/** Apache Tuscany scaDomain.js Footer */");
- out.println();
- out.println("function scaDomain() { }");
- out.println();
- out.println("// SCA services");
-
- // Use the DWR remoter to generate the JavaScipt function for each SCA service
- Remoter remoter = (Remoter)getContainer().getBean(Remoter.class.getName());
-
- String path = request.getContextPath() + request.getServletPath();
-
- for (String serviceName : services.keySet()) {
- String serviceScript = remoter.generateInterfaceScript(serviceName, path);
- out.println(serviceScript);
- }
-
- if (referenceNames.size() > 0) {
-
- out.println("// SCA reverse ajax control functions");
- out.println();
- out.println("scaDomain.open = function() { dwr.engine.setActiveReverseAjax(true); };");
- out.println("scaDomain.close = function() { dwr.engine.setActiveReverseAjax(false); };");
-
- out.println();
- out.println("// SCA references");
- out.println();
-
- // the JavaScript function for SCA references has an
- // empty impl as it uses DWR severside "push"
- for (String referenceName : referenceNames) {
- out.println("function " + referenceName + "() { }");
- }
- }
-
- out.println();
- out.println("/** End of Apache Tuscany scaDomain.js */");
- out.println();
- }
-
- /**
- * Add an SCA reference to be added to the DWR runtime
- */
- public void addReference(String name) {
- referenceNames.add(name);
- }
-
- /**
- * Add an SCA service to be added to the DWR runtime
- */
- public void addService(String name, final Class type, final Object instance) {
- ServiceHolder holder = new ServiceHolder();
- holder.name = name;
- holder.type = type;
- holder.instance = instance;
- services.put(name, holder);
- }
-
- /**
- * Defines each SCA service proxy instance to DWR
- */
- private void initServices() {
- CreatorManager creatorManager = (CreatorManager)getContainer().getBean(CreatorManager.class.getName());
-
- for (final ServiceHolder holder : services.values()) {
- creatorManager.addCreator(holder.name, new AbstractCreator() {
- public Class getType() {
- return holder.type;
- }
-
- public Object getInstance() throws InstantiationException {
- return holder.instance;
- }
- });
- }
- }
-
- // utility class to aid passing around services
- private class ServiceHolder {
- String name;
- Class type;
- Object instance;
- }
-
- /**
- * Patch the ServletConfig to enable setting init params for DWR
- * and so DWR can't see the Tuscany servlet's init params.
- */
- private ServletConfig patchConfig(final ServletConfig servletConfig) {
- ServletConfig patchedContext = new ServletConfig() {
- public String getInitParameter(String name) {
- return initParams.get(name);
- }
- public Enumeration getInitParameterNames() {
- return Collections.enumeration(initParams.keySet());
- }
- public ServletContext getServletContext() {
- return servletConfig.getServletContext();
- }
- public String getServletName() {
- return servletConfig.getServletName();
- }
- };
- return patchedContext;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator b/branches/sca-java-1.5.1/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
deleted file mode 100644
index 1a9f91fab2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-dwr/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.binding.dwr.DWRBindingActivator
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/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-java-1.5.1/modules/binding-ejb-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/pom.xml
deleted file mode 100644
index 1512ac4d2b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/pom.xml
+++ /dev/null
@@ -1,195 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-ejb-runtime</artifactId>
- <name>Apache Tuscany SCA EJB Binding Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ejb</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-openejb</artifactId>
- <version>2.1.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-connector</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-persistence-jpa10</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-ejbd</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-loader</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-jee</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-ejbd</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-javaagent</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- </exclusion>
- <exclusion>
- <groupId>asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-all</artifactId>
- <version>3.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
- <repositories>
- <repository>
- <id>geronimo-repository</id>
- <name>Geronimo Repository</name>
- <url>http://svn.apache.org/repos/asf/geronimo/server/tags/2.0.2/repository</url>
- <layout>default</layout>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- </repositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ejb.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ejb*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java
deleted file mode 100644
index c65868c23b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ClassLoadingUtil.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ejb.corba;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Utility class for loading classes by a variety of name variations.
- * <p/>
- * Supported names types are:
- * <p/>
- * 1) Fully qualified class name (e.g., "java.lang.String", "org.apache.geronimo.kernel.ClassLoading"
- * 2) Method signature encoding ("Ljava.lang.String;", "J", "I", etc.)
- * 3) Primitive type names ("int", "boolean", etc.)
- * 4) Method array signature strings ("[I", "[Ljava.lang.String")
- * 5) Arrays using Java code format ("int[]", "java.lang.String[][]")
- * <p/>
- * The classes are loaded using the provided class loader. For the basic types, the primitive
- * reflection types are returned.
- *
- * @version $Rev$ $Date$
- */
-public class ClassLoadingUtil {
-
- /**
- * Table for mapping primitive class names/signatures to the implementing
- * class object
- */
- private static final HashMap PRIMITIVE_CLASS_MAP = new HashMap();
-
- /**
- * Table for mapping primitive classes back to their name signature type, which
- * allows a reverse mapping to be performed from a class object into a resolvable
- * signature.
- */
- private static final HashMap CLASS_TO_SIGNATURE_MAP = new HashMap();
-
-
- /**
- * Setup the primitives map. We make any entry for each primitive class using both the
- * human readable name and the method signature shorthand type.
- */
- static {
- PRIMITIVE_CLASS_MAP.put("boolean", boolean.class);
- PRIMITIVE_CLASS_MAP.put("Z", boolean.class);
- PRIMITIVE_CLASS_MAP.put("byte", byte.class);
- PRIMITIVE_CLASS_MAP.put("B", byte.class);
- PRIMITIVE_CLASS_MAP.put("char", char.class);
- PRIMITIVE_CLASS_MAP.put("C", char.class);
- PRIMITIVE_CLASS_MAP.put("short", short.class);
- PRIMITIVE_CLASS_MAP.put("S", short.class);
- PRIMITIVE_CLASS_MAP.put("int", int.class);
- PRIMITIVE_CLASS_MAP.put("I", int.class);
- PRIMITIVE_CLASS_MAP.put("long", long.class);
- PRIMITIVE_CLASS_MAP.put("J", long.class);
- PRIMITIVE_CLASS_MAP.put("float", float.class);
- PRIMITIVE_CLASS_MAP.put("F", float.class);
- PRIMITIVE_CLASS_MAP.put("double", double.class);
- PRIMITIVE_CLASS_MAP.put("D", double.class);
- PRIMITIVE_CLASS_MAP.put("void", void.class);
- PRIMITIVE_CLASS_MAP.put("V", void.class);
-
- // Now build a reverse mapping table. The table above has a many-to-one mapping for
- // class names. To do the reverse, we need to pick just one. As long as the
- // returned name supports "round tripping" of the requests, this will work fine.
-
- CLASS_TO_SIGNATURE_MAP.put(boolean.class, "Z");
- CLASS_TO_SIGNATURE_MAP.put(byte.class, "B");
- CLASS_TO_SIGNATURE_MAP.put(char.class, "C");
- CLASS_TO_SIGNATURE_MAP.put(short.class, "S");
- CLASS_TO_SIGNATURE_MAP.put(int.class, "I");
- CLASS_TO_SIGNATURE_MAP.put(long.class, "J");
- CLASS_TO_SIGNATURE_MAP.put(float.class, "F");
- CLASS_TO_SIGNATURE_MAP.put(double.class, "D");
- CLASS_TO_SIGNATURE_MAP.put(void.class, "V");
- }
-
-
- /**
- * Load a class that matches the requested name, using the provided class loader context.
- * <p/>
- * The class name may be a standard class name, the name of a primitive type Java
- * reflection class (e.g., "boolean" or "int"), or a type in method type signature
- * encoding. Array classes in either encoding form are also processed.
- *
- * @param className The name of the required class.
- * @param classLoader The class loader used to resolve the class object.
- * @return The Class object resolved from "className".
- * @throws ClassNotFoundException When unable to resolve the class object.
- * @throws IllegalArgumentException If either argument is null.
- */
- public static Class loadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
-
- // the tests require IllegalArgumentExceptions for null values on either of these.
- if (className == null) {
- throw new IllegalArgumentException("className is null");
- }
-
- if (classLoader == null) {
- throw new IllegalArgumentException("classLoader is null");
- }
- // The easiest case is a proper class name. We just have the class loader resolve this.
- // If the class loader throws a ClassNotFoundException, then we need to check each of the
- // special name encodings we support.
- try {
- return classLoader.loadClass(className);
- } catch (ClassNotFoundException ignore) {
- // if not found, continue on to the other name forms.
- }
-
-
- // The second easiest version to resolve is a direct map to a primitive type name
- // or method signature. Check our name-to-class map for one of those.
- Class resolvedClass = (Class) PRIMITIVE_CLASS_MAP.get(className);
- if (resolvedClass != null) {
- return resolvedClass;
- }
-
- // Class names in method signature have the format "Lfully.resolved.name;",
- // so if it ends in a semicolon and begins with an "L", this must be in
- // this format. Have the class loader try to load this. There are no other
- // options if this fails, so just allow the class loader to throw the
- // ClassNotFoundException.
- if (className.endsWith(";") && className.startsWith("L")) {
- // pick out the name portion
- String typeName = className.substring(1, className.length() - 1);
- // and delegate the loading to the class loader.
- return classLoader.loadClass(typeName);
- }
-
- // All we have left now are the array types. Method signature array types
- // have a series of leading "[" characters to specify the number of dimensions.
- // The other array type we handle uses trailing "[]" for the dimensions, just
- // like the Java language syntax.
-
- // first check for the signature form ([[[[type).
- if (className.charAt(0) == '[') {
- // we have at least one array marker, now count how many leading '['s we have
- // to get the dimension count.
- int count = 0;
- int nameLen = className.length();
-
- while (count < nameLen && className.charAt(count) == '[') {
- count++;
- }
-
- // pull of the name subtype, which is everything after the last '['
- String arrayTypeName = className.substring(count, className.length());
- // resolve the type using a recursive call, which will load any of the primitive signature
- // types as well as class names.
- Class arrayType = loadClass(arrayTypeName, classLoader);
-
- // Resolving array types require a little more work. The array classes are
- // created dynamically when the first instance of a given dimension and type is
- // created. We need to create one using reflection to do this.
- return getArrayClass(arrayType, count);
- }
-
-
- // ok, last chance. Now check for an array specification in Java language
- // syntax. This will be a type name followed by pairs of "[]" to indicate
- // the number of dimensions.
- if (className.endsWith("[]")) {
- // get the base component class name and the arrayDimensions
- int count = 0;
- int position = className.length();
-
- while (position > 1 && className.substring(position - 2, position).equals("[]")) {
- // count this dimension
- count++;
- // and step back the probe position.
- position -= 2;
- }
-
- // position now points at the location of the last successful test. This makes it
- // easy to pick off the class name.
-
- String typeName = className.substring(0, position);
-
- // load the base type, again, doing this recursively
- Class arrayType = loadClass(typeName, classLoader);
- // and turn this into the class object
- return getArrayClass(arrayType, count);
- }
-
- throw new ClassNotFoundException("Could not load class " + className + " from unknown classloader; " + classLoader);
- }
-
-
- /**
- * Map a class object back to a class name. The returned class object
- * must be "round trippable", which means
- * <p/>
- * type == ClassLoading.loadClass(ClassLoading.getClassName(type), classLoader)
- * <p/>
- * must be true. To ensure this, the class name is always returned in
- * method signature format.
- *
- * @param type The class object we convert into name form.
- * @return A string representation of the class name, in method signature
- * format.
- */
- public static String getClassName(Class type) {
- StringBuffer name = new StringBuffer();
-
- // we test these in reverse order from the resolution steps,
- // first handling arrays, then primitive types, and finally
- // "normal" class objects.
-
- // First handle arrays. If a class is an array, the type is
- // element stored at that level. So, for a 2-dimensional array
- // of ints, the top-level type will be "[I". We need to loop
- // down the hierarchy until we hit a non-array type.
- while (type.isArray()) {
- // add another array indicator at the front of the name,
- // and continue with the next type.
- name.append('[');
- type = type.getComponentType();
- }
-
- // we're down to the base type. If this is a primitive, then
- // we poke in the single-character type specifier.
- if (type.isPrimitive()) {
- name.append((String) CLASS_TO_SIGNATURE_MAP.get(type));
- }
- // a "normal" class. This gets expressing using the "Lmy.class.name;" syntax.
- else {
- name.append('L');
- name.append(type.getName());
- name.append(';');
- }
- return name.toString();
- }
-
- private static Class getArrayClass(Class type, int dimension) {
- // Array.newInstance() requires an array of the requested number of dimensions
- // that gives the size for each dimension. We just request 0 in each of the
- // dimensions, which is not unlike a black hole singularity.
- int[] dimensions = new int[dimension];
- // create an instance and return the associated class object.
- return Array.newInstance(type, dimensions).getClass();
- }
-
- public static Set getAllTypes(Class type) {
- Set allTypes = new LinkedHashSet();
- allTypes.add(type);
- allTypes.addAll(getAllSuperClasses(type));
- allTypes.addAll(getAllInterfaces(type));
- return allTypes;
- }
-
- private static Set getAllSuperClasses(Class clazz) {
- Set allSuperClasses = new LinkedHashSet();
- for (Class superClass = clazz.getSuperclass(); superClass != null; superClass = superClass.getSuperclass()) {
- allSuperClasses.add(superClass);
- }
- return allSuperClasses;
- }
-
- private static Set getAllInterfaces(Class clazz) {
- Set allInterfaces = new LinkedHashSet();
- LinkedList stack = new LinkedList();
- stack.addAll(Arrays.asList(clazz.getInterfaces()));
- while (!stack.isEmpty()) {
- Class intf = (Class) stack.removeFirst();
- if (!allInterfaces.contains(intf)) {
- allInterfaces.add(intf);
- stack.addAll(Arrays.asList(intf.getInterfaces()));
- }
- }
- return allInterfaces;
- }
-
- public static Set reduceInterfaces(Set source) {
- Class[] classes = (Class[]) source.toArray(new Class[source.size()]);
- classes = reduceInterfaces(classes);
- return new LinkedHashSet(Arrays.asList(classes));
- }
-
- /**
- * If there are multiple interfaces, and some of them extend each other,
- * eliminate the superclass in favor of the subclasses that extend them.
- *
- * If one of the entries is a class (not an interface), make sure it's
- * the first one in the array. If more than one of the entries is a
- * class, throws an IllegalArgumentException
- *
- * @param source the original list of interfaces
- * @return the equal or smaller list of interfaces
- */
- public static Class[] reduceInterfaces(Class[] source) {
- // use a copy of the source array
- source = (Class[]) source.clone();
-
- for (int leftIndex = 0; leftIndex < source.length-1; leftIndex++) {
- Class left = source[leftIndex];
- if(left == null) {
- continue;
- }
-
- for (int rightIndex = leftIndex +1; rightIndex < source.length; rightIndex++) {
- Class right = source[rightIndex];
- if(right == null) {
- continue;
- }
-
- if(left == right || right.isAssignableFrom(left)) {
- // right is the same as class or a sub class of left
- source[rightIndex] = null;
- } else if(left.isAssignableFrom(right)) {
- // left is the same as class or a sub class of right
- source[leftIndex] = null;
-
- // the left has been eliminated; move on to the next left
- break;
- }
- }
- }
-
- Class clazz = null;
- for (int i = 0; i < source.length; i++) {
- if (source[i] != null && !source[i].isInterface()) {
- if (clazz != null) {
- throw new IllegalArgumentException("Source contains two classes which are not subclasses of each other: " + clazz.getName() + ", " + source[i].getName());
- }
- clazz = source[i];
- source[i] = null;
- }
- }
-
- List list = new ArrayList(source.length);
- if (clazz != null) list.add(clazz);
- for (int i = 0; i < source.length; i++) {
- if(source[i] != null) {
- list.add(source[i]);
- }
- }
- return (Class[]) list.toArray(new Class[list.size()]);
- }
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java
deleted file mode 100644
index 82554a1c8f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/DynamicStubClassLoader.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.corba;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import javax.rmi.CORBA.Stub;
-
-import net.sf.cglib.core.NamingPolicy;
-import net.sf.cglib.core.Predicate;
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.CallbackFilter;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.FixedValue;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.NoOp;
-
-/**
- * @version $Revision$ $Date$
- */
-public class DynamicStubClassLoader extends ClassLoader {
- private static final String PACKAGE_PREFIX = "org.omg.stub.";
-
- @Override
- public synchronized Class loadClass(final String name) throws ClassNotFoundException {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
- // check if the stub already exists first
- try {
- return classLoader.loadClass(name);
- } catch (ClassNotFoundException e) {
- }
-
- // if this is not a class from the org.omg.stub name space don't attempt to generate
- if (!name.startsWith(PACKAGE_PREFIX)) {
- throw new ClassNotFoundException("Could not load class: " + name);
- }
-
- // load the interfaces class we are attempting to create a stub for
- Class iface = loadStubInterfaceClass(name, classLoader);
-
- // create the stub builder
- try {
- Enhancer enhancer = new Enhancer();
- enhancer.setSuperclass(Stub.class);
- enhancer.setInterfaces(new Class[] {iface});
- enhancer.setCallbackFilter(FILTER);
- enhancer.setCallbackTypes(new Class[] {NoOp.class, MethodInterceptor.class, FixedValue.class});
- enhancer.setUseFactory(false);
- enhancer.setClassLoader(classLoader);
- enhancer.setNamingPolicy(new NamingPolicy() {
- public String getClassName(String s, String s1, Object o, Predicate predicate) {
- return name;
- }
- });
-
- // generate the class
- Class result = enhancer.createClass();
- assert result != null;
-
- StubMethodInterceptor interceptor = new StubMethodInterceptor(iface);
- Ids ids = new Ids(iface);
- Enhancer.registerStaticCallbacks(result, new Callback[] {NoOp.INSTANCE, interceptor, ids});
-
- return result;
- } catch (RuntimeException e) {
- throw e;
- } catch (Error e) {
- throw e;
- }
- }
-
- private Class loadStubInterfaceClass(String name, ClassLoader classLoader) throws ClassNotFoundException {
- try {
- int begin = name.lastIndexOf('.') + 1;
- String iPackage = name.substring(13, begin);
- String iName = iPackage + name.substring(begin + 1, name.length() - 5);
-
- return classLoader.loadClass(iName);
- } catch (ClassNotFoundException e) {
- // don't log exceptions from CosNaming because it attempts to load every
- // class bound into the name server
-
- //FIXME this variable is never read, can we remove the
- // whole block of code??
- //boolean shouldLog = true;
- StackTraceElement[] stackTrace = e.getStackTrace();
- for (int i = 0; i < stackTrace.length; i++) {
- StackTraceElement stackTraceElement = stackTrace[i];
- if (stackTraceElement.getClassName().equals("org.omg.CosNaming.NamingContextExtPOA") && stackTraceElement
- .getMethodName().equals("_invoke")) {
- //shouldLog = false;
- break;
- }
- }
-
- throw new ClassNotFoundException("Unable to generate stub", e);
- }
- }
-
- private static final CallbackFilter FILTER = new CallbackFilter() {
- public int accept(Method method) {
- // we don't intercept non-public methods like finalize
- if (!Modifier.isPublic(method.getModifiers())) {
- return 0;
- }
-
- if (method.getReturnType().equals(String[].class) && method.getParameterTypes().length == 0
- && method.getName().equals("_ids")) {
- return 2;
- }
-
- if (Modifier.isAbstract(method.getModifiers())) {
- return 1;
- }
-
- return 0;
- }
- };
-
- private static final class Ids implements FixedValue {
- private final String[] typeIds;
-
- public Ids(Class type) {
- typeIds = Java2IDLUtil.createCorbaIds(type);
- }
-
- public Object loadObject() throws Exception {
- return typeIds;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java
deleted file mode 100644
index de8090c45b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/Java2IDLUtil.java
+++ /dev/null
@@ -1,811 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.corba;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.io.UnsupportedEncodingException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.UnexpectedException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.ejb.spi.HandleDelegate;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.rmi.PortableRemoteObject;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.UserException;
-import org.omg.CORBA.portable.IDLEntity;
-import org.omg.CORBA.portable.ResponseHandler;
-import org.omg.CORBA.portable.UnknownException;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.omg.IOP.Codec;
-import org.omg.IOP.CodecFactory;
-import org.omg.IOP.ENCODING_CDR_ENCAPS;
-import org.omg.IOP.Encoding;
-
-/**
- * Various utility functions.
- * <p/>
- * Note: #getORB() and #getCodec() rely on UtilInitializer to initialize the ORB and codec.
- *
- * @version $Rev$ $Date$
- * @see UtilInitializer
- */
-public final class Java2IDLUtil {
- private static ORB orb;
- private static Codec codec;
- private static HandleDelegate handleDelegate;
-
- public static ORB getORB() {
- assert orb != null;
- return orb;
- }
-
-
-
- public static void setORB(ORB orb) throws UserException {
- if (Java2IDLUtil.orb == null) {
- Java2IDLUtil.orb = orb;
- CodecFactory factory = (CodecFactory) Java2IDLUtil.orb.resolve_initial_references("CodecFactory");
- codec = factory.create_codec(new Encoding(ENCODING_CDR_ENCAPS.value, (byte) 1, (byte) 2));
- }
- }
-
- public static Codec getCodec() {
- assert codec != null;
- return codec;
- }
-
- public static HandleDelegate getHandleDelegate() throws NamingException {
- if (handleDelegate == null) {
- InitialContext ic = new InitialContext();
- handleDelegate = (HandleDelegate) ic.lookup("java:comp/HandleDelegate");
- }
- return handleDelegate;
- }
-
- private static final Pattern SCOPED_NAME_EXTRACTION_PATTERN = Pattern.compile("(\\\\\\\\)|(\\\\@)|(@)|(\\z)");
-
- /**
- * See csiv2 Specification 16.2.5 par. 63-64. We extract the username if any and un-escape any
- * escaped \ and @ characters.
- *
- * @param scopedNameBytes
- * @return
- * @throws UnsupportedEncodingException
- */
- public static String extractUserNameFromScopedName(byte[] scopedNameBytes) throws UnsupportedEncodingException {
- String scopedUserName = new String(scopedNameBytes, "UTF8");
- return extractUserNameFromScopedName(scopedUserName);
- }
-
- public static String extractUserNameFromScopedName(String scopedUserName) {
- Matcher m = SCOPED_NAME_EXTRACTION_PATTERN.matcher(scopedUserName);
- StringBuffer buf = new StringBuffer();
- while (m.find()) {
- m.appendReplacement(buf, "");
- if (m.group(1) != null) {
- buf.append('\\');
- } else if (m.group(2) != null) {
- buf.append("@");
- } else if (m.group(3) != null) {
- break;
- }
- }
- return buf.toString();
- }
-
- private static final Pattern SCOPED_NAME_ESCAPE_PATTERN = Pattern.compile("(\\\\)|(@)");
-
- public static String buildScopedUserName(String user, String domain) {
- StringBuffer buf = new StringBuffer();
- if (user != null) {
- escape(user, buf);
- }
- if (domain != null) {
- buf.append('@');
- escape(domain, buf);
- }
- return buf.toString();
- }
-
- private static void escape(String s, StringBuffer buf) {
- Matcher m = SCOPED_NAME_ESCAPE_PATTERN.matcher(s);
- while (m.find()) {
- m.appendReplacement(buf, "");
- if (m.group(1) != null) {
- buf.append("\\\\");
- } else if (m.group(2) != null) {
- buf.append("\\@");
- }
- }
- m.appendTail(buf);
- }
-
-
- public static String byteToString(byte[] data) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < data.length; i++) {
- buffer.append(HEXCHAR[(data[i] >>> 4) & 0x0F]);
- buffer.append(HEXCHAR[(data[i]) & 0x0F]);
- }
- return buffer.toString();
-
- }
-
- private static final char[] HEXCHAR = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
- };
-
- public static void writeObject(Class type, Object object, OutputStream out) {
- if (type == Void.TYPE) {
- // do nothing for a void
- } else if (type == Boolean.TYPE) {
- out.write_boolean(((Boolean) object).booleanValue());
- } else if (type == Byte.TYPE) {
- out.write_octet(((Byte) object).byteValue());
- } else if (type == Character.TYPE) {
- out.write_wchar(((Character) object).charValue());
- } else if (type == Double.TYPE) {
- out.write_double(((Double) object).doubleValue());
- } else if (type == Float.TYPE) {
- out.write_float(((Float) object).floatValue());
- } else if (type == Integer.TYPE) {
- out.write_long(((Integer) object).intValue());
- } else if (type == Long.TYPE) {
- out.write_longlong(((Long) object).longValue());
- } else if (type == Short.TYPE) {
- out.write_short(((Short) object).shortValue());
- } else {
- // object types must be written in the context of the CORBA application server
- // which properly write replaces our objects for CORBA
- // ApplicationServer oldApplicationServer = ServerFederation.getApplicationServer();
- try {
- // ServerFederation.setApplicationServer(corbaApplicationServer);
-
- // todo check if
- // copy the result to force replacement
- // CORBA does not call writeReplace on remote proxies
- //
- // HOWEVER, if this is an array, then we don't want to do the replacement
- // because we can end up with a replacement element that's not compatible with the
- // original array type, which results in an ArrayStoreException. Fortunately,
- // the Yoko RMI support appears to be able to sort this out for us correctly.
- if (object instanceof Serializable && !object.getClass().isArray()) {
- try {
- object = copyObj(Thread.currentThread().getContextClassLoader(), object);
- } catch (Exception e) {
- throw new UnknownException(e);
- }
- }
-
- if (type == Object.class || type == Serializable.class) {
- javax.rmi.CORBA.Util.writeAny(out, object);
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
- out.write_Object((org.omg.CORBA.Object) object);
- } else if (Remote.class.isAssignableFrom(type)) {
- javax.rmi.CORBA.Util.writeRemoteObject(out, object);
- } else if (type.isInterface() && Serializable.class.isAssignableFrom(type)) {
- javax.rmi.CORBA.Util.writeAbstractObject(out, object);
- } else {
- out.write_value((Serializable) object, type);
- }
- } finally {
- // ServerFederation.setApplicationServer(oldApplicationServer);
- }
- }
- }
-
- private static Object copyObj(ClassLoader classLoader, Object object) throws IOException, ClassNotFoundException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(object);
- oos.flush();
- oos.close();
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- ObjectInputStreamExt ois = new ObjectInputStreamExt(bais, classLoader);
- return ois.readObject();
- }
-
- public static Object readObject(Class type, InputStream in) {
- if (type == Void.TYPE) {
- return null;
- } else if (type == Boolean.TYPE) {
- return new Boolean(in.read_boolean());
- } else if (type == Byte.TYPE) {
- return new Byte(in.read_octet());
- } else if (type == Character.TYPE) {
- return new Character(in.read_wchar());
- } else if (type == Double.TYPE) {
- return new Double(in.read_double());
- } else if (type == Float.TYPE) {
- return new Float(in.read_float());
- } else if (type == Integer.TYPE) {
- return new Integer(in.read_long());
- } else if (type == Long.TYPE) {
- return new Long(in.read_longlong());
- } else if (type == Short.TYPE) {
- return new Short(in.read_short());
- } else if (type == Object.class || type == Serializable.class) {
- return javax.rmi.CORBA.Util.readAny(in);
- } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)) {
- return in.read_Object(type);
- } else if (Remote.class.isAssignableFrom(type)) {
- return PortableRemoteObject.narrow(in.read_Object(), type);
- } else if (type.isInterface() && Serializable.class.isAssignableFrom(type)) {
- return in.read_abstract_interface();
- } else {
- return in.read_value(type);
- }
- }
-
- public static void throwException(Method method, InputStream in) throws Throwable {
- // read the exception id
- final String id = in.read_string();
-
- // get the class name from the id
- if (!id.startsWith("IDL:")) {
- return;
- }
-
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int i = 0; i < exceptionTypes.length; i++) {
- Class exceptionType = exceptionTypes[i];
-
- String exceptionId = getExceptionId(exceptionType);
- if (id.equals(exceptionId)) {
- throw (Throwable) in.read_value(exceptionType);
- }
- }
- throw new UnexpectedException(id);
- }
-
- public static OutputStream writeUserException(Method method, ResponseHandler reply, Exception exception) throws Exception {
- if (exception instanceof RuntimeException || exception instanceof RemoteException) {
- throw exception;
- }
-
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int i = 0; i < exceptionTypes.length; i++) {
- Class exceptionType = exceptionTypes[i];
- if (!exceptionType.isInstance(exception)) {
- continue;
- }
-
- OutputStream out = (OutputStream) reply.createExceptionReply();
- String exceptionId = getExceptionId(exceptionType);
- out.write_string(exceptionId);
- out.write_value(exception);
- return out;
- }
- throw exception;
- }
-
- public static String getExceptionId(Class exceptionType) {
- String exceptionName = exceptionType.getName().replace('.', '/');
- if (exceptionName.endsWith("Exception")) {
- exceptionName = exceptionName.substring(0, exceptionName.length() - "Exception".length());
- }
- exceptionName += "Ex";
- String exceptionId = "IDL:" + exceptionName + ":1.0";
- return exceptionId;
- }
-
- public static String[] createCorbaIds(Class type) {
- List ids = new LinkedList();
- for (Iterator iterator = getAllInterfaces(type).iterator(); iterator.hasNext();) {
- Class superInterface = (Class) iterator.next();
- if (Remote.class.isAssignableFrom(superInterface) && superInterface != Remote.class) {
- ids.add("RMI:" + superInterface.getName() + ":0000000000000000");
- }
- }
- return (String[]) ids.toArray(new String[ids.size()]);
- }
-
- private static Set getAllInterfaces(Class intfClass) {
- Set allInterfaces = new LinkedHashSet();
-
- LinkedList stack = new LinkedList();
- stack.addFirst(intfClass);
-
- while (!stack.isEmpty()) {
- Class intf = (Class) stack.removeFirst();
- allInterfaces.add(intf);
- stack.addAll(0, Arrays.asList(intf.getInterfaces()));
- }
-
- return allInterfaces;
- }
-
- public static Map mapMethodToOperation(Class intfClass) {
- return iiopMap(intfClass, false);
- }
-
- public static Map mapOperationToMethod(Class intfClass) {
- return iiopMap(intfClass, true);
- }
-
- private static Map iiopMap(Class intfClass, boolean operationToMethod) {
- Method[] methods = getAllMethods(intfClass);
-
- // find every valid getter
- HashMap getterByMethod = new HashMap(methods.length);
- HashMap getterByName = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // no arguments allowed
- if (method.getParameterTypes().length != 0) {
- continue;
- }
-
- // must start with get or is
- String verb;
- if (methodName.startsWith("get") && methodName.length() > 3 && method.getReturnType() != void.class) {
- verb = "get";
- } else if (methodName.startsWith("is") && methodName.length() > 2 && method.getReturnType() == boolean.class) {
- verb = "is";
- } else {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > verb.length() + 1 && Character.isUpperCase(methodName.charAt(verb.length() + 1))) {
- propertyName = methodName.substring(verb.length());
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(verb.length())) + methodName.substring(verb.length() + 1);
- }
- getterByMethod.put(method, propertyName);
- getterByName.put(propertyName, method);
- }
-
- HashMap setterByMethod = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- String methodName = method.getName();
-
- // must have exactally one arg
- if (method.getParameterTypes().length != 1) {
- continue;
- }
-
- // must return non void
- if (method.getReturnType() != void.class) {
- continue;
- }
-
- // must start with set
- if (!methodName.startsWith("set") || methodName.length() <= 3) {
- continue;
- }
-
- // must only throw Remote or Runtime Exceptions
- boolean exceptionsValid = true;
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int j = 0; j < exceptionTypes.length; j++) {
- Class exceptionType = exceptionTypes[j];
- if (!RemoteException.class.isAssignableFrom(exceptionType) &&
- !RuntimeException.class.isAssignableFrom(exceptionType) &&
- !Error.class.isAssignableFrom(exceptionType)) {
- exceptionsValid = false;
- break;
- }
- }
- if (!exceptionsValid) {
- continue;
- }
-
- String propertyName;
- if (methodName.length() > 4 && Character.isUpperCase(methodName.charAt(4))) {
- propertyName = methodName.substring(3);
- } else {
- propertyName = Character.toLowerCase(methodName.charAt(3)) + methodName.substring(4);
- }
-
- // must have a matching getter
- Method getter = (Method) getterByName.get(propertyName);
- if (getter == null) {
- continue;
- }
-
- // setter property must match getter return value
- if (!method.getParameterTypes()[0].equals(getter.getReturnType())) {
- continue;
- }
- setterByMethod.put(method, propertyName);
- }
-
- // index the methods by name... used to determine which methods are overloaded
- HashMap overloadedMethods = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String methodName = method.getName();
- List methodList = (List) overloadedMethods.get(methodName);
- if (methodList == null) {
- methodList = new LinkedList();
- overloadedMethods.put(methodName, methodList);
- }
- methodList.add(method);
- }
-
- // index the methods by lower case name... used to determine which methods differ only by case
- HashMap caseCollisionMethods = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
- if (getterByMethod.containsKey(method) || setterByMethod.containsKey(method)) {
- continue;
- }
- String lowerCaseMethodName = method.getName().toLowerCase();
- Set methodSet = (Set) caseCollisionMethods.get(lowerCaseMethodName);
- if (methodSet == null) {
- methodSet = new HashSet();
- caseCollisionMethods.put(lowerCaseMethodName, methodSet);
- }
- methodSet.add(method.getName());
- }
-
- String className = getClassName(intfClass);
- Map iiopMap = new HashMap(methods.length);
- for (int i = 0; i < methods.length; i++) {
- Method method = methods[i];
-
- String iiopName = (String) getterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_get_" + iiopName.substring(1);
- } else {
- iiopName = "_get_" + iiopName;
- }
- } else {
- iiopName = (String) setterByMethod.get(method);
- if (iiopName != null) {
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J_set_" + iiopName.substring(1);
- } else {
- iiopName = "_set_" + iiopName;
- }
- } else {
- iiopName = method.getName();
-
- // if we have a leading underscore prepend with J
- if (iiopName.charAt(0) == '_') {
- iiopName = "J" + iiopName;
- }
- }
- }
-
- // if this name only differs by case add the case index to the end
- Set caseCollisions = (Set) caseCollisionMethods.get(method.getName().toLowerCase());
- if (caseCollisions != null && caseCollisions.size() > 1) {
- iiopName += upperCaseIndexString(iiopName);
- }
-
- // if this is an overloaded method append the parameter string
- List overloads = (List) overloadedMethods.get(method.getName());
- if (overloads != null && overloads.size() > 1) {
- iiopName += buildOverloadParameterString(method.getParameterTypes());
- }
-
- // if we have a leading underscore prepend with J
- iiopName = replace(iiopName, '$', "U0024");
-
- // if we have matched a keyword prepend with an underscore
- if (keywords.contains(iiopName.toLowerCase())) {
- iiopName = "_" + iiopName;
- }
-
- // if the name is the same as the class name, append an underscore
- if (iiopName.equalsIgnoreCase(className)) {
- iiopName += "_";
- }
-
- if (operationToMethod) {
- iiopMap.put(iiopName, method);
- } else {
- iiopMap.put(method, iiopName);
- }
- }
-
- return iiopMap;
- }
-
- private static Method[] getAllMethods(Class intfClass) {
- LinkedList methods = new LinkedList();
- for (Iterator iterator = getAllInterfaces(intfClass).iterator(); iterator.hasNext();) {
- Class intf = (Class) iterator.next();
- methods.addAll(Arrays.asList(intf.getDeclaredMethods()));
- }
-
- return (Method[]) methods.toArray(new Method[methods.size()]);
- }
-
- /**
- * Return the a string containing an underscore '_' index of each uppercase character in the IIOP name.
- *
- * This is used for distinction of names that only differ by case, since CORBA does not support case sensitive names.
- */
- private static String upperCaseIndexString(String iiopName) {
- StringBuffer stringBuffer = new StringBuffer();
- for (int i = 0; i < iiopName.length(); i++) {
- char c = iiopName.charAt(i);
- if (Character.isUpperCase(c)) {
- stringBuffer.append('_').append(i);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Replaces any occurances of the specified "oldChar" with the new string.
- *
- * This is used to replace occurances if '$' in CORBA names since '$' is a special character
- */
- private static String replace(String source, char oldChar, String newString) {
- StringBuffer stringBuffer = new StringBuffer(source.length());
- for (int i = 0; i < source.length(); i++) {
- char c = source.charAt(i);
- if (c == oldChar) {
- stringBuffer.append(newString);
- } else {
- stringBuffer.append(c);
- }
- }
- return stringBuffer.toString();
- }
-
- /**
- * Return the a string containing a double underscore '__' list of parameter types encoded using the Java to IDL rules.
- *
- * This is used for distinction of methods that only differ by parameter lists.
- */
- private static String buildOverloadParameterString(Class[] parameterTypes) {
- String name = "";
- if (parameterTypes.length ==0) {
- name += "__";
- } else {
- for (int i = 0; i < parameterTypes.length; i++) {
- Class parameterType = parameterTypes[i];
- name += buildOverloadParameterString(parameterType);
- }
- }
- return name.replace('.', '_');
- }
-
- /**
- * Returns a single parameter type encoded using the Java to IDL rules.
- */
- private static String buildOverloadParameterString(Class parameterType) {
- String name = "_";
-
- int arrayDimensions = 0;
- while (parameterType.isArray()) {
- arrayDimensions++;
- parameterType = parameterType.getComponentType();
- }
-
- // arrays start with org_omg_boxedRMI_
- if (arrayDimensions > 0) {
- name += "_org_omg_boxedRMI";
- }
-
- // IDLEntity types must be prefixed with org_omg_boxedIDL_
- if (IDLEntity.class.isAssignableFrom(parameterType)) {
- name += "_org_omg_boxedIDL";
- }
-
- // add package... some types have special mappings in corba
- String packageName = (String) specialTypePackages.get(parameterType.getName());
- if (packageName == null) {
- packageName = getPackageName(parameterType.getName());
- }
- if (packageName.length() > 0) {
- name += "_" + packageName;
- }
-
- // arrays now contain a dimension indicator
- if (arrayDimensions > 0) {
- name += "_" + "seq" + arrayDimensions;
- }
-
- // add the class name
- String className = (String) specialTypeNames.get(parameterType.getName());
- if (className == null) {
- className = buildClassName(parameterType);
- }
- name += "_" + className;
-
- return name;
- }
-
- /**
- * Returns a string containing an encoded class name.
- */
- private static String buildClassName(Class type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- StringBuffer className = new StringBuffer(typeName.substring(endIndex + 1));
-
- // for innerclasses replace the $ separator with two underscores
- // we can't just blindly replace all $ characters since class names can contain the $ character
- if (type.getDeclaringClass() != null) {
- String declaringClassName = getClassName(type.getDeclaringClass());
- assert className.toString().startsWith(declaringClassName + "$");
- className.replace(declaringClassName.length(), declaringClassName.length() + 1, "__");
- }
-
- // if we have a leading underscore prepend with J
- if (className.charAt(0) == '_') {
- className.insert(0, "J");
- }
- return className.toString();
- }
-
- private static String getClassName(Class type) {
- if (type.isArray()) {
- throw new IllegalArgumentException("type is an array: " + type);
- }
-
- // get the classname
- String typeName = type.getName();
- int endIndex = typeName.lastIndexOf('.');
- if (endIndex < 0) {
- return typeName;
- }
- return typeName.substring(endIndex + 1);
- }
-
- private static String getPackageName(String interfaceName) {
- int endIndex = interfaceName.lastIndexOf('.');
- if (endIndex < 0) {
- return "";
- }
- return interfaceName.substring(0, endIndex);
- }
-
- private static final Map specialTypeNames;
- private static final Map specialTypePackages;
- private static final Set keywords;
-
- static {
- specialTypeNames = new HashMap();
- specialTypeNames.put("boolean", "boolean");
- specialTypeNames.put("char", "wchar");
- specialTypeNames.put("byte", "octet");
- specialTypeNames.put("short", "short");
- specialTypeNames.put("int", "long");
- specialTypeNames.put("long", "long_long");
- specialTypeNames.put("float", "float");
- specialTypeNames.put("double", "double");
- specialTypeNames.put("java.lang.Class", "ClassDesc");
- specialTypeNames.put("java.lang.String", "WStringValue");
- specialTypeNames.put("org.omg.CORBA.Object", "Object");
-
- specialTypePackages = new HashMap();
- specialTypePackages.put("boolean", "");
- specialTypePackages.put("char", "");
- specialTypePackages.put("byte", "");
- specialTypePackages.put("short", "");
- specialTypePackages.put("int", "");
- specialTypePackages.put("long", "");
- specialTypePackages.put("float", "");
- specialTypePackages.put("double", "");
- specialTypePackages.put("java.lang.Class", "javax.rmi.CORBA");
- specialTypePackages.put("java.lang.String", "CORBA");
- specialTypePackages.put("org.omg.CORBA.Object", "");
-
- keywords = new HashSet();
- keywords.add("abstract");
- keywords.add("any");
- keywords.add("attribute");
- keywords.add("boolean");
- keywords.add("case");
- keywords.add("char");
- keywords.add("const");
- keywords.add("context");
- keywords.add("custom");
- keywords.add("default");
- keywords.add("double");
- keywords.add("enum");
- keywords.add("exception");
- keywords.add("factory");
- keywords.add("false");
- keywords.add("fixed");
- keywords.add("float");
- keywords.add("in");
- keywords.add("inout");
- keywords.add("interface");
- keywords.add("long");
- keywords.add("module");
- keywords.add("native");
- keywords.add("object");
- keywords.add("octet");
- keywords.add("oneway");
- keywords.add("out");
- keywords.add("private");
- keywords.add("public");
- keywords.add("raises");
- keywords.add("readonly");
- keywords.add("sequence");
- keywords.add("short");
- keywords.add("string");
- keywords.add("struct");
- keywords.add("supports");
- keywords.add("switch");
- keywords.add("true");
- keywords.add("truncatable");
- keywords.add("typedef");
- keywords.add("union");
- keywords.add("unsigned");
- keywords.add("valuebase");
- keywords.add("valuetype");
- keywords.add("void");
- keywords.add("wchar");
- keywords.add("wstring");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.java
deleted file mode 100644
index 1be4a98a48..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/ObjectInputStreamExt.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.binding.ejb.corba;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.lang.reflect.Proxy;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ObjectInputStreamExt extends ObjectInputStream {
-
- private ClassLoader classloader;
-
- public ObjectInputStreamExt(InputStream in, ClassLoader loader) throws IOException {
- super(in);
- this.classloader = loader;
- }
-
- @Override
- protected Class resolveClass(ObjectStreamClass classDesc) throws IOException, ClassNotFoundException {
- return ClassLoadingUtil.loadClass(classDesc.getName(), classloader);
- }
-
- @Override
- protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException {
- Class[] cinterfaces = new Class[interfaces.length];
- for (int i = 0; i < interfaces.length; i++)
- cinterfaces[i] = classloader.loadClass(interfaces[i]);
-
- try {
- return Proxy.getProxyClass(classloader, cinterfaces);
- } catch (IllegalArgumentException e) {
- throw new ClassNotFoundException(null, e);
- }
- }
-
- ClassLoader getClassloader() {
- return classloader;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java
deleted file mode 100644
index 3ff0ed552a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/StubMethodInterceptor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.corba;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.ejb.EJBObject;
-import javax.rmi.CORBA.Stub;
-import javax.rmi.CORBA.Util;
-
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.RemarshalException;
-import org.omg.CORBA.portable.ServantObject;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-
-/**
- * @version $Revision$ $Date$
- */
-public class StubMethodInterceptor implements MethodInterceptor {
- private static final Method ISIDENTICAL;
-
- static {
- try {
- ISIDENTICAL = EJBObject.class.getMethod("isIdentical", new Class[]{EJBObject.class});
- } catch (NoSuchMethodException e) {
- throw new ExceptionInInitializerError(e);
- }
- }
-
- private final Class type;
- private final Map operations;
-
- public StubMethodInterceptor(Class type) {
- this.type = type;
- this.operations = Collections.unmodifiableMap(org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.mapMethodToOperation(type));
- }
-
- public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
- Stub stub = (Stub) proxy;
-
- // handle is identical in stub to avoid unnecessary round trip
- if (method.equals(ISIDENTICAL)) {
- org.omg.CORBA.Object otherObject = (org.omg.CORBA.Object) args[0];
- return new Boolean(stub._is_equivalent(otherObject));
- }
-
- // get the operation name object
- String operationName = (String) operations.get(method);
- if (operationName == null) {
- throw new IllegalStateException("Unknown method: " + method);
- }
-
- while (true) {
- // if this is a stub to a remote object we invoke over the wire
- if (!Util.isLocal(stub)) {
-
- InputStream in = null;
- try {
- // create the request output stream
- OutputStream out = (OutputStream) stub._request(operationName, true);
-
- // write the arguments
- Class[] parameterTypes = method.getParameterTypes();
- for (int i = 0; i < parameterTypes.length; i++) {
- Class parameterType = parameterTypes[i];
- org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.writeObject(parameterType, args[i], out);
- }
-
- // send the invocation
- in = (InputStream) stub._invoke(out);
-
- // read the result
- Object result = org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.readObject(method.getReturnType(), in);
- return result;
- } catch (RemarshalException exception) {
- continue;
- } catch (ApplicationException exception) {
- org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.throwException(method, (InputStream) exception.getInputStream());
- } catch (SystemException e) {
- throw Util.mapSystemException(e);
- } finally {
- stub._releaseReply(in);
- }
- } else {
- // get the servant
- ServantObject servantObject = stub._servant_preinvoke(operationName, type);
- if (servantObject == null) {
- continue;
- }
-
- try {
- // copy the arguments
- Object[] argsCopy = Util.copyObjects(args, stub._orb());
-
- // invoke the servant
- Object result = null;
- try {
- result = method.invoke(servantObject.servant, argsCopy);
- } catch (InvocationTargetException e) {
- if (e.getCause() != null) {
- throw e.getCause();
- }
- throw e;
- }
-
- // copy the result
- result = Util.copyObject(result, stub._orb());
-
- return result;
- } catch (Throwable throwable) {
- // copy the exception
- Throwable throwableCopy = (Throwable) Util.copyObject(throwable, stub._orb());
-
- // if it is one of my exception rethrow it
- Class[] exceptionTypes = method.getExceptionTypes();
- for (int i = 0; i < exceptionTypes.length; i++) {
- Class exceptionType = exceptionTypes[i];
- if (exceptionType.isInstance(throwableCopy)) {
- throw throwableCopy;
- }
- }
-
- throw Util.wrapException(throwableCopy);
- } finally {
- stub._servant_postinvoke(servantObject);
- }
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java
deleted file mode 100644
index f9aa9ffa22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/corba/UtilInitializer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.corba;
-
-import org.omg.CORBA.LocalObject;
-import org.omg.PortableInterceptor.ORBInitInfo;
-import org.omg.PortableInterceptor.ORBInitializer;
-
-/**
- * The sole purpose of this initializer is to register a non-singleton ORB
- * with the class <code>Util</code>.
- *
- * @version $Revision$ $Date$
- * @see Java2IDLUtil
- */
-public class UtilInitializer extends LocalObject implements ORBInitializer {
-
- private static final long serialVersionUID = 4901857563505370955L;
-
- /**
- * Called during ORB initialization. If it is expected that initial
- * services registered by an interceptor will be used by other
- * interceptors, then those initial services shall be registered at
- * this point via calls to
- * <code>ORBInitInfo.register_initial_reference</code>.
- *
- * @param info provides initialization attributes and operations by
- * which Interceptors can be registered.
- */
- public void pre_init(ORBInitInfo info) {
- }
-
- /**
- * Called during ORB initialization. If a service must resolve initial
- * references as part of its initialization, it can assume that all
- * initial references will be available at this point.
- * <p/>
- * Calling the <code>post_init</code> operations is not the final
- * task of ORB initialization. The final task, following the
- * <code>post_init</code> calls, is attaching the lists of registered
- * interceptors to the ORB. Therefore, the ORB does not contain the
- * interceptors during calls to <code>post_init</code>. If an
- * ORB-mediated call is made from within <code>post_init</code>, no
- * request interceptors will be invoked on that call.
- * Likewise, if an operation is performed which causes an IOR to be
- * created, no IOR interceptors will be invoked.
- *
- * @param info provides initialization attributes and
- * operations by which Interceptors can be registered.
- */
- public void post_init(ORBInitInfo info) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java
deleted file mode 100644
index 9247c1d3db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingInvoker.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.provider;
-
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-import org.apache.tuscany.sca.binding.ejb.util.EJBHandler;
-import org.apache.tuscany.sca.binding.ejb.util.NamingEndpoint;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-
-/**
- * EJBTargetInvoker
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingInvoker implements Invoker, DataExchangeSemantics {
-
- private Operation operation;
- private String location;
- private Class serviceInterface;
-
- public EJBBindingInvoker(EJBBinding ejbBinding, Class serviceInterface, Operation operation) {
- this.serviceInterface = serviceInterface;
- this.location = ejbBinding.getURI();
- this.operation = operation;
- }
-
- public Message invoke(Message msg) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(serviceInterface.getClassLoader());
- Object resp = doInvoke(msg.getBody());
- msg.setBody(resp);
- } catch (Throwable e) {
- e.printStackTrace();
- msg.setFaultBody(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- return msg;
- }
-
- /**
- * Invoke a EJB operation
- *
- * @param payload
- * @return
- */
- public Object doInvoke(final Object payload) {
-
- // construct NamingendPoint
- NamingEndpoint endpoint = getNamingEndpoint();
-
- // lookup home and ejb stub
- EJBHandler ejbHandler = new EJBHandler(endpoint, serviceInterface);
-
- String methodName = operation.getName();
-
- // invoke business method on ejb
- Object response = ejbHandler.invoke(methodName, (Object[])payload);
-
- return response;
- }
-
- protected NamingEndpoint getNamingEndpoint() {
- return new NamingEndpoint(location);
- }
-
- public boolean allowsPassByReference() {
- // EJB RMI/IIOP always pass by value
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.java
deleted file mode 100644
index a6ea583d0b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingProviderFactory.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.binding.ejb.provider;
-
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A factory from creating the EJB binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingProviderFactory implements BindingProviderFactory<EJBBinding> {
-
- public EJBBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- EJBBinding binding) {
- return new EJBBindingReferenceBindingProvider(component, reference, binding);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- EJBBinding binding) {
- return null;
- //throw new EJBBindingException("Service Binding not supported for EJB Binding");
- }
-
- public Class<EJBBinding> getModelType() {
- return EJBBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.java
deleted file mode 100644
index 2a02bf0d08..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/provider/EJBBindingReferenceBindingProvider.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.binding.ejb.provider;
-
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * Implementation of the ReferenceBindingProvider for the EJBBinding.
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingReferenceBindingProvider implements ReferenceBindingProvider {
- private EJBBinding ejbBinding;
- private RuntimeComponentReference reference;
-
- /**
- * Constructor
- *
- * @param component
- * @param reference
- * @param binding
- */
- public EJBBindingReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- EJBBinding binding) {
- this.reference = reference;
- this.ejbBinding = binding;
- }
-
- /**
- * {@inheritDoc}
- */
- public Invoker createInvoker(Operation operation) {
- return new EJBBindingInvoker(ejbBinding, ((JavaInterface)reference.getInterfaceContract().getInterface())
- .getJavaClass(), operation);
- }
-
- /**
- * {@inheritDoc}
- */
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- /**
- * {@inheritDoc}
- */
- public void start() {
- }
-
- /**
- * {@inheritDoc}
- */
- public void stop() {
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean supportsOneWayInvocation() {
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java
deleted file mode 100644
index d41dbd0a0f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBHandler.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ejb.EJBObject;
-import javax.rmi.CORBA.Util;
-
-import org.apache.tuscany.sca.binding.ejb.corba.ClassLoadingUtil;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.RemarshalException;
-import org.omg.CORBA.portable.ServantObject;
-import org.omg.CORBA_2_3.portable.InputStream;
-import org.omg.CORBA_2_3.portable.OutputStream;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * EJBMessageHandler
- *
- * @version $Rev$ $Date$
- */
-public class EJBHandler {
- private static final Map<String, Class> PRIMITIVE_TYPES = new HashMap<String, Class>();
- static {
- PRIMITIVE_TYPES.put("boolean", boolean.class);
- PRIMITIVE_TYPES.put("byte", byte.class);
- PRIMITIVE_TYPES.put("char", char.class);
- PRIMITIVE_TYPES.put("short", short.class);
- PRIMITIVE_TYPES.put("int", int.class);
- PRIMITIVE_TYPES.put("long", long.class);
- PRIMITIVE_TYPES.put("float", float.class);
- PRIMITIVE_TYPES.put("double", double.class);
- PRIMITIVE_TYPES.put("void", void.class);
- }
-
- private Object ejbStub;
-
- private InterfaceInfo interfaceInfo;
- private Class ejbInterface;
-
- public EJBHandler(NamingEndpoint namingEndpoint, Class ejbInterface) {
- this(namingEndpoint, InterfaceInfo.getInstance(ejbInterface));
- this.ejbInterface = ejbInterface;
- }
-
- // locates the stub
- private EJBHandler(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) {
- try {
- this.ejbStub = EJBStubHelper.lookup(namingEndpoint, ejbInterface);
- this.interfaceInfo = ejbInterface;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- private static Class loadClass(final String name) {
- try {
- return ClassLoadingUtil.loadClass(name, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- // invokes EJB method
- public Object invoke(String methodName, Object[] args) {
- Object response = null;
- try {
- if (ejbStub instanceof ObjectImpl) {
- ObjectImpl objectImpl = (ObjectImpl)ejbStub;
- // TODO: If the Java 2 security is turned on, then
- // the ORB will try to create proxy
- // from the interfaces defined on the stub
- if (System.getSecurityManager() == null && objectImpl._is_local()) {
- /*
- * CORBA.Stub is what the object from JNDI will be for a
- * remote EJB in the same JVM as the client, but with no
- * stub classes available on the client
- */
- response = invokeLocalCORBACall(objectImpl, methodName, args);
- } else {
- /*
- * _EJBObject_Stub is what the object from JNDI will be for
- * a remote EJB with no stub classes available on the client
- */
- response = invokeRemoteCORBACall(objectImpl, methodName, args);
- }
- } else {
- /*
- * A generated ejb stub or it must be an EJB in the same ear as
- * the client or an AppServer with a single ClassLoader, so
- * reflection can be used directly on the JNDI
- */
- JavaReflectionAdapter reflectionAdapter =
- JavaReflectionAdapter.createJavaReflectionAdapter(ejbStub.getClass());
- try {
- Method method = reflectionAdapter.getMethod(methodName);
- response = method.invoke(ejbStub, args);
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- // FIXME need to throw really a business exception.
- // ServiceBusinessException?
- // Tuscany core doesn't have ServiceBusinessException
- throw new ServiceRuntimeException(t);
- }
- }
-
- return response;
- } catch (Exception e) {
- // FIXME this be business exception? Tuscany core doesn't have
- // ServiceBusinessException
- throw new ServiceRuntimeException(e);
-
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Get the IDL operation name for a java method
- *
- * @param methodName java method name
- * @return The IDL operation name
- */
- private String getOperation(String methodName) {
- if (interfaceInfo == null) {
- return methodName;
- }
- MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
- if (methodInfo != null) {
- return methodInfo.getIDLName();
- } else {
- return null;
- }
- }
-
- /*
- * Derive the EJB interface name from the Stub When loading a stub class
- * corresponding to an interface or class <packagename>.<typename>, the
- * class <packagename>._<typename>_Stub shall be used if it exists;
- * otherwise, the class org.omg.stub.<packagename>._<typename>_Stub shall
- * be used.
- */
- private static String getInterface(String stubName) {
- int index = stubName.lastIndexOf('.');
- String packageName = null;
- String typeName = stubName;
- if (index != -1) {
- packageName = stubName.substring(0, index);
- if (packageName.startsWith("org.omg.stub.")) {
- packageName = packageName.substring("org.omg.stub.".length());
- }
- typeName = stubName.substring(index + 1);
- }
- if (typeName.startsWith("_") && typeName.endsWith("_Stub")) {
- typeName = typeName.substring(1, typeName.length() - "_Stub".length());
- }
- if (packageName != null)
- return packageName + "." + typeName;
- else
- return typeName;
- }
-
- /**
- * Invoke a method on the local CORBA object
- *
- * @param stub
- * @param methodName
- * @param args
- * @return
- * @throws RemoteException
- * @throws ServiceBusinessException
- */
- private Object invokeLocalCORBACall(final ObjectImpl stub, String methodName, Object[] args)
- throws RemoteException {
-
- final String operation = getOperation(methodName);
-
- Class type = loadClass(getInterface(stub.getClass().getName()));
- if (type == null)
- type = (ejbInterface != null) ? ejbInterface : EJBObject.class;
-
- ServantObject so = stub._servant_preinvoke(operation, type);
- if (so == null) {
- // The Servant is not local any more
- return invokeRemoteCORBACall(stub, methodName, args);
- }
- Object[] newArgs = null;
- ORB orb = stub._orb();
- try {
- if (args != null)
- newArgs = Util.copyObjects(args, orb);
- JavaReflectionAdapter reflectionAdapter =
- JavaReflectionAdapter.createJavaReflectionAdapter(so.servant.getClass());
- Method method = reflectionAdapter.getMethod(methodName);
- Object obj = reflectionAdapter.invoke(method, so.servant, newArgs);
- Object result = Util.copyObject(obj, orb);
- return result;
-
- } catch (InvocationTargetException e) {
- Throwable exCopy = (Throwable)Util.copyObject(e.getTargetException(), orb);
- MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
- String[] exceptionTypes = methodInfo.getExceptionTypes();
- for (int i = 0; i < exceptionTypes.length; i++) {
- Class exceptionType =
- methodInfo.getMethod() != null ? methodInfo.getMethod().getExceptionTypes()[i]
- : loadClass(exceptionTypes[i]);
- if (exceptionType.isAssignableFrom(exCopy.getClass()))
- throw new ServiceRuntimeException(exCopy); // FIXME should
- // be business
- // exception?
- }
- throw Util.wrapException(exCopy);
- } catch (Throwable e) {
- // Other exceptions thrown from "invoke"
- throw new ServiceRuntimeException(e);
- } finally {
- stub._servant_postinvoke(so);
- }
- }
-
- /**
- * Invoke a method on a remote CORBA object
- *
- * @param stub The remote stub
- * @param methodName The name of the method
- * @param args Argument list
- * @return
- * @throws RemoteException
- * @throws ServiceBusinessException
- */
- private Object invokeRemoteCORBACall(ObjectImpl stub, String methodName, Object[] args) throws RemoteException {
-
- try {
- String operation = getOperation(methodName);
-
- MethodInfo methodInfo = interfaceInfo.getMethod(methodName);
- if (methodInfo == null) {
- throw new ServiceRuntimeException("Invalid Method " + methodName);
- }
- Class[] parameterTypes = null;
- Class returnType = null;
- if (methodInfo.getMethod() != null) {
- parameterTypes = methodInfo.getMethod().getParameterTypes();
- returnType = methodInfo.getMethod().getReturnType();
- } else {
- String[] types = methodInfo.getParameterTypes();
- if (args != null) {
- if (types.length != args.length)
- throw new ServiceRuntimeException(
- "The argument list doesn't match the method signature of " + methodName);
- }
-
- parameterTypes = new Class[types.length];
- for (int i = 0; i < types.length; i++) {
- parameterTypes[i] = loadClass(types[i]);
- }
- returnType = loadClass(methodInfo.getReturnType());
- }
-
- InputStream in = null;
- try {
- OutputStream out = (OutputStream)stub._request(operation, true);
-
- for (int i = 0; i < parameterTypes.length; i++) {
- // Object arg = (args.length < i) ? null : args[i];
- writeValue(out, args[i], parameterTypes[i]);
- }
- if (returnType == void.class) {
- // void return
- stub._invoke(out);
- return null;
- } else {
- // read the return value
- in = (InputStream)stub._invoke(out);
- Object response = readValue(in, returnType);
- return response;
- }
-
- } catch (ApplicationException ex) {
- in = (InputStream)ex.getInputStream();
- try {
- org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.throwException(methodInfo.getMethod(), in);
- return null;
- } catch (Throwable e) {
- throw new RemoteException(e.getMessage(), e);
- }
- } catch (RemarshalException ex) {
- return invokeRemoteCORBACall(stub, methodName, args);
- } finally {
- stub._releaseReply(in);
- }
- } catch (SystemException ex) {
- throw Util.mapSystemException(ex);
- }
- }
-
- /**
- * @param out
- * @param value
- * @param type
- */
- private void writeValue(OutputStream out, Object value, Class type) {
- org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.writeObject(type, value, out);
- }
-
- /**
- * @param in
- * @param type
- * @return
- */
- private Object readValue(InputStream in, Class type) {
- return org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil.readObject(type, in);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java
deleted file mode 100644
index 0b97f42746..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBLocator.java
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.omg.CORBA.ORB;
-import org.omg.CosNaming.NamingContextExt;
-
-/**
- * CosNaming utility
- *
- * @version $Rev$ $Date$
- */
-class EJBLocator {
-
- /*
- * Root Context Initial Reference Key ------------
- * ----------------------------------- Server Root NameServiceServerRoot
- * Cell Persistent Root NameServiceCellPersistentRoot Cell Root
- * NameServiceCellRoot, NameService Node Root NameServiceNodeRoot
- */
- public static final String SERVER_ROOT = "NameServiceServerRoot";
- public static final String CELL_PERSISTENT_ROOT = "NameServiceCellPersistentRoot";
- public static final String CELL_ROOT = "NameServiceCellRoot";
- public static final String NODE_ROOT = "NameServiceNodeRoot";
- public static final String DEFAULT_ROOT = "NameService"; // Same as
- // CELL_ROOT
-
- public static final String DEFAULT_HOST = "127.0.0.1"; // Default host name
- // or IP address for
- // WebSphere
- public static final int DEFAULT_NAMING_PORT = 2809; // Default port
- public static final String NAMING_SERVICE = "NameService"; // The name of
- // the naming
- // service
- private static final Set<String> ROOTS =
- new HashSet<String>(Arrays.asList(new String[] {SERVER_ROOT, CELL_PERSISTENT_ROOT, CELL_ROOT, DEFAULT_ROOT,
- NODE_ROOT}));
-
- // private static final String CHARS_TO_ESCAPE = "\\/.";
- private static final String RFC2396 =
- "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789;/:?@&=+$,-_.!~*'()";
- private static final String HEX = "0123456789ABCDEF";
-
- private String hostName = DEFAULT_HOST;
- private int port = DEFAULT_NAMING_PORT;
- private String root = SERVER_ROOT;
-
- private ORB orb = null;
- private ObjectLocator locator = null;
- private boolean managed = true;
-
- EJBLocator(boolean managed) {
- this.managed = managed;
- if (!managed) {
- String url = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty(Context.PROVIDER_URL);
- }
- });
- processCorbaURL(url);
- }
- }
-
- EJBLocator(String hostName, int port) {
- this.hostName = (hostName == null) ? DEFAULT_HOST : hostName;
- this.port = port > 0 ? port : DEFAULT_NAMING_PORT;
- this.root = SERVER_ROOT;
- }
-
- EJBLocator(String hostName, int port, String root) {
- this(hostName, port);
- if (ROOTS.contains(root)) {
- this.root = root;
- } else {
- throw new IllegalArgumentException(root + " is not a legal root");
- }
- }
-
- EJBLocator(String corbaName, boolean managed) {
- this.managed = managed;
- if (corbaName.startsWith("corbaname:iiop:")) {
- processCorbaURL(corbaName);
- } else {
- throw new IllegalArgumentException(corbaName + " is not a legal corbaname");
- }
- }
-
- private void processCorbaURL(String url) {
- if (url != null && (url.startsWith("corbaname:iiop:") || url.startsWith("corbaloc:iiop:"))) {
- /**
- * corbaname:iiop:<hostName>:<port>/<root>#name corbaloc:iiop:<hostname>:<port>/<root>
- * For example,
- * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome";
- * or "corbaloc:iiop:myhost:2809/NameServiceServerRoot"
- */
- String[] parts = url.split("(:|/|#)");
- if (parts.length > 2 && parts[2].length() > 0) {
- hostName = parts[2]; // The host name
- int index = hostName.lastIndexOf('@'); // version@hostname
- if (index != -1) {
- hostName = hostName.substring(index + 1);
- }
- }
- if (parts.length > 3 && parts[3].length() > 0) {
- port = Integer.parseInt(parts[3]); // The port number
- }
- if (parts.length > 4 && parts[4].length() > 0) {
- root = parts[4]; // The root of naming
- }
- }
- }
-
- /**
- * The corbaloc and corbaname formats enable you to provide a URL to access
- * CORBA objects. Use the corbaloc format for resolving to a particular
- * CORBAservice without going through a naming service. Use the corbaname
- * format to resolve a stringified name from a specific naming context.
- */
-
- /**
- * corbaname Syntax The full corbaname BNF is: &lt;corbaname&gt; =
- * "corbaname:"&lt;corbaloc_obj&gt;["#"&lt;string_name&gt;]
- * &lt;corbaloc_obj&gt; = &lt;obj_addr_list&gt; ["/"&lt;key_string&gt;]
- * &lt;obj_addr_list&gt; = as defined in a corbaloc URL &lt;key_string&gt; =
- * as defined in a corbaloc URL &lt;string_name&gt;= stringified Name
- * empty_string Where:
- * <ul>
- * <li>corbaloc_obj: portion of a corbaname URL that identifies the naming
- * context. The syntax is identical to its use in a corbaloc URL.
- * <li>obj_addr_list: as defined in a corbaloc URL
- * <li>key_string: as defined in a corbaloc URL.
- * <li>string_name: a stringified Name with URL escapes as defined below.
- * </ul>
- *
- * @param hostName The host name or IP address of the naming server
- * @param port The port number of the naming service
- * @param root The root of the namespace
- * @param name The JNDI name
- */
- private static String getCorbaname(String hostName, int port, String root, String name) {
- if (name == null) {
- return "corbaname:iiop:" + hostName + ":" + port + "/" + root;
- } else {
- return "corbaname:iiop:" + hostName + ":" + port + "/" + root + "#" + toCorbaname(name);
- }
- }
-
- String getCorbaname(String name) {
- return getCorbaname(hostName, port, root, name);
- }
-
- /**
- * Connect to the ORB.
- */
-
- // FIXME. May need to change the IBM classes if this binding is contributed
- // to Tuscany
- public ORB connect() {
- if (orb == null) {
- Properties props = new Properties();
- /*
- * This code is for IBM JVM props.put("org.omg.CORBA.ORBClass",
- * "com.ibm.CORBA.iiop.ORB");
- * props.put("com.ibm.CORBA.ORBInitRef.NameService",
- * getCorbaloc(NAMING_SERVICE));
- * props.put("com.ibm.CORBA.ORBInitRef.NameServiceServerRoot",
- * getCorbaloc("NameServiceServerRoot"));
- */
- orb = ORB.init((String[])null, props);
- }
- return orb;
- }
-
- /**
- * Replace substrings
- *
- * @param source The source string.
- * @param match The string to search for within the source string.
- * @param replace The replacement for any matching components.
- * @return
- */
- private static String replace(String source, String match, String replace) {
- int index = source.indexOf(match, 0);
- if (index >= 0) {
-
- // We have at least one match, so got to do the
- // work...
-
- StringBuffer result = new StringBuffer(source.length() + 16);
- int matchLength = match.length();
- int startIndex = 0;
-
- while (index >= 0) {
- result.append(source.substring(startIndex, index));
- result.append(replace);
- startIndex = index + matchLength;
- index = source.indexOf(match, startIndex);
- }
-
- // Grab the last piece, if any...
- if (startIndex < source.length()) {
- result.append(source.substring(startIndex));
- }
-
- return result.toString();
-
- } else {
- // No matches, just return the source...
- return source;
- }
- }
-
- /**
- * Resolved the JNDI name from the initial CosNaming context
- *
- * @param jndiName
- * @return resolved CORBA object
- * @throws NamingException
- */
- private static org.omg.CORBA.Object resovleString(NamingContextExt initCtx, String jndiName) throws NamingException {
- try {
- String name = stringify(jndiName);
- return initCtx.resolve_str(name);
- } catch (Exception e) {
- NamingException ne = new NamingException(e.getMessage());
- ne.setRootCause(e);
- throw ne;
- }
- }
-
- /**
- * Look up a CORBA object by its JNDI name
- *
- * @param jndiName
- * @return
- * @throws NamingException
- */
- org.omg.CORBA.Object stringToObject(String jndiName) throws NamingException {
- /*
- * Using an existing ORB and invoking string_to_object with a CORBA
- * object URL with multiple name server addresses to get an initial
- * context CORBA object URLs can contain more than one bootstrap server
- * address. Use this feature when attempting to obtain an initial
- * context from a server cluster. You can specify the bootstrap server
- * addresses for all servers in the cluster in the URL. The operation
- * will succeed if at least one of the servers is running, eliminating a
- * single point of failure. There is no guarantee of any particular
- * order in which the address list will be processed. For example, the
- * second bootstrap server address may be used to obtain the initial
- * context even though the first bootstrap server in the list is
- * available. An example of a corbaloc URL with multiple addresses
- * follows. obj =
- * orb.string_to_object("corbaloc::myhost1:9810,:myhost1:9811,:myhost2:9810/NameService");
- */
- String corbaName = null;
- if (jndiName.startsWith("corbaloc:") || jndiName.startsWith("corbaname:")) {
- // Keep the qualified URL
- corbaName = jndiName;
- } else {
- // Create a corbaname URL
- corbaName = getCorbaname(jndiName);
- }
-
- connect();
- org.omg.CORBA.Object obj = orb.string_to_object(corbaName);
- return obj;
- }
-
- private boolean isJndiConfigured() {
- if (managed)
- return true;
- Boolean provided = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- String initCtxFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
- if (initCtxFactory == null) {
- URL file = Thread.currentThread().getContextClassLoader().getResource("jndi.properties");
- if (file != null) {
- return Boolean.TRUE;
- } else {
- return Boolean.FALSE;
- }
- } else {
- return Boolean.TRUE;
- }
- }
- });
- return provided.booleanValue();
- }
-
- /**
- * The character escape rules for the stringified name portion of an
- * corbaname are: US-ASCII alphanumeric characters are not escaped.
- * Characters outside this range are escaped, except for the following: ; / : ? @ & = + $ , - _ . ! ~ * ' ( )
- * corbaname Escape Mechanism The percent '%' character is used as an
- * escape. If a character that requires escaping is present in a name
- * component it is encoded as two hexadecimal digits following a "%"
- * character to represent the octet. (The first hexadecimal character
- * represent the highorder nibble of the octet, the second hexadecimal
- * character represents the low-order nibble.) If a '%' is not followed by
- * two hex digits, the stringified name is syntactically invalid.
- * @param s
- * @return RFC2396-encoded stringified name
- */
- static String encode2396(String s) {
- if (s == null) {
- return null;
- }
- StringBuffer encoded = new StringBuffer(s);
- for (int i = 0; i < encoded.length(); i++) {
- char c = encoded.charAt(i);
- if (RFC2396.indexOf(c) == -1) {
- encoded.setCharAt(i, '%');
- char[] ac = Integer.toHexString(c).toCharArray();
- if (ac.length == 2) {
- encoded.insert(i + 1, ac);
- } else if (ac.length == 1) {
- encoded.insert(i + 1, '0');
- encoded.insert(i + 2, ac[0]);
- } else {
- throw new IllegalArgumentException("Invalid character '" + c + "' in \"" + s + "\"");
- }
- i += 2; // NOPMD
- }
- }
- return encoded.toString();
- }
-
- /**
- * Decode an RFC2396-encoded string
- *
- * @param s
- * @return Plain string
- */
- static String decode2396(String s) {
- if (s == null) {
- return null;
- }
- StringBuffer decoded = new StringBuffer(s);
- for (int i = 0; i < decoded.length(); i++) {
- char c = decoded.charAt(i);
- if (c == '%') {
- if (i + 2 >= decoded.length()) {
- throw new IllegalArgumentException("Incomplete key_string escape sequence");
- }
- int j;
- j = HEX.indexOf(decoded.charAt(i + 1)) * 16 + HEX.indexOf(decoded.charAt(i + 2));
- decoded.setCharAt(i, (char)j);
- decoded.delete(i + 1, i + 3);
- } else if (RFC2396.indexOf(c) == -1) {
- throw new IllegalArgumentException("Invalid key_string character '" + c + "'");
- }
- }
- return decoded.toString();
- }
-
- /**
- * The backslash '\' character escapes the reserved meaning of '/', '.', and
- * '\' in a stringified name.
- *
- * @param jndiName
- * @return Escaped stringified name for CosNaming
- */
- private static String stringify(String jndiName) {
- // Escape . into \. since it's an INS naming delimiter
- return replace(encode2396(jndiName), ".", "\\.");
- }
-
- /**
- * Escape the "." into "%5C%2E"
- *
- * @param jndiName
- * @return corbaname treating "." as a literal
- */
- private static String toCorbaname(String jndiName) {
- // Escape . into %5C%2E (\.) since it's an INS naming delimiter
- // For example, sca.sample.StockQuote --->
- // sca%5C%2Esample%5C%2EStockQuote/StockQuote
- return replace(encode2396(jndiName), ".", "%5C%2E");
- }
-
- private ObjectLocator getObjectLocator() throws NamingException {
- if (locator != null) {
- return locator;
- }
- /*
- * For managed env, JNDI is assumed to be configured by default For
- * unmanaged environment, JNDI could have configured through
- * jndi.properties file
- */
- if (isJndiConfigured()) {
- locator = new JndiLocator();
- } else { // this is definitely JSE env without JNDI configured. Use
- // CORBA.
- locator = new CosNamingLocator();
- }
- return locator;
- }
-
- public Object locate(String jndiName) throws NamingException {
-
- Object result = getObjectLocator().locate(jndiName);
- return result;
- }
-
- private static interface ObjectLocator {
- Object locate(String name) throws NamingException;
- }
-
- private final class JndiLocator implements ObjectLocator {
- private Context context;
-
- private JndiLocator() throws NamingException {
- /*
- final Properties props = AccessController.doPrivileged(new PrivilegedAction<Properties>() {
- public Properties run() {
- return System.getProperties();
- }
- });
- Properties properties = new Properties();
- for (Map.Entry e : props.entrySet()) {
- String name = (String)e.getKey();
- if (name.startsWith("java.naming.")) {
- properties.setProperty(name, (String)e.getValue());
- }
- }
- // System.out.println(properties);
- this.context = new InitialContext(properties);
- */
- this.context = new InitialContext();
- }
-
- public Object locate(String name) throws NamingException {
- return context.lookup(name);
- }
- }
-
- private final class CosNamingLocator implements ObjectLocator {
- private NamingContextExt context;
-
- private CosNamingLocator() {
- }
-
- public Object locate(String name) throws NamingException {
- if (context != null) {
- return resovleString(context, name);
- } else {
- return stringToObject(name);
- }
- }
- }
-
- public void setHostEnv(boolean managed) {
- this.managed = managed;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java
deleted file mode 100644
index d34cfe1b16..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBObjectFactory.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.rmi.UnexpectedException;
-
-import javax.ejb.CreateException;
-import javax.ejb.EJBLocalHome;
-import javax.naming.NamingException;
-import javax.rmi.CORBA.Util;
-
-import org.omg.CORBA.SystemException;
-import org.omg.CORBA.portable.ApplicationException;
-import org.omg.CORBA.portable.ObjectImpl;
-import org.omg.CORBA.portable.RemarshalException;
-import org.omg.stub.java.rmi._Remote_Stub;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Factor class that is used to create EJB Proxies.
- *
- * @version $Rev$ $Date$
- */
-final class EJBObjectFactory {
-
- private EJBObjectFactory() {
- }
-
- /**
- * Get either a generated of dynamic EJB stub using the specified JNDI
- * properties.
- * <p>
- * The returned stub will implement the specified stubInterface Interface.
- * If the underlying EJB stub is not assignable from the specified
- * stubInterface then a proxy is used to convert between the two.
- * <p>
- * The returned EJB stub may be either the pregenerated EJB stub or a
- * dynamic stub. This allows a client to invoke an EJB without requiring any
- * of the pregenerated EJB stub classes be available in the classpath.
- * <p>
- */
- static Object createStub(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) throws NamingException,
- RemoteException, CreateException {
-
- EJBLocator locator = namingEndpoint.getLocator();
- Object homeObject = locator.locate(namingEndpoint.getJndiName());
- /*
- * The type of the object returned from the lookup is as follows: If the
- * generated stub exists on the classpath, it's an instance of that
- * type, otherwise, "org.omg.stub.java.rmi._Remote_Stub" or
- * "org.omg.stub.javax.ejb._EJBHome_Stub"
- */
- Object stub = getEJBStub(homeObject, ejbInterface);
- // Cache dynamic stub only
- return stub;
- }
-
- /**
- * @param homeObject
- * @param ejbHomeClass
- * @return
- * @throws RemoteException
- */
- private static Object getEJBStub(Object homeObject, InterfaceInfo ejbInterface) throws RemoteException,
- CreateException {
-
- Object stub = null;
-
- // Get the business interface of the EJB
- Class ejbInterfaceClass = null;
- try {
- ejbInterfaceClass = Thread.currentThread().getContextClassLoader().loadClass(ejbInterface.getName());
- } catch (ClassNotFoundException e) {
- // ignore
- }
-
- if (ejbInterfaceClass != null && ejbInterfaceClass.isInstance(homeObject)) {
- // EJB 3
- stub = homeObject;
- } else if (homeObject instanceof EJBLocalHome) {
- // Local EJB
- stub = createEJBLocalObject(homeObject);
- } else {
- // Handle dynamic stub
- if (homeObject instanceof ObjectImpl) {
- ObjectImpl objectImpl = (ObjectImpl)homeObject;
- stub = createEJBObject(objectImpl);
- }/**
- * Above checks will be satisfied if Bean is running on servers like WebSphere. With this
- * logic, client (SCA composite with EJB ref binding) doesn't need to include home class or
- * client stubs.
- *
- * Below check is needed SCA composite with EJB ref binding is accessing openEJB implementation.
- * For e.g if the bean is running on Geronimo.
- */
- else if ((javax.rmi.PortableRemoteObject.narrow(homeObject, javax.ejb.EJBHome.class)) instanceof javax.ejb.EJBHome) {
- stub = createEJBObjectFromHome(homeObject);
- } else
- throw new ServiceRuntimeException("Invalid stub type: " + homeObject.getClass());
- }
- return stub;
- }
-
- /**
- * Create a pre-generated EJB stub
- *
- * @param homeObject
- * @return
- * @throws RemoteException
- */
- static private Object createEJBLocalObject(Object homeObject) throws RemoteException {
-
- Object stub = null;
- try {
- // Find the "create()" method
- Method createMethod = homeObject.getClass().getMethod("create", null);
- // Create an EJB object
- stub = createMethod.invoke(homeObject, null);
- } catch (NoSuchMethodException e) {
- // "create()" method not found, it's still a dynamic stub
- stub = null;
- } catch (InvocationTargetException e) {
- throw new RemoteException(e.getTargetException().toString());
- } catch (Exception e) {
- throw new RemoteException(e.toString());
- }
- return stub;
- }
-
- /**
- * Here homeObject is instance of EJBHome
- *
- * @param homeObject
- * @return
- * @throws RemoteException
- */
- private static Object createEJBObjectFromHome(Object homeObject) throws RemoteException {
-
- Object stub = null;
- try {
- // Find the "create()" method
- Method createMethod = homeObject.getClass().getMethod("create", null);
- // Create an EJB object
- stub = createMethod.invoke(homeObject, null);
- } catch (NoSuchMethodException e) {
- // "create()" method not found, it's still a dynamic stub
- stub = null;
- } catch (InvocationTargetException e) {
- throw new RemoteException(e.getTargetException().toString());
- } catch (Exception e) {
- throw new RemoteException(e.toString());
- }
- return stub;
- }
-
- /**
- * Create an EJBObject using RMI/IIOP APIs
- *
- * @param ejbHomeObject
- * @return The EJBObject remote stub
- * @throws CreateException
- * @throws RemoteException
- */
- private static Object createEJBObject(ObjectImpl ejbHomeObject) throws CreateException, RemoteException {
-
- try {
- org.omg.CORBA_2_3.portable.InputStream in = null;
- try {
- org.omg.CORBA.portable.OutputStream out = ejbHomeObject._request("create", true);
- in = (org.omg.CORBA_2_3.portable.InputStream)ejbHomeObject._invoke(out);
- // The Remote stub should be available in JDK
- // TODO: [rfeng] Work around an issue in Apache Yoko which doesn't understand the org.omg.stub.*
- return in.read_Object(_Remote_Stub.class);
- } catch (ApplicationException ex) {
- in = (org.omg.CORBA_2_3.portable.InputStream)ex.getInputStream();
- String id = in.read_string();
- if (id.equals("IDL:javax/ejb/CreateEx:1.0")) {
- throw (CreateException)in.read_value(CreateException.class);
- }
- throw new UnexpectedException(id);
- } catch (RemarshalException ex) {
- return createEJBObject(ejbHomeObject);
- } finally {
- ejbHomeObject._releaseReply(in);
- }
- } catch (SystemException ex) {
- throw Util.mapSystemException(ex);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java
deleted file mode 100644
index b699a02d1d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/EJBStubHelper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.rmi.RemoteException;
-
-import javax.ejb.CreateException;
-import javax.naming.NamingException;
-
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.ServiceUnavailableException;
-
-final class EJBStubHelper {
-
- private static Object stub;
- private static ServiceRuntimeException exception;
-
- private EJBStubHelper() {
- }
-
- /**
- * @param owner
- * @param jndiName
- * @return
- */
-
- static Object lookup(NamingEndpoint endpoint, InterfaceInfo ejbInterface) {
- return getStub(endpoint, ejbInterface);
- }
-
- private static Object getStub(NamingEndpoint namingEndpoint, InterfaceInfo ejbInterface) {
- try {
- stub = EJBObjectFactory.createStub(namingEndpoint, ejbInterface);
- } catch (NamingException e) {
- exception = new ServiceUnavailableException(e);
- e.printStackTrace();
- throw (ServiceUnavailableException)exception;
- } catch (CreateException e) {
- exception = new ServiceUnavailableException(e);
- throw (ServiceUnavailableException)exception;
- } catch (RemoteException e) {
- exception = new ServiceRuntimeException(e);
- throw (ServiceRuntimeException)exception;
- }
-
- if (exception == null) {
- return stub; // Normal result
- } else {
- throw exception; // Throw the exception
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java
deleted file mode 100644
index e60e526e01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/InterfaceInfo.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.apache.tuscany.sca.binding.ejb.corba.Java2IDLUtil;
-
-/**
- * The signature for a java interface
- *
- * @version $Rev$ $Date$
- */
-class InterfaceInfo implements Serializable {
-
- private static final Map<Class, InterfaceInfo> INTERFACES =
- Collections.synchronizedMap(new WeakHashMap<Class, InterfaceInfo>());
-
- private static final long serialVersionUID = 2314533906465094860L;
- private String name;
-
- private Map<String, MethodInfo> methods = new HashMap<String, MethodInfo>();
-
- InterfaceInfo(final Class iface) {
- super();
- if (iface == null) {
- throw new IllegalArgumentException("The interface cannot be null");
- }
- this.name = iface.getName();
- // SECURITY
- /*
- * Permission: accessDeclaredMembers : Access denied
- * (java.lang.RuntimePermission accessDeclaredMembers)
- */
- Map idlNames = AccessController.doPrivileged(new PrivilegedAction<Map>() {
- public Map run() {
- return Java2IDLUtil.mapMethodToOperation(iface);
- }
- });
- Iterator i = idlNames.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry entry = (Map.Entry)i.next();
- Method method = (Method)entry.getKey();
- MethodInfo methodInfo = new MethodInfo(method);
- methodInfo.setIDLName((String) entry.getValue());
- methods.put(method.getName(), methodInfo);
- methods.put(methodInfo.getIDLName(), methodInfo);
- }
- }
-
- static final synchronized InterfaceInfo getInstance(final Class iface) {
- InterfaceInfo info = (InterfaceInfo)INTERFACES.get(iface);
- if (info == null) {
- info = new InterfaceInfo(iface);
- INTERFACES.put(iface, info);
- }
- return info;
- }
-
- /**
- * @return
- */
- Map<String, MethodInfo> getMethods() {
- return methods;
- }
-
- /**
- * @return
- */
- MethodInfo getMethod(String name) {
- return (MethodInfo)methods.get(name);
- }
-
- /**
- * @return
- */
- String getName() {
- return name;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("interface ").append(name).append("{ \n");
- Iterator i = methods.values().iterator();
- while (i.hasNext()) {
- MethodInfo methodInfo = (MethodInfo)i.next();
- sb.append("\t").append(methodInfo).append("\n");
- }
- sb.append("};\n");
- return sb.toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java
deleted file mode 100644
index 5e7d6761d9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/JavaReflectionAdapter.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * An adapter for java classes, indexes the methods by name and provides an
- * invoke method that takes a method name.
- *
- * @version $Rev$ $Date$
- */
-final class JavaReflectionAdapter {
-
- private static Map<Class, JavaReflectionAdapter> adapters =
- Collections.synchronizedMap(new WeakHashMap<Class, JavaReflectionAdapter>());
-
- private static final Map<Class, Object> DEFAULT_VALUES = new HashMap<Class, Object>();
- static {
- DEFAULT_VALUES.put(boolean.class, Boolean.FALSE);
- DEFAULT_VALUES.put(byte.class, new Byte((byte)0));
- DEFAULT_VALUES.put(char.class, new Character((char)0));
- DEFAULT_VALUES.put(short.class, new Short((short)0));
- DEFAULT_VALUES.put(int.class, Integer.valueOf(0));
- DEFAULT_VALUES.put(long.class, new Long(0));
- DEFAULT_VALUES.put(float.class, new Float(0.0));
- DEFAULT_VALUES.put(double.class, new Double(0.0));
- }
-
- private Map<String, Method> methodMap = new HashMap<String, Method>();
-
- /**
- * Constructor
- *
- * @param clazz
- */
- private JavaReflectionAdapter(final Class clazz) {
- // Index the methods on the implementation class
- // FIXME J2 Security - promote this to callers of this method
- Method[] methods = AccessController.doPrivileged(new PrivilegedAction<Method[]>() {
- public Method[] run() {
- return clazz.getMethods();
- }
- });
- for (int i = 0; i < methods.length; i++) {
- methodMap.put(methods[i].getName(), methods[i]);
- }
- }
-
- /**
- * Create a java reflection adapter
- *
- * @param clazz
- */
- static synchronized JavaReflectionAdapter createJavaReflectionAdapter(Class clazz) {
- JavaReflectionAdapter adapter = (JavaReflectionAdapter)adapters.get(clazz);
- if (adapter == null) {
- adapter = new JavaReflectionAdapter(clazz);
- adapters.put(clazz, adapter);
- }
- return adapter;
- }
-
- /**
- * Return the specified method
- *
- * @param methodName
- * @return
- * @throws NoSuchMethodException
- */
- Method getMethod(String methodName) throws NoSuchMethodException {
-
- Method method = (Method)methodMap.get(methodName);
- if (method == null) {
- throw new NoSuchMethodException(methodName);
- }
- return method;
- }
-
- /**
- * Returns a map containing the methods on the class, keyed by name
- *
- * @return
- */
- Map getMethods() {
- return methodMap;
- }
-
- /**
- * Invoke a method using Java reflection.
- *
- * @param method
- * @param object
- * @param args
- * @return
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- */
- Object invoke(Method method, Object object, Object[] args) throws InvocationTargetException,
- IllegalAccessException {
- Class[] parameterTypes = method.getParameterTypes();
- for (int i = 0; i < parameterTypes.length; i++) {
- Class parameterType = parameterTypes[i];
- if (args[i] == null && parameterType.isPrimitive()) {
- args[i] = DEFAULT_VALUES.get(parameterType);
- }
- }
- return method.invoke(object, args);
- }
-
- /**
- * Set the java bean property
- *
- * @param bean
- * @param propertyName
- * @param value
- * @return
- */
- boolean setProperty(Object bean, String propertyName, Object value) {
- try {
- PropertyDescriptor propertyDescriptor = new PropertyDescriptor(propertyName, bean.getClass());
- Method writeMethod = propertyDescriptor.getWriteMethod();
- writeMethod.invoke(bean, new Object[] {value});
- return true;
- } catch (InvocationTargetException e) {
- throw new ServiceRuntimeException(e.getTargetException());
- } catch (Exception e) {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java
deleted file mode 100644
index e7ea7c9077..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/MethodInfo.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * MetaData for a java method
- *
- * @version $Rev$ $Date$
- */
-class MethodInfo implements Serializable {
-
- /** Automatically generated javadoc for: serialVersionUID */
- private static final long serialVersionUID = -5557260979514687514L;
- private String name;
- private String returnType;
- private String[] parameterTypes;
- private String[] exceptionTypes;
-
- private String IDLName;
-
- private transient Method method;
-
- /**
- * Type Signature Java Type -------------- --------- Z boolean B byte C char
- * S short I int J long F float D double L fully-qualified-class ;
- * fully-qualified-class [ type type[] ( arg-types ) ret-type method type
- */
- private static final Map signatures = new HashMap();
- static {
- signatures.put("Z", boolean.class);
- signatures.put("B", byte.class);
- signatures.put("C", char.class);
- signatures.put("S", short.class);
- signatures.put("I", int.class);
- signatures.put("J", long.class);
- signatures.put("F", float.class);
- signatures.put("D", double.class);
- signatures.put("V", void.class);
- }
-
- MethodInfo(Method method) {
- this.method = method;
- this.name = method.getName();
- // this.declaringClass = method.getDeclaringClass().getName();
- this.returnType = method.getReturnType().getName();
- Class[] types = method.getParameterTypes();
- this.parameterTypes = new String[types.length];
- for (int i = 0; i < types.length; i++) {
- this.parameterTypes[i] = types[i].getName();
- }
- types = method.getExceptionTypes();
- this.exceptionTypes = new String[types.length];
- for (int i = 0; i < types.length; i++) {
- this.exceptionTypes[i] = types[i].getName();
- }
- IDLName = this.name;
- }
-
- MethodInfo(String name, String returnType, String[] parameterTypes, String[] exceptionTypes) {
- this.name = name;
- this.returnType = returnType;
- this.parameterTypes = parameterTypes;
- this.exceptionTypes = exceptionTypes;
- this.IDLName = name;
- }
-
- /**
- * Parse the class name from the internal signature Sample signatures: int
- * ---> I; int[] ---> [I Object ---> java/lang/Object Object[] --->
- * [Ljava/lang/Object;
- *
- * @param value
- * @return
- */
- private static String getName(String signature) {
- String name = signature;
- // Remove leading ARRAY ([) signatures
- int index = name.lastIndexOf('[');
- if (index != -1)
- name = name.substring(index + 1);
-
- // Remove L<...>;
- if (name.charAt(0) == 'L' && name.charAt(name.length() - 1) == ';')
- name = name.substring(1, name.length() - 1);
-
- // Primitive types
- Class primitiveClass = (Class)signatures.get(name);
- if (primitiveClass != null) {
- name = primitiveClass.getName();
- }
-
- for (int i = 0; i < index + 1; i++) {
- name = name + "[]";
- }
- return name;
- }
-
- /**
- * @return
- */
- String getName() {
- return name;
- }
-
- /**
- * @return
- */
- String[] getParameterTypes() {
- return parameterTypes;
- }
-
- /**
- * @return
- */
- String getReturnType() {
- return returnType;
- }
-
- /**
- * @return
- */
- String[] getExceptionTypes() {
- return exceptionTypes;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(getName(returnType)).append(" ").append(name).append("(");
- for (int j = 0; j < parameterTypes.length; j++) {
- sb.append(getName(parameterTypes[j])).append(" ").append("arg" + j);
- if (j < (parameterTypes.length - 1))
- sb.append(", ");
- }
- sb.append(")");
- if (exceptionTypes.length > 0) {
- sb.append(" throws ");
- for (int k = 0; k < exceptionTypes.length; k++) {
- sb.append(exceptionTypes[k]);
- if (k < (exceptionTypes.length - 1))
- sb.append(", ");
- }
- }
- sb.append(";");
- return sb.toString();
- }
-
- /**
- * @return Returns the iDLName.
- */
- String getIDLName() {
- return IDLName;
- }
-
- /**
- * @param name The iDLName to set.
- */
- void setIDLName(String name) {
- IDLName = name;
- }
-
- /**
- * @return the method
- */
- Method getMethod() {
- return method;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java
deleted file mode 100644
index 346b7c5cf6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/java/org/apache/tuscany/sca/binding/ejb/util/NamingEndpoint.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.util;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-public class NamingEndpoint {
- private String jndiName;
- private EJBLocator locator;
- private boolean managed = true;
-
- public NamingEndpoint(String hostName, int port, String jndiName) {
- this.jndiName = jndiName;
- this.locator = new EJBLocator(hostName, port);
- }
-
- public NamingEndpoint(String name) {
-
- /**
- * by default it's a managed environment means SCA composite with ref
- * binding is running on an AppServer. If running on J2SE, pass
- * -Dmanaged=false for the VM
- */
- final String managedEnv = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty("managed");
- }
- });
-
- if (managedEnv != null) {
- managed = Boolean.valueOf(managedEnv);
- }
-
- if ((!managed) && name.startsWith("corbaname:iiop:")) {
- /**
- * if (name.startsWith("corbaname:iiop:")) { corbaname:iiop:<hostName>:<port>/<root>#name
- * For example,
- * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome";
- */
-
- String[] parts = split(name, '#');
- if (parts.length != 2) {
- throw new IllegalArgumentException("Invalid corbaname: " + name);
- }
-
- this.jndiName = name; // The logical JNDI name
- this.locator = new EJBLocator(parts[0], managed);
-
- } else {
- this.jndiName = name;
- this.locator = new EJBLocator(managed);
- }
-
- }
-
- private static String[] split(String str, char ch) {
- int index = str.lastIndexOf(ch);
- if (index == -1) {
- return new String[] {str, ""};
- } else {
- return new String[] {str.substring(0, index), str.substring(index + 1)};
- }
- }
-
- /**
- * @return Returns the jndiName.
- */
- public String getJndiName() {
- return jndiName;
- }
-
- public EJBLocator getLocator() {
- return locator;
- }
-
- public String getCorbaname() {
- return locator.getCorbaname(jndiName);
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof NamingEndpoint) {
- NamingEndpoint endpoint = (NamingEndpoint)obj;
- return jndiName.equals(endpoint.jndiName);
- }
- return false;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- return jndiName.hashCode();
- }
-
- /**
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return jndiName;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index a89f711da9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.ejb.provider.EJBBindingProviderFactory;model=org.apache.tuscany.sca.binding.ejb.EJBBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/binding-ejb-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/binding-ejb-validation-messages.properties
deleted file mode 100644
index 28477dd3ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/main/resources/binding-ejb-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-UnknownEJBSessionType = Unknown EJB Session Type of {0} for {1}
-UnknownEJBVersion = Unknown EJB Version of {0} for {1}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/BankManagerFacade.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/BankManagerFacade.java
deleted file mode 100644
index 28dafedaeb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/BankManagerFacade.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 account;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- *
- * Compatible EJB interface
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface BankManagerFacade {
- Double getAccountBalance( String accountNo );
- void changeAccountBalance( String accountNo, Double balance );
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/Customer.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/Customer.java
deleted file mode 100644
index 49ece71f7a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/Customer.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 account;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface Customer {
-
- /**
- * This method deposits the amount. method accesses external EJB to get the
- * current balance and add the amount to existing balance.
- *
- * @param accountNo The number of the account into which to deposit the money
- * @param amount The amount to be deposited
- * @return total amount in customer account after deposit
- */
- Double depositAmount(java.lang.String accountNo, Double amount);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java
deleted file mode 100644
index ed2b403f2d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/account/CustomerImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package account;
-
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-import calculator.AddServiceRemote;
-
-@Service(Customer.class)
-public class CustomerImpl implements Customer {
-
- private AddServiceRemote extEJBService = null;
-
- public AddServiceRemote getExtEJBService() {
- return extEJBService;
- }
-
- @Reference
- public void setExtEJBService(AddServiceRemote extEJBService) {
- this.extEJBService = extEJBService;
- }
-
- // this method invokes external EJB through EJB reference binding
- public Double depositAmount(java.lang.String accountNo, Double amount) {
-
- Double total = null;
-
- System.out.println("In component implementation. Invoking external EJB through EJB reference binding ");
-
- try {
- Double balance = extEJBService.add(amount.doubleValue(), 1000); //invoke external ejb through ejb reference binding
- total = balance + amount;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return total;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java
deleted file mode 100644
index b0d1c8f6e5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/calculator/AddServiceRemote.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import javax.ejb.Remote;
-
-@Remote
-public interface AddServiceRemote {
- double add(double n1, double n2);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.java
deleted file mode 100644
index e480e648d9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacade.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.
- */
-
-/*
- * Generated by XDoclet - Do not edit!
- */
-package org.apache.geronimo.samples.bank.ejb;
-
-// copied from the Geronimo Bank sample: http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html#EJBsampleapplication-overview
-
-/**
- * Remote interface for BankManagerFacadeBean.
- * @xdoclet-generated at ${TODAY}
- * @copyright The XDoclet Team
- *
- * @version $Rev$ $Date$
- */
-public interface BankManagerFacade
- extends javax.ejb.EJBObject
-{
-
- void changeAccountBalance( java.lang.String accountNo,java.lang.Double balance )
- throws java.rmi.RemoteException;
-
- java.lang.Double getAccountBalance( java.lang.String accountNo )
- throws java.rmi.RemoteException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.java
deleted file mode 100644
index 0d02be3b95..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/geronimo/samples/bank/ejb/BankManagerFacadeHome.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.
- */
-
-/*
- * Generated by XDoclet - Do not edit!
- */
-
-// copied from the Geronimo Bank sample: http://cwiki.apache.org/GMOxDOC11/ejb-sample-application.html#EJBsampleapplication-overview
-
-package org.apache.geronimo.samples.bank.ejb;
-
-/**
- * Home interface for BankManagerFacadeBean.
- * @xdoclet-generated at ${TODAY}
- * @copyright The XDoclet Team
- *
- * @version $Rev$ $Date$
- */
-public interface BankManagerFacadeHome
- extends javax.ejb.EJBHome
-{
- String COMP_NAME="java:comp/env/ejb/BankManagerFacadeBean";
- String JNDI_NAME="org.apache.geronimo.samples.bank.ejb.BankManagerFacadeBean";
-
- org.apache.geronimo.samples.bank.ejb.BankManagerFacade create()
- throws javax.ejb.CreateException,java.rmi.RemoteException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.java
deleted file mode 100644
index 83bf9c8673..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/EJBReferenceTestCase.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.binding.ejb.tests;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import account.Customer;
-
-/**
- * Invokes the component which calls the reference using the EJB binding
- *
- * @version $Rev$ $Date$
- */
-public class EJBReferenceTestCase {
- private static final int MOCK_PORT = 8085;
- private SCADomain scaDomain;
-
- @Before
- public void setUp() throws Exception {
- System.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
- System.setProperty("java.naming.provider.url", "ejbd://localhost:" + MOCK_PORT);
- System.setProperty("managed", "false");
-
- scaDomain = SCADomain.newInstance("account/account.composite");
-
- // To capture the network traffic for the MockServer, uncomment the next two lines (A) and comment out B
- // int OPENEJB_PORT = 4201; // A
- // new Thread(new SocketTracer(MOCK_PORT, OPENEJB_PORT)).start(); // A
-
- // Start the mock server to simulate the remote EJB
- new Thread(new MockServer(MOCK_PORT)).start(); // B
-
- // Wait enough for the server to be started
- Thread.sleep(500);
- }
-
- @After
- public void tearDown() throws Exception {
- scaDomain.close();
- }
-
- @Test
- public void testCalculator() throws Exception {
- Customer customer = scaDomain.getService(Customer.class, "CustomerComponent");
- // This is one of the customer numbers in bank application running on Geronimo
- String accountNo = "1234567890";
- Double balance = customer.depositAmount(accountNo, new Double(100));
- // System.out.println("Balance amount for account " + accountNo + " is $" + balance);
- Assert.assertEquals(1200.0, balance, 0.0);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java
deleted file mode 100644
index e0cce4bae6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/MockServer.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ejb.tests;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-public class MockServer implements Runnable {
-
- private int listen;
- byte[][] seq =
- {
- {79, 69, 74, 80, 47, 51, 46, 48, 1, -84, -19, 0, 5, 119, 21, 1, 27, 0, 17, 47, 65, 100, 100, 83, 101, 114,
- 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 112, 119, 4, -63, -5, 13, 59},
- {79, 69, 74, 80, 47, 51, 46, 48, -84, -19, 0, 5, 119, 3, 1, 0, 21, 115, 114, 0, 41, 111, 114, 103, 46, 97,
- 112, 97, 99, 104, 101, 46, 111, 112, 101, 110, 101, 106, 98, 46, 99, 108, 105, 101, 110, 116, 46, 69, 74, 66,
- 77, 101, 116, 97, 68, 97, 116, 97, 73, 109, 112, 108, 29, -120, -127, 52, 16, -56, 15, 77, 12, 0, 0, 120,
- 112, 119, 1, 1, 112, 112, 112, 112, 119, 28, 7, 0, 21, 67, 97, 108, 99, 117, 108, 97, 116, 111, 114, 47, 65,
- 100, 100, 83, 101, 114, 118, 105, 99, 101, -1, -1, 0, 1, 118, 114, 0, 27, 99, 97, 108, 99, 117, 108, 97, 116,
- 111, 114, 46, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 120, 112, 112, 120},
- {79, 69, 74, 80, 47, 51, 46, 48, 0, -84, -19, 0, 5, 119, 1, 23, 116, 0, 21, 67, 97, 108, 99, 117, 108, 97,
- 116, 111, 114, 47, 65, 100, 100, 83, 101, 114, 118, 105, 99, 101, 119, 2, -1, -1, 112, 119, 5, -63, -5, 13,
- 59, 1, 112, 118, 114, 0, 27, 99, 97, 108, 99, 117, 108, 97, 116, 111, 114, 46, 65, 100, 100, 83, 101, 114,
- 118, 105, 99, 101, 82, 101, 109, 111, 116, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 112, 119, 24, 0, 3, 97,
- 100, 100, 2, 4, 64, 89, 0, 0, 0, 0, 0, 0, 4, 64, -113, 64, 0, 0, 0, 0, 0},
- {79, 69, 74, 80, 47, 51, 46, 48, -84, -19, 0, 5, 119, 3, 1, 0, 4, 115, 114, 0, 16, 106, 97, 118, 97, 46, 108,
- 97, 110, 103, 46, 68, 111, 117, 98, 108, 101, -128, -77, -62, 74, 41, 107, -5, 4, 2, 0, 1, 68, 0, 5, 118, 97,
- 108, 117, 101, 120, 114, 0, 16, 106, 97, 118, 97, 46, 108, 97, 110, 103, 46, 78, 117, 109, 98, 101, 114,
- -122, -84, -107, 29, 11, -108, -32, -117, 2, 0, 0, 120, 112, 64, -111, 48, 0, 0, 0, 0, 0}
- };
-
- public MockServer(int listen) {
- this.listen = listen;
- }
-
- public void run() {
- try {
- ServerSocket ss = new ServerSocket(listen);
- for (int i = 0; i < seq.length; i += 2) {
- // System.out.println("Processing request[" + i/2 + "]");
- doExchange(ss.accept(), seq[i], seq[i + 1]);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void doExchange(Socket socket, byte[] read, byte[] write) throws IOException, InterruptedException {
- Thread t2 = readBytes(socket, read.length);
- Thread t1 = writeBytes(socket, write);
- t1.join();
- t2.join();
- socket.close();
- }
-
- private Thread readBytes(Socket socket, int x) throws IOException, InterruptedException {
- byte[] buf = new byte[x];
- Thread t = new Reader(socket, buf);
- t.start();
- return t;
- }
-
- private Thread writeBytes(Socket socket, byte[] bs) throws IOException, InterruptedException {
- Thread t = new Writer(socket, bs);
- t.start();
- return t;
- }
-
- private static class Reader extends Thread {
-
- private InputStream is;
- private byte[] buf;
-
- Reader(Socket socket, byte[] buf) throws IOException {
- this.is = socket.getInputStream();
- this.buf = buf;
- }
-
- @Override
- public void run() {
- try {
- int totalSize = buf.length;
- int readSize = 0;
- int offset = 0;
- while (totalSize > 0 && (readSize = is.read(buf, offset, totalSize)) != -1) {
- offset += readSize;
- totalSize -= readSize;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
- private static class Writer extends Thread {
-
- private OutputStream os;
- private byte[] buf;
-
- Writer(Socket socket, byte[] buf) throws IOException {
- this.os = socket.getOutputStream();
- this.buf = buf;
- }
-
- @Override
- public void run() {
- try {
- os.write(buf);
- os.flush();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java
deleted file mode 100644
index 66b3feb458..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/java/org/apache/tuscany/sca/binding/ejb/tests/SocketTracer.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ejb.tests;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-
-/**
- * Displays the bytes flowing across a Socket connection.
- * Used to get the read count and reply data for the MockServer
- *
- * @version $Rev$ $Date$
- */
-public class SocketTracer implements Runnable {
-
- private int listen;
- private int send;
-
- SocketTracer(int listen, int send) {
- this.listen = listen;
- this.send = send;
- }
-
- public void run() {
- try {
- ServerSocket ss = new ServerSocket(listen);
- while (true) {
- Socket sin = ss.accept();
-
- Socket sout = new Socket("localhost", send);
-
- Thread st = new Thread(new Send(sin, sout));
- st.start();
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * @param buf
- * @param count
- */
- static synchronized void dump(String str, byte[] buf, int count) {
- // System.out.println(Thread.currentThread());
- System.out.print(str+"{");
- for (int j = 0; j < count; j++) {
- if (j == count - 1) {
- System.out.println(buf[j] + "}, ");
- } else {
- System.out.print(buf[j] + ", ");
- }
- }
- }
-}
-
-
-class Send implements Runnable {
-
- Socket sin;
- Socket sout;
-
- Send(Socket sin, Socket sout) {
- this.sin = sin;
- this.sout = sout;
- }
-
- public void run() {
- try {
-
- Reply rr = new Reply(sout.getInputStream(), sin.getOutputStream());
- Thread rt = new Thread(rr);
- rt.start();
-
- OutputStream outout = sout.getOutputStream();
- InputStream is = sin.getInputStream();
- byte[] buf = new byte[4096];
- int i = 0;
- int count = 0;
- while ((i = is.read()) != -1) {
- buf[count++] = (byte)i;
- outout.write(i);
- }
- SocketTracer.dump("Req: ", buf, count);
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
-
-class Reply implements Runnable {
-
- InputStream is;
- OutputStream outout;
-
- Reply(InputStream is, OutputStream outout) {
- this.is = is;
- this.outout = outout;
- }
-
- public void run() {
- try {
- byte[] buf = new byte[4096];
- int i = 0;
- int count = 0;
- while ((i = is.read()) != -1) {
- buf[count++] = (byte)i;
- outout.write(i);
- }
- SocketTracer.dump("Res: ", buf, count);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/account/account.composite b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/account/account.composite
deleted file mode 100644
index 701b989659..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/account/account.composite
+++ /dev/null
@@ -1,35 +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" name="account">
-
- <!-- composite refrence with ejb binding. Modify host and port number in uri attribute based on where you have installed target ResumeBank EJB -->
-
- <component name="CustomerComponent">
- <implementation.java class="account.CustomerImpl" />
- <reference name="extEJBService">
- <!-- To use the CosNaming, use the following URI -->
- <!--
- <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#AddServiceBean" />
- -->
- <binding.ejb uri="AddServiceRemote" />
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar b/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar
deleted file mode 100644
index d9afb9027f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb-runtime/src/test/resources/calculator-ejb/calculator-ejb.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/LICENSE b/branches/sca-java-1.5.1/modules/binding-ejb/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/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-java-1.5.1/modules/binding-ejb/NOTICE b/branches/sca-java-1.5.1/modules/binding-ejb/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/pom.xml b/branches/sca-java-1.5.1/modules/binding-ejb/pom.xml
deleted file mode 100644
index d5c970fd0d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/pom.xml
+++ /dev/null
@@ -1,91 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-ejb</artifactId>
- <name>Apache Tuscany SCA EJB Binding Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ejb</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ejb*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.java
deleted file mode 100644
index ae9d11d112..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBinding.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.binding.ejb;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * An implementation of EJBBinding.
- *
- * @version $Rev$ $Date$
- */
-public interface EJBBinding extends Binding, Extensible, Base {
- // Constants used when describing the EJB binding
- // model and for setting up defaults
- String BINDING_EJB = "binding.ejb";
- QName BINDING_EJB_QNAME = new QName(Constants.SCA10_NS, BINDING_EJB);
-
- // Constants for the XML describing the EJB Binding
- String HOME_INTERFACE = "homeInterface";
- String EJB_LINK_NAME = "ejb-link-name";
- String SESSION_TYPE = "session-type";
- String EJB_VERSION = "ejb-version";
- String NAME = "name";
- String POLICY_SETS = "policySets";
- String REQUIRES = "requires";
- String URI = "uri";
-
- // Enums for the EJB Binding
- enum EJBVersion {
- EJB2, EJB3
- };
-
- enum SessionType {
- STATEFUL, STATELESS
- };
-
- /**
- * Gets the homeInterface.
- *
- * @return home interface of the service binding
- */
- String getHomeInterface();
-
- /**
- * Set homeInterface
- *
- * @param homeInterface
- */
- void setHomeInterface(String homeInterface);
-
- /**
- * get ejb-link-name
- *
- * @return ejb-link-name
- */
- String getEjbLinkName();
-
- /**
- * Set ejb-link-name
- *
- * @param ejb-link-name
- */
- void setEjbLinkName(String ejbLinkName);
-
- SessionType getSessionType();
- void setSessionType(SessionType sessionType);
-
- EJBVersion getEjbVersion();
- void setEjbVersion(EJBVersion ejbVersion);
-
- // FIXME: Should use Intent instead of String
- String getRequires();
- void setRequires(String requires);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.java
deleted file mode 100644
index 6e2c8d358f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingException.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.binding.ejb;
-
-/**
- * Exception for the EJB Binding
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- /**
- * {@inheritDoc}
- */
- public EJBBindingException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public EJBBindingException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public EJBBindingException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public EJBBindingException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.java
deleted file mode 100644
index 13b069a6bb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/EJBBindingFactory.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.binding.ejb;
-
-/**
- * Factory for the EJB binding
- *
- * @version $Rev$ $Date$
- */
-public interface EJBBindingFactory {
-
- /**
- * Creates a new EJB binding.
- * @return the new EJB binding
- */
- EJBBinding createEJBBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.java
deleted file mode 100644
index e84de86eca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingFactoryImpl.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.binding.ejb.impl;
-
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-import org.apache.tuscany.sca.binding.ejb.EJBBindingFactory;
-
-/**
- * Factory class for building EJBBindings.
- *
- * @version $Rev$ $Date$
- *
- */
-public class EJBBindingFactoryImpl implements EJBBindingFactory {
-
- public EJBBinding createEJBBinding() {
- return new EJBBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java
deleted file mode 100644
index 4a8d751608..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingImpl.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-
-/**
- * An implementation of EJBBinding.
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingImpl extends ExtensibleImpl implements EJBBinding {
-
- /**
- * CORBA location For example,
- * "corbaname:iiop:localhost:2809/NameServiceServerRoot#ejb/MyEJBHome"
- */
- private String uri;
-
- /**
- * homeInterface. remote or local
- */
- private String homeInterface;
-
- /**
- * The ejb-link-name attribute allows a SCA client to bind to an EJB that is
- * packaged in the same JEE EAR file as the SCA client. This is functionally
- * equivalent to using the <ejb-link/> subelement of the <ejb-ref/> element
- * in s EJB deployment descriptor. Used only for Service binding
- */
- private String ejbLinkName;
-
- /**
- * The name of this binding
- */
- private String name;
-
- /**
- * Whether the binding is unresolved
- */
- private boolean unresolved;
-
- /**
- * Clone the binding
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- /**
- * The type of session for this EJB Binding
- */
- private SessionType sessionType;
-
- /**
- * The EJB version for this EJB Binding
- */
- private EJBVersion ejbVersion;
-
- private String requires;
-
- /**
- * Constructor
- */
- public EJBBindingImpl() {
- super();
- unresolved = true;
- }
-
- /**
- * Gets the homeInterface.
- *
- * @return home interface of the service binding
- */
- public String getHomeInterface() {
- return homeInterface;
- }
-
- /**
- * Set homeInterface
- *
- * @param homeInterface
- */
- public void setHomeInterface(String homeInterface) {
- this.homeInterface = homeInterface;
- }
-
- /**
- * get ejb-link-name
- *
- * @return ejb-link-name
- */
- public String getEjbLinkName() {
- return ejbLinkName;
- }
-
- /**
- * Set ejb-link-name
- *
- * @param ejb-link-name
- */
- public void setEjbLinkName(String ejbLinkName) {
- this.ejbLinkName = ejbLinkName;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getName() {
- return this.name;
- }
-
- /**
- * {@inheritDoc}
- */
- public String getURI() {
- return uri;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * {@inheritDoc}
- */
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public boolean isUnresolved() {
- return this.unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public void setSessionType(SessionType ejb_version_enum) {
- this.sessionType = ejb_version_enum;
- }
-
- public void setEjbVersion(EJBVersion ejb_version_enum) {
- this.ejbVersion = ejb_version_enum;
- }
-
- public void setRequires(String requires) {
- this.requires = requires;
-
- }
-
- public SessionType getSessionType() {
- return sessionType;
- }
-
- public EJBVersion getEjbVersion() {
- return ejbVersion;
- }
-
- public String getRequires() {
- return requires;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
deleted file mode 100644
index 305cd2a742..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/java/org/apache/tuscany/sca/binding/ejb/impl/EJBBindingProcessor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ejb.impl;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.ejb.EJBBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * A processor to read the XML that describes the EJB binding...
- *
- * <binding.ejb
- * homeInterface="NCName"?
- * ejb-link-name="NCName"?
- * session-type="stateful or stateless"?
- * ejb-version="EJB2 or EJB3"?
- * name="NCName"?
- * policySets=" sca:listOfQNames"?
- * requires="sca:listOfQNames"?
- * uri="anyURI"?
- * >
- *
- * <!-- additional elements here -->
- *
- * </binding.ejb>
- *
- * @version $Rev$ $Date$
- */
-public class EJBBindingProcessor implements StAXArtifactProcessor<EJBBindingImpl> {
- private PolicyFactory policyFactory;
- private ExtensionFactory extensionFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- public EJBBindingProcessor(ExtensionPointRegistry extensionPoints) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
-
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
- this.extensionAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
-
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public QName getArtifactType() {
- return EJBBinding.BINDING_EJB_QNAME;
- }
-
- /**
- * {@inheritDoc}
- */
- public EJBBindingImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- EJBBindingImpl ejbBinding = new EJBBindingImpl();
-
- // Read the policies
- policyProcessor.readPolicies(ejbBinding, reader);
-
- // Read the name
- String name = reader.getAttributeValue(null, EJBBinding.NAME);
- if (name != null) {
- ejbBinding.setName(name);
- }
-
- // Read binding URI
- String uri = reader.getAttributeValue(null, EJBBinding.URI);
- if (uri != null) {
- ejbBinding.setURI(uri);
- }
-
- String homeInterface = reader.getAttributeValue(null, EJBBinding.HOME_INTERFACE);
- if (homeInterface != null) {
- ejbBinding.setHomeInterface(homeInterface);
- }
-
- String ejbLinkName = reader.getAttributeValue(null, EJBBinding.EJB_LINK_NAME);
- if (ejbLinkName != null) {
- ejbBinding.setEjbLinkName(ejbLinkName);
- }
-
- String sessionType = reader.getAttributeValue(null, EJBBinding.SESSION_TYPE);
- if (sessionType != null) {
- if (sessionType.equals("stateless")) {
- ejbBinding.setSessionType(EJBBinding.SessionType.STATELESS);
- } else if (sessionType.equals("stateful")) {
- ejbBinding.setSessionType(EJBBinding.SessionType.STATEFUL);
- } else {
- error("UnknownEJBSessionType", reader, sessionType, name);
- //throw new ContributionReadException("Unknown EJB Session Type of " + sessionType + " for " + name);
- }
- }
-
- String ejbVersion = reader.getAttributeValue(null, EJBBinding.EJB_VERSION);
- if (ejbVersion != null) {
- if (ejbVersion.equals("EJB2")) {
- ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB2);
- } else if (ejbVersion.equals("EJB3")) {
- ejbBinding.setEjbVersion(EJBBinding.EJBVersion.EJB3);
- } else {
- error("UnknownEJBVersion", reader, ejbVersion, name);
- //throw new ContributionReadException("Unknown EJB Version of " + ejbVersion + " for " + name);
- }
- }
-
- // TODO: Read requires
- String requires = reader.getAttributeValue(null, EJBBinding.REQUIRES);
- if (requires != null) {
- ejbBinding.setRequires(requires);
- }
-
- // Handle extended attributes
- QName elementName = reader.getName();
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( ! elementName.getNamespaceURI().equals(attributeName.getNamespaceURI()) ) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- ejbBinding.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
-
- return ejbBinding;
- }
-
- public void write(EJBBindingImpl ejbBinding, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- // Write a <binding.ejb>
- writer.writeStartElement(Constants.SCA10_NS, EJBBinding.BINDING_EJB);
-
- if (ejbBinding.getName() != null){
- writer.writeAttribute(EJBBinding.NAME, ejbBinding.getName());
- }
-
- if (ejbBinding.getURI() != null){
- writer.writeAttribute(EJBBinding.URI, ejbBinding.getURI());
- }
-
- for(Extension extension : ejbBinding.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- // FIXME Implement the rest
-
- writer.writeEndElement();
- }
-
- public Class<EJBBindingImpl> getModelType() {
- return EJBBindingImpl.class;
- }
-
- public void resolve(EJBBindingImpl ejbBinding, ModelResolver modelResolver) throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ejb.EJBBindingFactory b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ejb.EJBBindingFactory
deleted file mode 100644
index c445a82ecb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ejb.EJBBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.ejb.impl.EJBBindingFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 82e85ef067..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.ejb.impl.EJBBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.ejb,model=org.apache.tuscany.sca.binding.ejb.EJBBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
deleted file mode 100644
index 28477dd3ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/main/resources/binding-ejb-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-UnknownEJBSessionType = Unknown EJB Session Type of {0} for {1}
-UnknownEJBVersion = Unknown EJB Version of {0} for {1}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/impl/ReadWriteAnyAttributeTestCase.java b/branches/sca-java-1.5.1/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/impl/ReadWriteAnyAttributeTestCase.java
deleted file mode 100644
index 9797c8b490..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ejb/src/test/java/org/apache/tuscany/sca/binding/ejb/impl/ReadWriteAnyAttributeTestCase.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ejb.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.xml.AnyAttributeProcessor;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadWriteAnyAttributeTestCase {
-
- private static final QName EXTENDED_ATTRIBUTE = new QName("http://test", "customAttribute");
-
- private static final String XML =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "targetNamespace=\"http://temp\" " +
- "name=\"myComposite\">" +
- "<service name=\"service\">" +
- "<binding.ejb xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSAnyAttribute=\"EJB Value\" />" +
- "<interface.java interface=\"com.ibm.MyInterface\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaInterfaceAnyAttribute=\"Java Interface Value\" />" +
- "</service>" +
- "<component name=\"component\">" +
- "<implementation.java class=\"com.ibm.test.MyClass\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaImplAnyAttribute=\"Java Impl Value\" />" +
- "</component>" +
- "<component name=\"component1\">" +
- "<implementation.composite xmlns:ns2=\"http://temp\" name=\"ns2:myComposite\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myCompositeImplAnyAttribute=\"Composite Impl Value\" />" +
- "</component>" +
- "<reference name=\"reference\">" +
- "<interface.wsdl interface=\"http://www.example.org/SpaceWarGame/#wsdl.interface(SpaceWarGame)\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSDLInterfaceAnyAttribute=\"WSDL Interface Value\" />" +
- "</reference>" +
- "</composite>";
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
-
- /**
- * Initialize the test environment
- * This takes care to register attribute processors when provided
- *
- * @param attributeProcessor
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- inputFactory = XMLInputFactory.newInstance();
-
- StAXAttributeProcessor attributeProcessor = new AnyAttributeProcessor(modelFactories,null);
-
- StAXAttributeProcessorExtensionPoint staxAttributeProcessors = new DefaultStAXAttributeProcessorExtensionPoint(extensionPoints);
- staxAttributeProcessors.addArtifactProcessor(attributeProcessor);
- extensionPoints.addExtensionPoint(staxAttributeProcessors);
-
- EJBBindingProcessor wsbp = new EJBBindingProcessor(extensionPoints);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(wsbp);
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
-
- @Test
- //@Ignore()
- public void testReadWriteCompositeWithBindings() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML);
- // System.out.println(bos.toString());
-
- assertEquals(XML, bos.toString());
- bos.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/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-java-1.5.1/modules/binding-gdata-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/pom.xml
deleted file mode 100644
index 3bfcd55c63..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/pom.xml
+++ /dev/null
@@ -1,210 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-gdata-runtime</artifactId>
- <name>Apache Tuscany SCA Gdata Binding Extension Runtime GSOC</name>
-
- <repositories>
- <repository>
- <id>com.google.gdata</id>
- <url>http://people.apache.org/~lresende/google-gdata/maven/</url>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-gdata</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.abdera</groupId>
- <artifactId>abdera-core</artifactId>
- <version>0.4.0-incubating</version>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gdata</groupId>
- <artifactId>gdata-client</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gdata</groupId>
- <artifactId>gdata-client-meta</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gdata</groupId>
- <artifactId>gdata-core</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gdata</groupId>
- <artifactId>gdata-media</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>
- ${tuscany.version}
- </Bundle-Version>
- <Bundle-SymbolicName>
- org.apache.tuscany.sca.binding.gdata.extension
- </Bundle-SymbolicName>
- <Bundle-Description>
- ${pom.name}
- </Bundle-Description>
- <Export-Package>
- org.apache.tuscany.sca.binding.gdata*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/Collection.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/Collection.java
deleted file mode 100644
index 8bff8631a6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/Collection.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.binding.gdata.collection;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of resources using Gdata.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Collection {
-
- /**
- * Get a GData feed for a collection of resources.
- *
- * @return the GData feed
- */
- Feed getFeed();
-
- /**
- * Get a GData feed for a collection of resources resulting from a query.
- *
- * @param queryString a query string
- * @return the GData feed
- */
- Feed query(Query query);
-
- /**
- * Creates a new entry.
- *
- * @param entry
- * @return
- */
- Entry post(Entry entry);
-
- /**
- * Retrieves an entry.
- *
- * @param id
- * @return
- */
- Entry get(String id) throws NotFoundException;
-
- /**
- * Update an entry.
- *
- * @param id
- * @param entry
- * @return
- */
- void put(String id, Entry entry) throws NotFoundException;
-
- /**
- * Delete an entry.
- *
- * @param id
- */
- void delete(String id) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/MediaCollection.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/MediaCollection.java
deleted file mode 100644
index 699e9f0172..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/MediaCollection.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.binding.gdata.collection;
-
-import java.io.InputStream;
-
-import org.osoa.sca.annotations.Remotable;
-
-import com.google.gdata.data.Entry;
-
-/**
- * Provides access to a collection of resources using Atom.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface MediaCollection extends Collection {
-
- /**
- * Creates a new media entry
- *
- * @param title
- * @param slug
- * @param contentType
- * @param media
- */
- Entry postMedia(String title, String slug, String contentType, InputStream media);
-
- /**
- * Update a media entry.
- *
- * @param id
- * @param contentType
- * @param media
- * @return
- */
- void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/NotFoundException.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/NotFoundException.java
deleted file mode 100644
index 4fc32d4d37..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/collection/NotFoundException.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.binding.gdata.collection;
-
-/**
- * Indicates that a resource could not be found.
- *
- * @version $Rev$ $Date$
- */
-public class NotFoundException extends Exception {
- private static final long serialVersionUID = -5046027674128627383L;
-
- public NotFoundException() {
- }
-
- public NotFoundException(String message) {
- super(message);
- }
-
- public NotFoundException(Throwable cause) {
- super(cause);
- }
-
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java
deleted file mode 100644
index 67cf01eca9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingInvoker.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.gdata.provider;
-
-import static org.apache.tuscany.sca.binding.gdata.provider.GdataBindingUtil.feedEntry;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.DeleteMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.osoa.sca.ServiceRuntimeException;
-
-import com.google.gdata.client.GoogleService;
-import com.google.gdata.client.Query;
-import com.google.gdata.data.Feed;
-import com.google.gdata.util.ResourceNotFoundException;
-import com.google.gdata.util.ServiceException;
-
-/**
- * Invoker for the GData binding.
- *
- * @version $Rev$ $Date$
- */
-class GdataBindingInvoker implements Invoker, DataExchangeSemantics {
-
- Operation operation;
- String uri;
- HttpClient httpClient;
- String authorizationHeader;
- GdataReferenceBindingProvider provider;
- GoogleService googleService;
-
- GdataBindingInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- this.operation = operation;
- this.uri = uri;
- this.googleService = googleService;
- this.httpClient = httpClient;
- this.authorizationHeader = authorizationHeader;
- this.provider = bindingProvider;
-
- }
-
-
- public boolean allowsPassByReference() {
- return true;
- }
-
- public Message invoke(Message msg) {
- // Shouldn't get here, as the only supported methods are
- // defined in the ResourceCollection interface, and implemented
- // by specific invoker subclasses
- throw new UnsupportedOperationException(operation.getName());
- }
-
-
- /**
- * Get operation invoker
- */
- public static class GetInvoker extends GdataBindingInvoker {
-
- public GetInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
-
- // Get the entry id from the message body
- String id = (String)((Object[])msg.getBody())[0];
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri + "/" + id);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
-
- try {
- URL entryURL = new URL(uri + "/" + id);
- com.google.gdata.data.Entry feedEntry = googleService.getEntry(entryURL, com.google.gdata.data.Entry.class);
- msg.setBody(feedEntry);
- } catch (IOException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- }
-
- }
- }
-
- /**
- * Post operation invoker
- */
- public static class PostInvoker extends GdataBindingInvoker {
-
- public PostInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
- // Post an entry
- Object[] args = (Object[])msg.getBody();
- com.google.gdata.data.Entry feedEntry = null;
-
- if (provider.supportsFeedEntries()) {
-
- // Expect an GData entry
-
- //System.out.println("[Debug Info]GdataBindingInvoker.PostInvoker --- supportsFeedEntries: " + provider.supportsFeedEntries());
- feedEntry = (com.google.gdata.data.Entry)args[0];
-
- //System.out.println("[Debug Info]GdataBindingInvoker.PostInvoker --- feedEntry title: " + feedEntry.getTitle().getPlainText());
-
- } else {
- // Expect a key and data item
- Entry<Object, Object> entry = new Entry<Object, Object>(args[0], args[1]);
-
- // FIXME: this needs to be examinated more....
- feedEntry = feedEntry(entry, provider.getItemClassType(), provider.getItemXMLType(), provider.getMediator());
- }
-
- try {
-
- com.google.gdata.data.Entry createdEntry = googleService.insert(new URL(uri), feedEntry);
-
- msg.setBody(createdEntry);
-
- } catch (IOException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- }
- }
- }
-
-
-
- /**
- * Put operation invoker
- */
- public static class PutInvoker extends GdataBindingInvoker {
-
- public PutInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
-
- // Put an entry
- Object[] args = (Object[])msg.getBody();
- String id;
- com.google.gdata.data.Entry feedEntry = null;
- if (provider.supportsFeedEntries()) {
- // Expect a key and GData entry
- id = (String)args[0];
- feedEntry = (com.google.gdata.data.Entry)args[1];
- } else {
-
- // Expect a key and data item
- id = (String)args[0];
- Entry<Object, Object> entry = new Entry<Object, Object>(id, args[1]);
-
- }
-
- // Send an HTTP PUT <Localhost>
- PutMethod putMethod = new PutMethod(uri + "/" + id);
- putMethod.setRequestHeader("Authorization", authorizationHeader);
- try {
- URL entryURL = new URL(uri + "/" + id);
-
- com.google.gdata.data.Entry toUpdateEntry = googleService.getEntry(entryURL, com.google.gdata.data.Entry.class);
-
- //System.out.println("EditHtml:" + toUpdateEntry.getEditLink().getHref());
-
- URL editURL = new URL(toUpdateEntry.getEditLink().getHref());
-
- com.google.gdata.data.Entry updatedEntry = googleService.update(editURL, feedEntry);
-
- msg.setBody(updatedEntry);
-
- } catch (IOException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- } }
- }
-
- /**
- * Delete operation invoker
- */
- public static class DeleteInvoker extends GdataBindingInvoker {
-
- public DeleteInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
-
- // Delete an entry
- String id = (String)((Object[])msg.getBody())[0];
-
- // Send an HTTP DELETE(Localhost)
- DeleteMethod deleteMethod = new DeleteMethod(uri + "/" + id);
- deleteMethod.setRequestHeader("Authorization", authorizationHeader);
-
- try {
- URL entryURL = new URL(uri + "/" + id);
-
- com.google.gdata.data.Entry toUpdateEntry = googleService.getEntry(entryURL, com.google.gdata.data.Entry.class);
-
- //System.out.println("EditHtml:" + toUpdateEntry.getEditLink().getHref());
-
- URL editURL = new URL(toUpdateEntry.getEditLink().getHref());
-
- googleService.delete(editURL);
-
- } catch (IOException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- }
- }
-
- }
-
-
- /**
- * GetAll operation invoker
- */
- public static class GetAllInvoker extends GdataBindingInvoker {
-
- public GetAllInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
-
- //System.out.println("[Debug Info] GdataBindingInvoker.GetAllInvoker.invoke---feedURL: " + uri);
-
- try {
-
- Feed feed = googleService.getFeed(new URL(uri), Feed.class);
- msg.setBody(feed);
-
- } catch (ResourceNotFoundException ex) {
- msg.setFaultBody(new ResourceNotFoundException("Invalid Resource at " + uri));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (Exception ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- }
-
- }
- }
-
- /**
- * Query operation invoker
- */
- public static class QueryInvoker extends GdataBindingInvoker {
-
- public QueryInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @SuppressWarnings("finally")
- @Override
- public Message invoke(Message msg) {
-
- // Send an HTTP GET
- GetMethod getMethod = new GetMethod(uri);
- getMethod.setRequestHeader("Authorization", authorizationHeader);
-
- Object[] args = (Object[])msg.getBody();
- Query myQuery = (Query)args[0];
-
- //System.out.println("[Debug Info] GdataBindingInvoker.QueryInvoker.invoke---feedURL: " + uri);
-
- try {
-
- Feed resultFeed = googleService.query(myQuery, Feed.class);
- msg.setBody(resultFeed);
-
- } catch (ResourceNotFoundException ex) {
- msg.setFaultBody(new ResourceNotFoundException("Invalid Resource at " + uri));
- } catch (ServiceException ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } catch (Exception ex) {
- msg.setFaultBody(new ServiceRuntimeException(ex));
- } finally {
- return msg;
- }
-
-
- }
- }
-
-
-
- /**
- * PostMedia operation invoker
- */
- public static class PostMediaInvoker extends GdataBindingInvoker {
-
- public PostMediaInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // TODO implement
- return super.invoke(msg);
- }
- }
-
- /**
- * PutMedia operation invoker
- */
- public static class PutMediaInvoker extends GdataBindingInvoker {
-
- public PutMediaInvoker(Operation operation,
- String uri,
- GoogleService googleService,
- HttpClient httpClient,
- String authorizationHeader,
- GdataReferenceBindingProvider bindingProvider) {
- super(operation, uri, googleService, httpClient, authorizationHeader, bindingProvider);
- }
-
- @Override
- public Message invoke(Message msg) {
- // TODO implement
- return super.invoke(msg);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java
deleted file mode 100644
index facf3bb641..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingListenerServlet.java
+++ /dev/null
@@ -1,746 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.gdata.provider;
-
-import static org.apache.tuscany.sca.binding.gdata.provider.GdataBindingUtil.entry;
-import static org.apache.tuscany.sca.binding.gdata.provider.GdataBindingUtil.feedEntry;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.apache.abdera.parser.ParseException;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-import com.google.gdata.data.ExtensionProfile;
-import com.google.gdata.data.ParseSource;
-import com.google.gdata.data.PlainTextConstruct;
-import com.google.gdata.util.ServiceException;
-
-/**
- * A resource collection binding listener, implemented as a Servlet and
- * registered in a Servlet host provided by the SCA hosting runtime.
- *
- * @version $Rev$ $Date$
- */
-class GdataBindingListenerServlet extends HttpServlet {
- private static final Logger logger = Logger.getLogger(GdataBindingListenerServlet.class.getName());
- private static final long serialVersionUID = 1L;
-
- private RuntimeWire wire;
- private Invoker getFeedInvoker;
- private Invoker getAllInvoker;
- private Invoker queryInvoker;
- private Invoker getInvoker;
- private Invoker postInvoker;
- private Invoker postMediaInvoker;
- private Invoker putInvoker;
- private Invoker putMediaInvoker;
- private Invoker deleteInvoker;
- private MessageFactory messageFactory;
- private String title;
- private Mediator mediator;
- private DataType<?> itemClassType;
- private DataType<?> itemXMLType;
- private boolean supportsFeedEntries;
-
- /**
- * Constructs a new binding listener.
- *
- * @param wire
- * @param messageFactory
- * @param feedType
- */
- GdataBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator, String title) {
- this.wire = wire;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
- this.title = title;
-
- // Get the invokers for the supported operations
- Operation getOperation = null;
- for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
- invocationChain.setAllowsPassByReference(true);
- Operation operation = invocationChain.getTargetOperation();
- String operationName = operation.getName();
-
- if (operationName.equals("getFeed")) {
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet constructor --- operation: getFeed");
- getFeedInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("getAll")) {
-
- getAllInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("query")) {
-
- queryInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("get")) {
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet Constructor --- opeartion: get");
- getInvoker = invocationChain.getHeadInvoker();
- getOperation = operation;
-
- } else if (operationName.equals("put")) {
-
- putInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("putMedia")) {
-
- putMediaInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("post")) {
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet Constructor --- opeartion: post");
- postInvoker = invocationChain.getHeadInvoker();
-
- } else if (operationName.equals("postMedia")) {
- postMediaInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("delete")) {
- deleteInvoker = invocationChain.getHeadInvoker();
- }
- }
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet constructor --- I am good here 00");
-
- // Determine the collection item type
- itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
- Class<?> itemClass = getOperation.getOutputType().getPhysical();
-
- if (itemClass == com.google.gdata.data.Entry.class) {
- supportsFeedEntries = true;
- }
- DataType<XMLType> outputType = getOperation.getOutputType();
- QName qname = outputType.getLogical().getElementName();
- qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
- itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet --- initilized!");
- }
-
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // No authentication required for a get request
- //System.out.println("[Debug Info]GdataBindingListenerServlet doGet() --- I am good here 00");
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet doGet() --- request.getRequestURI(): " + request.getRequestURI());
- //System.out.println("[Debug Info]GdataBindingListenerServlet doGet()--- path: " + path);
-
- // FIXME: Log this get http request, commented out for testing
- logger.fine("get " + request.getRequestURI());
-
- // Handle an Atom request
- if (path != null && path.equals("/atomsvc")) {
-
- //FIXME: This needs to be fixed, for /atomsvc
-
- /*
- System.out.println("GdataBindingListenerServlet doGet(): I am good here brach 01");
- // Return the Atom service document
- response.setContentType("application/atomsvc+xml; charset=utf-8");
- Service service = abderaFactory.newService();
- // service.setText("service");
-
- Workspace workspace = abderaFactory.newWorkspace();
- workspace.setTitle("resource");
-
- String href = request.getRequestURL().toString();
- href = href.substring(0, href.length() - "/atomsvc".length());
-
- Collection collection = workspace.addCollection("collection", "atom/feed");
- collection.setTitle("entries");
- collection.setAttributeValue("href", href);
- collection.setAccept("entry");
- collection.addCategories().setFixed(false);
-
- workspace.addCollection(collection);
-
- service.addWorkspace(workspace);
-
- // FIXME add prettyPrint support
- try {
- service.getDocument().writeTo(response.getOutputStream());
- } catch (IOException ioe) {
- throw new ServletException(ioe);
- }
- */
-
- } else if (path == null || path.length() == 0 || path.equals("/")) {
-
- // get HTTP request asking for a feed
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet doGet() --- I am good here brach 02");
-
- // Return a feed containing the entries in the collection
- com.google.gdata.data.Feed feed = null;
-
- if (supportsFeedEntries) {
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet doGet() --- supportsFeedEntries: " + supportsFeedEntries);
-
- // The service implementation supports feed entries, invoke its
- // getFeed operation
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage;
- if (request.getQueryString() != null) {
- //System.out.println("getQueryString != null");
- requestMessage.setBody(new Object[] {request.getQueryString()});
- responseMessage = queryInvoker.invoke(requestMessage);
- } else {
- //System.out.println("getQueryString == null");
- responseMessage = getFeedInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- //System.out.println("response msg class:" + responseMessage.getBody().getClass());
-
- feed = (com.google.gdata.data.Feed)responseMessage.getBody();
-
- //System.out.println("feed title: " + feed.getTitle().getPlainText());
-
- } else {
-
- //System.out.println("GdataBindingListenerServlet doGet(): do not supportsFeedEntries");
-
- // The service implementation does not support feed entries,
- // invoke its getAll operation to get the data item collection,
- // then create
- // feed entries from the items
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage;
- if (request.getQueryString() != null) {
- requestMessage.setBody(new Object[] {request.getQueryString()});
- responseMessage = queryInvoker.invoke(requestMessage);
- } else {
- responseMessage = getAllInvoker.invoke(requestMessage);
-
- //System.out
- // .println("GdataBindingListner.doGet(): get msg from getAllInvoker.invoke()" + responseMessage
- // .getBody().toString());
-
- }
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- Entry<Object, Object>[] collection = (Entry<Object, Object>[])responseMessage.getBody();
- if (collection != null) {
-
- // Create the feed
- feed = new com.google.gdata.data.Feed();
-
- // Set the feed title
- if (title != null) {
- feed.setTitle(new PlainTextConstruct(title));
- } else {
- feed.setTitle(new PlainTextConstruct("Feed title"));
- }
-
- // Add entries to the feed
- ArrayList<com.google.gdata.data.Entry> entries = new ArrayList<com.google.gdata.data.Entry>();
- for (Entry<Object, Object> entry : collection) {
- com.google.gdata.data.Entry feedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator);
- entries.add(feedEntry);
- }
- feed.setEntries(entries);
-
- }
- }
- if (feed != null) {
-
- // //System.out.println("feed(from the http response)is not
- // null");
-
- // Write a GData feed using Atom representation
- response.setContentType("application/atom+xml; charset=utf-8");
-
- // Generate the corresponding Atom representation of the feed
- StringWriter stringWriter = new StringWriter();
- com.google.gdata.util.common.xml.XmlWriter w =
- new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
- feed.generateAtom(w, new ExtensionProfile());
- w.flush();
-
- // Write the Atom representation(XML) into Http response content
- OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
- PrintWriter out = new PrintWriter(response.getOutputStream());
- out.println(stringWriter.toString());
- out.close();
-
- //System.out.println("Feed content in plain text:" + stringWriter.toString());
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- } else if (path.startsWith("/")) {
-
- // get HTTP request asking for an entry
-
- // Return a specific entry in the collection
- com.google.gdata.data.Entry feedEntry = null;
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- String id = path.substring(1);
- requestMessage.setBody(new Object[] {id});
- Message responseMessage = getInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- if (supportsFeedEntries) {
- // The service implementation returns a feed entry
- feedEntry = (com.google.gdata.data.Entry)responseMessage.getBody();
-
- //System.out.println("entry title: " + feedEntry.getTitle().getPlainText());
-
- } else {
- // The service implementation only returns a data item, create
- // an entry
- // from it
- Entry<Object, Object> entry = new Entry<Object, Object>(id, responseMessage.getBody());
- // FIXME The line below needs to be fixed
- // feedEntry = feedEntry(entry, itemClassType, itemXMLType,
- // mediator, abderaFactory);
- }
-
- // Write the Gdata entry
- if (feedEntry != null) {
-
- // Write a GData entry using Atom representation
- response.setContentType("application/atom+xml; charset=utf-8");
-
- // Generate the corresponding Atom representation of the feed
- StringWriter stringWriter = new StringWriter();
- com.google.gdata.util.common.xml.XmlWriter w =
- new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
- feedEntry.generateAtom(w, new ExtensionProfile());
- w.flush();
-
- // Write the Atom representation(XML) into Http response content
- OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
- PrintWriter out = new PrintWriter(response.getOutputStream());
- out.println(stringWriter.toString());
- out.close();
-
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- } else {
- // Path doesn't match any known pattern
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
- IOException {
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet doPost() --- reached");
-
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
-
- //System.out.println("[Debug Info]GdataBindingListenerServlet path --- " + path);
-
- if (path == null || path.length() == 0 || path.equals("/")) {
- // Create a new Gdata entry
- com.google.gdata.data.Entry createdFeedEntry = null;
- String contentType = request.getContentType();
-
- if (contentType != null && contentType.startsWith("application/atom+xml")) {
-
- // Read the entry from the request
- com.google.gdata.data.Entry feedEntry = null;
- try {
- ParseSource source = new ParseSource(request.getReader());
- feedEntry = com.google.gdata.data.Entry.readEntry(source, com.google.gdata.data.Entry.class, null);
- } catch (ParseException pe) {
- throw new ServletException(pe);
- } catch (com.google.gdata.util.ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- // Let the component implementation create it
- if (supportsFeedEntries) {
-
- // The service implementation supports feed entries, pass
- // the entry to it
- Message requestMessage = messageFactory.createMessage();
-
- requestMessage.setBody(new Object[] {feedEntry});
-
- Message responseMessage = postInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- createdFeedEntry = responseMessage.getBody();
- } else {
-
- // The service implementation does not support feed entries,
- // pass the data item to it
- Message requestMessage = messageFactory.createMessage();
- Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
- requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
- Message responseMessage = postInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- entry.setKey(responseMessage.getBody());
-
- createdFeedEntry = feedEntry(entry, itemClassType, itemXMLType, mediator);
- }
-
- } else if (contentType != null) {
-
- // Create a new media entry
-
- // Get incoming headers
- String title = request.getHeader("Title");
- String slug = request.getHeader("Slug");
-
- // Let the component implementation create the media entry
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {title, slug, contentType, request.getInputStream()});
- Message responseMessage = postMediaInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- createdFeedEntry = responseMessage.getBody();
- } else {
- response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- }
-
- // A new entry was created successfully
- if (createdFeedEntry != null) {
-
- // Set location of the created entry in the Location header
- // Link link = createdFeedEntry.getSelfLink();
- // if (link != null) {
- // response.addHeader("Location", link.getHref().toString());
- // }
-
- // Write the created Atom entry
- response.setStatus(HttpServletResponse.SC_CREATED);
- response.setContentType("application/atom+xml; charset=utf-8");
- try {
-
- // Generate the corresponding Atom representation of the
- // feed
- StringWriter stringWriter = new StringWriter();
- com.google.gdata.util.common.xml.XmlWriter w =
- new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
- createdFeedEntry.generateAtom(w, new ExtensionProfile());
- w.flush();
-
- // Write the Atom representation(XML) into Http response
- // content
- OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
- PrintWriter out = new PrintWriter(response.getOutputStream());
- out.println(stringWriter.toString());
- out.close();
-
- } catch (ParseException pe) {
- throw new ServletException(pe);
- }
-
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
- private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
- Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
- return writer;
- }
-
-
- @Override
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = request.getRequestURI().substring(request.getServletPath().length());
-
- //System.out.println("[Debug Info] localServlet doPut --- path: " + path);
-
- if (path != null && path.startsWith("/")) {
- String id = path.substring(1);
-
- // Update an Atom entry
- String contentType = request.getContentType();
- if (contentType != null && contentType.startsWith("application/atom+xml")) {
-
- // Read the entry from the request
- com.google.gdata.data.Entry feedEntry = null;
- try {
- ParseSource source = new ParseSource(request.getReader());
- feedEntry = com.google.gdata.data.Entry.readEntry(source, com.google.gdata.data.Entry.class, null);
-
- //System.out.println("[Debug Info] localServlet doPut --- feedEntry title: " + feedEntry.getTitle().getPlainText());
- } catch (ParseException pe) {
- throw new ServletException(pe);
- } catch (com.google.gdata.util.ParseException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (ServiceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
-
-
- // Let the component implementation create it
- if (supportsFeedEntries) {
-
- //System.out.println("[Debug Info] localServlet doPut --- supportsFeedEntries: " + supportsFeedEntries);
-
- // The service implementation supports feed entries, pass
- // the entry to it
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id, feedEntry});
- Message responseMessage = putInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- } else {
-
- // The service implementation does not support feed entries,
- // pass the data item to it
- Message requestMessage = messageFactory.createMessage();
- Entry<Object, Object> entry = entry(feedEntry, itemClassType, itemXMLType, mediator);
- requestMessage.setBody(new Object[] {entry.getKey(), entry.getData()});
- Message responseMessage = putInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- }
-
- // Write the Gdata entry
- if (feedEntry != null) {
-
- // Write a GData entry using Atom representation
- response.setContentType("application/atom+xml; charset=utf-8");
-
- // Generate the corresponding Atom representation of the feed
- StringWriter stringWriter = new StringWriter();
- com.google.gdata.util.common.xml.XmlWriter w =
- new com.google.gdata.util.common.xml.XmlWriter(stringWriter);
- feedEntry.generateAtom(w, new ExtensionProfile());
- w.flush();
-
- // Write the Atom representation(XML) into Http response content
- OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream());
- PrintWriter out = new PrintWriter(response.getOutputStream());
- out.println(stringWriter.toString());
- out.close();
-
- }
-
- } else if (contentType != null) {
-
- // Updated a media entry
-
- // Let the component implementation create the media entry
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id, contentType, request.getInputStream()});
- Message responseMessage = putMediaInvoker.invoke(requestMessage);
- Object body = responseMessage.getBody();
- if (responseMessage.isFault()) {
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- } else {
- response.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE);
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
-
-
-
- @Override
- protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException,
- IOException {
-
- // Authenticate the user
- String user = processAuthorizationHeader(request);
- if (user == null) {
- unauthorized(response);
- return;
- }
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
-
- String id;
- if (path != null && path.startsWith("/")) {
- id = path.substring(1);
- } else {
- id = "";
- }
-
- // Delete a specific entry from the collection
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[] {id});
- Message responseMessage = deleteInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
- if (body.getClass().getName().endsWith(".NotFoundException")) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- } else {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- }
- }
-
-
-
- /**
- * Process the authorization header
- *
- * @param request
- * @return
- * @throws ServletException
- */
- private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
-
- // FIXME temporarily disabling this as it doesn't work with all browsers
- if (true)
- return "admin";
-
- try {
- String authorization = request.getHeader("Authorization");
- if (authorization != null) {
- StringTokenizer tokens = new StringTokenizer(authorization);
- if (tokens.hasMoreTokens()) {
- String basic = tokens.nextToken();
- if (basic.equalsIgnoreCase("Basic")) {
- String credentials = tokens.nextToken();
- String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
- int colon = userAndPassword.indexOf(":");
- if (colon != -1) {
- String user = userAndPassword.substring(0, colon);
- String password = userAndPassword.substring(colon + 1);
-
- // Authenticate the User.
- if (authenticate(user, password)) {
- return user;
- }
- }
- }
- }
- }
- } catch (Exception e) {
- throw new ServletException(e);
- }
- return null;
- }
-
- /**
- * Authenticate a user.
- *
- * @param user
- * @param password
- * @return
- */
- private boolean authenticate(String user, String password) {
- // TODO Handle this using SCA security policies
- return ("admin".equals(user) && "admin".equals(password));
- }
-
- /**
- * Reject an unauthorized request.
- *
- * @param response
- */
- private void unauthorized(HttpServletResponse response) throws IOException {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java
deleted file mode 100644
index 62a05e91d0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingProviderFactory.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata.provider;
-
-import org.apache.tuscany.sca.binding.gdata.GdataBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-import com.google.gdata.util.AuthenticationException;
-
-/**
- * Implementation of a Binding provider factory for the Atom binding.
- *
- * @version $Rev$ $Date$
- */
-public class GdataBindingProviderFactory implements BindingProviderFactory<GdataBinding> {
-
- private MessageFactory messageFactory;
- private Mediator mediator;
- private ServletHost servletHost;
-
- public GdataBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- GdataBinding binding) {
- try {
- return new GdataReferenceBindingProvider(component, reference, binding, mediator);
- } catch (AuthenticationException e) {
- e.printStackTrace();
- return null; //Google authentication error! : This exception needs to be handled into a better way
- }
-
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- GdataBinding binding) {
- return new GdataServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
- }
-
- public Class<GdataBinding> getModelType() {
- return GdataBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingUtil.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingUtil.java
deleted file mode 100644
index 3d476df764..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataBindingUtil.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata.provider;
-
-import java.util.Date;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-import com.google.gdata.data.DateTime;
-import com.google.gdata.data.PlainTextConstruct;
-import com.google.gdata.data.TextContent;
-
-/**
- * Utility methods used in this package.
- *
- * @version $Rev$ $Date$
- */
-class GdataBindingUtil {
-
- /**
- * Create a data item from an GData entry.
- *
- * @param feedEntry
- * @param itemClassType
- * @param itemXMLType
- * @param mediator
- * @return
- */
- static Entry<Object, Object> entry(com.google.gdata.data.Entry feedEntry,
- DataType<?> itemClassType,
- DataType<?> itemXMLType,
- Mediator mediator) {
- if (feedEntry != null) {
- if (itemClassType.getPhysical() == Item.class) {
- String key = feedEntry.getId().toString();
-
- Item item = new Item();
- item.setTitle(feedEntry.getTitle().toString());
- TextContent content = (TextContent)feedEntry.getContent();
- item.setContents(content.getContent().getPlainText());
-
- for (com.google.gdata.data.Link link : feedEntry.getLinks()) {
- if (link.getRel() == null || "self".equals(link.getRel())) {
- if (item.getLink() == null) {
- item.setLink(link.getHref().toString());
- }
- } else if ("related".equals(link.getRel())) {
- item.setRelated(link.getHref().toString());
- } else if ("alternate".equals(link.getRel())) {
- item.setAlternate(link.getHref().toString());
- }
- }
-
- Date date = new Date(feedEntry.getUpdated().getValue());
- item.setDate(date);
- return new Entry<Object, Object>(key, item);
-
- } else {
- String key = null;
- if (feedEntry.getId() != null) {
- key = feedEntry.getId();
- }
-
- // Create the item from XML
- if (feedEntry.getContent() == null) {
- return null;
- }
-
- TextContent content = (TextContent)feedEntry.getContent();
- String value = content.getContent().getPlainText();
- Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
- return new Entry<Object, Object>(key, data);
- }
- } else {
- return null;
- }
- }
-
- /**
- * Create an Gdata entry for a key and item from a collection.
- *
- * @param entry
- * @param itemClassType
- * @param itemXMLType
- * @param mediator
- * @param factory
- * @return
- */
- static com.google.gdata.data.Entry feedEntry(Entry<Object, Object> entry,
- DataType<?> itemClassType,
- DataType<?> itemXMLType,
- Mediator mediator) {
-
- Object key = entry.getKey();
- Object data = entry.getData();
- if (data instanceof Item) {
- Item item = (Item)data;
-
- com.google.gdata.data.Entry feedEntry = new com.google.gdata.data.Entry();
- if (key != null) {
- feedEntry.setId(key.toString());
- }
- feedEntry.setTitle(new PlainTextConstruct(item.getTitle()));
- feedEntry.setContent(new PlainTextConstruct(item.getContents()));
-
- String href = item.getLink();
- if (href == null && key != null) {
- href = key.toString();
- }
-
- if (href != null) {
- feedEntry.addHtmlLink(href, "", "");
- }
- String related = item.getRelated();
- if (related != null) {
- feedEntry.addHtmlLink(related, "", "related");
- }
- String alternate = item.getAlternate();
- if (alternate != null) {
- feedEntry.addHtmlLink(alternate, "", "alternate");
- }
-
- Date date = item.getDate();
- if (date != null) {
- DateTime datetime = new DateTime(date);
- feedEntry.setUpdated(datetime);
- }
- return feedEntry;
-
- } else if (data != null) {
-
- com.google.gdata.data.Entry feedEntry = new com.google.gdata.data.Entry();
- feedEntry.setId(key.toString());
- feedEntry.setTitle(new PlainTextConstruct("item"));
-
- // Convert the item to XML
- String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
-
- // Might be wrong because the example uses XML datatype, I am using
- // plainText here
- feedEntry.setContent(new PlainTextConstruct(value));
-
- feedEntry.addHtmlLink(key.toString(), "", "");
- return feedEntry;
-
- } else {
- return null;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataReferenceBindingProvider.java
deleted file mode 100644
index ac8c298d1a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataReferenceBindingProvider.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.binding.gdata.provider;
-
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.httpclient.Credentials;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpConnectionManager;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.tuscany.sca.binding.gdata.GdataBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-import com.google.gdata.client.GoogleService;
-import com.google.gdata.util.AuthenticationException;
-
-/**
- * Implementation of the Atom binding provider.
- *
- * @version $Rev$ $Date$
- */
-class GdataReferenceBindingProvider implements ReferenceBindingProvider {
-
- private RuntimeComponentReference reference;
- private GdataBinding binding;
- private String authorizationHeader;
- private GoogleService googleService;
- private HttpClient httpClient;
- private Mediator mediator;
- private DataType<?> itemClassType;
- private DataType<?> itemXMLType;
- private boolean supportsFeedEntries;
-
- /**
- * Constructs a new AtomReferenceBindingProvider
- *
- * @param component
- * @param reference
- * @param binding
- * @param mediator
- * @throws AuthenticationException
- */
- GdataReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- GdataBinding binding,
- Mediator mediator) throws AuthenticationException {
- this.reference = reference;
- this.binding = binding;
- this.mediator = mediator;
-
- // Prepare authorization header
- String authorization = "admin" + ":" + "admin";
- authorizationHeader = "Basic " + new String(Base64.encodeBase64(authorization.getBytes()));
-
- // Prepare gdata header
- String serviceType = binding.getServiceType();
- String usernane = binding.getUsername();
- String password = binding.getPassword();
-
- //System.out.println("[Debug Info] binding.getServiceType()" + serviceType);
- //System.out.println("[Debug Info] binding.getName()" +usernane);
- //System.out.println("[Debug Info] binding.getPassword()" + password);
-
- googleService = new GoogleService(serviceType, "");
- if(binding.getUsername().equals("admin") == false && binding.getPassword().equals("admin")==false){
- googleService.setUserCredentials(binding.getUsername(),binding.getPassword());
- }
-
- // Create an HTTP client
- HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
- connectionManager.getParams().setDefaultMaxConnectionsPerHost(10);
- connectionManager.getParams().setConnectionTimeout(60000);
- httpClient = new HttpClient(connectionManager);
- }
-
- public Invoker createInvoker(Operation operation) {
-
- String operationName = operation.getName();
-
- if (operationName.equals("get")) {
-
- // Determine the collection item type
- itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
- Class<?> itemClass = operation.getOutputType().getPhysical();
- DataType<XMLType> outputType = operation.getOutputType();
- QName qname = outputType.getLogical().getElementName();
- qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
- itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
-
- if (itemClassType.getPhysical() == com.google.gdata.data.Entry.class) {
- supportsFeedEntries = true;
- }
-
- String entryURI = this.binding.getURI();
- if(entryURI.contains("picasaweb.google.com/data/feed/api/")){
- entryURI = entryURI.replace("picasaweb.google.com/data/feed/api/", "picasaweb.google.com/data/entry/api/");
- }
-
- return new GdataBindingInvoker.GetInvoker(operation, entryURI, googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("post")) {
-
- return new GdataBindingInvoker.PostInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("put")) {
-
- String entryURI = this.binding.getURI();
- if(entryURI.contains("picasaweb.google.com/data/feed/api/")){
- entryURI = entryURI.replace("picasaweb.google.com/data/feed/api/", "picasaweb.google.com/data/entry/api/");
- }
-
- return new GdataBindingInvoker.PutInvoker(operation, entryURI, googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("delete")) {
-
- String entryURI = this.binding.getURI();
- if(entryURI.contains("picasaweb.google.com/data/feed/api/")){
- entryURI = entryURI.replace("picasaweb.google.com/data/feed/api/", "picasaweb.google.com/data/entry/api/");
- }
- return new GdataBindingInvoker.DeleteInvoker(operation, entryURI, googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("getFeed") || operationName.equals("getAll")) {
-
- return new GdataBindingInvoker.GetAllInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("postMedia")) {
-
- return new GdataBindingInvoker.PostMediaInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("putMedia")) {
-
- return new GdataBindingInvoker.PutMediaInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
-
- } else if (operationName.equals("query")) {
-
- return new GdataBindingInvoker.QueryInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
- }
-
- return new GdataBindingInvoker(operation, binding.getURI(), googleService, httpClient, authorizationHeader, this);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public void start() {
- // Configure the HTTP client credentials
- Credentials credentials = new UsernamePasswordCredentials("admin", "admin");
- httpClient.getParams().setAuthenticationPreemptive(true);
- URI uri = URI.create(binding.getURI());
- httpClient.getState().setCredentials(new AuthScope(uri.getHost(), uri.getPort()), credentials);
- }
-
- public void stop() {
-
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- /**
- * Returns the mediator.
- *
- * @return
- */
- Mediator getMediator() {
- return mediator;
- }
-
- /**
- * Returns the item class type.
- *
- * @return
- */
- DataType<?> getItemClassType() {
- return itemClassType;
- }
-
- /**
- * Returns the item XML type.
- *
- * @return
- */
- DataType<?> getItemXMLType() {
- return itemXMLType;
- }
-
- /**
- * Returns true if the invoker should work with Atom feed entries.
- *
- * @return
- */
- boolean supportsFeedEntries() {
- return supportsFeedEntries;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataServiceBindingProvider.java
deleted file mode 100644
index 10faf74371..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/java/org/apache/tuscany/sca/binding/gdata/provider/GdataServiceBindingProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata.provider;
-
-import org.apache.tuscany.sca.binding.gdata.GdataBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of the Atom binding provider.
- *
- * @version $Rev$ $Date$
- */
-class GdataServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeComponentService service;
- private GdataBinding binding;
- private ServletHost servletHost;
- private MessageFactory messageFactory;
- private String servletMapping;
- private Mediator mediator;
-
- GdataServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- GdataBinding binding,
- ServletHost servletHost,
- MessageFactory messageFactory,
- Mediator mediator) {
- this.service = service;
- this.binding = binding;
- this.servletHost = servletHost;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- RuntimeComponentService componentService = (RuntimeComponentService)service;
- RuntimeWire wire = componentService.getRuntimeWire(binding);
-
- GdataBindingListenerServlet servlet =
- new GdataBindingListenerServlet(wire, messageFactory, mediator, binding.getTitle());
-
- servletMapping = binding.getURI();
- if (!servletMapping.endsWith("/")) {
- servletMapping += "/";
- }
- if (!servletMapping.endsWith("*")) {
- servletMapping += "*";
- }
- servletHost.addServletMapping(servletMapping, servlet);
-
- // Save the actual binding URI in the binding
- binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
- }
-
- public void stop() {
- servletHost.removeServletMapping(servletMapping);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 5e380eb4e0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.gdata.provider.GdataBindingProviderFactory;model=org.apache.tuscany.sca.binding.gdata.GdataBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Constants.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Constants.java
deleted file mode 100644
index 6b4a6e2509..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Constants.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-public class Constants {
- static long SLEEP_INTERVAL = 400L;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
deleted file mode 100644
index 7d723a2883..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Consumer.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.PlainTextConstruct;
-
-public class Consumer {
-
- public static void main(String[] args) throws Exception {
-
- //Initialize the GData client service (Reference Binding test)
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite");
- CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
-
-
- Feed feed = testService.clientGetFeed();
-
- //System.out.println("#Entries(Before post): "+ testService.clientGetFeed().getEntries().size());
-
- /*
- String entryID = "tag:blogger.com,1999:blog-4520949313432095990.post-973462497533349425";
- Entry entry = testService.clientGetEntry(entryID);
- System.out.println("Entry id: " + entry.getId());
- */
-
- Entry myEntry = new Entry();
- myEntry.setTitle(new PlainTextConstruct("titleByConsumer2"));
- myEntry.setContent(new PlainTextConstruct("contentByConsmer2"));
- testService.clientPost(myEntry);
-
- //System.out.println("#Entries(After post): "+ testService.clientGetFeed().getEntries().size());
-
- String entryID = "tag:blogger.com,1999:blog-4520949313432095990.post-973462497533349425";
- Entry entry = testService.clientGetEntry(entryID);
- //System.out.println("Entry id: " + entry.getId());
-
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
deleted file mode 100644
index af7027ca90..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/ConsumerProviderTestCase.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.PlainTextConstruct;
-
-public class ConsumerProviderTestCase {
-
- private static SCADomain scaDomainProvider = null;
- private static SCADomain scaDomainConsumer = null;
- private static CustomerClient testService = null;
-
- @BeforeClass
- public static void setUp() throws Exception {
- // Setup the local GData servlet (Service Binding test)
- scaDomainProvider = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite");
-
- // Initialize the GData client service (Reference Binding test)
- scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Consumer.composite");
- testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void tearDown() {
- scaDomainConsumer.close();
- scaDomainProvider.close();
- }
-
-
- @Test
- public void testClientGetFeed() throws Exception {
- Feed feed = testService.clientGetFeed();
- //System.out.println(feed.getTitle().getPlainText());
- Assert.assertNotNull(feed);
- // Given we are testing on the localhost providing feed, we know the
- // feed title is "Feedtitle(LocalHostServlet)"
- Assert.assertEquals("Feedtitle(LocalHostServlet)", feed.getTitle().getPlainText());
- }
-
- @Test
- public void testClientGetEntry() throws Exception {
- String entryID = "urn:uuid:customer-0";
- Entry entry = testService.clientGetEntry(entryID);
- //System.out.println("entryID in testcase: " + entry.getId());
- Assert.assertEquals(entryID, entry.getId());
- }
-
- @Test
- public void testClientPost() throws Exception {
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct("NewEntry title by Post"));
- newEntry.setContent(new PlainTextConstruct("NewEntry Content by Post"));
- Entry postedEntry = testService.clientPost(newEntry);
- Assert.assertEquals("NewEntry title by Post", postedEntry.getTitle().getPlainText());
- }
-
-
-
- @Test
- public void testClientPut() throws Exception {
- String newTitleValue = "newTitleValueByPut";
- String entryID = "urn:uuid:customer-0";
- //System.out.println("Before clientPut");
- testService.clientPut(entryID, newTitleValue);
- //System.out.println("After clientPut");
- Entry updatedEntry = testService.clientGetEntry(entryID);
- //System.out.println("title: "+ updatedEntry.getTitle().getPlainText());
- Assert.assertEquals(newTitleValue, updatedEntry.getTitle().getPlainText());
- }
-
-
-
- @Test
- public void testClientDelete() throws Exception {
-
- // We first create a new entry, then delete it
-
- // Post a new entry
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct("NewEntry title to be deleted"));
- newEntry.setContent(new PlainTextConstruct("NewEntry Content to be delted"));
- Entry confirmedNewEntry = testService.clientPost(newEntry);
-
- Thread.sleep(Constants.SLEEP_INTERVAL);
-
- Feed feed00 = testService.clientGetFeed();
- int entryNum00 = feed00.getEntries().size(); // The number of entries
- // before deleting
- //System.out.println("entryNum00:" + entryNum00);
-
- // Delete this newly created entry
- String entryID = confirmedNewEntry.getId();
- Thread.sleep(300);
-
- //System.out.println("confirmed entry ID: " + confirmedNewEntry.getId());
- //System.out.println("confirmed entry title: " + confirmedNewEntry.getTitle().getPlainText());
-
- //System.out.println("Before test clientDelete");
- testService.clientDelete(entryID);
- //System.out.println("After test clientDelete");
-
- Feed feed01 = testService.clientGetFeed();
- int entryNum01 = feed01.getEntries().size();
- //System.out.println("entryNum01:" + entryNum01); // The number of entries after deleting
-
- //assertEquals(1, entryNum00 - entryNum01);
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.java
deleted file mode 100644
index 7aa0a8961c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClient.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.binding.gdata;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-
-public interface CustomerClient {
-
- Feed clientGetFeed() throws Exception;
-
- Entry clientGetEntry(String entryID) throws Exception;
-
- Entry clientPost(Entry entry) throws Exception;
-
- void clientDelete(String entryID) throws Exception;
-
- void clientPut(String entryID, String newTitle) throws Exception;
-
- Feed clientQuery(Query query) throws Exception;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
deleted file mode 100644
index 5dc9c0079f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerClientImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.PlainTextConstruct;
-
-import org.apache.tuscany.sca.binding.gdata.collection.Collection;
-import org.apache.tuscany.sca.binding.gdata.collection.NotFoundException;
-import org.osoa.sca.annotations.Reference;
-
-public class CustomerClientImpl implements CustomerClient {
-
- @Reference
- public Collection resourceCollection;
-
- // Call Collection.getFeed()
- public Feed clientGetFeed() throws Exception {
- // Get all the entries from the provider, return in a single feed
- //System.out.println(">>> get the feed from the provider service");
- Feed feed = resourceCollection.getFeed();
- //System.out.println("\n\n!!! Fetched feed title: " + feed.getTitle().getPlainText());
- int i = 0;
- for (Object o : feed.getEntries()) {
- com.google.gdata.data.Entry e = (com.google.gdata.data.Entry)o;
- //System.out.print("Entry" + i + "\t");
- //System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
- i++;
- }
- return feed;
- }
-
-
- // Call Collection.get(entryID)
- public Entry clientGetEntry(String entryID) throws Exception {
- // Get an existing entry based on its id
- //System.out.println(">>> get an existing entry from the provider service");
- Entry entry = resourceCollection.get(entryID);
- //System.out.println("\n\n!!! Entry retrieved with id=" + entry.getId()
- // + " title="
- // + entry.getTitle().getPlainText());
- return entry;
- }
-
-
- // Call Collection.post(newEntry)
- public Entry clientPost(Entry newEntry) throws Exception {
- // Put a new entry to the provider
- //System.out.println(">>> post a new entry to the provider service");
- Entry confirmedNewEntry = resourceCollection.post(newEntry);
- //System.out.println("!!! New entry posted with id=" + confirmedNewEntry.getId()
- // + " title="
- // + confirmedNewEntry.getTitle().getPlainText());
- return confirmedNewEntry;
- }
-
-
- // Call Collection.delete(newEntry)
- public void clientDelete(String entryID) throws Exception {
- // Put a new entry to the provider
- //System.out.println(">>> delete an existing entry from the provider service");
- //System.out.println(">>> delete id=" + "urn:uuid:customer-1");
- resourceCollection.delete(entryID);
- //System.out.println("!!! entry with id" + entryID);
- }
-
-
-
- // Call Collection.put(entry, updatedTitle)
- public void clientPut(String entryID, String newTitle) throws Exception {
-
- //System.out.println("clientPut");
- // Put a new entry to the provider
- //System.out.println(">>> put id=" + entryID + " title=" + newTitle);
- Entry entry = resourceCollection.get(entryID);
-
- //change the title of this entry
- entry.setTitle(new PlainTextConstruct(newTitle));
- resourceCollection.put(entryID, entry);
- //System.out.println("!!! Updated entry with id=" + entry.getId() + " title=" + entry.getTitle());
- }
-
-
-
- // Call Collection.getFeed()
- public Feed clientQuery(Query query) throws Exception {
- // Get all the entries from the provider, return in a single feed
- //System.out.println(">>> query the service");
- Feed feed = resourceCollection.query(query);
- //System.out.println("\n\n!!! Query result feed title: " + feed.getTitle().getPlainText());
- int i = 0;
- for (Object o : feed.getEntries()) {
- com.google.gdata.data.Entry e = (com.google.gdata.data.Entry)o;
- //System.out.print("Entry" + i + "\t");
- //System.out.println(" id = " + e.getId() + "\t title = " + e.getTitle().getPlainText());
- i++;
- }
- return feed;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.java
deleted file mode 100644
index 9c4d118cd6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/CustomerCollectionImpl.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.binding.gdata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.DateTime;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.Link;
-import com.google.gdata.data.PlainTextConstruct;
-
-import org.apache.tuscany.sca.binding.gdata.collection.Collection;
-import org.osoa.sca.annotations.Scope;
-
-@Scope("COMPOSITE")
-public class CustomerCollectionImpl implements Collection {
-
-
- private Map<String, Entry> entries = new HashMap<String, Entry>();
-
- /**
- * Default constructor that initializes collection with couple customer
- * entries
- */
- public CustomerCollectionImpl() {
-
- for (int i = 0; i < 4; i++) {
- // id is supposed to be generated in a random way, but for the
- // purpose of testing, we just make them as static ids
-
- // String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
-
- String id = "urn:uuid:customer-" + String.valueOf(i);
- Entry entry = new Entry();
- entry.setId(id);
- entry.setTitle(new PlainTextConstruct("EntryTitle_" + i));
- entry.setContent(new PlainTextConstruct("content_" + i));
- entry.setUpdated(DateTime.now());
- // FIXME: The following three lines of code need to be fixed to add
- // HTML links.
- Link link = new Link();
- link.setType(Link.Type.ATOM);
- link.setRel(Link.Rel.ENTRY_EDIT);
- link.setHref("http://localhost:8084/customer" + "/" + id);
- entry.getLinks().add(link);
-
- // entry.addHtmlLink(""+id, "", "edit");
- // entry.addHtmlLink(""+id, "", "alternate");
- entries.put(id, entry);
- //System.out.println(">>> id=" + id);
- }
- }
-
- public Entry post(Entry entry) {
- //System.out.println(">>> ResourceCollectionImpl.post entry=" + entry.getTitle());
-
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
- entry.setId(id);
-
- Link link = new Link();
- link.setType(Link.Type.ATOM);
- link.setRel(Link.Rel.ENTRY_EDIT);
- link.setHref("http://localhost:8084/customer" + "/" + id);
- entry.getLinks().add(link);
-
- //entry.addLink("" + id, "edit"); entry.addLink("" + id, "alternate");
- entry.setUpdated(DateTime.now());
-
- // entry.addHtmlLink("http://www.google.com", "languageType", "edit");
- // entry.addHtmlLink("http://www.google.com", "languageType",
- // "alternate");
-
- entries.put(id, entry);
- //System.out.println(">>> ResourceCollectionImpl.post return id=" + id);
- return entry;
- }
-
- public Entry get(String id) {
- //System.out.println(">>> ResourceCollectionImpl.get id= " + id);
- return entries.get(id);
- }
-
- public void put(String id, Entry entry) {
- //System.out.println(">>> ResourceCollectionImpl.put id=" + id + " entry=" + entry.getTitle().getPlainText());
- entry.setUpdated(DateTime.now());
- entries.put(id, entry);
- }
-
-
- public void delete(String id) {
- //System.out.println(">>> ResourceCollectionImpl.delete id=" + id);
- entries.remove(id);
- }
-
-
- public Feed getFeed() {
- //System.out.println(">>> ResourceCollectionImpl.get collection");
-
- Feed feed = new Feed();
- feed.setTitle(new PlainTextConstruct("Feedtitle(LocalHostServlet)"));
- feed.setSubtitle(new PlainTextConstruct("Subtitle: This is a sample feed"));
- feed.setUpdated(DateTime.now());
- // FIXME: The following two lines of code need to be fixed
- // feed.addHtmlLink("", "", "");
- // feed.addHtmlLink("", "languageType", "self");
- ArrayList<Entry> entryList = new ArrayList<Entry>();
- for (Entry entry : entries.values()) {
- entryList.add(entry);
- }
- feed.setEntries(entryList);
-
- return feed;
- }
-
- //FIXME: need to be modified
- public Feed query(Query query) {
- //System.out.println(">>> ResourceCollectionImpl.query collection ");
- return getFeed();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
deleted file mode 100644
index a827677fd0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleBloggerServiceTestCase.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import java.net.URL;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.DateTime;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.PlainTextConstruct;
-
-public class GoogleBloggerServiceTestCase {
-
- private static SCADomain scaDomainConsumer = null;
- private static CustomerClient testService = null;
-
- @BeforeClass
- public static void setUp() throws Exception {
- //Initialize the GData client service (Reference Binding test)
- scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite");
- testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void tearDown(){
- scaDomainConsumer.close();
- }
-
- @Test
- public void testClientGetFeed() throws Exception {
- Feed feed = testService.clientGetFeed();
- //System.out.println("feed title: " + feed.getTitle().getPlainText());
- Assert.assertEquals("gdata binding tuscany test", feed.getTitle().getPlainText());
- }
-
-
- @Test
- public void testClientGetEntry() throws Exception {
- String entryID = "8308734583601887890";
- Entry blogEntry = testService.clientGetEntry(entryID);
- //System.out.println("Entry ID: " + blogEntry.getId());
- Assert.assertTrue(blogEntry.getId().endsWith(entryID));
- //System.out.println("------------------------------------------------------------\n\n");
- }
-
-
- @Test
- public void testClientPut() throws Exception {
- String entryID = "2889832689497686762";
- String newBlogEntryTitle = "updatedTitleByTestCase2";
- testService.clientPut(entryID, newBlogEntryTitle); //update the title
- Thread.sleep(Constants.SLEEP_INTERVAL);
- Entry updatedEntry = testService.clientGetEntry(entryID);
- Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
- }
-
-
-
- @Test
- public void testClientPost() throws Exception {
- String blogEntryTitle = "titleByBloogerTestcase000";
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
- newEntry.setContent(new PlainTextConstruct("contentByBloggerTestCase000"));
- Entry postedEntry = testService.clientPost(newEntry);
- Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
- }
-
-
- @Test
- public void testClientDelete() throws Exception {
-
- //This test case might fail
- //because Google blogger service has limitation on new posts allowed everyday/every hour?
-
- //System.out.println("testClientDelete");
- //We create a new post, and then delete it
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct("blogEntryShouldNotApear"));
- newEntry.setContent(new PlainTextConstruct("contentByBloggerShouldNotAppear"));
- Entry postedEntry = testService.clientPost(newEntry);
- Thread.sleep(Constants.SLEEP_INTERVAL);
- int idStartPosition = postedEntry.getId().lastIndexOf("-");
- String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- //System.out.println("postedEntryID: " + postedEntryID );
-
- //Before deletion
- Entry entry00 = testService.clientGetEntry(postedEntryID);
- //System.out.println("Before Deleteion: " + entry00.getId());
-
- //Delete this entry
- testService.clientDelete(postedEntryID);
-
- //Worked: this newly posted entry did not appear in the blogspot website,
- //But we need a Junit assertion here
- //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
- //FIXME: Need an assertion here
- //Assert(....);
- }
-
-
- @Test
- public void testClientQuery() throws Exception {
- Query myQuery = new Query(new URL("http://haibotuscany.blogspot.com/feeds/posts/default"));
- myQuery.setMaxResults(100);
- //myQuery.setUpdatedMin(startTime);
- myQuery.setUpdatedMax(DateTime.now());
- Feed resultFeed = testService.clientQuery(myQuery);
- //System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
- //System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
- //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
deleted file mode 100644
index 9c3122e134..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleCalendarServiceTestCase.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import java.net.URL;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.DateTime;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.PlainTextConstruct;
-
-public class GoogleCalendarServiceTestCase {
-
- private static SCADomain scaDomainConsumer = null;
- private static CustomerClient testService = null;
-
- public GoogleCalendarServiceTestCase() {
-
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- //Initialize the GData client service (Reference Binding test)
- scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite");
- testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void tearDown(){
- scaDomainConsumer.close();
- }
-
- @Test
- public void testClientGetFeed() throws Exception {
- Feed feed = testService.clientGetFeed();
- //System.out.println("feed title: " + feed.getTitle().getPlainText());
- Assert.assertEquals("gsoc gosc", feed.getTitle().getPlainText());
- }
-
-
- @Test
- public void testClientGetEntry() throws Exception {
- String entryID = "1c76lcl70jg9r0fm18rcbneea8";
- Entry blogEntry = testService.clientGetEntry(entryID);
- //System.out.println("Entry ID: " + blogEntry.getId());
- Assert.assertTrue(blogEntry.getId().endsWith(entryID));
- //System.out.println("------------------------------------------------------------\n\n");
- }
-
-
- @Test
- public void testClientPut() throws Exception {
- String entryID = "1c76lcl70jg9r0fm18rcbneea8";
- String newBlogEntryTitle = "updatedTitleByGoogleContactsConsumerTestCase";
- testService.clientPut(entryID, newBlogEntryTitle); //update the title
- Thread.sleep(Constants.SLEEP_INTERVAL);
- Entry updatedEntry = testService.clientGetEntry(entryID);
- Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
- }
-
- @Test
- public void testClientPost() throws Exception {
- String blogEntryTitle = "titleByGoogleCalendarTestcase";
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
- newEntry.setContent(new PlainTextConstruct("contentByGoogleCalendarTestCase"));
- Entry postedEntry = testService.clientPost(newEntry);
- Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
- }
-
- @Test
- public void testClientDelete() throws Exception {
-
- //This test case might fail
- //because Google blogger service has limitation on new posts allowed everyday/every hour?
-
- //System.out.println("testClientDelete");
- //We create a new post, and then delete it
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct("calendarEntryShouldNotApear"));
- newEntry.setContent(new PlainTextConstruct("calendarByBloggerShouldNotAppear"));
- Entry postedEntry = testService.clientPost(newEntry);
- Thread.sleep(Constants.SLEEP_INTERVAL);
-
- //System.out.println("ID: " + postedEntry.getId());
-
- int idStartPosition = postedEntry.getId().lastIndexOf("/");
- String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- //System.out.println("postedEntryID: " + postedEntryID );
-
- //Before deletion
- Entry entry00 = testService.clientGetEntry(postedEntryID);
- //System.out.println("Before Deleteion: " + entry00.getId());
-
- //Delete this entry
- testService.clientDelete(postedEntryID);
-
- //Worked: this newly posted entry did not appear in the contact list
- //But we need a Junit assertion here
- //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
- //FIXME: Need an assertion here
- //Assert(....);
- }
-
-
- @Test
- public void testClientQuery() throws Exception {
- Query myQuery = new Query(new URL("http://www.google.com/calendar/feeds/haibotuscany@gmail.com/private/full"));
- myQuery.setMaxResults(100);
- //myQuery.setUpdatedMin(startTime);
- myQuery.setUpdatedMax(DateTime.now());
-
- //Google Calendar service supports full-text search
- String queryString = "event0";
- myQuery.setFullTextQuery(queryString);
-
- Feed resultFeed = testService.clientQuery(myQuery);
- //System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
- //System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
- //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
deleted file mode 100644
index 1f261dfc90..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleContactsServiceTestCase.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import java.net.URL;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.DateTime;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-import com.google.gdata.data.PlainTextConstruct;
-
-public class GoogleContactsServiceTestCase {
-
- private static SCADomain scaDomainConsumer = null;
- private static CustomerClient testService = null;
-
- public GoogleContactsServiceTestCase(){
-
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- //Initialize the GData client service (Reference Binding test)
- scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite");
- testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void tearDown(){
- scaDomainConsumer.close();
- }
-
- @Test
- public void testClientGetFeed() throws Exception {
- Feed feed = testService.clientGetFeed();
- System.out.println("feed title: " + feed.getTitle().getPlainText());
- Assert.assertEquals("Haibo Zhao's Contacts", feed.getTitle().getPlainText());
- }
-
-
- @Test
- public void testClientGetEntry() throws Exception {
- String entryID = "12feeeb38ab87365";
- Entry contactEntry = testService.clientGetEntry(entryID);
- //System.out.println("Entry ID: " + contactEntry.getId());
- Assert.assertTrue(contactEntry.getId().endsWith(entryID));
- }
-
-
- @Test
- public void testClientPut() throws Exception {
- String entryID = "12feeeb38ab87365";
- String newBlogEntryTitle = "updatedTitleByGoogleContactsConsumerTestCase";
- testService.clientPut(entryID, newBlogEntryTitle); //update the title
- Thread.sleep(Constants.SLEEP_INTERVAL);
- Entry updatedEntry = testService.clientGetEntry(entryID);
- Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
- }
-
-
-
- @Test
- public void testClientPost() throws Exception {
- String blogEntryTitle = "titleByGoogleContactsTestcase";
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct(blogEntryTitle));
- newEntry.setContent(new PlainTextConstruct("contentByGoogleContactsTestCase"));
- Entry postedEntry = testService.clientPost(newEntry);
- Assert.assertEquals(blogEntryTitle, postedEntry.getTitle().getPlainText());
- }
-
-
- @Test
- public void testClientDelete() throws Exception {
-
- //This test case might fail
- //because Google blogger service has limitation on new posts allowed everyday/every hour?
-
- //System.out.println("testClientDelete");
- //We create a new post, and then delete it
- Entry newEntry = new Entry();
- newEntry.setTitle(new PlainTextConstruct("contactEntryShouldNotApear"));
- newEntry.setContent(new PlainTextConstruct("contactByBloggerShouldNotAppear"));
- Entry postedEntry = testService.clientPost(newEntry);
- Thread.sleep(Constants.SLEEP_INTERVAL);
-
- //System.out.println("ID: " + postedEntry.getId());
-
- int idStartPosition = postedEntry.getId().lastIndexOf("/");
- String postedEntryID = postedEntry.getId().substring(idStartPosition+1);
- //System.out.println("postedEntryID: " + postedEntryID );
-
- //Before deletion
- for (int i = 0; i < 5; i++) { // make 5 attempts because of timing issues
- try {
- Entry entry00 = testService.clientGetEntry(postedEntryID);
- //System.out.println("Before Deletion: " + entry00.getId());
- break; // get was successful
- } catch (Exception e) {
- if (i < 4) {
- System.out.println("Get failed, retrying...");
- } else {
- throw e; // final attempt, give up
- }
- }
- }
-
- //Delete this entry
- for (int i = 0; i < 5; i++) { // make 5 attempts because of timing issues
- try {
- testService.clientDelete(postedEntryID);
- break; // delete was successful
- } catch (Exception e) {
- if (i < 4) {
- System.out.println("Delete failed, retrying...");
- } else {
- throw e; // final attempt, give up
- }
- }
- }
-
- //Worked: this newly posted entry did not appear in the contact list
- //But we need a Junit assertion here
- //Link: http://haibotuscany.blogspot.com/feeds/posts/default/
- //FIXME: Need an assertion here
- //Assert(....);
- }
-
-
- @Test
- public void testClientQuery() throws Exception {
- Query myQuery = new Query(new URL("http://www.google.com/m8/feeds/contacts/default/base"));
- myQuery.setMaxResults(100);
- //myQuery.setUpdatedMin(startTime);
- myQuery.setUpdatedMax(DateTime.now());
- Feed resultFeed = testService.clientQuery(myQuery);
- //System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
- //System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
- //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.java
deleted file mode 100644
index 459c2f6933..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/GoogleWebAlbumServiceTestCase.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.binding.gdata;
-
-import java.net.URL;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.google.gdata.client.Query;
-import com.google.gdata.data.Entry;
-import com.google.gdata.data.Feed;
-
-public class GoogleWebAlbumServiceTestCase {
-
- private static SCADomain scaDomainConsumer = null;
- private static CustomerClient testService = null;
-
- public GoogleWebAlbumServiceTestCase(){
-
- }
-
- @BeforeClass
- public static void setUp() throws Exception {
- //Initialize the GData client service (Reference Binding test)
- scaDomainConsumer = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite");
- testService = scaDomainConsumer.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void tearDown(){
- scaDomainConsumer.close();
- }
-
- @Test
- public void testClientGetFeed() throws Exception {
- Feed feed = testService.clientGetFeed();
- //System.out.println("feed title: " + feed.getTitle().getPlainText());
- Assert.assertEquals("flowers", feed.getTitle().getPlainText());
- }
-
-
-
-
- @Test
- public void testClientGetEntry() throws Exception {
- String entryID = "photoid/5233468700029715874";
- Entry contactEntry = testService.clientGetEntry(entryID);
- //System.out.println("Entry ID: " + contactEntry.getId());
- Assert.assertTrue(contactEntry.getId().endsWith(entryID));
- //System.out.println("------------------------------------------------------------\n\n");
- }
-
-
- @Test
- public void testClientQuery() throws Exception {
- String feedUrlString = "http://picasaweb.google.com/data/feed/api/user/haibotuscany/album/flowers";
- URL feedURL = new URL(feedUrlString);
- Query myQuery = new Query(feedURL);
- myQuery.setMaxResults(100);
- myQuery.setFullTextQuery("photo");
- Feed resultFeed = testService.clientQuery(myQuery);
- //System.out.println("Query result feed title: " + resultFeed.getTitle().getPlainText());
- //System.out.println("Query result entry number: "+ resultFeed.getEntries().size());
- //assertEquals("gdata binding tuscany test", resultFeed.getTitle().getPlainText());
- }
-
-
-
- @Test
- public void testClientPut() throws Exception {
- String entryID = "photoid/5233468700029715874";
- String newBlogEntryTitle = "updatedTitle:dog";
- testService.clientPut(entryID, newBlogEntryTitle); //update the title
- Thread.sleep(Constants.SLEEP_INTERVAL);
- Entry updatedEntry = testService.clientGetEntry(entryID);
- Assert.assertEquals(newBlogEntryTitle, updatedEntry.getTitle().getPlainText());
- }
-
-
- @Test
- @Ignore("Not testing anything")
- public void testClientDelete() throws Exception {
-
- //Tested and it worked, but only once because we can not delete the same entry twice
- String entryID = "photoid/5233468698153151618";
-
- //Delete this entry
- //To test, change the entryID
- //testService.clientDelete(entryID);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.java
deleted file mode 100644
index 21bff30256..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/Provider.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.binding.gdata;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Provider {
-
- public static void main(String[] args) {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite");
- System.out.println("Provider.composite ready...");
-
- try {
- System.in.read();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.java
deleted file mode 100644
index 2773398426..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/java/org/apache/tuscany/sca/binding/gdata/StartLocalhostServlet.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.binding.gdata;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class StartLocalhostServlet {
-
- public static void main(String[] args) {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/gdata/Provider.composite");
- System.out.println("Provider.composite ready...");
-
- try {
- System.in.read();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/log4j.properties b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/log4j.properties
deleted file mode 100644
index 33eaf11c1f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Set root logger level to WARN and its only appender to CONSOLE
-log4j.rootLogger=INFO, CONSOLE
-
-
-# Console appender
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %x - %m\n
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite
deleted file mode 100644
index a7941a2056..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Consumer.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.gdata uri="http://localhost:8084/customer" serviceType="localServiceBinding" username="admin" password="admin"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite
deleted file mode 100644
index 078873c44f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleBlogger.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.gdata uri="http://haibotuscany.blogspot.com/feeds/posts/default" serviceType="blogger" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite
deleted file mode 100644
index 7e0c925482..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleCalendar.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.gdata uri="http://www.google.com/calendar/feeds/haibotuscany@gmail.com/private/full" serviceType="cl" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite
deleted file mode 100644
index bc1ea7a8a9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleContacts.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.gdata uri="http://www.google.com/m8/feeds/contacts/default/base" serviceType="cp" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite
deleted file mode 100644
index 99db48cc4e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/ConsumerGoogleWebAlbum.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.gdata uri="http://picasaweb.google.com/data/feed/api/user/haibotuscany/album/flowers" serviceType="lh2" username="haibotuscany@gmail.com" password="gsocgsocgsoc"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite b/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite
deleted file mode 100644
index a4cf00dc84..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata-runtime/src/test/resources/org/apache/tuscany/sca/binding/gdata/Provider.composite
+++ /dev/null
@@ -1,33 +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"
- targetNamespace = "http://customer"
- name="Provider">
-
- <service name="customer" promote="CustomerCollection">
- <tuscany:binding.gdata uri = "http://localhost:8084/customer"/>
- </service>
-
- <component name="CustomerCollection">
- <implementation.java class="org.apache.tuscany.sca.binding.gdata.CustomerCollectionImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/LICENSE b/branches/sca-java-1.5.1/modules/binding-gdata/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/binding-gdata/NOTICE b/branches/sca-java-1.5.1/modules/binding-gdata/NOTICE
deleted file mode 100644
index 841fb69681..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-
-
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/pom.xml b/branches/sca-java-1.5.1/modules/binding-gdata/pom.xml
deleted file mode 100644
index b7d4642408..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/pom.xml
+++ /dev/null
@@ -1,79 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-gdata</artifactId>
- <name>Apache Tuscany SCA Gdata Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.gdata</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.gdata*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java
deleted file mode 100644
index a3a0b834cd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBinding.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * Gdata binding model.
- *
- * @version $Rev$ $Date$
- */
-public interface GdataBinding extends Binding {
-
- /**
- * Returns the title of the GData collection.
- * @return
- */
- String getTitle();
-
- /**
- * Sets the title of the GData collection.
- * @param title
- */
- void setTitle(String title);
-
- /**
- * Returns the username to be used when authenticating with GData Services
- * @return
- */
- String getUsername();
-
- /**
- * Sets the username to be used when authenticating with GData Services
- * @param username
- */
- void setUsername(String username);
-
- /**
- * Returns the password to be used when authenticating with GData Services
- * @return
- */
- String getPassword();
-
- /**
- * Sets the password to be used when authenticating with GData Services
- * @param password
- */
- void setPassword(String password);
-
- /**
- * Returns the type os service being used
- * @return
- */
- String getServiceType();
-
- /**
- * Sets the type of service being used
- * @param serviceType
- */
- void setServiceType(String serviceType);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.java
deleted file mode 100644
index 5cfc688dcb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/GdataBindingFactory.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.binding.gdata;
-
-/**
- * Factory for the GData binding
- *
- * @version $Rev$ $Date$
- */
-public interface GdataBindingFactory {
-
- /**
- * Creates a new GData binding.
- * @return the new GData binding
- */
- GdataBinding createGdataBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.java
deleted file mode 100644
index 87f3597248..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingFactoryImpl.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.binding.gdata.impl;
-
-import org.apache.tuscany.sca.binding.gdata.GdataBinding;
-import org.apache.tuscany.sca.binding.gdata.GdataBindingFactory;
-
-/**
- * Factory for the GData binding model.
- *
- * @version $Rev$ $Date$
- */
-public class GdataBindingFactoryImpl implements GdataBindingFactory {
-
- public GdataBinding createGdataBinding() {
- return new GdataBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java
deleted file mode 100644
index b4b0a5f449..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingImpl.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.gdata.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.gdata.GdataBinding;
-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;
-
-/**
- * Implementation of the GData binding model.
- *
- * @version $Rev$ $Date$
- */
-class GdataBindingImpl implements GdataBinding, PolicySetAttachPoint {
-
- private String name;
- private String uri;
- private String title;
- private String username;
- private String password;
- private String serviceType;
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public String getTitle() {
- return title;
- }
-
- public String getUsername(){
- return username;
- }
-
- public String getPassword(){
- return password;
- }
-
- public String getServiceType(){
- return serviceType;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public boolean isUnresolved() {
- // The binding is always resolved
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The binding is always resolved
- }
-
- //Policy related getters/setters
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.java
deleted file mode 100644
index dea035559b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/java/org/apache/tuscany/sca/binding/gdata/impl/GdataBindingProcessor.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.binding.gdata.impl;
-
-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.binding.gdata.GdataBinding;
-import org.apache.tuscany.sca.binding.gdata.GdataBindingFactory;
-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;
-
-/**
- * A processor for <binding.gdata> elements.
- *
- * @version $Rev$ $Date$
- */
-public class GdataBindingProcessor implements StAXArtifactProcessor<GdataBinding> {
-
- private QName BINDING_GDATA = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.gdata");
-
- private final GdataBindingFactory factory;
-
- public GdataBindingProcessor(ModelFactoryExtensionPoint modelFactories) {
- this.factory = modelFactories.getFactory(GdataBindingFactory.class);
- //System.out.println("[Debug Info]GdataBindingProcessor reached");
- }
-
- public QName getArtifactType() {
- return BINDING_GDATA;
- }
-
- public Class<GdataBinding> getModelType() {
- return GdataBinding.class;
- }
-
- public GdataBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- GdataBinding gdataBinding = factory.createGdataBinding();
-
- String name = reader.getAttributeValue(null, "name");
- if (name != null) {
- gdataBinding.setName(name);
- }
-
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null) {
- gdataBinding.setURI(uri);
- }
-
- String serviceType = reader.getAttributeValue(null, "serviceType");
- if (serviceType != null) {
- gdataBinding.setServiceType(serviceType);
- }
-
- String username = reader.getAttributeValue(null, "username");
- if (username != null) {
- gdataBinding.setUsername(username);
- }
-
- String password = reader.getAttributeValue(null, "password");
- if (password != null) {
- gdataBinding.setPassword(password);
- }
-
-
- return gdataBinding;
- }
-
- public void write(GdataBinding gdataBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- writer.writeStartElement(BINDING_GDATA.getNamespaceURI(), BINDING_GDATA.getLocalPart());
-
- if (gdataBinding.getName() != null) {
- writer.writeAttribute("name", gdataBinding.getName());
- }
-
- if (gdataBinding.getURI() != null) {
- writer.writeAttribute("uri", gdataBinding.getURI());
- }
-
- if (gdataBinding.getServiceType() != null) {
- writer.writeAttribute("serviceType", gdataBinding.getServiceType());
- }
-
- if (gdataBinding.getUsername() != null) {
- writer.writeAttribute("username", gdataBinding.getUsername());
- }
-
- if (gdataBinding.getPassword() != null) {
- writer.writeAttribute("password", gdataBinding.getPassword());
- }
-
- writer.writeEndElement();
- }
-
-
- public void resolve(GdataBinding gdataBinding, ModelResolver resolver) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.gdata.GdataBindingFactory b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.gdata.GdataBindingFactory
deleted file mode 100644
index 21688a62a6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.gdata.GdataBindingFactory
+++ /dev/null
@@ -1,18 +0,0 @@
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the model factory
-org.apache.tuscany.sca.binding.gdata.impl.GdataBindingFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 4e71818f7b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-gdata/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.gdata.impl.GdataBindingProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.gdata,model=org.apache.tuscany.sca.binding.gdata.GdataBinding,factory=org.apache.tuscany.sca.binding.gdata.GdataBindingFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/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-java-1.5.1/modules/binding-http-jsonrpc-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/pom.xml
deleted file mode 100644
index c0b2d5b091..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/pom.xml
+++ /dev/null
@@ -1,130 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-http-jsonrpc-runtime</artifactId>
- <name>Apache Tuscany SCA HTTP Binding JSON-RPC Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http-jsonrpc</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-json</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.metaparadigm</groupId>
- <artifactId>json-rpc</artifactId>
- <version>1.0</version>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.http.wireformat.jsonrpc</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.http.wireformat.jsonrpc</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
deleted file mode 100644
index 37c76d88d3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorInterceptor.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.provider;
-
-import java.io.CharArrayWriter;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.HTTPBindingContext;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.json.JSONObject;
-
-import com.metaparadigm.jsonrpc.JSONRPCResult;
-
-/**
- * JSON-RPC Operation Selector Interceptor
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCOperationSelectorInterceptor implements Interceptor {
- private Invoker next;
-
- private RuntimeWire runtimeWire;
- private HTTPBinding binding;
-
- private MessageFactory messageFactory;
-
- public JSONRPCOperationSelectorInterceptor(HTTPBinding binding, RuntimeWire runtimeWire, MessageFactory messageFactory) {
- this.binding = binding;
- this.runtimeWire = runtimeWire;
- this.messageFactory = messageFactory;
- }
-
- public Invoker getNext() {
- return this.next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Message invoke(Message msg) {
-
- HTTPBindingContext bindingContext = msg.getBindingContext();
- if ("smd".equals(bindingContext.getHttpRequest().getQueryString())) {
- return getNext().invoke(msg);
- }
-
- JSONObject jsonReq = null;
- String method = null;
- try {
- Object[] args = msg.getBody();
- CharArrayWriter data = (CharArrayWriter) args[0];
- jsonReq = new JSONObject(data.toString());
- method = jsonReq.getString("method");
- } catch (Exception e) {
- Throwable exception = new RuntimeException("Unable to parse request", e);
- }
-
- Operation jsonOperation = findOperation(method);
- msg.setOperation(jsonOperation);
- msg.setBody(jsonReq);
-
- return getNext().invoke(msg);
- }
-
- /**
- * Find the operation from the component service contract
- * @param componentService
- * @param method
- * @return
- */
- private Operation findOperation(String method) {
- if (method.contains(".")) {
- method = method.substring(method.lastIndexOf(".") + 1);
- }
-
- List<Operation> operations = runtimeWire.getTarget().getInterfaceContract().getInterface().getOperations();
-
- Operation result = null;
- for (Operation o : operations) {
- if (o.getName().equalsIgnoreCase(method)) {
- result = o;
- break;
- }
- }
-
- return result;
- }
-
-
-
- /**
- * Create a Fault Message with a JSON representation of the current exception
- * @param throwable
- * @return
- */
- private Message createJSONFaultMessage(Throwable throwable) {
- Message jsonFaultMessage = messageFactory.createMessage();
-
- JSONRPCResult jsonFault = new JSONRPCResult(JSONRPCResult.CODE_REMOTE_EXCEPTION, null, throwable);
- jsonFaultMessage.setBody(jsonFault);
-
- return jsonFaultMessage;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
deleted file mode 100644
index 42ee2808c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorProviderFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * JSON-RPC Operation Selector Provider Factory
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCOperationSelectorProviderFactory implements OperationSelectorProviderFactory<JSONRPCOperationSelector> {
- private ExtensionPointRegistry extensionPoints;
-
- public JSONRPCOperationSelectorProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new JSONRPCOperationSelectorServiceProvider(extensionPoints, component, service, binding);
- }
-
- public Class<JSONRPCOperationSelector> getModelType() {
- return JSONRPCOperationSelector.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
deleted file mode 100644
index c24537f03f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/provider/JSONRPCOperationSelectorServiceProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.BindingRRB;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * JSON-RPC Operation Selector Service Provider
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCOperationSelectorServiceProvider implements OperationSelectorProvider {
- private MessageFactory messageFactory;
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public JSONRPCOperationSelectorServiceProvider(ExtensionPointRegistry extensionPoints,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
-
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- public Interceptor createInterceptor() {
- if(binding instanceof BindingRRB) {
- BindingRRB rrbBinding = (BindingRRB) binding;
- OperationSelector operationSelector = rrbBinding.getOperationSelector();
- if(operationSelector != null && operationSelector instanceof JSONRPCOperationSelector) {
- return new JSONRPCOperationSelectorInterceptor((HTTPBinding) binding, service.getRuntimeWire(binding), messageFactory);
- }
- }
-
- return null;
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_OPERATION_SELECTOR;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java
deleted file mode 100644
index b314f69fcb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatInterceptor.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.provider;
-
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.HTTPBindingContext;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.osoa.sca.ServiceRuntimeException;
-
-import com.metaparadigm.jsonrpc.JSONRPCResult;
-
-/**
- * JSON-RPC Wire Format Interceptor
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatInterceptor implements Interceptor {
- private Invoker next;
-
- private RuntimeWire runtimeWire;
- private HTTPBinding binding;
-
- private InterfaceContract serviceContract;
-
- private MessageFactory messageFactory;
-
- public JSONRPCWireFormatInterceptor(HTTPBinding binding, RuntimeWire runtimeWire, InterfaceContract serviceContract, MessageFactory messageFactory) {
- this.binding = binding;
- this.runtimeWire = runtimeWire;
-
- this.serviceContract = serviceContract;
-
- this.messageFactory = messageFactory;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
-
- }
-
- public Message invoke(Message msg) {
- HTTPBindingContext bindingContext = msg.getBindingContext();
- Message returnMessage = null;
-
- if ("smd".equals(bindingContext.getHttpRequest().getQueryString())) {
- returnMessage = handleSMDInvocation(msg);
- } else {
- returnMessage = handleJSONRPCInvocation(msg);
- }
-
- return returnMessage;
-
- }
-
- /**
- * Handle regular JSON-RPC Invocation
- * @param msg
- * @return
- */
- private Message handleJSONRPCInvocation (Message msg) {
- JSONObject jsonReq = (JSONObject) msg.getBody();
- String method = null;
- Object[] args = null;
- Object id = null;
- try {
- // Extract the method
- method = jsonReq.getString("method");
- if ((method != null) && (method.indexOf('.') < 0)) {
- jsonReq.putOpt("method", "Service" + "." + method);
- }
-
- // Extract the arguments
- JSONArray array = jsonReq.getJSONArray("params");
- args = new Object[array.length()];
- for (int i = 0; i < args.length; i++) {
- args[i] = array.get(i);
- }
- id = jsonReq.get("id");
-
- } catch (Exception e) {
- throw new RuntimeException("Unable to find json method name", e);
- }
-
- Message responseMessage = null;
- try {
- msg.setBody(args);
- responseMessage = runtimeWire.getInvocationChain(msg.getOperation()).getHeadInvoker().invoke(msg);
- } catch (RuntimeException re) {
- Throwable exception = new RuntimeException("Error invoking service :" + re.getMessage(), re);
- return createJSONFaultMessage(re);
- }
-
- Object result = null;
- if (!responseMessage.isFault()) {
- //successful execution of the invocation
- try {
- result = responseMessage.getBody();
- JSONObject jsonResponse = new JSONObject();
- jsonResponse.put("result", result);
- jsonResponse.putOpt("id", id);
- //get response to send to client
- responseMessage.setBody(jsonResponse);
- return responseMessage;
- } catch (Exception e) {
- throw new ServiceRuntimeException("Unable to create JSON response", e);
- }
- } else {
- //exception thrown while executing the invocation
- Throwable exception = (Throwable)responseMessage.getBody();
- return createJSONFaultMessage(exception);
- }
- }
-
- /**
- * handles requests for the SMD descriptor for a service
- */
- private Message handleSMDInvocation(Message msg) {
- HTTPBindingContext bindingContext = msg.getBindingContext();
-
- String serviceUrl = bindingContext.getHttpRequest().getRequestURL().toString();
- JavaInterface interfaze = (JavaInterface) serviceContract.getInterface();
- String smd = JavaToSmd.interfaceToSmd(interfaze.getJavaClass(), serviceUrl);
-
- Message smdResponseMessage = messageFactory.createMessage();
- smdResponseMessage.setBody(smd);
-
- return smdResponseMessage;
- }
-
- /**
- * Create a Fault Message with a JSON representation of the current exception
- * @param throwable
- * @return
- */
- private Message createJSONFaultMessage(Throwable throwable) {
- Message jsonFaultMessage = messageFactory.createMessage();
-
- JSONRPCResult jsonFault = new JSONRPCResult(JSONRPCResult.CODE_REMOTE_EXCEPTION, null, throwable);
- jsonFaultMessage.setBody(jsonFault);
-
- return jsonFaultMessage;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatProviderFactory.java
deleted file mode 100644
index c5f91e2b15..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatProviderFactory.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.binding.http.wireformat.jsonrpc.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * JSON-RPC Wire Format Provider Factory
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatProviderFactory implements WireFormatProviderFactory <JSONRPCWireFormat> {
- private ExtensionPointRegistry extensionPoints;
-
- public JSONRPCWireFormatProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new JSONRPCWireFormatReferenceProvider(extensionPoints, component, reference, binding);
- }
-
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new JSONRPCWireFormatServiceProvider(extensionPoints, component, service, binding);
- }
-
- public Class<JSONRPCWireFormat> getModelType() {
- return JSONRPCWireFormat.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatReferenceProvider.java
deleted file mode 100644
index 932072095a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatReferenceProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * JSON-RPC Wire Format Reference Provider
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatReferenceProvider implements WireFormatProvider {
-
- public JSONRPCWireFormatReferenceProvider (ExtensionPointRegistry extensionPoints,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
-
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract) {
- return null;
- }
-
- public Interceptor createInterceptor() {
- return null;
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.java
deleted file mode 100644
index 1454fbdff2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JSONRPCWireFormatServiceProvider.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.binding.http.wireformat.jsonrpc.provider;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.BindingRRB;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * JSON-RPC Wire Format Service Provider
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatServiceProvider implements WireFormatProvider {
- private MessageFactory messageFactory;
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private InterfaceContract serviceContract;
- private Binding binding;
-
- public JSONRPCWireFormatServiceProvider(ExtensionPointRegistry extensionPoints,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
-
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
-
- this.component = component;
- this.service = service;
- this.serviceContract = service.getInterfaceContract();
- this.binding = binding;
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract) {
- this.serviceContract = interfaceContract;
-
- setDataBinding(serviceContract.getInterface());
-
- // Set default databinding to json
- serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- if(binding instanceof BindingRRB) {
- BindingRRB rrbBinding = (BindingRRB) binding;
- WireFormat wireFormat = rrbBinding.getRequestWireFormat();
- if(wireFormat != null && wireFormat instanceof JSONRPCWireFormat) {
- return new JSONRPCWireFormatInterceptor((HTTPBinding) binding, service.getRuntimeWire(binding), serviceContract, messageFactory);
- }
- }
-
- return null;
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-
- private void setDataBinding(Interface interfaze) {
- List<Operation> operations = interfaze.getOperations();
- for (Operation operation : operations) {
- operation.setDataBinding(JSONDataBinding.NAME);
- DataType<List<DataType>> inputType = operation.getInputType();
- if (inputType != null) {
- List<DataType> logical = inputType.getLogical();
- for (DataType inArg : logical) {
- if (!SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
- inArg.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- DataType outputType = operation.getOutputType();
- if (outputType != null) {
- if (!SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
- outputType.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JavaToSmd.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JavaToSmd.java
deleted file mode 100644
index c67060f7b6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/provider/JavaToSmd.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.binding.http.wireformat.jsonrpc.provider;
-
-import java.lang.reflect.Method;
-
-/**
- * Utility class to create a Simple Method Description (SMD) descriptor
- * from a Java class. See http://dojo.jot.com/SMD.
- *
- * TODO: Change to work from the Tuscany Interface instead of a Java class
- *
- * @version $Rev$ $Date$
- */
-class JavaToSmd {
-
- static String interfaceToSmd(Class<?> klazz, String serviceUrl) {
- String name = klazz.getSimpleName();
- Method[] methods = klazz.getMethods();
-
- StringBuffer smdSb = new StringBuffer();
- smdSb.append("{\"SMDVersion\":\".1\",\"objectName\":\"" + name + "\",\"serviceType\":\"JSON-RPC\",\"serviceURL\":\""+ serviceUrl + "\",\"methods\":[");
- for (int i = 0; i < methods.length; i++) {
- if (i != 0) smdSb.append(",");
- Class<?>[] params = methods[i].getParameterTypes();
- smdSb.append("{\"name\":\""+methods[i].getName() + "\",\"parameters\":[");
- for (int j = 0; j < params.length; j++) {
- if (j != 0) smdSb.append(",");
- // right now Dojo doesn't look at the type value, so we'll default it to STRING
- // also, since we can't introspect the method parameter names we'll just create an incrementing parameter name
- smdSb.append("{\"name\":\"param" + j + "\",\"type\":\"STRING\"}");
- }
- smdSb.append("]}");
- }
- smdSb.append("]}");
-
- return smdSb.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
deleted file mode 100644
index 61ee00271b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
+++ /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.binding.http.operationselector.jsonrpc.provider.JSONRPCOperationSelectorProviderFactory;model=org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
deleted file mode 100644
index 9b7d686ddd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the wire format provider factory
-org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.provider.JSONRPCWireFormatProviderFactory;model=org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/LICENSE b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/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-java-1.5.1/modules/binding-http-jsonrpc/NOTICE b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/pom.xml b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/pom.xml
deleted file mode 100644
index b139423edc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/pom.xml
+++ /dev/null
@@ -1,94 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-http-jsonrpc</artifactId>
- <name>Apache Tuscany SCA HTTP Binding JSON-RPC Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.http.wireformat.jsonrpc</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.http.wireformat.jsonrpc</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelector.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelector.java
deleted file mode 100644
index 68024e8d5c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelector.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * JSON-RPC Operation Selector model
- *
- * @version $Rev$ $Date$
- */
-public interface JSONRPCOperationSelector extends OperationSelector {
- /**
- * QName representing the HTTP JSON-RPC Operation Selector extension
- */
- public static final QName OPERATION_SELECTOR_HTTP_JSONRPC_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jsonrpc");
-
- QName getSchemaName();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelectorFactory.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelectorFactory.java
deleted file mode 100644
index 37ceeed709..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/JSONRPCOperationSelectorFactory.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.binding.http.operationselector.jsonrpc;
-
-
-/**
- * JSON-RPC Operation Selector model factory
- *
- * @version $Rev$ $Date$
- */
-public interface JSONRPCOperationSelectorFactory {
-
- /**
- * Create a new JSON RPC Operation Selector
- * @return
- */
- JSONRPCOperationSelector createJSONRPCOperationSelector();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorFactoryImpl.java
deleted file mode 100644
index 107719dbc3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorFactoryImpl.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.binding.http.operationselector.jsonrpc.impl;
-
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory;
-
-/**
- * JSON-RPC Operation Selector model factory implementation
- * @version $Rev$ $Date$
- */
-public class JSONRPCOperationSelectorFactoryImpl implements JSONRPCOperationSelectorFactory {
-
- public JSONRPCOperationSelector createJSONRPCOperationSelector() {
- return new JSONRPCOperationSelectorImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorImpl.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorImpl.java
deleted file mode 100644
index 5f36bf8d34..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorImpl.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.binding.http.operationselector.jsonrpc.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
-
-/**
- * JSON-RPC Operation Selector model implementation
- * @version $Rev$ $Date$
- */
-public class JSONRPCOperationSelectorImpl implements JSONRPCOperationSelector {
-
- public QName getSchemaName() {
- return JSONRPCOperationSelector.OPERATION_SELECTOR_HTTP_JSONRPC_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormat.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormat.java
deleted file mode 100644
index f9aaa57a51..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormat.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * JSON-RPC Wire Format model
- *
- * @version $Rev$ $Date$
- */
-public interface JSONRPCWireFormat extends WireFormat {
- /**
- * QName representing the HTTP JSON-RPC Wire Format extension
- */
- public static final QName WIRE_FORMAT_HTTP_JSONRPC_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jsonrpc");
-
- QName getSchemaName();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormatFactory.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormatFactory.java
deleted file mode 100644
index 8d659faf41..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/JSONRPCWireFormatFactory.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.binding.http.wireformat.jsonrpc;
-
-/**
- * JSON-RPC Wire Format model factory
- * @version $Rev$ $Date$
- */
-public interface JSONRPCWireFormatFactory {
-
- /**
- * Create a new JSONRPC Wire Format
- * @return
- */
- JSONRPCWireFormat createJSONRPCWireFormat();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatFactoryImpl.java
deleted file mode 100644
index 392a32a8b7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatFactoryImpl.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.binding.http.wireformat.jsonrpc.impl;
-
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory;
-
-
-/**
- * JSON-RPC Wire Format model factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatFactoryImpl implements JSONRPCWireFormatFactory {
-
- public JSONRPCWireFormat createJSONRPCWireFormat() {
- return new JSONRPCWireFormatImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatImpl.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatImpl.java
deleted file mode 100644
index d02d667ab4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatImpl.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.binding.http.wireformat.jsonrpc.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
-
-/**
- * JSON-RPC Wire Format model implementation
- * @version $Rev$ $Date$
- */
-public class JSONRPCWireFormatImpl implements JSONRPCWireFormat {
-
- public QName getSchemaName() {
- return WIRE_FORMAT_HTTP_JSONRPC_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory
deleted file mode 100644
index 76203fbc11..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.impl.JSONRPCOperationSelectorFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory
deleted file mode 100644
index 3f72dd5a67..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.impl.JSONRPCWireFormatFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 17a340c06c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jsonrpc,model=org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat,factory=org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormatFactory
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#operationSelector.jsonrpc,model=org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector,factory=org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelectorFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorProcessorTestCase.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorProcessorTestCase.java
deleted file mode 100644
index 86b23d9125..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/operationselector/jsonrpc/impl/JSONRPCOperationSelectorProcessorTestCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.operationselector.jsonrpc.JSONRPCOperationSelector;
-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.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
-* JSON RPC operation selector processor tests
-*
-* @version $Rev$ $Date$
-*/
-public class JSONRPCOperationSelectorProcessorTestCase {
-
- public static final String COMPOSITE_WITH_OPERATION_SELECTOR =
- "<?xml version='1.0' encoding='UTF-8'?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-http\" name=\"binding-http\">"
- + "<component name=\"HelloWorldComponent\">"
- + "<implementation.java class=\"services.HelloWorld\" />"
- + "<service name=\"HelloWorldService\">"
- + "<wstxns1:binding.http xmlns:wstxns1=\"http://tuscany.apache.org/xmlns/sca/1.0\" xmlns:ns2=\"http://tuscany.apache.org/xmlns/sca/1.0\" uri=\"http://localhost:8080/uri\">"
- + "<ns2:operationSelector.jsonrpc />"
- + "</wstxns1:binding.http>"
- + "</service>"
- + "</component>"
- + "</composite>";
-
- private static XMLInputFactory inputFactory;
- private static XMLOutputFactory outputFactory;
- private static ExtensibleStAXArtifactProcessor staxProcessor;
- private static Monitor monitor;
-
- @BeforeClass
- public static void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- }
-
- /**
- * Tests the APIs:
- * public OperationSelector getOperationSelector();
- *
- * @throws Exception
- */
- @Test
- public void testWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_WITH_OPERATION_SELECTOR));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- HTTPBinding binding = (HTTPBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- OperationSelector operationSelector = binding.getOperationSelector();
- assertEquals(JSONRPCOperationSelector.class, operationSelector.getClass().getInterfaces()[0]);
- }
-
- @Test
- public void testWriteWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_WITH_OPERATION_SELECTOR));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(COMPOSITE_WITH_OPERATION_SELECTOR);
- // System.out.println(bos.toString());
-
- assertEquals(COMPOSITE_WITH_OPERATION_SELECTOR, bos.toString());
-
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatProcessorTestCase.java b/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatProcessorTestCase.java
deleted file mode 100644
index 994bad4311..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-jsonrpc/src/test/java/org/apache/tuscany/sca/binding/http/wireformat/jsonrpc/impl/JSONRPCWireFormatProcessorTestCase.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.wireformat.jsonrpc.JSONRPCWireFormat;
-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.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
-/**
-* JSON RPC wire format processor tests
-*
-* @version $Rev$ $Date$
-*/
-public class JSONRPCWireFormatProcessorTestCase {
-
- public static final String COMPOSITE_WITH_WIRE_FORMAT =
- "<?xml version='1.0' encoding='UTF-8'?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-http\" name=\"binding-http\">"
- + "<component name=\"HelloWorldComponent\">"
- + "<implementation.java class=\"services.HelloWorld\" />"
- + "<service name=\"HelloWorldService\">"
- + "<wstxns1:binding.http xmlns:wstxns1=\"http://tuscany.apache.org/xmlns/sca/1.0\" xmlns:ns2=\"http://tuscany.apache.org/xmlns/sca/1.0\" uri=\"http://localhost:8080/uri\">"
- + "<ns2:wireFormat.jsonrpc />"
- + "</wstxns1:binding.http>"
- + "</service>"
- + "</component>"
- + "</composite>";
-
- private static XMLInputFactory inputFactory;
- private static XMLOutputFactory outputFactory;
- private static ExtensibleStAXArtifactProcessor staxProcessor;
- private static Monitor monitor;
-
- @BeforeClass
- public static void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- }
-
- /**
- * Tests the APIs:
- * public WireFormat getRequstWireFormat();
- * public WireFormat getResponseWireFormat();
- *
- * @throws Exception
- */
- @Test
- public void testWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_WITH_WIRE_FORMAT));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- HTTPBinding binding = (HTTPBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- WireFormat requestWireFormat = binding.getRequestWireFormat();
- assertEquals(JSONRPCWireFormat.class, requestWireFormat.getClass().getInterfaces()[0]);
-
- WireFormat responseWireFormat = binding.getResponseWireFormat();
- assertEquals(JSONRPCWireFormat.class, responseWireFormat.getClass().getInterfaces()[0]);
- }
-
- @Test
- public void testWriteWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_WITH_WIRE_FORMAT));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(COMPOSITE_WITH_WIRE_FORMAT);
- // System.out.println(bos.toString());
-
- assertEquals(COMPOSITE_WITH_WIRE_FORMAT, bos.toString());
-
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-http-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/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-java-1.5.1/modules/binding-http-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-http-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-http-runtime/pom.xml
deleted file mode 100644
index b632d569ba..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/pom.xml
+++ /dev/null
@@ -1,120 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-http-runtime</artifactId>
- <name>Apache Tuscany SCA HTTP Binding Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-resource-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.http.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.http*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java
deleted file mode 100644
index 12f1143e3a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingListenerServlet.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.provider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URLDecoder;
-import java.text.ParseException;
-import java.util.List;
-
-import javax.servlet.ServletException;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.http.HTTPCacheContext;
-import org.apache.tuscany.sca.binding.http.util.HTTPHeadersParser;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-
-/**
- * Servlet responsible for dispatching HTTP requests to the
- * target component implementation.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingListenerServlet extends HttpServlet {
- private static final long serialVersionUID = 2865466417329430610L;
-
- private static final QName AUTEHTICATION_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","authentication");
-
- transient private Binding binding;
-
- transient private boolean requiresAuthentication = false;
- transient private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
-
- private MessageFactory messageFactory;
- private Invoker getInvoker;
- private Invoker conditionalGetInvoker;
- private Invoker putInvoker;
- private Invoker conditionalPutInvoker;
- private Invoker postInvoker;
- private Invoker conditionalPostInvoker;
- private Invoker deleteInvoker;
- private Invoker conditionalDeleteInvoker;
-
- /**
- * Constructs a new HTTPServiceListenerServlet.
- */
- public HTTPBindingListenerServlet(Binding binding, MessageFactory messageFactory) {
- this.binding = binding;
- this.messageFactory = messageFactory;
-
-
- // find out which policies are active
- if (binding instanceof PolicySetAttachPoint) {
- List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
- for(Intent intent : intents) {
- if(intent.getName().equals(AUTEHTICATION_INTENT)) {
- requiresAuthentication = true;
- }
- }
-
-
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
- } else {
- // etc. check for other types of policy being present
- }
- }
- }
- }
- }
-
-
- @Override
- protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- if(requiresAuthentication) {
- if(! hasAuthorization(request, response)) {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
- }
-
- super.service(request, response);
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.length() ==0) {
- // Redirect to a URL ending with / to make relative hrefs work
- // relative to the served resource.
- response.sendRedirect(request.getRequestURL().append('/').toString());
- return;
- }
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
-
- //store http headers to message
- requestMessage.getHeaders().addAll(HTTPHeadersParser.getHeaders(request));
-
- String id = path.substring(1);
-
- Message responseMessage = null;
- HTTPCacheContext cacheContext = null;
- try {
- cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
- } catch (ParseException e) {
- }
-
- // Route message based on availability of cache info and cache methods
- if (( cacheContext != null ) && (cacheContext.isEnabled()) && (conditionalGetInvoker != null )) {
- requestMessage.setBody(new Object[] {id, cacheContext});
- responseMessage = conditionalGetInvoker.invoke(requestMessage);
- } else {
- requestMessage.setBody(new Object[] {id});
- responseMessage = getInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
-
- int index = -1;
- if ( -1 < (index = body.getClass().getName().indexOf( "NotModifiedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED );
- return;
- } else if ( -1 < (index = body.getClass().getName().indexOf( "PreconditionFailedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED );
- return;
- }
-
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- // Write the response from the service implementation to the response
- // output stream
- InputStream is = (InputStream)responseMessage.getBody();
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- os.flush();
- os.close();
- }
-
- @Override
- protected void doDelete(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.length() ==0) {
- // Redirect to a URL ending with / to make relative hrefs work
- // relative to the served resource.
- response.sendRedirect(request.getRequestURL().append('/').toString());
- return;
- }
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- String id = path.substring(1);
-
- Message responseMessage = null;
- HTTPCacheContext cacheContext = null;
- try {
- cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
- } catch (ParseException e) {
- }
-
- // Route message based on availability of cache info and cache methods
- if (( cacheContext != null ) && (cacheContext.isEnabled()) && (conditionalDeleteInvoker != null )) {
- requestMessage.setBody(new Object[] {id, cacheContext});
- responseMessage = conditionalDeleteInvoker.invoke(requestMessage);
- } else {
- requestMessage.setBody(new Object[] {id});
- responseMessage = deleteInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
-
- int index = -1;
- if ( -1 < (index = body.getClass().getName().indexOf( "NotModifiedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED );
- return;
- } else if ( -1 < (index = body.getClass().getName().indexOf( "PreconditionFailedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED );
- return;
- }
-
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- // Write the response from the service implementation to the response
- // output stream
- InputStream is = (InputStream)responseMessage.getBody();
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- os.flush();
- os.close();
- }
-
- @Override
- protected void doPut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.length() ==0) {
- // Redirect to a URL ending with / to make relative hrefs work
- // relative to the served resource.
- response.sendRedirect(request.getRequestURL().append('/').toString());
- return;
- }
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- String id = path.substring(1);
-
- Message responseMessage = null;
- HTTPCacheContext cacheContext = null;
- try {
- cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
- } catch (ParseException e) {
- }
-
- // Route message based on availability of cache info and cache methods
- if (( cacheContext != null ) && (cacheContext.isEnabled()) && (conditionalPutInvoker != null )) {
- requestMessage.setBody(new Object[] {id, cacheContext});
- responseMessage = conditionalPutInvoker.invoke(requestMessage);
- } else {
- requestMessage.setBody(new Object[] {id});
- responseMessage = putInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
-
- int index = -1;
- if ( -1 < (index = body.getClass().getName().indexOf( "NotModifiedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED );
- return;
- } else if ( -1 < (index = body.getClass().getName().indexOf( "PreconditionFailedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED );
- return;
- }
-
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- // Write the response from the service implementation to the response
- // output stream
- InputStream is = (InputStream)responseMessage.getBody();
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- os.flush();
- os.close();
- }
-
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.length() ==0) {
- // Redirect to a URL ending with / to make relative hrefs work
- // relative to the served resource.
- response.sendRedirect(request.getRequestURL().append('/').toString());
- return;
- }
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- // String id = path.substring(1);
-
- Message responseMessage = null;
- HTTPCacheContext cacheContext = null;
- try {
- cacheContext = HTTPCacheContext.getCacheContextFromRequest(request);
- } catch (ParseException e) {
- }
-
- // Route message based on availability of cache info and cache methods
- if (( cacheContext != null ) && (cacheContext.isEnabled()) && (conditionalPostInvoker != null )) {
- requestMessage.setBody(new Object[] {cacheContext});
- responseMessage = conditionalPostInvoker.invoke(requestMessage);
- } else {
- requestMessage.setBody(new Object[] {});
- responseMessage = postInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- Object body = responseMessage.getBody();
-
- int index = -1;
- if ( -1 < (index = body.getClass().getName().indexOf( "NotModifiedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_NOT_MODIFIED );
- return;
- } else if ( -1 < (index = body.getClass().getName().indexOf( "PreconditionFailedException")) ) {
- if ( index > -1 )
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED, body.toString().substring( index ));
- else
- response.sendError( HttpServletResponse.SC_PRECONDITION_FAILED );
- return;
- }
-
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
-
- // Test if the ETag and LastModified are returned as a cache context.
- Object body = responseMessage.getBody();
- if ( body.getClass() == HTTPCacheContext.class ) {
- // Transfer to header if so.
- HTTPCacheContext cc = (HTTPCacheContext)responseMessage.getBody();
- if (( cc != null ) && ( cc.isEnabled() )) {
- String eTag = cc.getETag();
- if ( eTag != null )
- response.setHeader( "ETag", cc.getETag() );
- String lastModified = cc.getLastModified();
- if ( lastModified != null)
- response.setHeader( "LastModified", cc.getLastModified() );
- }
- }
- }
-
- /**
- * @return the getInvoker
- */
- public Invoker getGetInvoker() {
- return getInvoker;
- }
-
- /**
- * @param getInvoker the getInvoker to set
- */
- public void setGetInvoker(Invoker getInvoker) {
- this.getInvoker = getInvoker;
- }
-
- /**
- * @return the conditionalGetInvoker
- */
- public Invoker getConditionalGetInvoker() {
- return conditionalGetInvoker;
- }
-
- /**
- * @param conditionalGetInvoker the conditionalGetInvoker to set
- */
- public void setConditionalGetInvoker(Invoker conditionalGetInvoker) {
- this.conditionalGetInvoker = conditionalGetInvoker;
- }
-
- /**
- * @return the putInvoker
- */
- public Invoker getPutInvoker() {
- return putInvoker;
- }
-
- /**
- * @param putInvoker the putInvoker to set
- */
- public void setPutInvoker(Invoker putInvoker) {
- this.putInvoker = putInvoker;
- }
-
- /**
- * @return the conditionalPutInvoker
- */
- public Invoker getConditionalPutInvoker() {
- return conditionalPutInvoker;
- }
-
- /**
- * @param conditionalPutInvoker the conditionalPutInvoker to set
- */
- public void setConditionalPutInvoker(Invoker conditionalPutInvoker) {
- this.conditionalPutInvoker = conditionalPutInvoker;
- }
-
- /**
- * @return the postInvoker
- */
- public Invoker getPostInvoker() {
- return postInvoker;
- }
-
- /**
- * @param postInvoker the postInvoker to set
- */
- public void setPostInvoker(Invoker postInvoker) {
- this.postInvoker = postInvoker;
- }
-
- /**
- * @return the conditionalPostInvoker
- */
- public Invoker getConditionalPostInvoker() {
- return conditionalPostInvoker;
- }
-
- /**
- * @param conditionalPostInvoker the conditionalPostInvoker to set
- */
- public void setConditionalPostInvoker(Invoker conditionalPostInvoker) {
- this.conditionalPostInvoker = conditionalPostInvoker;
- }
-
- /**
- * @return the deleteInvoker
- */
- public Invoker getDeleteInvoker() {
- return deleteInvoker;
- }
-
- /**
- * @param deleteInvoker the deleteInvoker to set
- */
- public void setDeleteInvoker(Invoker deleteInvoker) {
- this.deleteInvoker = deleteInvoker;
- }
-
- /**
- * @return the conditionalDeleteInvoker
- */
- public Invoker getConditionalDeleteInvoker() {
- return conditionalDeleteInvoker;
- }
-
- /**
- * @param conditionalDeleteInvoker the conditionalDeleteInvoker to set
- */
- public void setConditionalDeleteInvoker(Invoker conditionalDeleteInvoker) {
- this.conditionalDeleteInvoker = conditionalDeleteInvoker;
- }
-
-
- /**
- * Utility Methods related to Policy
- */
-
-
- private boolean hasAuthorization(HttpServletRequest request, ServletResponse response) {
- boolean result = false;
- if(request.getHeader("Authorization") != null) {
- result = true;
- }
-
- return result;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java
deleted file mode 100644
index 768636d478..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPBindingProviderFactory.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.provider;
-
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-
-/**
- * Factory for HTTP binding providers.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingProviderFactory implements BindingProviderFactory<HTTPBinding> {
- private ExtensionPointRegistry extensionPoints;
- private MessageFactory messageFactory;
- private ServletHost servletHost;
-
- public HTTPBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, HTTPBinding binding) {
- return null;
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, HTTPBinding binding) {
- return new HTTPServiceBindingProvider(component, service, binding, extensionPoints, messageFactory, servletHost);
- }
-
- public Class<HTTPBinding> getModelType() {
- return HTTPBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.java
deleted file mode 100644
index e20d420d49..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPGetListenerServlet.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.binding.http.provider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URLDecoder;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-
-/**
- * Servlet responsible for dispatching HTTP GET requests to the
- * target component implementation.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPGetListenerServlet extends HttpServlet {
- private static final long serialVersionUID = 2865466417329430610L;
-
- private MessageFactory messageFactory;
- private Invoker getInvoker;
-
- /**
- * Constructs a new HTTPServiceListenerServlet.
- */
- public HTTPGetListenerServlet(Invoker getInvoker, MessageFactory messageFactory) {
- this.getInvoker = getInvoker;
- this.messageFactory = messageFactory;
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.length() ==0) {
-
- // Redirect to a URL ending with / to make relative hrefs work
- // relative to the served resource.
- response.sendRedirect(request.getRequestURL().append('/').toString());
- return;
- }
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- String id = path.substring(1);
- requestMessage.setBody(new Object[] {id});
- Message responseMessage = getInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
-
- // Write the response from the service implementation to the response
- // output stream
- InputStream is = (InputStream)responseMessage.getBody();
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- os.flush();
- os.close();
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPRRBListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPRRBListenerServlet.java
deleted file mode 100644
index 605e2c6211..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPRRBListenerServlet.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.provider;
-
-import java.io.BufferedReader;
-import java.io.CharArrayWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.http.HTTPBindingContext;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-
-public class HTTPRRBListenerServlet extends HttpServlet {
-
- private static final long serialVersionUID = 6688524143716091739L;
-
- transient private Binding binding;
- transient private Invoker bindingInvoker;
- transient private MessageFactory messageFactory;
-
- /**
- * Constructs a new HTTPServiceListenerServlet.
- */
- public HTTPRRBListenerServlet(Binding binding, Invoker bindingInvoker, MessageFactory messageFactory) {
- this.binding = binding;
- this.bindingInvoker = bindingInvoker;
- this.messageFactory = messageFactory;
- }
-
- public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Decode using the charset in the request if it exists otherwise
- // use UTF-8 as this is what all browser implementations use.
- // The JSON-RPC-Java JavaScript client is ASCII clean so it
- // although here we can correctly handle data from other clients
- // that do not escape non ASCII data
- String charset = request.getCharacterEncoding();
- if (charset == null) {
- charset = "UTF-8";
- }
- BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), charset));
-
- // Read the request
- CharArrayWriter data = new CharArrayWriter();
- char[] buf = new char[4096];
- int ret;
- while ((ret = in.read(buf, 0, 4096)) != -1) {
- data.write(buf, 0, ret);
- }
-
- HTTPBindingContext bindingContext = new HTTPBindingContext();
- bindingContext.setHttpRequest(request);
- bindingContext.setHttpResponse(response);
-
- // Dispatch the service interaction to the service invoker
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBindingContext(bindingContext);
- requestMessage.setBody(new Object[]{data});
-
- Message responseMessage = bindingInvoker.invoke(requestMessage);
-
- // return response to client
- if (responseMessage.isFault()) {
- // Turn a fault into an exception
- //throw new ServletException((Throwable)responseMessage.getBody());
- Throwable e = (Throwable)responseMessage.getBody();
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- } else {
- byte[] bout;
- bout = responseMessage.<Object>getBody().toString().getBytes("UTF-8");
- response.getOutputStream().write(bout);
- response.getOutputStream().flush();
- response.getOutputStream().close();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
deleted file mode 100644
index 8e84d04b76..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceBindingProvider.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.provider;
-
-import java.util.List;
-
-import javax.servlet.Servlet;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.SecurityContext;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.authentication.AuthenticationConfigurationPolicy;
-import org.apache.tuscany.sca.policy.confidentiality.ConfidentialityPolicy;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of an HTTP binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPServiceBindingProvider implements ServiceBindingProviderRRB {
- private static final QName AUTEHTICATION_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","authentication");
- private static final QName CONFIDENTIALITY_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","confidentiality");
-
- private ExtensionPointRegistry extensionPoints;
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private InterfaceContract serviceContract;
- private HTTPBinding binding;
- private MessageFactory messageFactory;
-
- private OperationSelectorProvider osProvider;
- private WireFormatProvider wfProvider;
-
- private ServletHost servletHost;
- private String servletMapping;
- private HTTPBindingListenerServlet bindingListenerServlet;
-
- public HTTPServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- HTTPBinding binding,
- ExtensionPointRegistry extensionPoints,
- MessageFactory messageFactory,
- ServletHost servletHost) {
- this.component = component;
- this.service = service;
-
- this.binding = binding;
- this.extensionPoints = extensionPoints;
- this.messageFactory = messageFactory;
- this.servletHost = servletHost;
-
- // retrieve operation selector and wire format service providers
-
- ProviderFactoryExtensionPoint providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
-
- if (binding.getOperationSelector() != null) {
- // Configure the interceptors for operation selection
- OperationSelectorProviderFactory osProviderFactory = (OperationSelectorProviderFactory) providerFactories.getProviderFactory(binding.getOperationSelector().getClass());
- if (osProviderFactory != null) {
- this.osProvider = osProviderFactory.createServiceOperationSelectorProvider(component, service, binding);
- }
- }
-
- if (binding.getRequestWireFormat() != null && binding.getResponseWireFormat() != null) {
- // Configure the interceptors for wire format
- WireFormatProviderFactory wfProviderFactory = (WireFormatProviderFactory) providerFactories.getProviderFactory(binding.getRequestWireFormat().getClass());
- if (wfProviderFactory != null) {
- this.wfProvider = wfProviderFactory.createServiceWireFormatProvider(component, service, binding);
- }
- }
-
-
-
- //clone the service contract to avoid databinding issues
- try {
- this.serviceContract = (InterfaceContract) service.getInterfaceContract().clone();
-
- // configure data binding
- if (this.wfProvider != null) {
- wfProvider.configureWireFormatInterfaceContract(service.getInterfaceContract());
- }
- } catch(CloneNotSupportedException e) {
- this.serviceContract = service.getInterfaceContract();
- }
-
- }
-
- public void start() {
- // Get the invokers for the supported operations
- RuntimeComponentService componentService = (RuntimeComponentService) service;
- RuntimeWire wire = componentService.getRuntimeWire(binding);
- Servlet servlet = null;
- bindingListenerServlet = new HTTPBindingListenerServlet(binding, messageFactory );
- for (InvocationChain invocationChain : wire.getInvocationChains()) {
- Operation operation = invocationChain.getTargetOperation();
- String operationName = operation.getName();
- if (binding.getOperationSelector() != null || binding.getRequestWireFormat() != null) {
- Invoker bindingInvoker = wire.getBindingInvocationChain().getHeadInvoker();
- servlet = new HTTPRRBListenerServlet(binding, bindingInvoker, messageFactory);
- break;
- } else if (operationName.equals("get")) {
- Invoker getInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setGetInvoker(getInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("conditionalGet")) {
- Invoker conditionalGetInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setConditionalGetInvoker(conditionalGetInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("delete")) {
- Invoker deleteInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setDeleteInvoker(deleteInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("conditionalDelete")) {
- Invoker conditionalDeleteInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setConditionalDeleteInvoker(conditionalDeleteInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("put")) {
- Invoker putInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setPutInvoker(putInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("conditionalPut")) {
- Invoker conditionalPutInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setConditionalPutInvoker(conditionalPutInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("post")) {
- Invoker postInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setPostInvoker(postInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("conditionalPost")) {
- Invoker conditionalPostInvoker = invocationChain.getHeadInvoker();
- bindingListenerServlet.setConditionalPostInvoker(conditionalPostInvoker);
- servlet = bindingListenerServlet;
- } else if (operationName.equals("service")) {
- Invoker serviceInvoker = invocationChain.getHeadInvoker();
- servlet = new HTTPServiceListenerServlet(binding, serviceInvoker, messageFactory);
- break;
- }
- }
- if (servlet == null) {
- throw new IllegalStateException("No get or service method found on the service");
- }
-
- // Create our HTTP service listener Servlet and register it with the
- // Servlet host
- servletMapping = binding.getURI();
- if (!servletMapping.endsWith("/")) {
- servletMapping += "/";
- }
- if (!servletMapping.endsWith("*")) {
- servletMapping += "*";
- }
-
-
- SecurityContext securityContext = new SecurityContext();
- boolean isConfidentialityRequired = false;
- boolean isAuthenticationRequired = false;
-
-
- // find out which policies are active
- if (binding instanceof PolicySetAttachPoint) {
- List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
- for(Intent intent : intents) {
- if (intent.getName().equals(AUTEHTICATION_INTENT)) {
- isAuthenticationRequired = true;
- } else if (intent.getName().equals(CONFIDENTIALITY_INTENT)) {
- isConfidentialityRequired = true;
- }
- }
-
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (ConfidentialityPolicy.class.isInstance(p) && isConfidentialityRequired) {
- //Handle enabling and configuring SSL
- ConfidentialityPolicy confidentialityPolicy = (ConfidentialityPolicy)p;
-
- securityContext.setSSLEnabled(true);
- securityContext.setSSLProperties(confidentialityPolicy.toProperties());
- } else if(AuthenticationConfigurationPolicy.class.isInstance(p) && isAuthenticationRequired) {
- // Handle authentication and user configuration
- AuthenticationConfigurationPolicy authenticationConfiguration = (AuthenticationConfigurationPolicy)p;
-
- securityContext.setAuthenticationEnabled(true);
- securityContext.getUsers().clear();
- securityContext.getUsers().addAll(authenticationConfiguration.getUsers());
- }
- }
- }
- }
-
-
- servletHost.addServletMapping(servletMapping, servlet, securityContext);
- }
-
- public void stop() {
- // Unregister the Servlet from the Servlet host
- servletHost.removeServletMapping(servletMapping);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- /**
- * Add specific http interceptor to invocation chain
- * @param runtimeWire
- */
- public void configureBindingChain(RuntimeWire runtimeWire) {
-
- InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
-
- if(osProvider != null) {
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR, osProvider.createInterceptor());
- }
-
- if (wfProvider != null) {
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT, wfProvider.createInterceptor());
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java
deleted file mode 100644
index 493255655d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/provider/HTTPServiceListenerServlet.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.provider;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-
-/**
- * Servlet responsible for dispatching HTTP service requests to the
- * target component implementation.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPServiceListenerServlet implements Servlet {
- private static final QName AUTEHTICATION_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0","authentication");
-
- transient private Binding binding;
- transient private ServletConfig config;
- transient private MessageFactory messageFactory;
- transient private Invoker serviceInvoker;
-
- transient private boolean requiresAuthentication = false;
- transient private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
-
- /**
- * Constructs a new HTTPServiceListenerServlet.
- */
- public HTTPServiceListenerServlet(Binding binding, Invoker serviceInvoker, MessageFactory messageFactory) {
- this.binding = binding;
- this.serviceInvoker = serviceInvoker;
- this.messageFactory = messageFactory;
-
- // find out which policies are active
- if (binding instanceof PolicySetAttachPoint) {
- List<Intent> intents = ((PolicySetAttachPoint)binding).getRequiredIntents();
- for(Intent intent : intents) {
- if(intent.getName().equals(AUTEHTICATION_INTENT)) {
- requiresAuthentication = true;
- }
- }
-
-
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
- } else {
- // etc. check for other types of policy being present
- }
- }
- }
- }
- }
-
- public ServletConfig getServletConfig() {
- return config;
- }
-
- public String getServletInfo() {
- return "";
- }
-
- public void init(ServletConfig config) throws ServletException {
- this.config = config;
- }
-
- public void destroy() {
-
- }
-
- public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
-
- if(requiresAuthentication) {
- if(! hasAuthenticationHeader((HttpServletRequest)request, (HttpServletResponse)response)) {
- ((HttpServletResponse)response).sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
- }
-
- // Dispatch the service interaction to the service invoker
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setBody(new Object[]{request, response});
- Message responseMessage = serviceInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- // Turn a fault into an exception
- //throw new ServletException((Throwable)responseMessage.getBody());
- Throwable e = (Throwable)responseMessage.getBody();
- ((HttpServletResponse)response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- }
- }
-
-
- private boolean hasAuthenticationHeader(HttpServletRequest request, ServletResponse response) {
- boolean result = false;
- if(request.getHeader("Authorization") != null) {
- result = true;
- }
-
- return result;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/util/HTTPHeadersParser.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/util/HTTPHeadersParser.java
deleted file mode 100644
index 1fe4600e31..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/java/org/apache/tuscany/sca/binding/http/util/HTTPHeadersParser.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.util;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.tuscany.sca.binding.http.HTTPHeader;
-
-public class HTTPHeadersParser {
-
- /**
- * Parse http request headers to a map
- *
- * @param request
- * @return
- */
- public static List<HTTPHeader> getHeaders(HttpServletRequest request) {
- List<HTTPHeader> headers = new ArrayList<HTTPHeader>();
-
- Enumeration<?> headerNames = request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- String headerName = (String) headerNames.nextElement();
- Object headerValue = request.getHeader(headerName);
- HTTPHeader header = new HTTPHeader(headerName, headerValue);
- headers.add(header);
- }
- return headers;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 0fa8d44c08..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.http.provider.HTTPBindingProviderFactory;model=org.apache.tuscany.sca.binding.http.HTTPBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java
deleted file mode 100644
index bb5f6d5a8b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingCacheTestCase.java
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.http;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.text.MessageFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * HTTP binding unit tests.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingCacheTestCase extends TestCase {
- // RFC 822 date time
- protected static final SimpleDateFormat dateFormat = new SimpleDateFormat(
- "EEE, dd MMM yyyy HH:mm:ss Z");
-
- // Request with no predicates in header.
- private static final String REQUEST1 = "{0} /httpbinding/{1} HTTP/1.0\n"
- + "Host: localhost\n" + "Content-Type: text/xml\n"
- + "Connection: close\n" + "Content-Length: {2}" + "\n\n{3}";
-
- // Request with predicates in header
- private static final String REQUEST2 = "{0} /httpbinding/{1} HTTP/1.0\n"
- + "Host: localhost\n" + "Content-Type: text/xml\n" + "{2}: {3}\n" // predicate (If-Match, If-None-Match, If-Modified-Since, If-NotModified-Since): value (date or ETag)
- + "Connection: close\n" + "Content-Length: {4}" + "\n\n{5}";
-
- private static final int HTTP_PORT = 8085;
-
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("testCache.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- /**
- * Test invoking a POJO get method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testGet() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST1, "GET", index, content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfModifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfModifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 304 Not Modified.
- assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfUnmodifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Unmodified-Since", dateFormat.format(new Date()), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfUnmodifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Unmodified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 412 precondition failed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfNoneMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 412 precondition failed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalGetIfNoneMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "GET", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a POJO get method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testDelete() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST1, "DELETE", index,
- content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("deleted item=" + index) != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfModifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfModifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 304 Not Modified.
- assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfUnmodifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Unmodified-Since", dateFormat.format(new Date()), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfUnmodifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Unmodified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 412 precondition failed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfNoneMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 412 precondition failed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalDeleteIfNoneMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "DELETE", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("deleted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a POJO get method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testPost() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST1, "POST", index, content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfModifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-Modified-Since", dateFormat.format(new Date()), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return code 200 OK
- // assertTrue(document.indexOf("posted item=" + index) != -1);
- assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfModifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("posted item=" + index) != -1);
- // Should return code 304 Not Modified.
- assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfUnmodifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-Unmodified-Since", dateFormat.format(new Date()), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return code 200 OK
- assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfUnmodifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-Unmodified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("posted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-Match", "eTagMatch", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return code 200 OK.
- assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
- // Should return code 412 precondition failed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat
- .format(REQUEST2, "POST", index, "If-Match", "eTagNoneMatch",
- content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("posted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfNoneMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-None-Match", "eTagNoneMatch", content.getBytes().length,
- content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return code 200 OK
- assertTrue(document.indexOf("HTTP/1.1 200 OK") != -1);
- // Should return code 412 precondition failed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPostIfNoneMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "POST", index,
- "If-None-Match", "eTagMatch", content.getBytes().length,
- content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("posted item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a POJO get method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testPut() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST1, "PUT", index, content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("updated item=" + index) != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfModifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfModifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Modified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 304 Not Modified.
- assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfUnmodifiedNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Unmodified-Since", dateFormat.format(new Date()), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 304 Not Modified.
- // assertTrue(document.indexOf("HTTP/1.1 304") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfUnmodifiedPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Unmodified-Since", dateFormat.format(new Date(0)), content
- .getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 412 precondition failed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfNoneMatchNegative() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 1;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 412 precondition failed.
- // assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Test invoking a conditional method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testConditionalPutIfNoneMatchPositive() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String content = "";
- String request = MessageFormat.format(REQUEST2, "PUT", index,
- "If-None-Match", "eTagXXX", content.getBytes().length, content);
- os.write(request.getBytes());
- os.flush();
-
- String document = read(client);
- // Should return item
- // assertTrue(document.indexOf("updated item=" + index) != -1);
- // Should return code 412 PreconditionFailed.
- assertTrue(document.indexOf("HTTP/1.1 412") != -1);
- }
-
- /**
- * Read response stream from the given socket.
- * @param socket
- * @return
- * @throws IOException
- */
- private static String read(Socket socket) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(socket
- .getInputStream()));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
deleted file mode 100644
index e5cad080a6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/HTTPBindingTestCase.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.http;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.text.MessageFormat;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * HTTP binding unit tests.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingTestCase extends TestCase {
-
- private static final String REQUEST1_HEADER =
- "GET /httpservice/test HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST1_CONTENT = "";
- private static final String REQUEST1 =
- REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
-
- private static final String REQUEST2_HEADER =
- "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST2_CONTENT = "";
- private static final String REQUEST2 =
- REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
-
- private static final String REQUEST3_HEADER =
- "GET /httpget/{0} HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST3_CONTENT = "";
- private static final String REQUEST3 =
- REQUEST3_HEADER + REQUEST3_CONTENT.getBytes().length + "\n\n" + REQUEST3_CONTENT;
-
- private static final int HTTP_PORT = 8085;
-
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("test.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- /**
- * Test invoking a POJO service implementation using the HTTP binding.
- * @throws Exception
- */
- public void testServiceImplementation() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hey</body>") != -1);
- }
-
- /**
- * Test invoking a POJO get method implementation using the HTTP binding.
- * @throws Exception
- */
- public void testGetImplementation() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- int index = 0;
- String request = MessageFormat.format( REQUEST3, index );
- os.write( request.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>item=" + index) != -1);
- }
-
- /**
- * Test getting a static resource provided using the HTTP binding.
- * @throws Exception
- */
- public void testStaticResourceImplementation() throws Exception {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST2.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
- }
-
- /**
- * Read response stream from the given socket.
- * @param socket
- * @return
- * @throws IOException
- */
- private static String read(Socket socket) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/NotModifiedException.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/NotModifiedException.java
deleted file mode 100644
index 1d6efea2a1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/NotModifiedException.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.binding.http;
-
-/**
- * Indicates that a resource was not modified.
- *
- * @version $Rev$ $Date$
- */
-public class NotModifiedException extends Exception {
- private static final long serialVersionUID = -5046027674128627383L;
-
- public NotModifiedException() {
- }
-
- public NotModifiedException(String message) {
- super(message);
- }
-
- public NotModifiedException(Throwable cause) {
- super(cause);
- }
-
- public NotModifiedException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/PreconditionFailedException.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/PreconditionFailedException.java
deleted file mode 100644
index 5728899ebe..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/PreconditionFailedException.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.binding.http;
-
-/**
- * Indicates that a resource was not modified.
- *
- * @version $Rev$ $Date$
- */
-public class PreconditionFailedException extends Exception {
- private static final long serialVersionUID = -5046027674128627383L;
-
- public PreconditionFailedException() {
- }
-
- public PreconditionFailedException(String message) {
- super(message);
- }
-
- public PreconditionFailedException(Throwable cause) {
- super(cause);
- }
-
- public PreconditionFailedException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java
deleted file mode 100644
index f2456f3175..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestBindingCacheImpl.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Date;
-
-/**
- * Test service implementation that implements a various conditional HTTP
- * methods. For testing, the id==0 items are very old (Date(0)), not modified,
- * and always match ETags and the id==1 items are always brand new (Date()),
- * modified, and never match ETags. Using these ids one can test the
- * LastModified and ETag headers of the requests.
- *
- * @version $Rev$ $Date$
- */
-public class TestBindingCacheImpl {
-
- /**
- * Implements the HTTP get method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream get(String id) {
- return new ByteArrayInputStream(
- ("<html><body><p>item=" + id + "</body></html>").getBytes());
- }
-
- /**
- * Implements the HTTP conditional get method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream conditionalGet(String id, HTTPCacheContext cacheContext)
- throws NotModifiedException, PreconditionFailedException {
-
- if (cacheContext != null) {
- if (cacheContext.ifModifiedSince) {
- if ((id.equals("1"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new NotModifiedException("item 1 was modified on "
- + new Date());
- }
- if (cacheContext.ifUnmodifiedSince) {
- if ((id.equals("0"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new PreconditionFailedException(
- "item 0 was modified on " + new Date(0));
- }
- if (cacheContext.ifMatch) {
- if (id.equals("1"))
- throw new PreconditionFailedException(
- "item 1 eTag does not match "
- + cacheContext.getETag());
- }
- if (cacheContext.ifNoneMatch) {
- if (id.equals("0"))
- throw new PreconditionFailedException(
- "item 0 eTag matches " + cacheContext.getETag());
- }
- }
- return new ByteArrayInputStream(
- ("<html><body><p>item=" + id + "</body></html>").getBytes());
- }
-
- /**
- * Implements the HTTP delete method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream delete(String id) {
- return new ByteArrayInputStream(
- ("<html><body><p>deleted item=" + id + "</body></html>")
- .getBytes());
- }
-
- /**
- * Implements the HTTP conditional delete method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream conditionalDelete(String id, HTTPCacheContext cacheContext)
- throws NotModifiedException, PreconditionFailedException {
-
- if (cacheContext != null) {
- if (cacheContext.ifModifiedSince) {
- if ((id.equals("1"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new NotModifiedException("item 1 was modified on "
- + new Date());
- }
- if (cacheContext.ifUnmodifiedSince) {
- if ((id.equals("0"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new PreconditionFailedException(
- "item 0 was modified on " + new Date(0));
- }
- if (cacheContext.ifMatch) {
- if (id.equals("1"))
- throw new PreconditionFailedException(
- "item 1 eTag does not match "
- + cacheContext.getETag());
- }
- if (cacheContext.ifNoneMatch) {
- if (id.equals("0"))
- throw new PreconditionFailedException(
- "item 0 eTag matches " + cacheContext.getETag());
- }
- }
- return new ByteArrayInputStream(
- ("<html><body><p>deleted item=" + id + "</body></html>")
- .getBytes());
- }
-
- /**
- * Implements the HTTP post method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream post() {
- int id = (new java.util.Random()).nextInt(Integer.MAX_VALUE);
- return new ByteArrayInputStream(
- ("<html><body><p>posted item=" + id + "</body></html>")
- .getBytes());
- }
-
- /**
- * Implements the HTTP conditional post method of the collection implementation.
- * @param id
- * @return
- */
- public HTTPCacheContext conditionalPost(HTTPCacheContext cacheContext)
- throws NotModifiedException, PreconditionFailedException {
- String id = "" + (new java.util.Random()).nextInt(Integer.MAX_VALUE);
-
- if (cacheContext != null) {
- if (cacheContext.ifModifiedSince) {
- if (0 >= cacheContext.lastModifiedDate.compareTo(new Date(0)))
- throw new NotModifiedException("item was modified on "
- + new Date());
- }
- if (cacheContext.ifUnmodifiedSince) {
- if ((0 >= cacheContext.lastModifiedDate.compareTo(new Date(0))))
- throw new PreconditionFailedException(
- "item was modified on " + new Date(0));
- }
- if (cacheContext.ifMatch) {
- if (cacheContext.getETag().equalsIgnoreCase("ETagNoneMatch"))
- throw new PreconditionFailedException(
- "item eTag does not match "
- + cacheContext.getETag());
- }
- if (cacheContext.ifNoneMatch) {
- if (cacheContext.getETag().equalsIgnoreCase("ETagMatch"))
- throw new PreconditionFailedException("item eTag matches "
- + cacheContext.getETag());
- }
- }
-
- // Return the ETag and LastModfied fields by serialize to a byte array
- HTTPCacheContext returnContext = new HTTPCacheContext();
- returnContext.setETag( "ETag" + (new java.util.Random()).nextInt(Integer.MAX_VALUE) );
- returnContext.setLastModified( new Date() );
- return returnContext;
- }
-
- /**
- * Implements the HTTP update/put method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream put(String id) {
- return new ByteArrayInputStream(
- ("<html><body><p>updated item=" + id + "</body></html>")
- .getBytes());
- }
-
- /**
- * Implements the HTTP conditional update/put method of the collection implementation.
- * @param id
- * @return
- */
- public InputStream conditionalPut(String id, HTTPCacheContext cacheContext)
- throws NotModifiedException, PreconditionFailedException {
-
- if (cacheContext != null) {
- if (cacheContext.ifModifiedSince) {
- if ((id.equals("1"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new NotModifiedException("item 1 was modified on "
- + new Date());
- }
- if (cacheContext.ifUnmodifiedSince) {
- if ((id.equals("0"))
- && (0 > cacheContext.lastModifiedDate
- .compareTo(new Date())))
- throw new PreconditionFailedException(
- "item 0 was modified on " + new Date(0));
- }
- if (cacheContext.ifMatch) {
- if (id.equals("1"))
- throw new PreconditionFailedException(
- "item 1 eTag does not match "
- + cacheContext.getETag());
- }
- if (cacheContext.ifNoneMatch) {
- if (id.equals("0"))
- throw new PreconditionFailedException(
- "item 0 eTag matches " + cacheContext.getETag());
- }
- }
-
- return new ByteArrayInputStream(
- ("<html><body><p>updated item=" + id + "</body></html>")
- .getBytes());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.java
deleted file mode 100644
index 333bacbab3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestGetImpl.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.binding.http;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-/**
- * Test service implementation that implements a get method.
- *
- * @version $Rev$ $Date$
- */
-public class TestGetImpl {
-
- public InputStream get(String id) {
- return new ByteArrayInputStream(("<html><body><p>item=" + id + "</body></html>").getBytes());
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.java
deleted file mode 100644
index ed846c1127..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceCacheImpl.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.binding.http;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.osoa.sca.annotations.Service;
-
-/**
- * Test service implementation.
- *
- * @version $Rev$ $Date$
- */
-
-@Service(Servlet.class)
-public class TestServiceCacheImpl implements Servlet {
-
- public void init(ServletConfig config) throws ServletException {
- }
-
- public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- //HttpServletResponse httpResponse = (HttpServletResponse)response;
- response.getOutputStream().print("<html><body><p>hey</body></html>");
- }
-
- public void destroy() {
- }
-
- public ServletConfig getServletConfig() {
- return null;
- }
-
- public String getServletInfo() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.java
deleted file mode 100644
index 11945c8cd1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/java/org/apache/tuscany/sca/binding/http/TestServiceImpl.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.binding.http;
-
-import java.io.IOException;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-import org.osoa.sca.annotations.Service;
-
-/**
- * Test service implementation.
- *
- * @version $Rev$ $Date$
- */
-
-@Service(Servlet.class)
-public class TestServiceImpl implements Servlet {
-
- public void init(ServletConfig config) throws ServletException {
- }
-
- public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- //HttpServletResponse httpResponse = (HttpServletResponse)response;
- response.getOutputStream().print("<html><body><p>hey</body></html>");
- }
-
- public void destroy() {
- }
-
- public ServletConfig getServletConfig() {
- return null;
- }
-
- public String getServletInfo() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/content/test.html b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/content/test.html
deleted file mode 100644
index f4b79d7f01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/content/test.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<body><p>hello</body>
-</html> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/test.composite b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/test.composite
deleted file mode 100644
index 62c4af4e22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/test.composite
+++ /dev/null
@@ -1,47 +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"
- targetNamespace="http://sample/test"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sr="http://sample/test"
- name="test">
-
- <component name="ResourceServiceComponent">
- <tuscany:implementation.resource location="content"/>
- <service name="Resource">
- <tuscany:binding.http uri="http://localhost:8085/webcontent"/>
- </service>
- </component>
-
- <component name="HTTPServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.http.TestServiceImpl"/>
- <service name="Servlet">
- <tuscany:binding.http uri="http://localhost:8085/httpservice"/>
- </service>
- </component>
-
- <component name="HTTPGetComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.http.TestGetImpl"/>
- <service name="TestGetImpl">
- <tuscany:binding.http uri="http://localhost:8085/httpget"/>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/testCache.composite b/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/testCache.composite
deleted file mode 100644
index d805402c4f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http-runtime/src/test/resources/testCache.composite
+++ /dev/null
@@ -1,33 +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"
- targetNamespace="http://sample/test"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sr="http://sample/test"
- name="test">
-
- <component name="HTTPBindingComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.http.TestBindingCacheImpl"/>
- <service name="TestBindingCacheImpl">
- <tuscany:binding.http uri="http://localhost:8085/httpbinding"/>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-http/LICENSE b/branches/sca-java-1.5.1/modules/binding-http/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/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-java-1.5.1/modules/binding-http/NOTICE b/branches/sca-java-1.5.1/modules/binding-http/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-http/pom.xml b/branches/sca-java-1.5.1/modules/binding-http/pom.xml
deleted file mode 100644
index 4dfbcbb6de..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/pom.xml
+++ /dev/null
@@ -1,87 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-http</artifactId>
- <name>Apache Tuscany SCA HTTP Binding Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.http</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.http*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.java
deleted file mode 100644
index 3a749c5f29..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBinding.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.binding.http;
-
-import org.apache.tuscany.sca.assembly.BindingRRB;
-
-
-/**
- * HTTP binding model.
- *
- * @version $Rev$ $Date$
-*/
-public interface HTTPBinding extends BindingRRB {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java
deleted file mode 100644
index f7e5bac606..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * HTTP Binding Context
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingContext {
- private HttpServletRequest request;
- private HttpServletResponse response;
-
- public HttpServletRequest getHttpRequest() {
- return request;
- }
- public void setHttpRequest(HttpServletRequest request) {
- this.request = request;
- }
- public HttpServletResponse getHttpResponse() {
- return response;
- }
- public void setHttpResponse(HttpServletResponse response) {
- this.response = response;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.java
deleted file mode 100644
index e66896c68e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPBindingFactory.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.binding.http;
-
-/**
- * Factory for the HTTP binding model.
- *
- * @version $Rev$ $Date$
- */
-public interface HTTPBindingFactory {
-
- /**
- * Creates a new HTTP binding.
- * @return a new HTTP binding
- */
- HTTPBinding createHTTPBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.java
deleted file mode 100644
index fb9242c26c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPCacheContext.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.binding.http;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * A class to store cache settings for Atom and HTTP requests and responses.
- *
- * Predicates are statements that work in conjunction with
- * ETags and LastModified dates to determine if a precondition
- * or postcondition is satisfied.
- * See HTTP specification for how predicates wrk:
- * http://tools.ietf.org/html/rfc2616
- * Example predicates in HTTP include If-Match, If-None-Match,
- * If-Modified-Since, If-Unmodified-Since, If-Range.
-
- */
-public class HTTPCacheContext {
- public static final SimpleDateFormat RFC822DateFormat = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z" ); // RFC 822 date time
-
- public boolean enabled;
- public String eTag;
- public String lastModified;
- public Date lastModifiedDate;
- public boolean ifModifiedSince;
- public boolean ifUnmodifiedSince;
- public boolean ifMatch;
- public boolean ifNoneMatch;
- public boolean ifRange;
-
- /**
- * An ETag is a unique ID for an item. It changes when
- * a field in the item or the update date changes.
- * See HTTP specification for how ETags work:
- * http://tools.ietf.org/html/rfc2616
- * @return the eTag
- */
- public String getETag() {
- return eTag;
- }
- /**
- * @param tag the eTag to set
- */
- public void setETag(String tag) {
- eTag = tag;
- enabled = true;
- }
- /**
- * The LastModified date is the time the item was last
- * changed. See HTTP specification for how ETags work:
- * http://tools.ietf.org/html/rfc2616
- * @return the lastModified
- */
- public String getLastModified() {
- return lastModified;
- }
- /**
- * The LastModified date is the time the item was last
- * changed. See HTTP specification for how ETags work:
- * http://tools.ietf.org/html/rfc2616
- * @return the lastModified
- */
- public Date getLastModifiedAsDate() {
- return lastModifiedDate;
- }
- /**
- * @param lastModified the lastModified to set
- */
- public void setLastModified(String lastModified) throws java.text.ParseException {
- this.lastModified = lastModified;
- // Catch date formatting on input to help debugging.
- lastModifiedDate = RFC822DateFormat.parse( lastModified );
- enabled = true;
- }
-
- /**
- * @param lastModified the lastModified to set
- */
- public void setLastModified(Date updated) {
- this.lastModified = RFC822DateFormat.format( updated );
- lastModifiedDate = updated;
- enabled = true;
- }
-
- /**
- * @return the ifModifedSince
- */
- public boolean isIfModifiedSince() {
- return ifModifiedSince;
- }
- /**
- * @param ifModifedSince the ifModifedSince to set
- */
- public void setIfModifiedSince(boolean ifModifiedSince) {
- this.ifModifiedSince = ifModifiedSince;
- if ( ifModifiedSince )
- enabled = true;
- }
- /**
- * @return the ifUnModifiedSince
- */
- public boolean isIfUnmodifiedSince() {
- return ifUnmodifiedSince;
- }
- /**
- * @param ifUnModifiedSince the ifUnModifiedSince to set
- */
- public void setIfUnmodifiedSince(boolean ifUnmodifiedSince) {
- this.ifUnmodifiedSince = ifUnmodifiedSince;
- if ( ifUnmodifiedSince )
- enabled = true;
- }
- /**
- * @return the ifMatch
- */
- public boolean isIfMatch() {
- return ifMatch;
- }
- /**
- * @param ifMatch the ifMatch to set
- */
- public void setIfMatch(boolean ifMatch) {
- this.ifMatch = ifMatch;
- if ( ifMatch )
- enabled = true;
- }
- /**
- * @return the ifNoneMatch
- */
- public boolean isIfNoneMatch() {
- return ifNoneMatch;
- }
- /**
- * @param ifNoneMatch the ifNoneMatch to set
- */
- public void setIfNoneMatch(boolean ifNoneMatch) {
- this.ifNoneMatch = ifNoneMatch;
- if ( ifNoneMatch )
- enabled = true;
- }
- /**
- * @return the ifRange
- */
- public boolean isIfRange() {
- return ifRange;
- }
- /**
- * @param ifRange the ifRange to set
- */
- public void setIfRange(boolean ifRange) {
- this.ifRange = ifRange;
- if ( ifRange )
- enabled = true;
- }
-
- public String toString() {
- final String PREDPREFIX = ", predicates=";
- StringBuffer sb = new StringBuffer(PREDPREFIX);
- if ( ifMatch || ifNoneMatch || ifModifiedSince || ifUnmodifiedSince || ifRange ) {
- if ( ifMatch ) {
- if ( sb.length() > PREDPREFIX.length() ) sb.append( ", ");
- sb.append("If-Match");
- }
- if ( ifNoneMatch ) {
- if ( sb.length() > PREDPREFIX.length() ) sb.append( ", ");
- sb.append("If-None-Match");
- }
- if ( ifModifiedSince ) {
- if ( sb.length() > PREDPREFIX.length() ) sb.append( ", ");
- sb.append("If-Modified-Since");
- }
- if ( ifUnmodifiedSince ) {
- if ( sb.length() > PREDPREFIX.length() ) sb.append( ", ");
- sb.append("If-UnModified-Since");
- }
- if ( ifRange ) {
- if ( sb.length() > PREDPREFIX.length() ) sb.append( ", ");
- sb.append("If-Range");
- }
- } else {
- sb.append("null");
- }
-
- return "eTag=" + eTag + ", lastModified=" + lastModified
- + sb.toString();
- }
-
- /**
- * Gets the cache context information (ETag, LastModified, predicates) from the Http request.
- * @param request
- * @return
- */
- public static HTTPCacheContext getCacheContextFromRequest( HttpServletRequest request ) throws java.text.ParseException {
- HTTPCacheContext context = new HTTPCacheContext();
-
- String eTag = request.getHeader( "If-Match" );
- if ( eTag != null ) {
- context.setETag( eTag );
- context.setIfMatch( true );
- }
- eTag = request.getHeader( "If-None-Match" );
- if ( eTag != null ) {
- context.setETag( eTag );
- context.setIfNoneMatch( true );
- }
- String lastModifiedString = request.getHeader( "If-Modified-Since" );
- if ( lastModifiedString != null ) {
- context.setLastModified( lastModifiedString );
- context.setIfModifiedSince( true );
- }
- lastModifiedString = request.getHeader( "If-Unmodified-Since" );
- if ( lastModifiedString != null ) {
- context.setLastModified( lastModifiedString );
- context.setIfUnmodifiedSince( true );
- }
- lastModifiedString = request.getHeader( "If-Range" );
- if ( lastModifiedString != null ) {
- context.setLastModified( lastModifiedString );
- context.setIfRange( true );
- }
- return context;
- }
- /**
- * Enabled is true whenever ETag, LastModified, or predicate is set.
- * @return the enabled
- */
- public boolean isEnabled() {
- return enabled;
- }
- /**
- * @param enabled the enabled to set
- */
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.java
deleted file mode 100644
index 69e44cf35c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/HTTPHeader.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.binding.http;
-
-public class HTTPHeader {
- private String name;
- private Object value;
-
- public HTTPHeader() {
-
- }
-
- public HTTPHeader(String name, Object value) {
- this.name = name;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.java
deleted file mode 100644
index 678cd1a426..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingFactoryImpl.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.binding.http.impl;
-
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.HTTPBindingFactory;
-
-/**
- * Factory for the HTTP binding model.
- *
- * @version $Rev$ $Date$
- */
-public class HTTPBindingFactoryImpl implements HTTPBindingFactory {
-
- public HTTPBinding createHTTPBinding() {
- return new HTTPBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
deleted file mode 100644
index c902797a79..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/impl/HTTPBindingImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-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;
-
-
-/**
- * Implementation of the HTTP binding model.
- *
- * @version $Rev$ $Date$
- */
-class HTTPBindingImpl implements HTTPBinding, PolicySetAttachPoint {
-
- private String name;
- private String uri;
-
- private WireFormat wireFormat;
- private OperationSelector operationSelector;
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
-
- 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 boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The sample binding is always resolved
- }
-
-// Wireformat and Operation selection
-
- public WireFormat getRequestWireFormat() {
- return wireFormat;
- }
-
- public void setRequestWireFormat(WireFormat wireFormat) {
- this.wireFormat = wireFormat;
- }
-
- public WireFormat getResponseWireFormat() {
- return wireFormat;
- }
-
- public void setResponseWireFormat(WireFormat wireFormat) {
- this.wireFormat = wireFormat;
- }
-
- public OperationSelector getOperationSelector() {
- return operationSelector;
- }
-
- public void setOperationSelector(OperationSelector operationSelector) {
- this.operationSelector = operationSelector;
- }
-
- //Policy related getters/setters
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
deleted file mode 100644
index cb35d0f104..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/java/org/apache/tuscany/sca/binding/http/xml/HTTPBindingProcessor.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.http.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.OperationSelector;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.http.HTTPBinding;
-import org.apache.tuscany.sca.binding.http.HTTPBindingFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-public class HTTPBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<HTTPBinding> {
- private static final String BINDING_HTTP = "binding.http";
- private static final QName BINDING_HTTP_QNAME = new QName(Constants.SCA10_TUSCANY_NS, BINDING_HTTP);
-
- private static final String NAME = "name";
- private static final String URI = "uri";
-
- private HTTPBindingFactory httpBindingFactory;
- private StAXArtifactProcessor<Object> extensionProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private Monitor monitor;
-
- public HTTPBindingProcessor(ExtensionPointRegistry extensionPoints,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.httpBindingFactory = modelFactories.getFactory(HTTPBindingFactory.class);
- this.extensionProcessor = (StAXArtifactProcessor<Object>)extensionProcessor;
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- return BINDING_HTTP_QNAME;
- }
-
- public Class<HTTPBinding> getModelType() {
- return HTTPBinding.class;
- }
-
- public HTTPBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- HTTPBinding httpBinding = httpBindingFactory.createHTTPBinding();
-
- // Read policies
- policyProcessor.readPolicies(httpBinding, reader);
-
- while(reader.hasNext()) {
- QName elementName = null;
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- elementName = reader.getName();
-
- if (BINDING_HTTP_QNAME.equals(elementName)) {
- String name = getString(reader, NAME);
- if(name != null) {
- httpBinding.setName(name);
- }
-
- String uri = getString(reader, URI);
- if (uri != null) {
- httpBinding.setURI(uri);
- }
- } else {
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- httpBinding.setRequestWireFormat((WireFormat)extension);
- } else if(extension instanceof OperationSelector) {
- httpBinding.setOperationSelector((OperationSelector)extension);
- }
- }
- }
-
- }
-
- if (event == END_ELEMENT && BINDING_HTTP_QNAME.equals(reader.getName())) {
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return httpBinding;
- }
-
- public void write(HTTPBinding httpBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- writeStart(writer, BINDING_HTTP_QNAME.getNamespaceURI(), BINDING_HTTP_QNAME.getLocalPart());
-
- //write policies
- policyProcessor.writePolicyAttributes(httpBinding, writer);
-
- // Write binding name
- if (httpBinding.getName() != null) {
- writer.writeAttribute(NAME, httpBinding.getName());
- }
-
- // Write binding URI
- if (httpBinding.getURI() != null) {
- writer.writeAttribute(URI, httpBinding.getURI());
- }
-
- if ( httpBinding.getRequestWireFormat() != null ) {
- extensionProcessor.write(httpBinding.getRequestWireFormat(), writer);
- }
-
- if ( httpBinding.getOperationSelector() != null ) {
- extensionProcessor.write(httpBinding.getOperationSelector(), writer);
- }
- writeEnd(writer);
- }
-
-
- public void resolve(HTTPBinding model, ModelResolver resolver) throws ContributionResolveException {
- policyProcessor.resolvePolicies(model, resolver);
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory b/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
deleted file mode 100644
index 44da6b166c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.http.HTTPBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.http.impl.HTTPBindingFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index ac004e826a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.http.xml.HTTPBindingProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.http,model=org.apache.tuscany.sca.binding.http.HTTPBinding,factory=org.apache.tuscany.sca.binding.http.HTTPBindingFactory
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/LICENSE b/branches/sca-java-1.5.1/modules/binding-jms-policy/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/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-java-1.5.1/modules/binding-jms-policy/NOTICE b/branches/sca-java-1.5.1/modules/binding-jms-policy/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/pom.xml b/branches/sca-java-1.5.1/modules/binding-jms-policy/pom.xml
deleted file mode 100644
index 07c2f674b9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/pom.xml
+++ /dev/null
@@ -1,94 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-jms-policy</artifactId>
- <name>Apache Tuscany SCA Policy Model for JMS Binding</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-reliability</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jms.policy</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jms.policy*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/JMSBindingDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/JMSBindingDefinitionsProvider.java
deleted file mode 100644
index de54545f7e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/JMSBindingDefinitionsProvider.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.binding.jms.policy;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions for the JMS binding
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingDefinitionsProvider implements SCADefinitionsProvider {
- private String definitionsFile = "org/apache/tuscany/sca/binding/jms/policy/definitions.xml";
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public JMSBindingDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- final URL definitionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
- SCADefinitions scaDefn = null;
- try {
- final URI uri = new URI(definitionsFile);
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
- public SCADefinitions run() throws ContributionReadException {
- return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
- }
- });
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- return scaDefn;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.java
deleted file mode 100644
index 16ed2a53a4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicy.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.binding.jms.policy.authentication.token;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicy implements Policy {
- public static final QName JMS_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jmsTokenAuthentication");
- public static final String JMS_TOKEN_AUTHENTICATION_TOKEN_NAME = "tokenName";
-
- private QName tokenName;
-
- public QName getTokenName() {
- return tokenName;
- }
-
- public void setTokenName(QName tokenName) {
- this.tokenName = tokenName;
- }
-
- public QName getSchemaName() {
- return JMS_TOKEN_AUTHENTICATION_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.java
deleted file mode 100644
index 11747914da..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProcessor.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.binding.jms.policy.authentication.token;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSTokenAuthenticationPolicy> {
-
- public QName getArtifactType() {
- return JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_POLICY_QNAME;
- }
-
- public JMSTokenAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public JMSTokenAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JMSTokenAuthenticationPolicy policy = new JMSTokenAuthenticationPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(getArtifactType()) ) {
- policy.setTokenName(getQName(reader, JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_TOKEN_NAME));
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( getArtifactType().equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(JMSTokenAuthenticationPolicy policy, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if ( policy.getTokenName() != null ) {
- writer.writeAttribute(prefix,
- getArtifactType().getNamespaceURI(),
- JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_TOKEN_NAME,
- policy.getTokenName().toString());
- }
-
- writer.writeEndElement();
- }
-
- public Class<JMSTokenAuthenticationPolicy> getModelType() {
- return JMSTokenAuthenticationPolicy.class;
- }
-
- public void resolve(JMSTokenAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index fd77e57418..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.authentication.token;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory<JMSTokenAuthenticationPolicy> {
- private ExtensionPointRegistry registry;
-
- public JMSTokenAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new JMSTokenAuthenticationReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new JMSTokenAuthenticationServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
deleted file mode 100644
index 56fffeb817..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyInterceptor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.authentication.token;
-
-
-import javax.jms.JMSException;
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationReferencePolicyInterceptor implements Interceptor {
-
- private Invoker next;
- private PolicySet policySet = null;
- private String context;
- private JMSTokenAuthenticationPolicy policy;
-
- public JMSTokenAuthenticationReferencePolicyInterceptor(String context, PolicySet policySet) {
- super();
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof JMSTokenAuthenticationPolicy){
- policy = (JMSTokenAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- try {
- javax.jms.Message jmsMsg = msg.getBody();
-
- if ( policy.getTokenName() != null){
-
- Subject subject = SecurityUtil.getSubject(msg);
- TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
-
- if (principal == null){
- // should call out here to some 3rd party system to get credentials
- // and correct token. Here we are just putting in the token name
- principal = new TokenPrincipal("DummyTokenID");
- subject.getPrincipals().add(principal);
- }
-
- jmsMsg.setStringProperty(policy.getTokenName().toString(), principal.getName());
- }
-
- return getNext().invoke(msg);
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.java
deleted file mode 100644
index b4fa617f74..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationReferencePolicyProvider.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.binding.jms.policy.authentication.token;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public JMSTokenAuthenticationReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationReferencePolicyInterceptor(getContext(), ps);
-
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_BINDING_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java
deleted file mode 100644
index c8d28ad5db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyInterceptor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.authentication.token;
-
-
-
-import javax.jms.JMSException;
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-
-/**
- * Policy handler to handle token based authentication
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationServicePolicyInterceptor implements Interceptor {
- private Invoker next;
- private PolicySet policySet = null;
- private String context;
- private JMSTokenAuthenticationPolicy policy;
-
- public JMSTokenAuthenticationServicePolicyInterceptor(String context, PolicySet policySet) {
- super();
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof JMSTokenAuthenticationPolicy){
- policy = (JMSTokenAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- try{
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- String token = jmsMsg.getStringProperty(policy.getTokenName().toString());
-
- Subject subject = SecurityUtil.getSubject(msg);
- TokenPrincipal principal = SecurityUtil.getPrincipal(subject, TokenPrincipal.class);
-
- if (principal == null){
- principal = new TokenPrincipal(token);
- subject.getPrincipals().add(principal);
- }
-
- System.out.println("JMS service received token: " + principal.getName());
-
- // call out here to some 3rd party system to do whatever you
- // need to authenticate the principal
-
- return getNext().invoke(msg);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.java
deleted file mode 100644
index 4b0944a420..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/authentication/token/JMSTokenAuthenticationServicePolicyProvider.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.binding.jms.policy.authentication.token;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSTokenAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public JMSTokenAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSTokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSTokenAuthenticationServicePolicyInterceptor(getContext(), ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java
deleted file mode 100644
index 1c16e3fa1b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicy.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderPolicy implements Policy {
- public static final QName JMS_HEADER_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jmsHeader");
- public static final String JMS_HEADER_JMS_TYPE = "JMSType";
- public static final String JMS_HEADER_JMS_CORRELATION_ID = "JMSCorrelationID";
- public static final String JMS_HEADER_JMS_DELIVERY_MODE = "JMSDeliveryMode";
- public static final String JMS_HEADER_JMS_TIME_TO_LIVE = "JMSTimeToLive";
- public static final String JMS_HEADER_JMS_PRIORITY = "JMSPriority";
- public static final String JMS_HEADER_JMS_PROPERTY = "property";
- public static final String JMS_HEADER_JMS_PROPERTY_NAME = "name";
-
- private String jmsType = null;
- private String jmsCorrelationId = null;
- private Boolean deliveryModePersistent = null;
- private Long timeToLive = null;
- private Integer jmsPriority = null;
- private Map<String, String> properties = new Hashtable<String, String>();
-
- public String getJmsType() {
- return jmsType;
- }
-
- public void setJmsType(String jmsType) {
- this.jmsType = jmsType;
- }
-
- public String getJmsCorrelationId() {
- return jmsCorrelationId;
- }
-
- public void setJmsCorrelationId(String jmsCorrelationId) {
- this.jmsCorrelationId = jmsCorrelationId;
- }
-
- public Boolean getDeliveryModePersistent() {
- return deliveryModePersistent;
- }
-
- public void setDeliveryModePersistent(Boolean deliveryModePersistent) {
- this.deliveryModePersistent = deliveryModePersistent;
- }
-
- public Long getTimeToLive() {
- return timeToLive;
- }
-
- public void setTimeToLive(Long timeToLive) {
- this.timeToLive = timeToLive;
- }
-
- public Integer getJmsPriority() {
- return jmsPriority;
- }
-
- public void setJmsPriority(Integer jmsPriority) {
- this.jmsPriority = jmsPriority;
- }
-
- public Map<String, String> getProperties() {
- return properties;
- }
-
- public QName getSchemaName() {
- return JMS_HEADER_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- @Override
- public String toString() {
- String result = "jmsHeader";
-
- result += " JMSType ";
- result += getJmsType();
- result += " JMSDeliveryMode ";
- result += getJmsCorrelationId();
- result += " JMSDeliveryMode ";
- result += getDeliveryModePersistent();
- result += " JMSTimeToLive ";
- result += getTimeToLive();
- result += " JMSPriority ";
- result += getJmsPriority();
-
- for (String propertyName : properties.keySet()){
- result += " property ";
- result += propertyName;
- result += " ";
- result += properties.get(propertyName);
- }
-
- return result;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java
deleted file mode 100644
index de2b69201b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProcessor.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.logging.Level;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSHeaderPolicy> {
-
- private Monitor monitor;
-
- public QName getArtifactType() {
- return JMSHeaderPolicy.JMS_HEADER_POLICY_QNAME;
- }
-
- public JMSHeaderPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Marshals warnings into the monitor
- *
- * @param message
- * @param model
- * @param messageParameters
- */
- protected void warning(String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals errors into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "assembly-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-
- public JMSHeaderPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JMSHeaderPolicy policy = new JMSHeaderPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(getArtifactType()) ) {
-
- policy.setJmsType(getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_TYPE));
- policy.setJmsCorrelationId(getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_CORRELATION_ID));
-
- String deliveryMode = getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_DELIVERY_MODE);
- if (deliveryMode != null){
- if (deliveryMode.equals("PERSISTENT")) {
- policy.setDeliveryModePersistent(true);
- } else if (deliveryMode.equals("NON_PERSISTENT")){
- policy.setDeliveryModePersistent(false);
- } else {
- error("InvalidDeliveryMode", policy, deliveryMode);
- }
- }
-
- String timeToLive = getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_TIME_TO_LIVE);
-
- if ( timeToLive != null){
- try {
- policy.setTimeToLive(Long.valueOf(timeToLive));
- } catch (NumberFormatException ex){
- error("InvalidTimeToLive", policy, timeToLive);
- }
- }
-
- String priority = getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_PRIORITY);
-
- if ( priority != null){
- try {
- policy.setJmsPriority(Integer.valueOf(priority));
- } catch (NumberFormatException ex){
- error("InvalidPriority", policy, priority);
- }
- }
- } else if (name.getLocalPart().equals(JMSHeaderPolicy.JMS_HEADER_JMS_PROPERTY)) {
- String propertyName = getString(reader, JMSHeaderPolicy.JMS_HEADER_JMS_PROPERTY_NAME);
- String propertyValue = reader.getElementText();
- policy.getProperties().put(propertyName, propertyValue);
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( getArtifactType().equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(JMSHeaderPolicy policy, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if (policy.getJmsType() != null){
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_TYPE, policy.getJmsType());
- }
-
- if (policy.getJmsCorrelationId() != null){
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_CORRELATION_ID, policy.getJmsCorrelationId());
- }
-
- if (policy.getDeliveryModePersistent() == true){
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_DELIVERY_MODE, "PERSISTENT");
- } else {
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_DELIVERY_MODE, "NON_PERSISTENT");
- }
-
- if (policy.getTimeToLive()!= null){
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_TIME_TO_LIVE, policy.getTimeToLive().toString());
- }
-
- if (policy.getJmsPriority()!= null){
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_PRIORITY, policy.getJmsPriority().toString());
- }
-
- for (String propertyName : policy.getProperties().keySet()){
- writer.writeStartElement(prefix,
- JMSHeaderPolicy.JMS_HEADER_JMS_PROPERTY,
- getArtifactType().getNamespaceURI());
- writer.writeAttribute(JMSHeaderPolicy.JMS_HEADER_JMS_PROPERTY_NAME, propertyName);
- writer.writeCharacters(policy.getProperties().get(propertyName));
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- public Class<JMSHeaderPolicy> getModelType() {
- return JMSHeaderPolicy.class;
- }
-
- public void resolve(JMSHeaderPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java
deleted file mode 100644
index ded3da05b9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSHeaderPolicyProviderFactory implements PolicyProviderFactory<JMSHeaderPolicy> {
- private ExtensionPointRegistry registry;
-
- public JMSHeaderPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new JMSHeaderReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
deleted file mode 100644
index 3c7b4467ba..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyInterceptor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-
-import java.util.Map;
-
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.policy.JMSBindingDefinitionsProvider;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JMSHeaderReferencePolicyInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding jmsBinding;
- private PolicySet policySet = null;
- private String context;
- private JMSHeaderPolicy jmsHeaderPolicy;
-
- public JMSHeaderReferencePolicyInterceptor(String context, RuntimeComponent component, RuntimeComponentReference reference, Binding binding, PolicySet policySet) {
- super();
- this.component = component;
- this.reference = reference;
- this.jmsBinding = (JMSBinding)binding;
- this.policySet = policySet;
- this.context = context;
-
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof JMSHeaderPolicy){
- jmsHeaderPolicy = (JMSHeaderPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
-
- javax.jms.Message jmsMsg = msg.getBody();
-
- // JMS header attrs set on MessageProducer via interceptors.
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java
deleted file mode 100644
index 3983541de3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/java/org/apache/tuscany/sca/binding/jms/policy/header/JMSHeaderReferencePolicyProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.policy.header;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JMSHeaderReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public JMSHeaderReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JMSHeaderPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JMSHeaderReferencePolicyInterceptor(getContext(), component, reference, binding, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_BINDING_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index e6f22e327c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jmsTokenAuthentication,model=org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy
-org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jmsHeader,model=org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index b04c71d8e3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index 0598cdc368..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.binding.jms.policy.JMSBindingDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/binding-jms-policy-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/binding-jms-policy-validation-messages.properties
deleted file mode 100644
index fd43b2c4e9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/binding-jms-policy-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-InvalidDeliveryMode = JMSDeliveryMode must be either PERSISTENT or NON_PERSISTENT but found {0}
-InvalidTimeToLive = JMSTimeToLive must be a long integer but found {0}
-InvalidPriority = JMSPriority must be a integer but found {0}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
deleted file mode 100644
index c87079dd54..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/main/resources/org/apache/tuscany/sca/binding/jms/policy/definitions.xml
+++ /dev/null
@@ -1,84 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
- <!-- intents not yet enabled -->
- <!--sca:bindingType type="sca:binding.jms"
- alwaysProvides="JMS"
- mayProvide="atLeastOnce atMostOnce ordered conversation" /-->
-
- <!-- PolicyIntents defined by the SCA Runtime Extension for JMS Binding -->
-
- <sca:intent name="JMS" constrains="sca:binding.jms">
- <sca:description>
- Communication through this binding requires JMS
- </sca:description>
- </sca:intent>
-
- <!-- delivery mode -->
- <intent name="deliveryMode"
- constrains="sca:binding.jms">
- <description>
- This intent is used to indicate the deliver mode
- of the sent message
- </description>
- </intent>
-
- <intent name="deliveryMode.persistent">
- <description>
- Message are sent persistently
- </description>
- </intent>
-
- <intent name="deliveryMode.nonPersistent">
- <description>
- Message are sent persistently
- </description>
- </intent>
-
- <!-- priority -->
- <intent name="priority"
- constrains="sca:binding.jms">
- <description>
- This intent is used to indicate the priority of the
- sent message
- </description>
- </intent>
-
- <intent name="priority.high">
- <description>
- Messages are high priority
- </description>
- </intent>
-
- <intent name="priority.medium">
- <description>
- Messages are medium priority
- </description>
- </intent>
-
- <intent name="priority.low">
- <description>
- Messages are low priority
- </description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.java
deleted file mode 100644
index a9da07ca7d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/java/org/apache/tuscany/sca/binding/jms/policy/PolicyProcessorTestCase.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.binding.jms.policy;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.jms.policy.authentication.token.JMSTokenAuthenticationPolicyProcessor;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicy;
-import org.apache.tuscany.sca.binding.jms.policy.header.JMSHeaderPolicyProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.policy.Policy;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyProcessorTestCase {
- private final static List<String> SEQ =
- Arrays.asList("<tuscany:jmsHeader xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" JMSType=\"ABC\" JMSDeliveryMode=\"PERSISTENT\" JMSTimeToLive=\"123\" JMSPriority=\"4\"><tuscany:property name=\"aProperty\">property value</tuscany:property></tuscany:jmsHeader>",
- "<tuscany:jmsTokenAuthentication xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" tuscany:tokenName=\"{http://tuscany.apache.org/foo}myname\" />");
-
- @Test
- public void testRead() throws Exception {
- List<String> results = new ArrayList<String>();
- Map<QName, StAXArtifactProcessor> processors = new HashMap<QName, StAXArtifactProcessor>();
- processors.put(JMSHeaderPolicy.JMS_HEADER_POLICY_QNAME, new JMSHeaderPolicyProcessor(null, null));
- processors.put(JMSTokenAuthenticationPolicy.JMS_TOKEN_AUTHENTICATION_POLICY_QNAME, new JMSTokenAuthenticationPolicyProcessor(null, null));
-
- InputStream is = getClass().getResourceAsStream("mock_policy_definitions.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
-
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
-
- while (true) {
- int event = reader.getEventType();
- if (event == XMLStreamConstants.START_ELEMENT) {
- if ("policySet".equals(reader.getName().getLocalPart())) {
- reader.nextTag();
- StAXArtifactProcessor processor = processors.get(reader.getName());
- Policy policy = (Policy)processor.read(reader);
-
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(outputStream);
- processor.write(policy, writer);
- writer.flush();
- results.add(outputStream.toString());
- }
- }
- if (reader.hasNext()) {
- reader.next();
- } else {
- break;
- }
- }
- Assert.assertEquals(SEQ, results);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/jms/policy/mock_policy_definitions.xml b/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/jms/policy/mock_policy_definitions.xml
deleted file mode 100644
index 3631c682aa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-policy/src/test/resources/org/apache/tuscany/sca/binding/jms/policy/mock_policy_definitions.xml
+++ /dev/null
@@ -1,39 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
- <!-- POLICY SETS -->
- <policySet name="ps1" provides="authorization" appliesTo="sca:implementation">
- <tuscany:jmsHeader JMSType="ABC"
- JMSCorrelattionID="DEF"
- JMSDeliveryMode="PERSISTENT"
- JMSTimeToLive="123"
- JMSPriority="4">
- <property name="aProperty">property value</property>
- </tuscany:jmsHeader>
- </policySet>
-
- <policySet name="ps2" provides="authorization" appliesTo="sca:implementation">
- <tuscany:jmsTokenAuthentication xmlns:foo="http://tuscany.apache.org/foo" tokenName="foo:myname"/>
- </policySet>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-jms-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/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-java-1.5.1/modules/binding-jms-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-jms-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-jms-runtime/pom.xml
deleted file mode 100644
index c47bf5090d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/pom.xml
+++ /dev/null
@@ -1,142 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-jms-runtime</artifactId>
- <name>Apache Tuscany SCA JMS Binding Runtime</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jms</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jms.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jms.provider*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.java
deleted file mode 100644
index 677f8eb6f8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/context/JMSBindingContext.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.binding.jms.context;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-
-
-/**
- * Context that the JMS binding puts on the Tuscany wire
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingContext {
-
- private Message jmsMsg;
- private Session jmsSession;
- private Session jmsResponseSession;
- private Destination requestDestination;
- private Destination replyToDestination;
- private JMSResourceFactory jmsResourceFactory;
- private long timeToLive;
- private boolean useBytesForWFJMSDefaultResponse;
-
- public Message getJmsMsg() {
- return jmsMsg;
- }
-
- public void setJmsMsg(Message jmsMsg) {
- this.jmsMsg = jmsMsg;
- }
-
- public synchronized Session getJmsSession() {
- if (jmsSession == null) {
- try {
- jmsSession = getJmsResourceFactory().createSession();
- } catch (Exception e) {
- throw new JMSBindingException(e);
- }
- }
- return jmsSession;
- }
-
- public synchronized void closeJmsSession() {
- if (jmsSession != null) {
- try {
- getJmsResourceFactory().closeSession(jmsSession);
- } catch (Exception e) {
- throw new JMSBindingException(e);
- } finally {
- jmsSession = null;
- }
- }
- }
-
- public synchronized Session getJmsResponseSession() {
- if (jmsResponseSession == null) {
- try {
- jmsResponseSession = getJmsResourceFactory().createResponseSession();
- } catch (Exception e) {
- throw new JMSBindingException(e);
- }
- }
- return jmsResponseSession;
- }
-
- public synchronized void closeJmsResponseSession() {
- if (jmsResponseSession != null) {
- try {
- getJmsResourceFactory().closeResponseSession(jmsResponseSession);
- } catch (Exception e) {
- throw new JMSBindingException(e);
- } finally {
- jmsResponseSession = null;
- }
- }
- }
-
- public Destination getRequestDestination() {
- return requestDestination;
- }
-
- public void setRequestDestination(Destination requestDestination) {
- this.requestDestination = requestDestination;
- }
-
- public Destination getReplyToDestination() {
- return replyToDestination;
- }
-
- public void setReplyToDestination(Destination replyToDestination) {
- this.replyToDestination = replyToDestination;
- }
-
- // TODO - difficult to get the resource factory into all the JMS providers
- // so it's here for the moment
- public JMSResourceFactory getJmsResourceFactory() {
- return jmsResourceFactory;
- }
-
- public void setJmsResourceFactory(JMSResourceFactory jmsResourceFactory) {
- this.jmsResourceFactory = jmsResourceFactory;
- }
-
- public long getTimeToLive() {
- return timeToLive;
- }
-
- public void setTimeToLive(long timeToLive) {
- this.timeToLive = timeToLive;
- }
-
- public boolean isUseBytesForWFJMSDefaultResponse() {
- return useBytesForWFJMSDefaultResponse;
- }
-
- public void setUseBytesForWFJMSDefaultResponse(
- boolean useBytesForWFJMSDefaultResponse) {
- this.useBytesForWFJMSDefaultResponse = useBytesForWFJMSDefaultResponse;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
deleted file mode 100644
index 5b7c8f992d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/headers/HeaderReferenceInterceptor.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.headers;
-
-
-
-
-import java.util.Map;
-
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HeaderReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private String correlationScheme;
- private WireFormat requestWireFormat;
- private WireFormat responseWireFormat;
-
- public HeaderReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.correlationScheme = jmsBinding.getCorrelationScheme();
-
- }
-
- public Message invoke(Message msg) {
-
- return next.invoke(invokeRequest(msg));
-
- }
-
- public Message invokeRequest(Message tuscanyMsg) {
- try {
- // get the jms context
- JMSBindingContext context = tuscanyMsg.getBindingContext();
- javax.jms.Message jmsMsg = tuscanyMsg.getBody();
-
- Operation operation = tuscanyMsg.getOperation();
- String operationName = operation.getName();
- RuntimeComponentReference reference = (RuntimeComponentReference)runtimeWire.getSource().getContract();
-
- // I think the OASIS spec suggests we do not need to do anything with
- // @nativeOperation here on the reference side.
- requestMessageProcessor.setOperationName(operationName, jmsMsg);
-
- if (jmsBinding.getOperationJMSDeliveryMode(operationName) != null) {
- if (jmsBinding.getOperationJMSDeliveryMode(operationName)) {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
- } else {
- jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
- }
- }
-
- if (jmsBinding.getOperationJMSCorrelationId(operationName) != null) {
- jmsMsg.setJMSCorrelationID(jmsBinding.getOperationJMSCorrelationId(operationName));
- }
-
- if (jmsBinding.getOperationJMSPriority(operationName) != null) {
- jmsMsg.setJMSPriority(jmsBinding.getOperationJMSPriority(operationName));
- }
-
- if (jmsBinding.getOperationJMSType(operationName) != null) {
- jmsMsg.setJMSType(jmsBinding.getOperationJMSType(operationName));
- }
-
- ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters();
-
- Object conversationID = parameters.getConversationID();
- if (conversationID != null) {
- jmsMsg.setStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY, conversationID.toString());
- }
-
- if (tuscanyMsg.getFrom().getCallbackEndpoint() != null) {
-
- if (parameters.getCallbackID() != null) {
- jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY, parameters.getCallbackID().toString());
- }
-
- String callbackDestName = getCallbackDestinationName(reference);
- if (callbackDestName != null) {
- jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName);
- }
- }
-
- for (String propName : jmsBinding.getPropertyNames()) {
- Object value = jmsBinding.getProperty(propName);
- jmsMsg.setObjectProperty(propName, value);
- }
-
- Map<String, Object> operationProperties = jmsBinding.getOperationProperties(operationName);
- if (operationProperties != null) {
- for (String propName : operationProperties.keySet()) {
- Object value = operationProperties.get(propName);
- jmsMsg.setObjectProperty(propName, value);
- }
- }
-
- if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
- context.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(operationName) * 2);
- } else {
- context.setTimeToLive(JMSBindingConstants.DEFAULT_TIME_TO_LIVE);
- }
-
- return tuscanyMsg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-
- protected String getCallbackDestinationName(RuntimeComponentReference reference) {
- RuntimeComponentService s = (RuntimeComponentService)reference.getCallbackService();
- JMSBinding b = s.getBinding(JMSBinding.class);
- if (b != null) {
- JMSBindingServiceBindingProvider bp = (JMSBindingServiceBindingProvider)s.getBindingProvider(b);
- return bp.getDestinationName();
- }
- return null;
- }
-
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java
deleted file mode 100644
index 64d01b2863..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultProviderFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSDefault> {
- private ExtensionPointRegistry registry;
-
- public OperationSelectorJMSDefaultProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- /**
- */
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new OperationSelectorJMSDefaultServiceProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
deleted file mode 100644
index 66f875621c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceInterceptor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringReader;
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultServiceInterceptor implements Interceptor {
-
- private static final String ON_MESSAGE_METHOD_NAME = "onMessage";
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
-
-
- public OperationSelectorJMSDefaultServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory,
- RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.service = (RuntimeComponentService)runtimeWire.getTarget().getContract();
- this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- String operationName = requestMessageProcessor.getOperationName(jmsMsg);
- Operation operation = getTargetOperation(operationName, jmsMsg);
- msg.setOperation(operation);
-
- return msg;
- }
-
- protected Operation getTargetOperation(String operationName, javax.jms.Message jmsMsg) {
- Operation operation = null;
-
- if (serviceOperations.size() == 1) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 203
- operation = serviceOperations.get(0);
-
- } else if (operationName != null) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 205
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationName)) {
- operation = op;
- break;
- }
- }
- } else if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault
- || jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML) {
-
- OMElement rootElement;
- String operationFromPayload;
-
- try {
- if (jmsMsg instanceof TextMessage) {
- String xmlPayload = ((TextMessage) jmsMsg).getText();
-
- if (xmlPayload != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xmlPayload));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- rootElement = builder.getDocumentElement();
- operationFromPayload = rootElement.getLocalName();
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationFromPayload)) {
- operation = op;
- break;
- }
- }
- }
- } else if (jmsMsg instanceof BytesMessage) {
- long noOfBytes = ((BytesMessage) jmsMsg).getBodyLength();
- byte[] bytes = new byte[(int) noOfBytes];
- ((BytesMessage) jmsMsg).readBytes(bytes);
- ((BytesMessage) jmsMsg).reset();
-
- if (bytes != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- rootElement = builder.getDocumentElement();
- operationFromPayload = rootElement.getLocalName();
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationFromPayload)) {
- operation = op;
- break;
- }
- }
- }
- }
-
- } catch (XMLStreamException e) {
- //let's ignore this in case the client doesn't want to use a wrapped xml message
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- // If operation is still null we attempt the last rule
- if (operation == null) {
-
- // SCA JMS Binding Specification - Rule 1.5.1 line 207
- for (Operation op : serviceOperations) {
- if (op.getName().equals(ON_MESSAGE_METHOD_NAME)) {
- operation = op;
- break;
- }
- }
- }
- }
-
- if (operation == null) {
- throw new JMSBindingException("Can't find operation " + (operationName != null ? operationName : ON_MESSAGE_METHOD_NAME));
- }
-
- return operation;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.java
deleted file mode 100644
index 1cceb4e382..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/runtime/OperationSelectorJMSDefaultServiceProvider.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.binding.jms.operationselector.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultServiceProvider implements OperationSelectorProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public OperationSelectorJMSDefaultServiceProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new OperationSelectorJMSDefaultServiceInterceptor((JMSBinding)binding,
- null,
- service.getRuntimeWire(binding));
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_OPERATION_SELECTOR;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.java
deleted file mode 100644
index 49ad6add50..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropProviderFactory.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.binding.jms.operationselector.jmsuserprop.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.OperationSelectorJMSUserProp;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-public class OperationSelectorJMSUserPropProviderFactory implements OperationSelectorProviderFactory<OperationSelectorJMSUserProp> {
- private ExtensionPointRegistry registry;
-
- public OperationSelectorJMSUserPropProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- /**
- */
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new OperationSelectorJMSUserPropServiceProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.java
deleted file mode 100644
index 272a0a3c21..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceInterceptor.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.binding.jms.operationselector.jmsuserprop.runtime;
-
-import java.util.List;
-
-import javax.jms.JMSException;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.OperationSelectorJMSUserProp;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Interceptor for user property based operation selection
- *
- * <operationSelector.jmsUser propertName="MyHeaderProperty"/>
- *
- */
-public class OperationSelectorJMSUserPropServiceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSBinding jmsBinding;
- private OperationSelectorJMSUserProp operationSelector;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
-
- public OperationSelectorJMSUserPropServiceInterceptor(JMSBinding jmsBinding, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.operationSelector = (OperationSelectorJMSUserProp)jmsBinding.getOperationSelector();
- this.runtimeWire = runtimeWire;
- this.service = (RuntimeComponentService) runtimeWire.getTarget().getContract();
- this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Operation operation = getTargetOperation(jmsMsg);
- msg.setOperation(operation);
-
- return msg;
- }
-
- protected Operation getTargetOperation(javax.jms.Message jmsMsg) {
- String operationName = null;
- String opSelectorPropertyName = operationSelector.getPropertyName();
-
- try {
- operationName = jmsMsg.getStringProperty(opSelectorPropertyName);
- } catch(JMSException e) {
- throw new JMSBindingException(e);
- }
-
- if (operationName == null){
- throw new JMSBindingException("Property " + opSelectorPropertyName + " not found in message header");
- }
-
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationName)) {
- return op;
- }
- }
-
- throw new JMSBindingException("Can't find operation " + operationName);
- }
-
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java
deleted file mode 100644
index ece54f5974..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/runtime/OperationSelectorJMSUserPropServiceProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-public class OperationSelectorJMSUserPropServiceProvider implements OperationSelectorProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public OperationSelectorJMSUserPropServiceProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new OperationSelectorJMSUserPropServiceInterceptor((JMSBinding)binding, service.getRuntimeWire(binding));
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_OPERATION_SELECTOR;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
deleted file mode 100644
index e2fc49834e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/AbstractMessageProcessor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Base MessageProcessor for the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractMessageProcessor implements JMSMessageProcessor {
- private static final Logger logger = Logger.getLogger(AbstractMessageProcessor.class.getName());
-
- protected String operationPropertyName;
- protected boolean xmlFormat = true;
-
- public AbstractMessageProcessor(JMSBinding jmsBinding) {
- this.operationPropertyName = jmsBinding.getOperationSelectorPropertyName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#getOperationName(javax.jms.Message)
- */
- public String getOperationName(Message message) {
- try {
-
- return message.getStringProperty(operationPropertyName);
-
- } catch (JMSException e) {
- throw new JMSBindingException("Exception retreiving operation name from message", e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#setOperationName(javax.jms.Message, java.lang.String)
- */
- public void setOperationName(String operationName, Message message) {
- try {
-
- message.setStringProperty(operationPropertyName, operationName);
-
- } catch (JMSException e) {
- throw new JMSBindingException("Exception setting the operation name on message", e);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Session, java.lang.Object)
- */
- public Message insertPayloadIntoJMSMessage(Session session, Object o) {
- return createJMSMessage(session, o);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.OperationAndDataBinding#extractPayload(javax.jms.Message)
- */
- public Object extractPayloadFromJMSMessage(Message msg) {
- try {
- if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- Object exc = ((ObjectMessage)msg).getObject();
- if (exc instanceof RuntimeException) {
- throw new ServiceRuntimeException("remote service exception, see nested exception", (Throwable)exc);
- } else {
- return new InvocationTargetException((Throwable) exc);
- }
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- return extractPayload(msg);
- }
-
- public Message createFaultMessage(Session session, Throwable o) {
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- try {
-
- ObjectMessage message = session.createObjectMessage();
- String causeMsg;
- if (o instanceof RuntimeException) {
- message.setObject(new RuntimeException(o.getMessage()));
- } else {
- // for a checked exception return the checked exception
- message.setObject(o);
- }
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- protected abstract Object extractPayload(Message msg);
-
- protected abstract Message createJMSMessage(Session session, Object o);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java
deleted file mode 100644
index 5d1990eb90..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/BytesMessageProcessor.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * MessageProcessor for sending/receiving javax.jms.BytesMessage with the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class BytesMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(AbstractMessageProcessor.class.getName());
-
- public BytesMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
-/* TUSCANY-2967 - disable this change while we decide what to do and
- * return faults as JMSObject messages to be consistent
- * again with other wire formats
- @Override
- public Object extractPayloadFromJMSMessage(Message msg) {
- byte [] bytes = (byte [])extractPayload(msg);
-
- try {
- if (msg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- return new InvocationTargetException(new ServiceRuntimeException(new String(bytes)));
- } else {
- return bytes;
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-*/
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- if (!(msg instanceof BytesMessage)) {
- throw new IllegalStateException("expecting JMS BytesMessage: " + msg);
- }
-
- long noOfBytes = ((BytesMessage)msg).getBodyLength();
- byte [] bytes = new byte[(int)noOfBytes];
- ((BytesMessage)msg).readBytes(bytes);
- ((BytesMessage)msg).reset();
- return bytes;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-/* TUSCANY-2967 - disable this change while we decide what to do and
- * return faults as JMSObject messages to be consistent
- * again with other wire formats
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
- try {
- Message message = createJMSMessage(session, o.toString().getBytes());
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-*/
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
-
- // TODO - an experiment. How to enforce a single
- // byte array parameter
- BytesMessage message = session.createBytesMessage();
-
- if (o != null){
- message.writeBytes((byte[])o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index 1de85ea773..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultJMSResourceFactoryExtensionPoint.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.binding.jms.provider;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-
-public class DefaultJMSResourceFactoryExtensionPoint implements JMSResourceFactoryExtensionPoint {
-
- public JMSResourceFactory createJMSResourceFactory(JMSBinding binding) {
- return new JMSResourceFactoryImpl(binding.getConnectionFactoryName(), binding.getResponseConnectionFactoryName(), binding.getInitialContextFactoryName(), binding.getJndiURL());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
deleted file mode 100644
index 05f264db78..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/DefaultMessageProcessor.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringReader;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-
-/**
- * MessageProcessor for sending/receiving XML over javax.jms.TextMessage or javax.jms.BytesMessage
- * with the JMSBinding.
- * This is very specific to the default wire format and is not tied into the usual hierarchy
- * of message processors
- *
- * @version $Rev$ $Date$
- */
-public class DefaultMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(DefaultMessageProcessor.class.getName());
-
- public DefaultMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
- // inherited methods that don't do anything useful
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- // should not be used
- return null;
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- // if it's not a text/bytes message or a fault then we don;t know what to do with it
- return null;
- }
-
- // TODO - This makes the assumption that whatever the text/bytes configuration of the
- // jms binding, unchecked faults will be sent as bytes.
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
- return createFaultJMSBytesMessage(session, o);
- }
-
- // handle text messages
-
- public Object extractPayloadFromJMSTextMessage(Message msg, OMElement wrapper) {
- if (msg instanceof TextMessage) {
- try {
- String xml = ((TextMessage) msg).getText();
- Object os;
- if (xml != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- OMElement newWrapper = wrapper.cloneOMElement();
- if (os != null){
- newWrapper.addChild((OMNode)os);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // handle the non-text fault case
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- public Message insertPayloadIntoJMSTextMessage(Session session, Object o, boolean unwrap) {
-
- try {
-
- TextMessage message = session.createTextMessage();
-
- if (o instanceof OMElement) {
-
- if (unwrap){
- OMElement firstElement = ((OMElement)o).getFirstElement();
- if (firstElement == null ) {
- message.setText(null);
- } else {
- message.setText(firstElement.toString());
- }
- }else {
- message.setText(o.toString());
- }
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof OMElement) {
- if (unwrap){
- OMElement firstElement = ((OMElement)((Object[]) o)[0]).getFirstElement();
- if (firstElement == null ) {
- message.setText(null);
- } else {
- message.setText(firstElement.toString());
- }
- }else {
- message.setText(((Object[]) o)[0].toString());
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message createFaultJMSTextMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- TextMessage message = session.createTextMessage();
- message.setText(String.valueOf(((FaultException) o).getFaultInfo()));
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // handle the non XML fault case
- return super.createFaultMessage(session, o);
- }
- }
-
- // handle bytes messages
-
- public Object extractPayloadFromJMSBytesMessage(Message msg, OMElement wrapper) {
-
- if (msg instanceof BytesMessage) {
- try {
- Object os;
-
- long noOfBytes = ((BytesMessage) msg).getBodyLength();
- byte[] bytes = new byte[(int) noOfBytes];
- ((BytesMessage) msg).readBytes(bytes);
- ((BytesMessage)msg).reset();
-
- if ((bytes != null) && (bytes.length > 0)) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
-
- if (wrapper != null){
- //don't modify the original wrapper since it will be reused
- //clone the wrapper
- OMElement newWrapper = wrapper.cloneOMElement();
- if (os != null){
- newWrapper.addChild((OMNode)os);
- }
- return newWrapper;
- }
-
- return os;
-
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- // trap the non-bytes fault case
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- public Message insertPayloadIntoJMSBytesMessage(Session session, Object o, boolean unwrap) {
-
- try {
-
- BytesMessage message = session.createBytesMessage();
-
-
- if (o instanceof OMElement) {
- if (unwrap) {
- OMElement firstElement = ((OMElement)o).getFirstElement();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(firstElement.toString().getBytes());
- }
-
- } else {
- message.writeBytes(o.toString().getBytes());
- }
-
- } else if ((o instanceof Object[]) && ((Object[]) o)[0] instanceof OMElement) {
- if (unwrap){
- OMElement firstElement = ((OMElement)((Object[]) o)[0]).getFirstElement();
- if (firstElement == null ) {
- //do nothing, the message will just be set with a byte[0]
- } else {
- message.writeBytes(firstElement.toString().getBytes());
- }
-
- }else {
- message.writeBytes(((Object[]) o)[0].toString().getBytes());
- }
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message createFaultJMSBytesMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
-
- if (o instanceof FaultException) {
- try {
-
- BytesMessage message = session.createBytesMessage();
- message.writeBytes(String.valueOf(((FaultException) o).getFaultInfo()).getBytes());
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- return super.createFaultMessage(session, o);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
deleted file mode 100644
index c9a11dc41e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingProviderFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A factory from creating the JMS binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingProviderFactory implements BindingProviderFactory<JMSBinding> {
-
- private ExtensionPointRegistry extensionPoints;
- private JMSResourceFactoryExtensionPoint jmsRFEP;
- private JMSServiceListenerFactory serviceListenerFactory;
-
- public JMSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
-
- jmsRFEP = (JMSResourceFactoryExtensionPoint)extensionPoints.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
- if (jmsRFEP == null) {
- jmsRFEP = new DefaultJMSResourceFactoryExtensionPoint();
- extensionPoints.addExtensionPoint(jmsRFEP);
- }
-
- JMSHostExtensionPoint jmsHostExtensionPoint = (JMSHostExtensionPoint)extensionPoints.getExtensionPoint(JMSHostExtensionPoint.class);
- serviceListenerFactory = jmsHostExtensionPoint.getJMSServiceListenerFactory();
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
- return new JMSBindingReferenceBindingProvider(component, reference, binding, extensionPoints, jmsRF);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, JMSBinding binding) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory(binding);
- return new JMSBindingServiceBindingProvider(component, service, binding, binding, serviceListenerFactory, extensionPoints, jmsRF);
- }
-
- public Class<JMSBinding> getModelType() {
- return JMSBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
deleted file mode 100644
index 0e44b84ea0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingReferenceBindingProvider.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.JMSException;
-
-import org.apache.tuscany.sca.binding.jms.headers.HeaderReferenceInterceptor;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.transport.TransportReferenceInterceptor;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of the JMS reference binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingReferenceBindingProvider implements ReferenceBindingProviderRRB {
-
- private RuntimeComponentReference reference;
- private JMSBinding jmsBinding;
- private JMSResourceFactory jmsResourceFactory;
- private RuntimeComponent component;
- private InterfaceContract interfaceContract;
- private ExtensionPointRegistry extensions;
-
- private ProviderFactoryExtensionPoint providerFactories;
-
- private WireFormatProviderFactory requestWireFormatProviderFactory;
- private WireFormatProvider requestWireFormatProvider;
-
- private WireFormatProviderFactory responseWireFormatProviderFactory;
- private WireFormatProvider responseWireFormatProvider;
-
- public JMSBindingReferenceBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, JMSBinding binding, ExtensionPointRegistry extensions, JMSResourceFactory jmsResourceFactory) {
- this.reference = reference;
- this.jmsBinding = binding;
- this.extensions = extensions;
- this.component = component;
- this.jmsResourceFactory = jmsResourceFactory;
-
- // Get the factories/providers for operation selection
- this.providerFactories = extensions.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- // Get the factories/providers for wire format
- this.requestWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass());
- if (this.requestWireFormatProviderFactory != null){
- this.requestWireFormatProvider = requestWireFormatProviderFactory.createReferenceWireFormatProvider(component, reference, jmsBinding);
- }
-
- this.responseWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
- if (this.responseWireFormatProviderFactory != null){
- this.responseWireFormatProvider = responseWireFormatProviderFactory.createReferenceWireFormatProvider(component, reference, jmsBinding);
- }
-
- // create an interface contract that reflects both request and response
- // wire formats
- try {
- interfaceContract = (InterfaceContract)reference.getInterfaceContract().clone();
-
- requestWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract);
- responseWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract);
- } catch (CloneNotSupportedException ex){
- interfaceContract = reference.getInterfaceContract();
- }
- }
-
- public Invoker createInvoker(Operation operation) {
-
- if (jmsBinding.getDestinationName() == null) {
- if (!reference.isCallback()) {
- throw new JMSBindingException("No destination specified for reference " + reference.getName());
- }
- }
-
- Invoker invoker = null;
- invoker = new RRBJMSBindingInvoker(jmsBinding, operation, jmsResourceFactory, reference);
-
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return interfaceContract;
- }
-
- public void start() {
-
- }
-
- public void stop() {
- try {
- jmsResourceFactory.closeConnection();
- jmsResourceFactory.closeResponseConnection();
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- /*
- * set up the reference binding wire with the right set of jms reference
- * interceptors
- */
- public void configureBindingChain(RuntimeWire runtimeWire) {
-
- InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
-
- // add transport interceptor
- bindingChain.addInterceptor(Phase.REFERENCE_BINDING_TRANSPORT,
- new TransportReferenceInterceptor(jmsBinding,
- jmsResourceFactory,
- runtimeWire) );
-
- // add request wire format
- bindingChain.addInterceptor(requestWireFormatProvider.getPhase(),
- requestWireFormatProvider.createInterceptor());
-
- // add response wire format, but only add it if it's different from the request
- if (!jmsBinding.getRequestWireFormat().equals(jmsBinding.getResponseWireFormat())){
- bindingChain.addInterceptor(responseWireFormatProvider.getPhase(),
- responseWireFormatProvider.createInterceptor());
- }
-
- // add the header processor that comes after the wire formatter but before the
- // policy interceptors
- bindingChain.addInterceptor(Phase.REFERENCE_BINDING_WIREFORMAT,
- new HeaderReferenceInterceptor(jmsBinding,
- jmsResourceFactory,
- runtimeWire) );
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
deleted file mode 100644
index de16edb044..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingServiceBindingProvider.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.transport.TransportServiceInterceptor;
-import org.apache.tuscany.sca.binding.jms.wire.CallbackDestinationInterceptor;
-import org.apache.tuscany.sca.binding.jms.wire.OperationPropertiesInterceptor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.jms.JMSServiceListener;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerDetails;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.OperationSelectorProvider;
-import org.apache.tuscany.sca.provider.OperationSelectorProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of the JMS service binding provider.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingServiceBindingProvider implements ServiceBindingProviderRRB, JMSServiceListenerDetails {
- private static final Logger logger = Logger.getLogger(JMSBindingServiceBindingProvider.class.getName());
-
- private RuntimeComponentService service;
- private Binding targetBinding;
- private JMSBinding jmsBinding;
- private JMSResourceFactory jmsResourceFactory;
- private JMSServiceListenerFactory serviceListenerFactory;
- private JMSServiceListener serviceListener;
-
- private RuntimeComponent component;
- private InterfaceContract interfaceContract;
-
- private ProviderFactoryExtensionPoint providerFactories;
- private ModelFactoryExtensionPoint modelFactories;
-
- private MessageFactory messageFactory;
-
- private OperationSelectorProviderFactory operationSelectorProviderFactory;
- private OperationSelectorProvider operationSelectorProvider;
-
- private WireFormatProviderFactory requestWireFormatProviderFactory;
- private WireFormatProvider requestWireFormatProvider;
-
- private WireFormatProviderFactory responseWireFormatProviderFactory;
- private WireFormatProvider responseWireFormatProvider;
-
- public JMSBindingServiceBindingProvider(RuntimeComponent component, RuntimeComponentService service, Binding targetBinding, JMSBinding binding, JMSServiceListenerFactory serviceListenerFactory, ExtensionPointRegistry extensionPoints, JMSResourceFactory jmsResourceFactory) {
- this.component = component;
- this.service = service;
- this.jmsBinding = binding;
- this.serviceListenerFactory = serviceListenerFactory;
- this.targetBinding = targetBinding;
- this.jmsResourceFactory = jmsResourceFactory;
-
- // Set the default destination when using a connection factory.
- // If an activation spec is being used, do not set the destination
- // because the activation spec provides the destination.
- if (jmsBinding.getDestinationName() == null &&
- (jmsBinding.getActivationSpecName() == null || jmsBinding.getActivationSpecName().equals(""))) {
- if (!service.isCallback()) {
- // use the SCA service name as the default destination name
- jmsBinding.setDestinationName(service.getName());
- }
- }
-
- // Get Message factory
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
-
- // Get the factories/providers for operation selection
- this.providerFactories = extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- this.operationSelectorProviderFactory =
- (OperationSelectorProviderFactory)providerFactories.getProviderFactory(jmsBinding.getOperationSelector().getClass());
- if (this.operationSelectorProviderFactory != null){
- this.operationSelectorProvider = operationSelectorProviderFactory.createServiceOperationSelectorProvider(component, service, jmsBinding);
- }
-
- // Get the factories/providers for wire format
- this.requestWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getRequestWireFormat().getClass());
- if (this.requestWireFormatProviderFactory != null){
- this.requestWireFormatProvider = requestWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding);
- }
-
- this.responseWireFormatProviderFactory =
- (WireFormatProviderFactory)providerFactories.getProviderFactory(jmsBinding.getResponseWireFormat().getClass());
- if (this.responseWireFormatProviderFactory != null){
- this.responseWireFormatProvider = responseWireFormatProviderFactory.createServiceWireFormatProvider(component, service, jmsBinding);
- }
-
- // create an interface contract that reflects both request and response
- // wire formats
- try {
- interfaceContract = (InterfaceContract)service.getInterfaceContract().clone();
-
- requestWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract);
- responseWireFormatProvider.configureWireFormatInterfaceContract(interfaceContract);
- } catch (CloneNotSupportedException ex){
- interfaceContract = service.getInterfaceContract();
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return interfaceContract;
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
- public void start() {
- try {
-
- this.serviceListener = serviceListenerFactory.createJMSServiceListener(this);
- serviceListener.start();
-
- } catch (Exception e) {
- throw new JMSBindingException("Error starting JMSServiceBinding", e);
- }
- }
-
- public void stop() {
- try {
- serviceListener.stop();
- } catch (Exception e) {
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
-
- public String getDestinationName() {
- return serviceListener.getDestinationName();
- }
-
- /*
- * Adds JMS specific interceptors to the binding chain
- */
- public void configureBindingChain(RuntimeWire runtimeWire) {
-
- InvocationChain bindingChain = runtimeWire.getBindingInvocationChain();
-
- // add transport interceptor
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_TRANSPORT,
- new TransportServiceInterceptor(jmsBinding,
- jmsResourceFactory,
- runtimeWire) );
-
- // add operation selector interceptor
- bindingChain.addInterceptor(operationSelectorProvider.getPhase(),
- operationSelectorProvider.createInterceptor());
-
- // add operationProperties interceptor after operation selector
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_OPERATION_SELECTOR,
- new OperationPropertiesInterceptor(jmsBinding, runtimeWire));
-
- // add callback destination interceptor after operation selector
- bindingChain.addInterceptor(Phase.SERVICE_BINDING_WIREFORMAT,
- new CallbackDestinationInterceptor(runtimeWire));
-
- // add request wire format
- bindingChain.addInterceptor(requestWireFormatProvider.getPhase(),
- requestWireFormatProvider.createInterceptor());
-
- // add response wire format, but only add it if it's different from the request
- if (!jmsBinding.getRequestWireFormat().equals(jmsBinding.getResponseWireFormat())){
- bindingChain.addInterceptor(responseWireFormatProvider.getPhase(),
- responseWireFormatProvider.createInterceptor());
- }
- }
-
- public RuntimeComponent getComponent() {
- return component;
- }
-
- public RuntimeComponentService getService() {
- return service;
- }
-
- public Binding getTargetBinding() {
- return targetBinding;
- }
-
- public JMSBinding getJmsBinding() {
- return jmsBinding;
- }
-
- public MessageFactory getMessageFactory() {
- return messageFactory;
- }
-
- public JMSResourceFactory getResourceFactory() {
- return jmsResourceFactory;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.java
deleted file mode 100644
index 821b9d7873..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessor.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.binding.jms.provider;
-
-import javax.jms.Message;
-import javax.jms.Session;
-
-/**
- * Interface for a component that does operation selection and message payload processing
- *
- * @version $Rev$ $Date$
- */
-public interface JMSMessageProcessor {
-
- /**
- * Get the operation name from a JMS Message
- */
- String getOperationName(Message message);
-
- /**
- * Set the operation name on a JMS Message
- */
- void setOperationName(String operationName, Message message);
-
- /**
- * Extracts the payload from a JMS Message
- */
- Object extractPayloadFromJMSMessage(Message msg);
-
- /**
- * Create a JMS Message containing the payload
- */
- Message insertPayloadIntoJMSMessage(Session session, Object payload);
-
- /**
- * Create a JMS Message for reporting an exception
- */
- Message createFaultMessage(Session session, Throwable responsePayload);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java
deleted file mode 100644
index 699b1cb176..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSMessageProcessorUtil.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-
-/**
- * Utility methods to load JMS message processors.
- *
- * @version $Rev: $ $Date: $
- */
-public class JMSMessageProcessorUtil {
-
- /**
- * Used to create instances of the JMSResourceFactory and RequestMessageProcessor and ResponseMessageProcessor from
- * string based class name provided in the configuration
- *
- * @param cl ClassLoader
- * @param className the string based class name to load and instantiate
- * @return the new object
- */
- private static Object instantiate(ClassLoader cl, String className, JMSBinding binding) {
- Object instance;
- if (cl == null) {
- cl = binding.getClass().getClassLoader();
- }
-
- try {
- Class<?> clazz;
-
- try {
- clazz = cl.loadClass(className);
- } catch (ClassNotFoundException e) {
- clazz = binding.getClass().getClassLoader().loadClass(className);
- }
-
- Constructor<?> constructor = clazz.getDeclaredConstructor(new Class[] {JMSBinding.class});
- instance = constructor.newInstance(binding);
-
- } catch (Throwable e) {
- throw new JMSBindingException("Exception instantiating OperationAndDataBinding class", e);
- }
-
- return instance;
- }
-
- public static JMSMessageProcessor getRequestMessageProcessor(JMSBinding binding) {
- return (JMSMessageProcessor)instantiate(null, binding.getRequestMessageProcessorName(), binding);
- }
-
- public static JMSMessageProcessor getResponseMessageProcessor(JMSBinding binding) {
- return (JMSMessageProcessor)instantiate(null, binding.getResponseMessageProcessorName(), binding);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java
deleted file mode 100644
index 348764fe43..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.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.binding.jms.provider;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-public interface JMSResourceFactory {
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
- */
- public abstract Connection getConnection() throws NamingException, JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
- */
- public abstract Session createSession() throws JMSException, NamingException;
-
- public abstract void closeSession(Session session) throws JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#startConnection()
- */
- public abstract void startConnection() throws JMSException, NamingException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#closeConnection()
- */
- public abstract void closeConnection() throws JMSException;
-
- public abstract Destination lookupDestination(String destName) throws NamingException;
-
- /**
- * You can create a destination in ActiveMQ (and have it appear in JNDI) by putting "dynamicQueues/" in front of the queue name being looked up
- */
- public abstract Destination createDestination(String jndiName) throws NamingException;
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#getConnection()
- */
- public abstract Connection getResponseConnection() throws NamingException, JMSException;
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.binding.jms.JMSResourceFactory#createSession()
- */
- public abstract Session createResponseSession() throws JMSException, NamingException;
-
- public abstract void closeResponseSession(Session session) throws JMSException;
-
- public abstract void closeResponseConnection() throws JMSException;
-
- /*
- * Indicates whether connections obtained using getConnection() or getResponseConnection()
- * must be closed after each use. This is necessary in environments where connections are
- * shared with other users, or where connections cannot be held across transaction boundaries.
- */
- public abstract boolean isConnectionClosedAfterUse();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.java
deleted file mode 100644
index 57fbfb3215..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryExtensionPoint.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.binding.jms.provider;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-
-public interface JMSResourceFactoryExtensionPoint {
-
- JMSResourceFactory createJMSResourceFactory(JMSBinding binding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
deleted file mode 100644
index 1debc61dff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactoryImpl.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.util.Properties;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-
-/**
- * Abstracts away any JMS provide specific feature from the JMS binding
- *
- * @version $Rev$ $Date$
- */
-public class JMSResourceFactoryImpl implements JMSResourceFactory {
-
- protected String initialContextFactoryName;
- protected String connectionFactoryName = "ConnectionFactory";
- protected String jndiURL;
-
- protected Connection connection;
- protected Context context;
- protected boolean isConnectionStarted;
- private Connection responseConnection;
- private String responseConnectionFactoryName;
-
- public JMSResourceFactoryImpl(String connectionFactoryName, String responseConnectionFactoryName, String initialContextFactoryName, String jndiURL) {
- if (connectionFactoryName != null && connectionFactoryName.trim().length() > 0) {
- this.connectionFactoryName = connectionFactoryName.trim();
- }
- if (responseConnectionFactoryName != null && responseConnectionFactoryName.trim().length() > 0) {
- this.responseConnectionFactoryName = responseConnectionFactoryName.trim();
- }
- if (initialContextFactoryName != null && initialContextFactoryName.trim().length() > 0) {
- this.initialContextFactoryName = initialContextFactoryName.trim();
- }
- if (jndiURL != null) {
- this.jndiURL = jndiURL.trim();
- }
- }
-
- /*
- * This is a simple implementation where a connection is created per binding Ideally the resource factory should be
- * able to leverage the host environment to provide connection pooling if it can. E.g. if Tuscany is running inside
- * an AppServer Then we could leverage the JMS resources it provides
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#getConnection()
- */
- public Connection getConnection() throws NamingException, JMSException {
- if (connection == null) {
- createConnection();
- }
- return connection;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#createSession()
- */
- public Session createSession() throws JMSException, NamingException {
- return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#closeSession(javax.jms.Session)
- */
- public void closeSession(Session session) throws JMSException {
- session.close();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#startConnection()
- */
- public void startConnection() throws JMSException, NamingException {
- if (!isConnectionStarted) {
- getConnection().start();
- isConnectionStarted = true;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#closeConnection()
- */
- public void closeConnection() throws JMSException {
- if (connection != null) {
- try {
- connection.close();
- } catch (JMSException e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!e.getMessage().contains("disposed")) {
- throw e;
- }
- }
- }
- }
-
- protected void createConnection() throws NamingException, JMSException {
- ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(connectionFactoryName);
- if (connectionFactory == null) {
- throw new JMSBindingException("connection factory not found: " + connectionFactoryName);
- }
- connection = connectionFactory.createConnection();
- }
-
- protected synchronized Context getInitialContext() throws NamingException {
- if (context == null) {
- Properties props = new Properties();
-
- if (initialContextFactoryName != null) {
- props.setProperty(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
- }
- if (jndiURL != null) {
- props.setProperty(Context.PROVIDER_URL, jndiURL);
- }
-
- initJREEnvironment(props);
-
- context = new InitialContext(props);
- }
- return context;
- }
-
- /**
- * If using the WAS JMS Client with a non-IBM JRE then an additional
- * environment property needs to be set to initialize the ORB correctly.
- * See: http://www-1.ibm.com/support/docview.wss?uid=swg24012804
- */
- protected void initJREEnvironment(Properties props) {
- if ("com.ibm.websphere.naming.WsnInitialContextFactory".equals(props.get(Context.INITIAL_CONTEXT_FACTORY))) {
- String vendor = System.getProperty("java.vendor");
- if (vendor == null || !vendor.contains("IBM")) {
- props.setProperty("com.ibm.CORBA.ORBInit", "com.ibm.ws.sib.client.ORB");
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#lookupDestination(java.lang.String)
- */
- public Destination lookupDestination(String destName) throws NamingException {
- if (destName == null) {
- return null;
- }
-
- Destination dest = (Destination)jndiLookUp(destName);
- if (dest == null) {
- dest = lookupPhysical(destName);
- }
- return dest;
- }
-
- protected Destination lookupPhysical(String jndiName) {
-
- // TODO: the SCA JMS spec says a destination name may be a non-jndi plain destination name
-
-// Session session = null;
-// try {
-//
-// Destination dest;
-// session = createSession();
-// dest = session.createQueue(jndiName);
-// return dest;
-//
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// } catch (NamingException e) {
-// throw new JMSBindingException(e);
-// } finally {
-// if (session != null) {
-// try {
-// session.close();
-// } catch (JMSException e) {
-// throw new JMSBindingException(e);
-// }
-// }
-// }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory#createDestination(java.lang.String)
- */
- public Destination createDestination(String jndiName) throws NamingException {
- return lookupDestination("dynamicQueues/" + jndiName);
- }
-
- protected Object jndiLookUp(String name) {
- Object o = null;
- try {
- o = getInitialContext().lookup("java:comp/env/" + name);
- } catch (Exception ex) {
- // ignore
- }
- if (o == null) {
- try {
- o = getInitialContext().lookup(name);
- } catch (NamingException ex) {
- // ignore
- }
- }
- return o;
- }
-
- public Session createResponseSession() throws JMSException, NamingException {
- return getResponseConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
- }
-
- public void closeResponseSession(Session session) throws JMSException {
- session.close();
- }
-
- public Connection getResponseConnection() throws NamingException, JMSException {
- if (responseConnection == null) {
- if (responseConnectionFactoryName != null) {
- ConnectionFactory connectionFactory = (ConnectionFactory)jndiLookUp(responseConnectionFactoryName);
- if (connectionFactory == null) {
- throw new JMSBindingException("connection factory not found: " + responseConnectionFactoryName);
- }
- responseConnection = connectionFactory.createConnection();
- } else {
- // if no response connection is defined in the SCDL use the request connection
- responseConnection = getConnection();
- }
- }
- return responseConnection;
- }
-
- public void closeResponseConnection() throws JMSException {
- if (responseConnection != null && !responseConnection.equals(connection)) {
- try {
- responseConnection.close();
- } catch (JMSException e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!e.getMessage().contains("disposed")) {
- throw e;
- }
- }
- }
- }
-
- public boolean isConnectionClosedAfterUse() {
- // It is assumed this resource factory is used in an environment
- // where the connection can be held for the life of the binding.
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
deleted file mode 100644
index 331c63f20f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ObjectMessageProcessor.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.ObjectMessage;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * MessageProcessor for sending/receiving Serializable objects with the JMSBinding.
- *
- */
-public class ObjectMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(ObjectMessageProcessor.class.getName());
-
- public ObjectMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
-
- ObjectMessage message = session.createObjectMessage();
-
- if (o != null){
- if (!(o instanceof Serializable)) {
- throw new IllegalStateException("JMS ObjectMessage payload not Serializable: " + o);
- }
-
- message.setObject((Serializable)o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Object extractPayloadFromJMSMessage(Message msg) {
- try {
- Object o = ((ObjectMessage)msg).getObject();
- if (o instanceof Throwable ) {
- if (o instanceof RuntimeException) {
- throw new ServiceRuntimeException("remote service exception, see nested exception", (RuntimeException)o);
- } else {
- return new InvocationTargetException((Throwable) o);
- }
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- return extractPayload(msg);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- return ((ObjectMessage)msg).getObject();
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- // special methods for handling operations with single parameters
-
- public Message createJMSMessageForSingleParamOperation(Session session, Object o, boolean wrapSingleInput) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
-
- ObjectMessage message = session.createObjectMessage();
-
- if (o != null) {
- if (!(o instanceof Serializable)) {
- throw new IllegalStateException("JMS ObjectMessage payload not Serializable: " + o);
- }
-
- // If the user has specifically requests that single parameters
- // be wrapped then leave is as is as it will have already been
- // wrapped by Tuscany. Otherwise unwrap it.
- if (wrapSingleInput) {
- message.setObject((Serializable) o);
- } else { // unwrap from array
- message.setObject((Serializable) ((Object[]) o)[0]);
- }
-
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Object extractPayloadFromJMSMessageForSingleParamOperation(Message msg, Class<?> argType, boolean wrapSingle) {
- // We always have a one arg operation if this method is called so we need to
- // decide if the data on the wire is wrapped or not. This is the algorithm.
- //
- // If the payload is null then create an empty array and pass it on
- // If the payload is not an array then it must represent an unwrapped
- // single arg. Wrap it up and pass it on
- // If the payload is an array then determine if it's a wrapped single arg or not
- // If the service interface arg type matches the type of the array and not it's contents
- // then it's an unwrapped argument so wrap it and pass it on
- // If the service interface arg type matches the type of the contents and not the type
- // of the array then the parameter is already wrapped so pass it on as is
- // If the service interface arg type matches both the type of the
- // array and the type of its contents then assume that the whole array is the
- // parameter and decide whether to unwrap it or pass it on as is based on the
- // setting of the wrapSingle attribute
- //
-
- try {
- Object payload = ((ObjectMessage) msg).getObject();
-
- if (payload instanceof Throwable) {
- if (payload instanceof RuntimeException) {
- throw new ServiceRuntimeException("remote service exception, see nested exception", (RuntimeException) payload);
- } else {
- return new InvocationTargetException((Throwable) payload);
- }
- }
-
- if (payload == null) {
- // methodA(null) was not wrapped on wire so wrap it here in order
- // that it passes through the rest of the Tuscany wire successfully
- return new Object[] { payload };
- }
-
- boolean payloadIsArray = payload.getClass().isArray();
-
- // Non-array payload is single arg
- if (!payloadIsArray) {
- // methodB(arg) wasn't wrapped on wire so wrap it here in order
- // that it passes through the rest of the Tuscany wire successfully
- return new Object[] { payload };
- } else {
- int size = ((Object[]) payload).length;
-
- // An initial quick check to determine whether the payload is not
- // wrapped. If the array has anything other than a single entry
- // then it's not the result of reference side wrapping so wrap it
- // here and pass it on
- if (size != 1) {
- return new Object[] { payload };
- }
-
- // we know the array has only one entry now so get it
- Object arrayContents = ((Object[]) payload)[0];
-
- // Is the operation argument the same type as the array itself?
- if (argType.isAssignableFrom(payload.getClass())) {
-
- // So we believe that the whole array is the argument but need
- // to check what is in the array to be sure
- if (arrayContents == null) {
- // There is nothing in the array so it could be an accident that
- // the array type matches the argument type, e.g. op(Object)
- // so rely on the wrapSingle setting to choose
- if (wrapSingle) {
- return payload;
- } else {
- return new Object[] { payload };
- }
- } else if (argType.isAssignableFrom(arrayContents.getClass())) {
- // We can't tell as the argument type matches both the array type and
- // the array contents type so use the wrapSingle setting to choose
- if (wrapSingle) {
- return payload;
- } else {
- return new Object[] { payload };
- }
- } else {
- // So by now we know the whole array is intended to be the
- // parameter to wrap it and send it on
- return new Object[] { payload };
- }
-
- } else {
- // The array type doesn't match the argument type so assume that the
- // array contents will match the argument type and that hence the
- // parameter is already wrapped so just send it as is. If the contents
- // type doesn't match the argument type a exception will be thrown further
- // along the wire
- return payload;
- }
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
deleted file mode 100644
index ee9501bf89..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Invoker for the JMS binding.
- *
- * @version $Rev$ $Date$
- */
-public class RRBJMSBindingInvoker implements Invoker, DataExchangeSemantics {
-
- protected Operation operation;
- protected String operationName;
-
- protected JMSBinding jmsBinding;
- protected JMSResourceFactory jmsResourceFactory;
- protected Destination bindingRequestDest;
- protected Destination bindingReplyDest;
- protected RuntimeComponentReference reference;
- protected RuntimeWire runtimeWire;
-
- public RRBJMSBindingInvoker(JMSBinding jmsBinding, Operation operation, JMSResourceFactory jmsResourceFactory, RuntimeComponentReference reference) {
-
- this.operation = operation;
- operationName = operation.getName();
-
- this.jmsBinding = jmsBinding;
- this.jmsResourceFactory = jmsResourceFactory;
- this.reference = reference;
- this.runtimeWire = reference.getRuntimeWire(jmsBinding);
-
- try {
- // If this is a callback reference, the destination is determined dynamically based on
- // properties of the inbound service request. We should not look for or require a
- // statically-configured destination unless a message is received that does not have
- // the necessary properties.
- if (!reference.isCallback()) {
- bindingRequestDest = lookupDestination();
- }
- bindingReplyDest = lookupResponseDestination();
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- }
- }
-
- /**
- * Looks up the Destination Queue for the JMS Binding
- *
- * @return The Destination Queue
- * @throws NamingException Failed to lookup Destination Queue
- * @throws JMSBindingException Failed to lookup Destination Queue
- * @see #lookupDestinationQueue(boolean)
- */
- protected Destination lookupDestination() throws NamingException, JMSBindingException {
- return lookupDestinationQueue(false);
- }
-
- /**
- * Looks up the Destination Response Queue for the JMS Binding
- *
- * @return The Destination Response Queue
- * @throws NamingException Failed to lookup Destination Response Queue
- * @throws JMSBindingException Failed to lookup Destination Response Queue
- * @see #lookupDestinationQueue(boolean)
- */
- protected Destination lookupResponseDestination() throws NamingException, JMSBindingException {
- return lookupDestinationQueue(true);
- }
-
- /**
- * Looks up the Destination Queue for the JMS Binding.
- * <p>
- * What happens in the look up will depend on the create mode specified for the JMS Binding:
- * <ul>
- * <li>always - the JMS queue is always created. It is an error if the queue already exists
- * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
- * <li>never - the JMS queue is never created. It is an error if the queue does not exist
- * </ul>
- * See the SCA JMS Binding specification for more information.
- * <p>
- *
- * @param isReponseQueue <code>true</code> if we are creating a response queue.
- * <code>false</code> if we are creating a request queue
- * @return The Destination queue.
- * @throws NamingException Failed to lookup JMS queue
- * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that
- * the JMS queue's current existence/non-existence is not compatible with
- * the create mode specified on the binding
- */
- protected Destination lookupDestinationQueue(boolean isReponseQueue) throws NamingException, JMSBindingException {
- String queueName;
- String queueType;
- String qCreateMode;
-
- if (isReponseQueue) {
- queueName = jmsBinding.getResponseDestinationName();
- queueType = "JMS Response Destination ";
- qCreateMode = jmsBinding.getResponseDestinationCreate();
- if (queueName == null) {
- return null;
- }
- } else {
- queueName = jmsBinding.getDestinationName();
- queueType = "JMS Destination ";
- qCreateMode = jmsBinding.getDestinationCreate();
- }
-
- Destination dest = jmsResourceFactory.lookupDestination(queueName);
-
- if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
- // In this mode, the queue must not already exist as we are creating it
- if (dest != null) {
- throw new JMSBindingException(queueType + queueName
- + " already exists but has create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
- // Create the queue
- dest = jmsResourceFactory.createDestination(queueName);
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- // In this mode, the queue may nor may not exist. It will be created if it does not exist
- if (dest == null) {
- dest = jmsResourceFactory.createDestination(queueName);
- }
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
- // In this mode, the queue must have already been created.
- if (dest == null) {
- throw new JMSBindingException(queueType + queueName
- + " not found but create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
- }
-
- // Make sure we ended up with a queue
- if (dest == null) {
- throw new JMSBindingException(queueType + queueName
- + " not found with create mode of \""
- + qCreateMode
- + "\" while registering binding "
- + jmsBinding.getName()
- + " invoker");
- }
-
- return dest;
- }
-
- public org.apache.tuscany.sca.invocation.Message invoke(org.apache.tuscany.sca.invocation.Message tuscanyMsg) {
- try {
- // populate the message context with JMS binding information
- JMSBindingContext context = new JMSBindingContext();
- context.setJmsResourceFactory(jmsResourceFactory);
- tuscanyMsg.setBindingContext(context);
-
- // get a jms session to cover the creation and sending of the message
- Session session = context.getJmsSession();
-
- context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
- context.setReplyToDestination(getReplyToDestination(session));
-
- try {
- tuscanyMsg = runtimeWire.getBindingInvocationChain().getHeadInvoker().invoke(tuscanyMsg);
- } catch (ServiceRuntimeException e) {
- if (e.getCause() instanceof InvocationTargetException) {
- if ((e.getCause().getCause() instanceof RuntimeException)) {
- tuscanyMsg.setFaultBody(e.getCause());
- } else {
- tuscanyMsg.setFaultBody(((InvocationTargetException)e.getCause()).getTargetException());
- }
- } else if (e.getCause() instanceof FaultException) {
- tuscanyMsg.setFaultBody(e.getCause());
- } else {
- tuscanyMsg.setFaultBody(e);
- }
- } catch (IllegalStateException e) {
- tuscanyMsg.setFaultBody(e);
- } catch (Throwable e) {
- tuscanyMsg.setFaultBody(e);
- } finally {
- context.closeJmsSession();
- if (jmsResourceFactory.isConnectionClosedAfterUse()) {
- jmsResourceFactory.closeConnection();
- }
- }
-
- return tuscanyMsg;
- } catch (Exception e) {
- throw new JMSBindingException(e);
- }
- }
-
- protected Destination getRequestDestination(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Session session) throws JMSBindingException, NamingException, JMSException {
- Destination requestDestination;
- if (reference.isCallback()) {
- String toURI = tuscanyMsg.getTo().getURI();
- if (toURI != null && toURI.startsWith("jms:")) {
- // the msg to uri contains the callback destination name
- // this is an jms physical name not a jndi name so need to use session.createQueue
- requestDestination = session.createQueue(toURI.substring(4));
- } else {
- requestDestination = lookupDestination();
- }
- } else {
- requestDestination = bindingRequestDest;
- }
-
- return requestDestination;
- }
-
- protected Destination getReplyToDestination(Session session) throws JMSException, JMSBindingException, NamingException {
- Destination replyToDest;
- if (operation.isNonBlocking()) {
- replyToDest = null;
- } else {
- if (bindingReplyDest != null) {
- replyToDest = bindingReplyDest;
- } else {
- replyToDest = session.createTemporaryQueue();
- }
- }
- return replyToDest;
- }
-
- public boolean allowsPassByReference() {
- // JMS always pass by value
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java
deleted file mode 100644
index c1b5e6562d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/TextMessageProcessor.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-
-/**
- * MessageProcessor for sending/receiving javax.jms.TextMessage with the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class TextMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(TextMessageProcessor.class.getName());
-
- public TextMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- if (!(msg instanceof TextMessage)) {
- throw new IllegalStateException("expecting JMS TextMessage: " + msg);
- }
-
- return ((TextMessage)msg).getText();
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
-
- TextMessage message = session.createTextMessage();
-
- if (o != null){
- message.setText(String.valueOf(o));
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.java
deleted file mode 100644
index 5a9e82b7da..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLBytesMessageProcessor.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.binding.jms.provider;
-
-import java.io.ByteArrayInputStream;
-import java.util.logging.Logger;
-
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-
-/**
- * MessageProcessor for sending/receiving XML javax.jms.BytesMessage with the JMSBinding.
- */
-public class XMLBytesMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(XMLBytesMessageProcessor.class.getName());
-
- public XMLBytesMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- if (!(msg instanceof BytesMessage)) {
- throw new IllegalStateException("expecting JMS BytesMessage: " + msg);
- }
-
- long noOfBytes = ((BytesMessage)msg).getBodyLength();
- byte [] bytes = new byte[(int)noOfBytes];
- ((BytesMessage)msg).readBytes(bytes);
- ((BytesMessage)msg).reset();
-
- Object os;
- if (noOfBytes > 0) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(bytes));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
- return os;
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Object extractPayloadFromJMSMessage(Message msg) {
- if (msg instanceof BytesMessage) {
- return extractPayload(msg);
- } else {
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
- BytesMessage message = session.createBytesMessage();
-
- if (o instanceof OMElement) {
- message.writeBytes(o.toString().getBytes());
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof OMElement) {
- message.writeBytes(((Object[])o)[0].toString().getBytes());
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
-
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- BytesMessage message = session.createBytesMessage();
- message.writeBytes(String.valueOf(((FaultException) o).getFaultInfo()).getBytes());
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- return super.createFaultMessage(session, o);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
deleted file mode 100644
index 8794f80126..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/XMLTextMessageProcessor.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.provider;
-
-import java.io.StringReader;
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-
-/**
- * MessageProcessor for sending/receiving XML javax.jms.TextMessage with the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class XMLTextMessageProcessor extends AbstractMessageProcessor {
- private static final Logger logger = Logger.getLogger(XMLTextMessageProcessor.class.getName());
-
- public XMLTextMessageProcessor(JMSBinding jmsBinding) {
- super(jmsBinding);
- }
-
- @Override
- protected Object extractPayload(Message msg) {
- try {
-
- String xml = ((TextMessage)msg).getText();
- Object os;
- if (xml != null) {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(xml));
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- os = builder.getDocumentElement();
- } else {
- os = null;
- }
- return os;
-
- } catch (XMLStreamException e) {
- throw new JMSBindingException(e);
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Object extractPayloadFromJMSMessage(Message msg) {
- if (msg instanceof TextMessage) {
- return extractPayload(msg);
- } else {
- return super.extractPayloadFromJMSMessage(msg);
- }
- }
-
- @Override
- protected Message createJMSMessage(Session session, Object o) {
- if (session == null) {
- logger.fine("no response session to create message: " + String.valueOf(o));
- return null;
- }
- try {
-
- TextMessage message = session.createTextMessage();
-
- if (o instanceof OMElement) {
- message.setText(o.toString());
- } else if ((o instanceof Object[]) && ((Object[])o)[0] instanceof OMElement) {
- message.setText(((Object[])o)[0].toString());
- } else if (o != null) {
- throw new IllegalStateException("expecting OMElement payload: " + o);
- }
-
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- @Override
- public Message createFaultMessage(Session session, Throwable o) {
- if (session == null) {
- logger.fine("no response session to create fault message: " + String.valueOf(o));
- return null;
- }
- if (o instanceof FaultException) {
- try {
-
- TextMessage message = session.createTextMessage();
- message.setText(String.valueOf(((FaultException)o).getFaultInfo()));
- message.setBooleanProperty(JMSBindingConstants.FAULT_PROPERTY, true);
- return message;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- return super.createFaultMessage(session, o);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
deleted file mode 100644
index 0628cfbb32..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.transport;
-
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class TransportReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private RuntimeComponentReference reference;
-
- public TransportReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.reference = (RuntimeComponentReference)runtimeWire.getSource().getContract();
- }
-
- public Message invoke(Message msg) {
- Message responseMsg = invokeRequest(msg);
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
-
- if (context.getReplyToDestination() == null) {
- responseMsg.setBody(null);
- } else {
- responseMsg = invokeResponse(msg);
- }
-
- return responseMsg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- MessageProducer producer = session.createProducer(context.getRequestDestination());
-
- // Set JMS header attributes in producer, not message.
- String opName = msg.getOperation().getName();
- if (jmsBinding.getOperationJMSTimeToLive(msg.getOperation().getName()) != null) {
- producer.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(msg.getOperation().getName()));
- }
- Integer priority = jmsBinding.getOperationJMSPriority( opName );
- if (priority != null) {
- producer.setPriority(priority.intValue());
- }
- Boolean deliveryModePersistent = jmsBinding.getOperationJMSDeliveryMode(opName);
- if (deliveryModePersistent != null) {
- if (deliveryModePersistent.booleanValue())
- producer.setDeliveryMode(javax.jms.DeliveryMode.PERSISTENT);
- else
- producer.setDeliveryMode(javax.jms.DeliveryMode.NON_PERSISTENT);
- }
-
- try {
- producer.send((javax.jms.Message)msg.getBody());
- } finally {
- producer.close();
- }
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- JMSBindingContext context = msg.getBindingContext();
- try {
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message requestMessage = (javax.jms.Message)msg.getBody();
-
- String msgSelector = "JMSCorrelationID = '" +
- requestMessage.getJMSMessageID() +
- "'";
- MessageConsumer consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
-
- javax.jms.Message replyMsg;
- try {
- context.getJmsResourceFactory().startConnection();
- //jmsResourceFactory.startConnection();
- replyMsg = consumer.receive(context.getTimeToLive());
- } finally {
- consumer.close();
- }
- if (replyMsg == null) {
- throw new JMSBindingException("No reply message received on " +
- context.getReplyToDestination() +
- " for message id " +
- requestMessage.getJMSMessageID());
- }
-
- msg.setBody(replyMsg);
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- } finally {
- try {
- context.closeJmsResponseSession();
- if (jmsResourceFactory.isConnectionClosedAfterUse())
- jmsResourceFactory.closeResponseConnection();
- } catch (JMSException e) {
- }
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
deleted file mode 100644
index 626e44f34f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.transport;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TransportServiceInterceptor implements Interceptor {
- private static final Logger logger = Logger.getLogger(TransportServiceInterceptor.class.getName());
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private RuntimeComponentService service;
- private String correlationScheme;
-
-
- public TransportServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.service = (RuntimeComponentService)runtimeWire.getTarget().getContract();
- this.correlationScheme = jmsBinding.getCorrelationScheme();
- }
-
- public Message invoke(Message msg) {
- try {
- return invokeResponse(next.invoke(invokeRequest(msg)));
- } catch (Throwable e) {
- logger.log(Level.SEVERE, "Exception invoking service '" + service.getName(), e);
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message replyJMSMsg = responseMessageProcessor.createFaultMessage(context.getJmsResponseSession(),
- (Throwable)e);
- msg.setBody(replyJMSMsg);
- invokeResponse(msg);
- return msg;
- } finally {
- try {
- ((JMSBindingContext)msg.getBindingContext()).closeJmsResponseSession();
- if (jmsResourceFactory.isConnectionClosedAfterUse())
- jmsResourceFactory.closeResponseConnection();
- } catch (JMSException e) {
- }
- }
- }
-
- public Message invokeRequest(Message msg) {
- try {
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
-
- EndpointReference from = new EndpointReferenceImpl(null);
- msg.setFrom(from);
- from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: whats this for?
- ReferenceParameters parameters = from.getReferenceParameters();
-
- String conversationID = requestJMSMsg.getStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY);
- if (conversationID != null) {
- parameters.setConversationID(conversationID);
- }
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- try {
-
- //if operation is oneway, return back.
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
- javax.jms.Message requestJMSMsg = context.getJmsMsg();
- javax.jms.Message responseJMSMsg = msg.getBody();
-
- Destination replyDest = requestJMSMsg.getJMSReplyTo();
- if (replyDest == null) {
- if (jmsBinding.getResponseDestinationName() != null) {
- try {
- replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
- } catch (NamingException e) {
- throw new JMSBindingException("Exception lookingup response destination", e);
- }
- }
- }
-
- if (replyDest == null) {
- // assume no reply is expected
- if (msg.getBody() != null) {
- logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo");
- }
- return msg;
- }
-
- responseJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
- responseJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
-
- if (correlationScheme == null ||
- JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
- responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
- } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
- responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
- }
-
- MessageProducer producer = session.createProducer(replyDest);
-
- // Set jms header attributes in producer, not message.
- int deliveryMode = requestJMSMsg.getJMSDeliveryMode();
- producer.setDeliveryMode(deliveryMode);
- int deliveryPriority = requestJMSMsg.getJMSPriority();
- producer.setPriority(deliveryPriority);
-
- producer.send((javax.jms.Message)msg.getBody());
-
- producer.close();
- context.closeJmsResponseSession();
-
- return msg;
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
deleted file mode 100644
index 64badf9002..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.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.binding.jms.wire;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-public class CallbackDestinationInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeComponentService service;
-
- public CallbackDestinationInterceptor(RuntimeWire runtimeWire) {
- super();
- this.service = (RuntimeComponentService) runtimeWire.getTarget().getContract();
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
-
- if (service.getInterfaceContract().getCallbackInterface() != null) {
-
- String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY);
- if (callbackdestName == null && msg.getOperation().isNonBlocking()) {
- // if the request has a replyTo but this service operation is oneway but the service uses callbacks
- // then use the replyTo as the callback destination
- Destination replyTo = jmsMsg.getJMSReplyTo();
- if (replyTo != null) {
- callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName();
- }
- }
-
- if (callbackdestName != null) {
- // append "jms:" to make it an absolute uri so the invoker can determine it came in on the request
- // as otherwise the invoker should use the uri from the service callback binding
- parameters.setCallbackReference(new EndpointReferenceImpl("jms:" + callbackdestName));
- }
-
- String callbackID = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY);
- if (callbackID != null) {
- parameters.setCallbackID(callbackID);
- }
- }
-
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- return msg;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java
deleted file mode 100644
index 2ba2429dfa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/OperationPropertiesInterceptor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wire;
-
-import java.util.List;
-
-import javax.jms.Destination;
-import javax.jms.Queue;
-import javax.jms.Topic;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-public class OperationPropertiesInterceptor implements Interceptor {
- private Invoker next;
- private JMSBinding jmsBinding;
- private RuntimeComponentService service;
- private List<Operation> serviceOperations;
-
- public OperationPropertiesInterceptor(JMSBinding jmsBinding, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.service = (RuntimeComponentService) runtimeWire.getTarget().getContract();
- this.serviceOperations = service.getInterfaceContract().getInterface().getOperations();
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Message invoke(Message msg) {
- return next.invoke(invokeRequest(msg));
- }
-
- public Message invokeRequest(Message msg) {
- // TODO - could probably optimize this better
- String operationName = msg.getOperation().getName();
- String operationNameOverride = jmsBinding.getNativeOperationName(operationName);
- for (Operation op : serviceOperations) {
- if (op.getName().equals(operationNameOverride)) {
- msg.setOperation(op);
- break;
- }
- }
- return msg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.java
deleted file mode 100644
index aa5df2b8bb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesProviderFactory.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.binding.jms.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSBytesProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSBytesReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new WireFormatJMSBytesServiceProvider(registry, component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
deleted file mode 100644
index d08707a1ba..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceInterceptor.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
-
-
-import java.lang.reflect.InvocationTargetException;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- Object[] requestParams = msg.getBody();
- javax.jms.Message requestMsg = null;
- if (requestParams != null && requestParams.length > 0 ){
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, requestParams[0]);
- } else {
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, null);
- }
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null){
- Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
- if (response instanceof InvocationTargetException) {
- msg.setFaultBody(((InvocationTargetException) response).getCause());
- } else {
- if (response != null){
- msg.setBody(response);
- } else {
- msg.setBody(null);
- }
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java
deleted file mode 100644
index 610c9901ec..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesReferenceProvider.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesReferenceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding)binding;
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however overried
- // any message processors specied in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
- }
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = reference.getReference().getInterfaceContract();
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesReferenceInterceptor(binding,
- null,
- reference.getRuntimeWire(binding));
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.java
deleted file mode 100644
index 5128309233..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceInterceptor.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.binding.jms.wireformat.jmsbytes.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- //if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- msg.setBody(new Object[]{requestPayload});
-
- return msg;
- }
-
- public Message invokeResponse(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
- if (msg.isFault()) {
- responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
- } else {
- Object response = msg.getBody();
- responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
deleted file mode 100644
index 426bca28c6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/runtime/WireFormatJMSBytesServiceProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesServiceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding)binding;
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.BYTES_MP_CLASSNAME);
- }
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = service.getService().getInterfaceContract();
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytes){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytes){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesServiceInterceptor((JMSBinding)binding,
- null,
- service.getRuntimeWire(binding));
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java
deleted file mode 100644
index 782f226fe6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLProviderFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-
-public class WireFormatJMSBytesXMLProviderFactory implements WireFormatProviderFactory<WireFormatJMSBytes> {
- private ExtensionPointRegistry registry;
- private JMSResourceFactoryExtensionPoint jmsRFEP;
-
- public WireFormatJMSBytesXMLProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- jmsRFEP = (JMSResourceFactoryExtensionPoint)registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSBytesXMLReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)binding);
- return new WireFormatJMSBytesXMLServiceProvider(registry, component, service, binding, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.java
deleted file mode 100644
index cbcd848c85..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceInterceptor.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.binding.jms.wireformat.jmsbytesxml.runtime;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-
-public class WireFormatJMSBytesXMLReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesXMLReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
-
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null){
- javax.jms.Message jmsMsg = (javax.jms.Message)msg.getBody();
- Object response = responseMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- if (response != null ){
- msg.setBody(response);
- try {
- if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- FaultException e = new FaultException("remote exception", response);
- OMElement om = (OMElement) response;
- e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
- msg.setFaultBody(e);
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- msg.setBody(null);
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.java
deleted file mode 100644
index bd04d4b24f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLReferenceProvider.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.binding.jms.wireformat.jmsbytesxml.runtime;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-public class WireFormatJMSBytesXMLReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesXMLReferenceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding)binding;
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however overried
- // any message processors specied in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_BYTES_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_BYTES_MP_CLASSNAME);
- }
-
- // create a local interface contract that is configured specifically to
- // deal with the data format that this wire format is expecting to sent to
- // and receive from the databinding interceptor. The request/response parts of
- // this interface contract will be copied into the binding interface contract
- // as required
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesXMLReferenceInterceptor(binding,
- null,
- reference.getRuntimeWire(binding));
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
deleted file mode 100644
index e3d22fa814..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceInterceptor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-public class WireFormatJMSBytesXMLServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSBytesXMLServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- //if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- msg.setBody(new Object[]{requestPayload});
-
- return msg;
- }
-
- public Message invokeResponse(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
- if (msg.isFault()) {
- responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
- } else {
- Object response = msg.getBody();
- responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.java
deleted file mode 100644
index c2d81600e1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/runtime/WireFormatJMSBytesXMLServiceProvider.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.binding.jms.wireformat.jmsbytesxml.runtime;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-public class WireFormatJMSBytesXMLServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSBytesXMLServiceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding,
- JMSResourceFactory jmsResourceFactory) {
- super();
- this.registry = registry;
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding)binding;
- this.jmsResourceFactory = jmsResourceFactory;
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_BYTES_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_BYTES_MP_CLASSNAME);
- }
-
- // create a local interface contract that is configured specifically to
- // deal with the data format that this wire format is expecting to sent to
- // and receive from the databinding interceptor. The request/response parts of
- // this interface contract will be copied into the binding interface contract
- // as required
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSBytesXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSBytesXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new WireFormatJMSBytesXMLServiceInterceptor((JMSBinding)binding,
- jmsResourceFactory,
- service.getRuntimeWire(binding));
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java
deleted file mode 100644
index cde7dfd6aa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultProviderFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultProviderFactory implements WireFormatProviderFactory<WireFormatJMSDefault> {
- private ExtensionPointRegistry registry;
- private JMSResourceFactoryExtensionPoint jmsRFEP;
-
- public WireFormatJMSDefaultProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- jmsRFEP = (JMSResourceFactoryExtensionPoint) registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component, RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSDefaultReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding) binding);
- return new WireFormatJMSDefaultServiceProvider(registry, component, service, binding, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
deleted file mode 100644
index f132940b22..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceInterceptor.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-import javax.jms.BytesMessage;
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private DefaultMessageProcessor requestMessageProcessor;
- private DefaultMessageProcessor responseMessageProcessor;
- private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, OMElement> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, Boolean> inputWrapperMap,
- HashMap<String, OMElement> outputWrapperMap) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- // Note the default processor doesn't follow the normal processor pattern
- // as it has to handle both text and bytes messages
- this.requestMessageProcessor = new DefaultMessageProcessor(jmsBinding);
- this.responseMessageProcessor = new DefaultMessageProcessor(jmsBinding);
- this.inputWrapperMap = inputWrapperMap;
- this.outputWrapperMap = outputWrapperMap;
- }
-
- public Message invoke(Message msg) {
-
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault) {
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault) {
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- javax.jms.Message requestMsg;
-
- if (((WireFormatJMSDefault) jmsBinding.getRequestWireFormat()).isUseBytesMessage()) {
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSBytesMessage(session, msg.getBody(), this.inputWrapperMap.get(msg.getOperation().getName()));
- } else {
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSTextMessage(session, msg.getBody(), this.inputWrapperMap.get(msg.getOperation().getName()));
- }
-
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null) {
- javax.jms.Message jmsMsg = (javax.jms.Message) msg.getBody();
-
- Operation op = msg.getOperation();
- DataType outputDataType = op.getOutputType();
-
- Class<?> outputType = null;
- if (outputDataType != null) {
- outputType = outputDataType.getPhysical();
- }
-
- if (outputType != null && javax.jms.Message.class.isAssignableFrom(outputType)) {
- msg.setBody(jmsMsg);
- } else {
-
- OMElement wrapper = null;
- // if we have a fault no need to wrap the response
- try {
- if (!jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- // If there is only one arg we must add a wrapper if the operation is wrapper style
- wrapper = this.outputWrapperMap.get(msg.getOperation().getName());
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
-
- Object response;
- if (jmsMsg instanceof BytesMessage) {
- response = responseMessageProcessor.extractPayloadFromJMSBytesMessage(jmsMsg, wrapper);
- } else {
- response = responseMessageProcessor.extractPayloadFromJMSTextMessage(jmsMsg, wrapper);
- }
-
- if (response != null) {
- msg.setBody(response);
- try {
- if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- FaultException e = new FaultException("remote exception", response);
- OMElement om = (OMElement) response;
- e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
- msg.setFaultBody(e);
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- msg.setBody(null);
- }
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
deleted file mode 100644
index f15d7317f8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultReferenceProvider.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
- private HashMap<String, Boolean> inputWrapperMap;
- private HashMap<String, OMElement> outputWrapperMap;
-
- public WireFormatJMSDefaultReferenceProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentReference reference, Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding) binding;
-
- this.inputWrapperMap = new HashMap<String, Boolean>();
- this.outputWrapperMap = new HashMap<String, OMElement>();
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
-
- // TODO - can be null if it's a $self$ reference. Need to decide if
- // that's valid
- if (reference.getReference() == null){
- interfaceContract = reference.getInterfaceContract();
- return;
- }
-
- List<Operation> opList = reference.getReference().getInterfaceContract().getInterface().getOperations();
-
- // Go through each operation and add wrapper info
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- // set the binding interface contract to represent the WSDL for the
- // xml messages that will be sent
- // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
- if (reference.getInterfaceContract() != null && !isAsIs()) {
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
-
- List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
-
- for (Operation op : opList) {
-
- String name = op.getName();
- Operation matchingWsdlOp = null;
-
- // find the matching wsdlop
- for (Operation wsdlOp : wsdlOpList) {
- if (name.equals(wsdlOp.getName())) {
- matchingWsdlOp = wsdlOp;
-
- break;
- }
- }
-
- // only add operations that need to be wrapped/unwrapped
- // we need to look at the wsdl interface to determine if the op is wrapped or not
-
- // TODO - not sure we really support viewing the input/output as separately wrapped
- // like the separate code paths imply. Not sure how many @OneWay tests we have, this might
- // not be an issue.
-
- if (matchingWsdlOp.isInputWrapperStyle()) {
- if (op.getInputType().getLogical().size() == 1) {
- this.inputWrapperMap.put(name, true);
- } else {
- this.inputWrapperMap.put(name, false);
- }
- } else {
- this.inputWrapperMap.put(name, false);
- }
-
- if (matchingWsdlOp.isOutputWrapperStyle()) {
- // we only need to know what the wrapper is on the deserialization
- // might need to change this when there input/output wrapper style is different
- ElementInfo ei = op.getOutputWrapper().getWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- OMNamespace ns = factory.createOMNamespace(namespace, "ns2");
- OMElement wrapper = factory.createOMElement(opName, ns);
-
- this.outputWrapperMap.put(name, wrapper);
- }
- }
- } else {
- interfaceContract = reference.getReference().getInterfaceContract();
- }
-
- }
-
- protected boolean isAsIs() {
- InterfaceContract ic = reference.getInterfaceContract();
- if (ic.getInterface().getOperations().size() != 1) {
- return false;
- }
-
- List<DataType> inputDataTypes = ic.getInterface().getOperations().get(0).getInputType().getLogical();
-
- if (inputDataTypes.size() != 1) {
- return false;
- }
-
- Class<?> inputType = inputDataTypes.get(0).getPhysical();
-
- if (javax.jms.Message.class.isAssignableFrom(inputType)) {
- return true;
- }
- return false;
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null &&
- !isAsIs()) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSDefaultReferenceInterceptor((JMSBinding) binding, null, reference.getRuntimeWire(binding), inputWrapperMap, outputWrapperMap);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
deleted file mode 100644
index 0753b8e7ef..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceInterceptor.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import javax.jms.BytesMessage;
-import javax.jms.Session;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private DefaultMessageProcessor requestMessageProcessor;
- private DefaultMessageProcessor responseMessageProcessor;
- private HashMap<String,OMElement> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, OMElement> inputWrapperMap,
- HashMap<String, Boolean> outputWrapperMap) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- // Note the default processor doesn't follow the normal processor pattern
- // as it has to handle both text and bytes messages
- this.requestMessageProcessor = new DefaultMessageProcessor(jmsBinding);
- this.responseMessageProcessor = new DefaultMessageProcessor(jmsBinding);
- this.inputWrapperMap = inputWrapperMap;
- this.outputWrapperMap = outputWrapperMap;
-
- }
-
- public Message invoke(Message msg) {
-
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault) {
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- // if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault) {
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Operation op = msg.getOperation();
- List<DataType> inputDataTypes = op.getInputType().getLogical();
-
- Class<?> inputType = null;
- if (inputDataTypes.size() == 1) {
- inputType = inputDataTypes.get(0).getPhysical();
- }
- if (inputType != null && javax.jms.Message.class.isAssignableFrom(inputType)) {
- msg.setBody(new Object[] { jmsMsg });
-
- if (jmsMsg instanceof BytesMessage) {
- context.setUseBytesForWFJMSDefaultResponse(true);
- } else {
- context.setUseBytesForWFJMSDefaultResponse(false);
- }
- } else {
-
- // If there is only one arg we must add a wrapper if the operation is wrapper style
- OMElement wrapper = this.inputWrapperMap.get(msg.getOperation().getName());
-
- Object requestPayload;
- if (jmsMsg instanceof BytesMessage) {
- requestPayload = responseMessageProcessor.extractPayloadFromJMSBytesMessage(jmsMsg, wrapper);
- context.setUseBytesForWFJMSDefaultResponse(true);
- } else {
- requestPayload = responseMessageProcessor.extractPayloadFromJMSTextMessage(jmsMsg, wrapper );
- context.setUseBytesForWFJMSDefaultResponse(false);
- }
-
- msg.setBody(new Object[] { requestPayload });
- }
-
- return msg;
-
- }
-
- public Message invokeResponse(Message msg) {
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
-
- boolean respondBytesMessage = context.isUseBytesForWFJMSDefaultResponse();
-
- if (msg.isFault()) {
- if (respondBytesMessage == true) {
- responseJMSMsg = requestMessageProcessor.createFaultJMSBytesMessage(session, (Throwable) msg.getBody());
- } else {
- responseJMSMsg = responseMessageProcessor.createFaultJMSTextMessage(session, (Throwable) msg.getBody());
- }
- } else {
- boolean unwrap = false;
-
- if (this.outputWrapperMap.get(msg.getOperation().getName()) != null){
- unwrap = this.outputWrapperMap.get(msg.getOperation().getName());
- }
-
- if (respondBytesMessage == true) {
- responseJMSMsg = requestMessageProcessor.insertPayloadIntoJMSBytesMessage(session, msg.getBody(), unwrap);
- } else {
- responseJMSMsg = requestMessageProcessor.insertPayloadIntoJMSTextMessage(session, msg.getBody(), unwrap);
- }
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
deleted file mode 100644
index 4f63867350..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/runtime/WireFormatJMSDefaultServiceProvider.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
- private HashMap<String, OMElement> inputWrapperMap;
- private HashMap<String, Boolean> outputWrapperMap;
-
- public WireFormatJMSDefaultServiceProvider(ExtensionPointRegistry registry, RuntimeComponent component, RuntimeComponentService service, Binding binding, JMSResourceFactory jmsResourceFactory) {
- super();
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding) binding;
- this.jmsResourceFactory = jmsResourceFactory;
-
- this.inputWrapperMap = new HashMap<String, OMElement>();
- this.outputWrapperMap = new HashMap<String, Boolean>();
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.DEFAULT_MP_CLASSNAME);
- }
-
- List<Operation> opList = service.getService().getInterfaceContract().getInterface().getOperations();
-
- // Go through each operation and add wrapper info
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- // set the binding interface contract to represent the WSDL for the
- // xml messages that will be sent
-
- // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
- if (service.getInterfaceContract() != null && !isAsIs()) {
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
-
- List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();
-
- for (Operation op : opList) {
- String name = op.getName();
-
- Operation matchingWsdlOp = null;
-
- // find the matching wsdlop
- for (Operation wsdlOp : wsdlOpList) {
- if (name.equals(wsdlOp.getName())) {
- matchingWsdlOp = wsdlOp;
- break;
- }
- }
-
- // only add operations that need to be wrapped/unwrapped
-
- // TODO - not sure we really support viewing the input/output as separately wrapped
- // like the separate code paths imply. Not sure how many @OneWay tests we have, this might
- // not be an issue.
- if (matchingWsdlOp.isInputWrapperStyle()) {
- if (op.getInputType().getLogical().size() == 1) {
- // we only need to know what the wrapper is on the deserialization
- // might need to change this when the input/output wrapper style is different
- ElementInfo ei = op.getInputWrapper().getWrapperElement();
- String namespace = ei.getQName().getNamespaceURI();
- String opName = ei.getQName().getLocalPart();
- OMNamespace ns = factory.createOMNamespace(namespace, "ns1");
- OMElement wrapper = factory.createOMElement(opName, ns);
- this.inputWrapperMap.put(name, wrapper);
- }
- }
-
- if (matchingWsdlOp.isOutputWrapperStyle()) {
- this.outputWrapperMap.put(name, true);
- } else {
- this.outputWrapperMap.put(name, false);
- }
-
- }
-
- } else {
- interfaceContract = service.getService().getInterfaceContract();
- }
- }
-
- protected boolean isAsIs() {
- InterfaceContract ic = service.getInterfaceContract();
- if (ic.getInterface().getOperations().size() != 1) {
- return false;
- }
-
- List<DataType> inputDataTypes = ic.getInterface().getOperations().get(0).getInputType().getLogical();
-
- if (inputDataTypes.size() != 1) {
- return false;
- }
-
- Class<?> inputType = inputDataTypes.get(0).getPhysical();
-
- if (javax.jms.Message.class.isAssignableFrom(inputType)) {
- return true;
- }
- return false;
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null &&
- !isAsIs()) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSDefault){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSDefault){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSDefaultServiceInterceptor(binding, jmsResourceFactory, service.getRuntimeWire(binding), this.inputWrapperMap, this.outputWrapperMap);
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.java
deleted file mode 100644
index 9e92bf40bf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectProviderFactory.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.binding.jms.wireformat.jmsobject.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectProviderFactory implements WireFormatProviderFactory<WireFormatJMSObject> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSObjectProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSObjectReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new WireFormatJMSObjectServiceProvider(registry, component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.java
deleted file mode 100644
index 22c66b0b78..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceInterceptor.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.binding.jms.wireformat.jmsobject.runtime;
-
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- private HashMap<String, String> singleArgMap;
-
- public WireFormatJMSObjectReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire, HashMap<String, String> hashMap) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.singleArgMap = hashMap;
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSObject){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSObject){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- javax.jms.Message requestMsg;
-
- // Tuscany automatically wraps operation arguments in an array before we
- // get to this point so here we need to decide how they are going to appear
- // on the wire.
- //
- // If the operation has a single parameter and the user has set @wrapSingle=false
- // then
- // send the single parameter out onto the wire unwrapped
- // else
- // send out the message as is
- //
- if (singleArgMap.get(msg.getOperation().getName()) == null) {
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
- } else {
- // we know that wrapSinle is set to false here as the provider only
- // populates singleArgMap if it is set false
- requestMsg = ((ObjectMessageProcessor) requestMessageProcessor).createJMSMessageForSingleParamOperation(session, msg.getBody(), false);
- }
-
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null){
- Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
-
- if (response instanceof InvocationTargetException) {
- msg.setFaultBody(((InvocationTargetException) response).getCause());
- } else {
- if (response != null){
- msg.setBody(response);
- } else {
- msg.setBody(null);
- }
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.java
deleted file mode 100644
index e09c146f48..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectReferenceProvider.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.binding.jms.wireformat.jmsobject.runtime;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- private HashMap<String,String> singleArgMap; //map of one arg operations, leave empty if wrapSingleInput is true
-
- public WireFormatJMSObjectReferenceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding)binding;
-
- this.singleArgMap = new HashMap<String,String>();
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
-
- //we don't need to create this map if wrapSingleInput is true
- if (!((WireFormatJMSObject) this.binding.getRequestWireFormat()).isWrappedSingleInput()){
- List<Operation> opList = reference.getReference().getInterfaceContract().getInterface().getOperations();
-
- for (Operation op: opList) {
- if (op.getInputType().getLogical().size() == 1){
- this.singleArgMap.put(op.getName(), "");
- }
- }
- }
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
- }
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = reference.getReference().getInterfaceContract();
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSObjectReferenceInterceptor(binding,
- null,
- reference.getRuntimeWire(binding), this.singleArgMap);
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
deleted file mode 100644
index 5979bc9214..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceInterceptor.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime;
-
-import java.util.HashMap;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
- private HashMap<String,Class<?>> singleArgMap;
- private boolean wrapSingle;
-
- public WireFormatJMSObjectServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory,
- RuntimeWire runtimeWire, HashMap<String, Class<?>> singleArgMap, boolean wrapSingle) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- this.singleArgMap = singleArgMap;
- this.wrapSingle = wrapSingle;
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSObject){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- //if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSObject){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
- Object requestPayload;
-
- // If the service interface has a single argument then we need
- // to check if the object from the wire is expected
- // to be unwrapped or not
- //
- Class<?> argType = this.singleArgMap.get(msg.getOperation().getName());
- if (argType == null) {
- requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- }else {
- requestPayload = ((ObjectMessageProcessor)requestMessageProcessor).extractPayloadFromJMSMessageForSingleParamOperation(jmsMsg, argType, wrapSingle);
- }
-
- if (requestPayload != null && requestPayload.getClass().isArray()) {
- msg.setBody(requestPayload);
- } else if (requestPayload == null) {
- msg.setBody(new Object[0]);
- } else {
- msg.setBody(new Object[] {requestPayload});
- }
-
- return msg;
- }
-
- public Message invokeResponse(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg = null;
- if (msg.isFault()) {
- responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
- } else {
- responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.java
deleted file mode 100644
index f112c0cff9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/runtime/WireFormatJMSObjectServiceProvider.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.binding.jms.wireformat.jmsobject.runtime;
-
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
- private HashMap<String,Class<?>> singleArgMap;
- private boolean wrapSingle = true;
-
- public WireFormatJMSObjectServiceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding)binding;
- this.singleArgMap = new HashMap<String,Class<?>>();
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
-
- List<Operation> opList = service.getService().getInterfaceContract().getInterface().getOperations();
-
- for (Operation op: opList) {
- if (op.getInputType().getLogical().size() == 1){
- this.singleArgMap.put(op.getName(), op.getInputType().getLogical().get(0).getPhysical());
- }
- }
-
- wrapSingle = ((WireFormatJMSObject) this.binding.getRequestWireFormat()).isWrappedSingleInput();
-
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.OBJECT_MP_CLASSNAME);
- }
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = service.getService().getInterfaceContract();
-
-
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSObject){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSObject){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
-
- return new WireFormatJMSObjectServiceInterceptor((JMSBinding)binding, null,service.getRuntimeWire(binding),
- this.singleArgMap, wrapSingle );
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.java
deleted file mode 100644
index 555dfb47b5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextProviderFactory.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.binding.jms.wireformat.jmstext.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextProviderFactory implements WireFormatProviderFactory<WireFormatJMSText> {
- private ExtensionPointRegistry registry;
-
- public WireFormatJMSTextProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSTextReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new WireFormatJMSTextServiceProvider(registry, component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
deleted file mode 100644
index 49e745ffaa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceInterceptor.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
-
-
-import java.lang.reflect.InvocationTargetException;
-import javax.jms.JMSException;
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSText){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- Object[] requestParams = msg.getBody();
- javax.jms.Message requestMsg = null;
- if (requestParams != null && requestParams.length > 0 ){
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, requestParams[0]);
- } else {
- requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, null);
- }
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null){
- Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
-
- if (response instanceof InvocationTargetException) {
- msg.setFaultBody(((InvocationTargetException) response).getCause());
- } else {
- if (response != null){
- msg.setBody(response);
- } else {
- msg.setBody(null);
- }
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java
deleted file mode 100644
index 8d96fc7634..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextReferenceProvider.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
-
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextReferenceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding)binding;
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
-
- // this wire format doubles up as the execution logic for user defined
- // message processors so check the processor name is still set to default
- // before overwriting
-
- if ((this.binding.getRequestWireFormat() instanceof WireFormatJMSText) &&
- (this.binding.getRequestMessageProcessorName().equals(JMSBindingConstants.DEFAULT_MP_CLASSNAME))){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME);
- }
- if ((this.binding.getResponseWireFormat() instanceof WireFormatJMSText) &&
- (this.binding.getResponseMessageProcessorName().equals(JMSBindingConstants.DEFAULT_MP_CLASSNAME))){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME);
- }
-
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = reference.getReference().getInterfaceContract();
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSTextReferenceInterceptor(binding,
- null,
- reference.getRuntimeWire(binding));
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.java
deleted file mode 100644
index cf9e49afef..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceInterceptor.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.binding.jms.wireformat.jmstext.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSText){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- //if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSText){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- msg.setBody(new Object[]{requestPayload});
-
- return msg;
- }
-
- public Message invokeResponse(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
- if (msg.isFault()) {
- responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
- } else {
- Object response = msg.getBody();
- responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, response);
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
deleted file mode 100644
index 983b01b121..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/runtime/WireFormatJMSTextServiceProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextServiceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding)binding;
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing however override
- // any message processors specified in the SCDL in this case
-
- // this wire format doubles up as the execution logic for user defined
- // message processors so check the processor name is still set to default
- // before overwriting
-
- if ((this.binding.getRequestWireFormat() instanceof WireFormatJMSText) &&
- (this.binding.getRequestMessageProcessorName().equals(JMSBindingConstants.DEFAULT_MP_CLASSNAME))){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME);
- }
- if ((this.binding.getResponseWireFormat() instanceof WireFormatJMSText) &&
- (this.binding.getResponseMessageProcessorName().equals(JMSBindingConstants.DEFAULT_MP_CLASSNAME))){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.TEXT_MP_CLASSNAME);
- }
-
- // just point to the reference interface contract so no
- // databinding transformation takes place
- interfaceContract = service.getService().getInterfaceContract();
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null ) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSText){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSText){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- /**
- */
- public Interceptor createInterceptor() {
- return new WireFormatJMSTextServiceInterceptor((JMSBinding)binding,
- null,
- service.getRuntimeWire(binding));
- }
-
- /**
- */
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.java
deleted file mode 100644
index 44f490ee37..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLProviderFactory.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.binding.jms.wireformat.jmstextxml.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryExtensionPoint;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.provider.WireFormatProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLProviderFactory implements WireFormatProviderFactory<WireFormatJMSTextXML> {
- private ExtensionPointRegistry registry;
- private JMSResourceFactoryExtensionPoint jmsRFEP;
-
- public WireFormatJMSTextXMLProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- jmsRFEP = (JMSResourceFactoryExtensionPoint)registry.getExtensionPoint(JMSResourceFactoryExtensionPoint.class);
- }
-
- /**
- */
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new WireFormatJMSTextXMLReferenceProvider(registry, component, reference, binding);
- }
-
- /**
- */
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- JMSResourceFactory jmsRF = jmsRFEP.createJMSResourceFactory((JMSBinding)binding);
- return new WireFormatJMSTextXMLServiceProvider(registry, component, service, binding, jmsRF);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.java
deleted file mode 100644
index adf3fda98c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceInterceptor.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.binding.jms.wireformat.jmstextxml.runtime;
-
-
-
-
-import javax.jms.JMSException;
-import javax.jms.Session;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLReferenceInterceptor implements Interceptor {
-
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
-
- public WireFormatJMSTextXMLReferenceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- try {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsSession();
-
- javax.jms.Message requestMsg = requestMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
- msg.setBody(requestMsg);
-
- requestMsg.setJMSReplyTo(context.getReplyToDestination());
-
- return msg;
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
- public Message invokeResponse(Message msg) {
- if (msg.getBody() != null){
- javax.jms.Message jmsMsg = (javax.jms.Message)msg.getBody();
- Object response = responseMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- if (response != null ){
- msg.setBody(response);
- try {
- if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
- FaultException e = new FaultException("remote exception", response);
- OMElement om = (OMElement) response;
- e.setFaultName(new QName(om.getNamespace().getNamespaceURI(), om.getLocalName()));
- msg.setFaultBody(e);
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- } else {
- msg.setBody(null);
- }
- }
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
deleted file mode 100644
index a52ee3df18..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLReferenceProvider.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLReferenceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private JMSBinding binding;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextXMLReferenceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.registry = registry;
- this.component = component;
- this.reference = reference;
- this.binding = (JMSBinding)binding;
-
- // configure the reference based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
-
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME);
- }
-
- // create a local interface contract that is configured specifically to
- // deal with the data format that this wire format is expecting to sent to
- // and receive from the databinding interceptor. The request/response parts of
- // this interface contract will be copied into the binding interface contract
- // as required
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- protected boolean isOnMessage() {
- InterfaceContract ic = reference.getInterfaceContract();
- if (ic.getInterface().getOperations().size() != 1) {
- return false;
- }
- return "onMessage".equals(ic.getInterface().getOperations().get(0).getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null &&
- !isOnMessage()) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSTextXMLReferenceInterceptor((JMSBinding)binding,
- null,
- reference.getRuntimeWire(binding));
- }
-
- public String getPhase() {
- return Phase.REFERENCE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.java
deleted file mode 100644
index e0a5c86202..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceInterceptor.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.binding.jms.wireformat.jmstextxml.runtime;
-
-import javax.jms.Session;
-
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLServiceInterceptor implements Interceptor {
- private Invoker next;
- private RuntimeWire runtimeWire;
- private JMSResourceFactory jmsResourceFactory;
- private JMSBinding jmsBinding;
- private JMSMessageProcessor requestMessageProcessor;
- private JMSMessageProcessor responseMessageProcessor;
-
- public WireFormatJMSTextXMLServiceInterceptor(JMSBinding jmsBinding, JMSResourceFactory jmsResourceFactory, RuntimeWire runtimeWire) {
- super();
- this.jmsBinding = jmsBinding;
- this.runtimeWire = runtimeWire;
- this.jmsResourceFactory = jmsResourceFactory;
- this.requestMessageProcessor = JMSMessageProcessorUtil.getRequestMessageProcessor(jmsBinding);
- this.responseMessageProcessor = JMSMessageProcessorUtil.getResponseMessageProcessor(jmsBinding);
- }
-
- public Message invoke(Message msg) {
-
- if (jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- msg = invokeRequest(msg);
- }
-
- msg = getNext().invoke(msg);
-
- //if it's oneway return back
- Operation operation = msg.getOperation();
- if (operation != null && operation.isNonBlocking()) {
- return msg;
- }
-
- if (jmsBinding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- msg = invokeResponse(msg);
- }
-
- return msg;
- }
-
- public Message invokeRequest(Message msg) {
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- Object requestPayload = requestMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
- msg.setBody(new Object[] { requestPayload });
-
- return msg;
- }
-
- public Message invokeResponse(Message msg) {
-
- // get the jms context
- JMSBindingContext context = msg.getBindingContext();
- Session session = context.getJmsResponseSession();
-
- javax.jms.Message responseJMSMsg;
- if (msg.isFault()) {
- responseJMSMsg = responseMessageProcessor.createFaultMessage(session, (Throwable)msg.getBody());
- } else {
- responseJMSMsg = responseMessageProcessor.insertPayloadIntoJMSMessage(session, msg.getBody());
- }
-
- msg.setBody(responseJMSMsg);
-
- return msg;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.java
deleted file mode 100644
index 7e48dc76a0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/runtime/WireFormatJMSTextXMLServiceProvider.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.binding.jms.wireformat.jmstextxml.runtime;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.WireFormatProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLServiceProvider implements WireFormatProvider {
- private ExtensionPointRegistry registry;
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private JMSBinding binding;
- private JMSResourceFactory jmsResourceFactory;
- private InterfaceContract interfaceContract;
-
- public WireFormatJMSTextXMLServiceProvider(ExtensionPointRegistry registry,
- RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding,
- JMSResourceFactory jmsResourceFactory) {
- super();
- this.component = component;
- this.service = service;
- this.binding = (JMSBinding)binding;
- this.jmsResourceFactory = jmsResourceFactory;
-
- // configure the service based on this wire format
-
- // currently maintaining the message processor structure which
- // contains the details of jms message processing so set the message
- // type here if not set explicitly in SCDL
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- this.binding.setRequestMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME);
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- this.binding.setResponseMessageProcessorName(JMSBindingConstants.XML_MP_CLASSNAME);
- }
-
- // create a local interface contract that is configured specifically to
- // deal with the data format that this wire format is expecting to sent to
- // and receive from the databinding interceptor. The request/response parts of
- // this interface contract will be copied into the binding interface contract
- // as required
- WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
- interfaceContract = wsBinding.getBindingInterfaceContract();
- interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract){
-
- if (this.interfaceContract != null) {
- if (this.binding.getRequestWireFormat() instanceof WireFormatJMSTextXML){
- // set the request data transformation
- interfaceContract.getInterface().resetInterfaceInputTypes(this.interfaceContract.getInterface());
- }
- if (this.binding.getResponseWireFormat() instanceof WireFormatJMSTextXML){
- // set the response data transformation
- interfaceContract.getInterface().resetInterfaceOutputTypes(this.interfaceContract.getInterface());
- }
- }
-
- return interfaceContract;
- }
-
- public Interceptor createInterceptor() {
- return new WireFormatJMSTextXMLServiceInterceptor((JMSBinding)binding,
- jmsResourceFactory,
- service.getRuntimeWire(binding));
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_WIREFORMAT;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index dec0991984..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jms.provider.JMSBindingProviderFactory;model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
deleted file mode 100644
index e98e85c0f2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.OperationSelectorProviderFactory
+++ /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.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.runtime.OperationSelectorJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault
-org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.runtime.OperationSelectorJMSUserPropProviderFactory;model=org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.OperationSelectorJMSUserProp
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
deleted file mode 100644
index 845c32a7d1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.WireFormatProviderFactory
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.runtime.WireFormatJMSDefaultProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault
-org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.runtime.WireFormatJMSTextXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.runtime.WireFormatJMSBytesProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.runtime.WireFormatJMSBytesXMLProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmstext.runtime.WireFormatJMSTextProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.runtime.WireFormatJMSObjectProviderFactory;model=org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.java
deleted file mode 100644
index fb80362457..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldClientImpl.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.binding.jms;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-/**
- * This class implements the HelloWorld service.
- *
- * @version $Rev$ $Date$
- */
-@Service(HelloWorldService.class)
-public class HelloWorldClientImpl implements HelloWorldService {
-
- private HelloWorldService serviceA;
-
- @Reference
- public void setServiceA(HelloWorldService service) {
- this.serviceA = service;
- }
-
- public String sayHello(String name) {
- return serviceA.sayHello(name);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.java
deleted file mode 100644
index 515da3144a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldService.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.binding.jms;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Interface for the HelloWorld Service.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface HelloWorldService {
- String sayHello(String name);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
deleted file mode 100644
index a8808c1bd1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/HelloWorldServiceImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms;
-
-/**
- * Implementation of the HelloWorldService.
- *
- * @version $Rev$ $Date$
- */
-public class HelloWorldServiceImpl implements HelloWorldService {
-
- public String sayHello(String name) {
- return "jmsHello " + name;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
deleted file mode 100644
index efd64361dd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/java/org/apache/tuscany/sca/binding/jms/OperationSelectionTestCaseFIXME.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.TextMessage;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.easymock.EasyMock;
-import org.junit.Test;
-
-/**
- * This unit test is used to ensure that a JMS Message delivered to a Component will select the correct operation based
- * on the details in section 1.5 of the JMS Binding specification.
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectionTestCaseFIXME {
- /**
- * This test attempts to invoke a Service with a Single method where scaOperationName is not specified in the JMS
- * Message
- * <p>
- * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
- *
- * @throws Exception Failed
- */
- @Test
- public void testServiceWithOnlyOneOperationScaOperationNameNotSpecified() throws Exception {
- // Create the operation we should match
- final Operation expectedOperation = newOperation("myOperation");
-
- // Create the list of operations for the Service
- final List<Operation> operations = new ArrayList<Operation>();
- operations.add(expectedOperation);
-
- // The name of the Operation in the JMS Message - not specified
- final String scaOperationName = null;
-
- // Do the test
- doTestJMSBinding(expectedOperation, operations, scaOperationName);
- }
-
- /**
- * This test attempts to invoke a Service with a Single method where scaOperationName in the JMS Message matches the
- * method name on the Service
- * <p>
- * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
- *
- * @throws Exception Failed
- */
- @Test
- public void testServiceWithOnlyOneOperationScaOperationNameMatches() throws Exception {
- // Create the operation we should match
- final Operation expectedOperation = newOperation("myOperation");
-
- // Create the list of operations for the Service
- final List<Operation> operations = new ArrayList<Operation>();
- operations.add(expectedOperation);
-
- // The name of the Operation in the JMS Message - matches operation name
- final String scaOperationName = expectedOperation.getName();
-
- // Do the test
- doTestJMSBinding(expectedOperation, operations, scaOperationName);
- }
-
- /**
- * This test attempts to invoke a Service with a Single method where scaOperationName in the JMS Message is
- * different the method name on the Service
- * <p>
- * Expected behaviour is that the single method will be invoked as scaOperationName is ignored
- *
- * @throws Exception Failed
- */
- @Test
- public void testServiceWithOnlyOneOperationScaOperationNameDifferent() throws Exception {
- // Create the operation we should match
- final Operation expectedOperation = newOperation("myOperation");
-
- // Create the list of operations for the Service
- final List<Operation> operations = new ArrayList<Operation>();
- operations.add(expectedOperation);
-
- // The name of the Operation in the JMS Message - different to operation name
- final String scaOperationName = "Does Not Match Opeation Name";
-
- // Do the test
- doTestJMSBinding(expectedOperation, operations, scaOperationName);
- }
-
- /**
- * This test attempts to invoke a Service with a multiple operations where scaOperationName specified in the JMS
- * Message matches an operation name
- * <p>
- * Expected behaviour is that the named method will be invoked.
- *
- * @throws Exception Failed
- */
- @Test
- public void testServiceWithMultipleOperationsScaOperationNameSpecified() throws Exception {
- // Create the list of operations for the Service
- final List<Operation> operations = new ArrayList<Operation>();
- for (int i = 0; i < 5; i++) {
- operations.add(newOperation("operation" + i));
- }
-
- // Now try and invoke each operation
- for (Operation expectedOperation : operations) {
- // The name of the Operation in the JMS Message
- final String scaOperationName = expectedOperation.getName();
-
- // Do the test
- doTestJMSBinding(expectedOperation, operations, scaOperationName);
- }
- }
-
- /**
- * This test attempts to invoke a Service with a multiple operations where scaOperationName specified in the JMS
- * Message is not set so we invoke the onMessage() method
- * <p>
- * Expected behaviour is that the onMessage() method should be used instead
- *
- * @throws Exception Failed
- */
- @Test
- public void testServiceWithMultipleOperationsScaOperationNotSpecified() throws Exception {
- // Create the list of operations for the Service
- final List<Operation> operations = new ArrayList<Operation>();
- for (int i = 0; i < 5; i++) {
- operations.add(newOperation("operation" + i));
- }
-
- // Add the onMessage operation to the Service Contract
- final Operation onMessageOperation = newOperation("onMessage");
- operations.add(onMessageOperation);
-
- // The name of the Operation in the JMS Message is not set so it will attempt
- // to invoke the onMessage() method
- final String scaOperationName = null;
-
- // Do the test
- doTestJMSBinding(onMessageOperation, operations, scaOperationName);
- }
-
- /**
- * This is the test method that will attempt to unit test invoking a Service with the specified operations using a
- * JMS Message with the specified scaOperationName to ensure that it invokes the expectedOperation
- *
- * @param expectedOperation The Operation we are expecting to be invoked over JMS
- * @param operations The list of Operations supported by the Service
- * @param scaOperationName The value to set scaOperationName in the JMS Message
- * @throws Exception Failed
- */
- private void doTestJMSBinding(Operation expectedOperation, List<Operation> operations, String scaOperationName)
- throws Exception {
- // Create the test JMS Binding
- final JMSBinding jmsBinding = new JMSBinding();
- JMSResourceFactory jmsResourceFactory = null;
-
- // Extra information for the method we are invoking
- final String operationParams = "Hello";
- final Object operationReturnValue = "Operation Success";
-
- // Mock up the Service. Basically, it is going to call:
- // List<Operation> opList = service.getInterfaceContract().getInterface().getOperations();
- final InterfaceContract ifaceContract = EasyMock.createStrictMock(InterfaceContract.class);
- final RuntimeComponentService service = EasyMock.createStrictMock(RuntimeComponentService.class);
- final Interface iface = EasyMock.createStrictMock(Interface.class);
- EasyMock.expect(iface.getOperations()).andReturn(operations);
- EasyMock.expect(ifaceContract.getInterface()).andReturn(iface);
- EasyMock.expect(service.getInterfaceContract()).andReturn(ifaceContract);
-
- // Mock up getting and invoking the RuntimeWire. It is going to call:
- // service.getRuntimeWire(jmsBinding).invoke(operation, (Object[])requestPayload);
- final RuntimeWire runtimeWire = EasyMock.createStrictMock(RuntimeWire.class);
- EasyMock.expect(service.getRuntimeWire(jmsBinding)).andReturn(runtimeWire);
- EasyMock.expect(runtimeWire.invoke(expectedOperation, new Object[] {operationParams}))
- .andReturn(operationReturnValue);
-
- // Create the JMS Binding Listener
- // final DefaultJMSBindingListener bindingListener = new DefaultJMSBindingListener(jmsBinding, jmsResourceFactory, service, null);
-
- // Simulate a message
- final TextMessage requestJMSMsg = EasyMock.createStrictMock(TextMessage.class);
- EasyMock.expect(requestJMSMsg.getStringProperty("scaOperationName")).andReturn(scaOperationName);
- EasyMock.expect(requestJMSMsg.getText()).andReturn(operationParams);
- EasyMock.expect(requestJMSMsg.getJMSReplyTo()).andReturn(null);
-
- // Lets put all the mocks into replay mode
- // EasyMock.replay(iface);
- EasyMock.replay(ifaceContract);
- EasyMock.replay(service);
- EasyMock.replay(requestJMSMsg);
- EasyMock.replay(runtimeWire);
-
- // Do the test
- // bindingListener.onMessage(requestJMSMsg);
-
- // Verify our Mock objects
- // EasyMock.verify(iface);
- // EasyMock.verify(ifaceContract);
- // EasyMock.verify(service);
- // EasyMock.verify(requestJMSMsg);
- // EasyMock.verify(runtimeWire);
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/client.composite b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/client.composite
deleted file mode 100644
index dcea428493..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/client.composite
+++ /dev/null
@@ -1,38 +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"
- name="RPCComposite">
-
- <component name="HelloWorldClient">
- <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldClientImpl"/>
- <reference name="serviceA" />
- </component>
-
- <reference name="serviceA" promote="HelloWorldClient/serviceA">
- <interface.java interface="org.apache.tuscany.sca.binding.jms.HelloWorldService" />
- <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
- <destination name="DestQueueA"/>
- <response>
- <destination name="RespQueueA"/>
- </response>
- </binding.jms>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/service.composite b/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/service.composite
deleted file mode 100644
index 44b7b29610..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms-runtime/src/test/resources/simple/service.composite
+++ /dev/null
@@ -1,35 +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"
- name="RPCComposite">
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.jms.HelloWorldServiceImpl"/>
- <service name="HelloWorldService">
- <binding.jms initialContextFactory="org.apache.activemq.jndi.ActiveMQInitialContextFactory" jndiURL="tcp://localhost:61616">
- <destination name="DestQueueA" create="always"/>
- <response>
- <destination name="RespQueueA" create="always"/>
- </response>
- </binding.jms>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/LICENSE b/branches/sca-java-1.5.1/modules/binding-jms/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/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-java-1.5.1/modules/binding-jms/NOTICE b/branches/sca-java-1.5.1/modules/binding-jms/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/pom.xml b/branches/sca-java-1.5.1/modules/binding-jms/pom.xml
deleted file mode 100644
index 0e14031a83..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/pom.xml
+++ /dev/null
@@ -1,66 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-jms</artifactId>
- <name>Apache Tuscany SCA JMS Binding Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jms</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jms*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java
deleted file mode 100644
index 277cba43ca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.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.binding.jms.impl;
-
-public class BindingProperty {
-
- private String name;
- private String type;
- private Object value;
-
- public BindingProperty(String name, String type, Object value) {
- this.name = name;
- this.type = type;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- public Object getValue() {
- return value;
- }
-
- @Override
- public boolean equals( Object object ) {
- return ( object instanceof BindingProperty ) && equals( (BindingProperty) object );
- }
-
- /**
- * Test whether this and another Binding Property are equal.
- * @param property
- * @return true if all fields of property match.
- */
- public boolean equals( BindingProperty property ) {
- if ( name == null && property.getName() != null )
- return false;
- else if ( !name.equals( property.getName() ))
- return false;
- else if ( type == null && property.getType() != null )
- return false;
- else if ( !type.equals( property.getType() ))
- return false;
- else if ( value == null && property.getValue() != null )
- return false;
- else if ( !value.equals( property.getValue() ))
- return false;
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
deleted file mode 100644
index 4c9e2fff7e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
+++ /dev/null
@@ -1,970 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.BindingRRB;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.DefinitionElement;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-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;
-
-/**
- * Models a binding to a JMS resource.
- *
- * @version $Rev$ $Date$
- */
-
-public class JMSBinding implements BindingRRB, PolicySetAttachPoint, OperationsConfigurator, DefinitionElement {
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- // properties required to implement the Tuscany binding extension SPI
- private String uri = null;
- private String name = null;
- private boolean unresolved = false;
- private List<Object> extensions = new ArrayList<Object>();
-
- // properties required by PolicySetAttachPoint
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- // properties required by IntentAttachPoint
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private IntentAttachPointType intentAttachPointType;
-
- // properties required to describe configured operations
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
-
- // properties required by DefinitionElement @575803A
- private String targetNamespace;
-
- // Properties required to describe the JMS binding model
-
- private String correlationScheme = JMSBindingConstants.CORRELATE_MSG_ID;
- private String initialContextFactoryName;
- private String jndiURL;
-
- private String destinationName = null;
- private String destinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
- private String destinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> destinationProperties = new HashMap<String, BindingProperty>();
-
- private String connectionFactoryName = null;
- private String connectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> connectionFactoryProperties = new HashMap<String, BindingProperty>();
-
- private String activationSpecName = null;
- private String activationSpecCreate = null;
- private Map<String, BindingProperty> activationSpecProperties = new HashMap<String, BindingProperty>();
-
- private String resourceAdapterName;;
- private Map<String, BindingProperty> resourceAdapterProperties = new HashMap<String, BindingProperty>();
-
- private String responseActivationSpecName = null;
- private String responseActivationSpecCreate = null;
- private Map<String, BindingProperty> responseActivationSpecProperties = new HashMap<String, BindingProperty>();
-
- private String responseDestinationName = null;
- private String responseDestinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
- private String responseDestinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> responseDestinationProperties = new HashMap<String, BindingProperty>();
-
- private String responseConnectionFactoryName = null;
- private String responseConnectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> responseConnectionFactoryProperties = new HashMap<String, BindingProperty>();
-
- // Provides the name of the factory that interfaces to the JMS API for us.
- private String jmsResourceFactoryName = JMSBindingConstants.DEFAULT_RF_CLASSNAME;
-
- // Message processors used to deal with the request and response messages
- public String requestMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
- public String responseMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
-
- // The JMS message property used to hold the name of the operation being called
- private String operationSelectorPropertyName = JMSBindingConstants.DEFAULT_OPERATION_PROP_NAME;
-
- // If the operation selector is derived automatically from the service interface it's stored here
- private String operationSelectorName = null;
-
- private boolean containsHeaders = false;
- private String replyTo;
- private String jmsType;
- private String jmsCorrelationId;
- private Boolean deliveryModePersistent;
- private Long timeToLive;
- private Integer jmsPriority;
-
- private Map<String, Object> properties = new HashMap<String, Object>();
- private Map<String, Map<String, Object>> operationProperties = new HashMap<String, Map<String,Object>>();
- private Map<String, String> nativeOperationNames = new HashMap<String, String>();
- private Map<String, String> operationJMSTypes = new HashMap<String, String>();
- private Map<String, String> operationJMSCorrelationIds = new HashMap<String, String>();
- private Map<String, Boolean> operationJMSDeliveryModes = new HashMap<String, Boolean>();
- private Map<String, Long> operationJMSTimeToLives = new HashMap<String, Long>();
- private Map<String, Integer> operationJMSPriorities = new HashMap<String, Integer>();
- private Map<String, Map<String, BindingProperty>> operationPropertiesProperties = new HashMap<String, Map<String,BindingProperty>>();
-
- private String jmsSelector;
- private QName requestConnectionName;
- private QName responseConnectionName;
- private QName operationPropertiesName;
- private JMSBinding requestConnectionBinding;
- private JMSBinding responseConnectionBinding;
- private JMSBinding operationPropertiesBinding;
-
- private WireFormat requestWireFormat;
- private WireFormat responseWireFormat;
- private OperationSelector operationSelector;
-
- public JMSBinding() {
- super();
- }
-
- // operations required by Binding
- public String getURI() {
- return this.uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isUnresolved() {
- return this.unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public WireFormat getRequestWireFormat() {
- return requestWireFormat;
- }
-
- public void setRequestWireFormat(WireFormat wireFormat) {
- this.requestWireFormat = wireFormat;
- }
-
- public WireFormat getResponseWireFormat() {
- return responseWireFormat;
- }
-
- public void setResponseWireFormat(WireFormat wireFormat) {
- this.responseWireFormat = wireFormat;
- }
-
- public OperationSelector getOperationSelector() {
- return operationSelector;
- }
-
- public void setOperationSelector(OperationSelector operationSelector) {
- this.operationSelector = operationSelector;
- }
-
- // Methods for getting/setting JMS binding model information
- // as derived from the XML of the binding.jms element
-
- public void setCorrelationScheme(String correlationScheme) {
- this.correlationScheme = correlationScheme;
- }
-
- public String getCorrelationScheme() {
- return correlationScheme;
- }
-
- public String getInitialContextFactoryName() {
- return initialContextFactoryName;
- }
-
- public void setInitialContextFactoryName(String initialContextFactoryName) {
- this.initialContextFactoryName = initialContextFactoryName;
- }
-
- public String getJndiURL() {
- return this.jndiURL;
- }
-
- public void setJndiURL(String jndiURL) {
- this.jndiURL = jndiURL;
- }
-
- public String getDestinationName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationName() != null) {
- return requestConnectionBinding.getDestinationName();
- } else {
- return destinationName;
- }
- }
-
- public void setDestinationName(String destinationName) {
- this.destinationName = destinationName;
- }
-
- public String getDestinationType() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationType() != null) {
- return requestConnectionBinding.getDestinationType();
- } else {
- return destinationType;
- }
- }
-
- public void setDestinationType(String destinationType) {
- this.destinationType = destinationType;
- }
-
- public String getDestinationCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationCreate() != null) {
- return requestConnectionBinding.getDestinationCreate();
- } else {
- return this.destinationCreate;
- }
- }
-
- public void setDestinationCreate(String create) {
- this.destinationCreate = create;
- }
-
- public String getConnectionFactoryName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getConnectionFactoryName() != null) {
- return requestConnectionBinding.getConnectionFactoryName();
- } else {
- return connectionFactoryName;
- }
- }
-
- public void setConnectionFactoryName(String connectionFactoryName) {
- this.connectionFactoryName = connectionFactoryName;
- }
-
- public String getConnectionFactoryCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getConnectionFactoryCreate() != null) {
- return requestConnectionBinding.getConnectionFactoryCreate();
- } else {
- return this.connectionFactoryCreate;
- }
- }
-
- public void setConnectionFactoryCreate(String create) {
- this.connectionFactoryCreate = create;
- }
-
- public String getResourceAdapterName() {
- return resourceAdapterName;
- }
-
- public void setResourceAdapterName(String name) {
- resourceAdapterName = name;
- }
-
- public String getActivationSpecName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getActivationSpecName() != null) {
- return requestConnectionBinding.getActivationSpecName();
- } else {
- return activationSpecName;
- }
- }
-
- public void setActivationSpecName(String activationSpecName) {
- this.activationSpecName = activationSpecName;
- }
-
- public String getActivationSpecCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getActivationSpecCreate() != null) {
- return requestConnectionBinding.getActivationSpecCreate();
- } else {
- return this.activationSpecCreate;
- }
- }
-
- public void setActivationSpecCreate(String create) {
- this.activationSpecCreate = create;
- }
-
- public String getResponseDestinationName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationName() != null) {
- return requestConnectionBinding.getResponseDestinationName();
- } else {
- return this.responseDestinationName;
- }
- }
-
- public void setResponseDestinationName(String name) {
- this.responseDestinationName = name;
- }
-
- public String getResponseDestinationType() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationType() != null) {
- return requestConnectionBinding.getResponseDestinationType();
- } else {
- return this.responseDestinationType;
- }
- }
-
- public void setResponseDestinationType(String type) {
- this.responseDestinationType = type;
- }
-
- public String getResponseDestinationCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationCreate() != null) {
- return requestConnectionBinding.getResponseDestinationCreate();
- } else {
- return this.responseDestinationCreate;
- }
- }
-
- public void setResponseDestinationCreate(String create) {
- this.responseDestinationCreate = create;
- }
-
- public String getResponseConnectionFactoryName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseConnectionFactoryName() != null) {
- return requestConnectionBinding.getResponseConnectionFactoryName();
- } else {
- return responseConnectionFactoryName;
- }
- }
-
- public void setResponseConnectionFactoryName(String connectionFactoryName) {
- this.responseConnectionFactoryName = connectionFactoryName;
- }
-
- public String getResponseConnectionFactoryCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseConnectionFactoryCreate() != null) {
- return requestConnectionBinding.getResponseConnectionFactoryCreate();
- } else {
- return this.responseConnectionFactoryCreate;
- }
- }
-
- public void setResponseConnectionFactoryCreate(String create) {
- this.responseConnectionFactoryCreate = create;
- }
-
- public String getResponseActivationSpecName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseActivationSpecName() != null) {
- return requestConnectionBinding.getResponseActivationSpecName();
- } else {
- return responseActivationSpecName;
- }
- }
-
- public void setResponseActivationSpecName(String activationSpecName) {
- this.responseActivationSpecName = activationSpecName;
- }
-
- public String getResponseActivationSpecCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseActivationSpecCreate() != null) {
- return requestConnectionBinding.getResponseActivationSpecCreate();
- } else {
- return this.responseActivationSpecCreate;
- }
- }
-
- public void setResponseActivationSpecCreate(String create) {
- this.responseActivationSpecCreate = create;
- }
-
- public String getJmsResourceFactoryName() {
- return jmsResourceFactoryName;
- }
-
- public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
- this.jmsResourceFactoryName = jmsResourceFactoryName;
- }
-
- public void setRequestMessageProcessorName(String name) {
- this.requestMessageProcessorName = name;
- }
-
- public String getRequestMessageProcessorName() {
- return requestMessageProcessorName;
- }
-
- public void setResponseMessageProcessorName(String name) {
- this.responseMessageProcessorName = name;
- }
-
- public String getResponseMessageProcessorName() {
- return responseMessageProcessorName;
- }
-
- public String getOperationSelectorPropertyName() {
- return operationSelectorPropertyName;
- }
-
- public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
- this.operationSelectorPropertyName = operationSelectorPropertyName;
- }
-
- public String getOperationSelectorName() {
- return operationSelectorName;
- }
-
- public void setOperationSelectorName(String operationSelectorName) {
- this.operationSelectorName = operationSelectorName;
- }
-
- public void setHeaders( boolean containsHeaders ) {
- this.containsHeaders = containsHeaders;
- }
-
- public boolean containsHeaders() {
- return this.containsHeaders;
- }
-
- public String getReplyTo() {
- return replyTo;
- }
-
- public void setReplyTo(String replyTo) {
- this.replyTo = replyTo;
- }
-
- public String getJMSType() {
- return jmsType;
- }
- public void setJMSType(String jmsType) {
- setHeaders( true );
- this.jmsType = jmsType;
- }
-
- public String getJMSCorrelationId() {
- return jmsCorrelationId;
- }
-
- public void setJMSCorrelationId(String jmsCorrelationId) {
- setHeaders( true );
- this.jmsCorrelationId = jmsCorrelationId;
- }
-
- public Boolean isdeliveryModePersistent() {
- return deliveryModePersistent;
- }
- public void setJMSDeliveryMode(boolean persistent) {
- setHeaders( true );
- this.deliveryModePersistent = Boolean.valueOf(persistent);
- }
-
- public Integer getJMSPriority() {
- return jmsPriority;
- }
-
- public void setJMSPriority(int jmsPriority) {
- setHeaders( true );
- this.jmsPriority = Integer.valueOf(jmsPriority);
- }
-
- public Long getJMSTimeToLive() {
- return timeToLive;
- }
-
- public void setJMSTimeToLive(long timeToLive) {
- setHeaders( true );
- this.timeToLive = Long.valueOf(timeToLive);
- }
-
- public Set<String> getPropertyNames() {
- return properties.keySet();
- }
-
- public Object getProperty(String name) {
- return properties.get(name);
- }
-
- public void setProperty(String name, Object value) {
- properties.put(name, value);
- }
-
- protected Map<String, Object> getProperties() {
- return properties;
- }
-
- /**
- * Adds an operationName to this binding.
- * @param opName
- */
- public void addOperationName(String opName) {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- props = new HashMap<String, Object>();
- operationProperties.put(opName, props);
- }
- }
-
- /**
- * Provides set of operation names in this binding.
- * @return a Set<String> of operation names
- */
- public Set<String> getOperationNames() {
- if (operationPropertiesBinding != null) {
- return operationPropertiesBinding.getOperationNames();
- } else {
- // Make a defensive copy since key changes affect map, map changes affect keys.
- Set<String> opNames = operationProperties.keySet();
- Set<String> opNamesCopy = new TreeSet<String>( opNames );
- return opNamesCopy;
- }
- }
-
- public Map<String, Object> getOperationProperties(String opName) {
- if (operationPropertiesBinding != null) {
- return operationPropertiesBinding.getOperationProperties(opName);
- } else {
- return operationProperties.get(opName);
- }
- }
-
- public void setOperationProperty(String opName, String propName, Object value) {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- props = new HashMap<String, Object>();
- operationProperties.put(opName, props);
- }
- props.put(propName, value);
- }
-
- /**
- * Provides the value of a property for a given operation
- * @param opName is the name of the operation in this binding.
- * @param propName is the key name for the property
- * @return Object representing the property value for this property name. Returns
- * null for non existant operation name or property name.
- */
- public Object getOperationProperty(String opName, String propName ) {
- if (operationPropertiesBinding != null) {
- return operationPropertiesBinding.getOperationProperty(opName, propName);
- } else {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- return null;
- }
- return props.get(propName);
- }
- }
-
- public boolean hasNativeOperationName(String opName) {
- if (operationPropertiesBinding != null) {
- return operationPropertiesBinding.hasNativeOperationName(opName);
- } else {
- return nativeOperationNames.containsKey(opName);
- }
- }
-
- public String getNativeOperationName(String opName) {
- if (operationPropertiesBinding != null && operationPropertiesBinding.getNativeOperationName(opName) != null) {
- return operationPropertiesBinding.getNativeOperationName(opName);
- } else {
- if (nativeOperationNames.containsKey(opName)) {
- return nativeOperationNames.get(opName);
- } else {
- return opName;
- }
- }
- }
-
- public void setNativeOperationName(String opName, String nativeOpName) {
- this.nativeOperationNames .put(opName, nativeOpName);
- }
-
- public String getOperationJMSType(String opName) {
- if (operationPropertiesBinding != null && operationPropertiesBinding.getOperationJMSType(opName) != null) {
- return operationPropertiesBinding.getOperationJMSType(opName);
- } else {
- if (operationJMSTypes.containsKey(opName)) {
- return operationJMSTypes.get(opName);
- } else {
- return jmsType;
- }
- }
- }
- public void setOperationJMSType(String opName, String jmsType) {
- this.operationJMSTypes.put(opName, jmsType);
- }
-
- public String getOperationJMSCorrelationId(String opName) {
- if (operationPropertiesBinding != null) {
- if (operationPropertiesBinding.getOperationJMSCorrelationId(opName) != null) {
- return operationPropertiesBinding.getOperationJMSCorrelationId(opName);
- } else {
- return jmsCorrelationId;
- }
- } else {
- if (operationJMSCorrelationIds.containsKey(opName)) {
- return operationJMSCorrelationIds.get(opName);
- } else {
- return jmsCorrelationId;
- }
- }
- }
- public void setOperationJMSCorrelationId(String opName, String jmsCorrelationId) {
- operationJMSCorrelationIds.put(opName, jmsCorrelationId);
- }
-
- public Boolean getOperationJMSDeliveryMode(String opName) {
- if (operationPropertiesBinding != null) {
- if (operationPropertiesBinding.getOperationJMSDeliveryMode(opName) != null) {
- return operationPropertiesBinding.getOperationJMSDeliveryMode(opName);
- } else {
- return deliveryModePersistent;
- }
- } else {
- if (operationJMSDeliveryModes.containsKey(opName)) {
- return operationJMSDeliveryModes.get(opName);
- } else {
- return deliveryModePersistent;
- }
- }
- }
- public void setOperationJMSDeliveryMode(String opName, boolean b) {
- operationJMSDeliveryModes.put(opName, b);
- }
-
- public Long getOperationJMSTimeToLive(String opName) {
- if (operationPropertiesBinding != null) {
- if (operationPropertiesBinding.getOperationJMSTimeToLive(opName) != null) {
- return operationPropertiesBinding.getOperationJMSTimeToLive(opName);
- } else {
- return timeToLive;
- }
- } else {
- if (operationJMSTimeToLives.containsKey(opName)) {
- return operationJMSTimeToLives.get(opName);
- } else {
- return timeToLive;
- }
- }
- }
- public void setOperationJMSTimeToLive(String opName, Long ttl) {
- operationJMSTimeToLives.put(opName, ttl);
- }
-
- public Integer getOperationJMSPriority(String opName) {
- if (operationPropertiesBinding != null) {
- if (operationPropertiesBinding.getOperationJMSPriority(opName) != null) {
- return operationPropertiesBinding.getOperationJMSPriority(opName);
- } else {
- return jmsPriority;
- }
- } else {
- if (operationJMSPriorities.containsKey(opName)) {
- return operationJMSPriorities.get(opName);
- } else {
- return jmsPriority;
- }
- }
- }
- public void setOperationJMSPriority(String opName, int p) {
- operationJMSPriorities.put(opName, p);
- }
-
- public String getJMSSelector() {
- return jmsSelector;
- }
- public void setJMSSelector(String jmsSelector) {
- this.jmsSelector = jmsSelector;
- }
-
- public QName getRequestConnectionName() {
- return requestConnectionName;
- }
-
- public void setRequestConnectionName(QName requestConnectionName) {
- this.requestConnectionName = requestConnectionName;
- }
-
- public void setResponseConnectionName(QName responseConnectionName) {
- this.responseConnectionName = responseConnectionName;
- }
-
- public QName getResponseConnectionName() {
- return responseConnectionName;
- }
-
- public void setRequestConnectionBinding(JMSBinding binding) {
- this.requestConnectionBinding = binding;
- }
- public JMSBinding getRequestConnectionBinding() {
- return requestConnectionBinding;
- }
-
- public void setResponseConnectionBinding(JMSBinding binding) {
- this.responseConnectionBinding = binding;
- }
- public JMSBinding getResponseConnectionBinding() {
- return responseConnectionBinding;
- }
-
- public void setOperationPropertiesName(QName nameValue) {
- this.operationPropertiesName = nameValue;
- }
- public QName getOperationPropertiesName() {
- return operationPropertiesName;
- }
-
- public void setOperationPropertiesBinding(JMSBinding binding) {
- this.operationPropertiesBinding = binding;
- }
- public JMSBinding getOperationPropertiesBinding() {
- return operationPropertiesBinding;
- }
-
- // operations required by PolicySetAttachPoint
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- // operations required by IntentAttachPoint
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public Map<String, BindingProperty> getDestinationProperties() {
- return destinationProperties;
- }
-
- public Map<String, BindingProperty> getConnectionFactoryProperties() {
- return connectionFactoryProperties;
- }
-
- public Map<String, BindingProperty> getResourceAdapterProperties() {
- return resourceAdapterProperties;
- }
-
- public Map<String, BindingProperty> getActivationSpecProperties() {
- return activationSpecProperties;
- }
-
- public Map<String, BindingProperty> getResponseActivationSpecProperties() {
- return responseActivationSpecProperties;
- }
-
- public Map<String, BindingProperty> getResponseDestinationProperties() {
- return responseDestinationProperties;
- }
-
- public Map<String, BindingProperty> getResponseConnectionFactoryProperties() {
- return responseConnectionFactoryProperties;
- }
-
- public Map<String, BindingProperty> getOperationPropertiesProperties(String opName) {
- if (operationPropertiesProperties.get(opName)==null) {
- operationPropertiesProperties.put(opName, new HashMap<String, BindingProperty>());
- }
- return operationPropertiesProperties.get(opName);
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- this.configuredOperations = configuredOperations;
- }
-
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String ns) {
- targetNamespace = ns;
- }
-
- // hashCode() is here because binding elements in definitions documents are added
- // to the model resolver hashmap. The namespace and name are keys.
- @Override
- public int hashCode() {
- return (String.valueOf(getTargetNamespace()) + String.valueOf(getName())).hashCode();
- }
-
- @Override
- public boolean equals( Object object ) {
- return ( object instanceof JMSBinding ) && equals( (JMSBinding) object );
- }
-
- /**
- * Compares two JMS bindings for equality.
- * Because of the many fields, this comparison is rather large O(n).
- * @param binding test binding for equality comparison
- * @return boolean stating whether objects are equal
- */
- public boolean equals( JMSBinding binding ) {
- // If the target namespace is set, this binding came from a definitions document.
- // The target namespace and name are used as keys for doing model resolver hashmap lookups.
- // Only the target namespace and name can be compared.
- if (this.targetNamespace != null) {
- if ( !optStringEquals( this.targetNamespace, binding.getTargetNamespace() )) return false;
- if ( !optStringEquals( this.name, binding.getName() )) return false;
- return true;
- }
-
- // Test all fields for equality.
- // First test simple fields to quickly weed out mismatches.
- if ( !optStringEquals( this.uri, binding.getURI() )) return false;
- if ( !optStringEquals( this.name, binding.getName() )) return false;
- if ( !optStringEquals( this.targetNamespace, binding.getTargetNamespace() )) return false;
- if ( !optStringEquals( this.destinationName, binding.getDestinationName() )) return false;
- if ( !optStringEquals( this.correlationScheme, binding.getCorrelationScheme() )) return false;
- if ( !optStringEquals( this.initialContextFactoryName, binding.getInitialContextFactoryName() )) return false;
- if ( !optStringEquals( this.jndiURL, binding.getJndiURL() )) return false;
- if ( !optStringEquals( this.requestConnectionName, binding.getRequestConnectionName() )) return false;
- if ( !optStringEquals( this.responseConnectionName, binding.getResponseConnectionName() )) return false;
- if ( !optStringEquals( this.jmsSelector, binding.getJMSSelector() )) return false;
- if ( !equals( properties, binding.getProperties()) )
- return false;
-
- // Test operation properties
- Set<String> operationNamesA = this.getOperationNames();
- Set<String> operationNamesB = binding.getOperationNames();
- if ( operationNamesA != null && operationNamesB != null ) {
- if ( operationNamesA == null && operationNamesB != null ) return false;
- if ( operationNamesA != null && operationNamesB == null ) return false;
- if ( operationNamesA.size() != operationNamesB.size() ) return false;
- for(Iterator<String> it=operationNamesA.iterator(); it.hasNext(); ) {
- String opName = it.next();
- if ( !operationNamesB.contains( opName )) {
- return false;
- }
- }
- }
-
- // Destination properties
- if ( !optStringEquals( this.getDestinationName(), binding.getDestinationName() )) return false;
- if ( !optStringEquals( this.getDestinationType(), binding.getDestinationType() )) return false;
-
- // Connection factory properties
- if ( !optStringEquals( this.getConnectionFactoryName(), binding.getConnectionFactoryName() )) return false;
-
- // Activation spec properties
- if ( !optStringEquals( this.getActivationSpecName(), binding.getActivationSpecName() )) return false;
-
- // Response properties
- if ( !optStringEquals( this.getResponseDestinationName(), binding.getResponseDestinationName() )) return false;
- if ( !optStringEquals( this.getResponseActivationSpecName(), binding.getResponseActivationSpecName() )) return false;
- if ( !optStringEquals( this.getResponseConnectionFactoryName(), binding.getResponseConnectionFactoryName() )) return false;
-
- // Resource adapter
- if ( !optStringEquals( this.getResourceAdapterName(), binding.getResourceAdapterName() )) return false;
-
- // Configured operations
- if ( this.configuredOperations.size() != binding.getConfiguredOperations().size() ) return false;
-
- // wire format
- if ( this.getRequestWireFormat().getClass() != binding.getRequestWireFormat().getClass()) return false;
- if ( this.getResponseWireFormat().getClass() != binding.getResponseWireFormat().getClass()) return false;
-
- // operation selector
- if ( this.getOperationSelector().getClass() != binding.getOperationSelector().getClass()) return false;
-
-
- // Other fields could also be checked for equality. See class fields for details.
- return true;
- }
-
- /**
- * Tests if Strings are equal.
- * Either one may be null. This will match true if both
- * are null or both are non-null and equal.
- * @param p1 property list 1
- * @param p2 property list 2
- * @return whether or not properties are equal
- */
- public static boolean optStringEquals( Object s1, Object s2 ) {
- if ( s1 == null && s2 == null ) return true;
- if ( s1 != null && s2 == null ) return false;
- if ( s1 == null && s2 != null ) return false;
- return s1.equals( s2 );
- }
-
- /**
- * Tests if two property lists are equal.
- * Either one may be null. This will match true if both
- * are null or both are non-null and equal.
- * @param p1 property list 1
- * @param p2 property list 2
- * @return whether or not properties are equal
- */
- public static boolean equals( Map<String, Object> p1, Map<String, Object> p2 ) {
- if ( p1 == null && p2 == null)
- return true;
- if ( p1 == null || p2 == null)
- return false;
- if ( p1.size() != p2.size())
- return false;
-
- // For both the keys and values of a map
- for (Iterator it=p1.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object k1 = entry.getKey();
- Object v1 = entry.getValue();
- Object v2 = p2.get( k1 );
-
- if ( v1 == null && v2 != null )
- return false;
- if ( v1 != null && v2 == null )
- return false;
- if ( !v1.equals( v2 ))
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
deleted file mode 100644
index 83c213997f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Constants for the JMS binding.
- *
- * @version $Rev$ $Date$
- */
-public interface JMSBindingConstants {
-
- // Constants used when describing the JMS binding
- // model and for setting up defaults
- String BINDING_JMS = "binding.jms";
- QName BINDING_JMS_QNAME = new QName(Constants.SCA10_NS, BINDING_JMS);
- String CORRELATE_MSG_ID = "requestmsgidtocorrelid";
- String CORRELATE_CORRELATION_ID = "requestcorrelidtocorrelid";
- String CORRELATE_NONE = "none";
- List<String> VALID_CORRELATION_SCHEMES =
- Arrays.asList(new String[] {CORRELATE_MSG_ID, CORRELATE_CORRELATION_ID, CORRELATE_NONE});
- String DESTINATION_TYPE_QUEUE = "queue"; // 0
- String DESTINATION_TYPE_TOPIC = "topic"; // 1
- List<String> VALID_DESTINATION_TYPES =
- Arrays.asList(new String[] {DESTINATION_TYPE_QUEUE, DESTINATION_TYPE_TOPIC});
- String CREATE_ALWAYS = "always";
- String CREATE_NEVER = "never";
- String CREATE_IF_NOT_EXIST = "ifnotexist";
- String DEFAULT_CONTEXT_FACTORY_NAME = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
- String DEFAULT_JNDI_URL = "tcp://localhost:61616";
- int DEFAULT_TIME_TO_LIVE = 20000; // in milliseconds
- int DEFAULT_PRIORITY = 1;
- int NON_PERSISTENT = 1; // Maps to javax.jms.DeliveryMode
- String DEFAULT_RF_CLASSNAME = "org.apache.tuscany.sca.host.jms.activemq.JMSResourceFactoryImpl";
- String XML_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor";
- String TEXT_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.TextMessageProcessor";
- String OBJECT_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor";
- String BYTES_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.BytesMessageProcessor";
- String XML_BYTES_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.XMLBytesMessageProcessor";
- String DEFAULT_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.DefaultMessageProcessor";
- String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
-
- String FAULT_PROPERTY = "org_apache_tuscany_sca_fault";
-
- String CALLBACK_ID_PROPERTY = "CallbackID";
- String CALLBACK_Q_PROPERTY = "scaCallbackQueue";
- String CONVERSATION_ID_PROPERTY = "scaConversationId";
-
- // XML element and attribute names
- String HEADERS = "headers";
-
- int MSG_CTXT_POSITION = 0;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
deleted file mode 100644
index 0928e02082..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.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.binding.jms.impl;
-
-/**
- * Base exception for the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public JMSBindingException() {
- super();
- }
-
- public JMSBindingException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public JMSBindingException(String arg0) {
- super(arg0);
- }
-
- public JMSBindingException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
deleted file mode 100644
index 49875d84d0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
+++ /dev/null
@@ -1,1560 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-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.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A processor to read the XML that describes the JMS binding...
- *
- * <binding.jms correlationScheme="string"?
- * initialContextFactory="xs:anyURI"?
- * jndiURL="xs:anyURI"?
- * requestConnection="QName"?
- * responseConnection="QName"?
- * operationProperties="QName"?
- * ...>
- *
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- *
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- * <response>
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- * <wireFormat.someWireFormat/>?
- * </response>?
- *
- * <complexType name="SubscriptionHeaders">
- * <attribute name="JMSSelector" type="string"/>
- * </complexType>
- *
- * <resourceAdapter name="NMTOKEN">?
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </resourceAdapter>?
- *
- * <operationProperties name="string" nativeOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- * </operationProperties>*
- *
- * <wireFormat.someWireFormat/>?
- * </binding.jms>
- *
- * Parsing error messages are recorded locally and reported as validation exceptions. Parsing
- * warnings do not cause validation exceptions.
- *
- * @version $Rev$ $Date$
- */
-
-public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSBinding> {
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private ConfiguredOperationProcessor configuredOperationProcessor;
- protected StAXArtifactProcessor<Object> extensionProcessor;
- private Monitor monitor;
-
- private ModelFactoryExtensionPoint modelFactories; // DOB
- public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.configuredOperationProcessor =
- new ConfiguredOperationProcessor(modelFactories, this.monitor);
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- this.modelFactories = modelFactories;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an error.
- * One side effect is that error messages are saved for future validation calls.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return JMSBindingConstants.BINDING_JMS_QNAME;
- }
-
- public Class<JMSBinding> getModelType() {
- return JMSBinding.class;
- }
-
- public JMSBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JMSBinding jmsBinding = new JMSBinding();
- // Reset validation message to keep track of validation issues.
-
- // Read policies
- policyProcessor.readPolicies(jmsBinding, reader);
-
- // Read binding name
- String name = reader.getAttributeValue(null, "name");
- if (name != null) {
- jmsBinding.setName(name);
- }
-
- // Read binding URI
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null && uri.length() > 0) {
- parseURI(uri, jmsBinding);
- }
-
- // Read correlation scheme
- String correlationScheme = reader.getAttributeValue(null, "correlationScheme");
- if (correlationScheme != null && correlationScheme.length() > 0) {
- if (JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
- jmsBinding.setCorrelationScheme(correlationScheme);
- } else {
- error("InvalidCorrelationScheme", reader, correlationScheme);
- }
- }
-
- // Read initial context factory
- String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
- if (initialContextFactory != null && initialContextFactory.length() > 0) {
- jmsBinding.setInitialContextFactoryName(initialContextFactory);
- }
-
- // Read JNDI URL
- String jndiURL = reader.getAttributeValue(null, "jndiURL");
- if (jndiURL != null && jndiURL.length() > 0) {
- jmsBinding.setJndiURL(jndiURL);
- }
-
- // Read message processor class name
- // TODO - maintain this for the time being but move over to
- // configuring wire formats instead of message processors
- String messageProcessorName = reader.getAttributeValue(null, "messageProcessor");
- if (messageProcessorName != null && messageProcessorName.length() > 0) {
- if ("XMLTextMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSTextXML());
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- } else if ("TextMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSText());
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- } else if ("ObjectMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSObject());
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- } else {
- jmsBinding.setRequestMessageProcessorName(messageProcessorName);
- jmsBinding.setResponseMessageProcessorName(messageProcessorName);
- // exploit the text wire format code to drive the user selected
- // message processor
- jmsBinding.setRequestWireFormat(new WireFormatJMSText());
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- }
- }
-
- String requestConnectionName = reader.getAttributeValue(null, "requestConnection");
- if (requestConnectionName != null && requestConnectionName.length() > 0) {
- jmsBinding.setRequestConnectionName(getQNameValue(reader, requestConnectionName));
- }
- String responseConnectionName = reader.getAttributeValue(null, "responseConnection");
- if (responseConnectionName != null && responseConnectionName.length() > 0) {
- jmsBinding.setResponseConnectionName(getQNameValue(reader, responseConnectionName));
- }
-
- String operationPropertiesName = reader.getAttributeValue(null, "operationProperties");
- if (operationPropertiesName != null && operationPropertiesName.length() > 0) {
- jmsBinding.setOperationPropertiesName(getQNameValue(reader, operationPropertiesName));
- }
-
- // Read sub-elements of binding.jms
- boolean endFound = false;
- while (!endFound) {
- int fg = reader.next();
- switch (fg) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("destination".equals(elementName)) {
- parseDestination(reader, jmsBinding);
- } else if ("connectionFactory".equals(elementName)) {
- parseConnectionFactory(reader, jmsBinding);
- } else if ("activationSpec".equals(elementName)) {
- parseActivationSpec(reader, jmsBinding);
- } else if ("response".equals(elementName)) {
- parseResponse(reader, jmsBinding);
- } else if ("resourceAdapter".equals(elementName)) {
- parseResourceAdapter(reader, jmsBinding);
- } else if ("headers".equals(elementName)) {
- parseHeaders(reader, jmsBinding);
- } else if ("operationProperties".equals(elementName)) {
- parseOperationProperties(reader, jmsBinding);
- } else if ("SubscriptionHeaders".equals(elementName)) {
- parseSubscriptionHeaders(reader, jmsBinding);
- } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
- ConfiguredOperation confOp = configuredOperationProcessor.read(reader);
- if (confOp != null) {
- ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
- }
- } else {
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- if (jmsBinding.getRequestWireFormat() == null) {
- jmsBinding.setRequestWireFormat((WireFormat) extension);
- } else {
- throw new ContributionReadException("The request wireformat has already been defined. " + "Only one request wire format can be specified.");
- }
- } else if (extension instanceof OperationSelector) {
- if (jmsBinding.getOperationSelector() == null) {
- jmsBinding.setOperationSelector((OperationSelector) extension);
- } else {
- throw new ContributionReadException("More than one operation selector has been specified. " + "Only one operation selector can be specified.");
- }
-
- } else {
- error("UnexpectedElement", reader, extension.toString());
- }
- }
- }
- //reader.next();
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (Constants.OPERATION.equals(x.getLocalPart())) break;
- // This assumption is not captured in schema, which isn't good, but will probably be fine for now.
- // A better solution might be to require each processor to advance to its own END_ELEMENT.
- if (x.getLocalPart().startsWith("wireFormat.") || x.getLocalPart().startsWith("operationSelector.")) {
- break;
- }
- if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
- endFound = true;
- } else {
- error("UnexpectedElement: expected " + JMSBindingConstants.BINDING_JMS_QNAME + ", found " + x.toString(),
- reader, x.toString());
- }
- }
- }
-
- // if no operation selector is specified then assume the default
- if (jmsBinding.getOperationSelector() == null){
- jmsBinding.setOperationSelector(new OperationSelectorJMSDefault());
- }
-
- // if no request wire format specified then assume the default
- if (jmsBinding.getRequestWireFormat() == null){
- jmsBinding.setRequestWireFormat(new WireFormatJMSDefault());
- }
-
- // if no response wire format specific then assume the same as the request
- if (jmsBinding.getResponseWireFormat() == null){
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- }
-
- validate( jmsBinding );
-
- return jmsBinding;
- }
-
- protected void parseURI(String uri, JMSBinding jmsBinding) {
- if (!uri.startsWith("jms:")) {
- error("MustStartWithSchema", jmsBinding, uri);
- return;
- }
- int i = uri.indexOf('?');
- if (i >= 0) {
- StringTokenizer st = new StringTokenizer(uri.substring(i+1),"&");
- while (st.hasMoreTokens()) {
- String s = st.nextToken();
- if (s.startsWith("connectionFactoryName=")) {
- jmsBinding.setConnectionFactoryName(s.substring(22));
- } else {
- error("UnknownTokenInURI", jmsBinding, s, uri);
- return;
- }
- }
- jmsBinding.setDestinationName(uri.substring(4, i));
- } else {
- jmsBinding.setDestinationName(uri.substring(4));
- }
- }
-
- public void resolve(JMSBinding model, ModelResolver resolver) throws ContributionResolveException {
- if (model.getRequestConnectionName() != null) {
- model.setRequestConnectionBinding(getConnectionBinding(model, "requestConnection", model.getRequestConnectionName(), resolver));
- }
- if (model.getResponseConnectionName() != null) {
- model.setResponseConnectionBinding(getConnectionBinding(model, "responseConnection", model.getResponseConnectionName(), resolver));
- }
- if (model.getOperationPropertiesName() != null) {
- model.setOperationPropertiesBinding(getConnectionBinding(model, "operationProperties", model.getOperationPropertiesName(), resolver));
- }
- }
-
- @SuppressWarnings("unchecked")
- private JMSBinding getConnectionBinding(JMSBinding model, String attrName, QName bindingName, ModelResolver resolver) {
- JMSBinding binding = new JMSBinding();
- binding.setTargetNamespace(bindingName.getNamespaceURI());
- binding.setName(bindingName.getLocalPart());
- binding.setUnresolved(true);
- binding = resolver.resolveModel(JMSBinding.class, binding);
- if (binding.isUnresolved())
- error("BindingNotFound", model, attrName, bindingName);
- return binding;
- }
-
- private void parseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- warning("DoesntProcessDestinationType", jmsBinding);
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
- jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
- } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
- jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
- } else {
- error("InvalidDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- jmsBinding.setDestinationCreate(create);
- }
-
- jmsBinding.getDestinationProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setConnectionFactoryName(name);
- } else {
- error("MissingConnectionFactoryName", reader);
- }
- jmsBinding.getConnectionFactoryProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setActivationSpecName(name);
- } else {
- warning("MissingActivationSpecName", reader);
- }
- jmsBinding.getActivationSpecProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- warning("DoesntProcessResponseDestinationType", jmsBinding);
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
- jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
- } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
- jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
- } else {
- error("InvalidResponseDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- jmsBinding.setResponseDestinationCreate(create);
- }
-
- jmsBinding.getResponseDestinationProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseConnectionFactoryName(name);
- } else {
- warning("MissingResponseConnectionFactory", reader);
- }
- jmsBinding.getResponseConnectionFactoryProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseActivationSpecName(name);
- } else {
- warning("MissingResponseActivationSpec", reader);
- }
- jmsBinding.getResponseActivationSpecProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding) throws ContributionReadException, XMLStreamException {
- // Read sub-elements of response
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("destination".equals(elementName)) {
- parseResponseDestination(reader, jmsBinding);
- } else if ("connectionFactory".equals(elementName)) {
- parseResponseConnectionFactory(reader, jmsBinding);
- } else if ("activationSpec".equals(elementName)) {
- parseResponseActivationSpec(reader, jmsBinding);
- } else {
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- if (jmsBinding.getResponseWireFormat() == null) {
- jmsBinding.setResponseWireFormat((WireFormat)extension);
- } else {
- throw new ContributionReadException("The response wireformat has already been defined. " + "Only one response wire format can be specified.");
- }
- } else {
- error("UnexpectedElement", reader, extension.toString());
- }
- }
- reader.next();
- }
- //reader.next();
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("response")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResourceAdapterName(name);
- } else {
- error("MissingResourceAdapterName", reader);
- }
- jmsBinding.getResourceAdapterProperties().putAll(parseBindingProperties(reader));
- }
-
- /**
- * <headers JMSType=”string”?
- * JMSCorrelationID=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- */
- private void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "JMSType");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setJMSType(jmsType);
- }
-
- String jmsCorrelationId = reader.getAttributeValue(null, "JMSCorrelationID");
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- jmsBinding.setJMSCorrelationId(jmsCorrelationId);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "JMSDeliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSDeliveryMode(true);
- } else if ("NON_PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSDeliveryMode(false);
- } else {
- error("InvalidJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "JMSTimeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setJMSTimeToLive(Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "JMSPriority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- try {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setJMSPriority(p);
- } else {
- warning("InvalidJMSPriority", jmsBinding, jmsPriority);
- }
- } catch (NumberFormatException ex) {
- error("InvalidJMSPriority", jmsBinding, jmsPriority);
- }
- }
-
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("property")) {
- parseProperty(reader, jmsBinding);
- }
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseProperty(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- jmsBinding.setHeaders( true );
- String name = reader.getAttributeValue(null, "name");
- String type = reader.getAttributeValue(null, "type");
- if (name != null && name.length() > 0) {
- Object value = reader.getElementText();
- if ("boolean".equalsIgnoreCase(type)) {
- value = Boolean.parseBoolean((String)value);
- } else if ("byte".equalsIgnoreCase(type)) {
- value = Byte.parseByte(((String)value));
- } else if ("short".equalsIgnoreCase(type)) {
- value = Short.parseShort((String)value);
- } else if ("int".equalsIgnoreCase(type)) {
- value = Integer.parseInt((String)value);
- } else if ("long".equalsIgnoreCase(type)) {
- value = Long.parseLong((String)value);
- } else if ("float".equalsIgnoreCase(type)) {
- value = Float.parseFloat((String)value);
- } else if ("double".equalsIgnoreCase(type)) {
- value = Double.parseDouble((String)value);
- } else if ("String".equalsIgnoreCase(type)) {
- // its already a string
- }
- jmsBinding.setProperty(name, value);
- }
- }
-
- /**
- * <operationProperties name=”string” nativeOperation=”string”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * <headers JMSType=”string”?
- * JMSCorrelationID=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- * </operationProperties>*
- */
- private void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
-
- if (jmsBinding.getOperationPropertiesName() != null) {
- error("DuplicateOperationProperties", jmsBinding);
- }
-
- String opName = reader.getAttributeValue(null, "name");
- if (opName == null || opName.length() < 1) {
- warning("MissingJMSOperationPropertyName", jmsBinding);
- return;
- }
- // Since nativeOpName, headers, and property elements are optional, must add opName.
- jmsBinding.addOperationName(opName);
- String nativeOpName = reader.getAttributeValue(null, "nativeOperation"); // optional
- if (nativeOpName != null && nativeOpName.length() > 0) {
- jmsBinding.setNativeOperationName(opName, nativeOpName);
- }
-
- Map<String, BindingProperty> props = new HashMap<String, BindingProperty>();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("headers")) { // optional
- parseOperationHeaders(reader, jmsBinding, opName);
- } else if (reader.getName().getLocalPart().equals("property")) { // optional
- processProperty(reader, props);
- }
- break;
- case END_ELEMENT:
- if (reader.isEndElement()) {
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- break;
- }
- if (x.getLocalPart().equals("property")) {
- break;
- }
- if (x.getLocalPart().equals("operationProperties")) {
- jmsBinding.getOperationPropertiesProperties(opName).putAll(props);
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
- }
-
- private void parseOperationHeaders(XMLStreamReader reader, JMSBinding jmsBinding, String opName) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "JMSType");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setOperationJMSType(opName, jmsType);
- }
-
- String jmsCorrelationId = reader.getAttributeValue(null, "JMSCorrelationID");
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- jmsBinding.setOperationJMSCorrelationId(opName, jmsCorrelationId);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "JMSDeliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setOperationJMSDeliveryMode(opName, true);
- } else if ("NON_PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setOperationJMSDeliveryMode(opName, false);
- } else {
- error("InvalidOPJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "JMSTimeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setOperationJMSTimeToLive(opName, Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "JMSPriority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- try {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setOperationJMSPriority(opName, p);
- } else {
- warning("InvalidOPJMSPriority", jmsBinding, jmsPriority);
- }
- } catch (NumberFormatException ex) {
- error("InvalidOPJMSPriority", jmsBinding, jmsPriority);
- }
- }
-
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("property")) {
- parseOperationPropertyProperties(reader, jmsBinding, opName);
- }
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseOperationPropertyProperties(XMLStreamReader reader, JMSBinding jmsBinding, String opName) throws XMLStreamException {
- String propName = reader.getAttributeValue(null, "name");
- String type = reader.getAttributeValue(null, "type");
- if (propName != null && propName.length() > 0) {
- Object value = reader.getElementText();
- if ("boolean".equalsIgnoreCase(type)) {
- value = Boolean.parseBoolean((String)value);
- } else if ("byte".equalsIgnoreCase(type)) {
- value = Byte.parseByte(((String)value));
- } else if ("short".equalsIgnoreCase(type)) {
- value = Short.parseShort((String)value);
- } else if ("int".equalsIgnoreCase(type)) {
- value = Integer.parseInt((String)value);
- } else if ("long".equalsIgnoreCase(type)) {
- value = Long.parseLong((String)value);
- } else if ("float".equalsIgnoreCase(type)) {
- value = Float.parseFloat((String)value);
- } else if ("double".equalsIgnoreCase(type)) {
- value = Double.parseDouble((String)value);
- } else if ("String".equalsIgnoreCase(type)) {
- // its already a string
- }
- jmsBinding.setOperationProperty(opName, propName, value);
- }
- }
-
- private void parseSubscriptionHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String jmsSelector = reader.getAttributeValue(null, "JMSSelector");
- if (jmsSelector != null && jmsSelector.length() > 0) {
- jmsBinding.setJMSSelector(jmsSelector);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && "SubscriptionHeaders".equals(reader.getName().getLocalPart())) {
- break;
- }
- } // end while
- }
-
- private Map<String, BindingProperty> parseBindingProperties(XMLStreamReader reader) throws XMLStreamException {
- Map<String, BindingProperty> props = new HashMap<String, BindingProperty>();
- String parentName = reader.getName().getLocalPart();
- // Parse for all the properties within this element, until the end of
- // the element is reached.
- boolean completed = false;
- while (!completed) {
- switch (reader.next()) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("property".equals(elementName)) {
- processProperty(reader, props);
- }
- break;
- case END_ELEMENT:
- String endName = reader.getName().getLocalPart();
- if (parentName.equals(endName)) {
- completed = true;
- break;
- }
- }
- }
- return props;
- }
-
- private void processProperty(XMLStreamReader reader, Map<String, BindingProperty> props) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name == null || name.length() < 1) {
- error("InvalidPropertyElement", reader);
- }
- String type = reader.getAttributeValue(null, "type");
- String value = reader.getElementText();
- props.put(name, new BindingProperty(name, type, value));
- }
-
- /**
- * Preserve an existing public method. The method validate() is a legacy method
- * that was called from reading am XML stream via the read(XMLStreamReader) method above.
- * However read(XMLStreamReader) now calls validate(JMSBinding jmsBinding) and
- * passes in the jmsBinding model.
- * The older validate() now calls validate(JMSBinding jmsBinding) with a null model.
- */
- public void validate() {
- validate( null );
- }
-
- /**
- * Validates JMS parsing and JMSBinding model.
- * Validation rules are taken from the binding schema and the OSOA and OASIS specs:
- * http://www.oasis-open.org/committees/documents.php?wg_abbrev=sca-bindings
- * (sca-binding-jms-1.1-spec-cd01-rev4.pdf)
- * http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- * (SCA JMS Binding V1.00 )
- * @param jmsBinding an optional JMS binding model to check for validity.
- * @since 1.4
- */
- protected void validate( JMSBinding jmsBinding ) {
- // If no JMSBinding model is provided, that is all the validation we can do.
- if ( jmsBinding == null ) {
- return;
- }
-
- // Connection factory should not contradict destination type.
- String connectionFactoryName = jmsBinding.getConnectionFactoryName();
- if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE == jmsBinding.getDestinationType()) {
- if ( connectionFactoryName.contains( "topic" )) {
- error("DestinationQueueContradiction", jmsBinding, connectionFactoryName );
- }
- }
- if (JMSBindingConstants.DESTINATION_TYPE_TOPIC == jmsBinding.getDestinationType()) {
- if ( connectionFactoryName.contains( "queue" )) {
- error("DestinationTopicContradiction", jmsBinding, connectionFactoryName );
- }
- }
- }
-
- // Connection factory and activation Specification are mutually exclusive.
- if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
- String activationSpecName = jmsBinding.getActivationSpecName();
- if ((activationSpecName != null) && (activationSpecName.length() > 0 )) {
- error("ConnectionFactoryActivationSpecContradiction", jmsBinding, connectionFactoryName, activationSpecName );
- }
- }
-
- // Given a response connection name attribute, there must not be a response element.
- // 156 • /binding.jms/@responseConnection – identifies a binding.jms element that is present in a
- // 157 definition document, whose response child element is used to define the values for this binding. In
- // 158 this case this binding.jms element MUST NOT contain a response element.
- QName responseConnectionName = jmsBinding.getResponseConnectionName();
- if (( responseConnectionName != null ) && ( responseConnectionName.getLocalPart().length() > 0 )) {
- String responseDestinationName = jmsBinding.getResponseDestinationName();
- if (( responseDestinationName != null ) && (responseDestinationName.length() > 0)) {
- error("ResponseAttrElement", jmsBinding, responseConnectionName, responseDestinationName );
- }
- }
-
- // Other jmsBinding model validation may be added here.
-
- }
-
- /**
- * Given a valid JMSBinding, write it as XML using the given XML writer.
- *
- * This high-level method handles binding.jms element and its attributes.
- * Sub elements have their own writer methods and are called from here.
- * <binding.jms
- * correlationScheme="string"?
- * initialContextFactory="xs:anyURI"?
- * jndiURL="xs:anyURI"?
- * requestConnection="QName"?
- * responseConnection="QName"?
- * operationProperties="QName"?
- * ...>
- *
- * @param jmsBinding JMSBinding model
- * @param writer an XMLStreamWriter that writes XML attributes and elements
- */
- public void write(JMSBinding jmsBinding, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- // Write a <binding.jms>
- writeStart(writer, Constants.SCA10_NS, JMSBindingConstants.BINDING_JMS,
- new XAttr("requestConnection", jmsBinding.getRequestConnectionName()),
- new XAttr("responseConnection", jmsBinding.getResponseConnectionName()),
- new XAttr("operationProperties", jmsBinding.getOperationPropertiesName()));
-
- if (jmsBinding.getName() != null) {
- writer.writeAttribute("name", jmsBinding.getName());
- }
-
- if (jmsBinding.getURI() != null) {
- writer.writeAttribute("uri", jmsBinding.getURI());
- }
-
- //String dest = jmsBinding.getDestinationName();
- //if (dest != null) {
- // if ( dest != null ) {
- // writer.writeAttribute("uri", "jms:" + jmsBinding.getDestinationName());
- // }
- //}
-
- String correlationScheme = jmsBinding.getCorrelationScheme();
- if ( correlationScheme != null ) {
- if ( !correlationScheme.equals(JMSBindingConstants.CORRELATE_MSG_ID) ) {
- writer.writeAttribute("correlationScheme", jmsBinding.getCorrelationScheme());
- }
- }
-
- if ( jmsBinding.getInitialContextFactoryName() != null ) {
- writer.writeAttribute("initialContextFactory", jmsBinding.getInitialContextFactoryName());
- }
-
- if ( jmsBinding.getJndiURL() != null ) {
- writer.writeAttribute("jndiURL", jmsBinding.getJndiURL());
- }
-
- if ( jmsBinding.containsHeaders() ) {
- writeHeaders( jmsBinding, writer);
- }
-
- writeOperationProperties( jmsBinding, writer );
-
- writeSubscriptionHeaders( jmsBinding, writer );
-
- writeDestinationProperties( jmsBinding, writer );
-
- writeConnectionFactoryProperties( jmsBinding, writer );
-
- writeActivationSpecProperties( jmsBinding, writer );
-
- // Write response info, if names are not defaults.
- String responseDestName = jmsBinding.getResponseDestinationName();
- String responseCFName = jmsBinding.getResponseConnectionFactoryName();
- String responseASName = jmsBinding.getResponseActivationSpecName();
- if ( responseDestName != null ||
- responseCFName != null ||
- responseASName != null ) {
-
- writer.writeStartElement(Constants.SCA10_NS, "response");
- writeResponseDestinationProperties( jmsBinding, writer );
- writeResponseConnectionFactoryProperties( jmsBinding, writer );
- writeResponseActivationSpecProperties( jmsBinding, writer );
-
- if ((jmsBinding.getResponseWireFormat() != null) &&
- !(jmsBinding.getResponseWireFormat() instanceof WireFormatJMSDefault)){
- writeWireFormat(jmsBinding.getResponseWireFormat(), writer);
- }
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters( " " );
- }
-
- writeResourceAdapterProperties( jmsBinding, writer );
-
- writeConfiguredOperations( jmsBinding, writer );
-
- if ((jmsBinding.getRequestWireFormat() != null) &&
- !(jmsBinding.getRequestWireFormat() instanceof WireFormatJMSDefault)){
- writeWireFormat(jmsBinding.getRequestWireFormat(), writer);
- }
-
- if ((jmsBinding.getOperationSelector() != null) &&
- !(jmsBinding.getOperationSelector() instanceof OperationSelectorJMSDefault)){
- writeOperationSelector(jmsBinding.getOperationSelector(), writer);
- }
-
- writeEnd(writer);
- }
-
- /**
- * Writes headers element and its attributes.
- * <headers JMSType=”string”?
- * JMSCorrelationID=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- */
- private void writeHeaders( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
-
- writer.writeStartElement(Constants.SCA10_NS, JMSBindingConstants.HEADERS);
-
- String jmsType = jmsBinding.getJMSType();
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("JMSType", jmsType);
- }
-
- String jmsCorrelationId = jmsBinding.getJMSCorrelationId();
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- writer.writeAttribute("JMSCorrelationID", jmsCorrelationId);
- }
-
- Boolean jmsDeliveryMode = jmsBinding.isdeliveryModePersistent();
- if (jmsDeliveryMode != null) {
- if ( jmsDeliveryMode.booleanValue() )
- writer.writeAttribute("JMSDeliveryMode", "PERSISTENT");
- else
- writer.writeAttribute("JMSDeliveryMode", "NON_PERSISTENT");
- }
-
- Long jmsTimeToLive = jmsBinding.getJMSTimeToLive();
- if (jmsTimeToLive != null) {
- writer.writeAttribute("JMSTimeToLive", jmsTimeToLive.toString());
- }
-
- Integer jmsPriority = jmsBinding.getJMSPriority();
- if (jmsPriority != null) {
- writer.writeAttribute("JMSPriority", jmsPriority.toString());
- }
-
- Map<String, Object> properties = jmsBinding.getProperties();
- writeProperties( properties, writer );
- //writer.writeCharacters( " " );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters( " " );
- }
-
- /**
- * Writes a complete set of properties to the given XML stream writer.
- * If the value is of type string, the property will be output:
- * <property name="key">StringValue</property>
- * If the value is of type box (e.g.Integer, Long) or BindingProperty, the output will be
- * <property name="key" type="int">42</property>
- */
- private void writeProperties(Map<String, Object> properties, XMLStreamWriter writer) throws XMLStreamException {
- if (( properties == null ) || ( properties.size() == 0 )) {
- return;
- }
-
- // For both the keys and values of a map
- for (Iterator it=properties.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
-
- writer.writeStartElement(Constants.SCA10_NS, "property" );
- writer.writeAttribute("name", key.toString());
-
- if ( value instanceof String) {
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof BindingProperty ) {
- BindingProperty property = (BindingProperty) value;
- String type = property.getType();
- if ( type != null ) {
- writer.writeAttribute("type", type);
- }
- writer.writeCharacters( property.getValue().toString() );
- } else if ( value instanceof Boolean ) {
- writer.writeAttribute("type", "boolean");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Byte ) {
- writer.writeAttribute("type", "byte");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Short ) {
- writer.writeAttribute("type", "short");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Integer ) {
- writer.writeAttribute("type", "int");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Long ) {
- writer.writeAttribute("type", "long");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Float ) {
- writer.writeAttribute("type", "float");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Double ) {
- writer.writeAttribute("type", "double");
- writer.writeCharacters( value.toString() );
- } else {
- writer.writeCharacters( value.toString() );
- }
- writer.writeEndElement();
- }
- }
-
- /**
- * Writes operation properties if there are any.
- *
- * <operationProperties name="string" nativeOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers JMSType="string"?
- * JMSCorrelationID="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- * </operationProperties>*
- * </binding.jms>
- */
- private void writeOperationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- if (jmsBinding.getOperationPropertiesBinding() != null) {
- return;
- }
- Set<String> operationNames = jmsBinding.getOperationNames();
- if (operationNames == null || (operationNames.size() < 1)) {
- return;
- }
-
- for(Iterator<String> it=operationNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
-
- writer.writeStartElement(Constants.SCA10_NS, "operationProperties");
- writer.writeAttribute("name", opName);
-
- String nativeOperation = jmsBinding.getNativeOperationName(opName);
- if (nativeOperation != null && nativeOperation.length() > 0) {
- if ( !nativeOperation.equals( opName )) {
- writer.writeAttribute("nativeOperation", nativeOperation);
- }
- }
-
- Map<String, BindingProperty> operationPropertiesProperties =
- jmsBinding.getOperationPropertiesProperties(opName);
- writeBindingProperties( operationPropertiesProperties, writer );
-
- String jmsType = jmsBinding.getOperationJMSType(opName);
- String jmsCorrelationId = jmsBinding.getOperationJMSCorrelationId(opName);
- Boolean jmsDeliveryMode = jmsBinding.getOperationJMSDeliveryMode(opName);
- Long jmsTimeToLive = jmsBinding.getOperationJMSTimeToLive(opName);
- Integer jmsPriority = jmsBinding.getOperationJMSPriority(opName);
- Map<String, Object> operationProperties = jmsBinding.getOperationProperties(opName);
-
- if (operationProperties != null){
- if ((jmsType != null && jmsType.length() > 0) ||
- (jmsCorrelationId != null && jmsCorrelationId.length() > 0) ||
- jmsDeliveryMode != null || jmsTimeToLive != null ||
- jmsPriority != null) {
-
- writer.writeStartElement(Constants.SCA10_NS, JMSBindingConstants.HEADERS);
-
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("JMSType", jmsType);
- }
-
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- writer.writeAttribute("JMSCorrelationID", jmsCorrelationId);
- }
-
- if (jmsDeliveryMode != null) {
- if (jmsDeliveryMode.booleanValue())
- writer.writeAttribute("JMSDeliveryMode", "PERSISTENT");
- else
- writer.writeAttribute("JMSDeliveryMode", "NON_PERSISTENT");
- }
-
- if (jmsTimeToLive != null) {
- writer.writeAttribute("JMSTimeToLive", jmsTimeToLive.toString());
- }
-
- if (jmsPriority != null) {
- writer.writeAttribute("JMSPriority", jmsPriority.toString());
- }
-
- writeProperties( operationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- // writer.writeCharacters( " " );
- }
- }
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
- }
-
- /**
- * Writes a complete set of properties to the given XML stream writer.
- * If the value is of type string, the property will be output:
- * <property name="key">StringValue</property>
- * If the value is of type box (e.g.Integer, Long) or BindingProperty, the output will be
- * <property name="key" type="int">42</property>
- */
- private void writeBindingProperties(Map<String, BindingProperty> properties, XMLStreamWriter writer) throws XMLStreamException {
- if (( properties == null ) || ( properties.size() == 0 )) {
- return;
- }
-
- // For both the keys and values of a map
- for (Iterator it=properties.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
-
- writer.writeStartElement(Constants.SCA10_NS, "property" );
- if (key != null){
- writer.writeAttribute("name", key.toString());
- }
-
- if ( value instanceof String) {
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof BindingProperty ) {
- BindingProperty property = (BindingProperty) value;
- String type = property.getType();
- if ( type != null ) {
- writer.writeAttribute("type", type);
- }
- writer.writeCharacters( property.getValue().toString() );
- } else {
- writer.writeCharacters( value.toString() );
- }
- writer.writeEndElement();
- }
- }
-
- /**
- * Writes subscription headers if there are any.
- * <complexType name="SubscriptionHeaders">
- * <attribute name="JMSSelector" type="string"/>
- * </complexType>
- *
- */
- private void writeSubscriptionHeaders( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String jmsSubscriptionHeaders = jmsBinding.getJMSSelector();
- if (jmsSubscriptionHeaders != null && jmsSubscriptionHeaders.length() > 0) {
- writer.writeStartElement(Constants.SCA10_NS, "SubscriptionHeaders");
- writer.writeAttribute("JMSSelector", jmsSubscriptionHeaders);
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- // writer.writeCharacters( " " );
- }
- }
-
- /**
- * Writes destination properties if there are any.
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- */
- private void writeDestinationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String destinationName = jmsBinding.getDestinationName();
- if (destinationName == null || (destinationName.length() < 1)) {
- return;
- }
- if (destinationName == null) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("name", destinationName);
- }
-
- // Type not handled yet
- // String destinationType = jmsBinding.getDestinationType();
- // if ( destinationType != null && destinationType.length() > 0) {
- // writer.writeAttribute("type", destinationType);
- // }
-
- String destinationCreate = jmsBinding.getDestinationCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0 &&
- !destinationCreate.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> destinationProperties =
- jmsBinding.getDestinationProperties();
- writeBindingProperties( destinationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes connection factory properties if there are any.
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- */
- private void writeConnectionFactoryProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String cfName = jmsBinding.getConnectionFactoryName();
- if (cfName == null || (cfName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("name", cfName);
- }
-
- String destinationCreate = jmsBinding.getConnectionFactoryCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0 &&
- !destinationCreate.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getConnectionFactoryProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes activation Spec properties if there are any.
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- */
- private void writeActivationSpecProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getActivationSpecName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "activationSpec");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- String destinationCreate = jmsBinding.getActivationSpecCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getActivationSpecProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response destination properties if there are any.
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- */
- private void writeResponseDestinationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String destinationName = jmsBinding.getResponseDestinationName();
- if (destinationName == null || (destinationName.length() < 1)) {
- return;
- }
- if (destinationName == null) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("name", destinationName);
- }
-
- // Type not handled yet
- // String destinationType = jmsBinding.getDestinationType();
- // if ( destinationType != null && destinationType.length() > 0) {
- // writer.writeAttribute("type", destinationType);
- // }
-
- String destinationCreate = jmsBinding.getResponseDestinationCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> destinationProperties =
- jmsBinding.getResponseDestinationProperties();
- writeBindingProperties( destinationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response connection factory properties if there are any.
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- */
- private void writeResponseConnectionFactoryProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String cfName = jmsBinding.getResponseConnectionFactoryName();
- if (cfName == null || (cfName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("name", cfName);
- }
-
- String destinationCreate = jmsBinding.getResponseConnectionFactoryCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResponseConnectionFactoryProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response activation Spec properties if there are any.
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- */
- private void writeResponseActivationSpecProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getResponseActivationSpecName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "activationSpec");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- String destinationCreate = jmsBinding.getResponseActivationSpecCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResponseActivationSpecProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes resource adapter properties if there are any.
- * <resourceAdapter name="NMTOKEN">?
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </resourceAdapter>?
- */
- private void writeResourceAdapterProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getResourceAdapterName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement(Constants.SCA10_NS, "resourceAdapter");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResourceAdapterProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes configured operations if there are any.
- * <binding.jms uri=\"jms:testQueue\" >"
- * <operationProperties name=\"op1\">"
- * </operationProperties >"
- * <operation name=\"op1\" requires=\"IntentOne IntentTwo\"/>"
- * </binding.jms>"
- */
- private void writeConfiguredOperations( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException, ContributionWriteException {
- List<ConfiguredOperation> configOps = jmsBinding.getConfiguredOperations();
- if (configOps == null || (configOps.size() < 1)) {
- return;
- }
-
- for( Iterator<ConfiguredOperation> it = configOps.iterator(); it.hasNext();) {
- configuredOperationProcessor.write(it.next(), writer);
- }
-
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Wire out a request or response wire format element. Uses extension processors
- * to do this as wire format is an extension point
- *
- * @param wireFormat
- * @param writer
- */
- private void writeWireFormat(WireFormat wireFormat, XMLStreamWriter writer ) throws XMLStreamException, ContributionWriteException {
- extensionProcessor.write(wireFormat, writer);
- }
-
- /**
- * Wire out an operation selector element. Uses extension processors
- * to do this as operation selector is an extension point
- *
- * @param operationSeletor
- * @param writer
- */
- private void writeOperationSelector(OperationSelector operationSeletor, XMLStreamWriter writer ) throws XMLStreamException, ContributionWriteException{
- extensionProcessor.write(operationSeletor, writer);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java
deleted file mode 100644
index ce7c2a71b9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.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.binding.jms.operationselector.jmsdefault;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefault implements OperationSelector {
- public static final QName OPERATION_SELECTOR_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "operationSelector.jmsdefault");
-
- public QName getSchemaName() {
- return OPERATION_SELECTOR_JMS_DEFAULT_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java
deleted file mode 100644
index 4a8e4a1bd2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<OperationSelectorJMSDefault> {
-
- public QName getArtifactType() {
- return OperationSelectorJMSDefault.OPERATION_SELECTOR_JMS_DEFAULT_QNAME;
- }
-
- public OperationSelectorJMSDefaultProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public OperationSelectorJMSDefault read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- OperationSelectorJMSDefault wireFormat = new OperationSelectorJMSDefault();
-
- return wireFormat;
- }
-
- public void write(OperationSelectorJMSDefault wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<OperationSelectorJMSDefault> getModelType() {
- return OperationSelectorJMSDefault.class;
- }
-
- public void resolve(OperationSelectorJMSDefault arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserProp.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserProp.java
deleted file mode 100644
index 5e76405754..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserProp.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-
-/**
- * Model of user property based operation selection
- *
- * <operationSelector.jmsUser propertName="MyHeaderProperty"/>
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSUserProp implements OperationSelector {
- public static final QName OPERATION_SELECTOR_JMS_USERPROP_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "operationSelector.jmsUserProp");
- public static final String OPERATION_SELECTOR_JMS_USERPROP_ATTR = "propertyName";
-
- private String propertyName;
-
- public QName getSchemaName() {
- return OPERATION_SELECTOR_JMS_USERPROP_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public String getPropertyName() {
- return propertyName;
- }
-
- public void setPropertyName(String propertyName) {
- this.propertyName = propertyName;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserPropProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserPropProcessor.java
deleted file mode 100644
index f1fd97cb4e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsuserprop/OperationSelectorJMSUserPropProcessor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSUserPropProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<OperationSelectorJMSUserProp> {
-
- public QName getArtifactType() {
- return OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_QNAME;
- }
-
- public OperationSelectorJMSUserPropProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public OperationSelectorJMSUserProp read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- OperationSelectorJMSUserProp opSelector = new OperationSelectorJMSUserProp();
- String propertyName = reader.getAttributeValue(null, OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR);
- if (propertyName != null && propertyName.length() > 0) {
- opSelector.setPropertyName(propertyName);
- } else {
- throw new ContributionReadException(OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_QNAME.toString() + ": " +
- OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR + " is a required attribute.");
- }
-
- return opSelector;
- }
-
- public void write(OperationSelectorJMSUserProp opSelector, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if (opSelector.getPropertyName() != null) {
- writer.writeAttribute(OperationSelectorJMSUserProp.OPERATION_SELECTOR_JMS_USERPROP_ATTR, opSelector.getPropertyName());
- }
-
- writer.writeEndElement();
- }
-
- public Class<OperationSelectorJMSUserProp> getModelType() {
- return OperationSelectorJMSUserProp.class;
- }
-
- public void resolve(OperationSelectorJMSUserProp arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java
deleted file mode 100644
index 84d1a2740f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.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.binding.jms.wireformat.jmsbytes;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytes implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsBytes");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java
deleted file mode 100644
index 2d807d49cb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSBytes> {
-
- public QName getArtifactType() {
- return WireFormatJMSBytes.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSBytesProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSBytes read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSBytes wireFormat = new WireFormatJMSBytes();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSBytes wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSBytes> getModelType() {
- return WireFormatJMSBytes.class;
- }
-
- public void resolve(WireFormatJMSBytes arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXML.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXML.java
deleted file mode 100644
index 668171fc9f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXML.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.binding.jms.wireformat.jmsbytesxml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-
-public class WireFormatJMSBytesXML implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsBytesXML");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXMLProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXMLProcessor.java
deleted file mode 100644
index 105aed270a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytesxml/WireFormatJMSBytesXMLProcessor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-public class WireFormatJMSBytesXMLProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSBytesXML> {
-
- public QName getArtifactType() {
- return WireFormatJMSBytesXML.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSBytesXMLProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSBytesXML read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSBytesXML wireFormat = new WireFormatJMSBytesXML();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSBytesXML wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSBytesXML> getModelType() {
- return WireFormatJMSBytesXML.class;
- }
-
- public void resolve(WireFormatJMSBytesXML arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java
deleted file mode 100644
index 8cca30a8ca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefault.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefault implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsdefault");
-
- public static final String WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR = "sendFormat";
-
- public static final String WIRE_FORMAT_JMS_DEFAULT_TEXT_FORMAT_VAL = "text";
- public static final String WIRE_FORMAT_JMS_DEFAULT_BYTES_FORMAT_VAL = "bytes";
-
- //default is to use a javax.jms.BytesMessage
- private boolean useBytesMessage = true;
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- @Override
- public boolean equals(Object obj) {
- return this.getClass() == obj.getClass();
- }
-
- public void setUseBytesMessage(boolean useBytesMessage) {
- this.useBytesMessage = useBytesMessage;
- }
-
- public boolean isUseBytesMessage() {
- return useBytesMessage;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProcessor.java
deleted file mode 100644
index 1c3f666577..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsdefault/WireFormatJMSDefaultProcessor.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.binding.jms.wireformat.jmsdefault;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSDefaultProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSDefault> {
-
- public QName getArtifactType() {
- return WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public WireFormatJMSDefaultProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- public WireFormatJMSDefault read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSDefault wireFormat = new WireFormatJMSDefault();
-
- String sendFormat = reader.getAttributeValue(null, WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR);
- if (sendFormat != null && sendFormat.length() > 0) {
- if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_TEXT_FORMAT_VAL.equalsIgnoreCase(sendFormat)) {
- wireFormat.setUseBytesMessage(false);
- }else if (WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_BYTES_FORMAT_VAL.equalsIgnoreCase(sendFormat)) {
- wireFormat.setUseBytesMessage(true);
- }else{
- throw new ContributionReadException(WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_QNAME.toString() +" " +sendFormat + " is not a valid attribute value for " +
- WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR);
- }
- }
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSDefault wireFormat, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix, getArtifactType().getLocalPart(), getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if (wireFormat.isUseBytesMessage()) {
- writer.writeAttribute(WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR, WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_BYTES_FORMAT_VAL);
- } else {
- writer.writeAttribute(WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_FORMAT_ATTR, WireFormatJMSDefault.WIRE_FORMAT_JMS_DEFAULT_TEXT_FORMAT_VAL);
- }
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSDefault> getModelType() {
- return WireFormatJMSDefault.class;
- }
-
- public void resolve(WireFormatJMSDefault arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java
deleted file mode 100644
index a485d2b5ec..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmsobject;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObject implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsObject");
-
- public static final String WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR = "wrapSingle";
-
- private boolean wrappedSingleInput = false;
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public void setWrappedSingleInput(boolean wrappedSingleInput) {
- this.wrappedSingleInput = wrappedSingleInput;
- }
-
- public boolean isWrappedSingleInput() {
- return wrappedSingleInput;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java
deleted file mode 100644
index 62b2a91d62..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.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.binding.jms.wireformat.jmsobject;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSObject> {
-
- public QName getArtifactType() {
- return WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSObjectProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSObject read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSObject wireFormat = new WireFormatJMSObject();
-
- String wrappedSingleInput = reader.getAttributeValue(null, WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR);
- if (wrappedSingleInput != null && wrappedSingleInput.length() > 0) {
- if ("true".equalsIgnoreCase(wrappedSingleInput)) {
- wireFormat.setWrappedSingleInput(true);
- } else if ("false".equalsIgnoreCase(wrappedSingleInput)) {
- wireFormat.setWrappedSingleInput(false);
- } else {
- throw new ContributionReadException(WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME.toString() + ": " + wrappedSingleInput +
- " is not a valid attribute value for " + WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR);
- }
- }
- return wireFormat;
- }
-
- public void write(WireFormatJMSObject wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeAttribute(WireFormatJMSObject.WIRE_FORMAT_JMS_OBJECT_WRAP_SINGLE_ATTR, String.valueOf(wireFormat.isWrappedSingleInput()));
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSObject> getModelType() {
- return WireFormatJMSObject.class;
- }
-
- public void resolve(WireFormatJMSObject arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java
deleted file mode 100644
index fff33df1f4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.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.binding.jms.wireformat.jmstext;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSText implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsText");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java
deleted file mode 100644
index 9b675df290..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstext;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSText> {
-
- public QName getArtifactType() {
- return WireFormatJMSText.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSTextProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSText read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSText wireFormat = new WireFormatJMSText();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSText wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSText> getModelType() {
- return WireFormatJMSText.class;
- }
-
- public void resolve(WireFormatJMSText arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java
deleted file mode 100644
index 23a53b9d96..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXML implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsTextXML");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- @Override
- public boolean equals(Object obj) {
- return this.getClass() == obj.getClass();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java b/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java
deleted file mode 100644
index 8248fc771a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSTextXML> {
-
- public QName getArtifactType() {
- return WireFormatJMSTextXML.WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public WireFormatJMSTextXMLProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSTextXML read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSTextXML wireFormat = new WireFormatJMSTextXML();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSTextXML wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSTextXML> getModelType() {
- return WireFormatJMSTextXML.class;
- }
-
- public void resolve(WireFormatJMSTextXML arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 05f9f377ba..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.jms.impl.JMSBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.jms,model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
-org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefaultProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsdefault,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsdefault.WireFormatJMSDefault
-org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXMLProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsTextXML,model=org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytesProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsBytes,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXMLProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsBytesXML,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytesxml.WireFormatJMSBytesXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSTextProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsText,model=org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObjectProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsObject,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject
-org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#operationSelector.jmsdefault,model=org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault
-org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.OperationSelectorJMSUserPropProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#operationSelector.jmsUserProp,model=org.apache.tuscany.sca.binding.jms.operationselector.jmsuserprop.OperationSelectorJMSUserProp \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
deleted file mode 100644
index 9361bb0e3c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-DoesntProcessOperationProperties = JMS Binding doesn't process operationProperties yet
-DoesntProcessHeaders = JMS Binding doesn't process headers yet
-DoesntProcessResourceAdapter = JMS Binding doesn't process resourceAdapter yet
-DoesntProcessResponseConnectionFactory = JMS Binding doesn't process response connectionFactory yet
-DoesntProcessResponseActivationSpec = JMS Binding doesn't process response activationSpec yet
-DoesntProcessResponseDestinationType = JMS Binding doesn't process response destination type yet
-DoesntProcessActivationSpec = JMS Binding doesn't process activationSpec yet
-DoesntProcessDestinationType = JMS Binding doesn't process destination type yet
-MissingConnectionFactoryName = Missing ConnectionFactory Name
-MissingResponseConnectionFactory = Missing response connectionFactory name
-InvalidResponseDestinationType = Invalid response destination type: {0}
-InvalidDestinationType = Invalid destination type: {0}
-MissingActivationSpecName = Missing ActivationSpec Name
-MissingResponseActivationSpec = Missing response ActivationSpec name
-UnknownTokenInURI = Unknown token {0} in uri: {1}
-MustStartWithSchema = URI must start with the scheme 'jms:' for uri: {0}
-InvalidCorrelationScheme = Invalid correlationScheme: {0}
-UnexpectedElement = Incomplete binding.jms definition found unexpected element: {0}
-UnexpectedResponseElement = Incomplete binding.jms/response definition found unexpected element: {0}
-InvalidJMSDeliveryMode = Invalid JMSDeliveryMode: {0}
-InvalidJMSPriority = Invalid JMSPriority: {0}
-MissingJMSOperationPropertyName = Missing JMSOperationProperty Name
-InvalidOPJMSDeliveryMode = Invalid OPJMSDeliveryMode: {0}
-InvalidOPJMSPriority = Invalid OPJMSPriority: {0}
-DestinationQueueContradiction = Destination type queue contradicts connection factory name: {0}
-DestinationTopicContradiction = Destination type topic contradicts connection factory name: {0}
-ConnectionFactoryActivationSpecContradiction = Connection factory \"{0}\" and activation specification \"{0}\" are mutually exclusive
-ResponseAttrElement = Response connection \"{0}\" and response element \"{1}\" are mutually exclusive
-BindingNotFound = {0} refers to a binding definition {1} which is not found
-DuplicateOperationProperties = Must not use both operationProperties attribute and operationProperties element
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java b/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
deleted file mode 100644
index e05f31da1b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
+++ /dev/null
@@ -1,783 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.impl;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-
-/**
- * Tests for JMS binding xml
- */
-public class JMSBindingProcessorTestCase extends TestCase {
- // Note: If you are adding new JMS binding read test cases,
- // consider adding a similar test case to JMSBindingProcessorWriteTestCase.
- public static final String COMPOSITE =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" />"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String HEADERS1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers JMSType=\"myType\" JMSCorrelationID=\"myCorrelId\" JMSDeliveryMode=\"PERSISTENT\" JMSTimeToLive=\"54321\" JMSPriority=\"5\">"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String HEADERS_INVALID_PRIORITY =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers JMSType=\"myType\" JMSCorrelationID=\"myCorrelId\" JMSDeliveryMode=\"PERSISTENT\" JMSTimeToLive=\"54321\" JMSPriority=\"medium\">"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers>"
- + " <property name=\"p1\">bla</property>"
- + " <property name=\"intProp\" type=\"int\">42</property>"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " <headers JMSType=\"op1Type\" >"
- + " <property name=\"p1\">bla</property>"
- + " <property name=\"intProp\" type=\"int\">42</property>"
- + " </headers>"
- + " </operationProperties >"
- + " <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\" >"
- + " <headers JMSType=\"op2Type\">"
- + " <property name=\"p2\">op2bla</property>"
- + " <property name=\"intProp\" type=\"int\">77</property>"
- + " </headers>"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_NAMES_NO_PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " </operationProperties >"
- + " <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\" >"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String SELECTOR =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <SubscriptionHeaders JMSSelector=\"prop1 = 2\" />"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String COMPOSITE_INVALID_URI =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"invalidjms:testQueue\" />"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- // Invalid: contains both a response attribute and a response element.
- public static final String COMPOSITE_INVALID_RESPONSE_ATTR_ELEMENT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" responseConnection=\"responseConnectionAttrName\">"
- + " <response>"
- + " <destination name=\"responseConnectionElementName\"/>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String DEST_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <destination name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </destination>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String CF_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <connectionFactory name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </connectionFactory>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String AS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <activationSpec name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </activationSpec>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_DEST_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <destination name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </destination>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_CF_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <connectionFactory name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </connectionFactory>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_AS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <activationSpec name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </activationSpec>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_PROPS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <operationProperties name=\"op1\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RES_ADPT_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <resourceAdapter name=\"r1\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </resourceAdapter>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String CONFIGURED_OPERATIONS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " </operationProperties >"
- + " <operation name=\"op1\" requires=\"IntentOne IntentTwo\"/>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String WIRE_FORMAT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <response>"
- + " <destination name=\"responseConnectionElementName\"/>"
- + " <tuscany:wireFormat.jmsBytes/>"
- + " </response>"
- + " <tuscany:wireFormat.jmsObject/>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_PROP_NAME =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms operationProperties=\"foo\"/>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
-
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("testQueue", binding.getDestinationName());
- }
-
- public void testHeaders1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(HEADERS1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("myType", binding.getJMSType());
- assertEquals("myCorrelId", binding.getJMSCorrelationId());
- assertTrue(binding.isdeliveryModePersistent());
- assertEquals(54321, binding.getJMSTimeToLive().longValue());
- assertEquals(5, binding.getJMSPriority().intValue());
- }
-
- public void testProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("bla", binding.getProperty("p1"));
- assertEquals(42, ((Integer)binding.getProperty("intProp")).intValue());
- }
-
- public void testOpProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Map<String, Object> op1Props = binding.getOperationProperties("op1");
- assertEquals("op1Type", binding.getOperationJMSType("op1"));
- assertEquals("bla", op1Props.get("p1"));
- assertEquals(42, ((Integer)op1Props.get("intProp")).intValue());
-
- assertEquals("op2Type", binding.getOperationJMSType("op2"));
- Map<String, Object> op2Props = binding.getOperationProperties("op2");
- assertEquals("op2bla", op2Props.get("p2"));
- assertEquals(77, ((Integer)op2Props.get("intProp")).intValue());
- }
-
- public void testSubscriptionHeaders () throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(SELECTOR));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- assertEquals("prop1 = 2", binding.getJMSSelector());
- }
-
- /** Test various parsing validation requirements. */
- public void testParsingValidationErrors1() throws Exception {
- // Composite with malformed URI.
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID_URI));
-
- try {
- Composite composite = (Composite)staxProcessor.read(reader);
- } catch(Exception e) {
- // JMSBindingExceptions are expected with invalid composite.
- if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) )
- throw e;
- // Do assertion to make sure test registers results.
- assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) );
- }
- }
-
- public void testParsingValidationErrors2() throws Exception {
- // Composite with invalid priority
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(HEADERS_INVALID_PRIORITY));
-
- try {
- Composite composite = (Composite)staxProcessor.read(reader);
- } catch(Exception e) {
- // JMSBindingExceptions are expected with invalid composite.
- if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) )
- throw e;
- // Do assertion to make sure test registers results.
- assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) );
- return;
- }
- }
-
- /** Test various model validation requirements. */
- public void testValidationErrors1() throws Exception {
- // Composite with response connection attr and element.
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID_RESPONSE_ATTR_ELEMENT));
-
- try {
- Composite composite = (Composite)staxProcessor.read(reader);
- } catch(Exception e) {
- // JMSBindingExceptions are expected with invalid composite.
- if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) )
- throw e;
- // Do assertion to make sure test registers results.
- assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) );
- }
- }
-
- public void testDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(DEST_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getDestinationProperties());
- assertEquals(2, binding.getDestinationProperties().size());
- BindingProperty bp = binding.getDestinationProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getDestinationProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CF_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getConnectionFactoryProperties());
- assertEquals(2, binding.getConnectionFactoryProperties().size());
- BindingProperty bp = binding.getConnectionFactoryProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getConnectionFactoryProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(AS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getActivationSpecProperties());
- assertEquals(2, binding.getActivationSpecProperties().size());
- BindingProperty bp = binding.getActivationSpecProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getActivationSpecProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_DEST_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseDestinationProperties());
- assertEquals(2, binding.getResponseDestinationProperties().size());
- BindingProperty bp = binding.getResponseDestinationProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseDestinationProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_CF_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseConnectionFactoryProperties());
- assertEquals(2, binding.getResponseConnectionFactoryProperties().size());
- BindingProperty bp = binding.getResponseConnectionFactoryProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseConnectionFactoryProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_AS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseActivationSpecProperties());
- assertEquals(2, binding.getResponseActivationSpecProperties().size());
- BindingProperty bp = binding.getResponseActivationSpecProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseActivationSpecProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testOperationPropertiesProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getOperationPropertiesProperties("op1"));
- assertEquals(2, binding.getOperationPropertiesProperties("op1").size());
- BindingProperty bp = binding.getOperationPropertiesProperties("op1").get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getOperationPropertiesProperties("op1").get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResouceAdapterProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RES_ADPT_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("r1", binding.getResourceAdapterName());
- assertNotNull(binding.getResourceAdapterProperties());
- assertEquals(2, binding.getResourceAdapterProperties().size());
- BindingProperty bp = binding.getResourceAdapterProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResourceAdapterProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * public Object getOperationProperty(String opName, String propName );
- * @throws Exception
- */
- public void testOpProperties2() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Set<String> opNames = binding.getOperationNames();
- assertEquals( 2, opNames.size() );
- // Recall that order is not guaranteed iterating over a set.
- for (Iterator<String> it=opNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
- assertTrue( opName.equals( "op1") || opName.equals( "op2"));
- }
-
- Object value = binding.getOperationProperty( "op1", "p1" );
- assertEquals("bla", value);
- value = binding.getOperationProperty( "op1", "intProp" );
- assertEquals(42, ((Integer)value).intValue());
-
- value = binding.getOperationProperty( "op2", "p2" );
- assertEquals("op2bla", value);
- value = binding.getOperationProperty( "op2", "intProp" );
- assertEquals(77, ((Integer)value).intValue());
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * Provides no optional properties or sub elements
- * @throws Exception
- */
- public void testOpProperties3() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_NAMES_NO_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Set<String> opNames = binding.getOperationNames();
- assertEquals( 2, opNames.size() );
- // Recall that order is not guaranteed iterating over a set.
- for (Iterator<String> it=opNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
- assertTrue( opName.equals( "op1") || opName.equals( "op2"));
- }
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * Provides no optional properties or sub elements
- * @throws Exception
- */
- public void testConfiguredOperations1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CONFIGURED_OPERATIONS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- OperationsConfigurator opConfig = ((OperationsConfigurator)binding);
- assertEquals(opConfig.getConfiguredOperations().get(0).getRequiredIntents().size(), 2);
- }
-
- /**
- * Tests the APIs:
- * public WireFormat getRequstWireFormat();
- * public WireFormat getResponseWireFormat();
- *
- * @throws Exception
- */
- public void testWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(WIRE_FORMAT));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- WireFormat requestWireFormat = binding.getRequestWireFormat();
- assertEquals(WireFormatJMSObject.class, requestWireFormat.getClass());
-
- WireFormat responseWireFormat = binding.getResponseWireFormat();
- assertEquals(WireFormatJMSBytes.class, responseWireFormat.getClass());
- }
-
- public void testOpPropertiesName() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROP_NAME));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals( "foo", binding.getOperationPropertiesName().getLocalPart() );
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java b/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java
deleted file mode 100644
index d3efdfb606..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jms.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-
-/**
- * Tests for JMS binding XML writes.
- * In general, for each JMS binding XML read test case, there
- * is a write test case.
- */
-public class JMSBindingProcessorWriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- public static final String DEFAULT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <destination name=\"AAA\">"
- + " <property name=\"AAAProp\" type=\"string\"/>"
- + " </destination>"
- + " <connectionFactory name=\"ABC\"/>"
- + " <response/>"
- + " <headers/>"
- + " <resourceAdapter name=\"GHI\"/>"
- + " <operationProperties name=\"JKL\">"
- + " </operationProperties>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.COMPOSITE));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2);
- }
-
- public void testHeaders1() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.HEADERS1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2 );
- }
-
- public void testProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.PROPERTIES1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2 );
- }
-
- public void testOpProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.OP_PROPERTIES1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testSubscriptionHeaders() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.SELECTOR));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.DEST_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.CF_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.AS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_DEST_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_CF_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_AS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testOperationPropertiesProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.OP_PROPS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResouceAdapterProperties() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RES_ADPT_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testConfiguredOperations() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.CONFIGURED_OPERATIONS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testWireFormat() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.WIRE_FORMAT));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- // TUSCANY-3120
- // Checking we don't write out values unless the use has specified them on input
- public void testDefault() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(DEFAULT));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- System.out.println(bos.toString());
- assertEquals(bos.toString(),
- "<?xml version=\'1.0\' encoding=\'UTF-8\'?>" +
- "<composite targetNamespace=\"http://binding-jms\" name=\"binding-jms\" xmlns=\"http://www.osoa.org/xmlns/sca/1.0\">" +
- "<component name=\"HelloWorldComponent\">" +
- "<service name=\"HelloWorldService\">" +
- "<binding.jms><operationProperties name=\"JKL\" /> " +
- "<destination name=\"AAA\">" +
- "<property name=\"AAAProp\" type=\"string\"></property>" +
- "</destination> " +
- "<connectionFactory name=\"ABC\" /> "+
- "<resourceAdapter name=\"GHI\" /> " +
- "</binding.jms>" +
- "</service>" +
- "</component>" +
- "</composite>");
- }
-
- public void testOperationPropertiesName() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.OP_PROP_NAME));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals("foo", binding2.getOperationPropertiesName().getLocalPart());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/LICENSE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/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-java-1.5.1/modules/binding-jsonrpc-js-dojo/NOTICE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/pom.xml b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/pom.xml
deleted file mode 100644
index 042425b3ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/pom.xml
+++ /dev/null
@@ -1,74 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-jsonrpc-js-dojo</artifactId>
- <name>Apache Tuscany SCA JSON-RPC Binding JavaScript using Dojo</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-web-javascript</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jsonrpc-js</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jsonrpc.js*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java
deleted file mode 100644
index 4fe32cff6d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc.js.dojo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-
-public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.jsonrpc");
-
- public Class<?> getModelType() {
- return JSONRPCBinding.class;
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public String getJavascriptProxyFile() {
- return null;
- }
-
- public InputStream getJavascriptProxyFileAsStream() throws IOException {
- return null;
- }
-
- public String createJavascriptReference(ComponentReference componentReference) throws IOException {
- Binding binding = componentReference.getBindings().get(0);
- URI targetURI = URI.create(binding.getURI());
- String targetPath = targetURI.getPath();
-
- return "dojo.rpc.JsonService(\"" + targetPath + "?smd\")";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
deleted file mode 100644
index 90a9e0a9d8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Proxy Factory
-org.apache.tuscany.sca.binding.jsonrpc.js.dojo.JSONRPCBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.jsonrpc,model=org.apache.tuscany.sca.binding.atom.AtomBinding,model=org.apache.tuscany.sca.binding.atom.JSONRPCBinding \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/LICENSE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/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-java-1.5.1/modules/binding-jsonrpc-js/NOTICE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/pom.xml b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/pom.xml
deleted file mode 100644
index b1fa844401..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/pom.xml
+++ /dev/null
@@ -1,74 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-jsonrpc-js</artifactId>
- <name>Apache Tuscany SCA JSON-RPC Binding JavaScript</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-web-javascript</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jsonrpc-js</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jsonrpc.js*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.java
deleted file mode 100644
index b0fd4d9556..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/JSONRPCBindingJavascriptProxyFactoryImpl.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.binding.jsonrpc.js;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-
-public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "binding.jsonrpc");
- private static final String JAVASCRIPT_FILE_NAME = "binding-jsonrpc.js";
-
- public Class<?> getModelType() {
- return JSONRPCBinding.class;
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public String getJavascriptProxyFile() {
- return JAVASCRIPT_FILE_NAME;
- }
-
- public InputStream getJavascriptProxyFileAsStream() throws IOException {
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(JAVASCRIPT_FILE_NAME);
- if (is == null) {
- throw new IOException("Could not find Javascript '" + JAVASCRIPT_FILE_NAME + "'" );
- }
-
- return is;
- }
-
- public String createJavascriptReference(ComponentReference componentReference) throws IOException {
- Binding binding = componentReference.getBindings().get(0);
- URI targetURI = URI.create(binding.getURI());
- String targetPath = targetURI.getPath();
-
- return "JSONRpcClient(\"" + targetPath + "\").Service";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
deleted file mode 100644
index 812afe568a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Proxy Factory
-org.apache.tuscany.sca.binding.jsonrpc.js.JSONRPCBindingJavascriptProxyFactoryImpl;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.jsonrpc,model=org.apache.tuscany.sca.binding.atom.AtomBinding,model=org.apache.tuscany.sca.binding.atom.JSONRPCBinding \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/binding-jsonrpc.js b/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/binding-jsonrpc.js
deleted file mode 100644
index ca3c2a8605..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-js/src/main/resources/binding-jsonrpc.js
+++ /dev/null
@@ -1,492 +0,0 @@
-/*
- * JSON-RPC JavaScript client
- *
- * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $
- *
- * Copyright (c) 2003-2004 Jan-Klaas Kollhof
- * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
- *
- * This code is based on Jan-Klaas' JavaScript o lait library (jsolait).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/*
- * Modifications for Apache Tuscany:
- * - JSONRpcClient_createMethod changed so callback is last arg
- */
-
-/* escape a character */
-
-escapeJSONChar =
-function escapeJSONChar(c)
-{
- if(c == "\"" || c == "\\") return "\\" + c;
- else if (c == "\b") return "\\b";
- else if (c == "\f") return "\\f";
- else if (c == "\n") return "\\n";
- else if (c == "\r") return "\\r";
- else if (c == "\t") return "\\t";
- var hex = c.charCodeAt(0).toString(16);
- if(hex.length == 1) return "\\u000" + hex;
- else if(hex.length == 2) return "\\u00" + hex;
- else if(hex.length == 3) return "\\u0" + hex;
- else return "\\u" + hex;
-};
-
-
-/* encode a string into JSON format */
-
-escapeJSONString =
-function escapeJSONString(s)
-{
- /* The following should suffice but Safari's regex is b0rken
- (doesn't support callback substitutions)
- return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g,
- escapeJSONChar) + "\"";
- */
-
- /* Rather inefficient way to do it */
- var parts = s.split("");
- for(var i=0; i < parts.length; i++) {
- var c =parts[i];
- if(c == '"' ||
- c == '\\' ||
- c.charCodeAt(0) < 32 ||
- c.charCodeAt(0) >= 128)
- parts[i] = escapeJSONChar(parts[i]);
- }
- return "\"" + parts.join("") + "\"";
-};
-
-
-/* Marshall objects to JSON format */
-
-toJSON = function toJSON(o)
-{
- if(o == null) {
- return "null";
- } else if(o.constructor == String) {
- return escapeJSONString(o);
- } else if(o.constructor == Number) {
- return o.toString();
- } else if(o.constructor == Boolean) {
- return o.toString();
- } else if(o.constructor == Date) {
- return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}';
- } else if(o.constructor == Array) {
- var v = [];
- for(var i = 0; i < o.length; i++) v.push(toJSON(o[i]));
- return "[" + v.join(", ") + "]";
- } else {
- var v = [];
- for(attr in o) {
- if(o[attr] == null) v.push("\"" + attr + "\": null");
- else if(typeof o[attr] == "function"); /* skip */
- else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
- }
- return "{" + v.join(", ") + "}";
- }
-};
-
-
-/* JSONRpcClient constructor */
-
-JSONRpcClient =
-function JSONRpcClient_ctor(serverURL, user, pass, objectID)
-{
- this.serverURL = serverURL;
- this.user = user;
- this.pass = pass;
- this.objectID = objectID;
-
- /* Add standard methods */
- if(this.objectID) {
- this._addMethods(["listMethods"]);
- var req = this._makeRequest("listMethods", []);
- } else {
- this._addMethods(["system.listMethods"]);
- var req = this._makeRequest("system.listMethods", []);
- }
- var m = this._sendRequest(req);
- this._addMethods(m);
-};
-
-
-/* JSONRpcCLient.Exception */
-
-JSONRpcClient.Exception =
-function JSONRpcClient_Exception_ctor(code, message, javaStack)
-{
- this.code = code;
- var name;
- if(javaStack) {
- this.javaStack = javaStack;
- var m = javaStack.match(/^([^:]*)/);
- if(m) name = m[0];
- }
- if(name) this.name = name;
- else this.name = "JSONRpcClientException";
- this.message = message;
-};
-
-JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490;
-JSONRpcClient.Exception.CODE_ERR_CLIENT = 550;
-JSONRpcClient.Exception.CODE_ERR_PARSE = 590;
-JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591;
-JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592;
-JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593;
-
-JSONRpcClient.Exception.prototype = new Error();
-
-JSONRpcClient.Exception.prototype.toString =
-function JSONRpcClient_Exception_toString(code, msg)
-{
- return this.name + ": " + this.message;
-};
-
-
-/* Default top level exception handler */
-
-JSONRpcClient.default_ex_handler =
-function JSONRpcClient_default_ex_handler(e) { alert(e); };
-
-
-/* Client settable variables */
-
-JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler;
-JSONRpcClient.profile_async = false;
-JSONRpcClient.max_req_active = 1;
-JSONRpcClient.requestId = 1;
-
-
-/* JSONRpcClient implementation */
-
-JSONRpcClient.prototype._createMethod =
-function JSONRpcClient_createMethod(methodName)
-{
- var fn=function()
- {
- var args = [];
- var callback = null;
- for(var i=0;i<arguments.length;i++) args.push(arguments[i]);
-
-/* TUSCANY change callback to be last arg instead of first to match binding.ajax
- if(typeof args[0] == "function") callback = args.shift();
-*/
- if(typeof args[arguments.length-1] == "function") callback = args.pop();
-
- var req = fn.client._makeRequest.call(fn.client, fn.methodName,
- args, callback);
- if(callback == null) {
- return fn.client._sendRequest.call(fn.client, req);
- } else {
- JSONRpcClient.async_requests.push(req);
- JSONRpcClient.kick_async();
- return req.requestId;
- }
- };
- fn.client = this;
- fn.methodName = methodName;
- return fn;
-};
-
-JSONRpcClient.prototype._addMethods =
-function JSONRpcClient_addMethods(methodNames)
-{
- for(var i=0; i<methodNames.length; i++) {
- var obj = this;
- var names = methodNames[i].split(".");
- for(var n=0; n<names.length-1; n++) {
- var name = names[n];
- if(obj[name]) {
- obj = obj[name];
- } else {
- obj[name] = new Object();
- obj = obj[name];
- }
- }
- var name = names[names.length-1];
- if(!obj[name]) {
- var method = this._createMethod(methodNames[i]);
- obj[name] = method;
- }
- }
-};
-
-JSONRpcClient._getCharsetFromHeaders =
-function JSONRpcClient_getCharsetFromHeaders(http)
-{
- try {
- var contentType = http.getResponseHeader("Content-type");
- var parts = contentType.split(/\s*;\s*/);
- for(var i =0; i < parts.length; i++) {
- if(parts[i].substring(0, 8) == "charset=")
- return parts[i].substring(8, parts[i].length);
- }
- } catch (e) {}
- return "UTF-8"; /* default */
-};
-
-/* Async queue globals */
-JSONRpcClient.async_requests = [];
-JSONRpcClient.async_inflight = {};
-JSONRpcClient.async_responses = [];
-JSONRpcClient.async_timeout = null;
-JSONRpcClient.num_req_active = 0;
-
-JSONRpcClient._async_handler =
-function JSONRpcClient_async_handler()
-{
- JSONRpcClient.async_timeout = null;
-
- while(JSONRpcClient.async_responses.length > 0) {
- var res = JSONRpcClient.async_responses.shift();
- if(res.canceled) continue;
- if(res.profile) res.profile.dispatch = new Date();
- try {
- res.cb(res.result, res.ex, res.profile);
- } catch(e) {
- JSONRpcClient.toplevel_ex_handler(e);
- }
- }
-
- while(JSONRpcClient.async_requests.length > 0 &&
- JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) {
- var req = JSONRpcClient.async_requests.shift();
- if(req.canceled) continue;
- req.client._sendRequest.call(req.client, req);
- }
-};
-
-JSONRpcClient.kick_async =
-function JSONRpcClient_kick_async()
-{
- if(JSONRpcClient.async_timeout == null)
- JSONRpcClient.async_timeout =
- setTimeout(JSONRpcClient._async_handler, 0);
-};
-
-JSONRpcClient.cancelRequest =
-function JSONRpcClient_cancelRequest(requestId)
-{
- /* If it is in flight then mark it as canceled in the inflight map
- and the XMLHttpRequest callback will discard the reply. */
- if(JSONRpcClient.async_inflight[requestId]) {
- JSONRpcClient.async_inflight[requestId].canceled = true;
- return true;
- }
-
- /* If its not in flight yet then we can just mark it as canceled in
- the the request queue and it will get discarded before being sent. */
- for(var i in JSONRpcClient.async_requests) {
- if(JSONRpcClient.async_requests[i].requestId == requestId) {
- JSONRpcClient.async_requests[i].canceled = true;
- return true;
- }
- }
-
- /* It may have returned from the network and be waiting for its callback
- to be dispatched, so mark it as canceled in the response queue
- and the response will get discarded before calling the callback. */
- for(var i in JSONRpcClient.async_responses) {
- if(JSONRpcClient.async_responses[i].requestId == requestId) {
- JSONRpcClient.async_responses[i].canceled = true;
- return true;
- }
- }
-
- return false;
-};
-
-JSONRpcClient.prototype._makeRequest =
-function JSONRpcClient_makeRequest(methodName, args, cb)
-{
- var req = {};
- req.client = this;
- req.requestId = JSONRpcClient.requestId++;
-
- var obj = {};
- obj.id = req.requestId;
- if (this.objectID)
- obj.method = ".obj#" + this.objectID + "." + methodName;
- else
- obj.method = methodName;
- obj.params = args;
-
- if (cb) req.cb = cb;
- if (JSONRpcClient.profile_async)
- req.profile = { "submit": new Date() };
- req.data = toJSON(obj);
-
- return req;
-};
-
-JSONRpcClient.prototype._sendRequest =
-function JSONRpcClient_sendRequest(req)
-{
- if(req.profile) req.profile.start = new Date();
-
- /* Get free http object from the pool */
- var http = JSONRpcClient.poolGetHTTPRequest();
- JSONRpcClient.num_req_active++;
-
- /* Send the request */
- if (typeof(this.user) == "undefined") {
- http.open("POST", this.serverURL, (req.cb != null));
- } else {
- http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass);
- }
-
- /* setRequestHeader is missing in Opera 8 Beta */
- try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {}
-
- /* Construct call back if we have one */
- if(req.cb) {
- var self = this;
- http.onreadystatechange = function() {
- if(http.readyState == 4) {
- http.onreadystatechange = function () {};
- var res = { "cb": req.cb, "result": null, "ex": null};
- if (req.profile) {
- res.profile = req.profile;
- res.profile.end = new Date();
- }
- try { res.result = self._handleResponse(http); }
- catch(e) { res.ex = e; }
- if(!JSONRpcClient.async_inflight[req.requestId].canceled)
- JSONRpcClient.async_responses.push(res);
- delete JSONRpcClient.async_inflight[req.requestId];
- JSONRpcClient.kick_async();
- }
- };
- } else {
- http.onreadystatechange = function() {};
- }
-
- JSONRpcClient.async_inflight[req.requestId] = req;
-
- try {
- http.send(req.data);
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- if(!req.cb) return this._handleResponse(http);
-};
-
-JSONRpcClient.prototype._handleResponse =
-function JSONRpcClient_handleResponse(http)
-{
- /* Get the charset */
- if(!this.charset) {
- this.charset = JSONRpcClient._getCharsetFromHeaders(http);
- }
-
- /* Get request results */
- var status, statusText, data;
- try {
- status = http.status;
- statusText = http.statusText;
- data = http.responseText;
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- JSONRpcClient.kick_async();
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- /* Return http object to the pool; */
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
-
- /* Unmarshall the response */
- if(status != 200) {
- throw new JSONRpcClient.Exception(status, statusText);
- }
- var obj;
- try {
- eval("obj = " + data);
- } catch(e) {
- throw new JSONRpcClient.Exception(550, "error parsing result");
- }
- if(obj.error)
- throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg,
- obj.error.trace);
- var res = obj.result;
-
- /* Handle CallableProxy */
- if(res && res.objectID && res.JSONRPCType == "CallableReference")
- return new JSONRpcClient(this.serverURL, this.user,
- this.pass, res.objectID);
-
- return res;
-};
-
-
-/* XMLHttpRequest wrapper code */
-
-/* XMLHttpRequest pool globals */
-JSONRpcClient.http_spare = [];
-JSONRpcClient.http_max_spare = 8;
-
-JSONRpcClient.poolGetHTTPRequest =
-function JSONRpcClient_pool_getHTTPRequest()
-{
- if(JSONRpcClient.http_spare.length > 0) {
- return JSONRpcClient.http_spare.pop();
- }
- return JSONRpcClient.getHTTPRequest();
-};
-
-JSONRpcClient.poolReturnHTTPRequest =
-function JSONRpcClient_poolReturnHTTPRequest(http)
-{
- if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare)
- delete http;
- else
- JSONRpcClient.http_spare.push(http);
-};
-
-JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
- "MSXML2.XMLHTTP.4.0",
- "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP",
- "Microsoft.XMLHTTP" ];
-
-JSONRpcClient.getHTTPRequest =
-function JSONRpcClient_getHTTPRequest()
-{
- /* Mozilla XMLHttpRequest */
- try {
- JSONRpcClient.httpObjectName = "XMLHttpRequest";
- return new XMLHttpRequest();
- } catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) {
- try {
- JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i];
- return new ActiveXObject(JSONRpcClient.msxmlNames[i]);
- } catch (e) {}
- }
-
- /* None found */
- JSONRpcClient.httpObjectName = null;
- throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object");
-};
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/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-java-1.5.1/modules/binding-jsonrpc-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/pom.xml
deleted file mode 100644
index 85e80d9809..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/pom.xml
+++ /dev/null
@@ -1,164 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <name>Apache Tuscany SCA JSON-RPC Binding Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-json</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.metaparadigm</groupId>
- <artifactId>json-rpc</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>httpunit</groupId>
- <artifactId>httpunit</artifactId>
- <version>1.6.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jsonrpc.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>
- !org.apache.tuscany.sca.binding.jsonrpc,
- org.apache.tuscany.sca.binding.jsonrpc*
- </Export-Package>
- <Import-Package>
- org.apache.tuscany.sca.assembly.xml,
- org.apache.tuscany.sca.binding.jsonrpc,
- *
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.java
deleted file mode 100644
index a9fff462fa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingInvoker.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.binding.jsonrpc.provider;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Invoker for the JSONRPC Binding
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBindingInvoker implements Invoker {
- Operation operation;
- String uri;
-
- public JSONRPCBindingInvoker(Operation operation, String uri) {
- this.operation = operation;
- this.uri = uri;
- }
-
- public Message invoke(Message msg) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
deleted file mode 100644
index 245eade7ad..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCBindingProviderFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc.provider;
-
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * JSON-RPC Provider Factory
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBindingProviderFactory implements BindingProviderFactory<JSONRPCBinding> {
-
- private MessageFactory messageFactory;
- private ServletHost servletHost;
-
- public JSONRPCBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- JSONRPCBinding binding) {
-
- return new JSONRPCReferenceBindingProvider(component, reference, binding);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- JSONRPCBinding binding) {
- return new JSONRPCServiceBindingProvider(component, service, binding, messageFactory, servletHost);
- }
-
- public Class<JSONRPCBinding> getModelType() {
- return JSONRPCBinding.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
deleted file mode 100644
index e2528f59e5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCReferenceBindingProvider.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc.provider;
-
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * Implementation of the JSONRPC Binding Provider for References
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCReferenceBindingProvider implements ReferenceBindingProvider {
-
- private RuntimeComponentReference reference;
- private JSONRPCBinding binding;
-
- public JSONRPCReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- JSONRPCBinding binding) {
- this.reference = reference;
- this.binding = binding;
-
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public Invoker createInvoker(Operation operation) {
- return new JSONRPCBindingInvoker(operation, binding.getURI());
- }
-
- public void start() {
- // TODO Auto-generated method stub
-
- }
-
- public void stop() {
- // TODO Auto-generated method stub
-
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
deleted file mode 100644
index 909bd7bc19..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceBindingProvider.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc.provider;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Implementation of the JSONRPC Binding Provider for Services
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCServiceBindingProvider implements ServiceBindingProvider {
-
- // Path to the scaDomain.js script
- // Note: this is the same as the Ajax binding to keep the client code
- // the same for clients using either the ajax or jsonrpc binding
- private static final String SCA_DOMAIN_SCRIPT = "/SCADomain/scaDomain.js";
-
- private MessageFactory messageFactory;
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private InterfaceContract serviceContract;
- private JSONRPCBinding binding;
- private ServletHost servletHost;
- private List<String> servletMappings = new ArrayList<String>();
- private String domainScriptMapping;
-
- public JSONRPCServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- JSONRPCBinding binding,
- MessageFactory messageFactory,
- ServletHost servletHost) {
- this.component = component;
- this.service = service;
- this.binding = binding;
- this.messageFactory = messageFactory;
- this.servletHost = servletHost;
-
- //clone the service contract to avoid databinding issues
- try {
- this.serviceContract = (InterfaceContract)service.getInterfaceContract().clone();
- } catch(CloneNotSupportedException e) {
- this.serviceContract = service.getInterfaceContract();
- }
-
- setDataBinding(serviceContract.getInterface());
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- // Set default databinding to json
- serviceContract.getInterface().resetDataBinding(JSONDataBinding.NAME);
-
- // Determine the service business interface
- Class<?> serviceInterface = getTargetJavaClass(serviceContract.getInterface());
-
- // Create a Java proxy to the target service
- Object proxy = component.getComponentContext().createSelfReference(serviceInterface, service).getService();
-
- // Create and register a Servlet for this service
- JSONRPCServiceServlet serviceServlet =
- new JSONRPCServiceServlet(messageFactory, binding, service, serviceContract, serviceInterface, proxy);
- String mapping = binding.getURI();
- if (!mapping.endsWith("/")) {
- mapping += "/";
- }
- if (!mapping.endsWith("*")) {
- mapping += "*";
- }
-
- servletHost.addServletMapping(mapping, serviceServlet);
- servletMappings.add(mapping);
- servletHost.addServletMapping(binding.getURI(), serviceServlet);
- servletMappings.add(binding.getURI());
-
- // Register service to scaDomain.js
- int port;
- URI uri = URI.create(servletHost.getURLMapping(binding.getURI()).toString());
- port = uri.getPort();
- if (port == -1) {
- port = servletHost.getDefaultPort();
- }
-
- // get the ScaDomainScriptServlet, if it doesn't yet exist create one
- // this uses removeServletMapping / addServletMapping as there is no getServletMapping facility
- domainScriptMapping = URI.create("http://localhost:" + port + SCA_DOMAIN_SCRIPT).toString();
- ScaDomainScriptServlet scaDomainServlet =
- (ScaDomainScriptServlet)servletHost.getServletMapping(domainScriptMapping);
- if (scaDomainServlet == null) {
- scaDomainServlet = new ScaDomainScriptServlet();
- servletHost.addServletMapping(domainScriptMapping, scaDomainServlet);
- }
-
- // Add this service to the SCA Domain Script Servlet
- scaDomainServlet.addService(binding.getName());
- }
-
- public void stop() {
-
- // Remove the Servlet mappings we've added
- for (String mapping: servletMappings) {
- servletHost.removeServletMapping(mapping);
- }
-
- // Unregister the service from the SCA Domain Script Servlet
- ScaDomainScriptServlet scaDomainServlet = (ScaDomainScriptServlet) servletHost.getServletMapping(domainScriptMapping);
- if (scaDomainServlet != null) {
- scaDomainServlet.removeService(binding.getName());
-
- // Remove the Servlet if there's no more registered services
- if (scaDomainServlet.getServiceNames().isEmpty()) {
- servletHost.removeServletMapping(domainScriptMapping);
- }
- }
-
- }
-
- private Class<?> getTargetJavaClass(Interface targetInterface) {
- // TODO: right now assume that the target is always a Java
- // Implementation. Need to figure out how to generate Java
- // Interface in cases where the target is not a Java Implementation
- return ((JavaInterface)targetInterface).getJavaClass();
- }
-
- private void setDataBinding(Interface interfaze) {
- List<Operation> operations = interfaze.getOperations();
- for (Operation operation : operations) {
- operation.setDataBinding(JSONDataBinding.NAME);
- DataType<List<DataType>> inputType = operation.getInputType();
- if (inputType != null) {
- List<DataType> logical = inputType.getLogical();
- for (DataType inArg : logical) {
- if (!SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
- inArg.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- DataType outputType = operation.getOutputType();
- if (outputType != null) {
- if (!SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
- outputType.setDataBinding(JSONDataBinding.NAME);
- }
- }
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
deleted file mode 100644
index a6ccd195ae..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JSONRPCServiceServlet.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jsonrpc.provider;
-
-import java.io.BufferedReader;
-import java.io.CharArrayWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.util.List;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.osoa.sca.ServiceRuntimeException;
-
-import com.metaparadigm.jsonrpc.JSONRPCBridge;
-import com.metaparadigm.jsonrpc.JSONRPCResult;
-import com.metaparadigm.jsonrpc.JSONRPCServlet;
-
-/**
- * Servlet that handles JSON-RPC requests invoking SCA services.
- *
- * There is an instance of this Servlet for each <binding.jsonrpc>
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCServiceServlet extends JSONRPCServlet {
- private static final long serialVersionUID = 1L;
-
- transient MessageFactory messageFactory;
-
- transient Binding binding;
- transient String serviceName;
- transient Object serviceInstance;
- transient RuntimeComponentService componentService;
- transient InterfaceContract serviceContract;
- transient Class<?> serviceInterface;
-
- public JSONRPCServiceServlet(MessageFactory messageFactory,
- Binding binding,
- RuntimeComponentService componentService,
- InterfaceContract serviceContract,
- Class<?> serviceInterface,
- Object serviceInstance) {
- this.messageFactory = messageFactory;
- this.binding = binding;
- this.serviceName = binding.getName();
- this.componentService = componentService;
- this.serviceContract = serviceContract;
- this.serviceInterface = serviceInterface;
- this.serviceInstance = serviceInstance;
- }
-
- /**
- * Override to do nothing as the JSONRPCServlet is setup by the
- * service method in this class.
- */
- @Override
- public void init(ServletConfig config) {
- }
-
- @Override
- public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
- if ("smd".equals(request.getQueryString())) {
- handleSMDRequest(request, response);
- } else {
- try {
- handleServiceRequest(request, response);
-
- } catch(RuntimeException re) {
- if (re.getCause() instanceof javax.security.auth.login.LoginException) {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"" + "ldap-realm" + "\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
- } finally {
- HttpSession session = request.getSession(false);
- if (session != null) {
- session.removeAttribute("JSONRPCBridge");
- }
- }
- }
- }
-
- private void handleServiceRequest(HttpServletRequest request, HttpServletResponse response) throws IOException {
- // Encode using UTF-8, although We are actually ASCII clean as
- // all unicode data is JSON escaped using backslash u. This is
- // less data efficient for foreign character sets but it is
- // needed to support naughty browsers such as Konqueror and Safari
- // which do not honour the charset set in the response
- response.setContentType("text/plain;charset=utf-8");
- OutputStream out = response.getOutputStream();
-
- // Decode using the charset in the request if it exists otherwise
- // use UTF-8 as this is what all browser implementations use.
- // The JSON-RPC-Java JavaScript client is ASCII clean so it
- // although here we can correctly handle data from other clients
- // that do not escape non ASCII data
- String charset = request.getCharacterEncoding();
- if (charset == null) {
- charset = "UTF-8";
- }
- BufferedReader in = new BufferedReader(new InputStreamReader(request.getInputStream(), charset));
-
- // Read the request
- CharArrayWriter data = new CharArrayWriter();
- char[] buf = new char[4096];
- int ret;
- while ((ret = in.read(buf, 0, 4096)) != -1) {
- data.write(buf, 0, ret);
- }
-
- JSONObject jsonReq = null;
- String method = null;
- try {
- jsonReq = new JSONObject(data.toString());
- method = jsonReq.getString("method");
- } catch (Exception e) {
- //FIXME Exceptions are not handled correctly here
- // They should be reported to the client JavaScript as proper
- // JavaScript exceptions.
- throw new RuntimeException("Unable to parse request", e);
- }
-
-
- // check if it's a system request
- // or a method invocation
- byte[] bout;
- if (method.startsWith("system.")) {
- bout = handleJSONRPCSystemInvocation(request, response, data.toString());
- } else {
- bout = handleJSONRPCMethodInvocation(request, response, jsonReq);
- }
-
- // Send response to client
- out.write(bout);
- out.flush();
- out.close();
- }
-
- /**
- * handles requests for the SMD descriptor for a service
- */
- protected void handleSMDRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, UnsupportedEncodingException {
- String serviceUrl = request.getRequestURL().toString();
- String smd = JavaToSmd.interfaceToSmd(serviceInterface, serviceUrl);
-
- response.setContentType("text/plain;charset=utf-8");
- OutputStream out = response.getOutputStream();
- byte[] bout = smd.getBytes("UTF-8");
- out.write(bout);
- out.flush();
- out.close();
- }
-
- protected byte[] handleJSONRPCSystemInvocation(HttpServletRequest request, HttpServletResponse response, String requestData) throws IOException,
- UnsupportedEncodingException {
- /*
- * Create a new bridge for every request to avoid all the problems with
- * JSON-RPC-Java storing the bridge in the session
- */
- HttpSession session = request.getSession();
-
- JSONRPCBridge jsonrpcBridge = new JSONRPCBridge();
- jsonrpcBridge.registerObject("Service", serviceInstance, serviceInterface);
- session.setAttribute("JSONRPCBridge", jsonrpcBridge);
-
- org.json.JSONObject jsonReq = null;
- com.metaparadigm.jsonrpc.JSONRPCResult jsonResp = null;
- try {
- jsonReq = new org.json.JSONObject(requestData);
- } catch (java.text.ParseException e) {
- throw new RuntimeException("Unable to parse request", e);
- }
-
- String method = jsonReq.getString("method");
- if ((method != null) && (method.indexOf('.') < 0)) {
- jsonReq.putOpt("method", "Service" + "." + method);
- }
-
- // invoke the request
- jsonResp = jsonrpcBridge.call(new Object[] {request}, jsonReq);
-
- return jsonResp.toString().getBytes("UTF-8");
- }
-
- protected byte[] handleJSONRPCMethodInvocation(HttpServletRequest request, HttpServletResponse response, JSONObject jsonReq) throws IOException,
- UnsupportedEncodingException {
-
- String method = null;
- Object[] args = null;
- Object id = null;
- try {
- // Extract the method
- method = jsonReq.getString("method");
- if ((method != null) && (method.indexOf('.') < 0)) {
- jsonReq.putOpt("method", "Service" + "." + method);
- }
-
- // Extract the arguments
- JSONArray array = jsonReq.getJSONArray("params");
- args = new Object[array.length()];
- for (int i = 0; i < args.length; i++) {
- args[i] = array.get(i);
- }
- id = jsonReq.get("id");
-
- } catch (Exception e) {
- throw new RuntimeException("Unable to find json method name", e);
- }
-
- // invoke the request
- RuntimeWire wire = componentService.getRuntimeWire(binding, serviceContract);
- Operation jsonOperation = findOperation(method);
- Object result = null;
-
-
- // Invoke the get operation on the service implementation
- Message requestMessage = messageFactory.createMessage();
- requestMessage.setOperation(jsonOperation);
-
- requestMessage.getHeaders().add(request);
-
- requestMessage.setBody(args);
-
- //result = wire.invoke(jsonOperation, args);
- Message responseMessage = null;
- try {
- responseMessage = wire.getInvocationChain(jsonOperation).getHeadInvoker().invoke(requestMessage);
- } catch (RuntimeException re) {
- if (re.getCause() instanceof javax.security.auth.login.LoginException) {
- throw re;
- } else {
- //some other exception
- JSONRPCResult errorResult = new JSONRPCResult(JSONRPCResult.CODE_REMOTE_EXCEPTION, id, re);
- return errorResult.toString().getBytes("UTF-8");
- }
- }
-
- if (!responseMessage.isFault()) {
- //successful execution of the invocation
- try {
- result = responseMessage.getBody();
- JSONObject jsonResponse = new JSONObject();
- jsonResponse.put("result", result);
- jsonResponse.putOpt("id", id);
- //get response to send to client
- return jsonResponse.toString().getBytes("UTF-8");
- } catch (Exception e) {
- throw new ServiceRuntimeException("Unable to create JSON response", e);
- }
- } else {
- //exception thrown while executing the invocation
- Throwable exception = (Throwable)responseMessage.getBody();
- JSONRPCResult errorResult = new JSONRPCResult(JSONRPCResult.CODE_REMOTE_EXCEPTION, id, exception );
- return errorResult.toString().getBytes("UTF-8");
- }
-
- }
-
- /**
- * Find the operation from the component service contract
- * @param componentService
- * @param method
- * @return
- */
- private Operation findOperation(String method) {
- if (method.contains(".")) {
- method = method.substring(method.lastIndexOf(".") + 1);
- }
-
- List<Operation> operations = serviceContract.getInterface().getOperations();
- //componentService.getBindingProvider(binding).getBindingInterfaceContract().getInterface().getOperations();
-
-
- Operation result = null;
- for (Operation o : operations) {
- if (o.getName().equalsIgnoreCase(method)) {
- result = o;
- break;
- }
- }
-
- return result;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JavaToSmd.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JavaToSmd.java
deleted file mode 100644
index 64339fda7b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JavaToSmd.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.binding.jsonrpc.provider;
-
-import java.lang.reflect.Method;
-
-/**
- * Utility class to create a Simple Method Description (SMD) descriptor
- * from a Java class. See http://dojo.jot.com/SMD.
- *
- * TODO: Change to work from the Tuscany Interface instead of a Java class
- *
- * @version $Rev$ $Date$
- */
-class JavaToSmd {
-
- static String interfaceToSmd(Class<?> klazz, String serviceUrl) {
- String name = klazz.getSimpleName();
- Method[] methods = klazz.getMethods();
-
- StringBuffer smdSb = new StringBuffer();
- smdSb.append("{\"SMDVersion\":\".1\",\"objectName\":\"" + name + "\",\"serviceType\":\"JSON-RPC\",\"serviceURL\":\""+ serviceUrl + "\",\"methods\":[");
- for (int i = 0; i < methods.length; i++) {
- if (i != 0) smdSb.append(",");
- Class<?>[] params = methods[i].getParameterTypes();
- smdSb.append("{\"name\":\""+methods[i].getName() + "\",\"parameters\":[");
- for (int j = 0; j < params.length; j++) {
- if (j != 0) smdSb.append(",");
- // right now Dojo doesn't look at the type value, so we'll default it to STRING
- // also, since we can't introspect the method parameter names we'll just create an incrementing parameter name
- smdSb.append("{\"name\":\"param" + j + "\",\"type\":\"STRING\"}");
- }
- smdSb.append("]}");
- }
- smdSb.append("]}");
-
- return smdSb.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/ScaDomainScriptServlet.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/ScaDomainScriptServlet.java
deleted file mode 100644
index 999588abf1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/ScaDomainScriptServlet.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.binding.jsonrpc.provider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * Servlet to handle requests for the scaDomain.js script.
- *
- * This script wrappers the JSON-RPC-Java jsonrpc.js script
- * adding in at the bottom the JavaScript to create and initialize
- * the variables representing the SCA services.
- *
- * @version $Rev$ $Date$
- */
-public class ScaDomainScriptServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
- protected transient List<String> serviceNames;
-
- public ScaDomainScriptServlet() {
- serviceNames = new ArrayList<String>();
- }
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
-
- ServletOutputStream os = response.getOutputStream();
-
- os.println();
- os.println("/* Apache Tuscany scaDomain.js Header */");
- os.println();
-
- writeJSONRPCJavaScript(os);
- writeScaDomainCode(os, request.getServletPath());
- }
-
- /**
- * Creates a JavaScript variable within the scaDomain script for each SCA service and
- * initializes its value with the JSON-RPC client to invoke the serverside service.
- */
- protected void writeScaDomainCode(ServletOutputStream out, String path) throws IOException {
- out.println();
- out.println("/* Apache Tuscany scaDomain.js Footer */");
- out.println();
- out.println("function scaDomain() {}");
-
- // remove the leading slash '/' character
- path = path.substring(1);
-
- for (String serviceName : serviceNames) {
- out.println();
-
- // A slight hack to make the service function available with a variable named 'serviceName'
- // to do that the JSONRpcClient is added to the scaDomain and then the service function is got from that
- out.println("scaDomain." + serviceName + " = " + "new JSONRpcClient(\"" + serviceName + "\");");
- out.println(serviceName + " = scaDomain." + serviceName + ".Service;");
- }
-
- out.println();
- out.println("/** End of Apache Tuscany scaDomain.js */");
- out.println();
- }
-
- /**
- * Reads the jsonrpc.js script from the classpath and adds its contents to the output stream.
- */
- protected void writeJSONRPCJavaScript(ServletOutputStream os) throws IOException {
- URL url = getClass().getResource("jsonrpc.js");
- InputStream is = url.openStream();
- int i;
- while ((i = is.read()) != -1) {
- os.write(i);
- }
- }
-
- public void addService(String serviceName) {
- serviceNames.add(serviceName);
- }
-
- public void removeService(String serviceName) {
- serviceNames.remove(serviceName);
- }
-
- public List<String> getServiceNames() {
- return serviceNames;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 4767358e7a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.jsonrpc.provider.JSONRPCBindingProviderFactory;model=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/provider/jsonrpc.js b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/provider/jsonrpc.js
deleted file mode 100644
index d837bab91c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/main/resources/org/apache/tuscany/sca/binding/jsonrpc/provider/jsonrpc.js
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * JSON-RPC JavaScript client
- *
- * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $
- *
- * Copyright (c) 2003-2004 Jan-Klaas Kollhof
- * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
- *
- * This code is based on Jan-Klaas' JavaScript o lait library (jsolait).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/*
- * Modifications for Apache Tuscany:
- * - JSONRpcClient_createMethod changed so callback is last arg
- */
-
-/* escape a character */
-
-escapeJSONChar =
-function escapeJSONChar(c)
-{
- if(c == "\"" || c == "\\") return "\\" + c;
- else if (c == "\b") return "\\b";
- else if (c == "\f") return "\\f";
- else if (c == "\n") return "\\n";
- else if (c == "\r") return "\\r";
- else if (c == "\t") return "\\t";
- var hex = c.charCodeAt(0).toString(16);
- if(hex.length == 1) return "\\u000" + hex;
- else if(hex.length == 2) return "\\u00" + hex;
- else if(hex.length == 3) return "\\u0" + hex;
- else return "\\u" + hex;
-};
-
-
-/* encode a string into JSON format */
-
-escapeJSONString =
-function escapeJSONString(s)
-{
- /* The following should suffice but Safari's regex is b0rken
- (doesn't support callback substitutions)
- return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g,
- escapeJSONChar) + "\"";
- */
-
- /* Rather inefficient way to do it */
- var parts = s.split("");
- for(var i=0; i < parts.length; i++) {
- var c =parts[i];
- if(c == '"' ||
- c == '\\' ||
- c.charCodeAt(0) < 32 ||
- c.charCodeAt(0) >= 128)
- parts[i] = escapeJSONChar(parts[i]);
- }
- return "\"" + parts.join("") + "\"";
-};
-
-
-/* Marshall objects to JSON format */
-
-toJSON = function toJSON(o)
-{
- if(o == null) {
- return "null";
- } else if(o.constructor == String) {
- return escapeJSONString(o);
- } else if(o.constructor == Number) {
- return o.toString();
- } else if(o.constructor == Boolean) {
- return o.toString();
- } else if(o.constructor == Date) {
- return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}';
- } else if(o.constructor == Array) {
- var v = [];
- for(var i = 0; i < o.length; i++) v.push(toJSON(o[i]));
- return "[" + v.join(", ") + "]";
- } else {
- var v = [];
- for(attr in o) {
- if(o[attr] == null) v.push("\"" + attr + "\": null");
- else if(typeof o[attr] == "function"); /* skip */
- else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
- }
- return "{" + v.join(", ") + "}";
- }
-};
-
-
-/* JSONRpcClient constructor */
-
-JSONRpcClient =
-function JSONRpcClient_ctor(serverURL, user, pass, objectID)
-{
- this.serverURL = serverURL;
- this.user = user;
- this.pass = pass;
- this.objectID = objectID;
-
- /* Add standard methods */
- if(this.objectID) {
- this._addMethods(["listMethods"]);
- var req = this._makeRequest("listMethods", []);
- } else {
- this._addMethods(["system.listMethods"]);
- var req = this._makeRequest("system.listMethods", []);
- }
- var m = this._sendRequest(req);
- this._addMethods(m);
-};
-
-
-/* JSONRpcCLient.Exception */
-
-JSONRpcClient.Exception =
-function JSONRpcClient_Exception_ctor(code, message, javaStack)
-{
- this.code = code;
- var name;
- if(javaStack) {
- this.javaStack = javaStack;
- var m = javaStack.match(/^([^:]*)/);
- if(m) name = m[0];
- }
- if(name) this.name = name;
- else this.name = "JSONRpcClientException";
- this.message = message;
-};
-
-JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490;
-JSONRpcClient.Exception.CODE_ERR_CLIENT = 550;
-JSONRpcClient.Exception.CODE_ERR_PARSE = 590;
-JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591;
-JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592;
-JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593;
-
-JSONRpcClient.Exception.prototype = new Error();
-
-JSONRpcClient.Exception.prototype.toString =
-function JSONRpcClient_Exception_toString(code, msg)
-{
- return this.name + ": " + this.message;
-};
-
-
-/* Default top level exception handler */
-
-JSONRpcClient.default_ex_handler =
-function JSONRpcClient_default_ex_handler(e) { alert(e); };
-
-
-/* Client settable variables */
-
-JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler;
-JSONRpcClient.profile_async = false;
-JSONRpcClient.max_req_active = 1;
-JSONRpcClient.requestId = 1;
-
-
-/* JSONRpcClient implementation */
-
-JSONRpcClient.prototype._createMethod =
-function JSONRpcClient_createMethod(methodName)
-{
- var fn=function()
- {
- var args = [];
- var callback = null;
- for(var i=0;i<arguments.length;i++) args.push(arguments[i]);
-
-/* TUSCANY change callback to be last arg instead of first to match binding.ajax
- if(typeof args[0] == "function") callback = args.shift();
-*/
- if(typeof args[arguments.length-1] == "function") callback = args.pop();
-
- var req = fn.client._makeRequest.call(fn.client, fn.methodName,
- args, callback);
- if(callback == null) {
- return fn.client._sendRequest.call(fn.client, req);
- } else {
- JSONRpcClient.async_requests.push(req);
- JSONRpcClient.kick_async();
- return req.requestId;
- }
- };
- fn.client = this;
- fn.methodName = methodName;
- return fn;
-};
-
-JSONRpcClient.prototype._addMethods =
-function JSONRpcClient_addMethods(methodNames)
-{
- for(var i=0; i<methodNames.length; i++) {
- var obj = this;
- var names = methodNames[i].split(".");
- for(var n=0; n<names.length-1; n++) {
- var name = names[n];
- if(obj[name]) {
- obj = obj[name];
- } else {
- obj[name] = new Object();
- obj = obj[name];
- }
- }
- var name = names[names.length-1];
- if(!obj[name]) {
- var method = this._createMethod(methodNames[i]);
- obj[name] = method;
- }
- }
-};
-
-JSONRpcClient._getCharsetFromHeaders =
-function JSONRpcClient_getCharsetFromHeaders(http)
-{
- try {
- var contentType = http.getResponseHeader("Content-type");
- var parts = contentType.split(/\s*;\s*/);
- for(var i =0; i < parts.length; i++) {
- if(parts[i].substring(0, 8) == "charset=")
- return parts[i].substring(8, parts[i].length);
- }
- } catch (e) {}
- return "UTF-8"; /* default */
-};
-
-/* Async queue globals */
-JSONRpcClient.async_requests = [];
-JSONRpcClient.async_inflight = {};
-JSONRpcClient.async_responses = [];
-JSONRpcClient.async_timeout = null;
-JSONRpcClient.num_req_active = 0;
-
-JSONRpcClient._async_handler =
-function JSONRpcClient_async_handler()
-{
- JSONRpcClient.async_timeout = null;
-
- while(JSONRpcClient.async_responses.length > 0) {
- var res = JSONRpcClient.async_responses.shift();
- if(res.canceled) continue;
- if(res.profile) res.profile.dispatch = new Date();
- try {
- res.cb(res.result, res.ex, res.profile);
- } catch(e) {
- JSONRpcClient.toplevel_ex_handler(e);
- }
- }
-
- while(JSONRpcClient.async_requests.length > 0 &&
- JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) {
- var req = JSONRpcClient.async_requests.shift();
- if(req.canceled) continue;
- req.client._sendRequest.call(req.client, req);
- }
-};
-
-JSONRpcClient.kick_async =
-function JSONRpcClient_kick_async()
-{
- if(JSONRpcClient.async_timeout == null)
- JSONRpcClient.async_timeout =
- setTimeout(JSONRpcClient._async_handler, 0);
-};
-
-JSONRpcClient.cancelRequest =
-function JSONRpcClient_cancelRequest(requestId)
-{
- /* If it is in flight then mark it as canceled in the inflight map
- and the XMLHttpRequest callback will discard the reply. */
- if(JSONRpcClient.async_inflight[requestId]) {
- JSONRpcClient.async_inflight[requestId].canceled = true;
- return true;
- }
-
- /* If its not in flight yet then we can just mark it as canceled in
- the the request queue and it will get discarded before being sent. */
- for(var i in JSONRpcClient.async_requests) {
- if(JSONRpcClient.async_requests[i].requestId == requestId) {
- JSONRpcClient.async_requests[i].canceled = true;
- return true;
- }
- }
-
- /* It may have returned from the network and be waiting for its callback
- to be dispatched, so mark it as canceled in the response queue
- and the response will get discarded before calling the callback. */
- for(var i in JSONRpcClient.async_responses) {
- if(JSONRpcClient.async_responses[i].requestId == requestId) {
- JSONRpcClient.async_responses[i].canceled = true;
- return true;
- }
- }
-
- return false;
-};
-
-JSONRpcClient.prototype._makeRequest =
-function JSONRpcClient_makeRequest(methodName, args, cb)
-{
- var req = {};
- req.client = this;
- req.requestId = JSONRpcClient.requestId++;
-
- var obj = {};
- obj.id = req.requestId;
- if (this.objectID)
- obj.method = ".obj#" + this.objectID + "." + methodName;
- else
- obj.method = methodName;
- obj.params = args;
-
- if (cb) req.cb = cb;
- if (JSONRpcClient.profile_async)
- req.profile = { "submit": new Date() };
- req.data = toJSON(obj);
-
- return req;
-};
-
-JSONRpcClient.prototype._sendRequest =
-function JSONRpcClient_sendRequest(req)
-{
- if(req.profile) req.profile.start = new Date();
-
- /* Get free http object from the pool */
- var http = JSONRpcClient.poolGetHTTPRequest();
- JSONRpcClient.num_req_active++;
-
- /* Send the request */
- if (typeof(this.user) == "undefined") {
- http.open("POST", this.serverURL, (req.cb != null));
- } else {
- http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass);
- }
-
- /* setRequestHeader is missing in Opera 8 Beta */
- try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {}
-
- /* Construct call back if we have one */
- if(req.cb) {
- var self = this;
- http.onreadystatechange = function() {
- if(http.readyState == 4) {
- http.onreadystatechange = function () {};
- var res = { "cb": req.cb, "result": null, "ex": null};
- if (req.profile) {
- res.profile = req.profile;
- res.profile.end = new Date();
- }
- try { res.result = self._handleResponse(http); }
- catch(e) { res.ex = e; }
- if(!JSONRpcClient.async_inflight[req.requestId].canceled)
- JSONRpcClient.async_responses.push(res);
- delete JSONRpcClient.async_inflight[req.requestId];
- JSONRpcClient.kick_async();
- }
- };
- } else {
- http.onreadystatechange = function() {};
- }
-
- JSONRpcClient.async_inflight[req.requestId] = req;
-
- try {
- http.send(req.data);
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- if(!req.cb) return this._handleResponse(http);
-};
-
-JSONRpcClient.prototype._handleResponse =
-function JSONRpcClient_handleResponse(http)
-{
- /* Get the charset */
- if(!this.charset) {
- this.charset = JSONRpcClient._getCharsetFromHeaders(http);
- }
-
- /* Get request results */
- var status, statusText, data;
- try {
- status = http.status;
- statusText = http.statusText;
- data = http.responseText;
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- JSONRpcClient.kick_async();
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- /* Return http object to the pool; */
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
-
- /* Unmarshall the response */
- if(status != 200) {
- throw new JSONRpcClient.Exception(status, statusText);
- }
- var obj;
- try {
- eval("obj = " + data);
- } catch(e) {
- throw new JSONRpcClient.Exception(550, "error parsing result");
- }
- if(obj.error)
- throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg,
- obj.error.trace);
- var res = obj.result;
-
- /* Handle CallableProxy */
- if(res && res.objectID && res.JSONRPCType == "CallableReference")
- return new JSONRpcClient(this.serverURL, this.user,
- this.pass, res.objectID);
-
- return res;
-};
-
-
-/* XMLHttpRequest wrapper code */
-
-/* XMLHttpRequest pool globals */
-JSONRpcClient.http_spare = [];
-JSONRpcClient.http_max_spare = 8;
-
-JSONRpcClient.poolGetHTTPRequest =
-function JSONRpcClient_pool_getHTTPRequest()
-{
- if(JSONRpcClient.http_spare.length > 0) {
- return JSONRpcClient.http_spare.pop();
- }
- return JSONRpcClient.getHTTPRequest();
-};
-
-JSONRpcClient.poolReturnHTTPRequest =
-function JSONRpcClient_poolReturnHTTPRequest(http)
-{
- if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare)
- delete http;
- else
- JSONRpcClient.http_spare.push(http);
-};
-
-JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
- "MSXML2.XMLHTTP.4.0",
- "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP",
- "Microsoft.XMLHTTP" ];
-
-JSONRpcClient.getHTTPRequest =
-function JSONRpcClient_getHTTPRequest()
-{
- /* Mozilla XMLHttpRequest */
- try {
- JSONRpcClient.httpObjectName = "XMLHttpRequest";
- return new XMLHttpRequest();
- } catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) {
- try {
- JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i];
- return new ActiveXObject(JSONRpcClient.msxmlNames[i]);
- } catch (e) {}
- }
-
- /* None found */
- JSONRpcClient.httpObjectName = null;
- throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object");
-};
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.java
deleted file mode 100644
index 4b159fb563..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/bean/TestBean.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 bean;
-
-public class TestBean {
- private String testString;
- private String[] testStringArray;
- private int testInt;
-
-
- public String getTestString() {
- return testString;
- }
-
- public void setTestString(String testString) {
- this.testString = testString;
- }
-
- public String[] getTestStringArray() {
- return testStringArray;
- }
-
- public void setStringArray(String[] stringArray) {
- this.testStringArray = stringArray;
- }
-
- public int getTestInt() {
- return testInt;
- }
-
- public void setTestInt(int testInt) {
- this.testInt = testInt;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
deleted file mode 100644
index 580af6cf31..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/Echo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package echo;
-
-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.osoa.sca.annotations.Remotable;
-
-import bean.TestBean;
-
-/**
- * Interface of our sample JSONRPC service.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Echo {
-
- String echo(String msg);
-
- void echoRuntimeException() throws RuntimeException;
-
- void echoBusinessException() throws EchoBusinessException;
-
- int echoInt(int param);
-
- boolean echoBoolean(boolean param);
-
- Map echoMap(HashMap map);
-
- TestBean echoBean(TestBean testBean);
-
- List echoList(ArrayList list);
-
- String [] echoArrayString(String[] stringArray);
-
- int [] echoArrayInt(int[] intArray);
-
- Set echoSet(HashSet set);
-
- void get\u03a9\u03bb\u03c0();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoBusinessException.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoBusinessException.java
deleted file mode 100644
index bf8c7d2c8a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoBusinessException.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 echo;
-
-public class EchoBusinessException extends Exception {
- private static final long serialVersionUID = 7234119326657905710L;
-
- public EchoBusinessException(String message)
- {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
deleted file mode 100644
index 2f4880286f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/echo/EchoComponentImpl.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package echo;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import bean.TestBean;
-
-/**
- * A simple client component that uses a reference with an JSONRPC binding.
- *
- * @version $Rev$ $Date$
- */
-public class EchoComponentImpl implements Echo {
-
- public String echo(String msg) {
- System.out.println("Echo: "+ msg);
- return "echo: " + msg;
- }
-
- public void echoBusinessException() throws EchoBusinessException {
- throw new EchoBusinessException("Business Exception");
-
- }
-
- public void echoRuntimeException() throws RuntimeException {
- throw new RuntimeException("Runtime Exception");
- }
-
- public int echoInt(int param) {
- int value = param;
- return value;
- }
-
- public boolean echoBoolean(boolean param) {
- boolean value = param;
- return value;
- }
-
- public Map echoMap(HashMap param) {
- Map map = new HashMap();
- map = param;
- return map;
- }
-
- public TestBean echoBean(TestBean testBean1) {
- TestBean testBean = new TestBean();
- testBean.setTestString(testBean1.getTestString());
- testBean.setTestInt(testBean1.getTestInt());
- return testBean;
- }
-
- public List echoList(ArrayList param){
- List list = new ArrayList();
- for(Iterator itr = param.iterator();itr.hasNext();)
- {
- list.add(itr.next());
- }
- return list;
- }
-
- public String[] echoArrayString(String[] stringArray) {
- return stringArray;
- }
-
- public int[] echoArrayInt(int[] intArray) {
- return intArray;
- }
-
- public Set echoSet(HashSet param){
- Set set = new HashSet();
- set = param;
- return set;
-
- }
-
-
- public void get\u03a9\u03bb\u03c0() {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
deleted file mode 100644
index 6d156fcdf5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCDataTypeTestCase.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jsonrpc;
-
-import java.io.ByteArrayInputStream;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import com.meterware.httpunit.PostMethodWebRequest;
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONRPCDataTypeTestCase {
-
- private static final String SERVICE_PATH = "/EchoService";
- private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH;
- private SCADomain domain;
-
- @Before
- public void setUp() throws Exception {
- domain = SCADomain.newInstance("JSONRPCBinding.composite");
- }
-
- @After
- public void tearDown() throws Exception {
- domain.close();
- }
-
- @Test
- public void testInt() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoInt\", \"params\": [12345], \"id\": 4}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals(12345, jsonResp.getInt("result"));
- }
-
- @Test
- public void testBoolean() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoBoolean\", \"params\": [true], \"id\": 5}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals(true, jsonResp.getBoolean("result"));
- }
-
- @Test
- public void testMap() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoMap\", \"params\": [ {\"javaClass\": \"java.util.HashMap\", \"map\": { \"Binding\": \"JSON-RPC\"}}], \"id\": 6}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals("JSON-RPC", jsonResp.getJSONObject("result").getJSONObject("map").getString("Binding"));
- }
-
- @Test
- public void testBean() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoBean\", \"params\": [ {\"javaClass\": \"bean.TestBean\", \"testString\": \"JSON-RPC\", \"testInt\":1234}], \"id\": 7}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals("JSON-RPC", jsonResp.getJSONObject("result").getString("testString"));
- }
-
- @Test
- public void testList() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoList\", \"params\": [ {\"javaClass\": \"java.util.ArrayList\", \"list\": [0,1,2,3,4]}], \"id\": 8}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals(0, jsonResp.getJSONObject("result").getJSONArray("list").get(0));
- }
-
- @Test
- public void testArrayString() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{\"params\":[[\"1\",\"2\"]],\"method\":\"echoArrayString\",\"id\":9}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals(1, jsonResp.getJSONArray("result").getInt(0));
- }
-
-
- @Test
- public void testArrayInt() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{\"params\":[[1,2]],\"method\":\"echoArrayInt\",\"id\":10}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals(1, jsonResp.getJSONArray("result").getInt(0));
- }
-
-
- @Test
- public void testSet() throws Exception {
- JSONObject jsonRequest = new JSONObject(
- "{ \"method\": \"echoSet\", \"params\": [ {\"javaClass\": \"java.util.HashSet\", \"set\": {\"1\": \"red\", \"2\": \"blue\"}}],\"id\": 11}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest(SERVICE_URL,
- new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")), "application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
-
- Assert.assertEquals("red", jsonResp.getJSONObject("result").getJSONObject("set").getString("red"));
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.java
deleted file mode 100644
index 52518e1bbc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCExceptionTestCase.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.binding.jsonrpc;
-
-import java.io.ByteArrayInputStream;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.meterware.httpunit.PostMethodWebRequest;
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONRPCExceptionTestCase{
-
- private static final String SERVICE_PATH = "/EchoService";
-
- private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH;
-
- private SCADomain domain;
-
- @Before
- public void setUp() throws Exception {
- domain = SCADomain.newInstance("JSONRPCBinding.composite");
- }
-
- @After
- public void tearDown() throws Exception {
- domain.close();
- }
-
- @Test
- public void testRuntimeException() throws Exception{
- JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoRuntimeException\", \"params\": [], \"id\": 2}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonErr = new JSONObject(response.getText()).getJSONObject("error");
-
- Assert.assertEquals("Runtime Exception", jsonErr.getString("msg"));
- }
-
- @Test
- public void testBusinessException() throws Exception{
- JSONObject jsonRequest = new JSONObject("{ \"method\": \"echoBusinessException\", \"params\": [], \"id\": 3}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonErr = new JSONObject(response.getText()).getJSONObject("error");
-
- Assert.assertEquals("Business Exception", jsonErr.getString("msg"));
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
deleted file mode 100644
index 67d3eda6b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCServiceTestCase.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.jsonrpc;
-
-import java.io.ByteArrayInputStream;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.meterware.httpunit.PostMethodWebRequest;
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONRPCServiceTestCase{
-
- private static final String SERVICE_PATH = "/EchoService";
-
- private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH;
-
- private SCADomain domain;
-
- @Before
- public void setUp() throws Exception {
- domain = SCADomain.newInstance("JSONRPCBinding.composite");
- }
-
- @After
- public void tearDown() throws Exception {
- domain.close();
- }
-
- @Test
- public void testJSONRPCBinding() throws Exception {
- JSONObject jsonRequest = new JSONObject("{ \"method\": \"echo\", \"params\": [\"Hello JSON-RPC\"], \"id\": 1}");
-
- WebConversation wc = new WebConversation();
- WebRequest request = new PostMethodWebRequest( SERVICE_URL, new ByteArrayInputStream(jsonRequest.toString().getBytes("UTF-8")),"application/json");
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
-
- JSONObject jsonResp = new JSONObject(response.getText());
- Assert.assertEquals("echo: Hello JSON-RPC", jsonResp.getString("result"));
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java
deleted file mode 100644
index 64c2dd31f2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCSmdTestCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.meterware.httpunit.GetMethodWebRequest;
-import com.meterware.httpunit.WebConversation;
-import com.meterware.httpunit.WebRequest;
-import com.meterware.httpunit.WebResponse;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONRPCSmdTestCase {
-
- private static final String SERVICE_PATH = "/EchoService";
-
- private static final String SERVICE_URL = "http://localhost:8085/SCADomain" + SERVICE_PATH;
-
- private static final String SMD_URL = SERVICE_URL + "?smd";
-
- private static SCADomain domain;
-
- @Before
- public void setUp() throws Exception {
- domain = SCADomain.newInstance("JSONRPCBinding.composite");
- }
-
- @After
- public void tearDown() throws Exception {
- domain.close();
- }
-
- @Test
- /**
- * This test make sure the JSON-RPC Binding can handle special characters when generating SMD
- */
- public void testJSONRPCSmdSpecialCharacters() throws Exception {
- WebConversation wc = new WebConversation();
- WebRequest request = new GetMethodWebRequest(SMD_URL);
- WebResponse response = wc.getResource(request);
-
- Assert.assertEquals(200, response.getResponseCode());
- Assert.assertNotNull(response.getText());
-
- //System.out.println(">>>SMD:" + response.getText());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite b/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite
deleted file mode 100644
index 978fdcfa7f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite
+++ /dev/null
@@ -1,35 +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"
- targetNamespace="http://jsonrpc"
- xmlns:jsonrpc="http://jsonrpc"
- name="JSONRPCBinding">
-
- <service name="EchoService" promote="EchoComponent">
- <interface.java interface="echo.Echo"/>
- <tuscany:binding.jsonrpc uri="http://localhost:8085/SCADomain/EchoService"/>
- </service>
-
- <component name="EchoComponent">
- <implementation.java class="echo.EchoComponentImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/LICENSE b/branches/sca-java-1.5.1/modules/binding-jsonrpc/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/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-java-1.5.1/modules/binding-jsonrpc/NOTICE b/branches/sca-java-1.5.1/modules/binding-jsonrpc/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/pom.xml b/branches/sca-java-1.5.1/modules/binding-jsonrpc/pom.xml
deleted file mode 100644
index 6851a91727..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/pom.xml
+++ /dev/null
@@ -1,78 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-jsonrpc</artifactId>
- <name>Apache Tuscany SCA JSON-RPC Binding Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jsonrpc</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jsonrpc*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
deleted file mode 100644
index ce86365980..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBinding.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * A model for the JSONRPC binding.
- *
- * @version $Rev$ $Date$
- */
-public interface JSONRPCBinding extends Binding, PolicySetAttachPoint {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.java
deleted file mode 100644
index 707a9d7103..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCBindingFactory.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.binding.jsonrpc;
-
-
-/**
- * Factory for the JSON RPC binding model.
- *
- * @version $Rev$ $Date$
-*/
-public interface JSONRPCBindingFactory {
-
- /**
- * Creates a new JSON RPC Binding
- * @return a new JSON RPC Binding
- */
- JSONRPCBinding createJSONRPCBinding();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingFactoryImpl.java
deleted file mode 100644
index 625457a668..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingFactoryImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.jsonrpc.impl;
-
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory;
-
-
-/**
- * Factory for the JSON RPC binding model.
- *
- * @version $Rev$ $Date$
-*/
-public class JSONRPCBindingFactoryImpl implements JSONRPCBindingFactory {
-
- public JSONRPCBinding createJSONRPCBinding() {
- return new JSONRPCBindingImpl();
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.java
deleted file mode 100644
index 1ee3631a98..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/impl/JSONRPCBindingImpl.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.binding.jsonrpc.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding;
-
-/**
- * A model for the JSONRPC binding.
- *
- * @version $Rev$ $Date$
- */
-public class JSONRPCBindingImpl implements JSONRPCBinding {
- private String name;
- private String uri;
-
-
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isUnresolved() {
- // The binding is always resolved
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The binding is always resolved
- }
-
- //Policy related getters/setters
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory
deleted file mode 100644
index 8b9662997d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.jsonrpc.impl.JSONRPCBindingFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 0f39251068..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-jsonrpc/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.jsonrpc,model=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding,factory=org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBindingFactory
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/LICENSE b/branches/sca-java-1.5.1/modules/binding-notification/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/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-java-1.5.1/modules/binding-notification/NOTICE b/branches/sca-java-1.5.1/modules/binding-notification/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/pom.xml b/branches/sca-java-1.5.1/modules/binding-notification/pom.xml
deleted file mode 100644
index 222524ec59..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/pom.xml
+++ /dev/null
@@ -1,150 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-notification</artifactId>
- <name>Apache Tuscany SCA Notification Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-notification</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- <version>1.2.7</version>
- </dependency>
-
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
- <scope>runtime</scope>
- </dependency>
- <!-- test dependencies -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.notification</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.notification*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.java
deleted file mode 100644
index 8e6a78551a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/DefaultNotificationBindingFactory.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.binding.notification;
-
-/**
- * Creates runtime artifacts for the notification binding
- *
- * @version $Rev$ $Date$
- */
-public class DefaultNotificationBindingFactory implements NotificationBindingFactory {
-
- public NotificationBinding createNotificationBinding() {
- return new NotificationBindingImpl();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.java
deleted file mode 100644
index 940a69784b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBinding.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.binding.notification;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface NotificationBinding extends Binding {
-
- String getNtmAddress();
-
- void setNtmAddress(String ntm);
-
- URI getNotificationType();
-
- void setNotificationType(URI notificationType);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.java
deleted file mode 100644
index 31a8b26c02..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingFactory.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.binding.notification;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface NotificationBindingFactory {
-
- NotificationBinding createNotificationBinding();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java
deleted file mode 100644
index f4c210ba7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.net.URI;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationBindingImpl implements NotificationBinding {
- private String name;
- private String uri;
- protected String ntmAddress;
- protected URI notificationType;
-
- @Override
- public Object clone() {
- return this;
- }
-
- 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 String getNtmAddress() {
- return ntmAddress;
- }
-
- public void setNtmAddress(String ntmAddress) {
- this.ntmAddress = ntmAddress;
- }
-
- public URI getNotificationType() {
- return notificationType;
- }
-
- public void setNotificationType(URI notificationType) {
- this.notificationType = notificationType;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public boolean isUnresolved() {
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.java
deleted file mode 100644
index 7fdeee189b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingModuleActivator.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.binding.notification;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.binding.notification.encoding.DefaultEncodingRegistry;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.http.ExtensibleServletHost;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationBindingModuleActivator implements ModuleActivator {
-
- private NotificationBindingProcessor bindingProcessor;
-
- private DefaultEncodingRegistry encodingRegistry;
- private ServletHost servletHost;
-
-
- public void start(ExtensionPointRegistry registry) {
- encodingRegistry = new DefaultEncodingRegistry();
- servletHost = new ExtensibleServletHost(registry.getExtensionPoint(ServletHostExtensionPoint.class));
-
- AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- DefaultNotificationBindingFactory bindingFactory = new DefaultNotificationBindingFactory();
- bindingProcessor = new NotificationBindingProcessor(assemblyFactory, policyFactory, bindingFactory);
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- processors.addArtifactProcessor(bindingProcessor);
-
- NotificationBindingProviderFactory nbpf = new NotificationBindingProviderFactory(servletHost,
- encodingRegistry);
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- providerFactories.addProviderFactory(nbpf);
- }
-
- public void stop(ExtensionPointRegistry registry) {
- encodingRegistry.stop();
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- processors.removeArtifactProcessor(bindingProcessor);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java
deleted file mode 100644
index 892700779f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProcessor.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationBindingProcessor implements StAXArtifactProcessor<NotificationBinding> {
-
- protected static final QName BINDING_NOTIFICATION = new QName(Constants.SCA10_TUSCANY_NS, "binding.notification");
-
- private NotificationBindingFactory bindingFactory;
-
- public NotificationBindingProcessor(AssemblyFactory assemblyFactory,
- PolicyFactory policyFactory,
- NotificationBindingFactory bindingFactory) {
- this.bindingFactory = bindingFactory;
- }
-
- public QName getArtifactType() {
- return BINDING_NOTIFICATION;
- }
-
- public Class<NotificationBinding> getModelType() {
- return NotificationBinding.class;
- }
-
- public NotificationBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert BINDING_NOTIFICATION.equals(reader.getName());
- String bindingUri = reader.getAttributeValue(null, "uri");
- String name = reader.getAttributeValue(null, "name");
- String ntm = reader.getAttributeValue(null, "ntm");
- String notificationType = reader.getAttributeValue(null, "notificationType");
-
- NotificationBinding binding = bindingFactory.createNotificationBinding();
- if (name != null) {
- binding.setName(name);
- }
- if (bindingUri != null) {
- binding.setURI(bindingUri);
- }
- if (ntm != null) {
- binding.setNtmAddress(ntm);
- }
- if (notificationType != null) {
- try {
- binding.setNotificationType(new URI(notificationType));
- } catch(URISyntaxException e) {
- throw new ContributionReadException(e);
- }
- }
- return binding;
- }
-
- public void write(NotificationBinding notificationBinding, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
-
- //FIXME Implement this method
- }
-
- public void resolve(NotificationBinding notificationBinding, ModelResolver resolver) throws ContributionResolveException {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java
deleted file mode 100644
index e5ea616fdb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBindingProviderFactory.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.net.InetAddress;
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.binding.notification.encoding.AbstractEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerIDEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerProducerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverrideEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverrideResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ConsumerReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
-import org.apache.tuscany.sca.binding.notification.encoding.EndConsumersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndProducersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddressEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReferenceEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumersEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborsEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerAckEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponseEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ReferencePropertiesEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.RemoveBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.RemovedBrokerEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnectionEnDeCoder;
-import org.apache.tuscany.sca.binding.notification.encoding.SubscribeEnDeCoder;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The runtime representation of the notification reference binding
- *
- * @version $Rev$ $Date$
- */
-public class NotificationBindingProviderFactory implements BindingProviderFactory<NotificationBinding>,
- NotificationBrokerManager {
- private static final String DEFAULT_PORT = "8083";
-
- private ServletHost servletHost;
- private NotificationTypeManagerImpl notificationTypeManager;
- private EncodingRegistry encodingRegistry;
- private String httpUrl;
- private Map<URI, NotificationReferenceBindingProvider> referenceBindingProviders;
- private Map<URI, NotificationServiceBindingProvider> serviceBindingProviders;
-
- private static NotificationBindingProviderFactory factoryInstance = null;
-
- public NotificationBindingProviderFactory(ServletHost servletHost, EncodingRegistry encodingRegistry) {
- this.servletHost = servletHost;
- this.encodingRegistry = encodingRegistry;
- this.referenceBindingProviders = new HashMap<URI, NotificationReferenceBindingProvider>();
- this.serviceBindingProviders = new HashMap<URI, NotificationServiceBindingProvider>();
-
- factoryInstance = this;
- }
-
- public Class<NotificationBinding> getModelType() {
- return NotificationBinding.class;
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- NotificationBinding binding) {
- init();
- URI notificationType = binding.getNotificationType();
- if (!validReferenceBinding(binding)) {
- throw new RuntimeException("Binding not valid");
- }
- NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
- if (referenceBindingProvider == null) {
- referenceBindingProvider =
- new NotificationReferenceBindingProvider(binding, component, reference, servletHost,
- notificationTypeManager, encodingRegistry, httpUrl, this);
- referenceBindingProviders.put(notificationType, referenceBindingProvider);
- }
- return referenceBindingProvider;
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- NotificationBinding binding) {
- init();
- URI notificationType = binding.getNotificationType();
- if (!validServiceBinding(binding)) {
- throw new RuntimeException("Binding not valid");
- }
- NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
- if (serviceBindingProvider == null) {
- serviceBindingProvider =
- new NotificationServiceBindingProvider(binding, component, service, servletHost,
- notificationTypeManager, encodingRegistry, httpUrl, this);
- serviceBindingProviders.put(notificationType, serviceBindingProvider);
- }
- return serviceBindingProvider;
- }
-
- private boolean validServiceBinding(NotificationBinding binding) {
- URI notificationType = binding.getNotificationType();
- NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
- if (referenceBindingProvider != null) {
- return validBinding(binding, referenceBindingProvider.getBinding());
- }
- return true;
- }
-
- private boolean validReferenceBinding(NotificationBinding binding) {
- URI notificationType = binding.getNotificationType();
- NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
- if (serviceBindingProvider != null) {
- return validBinding(binding, serviceBindingProvider.getBinding());
- }
- return true;
- }
-
- private boolean validBinding(NotificationBinding binding1, NotificationBinding binding2) {
- String binding1NtmAddress = binding1.getNtmAddress();
- String binding2NtmAddress = binding2.getNtmAddress();
- if (binding1NtmAddress == null && binding2NtmAddress == null) {
- return true;
- } else if (binding1NtmAddress == null || binding2NtmAddress == null) {
- return false;
- } else {
- return binding1NtmAddress.equals(binding2NtmAddress);
- }
- }
-
- /*
- * These methods are intended to be called by the binding providers' start
- * methods. By the time this happens, both referenceBindingProvider != null &&
- * serviceBindingProvider != null, if they are ever going to be
- */
- public void serviceProviderStarted(URI notificationType,
- NotificationServiceBindingProvider serviceBindingProvider,
- URL remoteNtmUrl) {
- NotificationReferenceBindingProvider referenceBindingProvider = referenceBindingProviders.get(notificationType);
- if (referenceBindingProvider == null) {
- serviceBindingProvider.deployConsumer();
- } else if (referenceBindingProvider.isStarted()) {
- String brokerID = BrokerID.generate();
- deployBroker(notificationType, serviceBindingProvider, referenceBindingProvider, brokerID, remoteNtmUrl);
- }
- }
-
- public void referenceProviderStarted(URI notificationType,
- NotificationReferenceBindingProvider referenceBindingProvider,
- URL remoteNtmUrl) {
- NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
- if (serviceBindingProvider == null) {
- referenceBindingProvider.deployProducer();
- } else if (serviceBindingProvider.isStarted()) {
- String brokerID = BrokerID.generate();
- deployBroker(notificationType, serviceBindingProvider, referenceBindingProvider, brokerID, remoteNtmUrl);
- }
- }
-
- private void deployBroker(URI notificationType,
- NotificationServiceBindingProvider serviceBindingProvider,
- NotificationReferenceBindingProvider referenceBindingProvider,
- String brokerID,
- URL remoteNtmUrl) {
- URL consumerUrl = serviceBindingProvider.getURL();
- URL producerUrl = referenceBindingProvider.getURL();
- List<EndpointReference> consumerList = new ArrayList<EndpointReference>();
- List<EndpointReference> producerList = new ArrayList<EndpointReference>();
- boolean firstBroker =
- notificationTypeManager.newBroker(notificationType,
- consumerUrl,
- producerUrl,
- brokerID,
- remoteNtmUrl,
- consumerList,
- producerList);
- if (firstBroker) {
- serviceBindingProvider.deployBroker(brokerID, null, producerList);
- referenceBindingProvider.deployBroker(brokerID, null, consumerList);
- if (!consumerList.isEmpty() || !producerList.isEmpty()) {
- notificationTypeManager.newBrokerAck(remoteNtmUrl);
- }
- } else {
- // returned lists contain broker consumers and producers and are the
- // same length
- int index = consumerList.size() - 1;
- // establish connection with picked broker
- EndpointReference brokerConsumerEPR = consumerList.get(index);
- EndpointReference brokerProducerEPR = producerList.get(index);
- serviceBindingProvider.deployBroker(brokerID, brokerProducerEPR, null);
- referenceBindingProvider.deployBroker(brokerID, brokerConsumerEPR, null);
- }
- }
-
- public void replaceConsumersBrokerConnection(URI notificationType, EndpointReference chosenBrokerProducerEpr) {
- NotificationServiceBindingProvider serviceBindingProvider = serviceBindingProviders.get(notificationType);
- if (serviceBindingProvider == null) {
- throw new RuntimeException("Missing service binding provider for [" + notificationType + "]");
- }
- serviceBindingProvider.replaceBrokerConnection(chosenBrokerProducerEpr);
- }
-
- public static void removeBroker(URI notificationType) {
- if (factoryInstance == null) {
- throw new RuntimeException("Missing factory instance");
- }
- NotificationReferenceBindingProvider referenceBindingProvider =
- factoryInstance.referenceBindingProviders.get(notificationType);
- NotificationServiceBindingProvider serviceBindingProvider =
- factoryInstance.serviceBindingProviders.get(notificationType);
- if (referenceBindingProvider == null || serviceBindingProvider == null) {
- throw new RuntimeException("Not a broker for [" + notificationType + "]");
- }
- referenceBindingProvider.undeployBroker(serviceBindingProvider.getURL());
- }
-
- private String getBaseURI() {
- if (httpUrl == null) {
- // Allow priviledged access to read system property. Requires PropertyPermision in security policy.
- String httpPort = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty("notification.httpPort");
- }
- });
-
- if (httpPort == null) {
- httpPort = DEFAULT_PORT;
- }
- String localHost = null;
- try {
- localHost = InetAddress.getLocalHost().getCanonicalHostName();
- } catch (Exception e) {
- e.printStackTrace();
- localHost = "localhost";
- }
- httpUrl = "http://" + localHost + ((httpPort != null) ? (":" + httpPort) : "");
- }
- return httpUrl;
- }
-
- @SuppressWarnings("unchecked")
- public void init() {
- if (notificationTypeManager == null) {
- AbstractEnDeCoder subscribeEnDeCoder = new SubscribeEnDeCoder(encodingRegistry);
- subscribeEnDeCoder.start();
- AbstractEnDeCoder consumerReferenceEnDeCoder = new ConsumerReferenceEnDeCoder(encodingRegistry);
- consumerReferenceEnDeCoder.start();
- AbstractEnDeCoder endpointAddressEnDeCoder = new EndpointAddressEnDeCoder(encodingRegistry);
- endpointAddressEnDeCoder.start();
- AbstractEnDeCoder newConsumerEnDeCoder = new NewConsumerEnDeCoder(encodingRegistry);
- newConsumerEnDeCoder.start();
- AbstractEnDeCoder newProducerEnDeCoder = new NewProducerEnDeCoder(encodingRegistry);
- newProducerEnDeCoder.start();
- AbstractEnDeCoder newConsumerResponseEnDeCoder = new NewConsumerResponseEnDeCoder(encodingRegistry);
- newConsumerResponseEnDeCoder.start();
- AbstractEnDeCoder newProducerResponseEnDeCoder = new NewProducerResponseEnDeCoder(encodingRegistry);
- newProducerResponseEnDeCoder.start();
- AbstractEnDeCoder newBrokerEnDeCoder = new NewBrokerEnDeCoder(encodingRegistry);
- newBrokerEnDeCoder.start();
- AbstractEnDeCoder brokerConsumerReferenceEnDeCoder = new BrokerConsumerReferenceEnDeCoder(encodingRegistry);
- brokerConsumerReferenceEnDeCoder.start();
- AbstractEnDeCoder brokerProducerReferenceEnDeCoder = new BrokerProducerReferenceEnDeCoder(encodingRegistry);
- brokerProducerReferenceEnDeCoder.start();
- AbstractEnDeCoder newBrokerResponseEnDeCoder = new NewBrokerResponseEnDeCoder(encodingRegistry);
- newBrokerResponseEnDeCoder.start();
- AbstractEnDeCoder brokersEnDeCoder = new BrokersEnDeCoder(encodingRegistry);
- brokersEnDeCoder.start();
- AbstractEnDeCoder brokerEnDeCoder = new BrokerEnDeCoder(encodingRegistry);
- brokerEnDeCoder.start();
- AbstractEnDeCoder endConsumersEnDeCoder = new EndConsumersEnDeCoder(encodingRegistry);
- endConsumersEnDeCoder.start();
- AbstractEnDeCoder endProducersEnDeCoder = new EndProducersEnDeCoder(encodingRegistry);
- endProducersEnDeCoder.start();
- AbstractEnDeCoder endpointReferenceEnDeCoder = new EndpointReferenceEnDeCoder(encodingRegistry);
- endpointReferenceEnDeCoder.start();
- AbstractEnDeCoder referencePropertiesEnDeCoder = new ReferencePropertiesEnDeCoder(encodingRegistry);
- referencePropertiesEnDeCoder.start();
- AbstractEnDeCoder brokerIDEnDeCoder = new BrokerIDEnDeCoder(encodingRegistry);
- brokerIDEnDeCoder.start();
- AbstractEnDeCoder connectionOverrideEnDeCoder = new ConnectionOverrideEnDeCoder(encodingRegistry);
- connectionOverrideEnDeCoder.start();
- AbstractEnDeCoder connectionOverrideResponseEnDeCoder =
- new ConnectionOverrideResponseEnDeCoder(encodingRegistry);
- connectionOverrideResponseEnDeCoder.start();
- AbstractEnDeCoder newBrokerAckEnDeCoder = new NewBrokerAckEnDeCoder(encodingRegistry);
- newBrokerAckEnDeCoder.start();
- AbstractEnDeCoder neighborBrokerConsumersEnDeCoder = new NeighborBrokerConsumersEnDeCoder(encodingRegistry);
- neighborBrokerConsumersEnDeCoder.start();
- AbstractEnDeCoder removeBrokerEnDeCoder = new RemoveBrokerEnDeCoder(encodingRegistry);
- removeBrokerEnDeCoder.start();
- AbstractEnDeCoder removedBrokerEnDeCoder = new RemovedBrokerEnDeCoder(encodingRegistry);
- removedBrokerEnDeCoder.start();
- AbstractEnDeCoder neighborsEnDeCoder = new NeighborsEnDeCoder(encodingRegistry);
- neighborsEnDeCoder.start();
- AbstractEnDeCoder replaceBrokerConnectionEnDeCoder = new ReplaceBrokerConnectionEnDeCoder(encodingRegistry);
- replaceBrokerConnectionEnDeCoder.start();
-
- notificationTypeManager = new NotificationTypeManagerImpl();
- notificationTypeManager.setServletHost(servletHost);
- notificationTypeManager.setEncodingRegistry(encodingRegistry);
- notificationTypeManager.init();
-
- getBaseURI();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.java
deleted file mode 100644
index 8a6d57e825..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationBrokerManager.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.binding.notification;
-
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface NotificationBrokerManager {
-
- void serviceProviderStarted(URI notificationType,
- NotificationServiceBindingProvider serviceBindingProvider,
- URL remoteNtmUrl);
-
- void referenceProviderStarted(URI notificationType,
- NotificationReferenceBindingProvider referenceBindingProvider,
- URL remoteNtmUrl);
-
- void replaceConsumersBrokerConnection(URI notificationType, EndpointReference chosenBrokerProducerEpr);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java
deleted file mode 100644
index 8980fa26ff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingInvoker.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.io.OutputStream;
-import java.util.HashMap;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.notification.NotificationReferenceBindingProvider.SubscriberInfo;
-import org.apache.tuscany.sca.binding.notification.encoding.Constants;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
-import org.apache.tuscany.sca.implementation.notification.ImmutableMessage;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Turns invoke into remote message fan-out
- *
- * @version $Rev$ $Date$
- */
-public class NotificationReferenceBindingInvoker implements Invoker {
-
- private static final Message RESPONSE = new ImmutableMessage();
- private Operation operation;
-
- private NotificationReferenceBindingProvider notificationReferenceBindingProvider;
-
- public NotificationReferenceBindingInvoker(Operation operation,
- NotificationReferenceBindingProvider notificationReferenceBindingProvider) {
- this.operation = operation;
- this.notificationReferenceBindingProvider = notificationReferenceBindingProvider;
- }
-
- public Message invoke(Message msg) {
- Object payload = msg.getBody();
- if (payload == null) {
- throw new RuntimeException("Message body is null");
- }
- Writeable writeable = null;
- String incomingBrokerID = null;
- if (payload.getClass().isArray()) {
- Object[] bodyArray = (Object[])payload;
- if (bodyArray.length == 3) {
- writeable = getWriteableFromByteArray((byte[])bodyArray[1]);
- incomingBrokerID = (String)bodyArray[2];
- } else if (bodyArray.length == 1) {
- writeable = getWriteableFromPayload(bodyArray[0]);
- } else {
- throw new RuntimeException("Invalid body array size");
- }
- } else {
- writeable = getWriteableFromPayload(payload);
- }
-
- try {
- for (SubscriberInfo subscriber : notificationReferenceBindingProvider.getSubscribers()) {
- // check for each subscriber's broker id and skip if equal
- if (incomingBrokerID != null && subscriber.brokerID != null && incomingBrokerID.equals(subscriber.brokerID)) {
- continue;
- }
- HashMap<String, String> headers = new HashMap<String, String>();
- headers.put(IOUtils.Notification_Operation, operation.getName());
- String brokerID = notificationReferenceBindingProvider.getBrokerID();
- if (brokerID != null) {
- headers.put(Constants.Broker_ID, brokerID);
- }
- IOUtils.sendHttpRequest(subscriber.address, headers, writeable, null);
- }
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException("Sender caught exception", e);
- }
- return RESPONSE;
- }
-
- private Writeable getWriteableFromPayload(Object payload) throws RuntimeException {
- if (!(payload instanceof OMElement)) {
- throw new RuntimeException("payload not OMElement");
- }
- final OMElement element = (OMElement)payload;
- Writeable writeable = new Writeable() {
- public void write(OutputStream os) throws IOUtilsException {
- try {
- element.serialize(os);
- os.flush();
- } catch(Exception e) {
- throw new IOUtilsException(e);
- }
- }
- };
- return writeable;
- }
-
- private Writeable getWriteableFromByteArray(final byte[] payload) {
- Writeable writeable = new Writeable() {
- public void write(OutputStream os) throws IOUtilsException {
- try {
- os.write(payload);
- os.flush();
- } catch(Exception e) {
- throw new IOUtilsException(e);
- }
- }
- };
- return writeable;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java
deleted file mode 100644
index c1a8162836..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationReferenceBindingProvider.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.notification.encoding.Broker;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
-import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverride;
-import org.apache.tuscany.sca.binding.notification.encoding.Constants;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingObject;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnection;
-import org.apache.tuscany.sca.binding.notification.encoding.Subscribe;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
-import org.apache.tuscany.sca.binding.notification.util.URIUtil;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * The runtime representation of the notification reference binding
- *
- * @version $Rev$ $Date$
- */
-public class NotificationReferenceBindingProvider
- implements ReferenceBindingProvider, NotificationServletStreamHandler {
-
- private static final String producerPathBase = "/producer";
- private NotificationReferenceBindingInvoker invoker;
- private RuntimeComponentReference reference;
- private NotificationBinding notificationBinding;
- private ServletHost servletHost;
- private NotificationTypeManager ntm;
- private EncodingRegistry encodingRegistry;
- private URI notificationType;
- private URL myUrl;
- private URL remoteNtmUrl;
- private boolean started;
- private NotificationBrokerManager brokerManager;
-
- private List<SubscriberInfo> subscribers;
- private String brokerID;
-
- public NotificationReferenceBindingProvider(NotificationBinding notificationBinding,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- ServletHost servletHost,
- NotificationTypeManager ntm,
- EncodingRegistry encodingRegistry,
- String httpUrl,
- NotificationBrokerManager brokerManager) {
- this.invoker = null;
- this.notificationBinding = notificationBinding;
- this.reference = reference;
- this.servletHost = servletHost;
- this.ntm = ntm;
- this.encodingRegistry = encodingRegistry;
- this.notificationType = notificationBinding.getNotificationType();
- String ntmAddress = notificationBinding.getNtmAddress();
- String notificationTypePath = URIUtil.getPath(notificationType);
- try {
- this.myUrl = new URL(httpUrl + producerPathBase + notificationTypePath);
- this.remoteNtmUrl = null;
- if (ntmAddress != null && notificationType != null) {
- remoteNtmUrl = new URL(ntmAddress + notificationTypePath);
- }
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- this.started = false;
- this.brokerManager = brokerManager;
-
- URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
- notificationBinding.setURI(uri.toString());
- Interface interfaze = reference.getInterfaceContract().getInterface();
- interfaze.resetDataBinding(OMElement.class.getName());
- for (Operation operation : interfaze.getOperations()) {
- operation.setNonBlocking(false);
- }
-
- this.subscribers = new ArrayList<SubscriberInfo>();
- this.brokerID = null;
- }
-
- public NotificationBinding getBinding() {
- return notificationBinding;
- }
-
- public URL getURL() {
- return myUrl;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public void setBrokerID(String brokerID) {
- this.brokerID = brokerID;
- }
-
- public String getBrokerID() {
- return brokerID;
- }
-
- public Invoker createInvoker(Operation operation) {
- if (invoker == null) {
- invoker = new NotificationReferenceBindingInvoker(operation, this);
- }
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public void start() {
- if (started) {
- return;
- }
-
- brokerManager.referenceProviderStarted(notificationType, this, remoteNtmUrl);
- started = true;
- }
-
- public void stop() {
- }
-
- public void deployProducer() {
- List<URL> consumerList = new ArrayList<URL>();
- String sequenceType;
- try {
- sequenceType = ntm.newProducer(notificationType, myUrl, remoteNtmUrl, consumerList);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- if (Constants.EndConsumers.equals(sequenceType)) {
- for (URL consumerUrl : consumerList) {
- addSubscriberUrl(consumerUrl);
- }
- } else if (Constants.BrokerConsumers.equals(sequenceType)) {
- // Pick a broker consumer, for now the first one
- URL consumerUrl = consumerList.get(0);
- addSubscriberUrl(consumerUrl);
- }
-
- servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
- }
-
- public void deployBroker(String brokerID, EndpointReference brokerConsumerEPR, List<EndpointReference> consumerList) {
- if (brokerConsumerEPR != null) {
- addSubscriber(brokerConsumerEPR);
- }
- if (consumerList != null && !consumerList.isEmpty()) {
- for (EndpointReference consumerEPR : consumerList) {
- addSubscriber(consumerEPR);
- }
- }
- setBrokerID(brokerID);
- servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
- }
-
- public void undeployBroker(URL brokerConsumerUrl) {
- EndpointReference brokerConsumerEpr = EncodingUtils.createEndpointReference(brokerConsumerUrl, getBrokerID());
- ntm.removeBroker(brokerConsumerEpr, getNeighborBrokerConsumerEprs(), remoteNtmUrl);
- removeBrokerSubscribers();
- }
-
- public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
-
- try {
- EncodingObject eo = EncodingUtils.decodeFromStream(encodingRegistry, istream);
- if (eo instanceof Subscribe) {
- Subscribe sub = (Subscribe)eo;
- addSubscriber(sub.getConsumerReference().getReference());
- } else if (eo instanceof ConnectionOverride) {
- ConnectionOverride co = (ConnectionOverride)eo;
- replaceSubscribers(co.getBrokerConsumerReference().getReference());
- } else if (eo instanceof ReplaceBrokerConnection) {
- ReplaceBrokerConnection rbc = (ReplaceBrokerConnection)eo;
- URL removedBrokerConsumerEpr = rbc.getRemovedBroker().getReference().getEndpointAddress().getAddress();
- if (rbc.getNeighbors() != null) {
- int choice = rbc.getNeighbors().getBrokerSequence().size() - 1;
- Broker chosenBroker = rbc.getNeighbors().getBrokerSequence().get(choice);
- replaceBrokerSubscriber(removedBrokerConsumerEpr,
- chosenBroker.getBrokerConsumerReference().getReference());
- brokerManager.replaceConsumersBrokerConnection(notificationType,
- chosenBroker.getBrokerProducerReference().getReference());
- } else {
- replaceBrokerSubscriber(removedBrokerConsumerEpr, null);
- }
- } else {
- throw new RuntimeException("Unknown encoding object");
- }
- } catch(Throwable e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public synchronized List<SubscriberInfo> getSubscribers() {
- return subscribers;
- }
-
- private void addSubscriberUrl(URL subscriberUrl) {
- addSubscriber(subscriberUrl, null);
- }
-
- private void addSubscriber(EndpointReference subscriberEPR) {
- BrokerID brokerID = null;
- if (subscriberEPR.getReferenceProperties() != null) {
- brokerID = subscriberEPR.getReferenceProperties().getProperty(BrokerID.class);
- }
- addSubscriber(subscriberEPR.getEndpointAddress().getAddress(), (brokerID != null ? brokerID.getID() : null));
- }
-
- private void addSubscriber(URL address, String brokerID) {
- synchronized(this) {
- SubscriberInfo si = new SubscriberInfo(address);
- si.brokerID = brokerID;
- if (subscribers == null) {
- subscribers = new ArrayList<SubscriberInfo>();
- }
- subscribers.add(si);
- }
- }
-
- private void replaceSubscribers(EndpointReference brokerConsumerEPR) {
- synchronized(this) {
- subscribers = null;
- }
- addSubscriber(brokerConsumerEPR);
- }
-
- private void replaceBrokerSubscriber(URL removedBrokerConsumerUrl, EndpointReference chosenBrokerConsumerEpr) {
- synchronized(this) {
- if (subscribers == null) {
- throw new RuntimeException("No subscribers");
- }
- SubscriberInfo siToRemove = null;
- for (SubscriberInfo si : subscribers) {
- if (si.address.equals(removedBrokerConsumerUrl)) {
- siToRemove = si;
- }
- }
- if (siToRemove == null) {
- throw new RuntimeException("Can't find info for broker to remove [" + removedBrokerConsumerUrl + "]");
- }
- if (!subscribers.remove(siToRemove)) {
- throw new RuntimeException("Can't remove info for [" + siToRemove.address + "]");
- }
- }
- if (chosenBrokerConsumerEpr != null) {
- addSubscriber(chosenBrokerConsumerEpr);
- }
- }
-
- private List<EndpointReference> getNeighborBrokerConsumerEprs() {
- synchronized(this) {
- if (subscribers == null) {
- throw new RuntimeException("No subscribers");
- }
- List<EndpointReference> neighborBrokerConsumerEprs = new ArrayList<EndpointReference>();
- for(SubscriberInfo si : subscribers) {
- if (si.brokerID != null) {
- neighborBrokerConsumerEprs.add(EncodingUtils.createEndpointReference(si.address, si.brokerID));
- }
- }
-
- return neighborBrokerConsumerEprs;
- }
- }
-
- private void removeBrokerSubscribers() {
- synchronized(this) {
- if (subscribers == null) {
- throw new RuntimeException("No subscribers");
- }
- List<SubscriberInfo> sisToRemove = new ArrayList<SubscriberInfo>();
- for (SubscriberInfo si : subscribers) {
- if (si.brokerID != null) {
- sisToRemove.add(si);
- }
- }
- for(SubscriberInfo si : sisToRemove) {
- if (!subscribers.remove(si)) {
- throw new RuntimeException("Can't remove broker subscriber [" + si.address + "]");
- }
- }
- }
- }
-
- class SubscriberInfo {
- public URL address;
- public String brokerID;
-
- public SubscriberInfo(URL address) {
- this.address = address;
- this.brokerID = null;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java
deleted file mode 100644
index 4511fb454b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationServiceBindingProvider.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReference;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
-import org.apache.tuscany.sca.binding.notification.encoding.ConnectionOverride;
-import org.apache.tuscany.sca.binding.notification.encoding.Constants;
-import org.apache.tuscany.sca.binding.notification.encoding.ConsumerReference;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddress;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-import org.apache.tuscany.sca.binding.notification.encoding.ReferenceProperties;
-import org.apache.tuscany.sca.binding.notification.encoding.Subscribe;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
-import org.apache.tuscany.sca.binding.notification.util.URIUtil;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
-import org.apache.tuscany.sca.core.invocation.MessageImpl;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * The runtime representation of the local service binding
- *
- * @version $Rev$ $Date$
- */
-public class NotificationServiceBindingProvider
- implements ServiceBindingProvider, NotificationServletStreamHandler {
-
- private RuntimeWire wire;
- private NotificationBinding notificationBinding;
- private RuntimeComponentService service;
- private ServletHost servletHost;
- private NotificationTypeManager ntm;
- private EncodingRegistry encodingRegistry;
- private URI notificationType;
- private URL myUrl;
- private URL remoteNtmUrl;
- private static final String consumerPathBase = "/consumer";
- private boolean started;
- private NotificationBrokerManager brokerManager;
- private String brokerID;
-
- public NotificationServiceBindingProvider(NotificationBinding notificationBinding,
- RuntimeComponent component,
- RuntimeComponentService service,
- ServletHost servletHost,
- NotificationTypeManager ntm,
- EncodingRegistry encodingRegistry,
- String httpUrl,
- NotificationBrokerManager brokerManager) {
- this.notificationBinding = notificationBinding;
- this.service = service;
- this.servletHost = servletHost;
- this.ntm = ntm;
- this.encodingRegistry = encodingRegistry;
- this.notificationType = notificationBinding.getNotificationType();
- String ntmAddress = notificationBinding.getNtmAddress();
- String notificationTypePath = URIUtil.getPath(notificationType);
- try {
- this.myUrl = new URL(httpUrl + consumerPathBase + notificationTypePath);
- remoteNtmUrl = null;
- if (ntmAddress != null && notificationType != null) {
- remoteNtmUrl = new URL(ntmAddress + notificationTypePath);
- }
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- this.started = false;
- this.brokerManager = brokerManager;
- this.brokerID = null;
-
- URI uri = URI.create(component.getURI() + "/" + notificationBinding.getName());
- notificationBinding.setURI(uri.toString());
- Interface interfaze = service.getInterfaceContract().getInterface();
- interfaze.resetDataBinding(OMElement.class.getName());
- for (Operation operation : interfaze.getOperations()) {
- operation.setNonBlocking(false);
- }
- }
-
- public NotificationBinding getBinding() {
- return notificationBinding;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public URL getURL() {
- return myUrl;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- if (started) {
- return;
- }
-
- RuntimeComponentService componentService = (RuntimeComponentService) service;
- wire = componentService.getRuntimeWire(notificationBinding);
-
- for (InvocationChain ch : wire.getInvocationChains()) {
- ch.setAllowsPassByReference(true);
- }
-
- brokerManager.serviceProviderStarted(notificationType, this, remoteNtmUrl);
- started = true;
- }
-
- public void stop() {
- }
-
- public void deployConsumer() {
- WriteableSubscribe ws = new WriteableSubscribe(myUrl, null);
- List<URL> producerList = new ArrayList<URL>();
- String sequenceType = ntm.newConsumer(notificationType, myUrl, remoteNtmUrl, producerList);
- if (Constants.EndProducers.equals(sequenceType)) {
- for (URL producerUrl : producerList) {
- subscribeWithProducer(producerUrl, null, ws);
- }
- } else if (Constants.BrokerProducers.equals(sequenceType)) {
- // Pick a broker producer, for now the first one
- URL producerUrl = producerList.get(0);
- subscribeWithProducer(producerUrl, null, ws);
- }
-
- servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
- }
-
- protected void subscribeWithProducer(URL producerUrl, String brokerID, WriteableSubscribe ws) {
- if (ws == null) {
- ws = new WriteableSubscribe(myUrl, brokerID);
- }
- try {
- IOUtils.sendHttpRequest(producerUrl, Constants.SUBSCRIBE_OP, ws, null);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public void deployBroker(String brokerID, EndpointReference brokerProducerEPR, List<EndpointReference> producerList) {
- if (brokerProducerEPR != null) {
- subscribeWithProducer(brokerProducerEPR.getEndpointAddress().getAddress(), brokerID, null);
- }
- this.brokerID = brokerID;
- if (producerList != null && !producerList.isEmpty()) {
- WriteableConnectionOverride wco = new WriteableConnectionOverride(myUrl, brokerID);
- for (EndpointReference producerEPR : producerList) {
- try {
- IOUtils.sendHttpRequest(producerEPR.getEndpointAddress().getAddress(), Constants.CONNECTION_OVERRIDE_OP, wco, null);
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- servletHost.addServletMapping(myUrl.toString(), new NotificationServlet(this));
- }
-
- public void replaceBrokerConnection(EndpointReference chosenBrokerProducerEpr) {
- if (brokerID == null) {
- throw new RuntimeException("Missing broker id");
- }
- URL producerUrl = chosenBrokerProducerEpr.getEndpointAddress().getAddress();
- subscribeWithProducer(producerUrl, brokerID, null);
- }
-
- public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
- String opHeader = headers.get(IOUtils.Notification_Operation);
- String incomingBrokerID = headers.get(Constants.Broker_ID);
- if (opHeader == null) {
- throw new RuntimeException("Missing operation header");
- }
- if (wire == null) {
- throw new RuntimeException("Missing wire");
- }
- InvocationChain chain = null;
- for (InvocationChain ch : wire.getInvocationChains()) {
- // We may want to use more than just the op name
- if(ch.getTargetOperation().getName().equals(opHeader)) {
- chain = ch;
- break;
- }
- }
- if (chain == null) {
- throw new RuntimeException("Can't find invocation chain match for [" + opHeader + "]");
- }
- byte[] payload = null;
- try {
- payload = IOUtils.readFully(istream, contentLength);
- } catch(IOException e) {
- throw new RuntimeException(e);
- }
- Object[] args = getArgsFromByteArray(payload, incomingBrokerID);
-
- invoke(chain, args);
-
- // Doing nothing to ostream is equivalent to returning null
- }
-
- private Object[] getArgsFromByteArray(byte[] payload, String incomingBrokerID) {
- try {
- StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(payload));
- OMElement element = builder.getDocumentElement();
- return new Object[] { element };
- } catch(Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- protected void invoke(InvocationChain chain, Object[] args) {
- Message msg = new MessageImpl();
- msg.setBody(args);
- chain.getHeadInvoker().invoke(msg);
- }
-
- class WriteableSubscribe implements Writeable {
-
- private Subscribe sub;
-
- public WriteableSubscribe(URL url, String brokerID) {
- EndpointAddress epa = new EndpointAddress();
- epa.setAddress(url);
- EndpointReference epr = new EndpointReference();
- epr.setEndpointAddress(epa);
- if (brokerID != null) {
- BrokerID cbi = new BrokerID();
- cbi.setID(brokerID);
- ReferenceProperties crp = new ReferenceProperties();
- crp.addProperty(cbi);
- epr.setReferenceProperties(crp);
- }
- ConsumerReference cr = new ConsumerReference();
- cr.setReference(epr);
- sub = new Subscribe();
- sub.setConsumerReference(cr);
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, sub, os);
- }
- }
-
- class WriteableConnectionOverride implements Writeable {
-
- private ConnectionOverride connectionOverride;
-
- public WriteableConnectionOverride(URL brokerConsumerUrl, String brokerID) {
- EndpointAddress epa = new EndpointAddress();
- epa.setAddress(brokerConsumerUrl);
- EndpointReference brokerConsumerEPR = new EndpointReference();
- brokerConsumerEPR.setEndpointAddress(epa);
- BrokerID cbi = new BrokerID();
- cbi.setID(brokerID);
- ReferenceProperties crp = new ReferenceProperties();
- crp.addProperty(cbi);
- brokerConsumerEPR.setReferenceProperties(crp);
- BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
- brokerConsumerReference.setReference(brokerConsumerEPR);
- connectionOverride = new ConnectionOverride();
- connectionOverride.setBrokerConsumerReference(brokerConsumerReference);
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, connectionOverride, os);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.java
deleted file mode 100644
index 101d05f9cb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManager.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.binding.notification;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface NotificationTypeManager {
-
- String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerList);
- String newProducer(URI notificationType, URL producerUrl, URL remoteNtmUrl, List<URL> consumerList);
- boolean newBroker(URI notificationType,
- URL consumerUrl,
- URL producerUrl,
- String brokerID,
- URL remoteNtmUrl,
- List<EndpointReference> consumerList,
- List<EndpointReference> producerList);
- void newBrokerAck(URL remoteNtmUrl);
- void removeBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs, URL remoteNtmUrl);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java
deleted file mode 100644
index 527cfbd667..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/NotificationTypeManagerImpl.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-
-import org.apache.tuscany.sca.binding.notification.encoding.Broker;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerConsumerReference;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerID;
-import org.apache.tuscany.sca.binding.notification.encoding.BrokerProducerReference;
-import org.apache.tuscany.sca.binding.notification.encoding.Brokers;
-import org.apache.tuscany.sca.binding.notification.encoding.Constants;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingException;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingObject;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingRegistry;
-import org.apache.tuscany.sca.binding.notification.encoding.EncodingUtils;
-import org.apache.tuscany.sca.binding.notification.encoding.EndConsumers;
-import org.apache.tuscany.sca.binding.notification.encoding.EndProducers;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointAddress;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReference;
-import org.apache.tuscany.sca.binding.notification.encoding.EndpointReferenceWrapper;
-import org.apache.tuscany.sca.binding.notification.encoding.NeighborBrokerConsumers;
-import org.apache.tuscany.sca.binding.notification.encoding.Neighbors;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBroker;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerAck;
-import org.apache.tuscany.sca.binding.notification.encoding.NewBrokerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumer;
-import org.apache.tuscany.sca.binding.notification.encoding.NewConsumerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducer;
-import org.apache.tuscany.sca.binding.notification.encoding.NewProducerResponse;
-import org.apache.tuscany.sca.binding.notification.encoding.RemoveBroker;
-import org.apache.tuscany.sca.binding.notification.encoding.RemovedBroker;
-import org.apache.tuscany.sca.binding.notification.encoding.ReplaceBrokerConnection;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet;
-import org.apache.tuscany.sca.binding.notification.util.URIUtil;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.ReadableContinuation;
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.Writeable;
-import org.apache.tuscany.sca.binding.notification.util.NotificationServlet.NotificationServletStreamHandler;
-import org.apache.tuscany.sca.host.http.ServletHost;
-
-/**
- * A notification type manager serves as a registry of producers and consumers, or brokers, for
- * any notification type. This class implements an interface that allows a reference provider
- * (a producer), a service provider (a consumer), or both (a broker, via the provider factory),
- * to access locally the ntm for its notification type, regardless of whether the ntm resides
- * locally or remotely.
- * At a given host there is only one reference provider and/or one service provider for any given
- * notification type. So, if the ntm for a notification type resides locally, then it is invoked
- * exclusively by either a reference provider (newProducer), a service provider (newConsumer), or
- * a provider factory (newBroker). And since these invocations occur when the providers are being
- * created then all three of consumerLists, producerLists and brokerLists must be null when these
- * invocations occur.
- *
- * @version $Rev$ $Date$
- */
-public class NotificationTypeManagerImpl implements NotificationTypeManager {
-
- private static final String ntmPathBase = "/ntm";
-
- private ServletHost servletHost;
- private EncodingRegistry encodingRegistry;
- private Map<URI, NotificationTypeManagerHandler> ntmHandlers;
-
- public NotificationTypeManagerImpl() {
- }
-
- public void setServletHost(ServletHost servletHost) {
- this.servletHost = servletHost;
- }
-
- public void setEncodingRegistry(EncodingRegistry encodingRegistry) {
- this.encodingRegistry = encodingRegistry;
- }
-
- public void init() {
- ntmHandlers = new HashMap<URI, NotificationTypeManagerHandler>();
- }
-
- public String newConsumer(URI notificationType, URL consumerUrl, URL remoteNtmUrl, List<URL> producerListResult) {
- if (ntmUrlIsRemote(consumerUrl, remoteNtmUrl)) {
- try {
- WriteableEPW wEPW = new WriteableEPW(new NewConsumer(), consumerUrl);
- InputStreamDecoder isd = new InputStreamDecoder();
- NewConsumerResponse ncr =
- (NewConsumerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_CONSUMER_OP, wEPW, isd);
- String sequenceType = ncr.getSequenceType();
- if (Constants.EndProducers.equals(sequenceType) || Constants.BrokerProducers.equals(sequenceType)) {
- for (EndpointReference epr : ncr.getReferenceSequence()) {
- producerListResult.add(epr.getEndpointAddress().getAddress());
- }
- }
- return sequenceType;
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else {
- NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
- if (ntmHandler != null) {
- throw new RuntimeException("Trying to deploy local consumer with existing local producer, consumer or broker");
- }
-
- createNtmHandler(consumerUrl.getAuthority(), notificationType, consumerUrl, null, null);
-
- return Constants.NoProducers;
- }
- }
-
- private void createNtmHandler(String ntmUriAuthority, URI notificationType, URL consumerUrl, URL producerUrl, BrokerStruct broker) {
- String ntmUri = "http://" + ntmUriAuthority + ntmPathBase + URIUtil.getPath(notificationType);
- NotificationTypeManagerHandler ntmh = new NotificationTypeManagerHandler(notificationType, consumerUrl, producerUrl, broker);
- ntmHandlers.put(notificationType, ntmh);
- servletHost.addServletMapping(ntmUri, new NotificationServlet(ntmh));
- }
-
- public String newProducer(URI notificationType, URL producerUrl, URL remoteNtmUrl, List<URL> consumerListResult) {
- if (ntmUrlIsRemote(producerUrl, remoteNtmUrl)) {
- try {
- WriteableEPW wEPW = new WriteableEPW(new NewProducer(), producerUrl);
- InputStreamDecoder isd = new InputStreamDecoder();
- NewProducerResponse npr =
- (NewProducerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_PRODUCER_OP, wEPW, isd);
- String sequenceType = npr.getSequenceType();
- if (Constants.EndConsumers.equals(sequenceType) || Constants.BrokerConsumers.equals(sequenceType)) {
- for (EndpointReference epr : npr.getReferenceSequence()) {
- consumerListResult.add(epr.getEndpointAddress().getAddress());
- }
- }
- return sequenceType;
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else {
- NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
- if (ntmHandler != null) {
- throw new RuntimeException("Trying to deploy local producer with existing local producer, consumer or broker");
- }
-
- createNtmHandler(producerUrl.getAuthority(), notificationType, null, producerUrl, null);
-
- return Constants.NoConsumers;
- }
- }
-
- public boolean newBroker(URI notificationType,
- URL consumerUrl,
- URL producerUrl,
- String brokerID,
- URL remoteNtmUrl,
- List<EndpointReference> consumerListResult,
- List<EndpointReference> producerListResult) {
- String ntmUriAuthority = producerUrl.getAuthority();
- if (!ntmUriAuthority.equals(consumerUrl.getAuthority())) {
- throw new RuntimeException("Producer url and consumer url do not match");
- }
- if (ntmUrlIsRemote(producerUrl, remoteNtmUrl)) {
- try {
- WriteableNewBroker wnb = new WriteableNewBroker(consumerUrl, producerUrl, brokerID);
- InputStreamDecoder isd = new InputStreamDecoder();
- NewBrokerResponse nbr =
- (NewBrokerResponse)IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_BROKER_OP, wnb, isd);
- if (nbr.isFirstBroker()) {
- if (nbr.getEndConsumers().getSequenceType().equals(Constants.EndConsumers)) {
- for (EndpointReference epr : nbr.getEndConsumers().getReferenceSequence()) {
- consumerListResult.add(epr);
- }
- }
- if (nbr.getEndProducers().getSequenceType().equals(Constants.EndProducers)) {
- for (EndpointReference epr : nbr.getEndProducers().getReferenceSequence()) {
- producerListResult.add(epr);
- }
- }
- } else {
- for (Broker broker : nbr.getBrokers().getBrokerSequence()) {
- consumerListResult.add(broker.getBrokerConsumerReference().getReference());
- producerListResult.add(broker.getBrokerProducerReference().getReference());
- }
- }
- return nbr.isFirstBroker();
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- } else {
- NotificationTypeManagerHandler ntmHandler = ntmHandlers.get(notificationType);
- if (ntmHandler != null) {
- throw new RuntimeException("Trying to deploy local broker with existing local producer, consumer or broker");
- }
-
- BrokerStruct broker = new BrokerStruct(consumerUrl, producerUrl, brokerID);
- createNtmHandler(ntmUriAuthority, notificationType, null, null, broker);
-
- return true;
- }
- }
-
- private boolean ntmUrlIsRemote(URL localUrl, URL ntmUrl) {
- if (ntmUrl == null) {
- return false;
- }
- if (localUrl.getPort() != ntmUrl.getPort()) {
- return true;
- }
- String remoteNtmUrlAuthority = ntmUrl.getAuthority();
- if (remoteNtmUrlAuthority.indexOf("localhost") >= 0) {
- return false;
- }
- return !localUrl.getAuthority().equals(remoteNtmUrlAuthority);
- }
-
- public void newBrokerAck(URL remoteNtmUrl) {
- try {
- IOUtils.sendHttpRequest(remoteNtmUrl, Constants.NEW_BROKER_ACK_OP, new WriteableNewBrokerAck(), null);
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public void removeBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs, URL remoteNtmUrl) {
- WriteableRemoveBroker wrb = new WriteableRemoveBroker(brokerConsumerEpr, neighborBrokerConsumerEprs);
-
- try {
- IOUtils.sendHttpRequest(remoteNtmUrl, Constants.REMOVE_BROKER_OP, wrb, null);
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- private class NotificationTypeManagerHandler implements NotificationServletStreamHandler {
-
- private URI notificationType;
- List<URL> consumerList;
- List<URL> producerList;
- List<BrokerStruct> brokerList;
- private NotificationTypeLock notificationTypeLock;
- private BrokerStruct pendingBroker;
-
- public NotificationTypeManagerHandler(URI notificationType) {
- this.notificationType = notificationType;
- this.notificationTypeLock = new NotificationTypeLock();
- this.pendingBroker = null;
- }
-
- public NotificationTypeManagerHandler(URI notificationType, URL consumerUrl, URL producerUrl, BrokerStruct broker) {
- this(notificationType);
- if (consumerUrl != null) {
- addConsumer(consumerUrl);
- } else if (producerUrl != null) {
- addProducer(producerUrl);
- } else if (broker != null) {
- addBroker(broker);
- }
- }
-
- private void addConsumer(URL consumerUrl) {
- if (consumerList == null) {
- consumerList = new ArrayList<URL>();
- }
- consumerList.add(consumerUrl);
- }
-
- private void addProducer(URL producerUrl) {
- if (producerList == null) {
- producerList = new ArrayList<URL>();
- }
- producerList.add(producerUrl);
- }
-
- private void addBroker(BrokerStruct broker) {
- if (brokerList == null) {
- brokerList = new ArrayList<BrokerStruct>();
- }
- brokerList.add(broker);
- }
-
- public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream) {
- String opHeader = headers.get(IOUtils.Notification_Operation);
- EncodingObject eo = null;
- try {
- eo = EncodingUtils.decodeFromStream(encodingRegistry, istream);
- } catch(EncodingException e) {
- throw new RuntimeException(e);
- }
-
- if (Constants.NEW_CONSUMER_OP.equals(opHeader)) {
- handleNewConsumer((NewConsumer)eo, ostream);
- } else if(Constants.NEW_PRODUCER_OP.equals(opHeader)) {
- handleNewProducer((NewProducer)eo, ostream);
- } else if(Constants.NEW_BROKER_OP.equals(opHeader)) {
- handleNewBroker((NewBroker)eo, ostream);
- } else if (Constants.NEW_BROKER_ACK_OP.equals(opHeader)) {
- handleNewBrokerAck();
- } else if (Constants.REMOVE_BROKER_OP.equals(opHeader)) {
- handleRemoveBroker((RemoveBroker)eo);
- }
- }
-
- private void handleNewConsumer(NewConsumer nc, ServletOutputStream ostream) {
- synchronized(notificationTypeLock) {
- if (notificationTypeLock.isLocked) {
- try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
- }
- URL consumerUrl = nc.getReference().getEndpointAddress().getAddress();
- if (brokerList == null) {
- addConsumer(consumerUrl);
- }
-
- NewConsumerResponse ncr = new NewConsumerResponse();
- if (producerList != null) {
- ncr.setSequenceType(Constants.EndProducers);
- for (URL producerUrl : producerList) {
- ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
- }
- } else if(brokerList != null) {
- ncr.setSequenceType(Constants.BrokerProducers);
- for (BrokerStruct broker : brokerList) {
- ncr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.producerUrl, null));
- }
- } else {
- ncr.setSequenceType(Constants.NoProducers);
- }
- try {
- EncodingUtils.encodeToStream(encodingRegistry, ncr, ostream);
- } catch(IOUtilsException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- private void handleNewProducer(NewProducer np, ServletOutputStream ostream) {
- synchronized(notificationTypeLock) {
- if (notificationTypeLock.isLocked) {
- try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
- }
- URL producerUrl = np.getReference().getEndpointAddress().getAddress();
- if (brokerList == null) {
- addProducer(producerUrl);
- }
-
- NewProducerResponse npr = new NewProducerResponse();
- if (consumerList != null) {
- npr.setSequenceType(Constants.EndConsumers);
- for (URL consumerUrl : consumerList) {
- npr.addReferenceToSequence(EncodingUtils.createEndpointReference(consumerUrl, null));
- }
- } else if(brokerList != null) {
- npr.setSequenceType(Constants.BrokerConsumers);
- for (BrokerStruct broker : brokerList) {
- npr.addReferenceToSequence(EncodingUtils.createEndpointReference(broker.consumerUrl, null));
- }
- } else {
- npr.setSequenceType(Constants.NoConsumers);
- }
- try {
- EncodingUtils.encodeToStream(encodingRegistry, npr, ostream);
- } catch(IOUtilsException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- private void handleNewBroker(NewBroker nb, ServletOutputStream ostream) {
- synchronized(notificationTypeLock) {
- if (notificationTypeLock.isLocked) {
- try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
- }
- NewBrokerResponse nbr = new NewBrokerResponse();
- if (consumerList != null || producerList != null || brokerList == null) {
- nbr.setFirstBroker(true);
- EndConsumers endConsumers = new EndConsumers();
- if (consumerList != null) {
- endConsumers.setSequenceType(Constants.EndConsumers);
- for (URL consumerUrl : consumerList) {
- endConsumers.addReferenceToSequence(EncodingUtils.createEndpointReference(consumerUrl, null));
- }
- } else {
- endConsumers.setSequenceType(Constants.NoConsumers);
- }
- nbr.setEndConsumers(endConsumers);
- EndProducers endProducers = new EndProducers();
- if (producerList != null) {
- endProducers.setSequenceType(Constants.EndProducers);
- for (URL producerUrl : producerList) {
- endProducers.addReferenceToSequence(EncodingUtils.createEndpointReference(producerUrl, null));
- }
- } else {
- endProducers.setSequenceType(Constants.NoProducers);
- }
- nbr.setEndProducers(endProducers);
- } else {
- nbr.setFirstBroker(false);
- Brokers brokers = new Brokers();
- for (BrokerStruct brokerStruct : brokerList) {
- Broker brokerElt = new Broker();
- BrokerConsumerReference bcr = new BrokerConsumerReference();
- bcr.setReference(EncodingUtils.createEndpointReference(brokerStruct.consumerUrl, brokerStruct.brokerID));
- brokerElt.setBrokerConsumerReference(bcr);
-
- BrokerProducerReference bpr = new BrokerProducerReference();
- bpr.setReference(EncodingUtils.createEndpointReference(brokerStruct.producerUrl, brokerStruct.brokerID));
- brokerElt.setBrokerProducerReference(bpr);
- brokers.addBrokerToSequence(brokerElt);
- }
- nbr.setBrokers(brokers);
- }
- EndpointReference consumerEPR = nb.getBrokerConsumerReference().getReference();
- URL consumerUrl = consumerEPR.getEndpointAddress().getAddress();
- BrokerID consumerBrokerID = consumerEPR.getReferenceProperties().getProperty(BrokerID.class);
- EndpointReference producerEPR = nb.getBrokerProducerReference().getReference();
- URL producerUrl = producerEPR.getEndpointAddress().getAddress();
- BrokerID producerBrokerID = producerEPR.getReferenceProperties().getProperty(BrokerID.class);
- if (consumerBrokerID == null ||
- producerBrokerID == null ||
- !consumerBrokerID.getID().equals(producerBrokerID.getID())) {
- throw new RuntimeException("Producer and consumer broker ids do not match");
- }
- // only add broker if consumerList == null && producerList == null
- // otherwise, make it a pending broker and wait for ack
- // TODO block for a configurable amount of time
- BrokerStruct broker = new BrokerStruct(consumerUrl, producerUrl, consumerBrokerID.getID());
- if (consumerList == null && producerList == null) {
- addBroker(broker);
- } else {
- pendingBroker = broker;
- notificationTypeLock.isLocked = true;
- }
- try {
- EncodingUtils.encodeToStream(encodingRegistry, nbr, ostream);
- } catch(IOUtilsException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- private void handleNewBrokerAck() {
- synchronized(notificationTypeLock) {
- if (!notificationTypeLock.isLocked) {
- notificationTypeLock.notifyAll();
- throw new RuntimeException("Notification type should be locked");
- }
- if (brokerList != null) {
- notificationTypeLock.isLocked = false;
- notificationTypeLock.notifyAll();
- throw new RuntimeException("Can't add pending broker to non-empty broker list");
- }
- if (pendingBroker == null) {
- notificationTypeLock.isLocked = false;
- notificationTypeLock.notifyAll();
- throw new RuntimeException("Missing pending broker");
- }
- addBroker(pendingBroker);
- consumerList = null;
- producerList = null;
- pendingBroker = null;
- notificationTypeLock.isLocked = false;
- notificationTypeLock.notifyAll();
- }
- }
-
- private void handleRemoveBroker(RemoveBroker rb) {
- synchronized(notificationTypeLock) {
- if (notificationTypeLock.isLocked) {
- try { notificationTypeLock.wait(); } catch(InterruptedException e) {}
- }
-
- if (brokerList == null) {
- throw new RuntimeException("No broker to remove for [" + notificationType + "]");
- }
-
- NeighborBrokerConsumers nbcs = rb.getNeighborBrokerConsumers();
- EndpointReference rbEpr = rb.getBrokerConsumerReference().getReference();
- if (nbcs != null && nbcs.getReferenceSequence() != null) {
- List<Broker> neighborBrokers = new ArrayList<Broker>();
- for (EndpointReference neighborBrokerConsumerEpr : nbcs.getReferenceSequence()) {
- BrokerStruct neighborBrokerStruct = null;
- URL neighborBrokerConsumerEprUrl = neighborBrokerConsumerEpr.getEndpointAddress().getAddress();
- for (BrokerStruct brokerStruct : brokerList) {
- if (brokerStruct.consumerUrl.equals(neighborBrokerConsumerEprUrl)) {
- neighborBrokerStruct = brokerStruct;
- break;
- }
- }
- if (neighborBrokerStruct == null) {
- throw new RuntimeException("Can't find neighbor broker for consumer EPR [" +
- neighborBrokerConsumerEprUrl + "]");
- }
- BrokerConsumerReference bcr = new BrokerConsumerReference();
- bcr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.consumerUrl, neighborBrokerStruct.brokerID));
- BrokerProducerReference bpr = new BrokerProducerReference();
- bpr.setReference(EncodingUtils.createEndpointReference(neighborBrokerStruct.producerUrl, neighborBrokerStruct.brokerID));
- Broker neighborBroker = new Broker();
- neighborBroker.setBrokerConsumerReference(bcr);
- neighborBroker.setBrokerProducerReference(bpr);
- neighborBrokers.add(neighborBroker);
- }
- int lastIndex = neighborBrokers.size() - 1;
- for (int index = lastIndex; index >= 0; index--) {
- List<Broker> writeableNeighborBrokers = ((index > 0) ? neighborBrokers.subList(0, index) : null);
- WriteableReplaceBrokerConnection wrbc = new WriteableReplaceBrokerConnection(rbEpr, writeableNeighborBrokers);
- URL targetUrl =
- neighborBrokers.get(index).getBrokerProducerReference().getReference().getEndpointAddress().getAddress();
- try {
- IOUtils.sendHttpRequest(targetUrl, Constants.REPLACE_BROKER_CONNECTION_OP, wrbc, null);
- } catch(Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
- }
-
- BrokerStruct removedBrokerStruct = null;
- URL rbEprUrl = rbEpr.getEndpointAddress().getAddress();
- for (BrokerStruct brokerSruct : brokerList) {
- if (brokerSruct.consumerUrl.equals(rbEprUrl)) {
- removedBrokerStruct = brokerSruct;
- break;
- }
- }
- if (removedBrokerStruct == null) {
- throw new RuntimeException("Can't find broker to remove for EPR [" + rbEprUrl + "]");
- }
- if(!brokerList.remove(removedBrokerStruct)) {
- throw new RuntimeException("Broker was not removed");
- }
- }
- }
- }
-
- class NotificationTypeLock {
- public boolean isLocked;
- }
-
- class WriteableEPW implements Writeable {
- private EndpointReferenceWrapper epw;
-
- public WriteableEPW(EndpointReferenceWrapper epw, URL url) {
- EndpointAddress epa = new EndpointAddress();
- epa.setAddress(url);
- EndpointReference epr = new EndpointReference();
- epr.setEndpointAddress(epa);
- epw.setReference(epr);
- this.epw = epw;
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, epw, os);
- }
- }
-
- class InputStreamDecoder implements ReadableContinuation {
-
- public Object read(InputStream istream) throws IOUtilsException {
- try {
- return EncodingUtils.decodeFromStream(encodingRegistry, istream);
- } catch(EncodingException e) {
- throw new IOUtilsException(e);
- }
- }
- }
-
- class BrokerStruct {
- public URL consumerUrl;
- public URL producerUrl;
- public String brokerID;
-
- public BrokerStruct(URL consumerUrl, URL producerUrl, String brokerID) {
- this.consumerUrl = consumerUrl;
- this.producerUrl = producerUrl;
- this.brokerID = brokerID;
- }
- }
-
- class WriteableNewBroker implements Writeable {
- private NewBroker newBroker;
-
- public WriteableNewBroker(URL consumerUrl, URL producerUrl, String brokerID) {
- newBroker = new NewBroker();
- BrokerConsumerReference bcr = new BrokerConsumerReference();
- bcr.setReference(EncodingUtils.createEndpointReference(consumerUrl, brokerID));
- newBroker.setBrokerConsumerReference(bcr);
-
- BrokerProducerReference bpr = new BrokerProducerReference();
- bpr.setReference(EncodingUtils.createEndpointReference(producerUrl, brokerID));
- newBroker.setBrokerProducerReference(bpr);
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, newBroker, os);
- }
- }
-
- class WriteableNewBrokerAck implements Writeable {
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, new NewBrokerAck(), os);
- }
- }
-
- class WriteableRemoveBroker implements Writeable {
- private RemoveBroker removeBroker;
-
- public WriteableRemoveBroker(EndpointReference brokerConsumerEpr, List<EndpointReference> neighborBrokerConsumerEprs) {
- removeBroker = new RemoveBroker();
- BrokerConsumerReference brokerConsumerReference = new BrokerConsumerReference();
- brokerConsumerReference.setReference(brokerConsumerEpr);
- removeBroker.setBrokerConsumerReference(brokerConsumerReference);
- if (neighborBrokerConsumerEprs != null) {
- NeighborBrokerConsumers neighborBrokerConsumers = new NeighborBrokerConsumers();
- neighborBrokerConsumers.setReferenceSequence(neighborBrokerConsumerEprs);
- neighborBrokerConsumers.setSequenceType(Constants.BrokerConsumers);
- removeBroker.setNeighborBrokerConsumers(neighborBrokerConsumers);
- }
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, removeBroker, os);
- }
- }
-
- class WriteableReplaceBrokerConnection implements Writeable {
- private ReplaceBrokerConnection replaceBrokerConnection;
-
- public WriteableReplaceBrokerConnection(EndpointReference removedBrokerEpr, List<Broker> brokerSequence) {
- replaceBrokerConnection = new ReplaceBrokerConnection();
- RemovedBroker removedBroker = new RemovedBroker();
- removedBroker.setReference(removedBrokerEpr);
- replaceBrokerConnection.setRemovedBroker(removedBroker);
- if (brokerSequence != null) {
- Neighbors neighbors = new Neighbors();
- neighbors.setBrokerSequence(brokerSequence);
- replaceBrokerConnection.setNeighbors(neighbors);
- }
- }
-
- public void write(OutputStream os) throws IOUtilsException {
- EncodingUtils.encodeToStream(encodingRegistry, replaceBrokerConnection, os);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.java
deleted file mode 100644
index e99845d886..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBroker.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class AbstractBroker implements EncodingObject {
-
- private BrokerProducerReference brokerProducerReference;
- private BrokerConsumerReference brokerConsumerReference;
-
- public BrokerProducerReference getBrokerProducerReference() {
- return this.brokerProducerReference;
- }
-
- public void setBrokerProducerReference(BrokerProducerReference brokerProducerReference) {
- this.brokerProducerReference = brokerProducerReference;
- }
-
- public BrokerConsumerReference getBrokerConsumerReference() {
- return this.brokerConsumerReference;
- }
-
- public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
- this.brokerConsumerReference = brokerConsumerReference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.java
deleted file mode 100644
index 76eb204f21..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractBrokerEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class AbstractBrokerEnDeCoder<B extends AbstractBroker> extends AbstractEnDeCoder<B> {
-
- public AbstractBrokerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(B encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- registry.encode(encodingObject.getBrokerConsumerReference(), writer);
- registry.encode(encodingObject.getBrokerProducerReference(), writer);
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public B decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- B brokerElement = getEncodingObjectType().newInstance();
- boolean haveBCR = false;
- boolean haveBPR = false;
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- if (encodingObject instanceof BrokerConsumerReference && !haveBCR) {
- brokerElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
- haveBCR = true;
- } else if(encodingObject instanceof BrokerProducerReference && !haveBPR) {
- brokerElement.setBrokerProducerReference((BrokerProducerReference)encodingObject);
- haveBPR = true;
- } else {
- throw new EncodingException("Invalid encoding object");
- }
- break;
- case END_ELEMENT:
- if (!haveBCR) {
- throw new EncodingException("Missing broker consumer reference");
- }
- if (!haveBPR) {
- throw new EncodingException("Missing broker producer reference");
- }
- return brokerElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java
deleted file mode 100644
index 536801016c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/AbstractEnDeCoder.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class AbstractEnDeCoder<E extends EncodingObject> implements
- EnDeCoder<E> {
-
- protected EncodingRegistry registry;
-
- protected AbstractEnDeCoder(EncodingRegistry registry) {
-
- this.registry = registry;
- }
-
- public void start() {
- Class<E> encodingType = getEncodingObjectType();
- QName encodingQName = getEncodingObjectQName();
-
- registry.registerEnDeCoder(encodingType, encodingQName, this);
- }
-
- public void stop() {
- Class<E> encodingType = getEncodingObjectType();
- QName encodingQName = getEncodingObjectQName();
-
- registry.unregisterEnDeCoder(encodingType, encodingQName);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java
deleted file mode 100644
index 3b2aacef4c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Broker.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Broker extends AbstractBroker {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java
deleted file mode 100644
index 94357cd98d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReference.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerConsumerReference extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.java
deleted file mode 100644
index 66f0a198e4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerConsumerReferenceEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerConsumerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<BrokerConsumerReference> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerConsumerReference);
-
- public BrokerConsumerReferenceEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<BrokerConsumerReference> getEncodingObjectType() {
- return BrokerConsumerReference.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.java
deleted file mode 100644
index e6e6b05a42..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerEnDeCoder extends AbstractBrokerEnDeCoder<Broker> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Broker);
-
- public BrokerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<Broker> getEncodingObjectType() {
-
- return Broker.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.java
deleted file mode 100644
index 7c53d529a8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerID.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.binding.notification.encoding;
-
-import java.util.UUID;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerID implements EncodingObject {
-
- private String id;
-
- public String getID() {
- return id;
- }
-
- public void setID(String id) {
- this.id = id;
- }
-
- public static String generate() {
- return UUID.randomUUID().toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java
deleted file mode 100644
index a500a2a854..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerIDEnDeCoder.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerIDEnDeCoder extends AbstractEnDeCoder<BrokerID> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerID);
-
- public BrokerIDEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(BrokerID encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- writer.writeCharacters(encodingObject.getID());
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public BrokerID decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- BrokerID brokerIDElement = new BrokerID();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- break;
- case XMLStreamConstants.CHARACTERS:
- if (reader.hasText()) {
- String id = reader.getText();
- brokerIDElement.setID(id);
- } else {
- throw new EncodingException("Broker ID missing value");
- }
- break;
- case END_ELEMENT:
- return brokerIDElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<BrokerID> getEncodingObjectType() {
-
- return BrokerID.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java
deleted file mode 100644
index a6a2b15a15..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerProducerReference extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java
deleted file mode 100644
index 209416c203..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokerProducerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<BrokerProducerReference> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerProducerReference);
-
- public BrokerProducerReferenceEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<BrokerProducerReference> getEncodingObjectType() {
- return BrokerProducerReference.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java
deleted file mode 100644
index 24395ee0a6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.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.binding.notification.encoding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Brokers implements EncodingObject {
-
- private List<Broker> brokerSequence;
-
- public List<Broker> getBrokerSequence() {
- return brokerSequence;
- }
-
- public void addBrokerToSequence(Broker broker) {
- if(this.brokerSequence == null) {
- this.brokerSequence = new ArrayList<Broker>();
- }
- this.brokerSequence.add(broker);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java
deleted file mode 100644
index 1dba2533d2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BrokersEnDeCoder extends AbstractEnDeCoder<Brokers> {
-
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Brokers);
-
- public BrokersEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(Brokers encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- if (encodingObject.getBrokerSequence() != null) {
- for (Broker broker : encodingObject.getBrokerSequence()) {
- registry.encode(broker, writer);
- }
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public Brokers decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- Brokers brokersElement = new Brokers();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- brokersElement.addBrokerToSequence((Broker)encodingObject);
- break;
- case END_ELEMENT:
- return brokersElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<Brokers> getEncodingObjectType() {
-
- return Brokers.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java
deleted file mode 100644
index 5783d0de02..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConnectionOverride implements EncodingObject {
-
- private BrokerConsumerReference brokerConsumerReference;
-
- public BrokerConsumerReference getBrokerConsumerReference() {
- return this.brokerConsumerReference;
- }
-
- public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
- this.brokerConsumerReference = brokerConsumerReference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java
deleted file mode 100644
index bec3e6ff29..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConnectionOverrideEnDeCoder extends AbstractEnDeCoder<ConnectionOverride> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverride);
-
- public ConnectionOverrideEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ConnectionOverride encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- registry.encode(encodingObject.getBrokerConsumerReference(), writer);
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public ConnectionOverride decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ConnectionOverride connectionOverrideElement = new ConnectionOverride();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- connectionOverrideElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
- break;
- case END_ELEMENT:
- return connectionOverrideElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<ConnectionOverride> getEncodingObjectType() {
-
- return ConnectionOverride.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java
deleted file mode 100644
index 91ba05404a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConnectionOverrideResponse implements EncodingObject {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java
deleted file mode 100644
index 9012aaeb25..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConnectionOverrideResponseEnDeCoder extends AbstractEnDeCoder<ConnectionOverrideResponse> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverrideResponse);
-
- public ConnectionOverrideResponseEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ConnectionOverrideResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public ConnectionOverrideResponse decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ConnectionOverrideResponse connectionOverrideResponseElement = new ConnectionOverrideResponse();
- while (true) {
- switch (reader.next()) {
- case END_ELEMENT:
- return connectionOverrideResponseElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<ConnectionOverrideResponse> getEncodingObjectType() {
-
- return ConnectionOverrideResponse.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java
deleted file mode 100644
index ca64c15305..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface Constants {
-
- String NOTIFICATION_NS = "http://docs.oasis-open.org/wsn/b-2";
- String NOTIFICATION_PREFIX = "wsnt";
- String ADDRESSING_NS = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
- String ADDRESSING_PREFIX = "wsa";
- String Subscribe = "Subscribe";
- String ConsumerReference = "ConsumerReference";
- String Address = "Address";
- String ReferenceProperties = "ReferenceProperties";
- String EndpointReference = "EndpointReference";
- String BrokerID = "BrokerID";
- String NewConsumer = "NewConsumer";
- String NewProducer = "NewProducer";
- String NewConsumerResponse = "NewConsumerResponse";
- String NewProducerResponse = "NewProducerResponse";
- String ConsumerSequenceType = "ConsumerSequenceType";
- String EndConsumers = "EndConsumers";
- String BrokerConsumers = "BrokerConsumers";
- String NoConsumers = "NoConsumers";
- String ProducerSequenceType = "ProducerSequenceType";
- String EndProducers = "EndProducers";
- String BrokerProducers = "BrokerProducers";
- String NoProducers = "NoProducers";
- String Broker = "Broker";
- String NewBroker = "NewBroker";
- String NewBrokerAck = "NewBrokerAck";
- String BrokerConsumerReference = "BrokerConsumerReference";
- String BrokerProducerReference = "BrokerProducerReference";
- String NewBrokerResponse = "NewBrokerResponse";
- String FirstBroker = "FirstBroker";
- String Brokers = "Brokers";
- String ConnectionOverride = "ConnectionOverride";
- String ConnectionOverrideResponse = "ConnectionOverrideResponse";
- String NeighborBrokerConsumers = "NeighborBrokerConsumers";
- String RemoveBroker = "RemoveBroker";
- String RemovedBroker = "RemovedBroker";
- String Neighbors = "Neighbors";
- String ReplaceBrokerConnection = "ReplaceBrokerConnection";
-
- String SUBSCRIBE_OP = "subscribe";
- String CONNECTION_OVERRIDE_OP = "connectionOverride";
- String NEW_CONSUMER_OP = "newConsumer";
- String NEW_PRODUCER_OP = "newProducer";
- String NEW_BROKER_OP = "newBroker";
- String NEW_BROKER_ACK_OP = "newBrokerAck";
- String REMOVE_BROKER_OP = "removeBroker";
- String REPLACE_BROKER_CONNECTION_OP = "replaceBrokerConnection";
-
- String Broker_ID = "brokerID";
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java
deleted file mode 100644
index 1c678a2b96..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConsumerReference extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java
deleted file mode 100644
index 8c6f684425..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConsumerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<ConsumerReference> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConsumerReference);
-
- public ConsumerReferenceEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<ConsumerReference> getEncodingObjectType() {
- return ConsumerReference.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java
deleted file mode 100644
index 5b28aedcf9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DefaultEncodingRegistry implements EncodingRegistry {
-
- private final Map<Class<? extends EncodingObject>, EnDeCoder> encoderRegistry =
- new ConcurrentHashMap<Class<? extends EncodingObject>, EnDeCoder>();
-
- private final Map<QName, EnDeCoder> decoderRegistry = new ConcurrentHashMap<QName, EnDeCoder>();
-
- public DefaultEncodingRegistry() {
- }
-
- public <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder) {
-
- encoderRegistry.put(encodingClass, enDeCoder);
- decoderRegistry.put(qname, enDeCoder);
- }
-
- public <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname) {
-
- encoderRegistry.remove(encodingClass);
- decoderRegistry.remove(qname);
- }
-
- @SuppressWarnings("unchecked")
- public void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- EnDeCoder encoder = encoderRegistry.get(encodingObject.getClass());
- if (encoder == null) {
- throw new EncodingException("No encoder defined for " + encodingObject.getClass());
- }
- encoder.encode(encodingObject, writer);
- }
-
- public EncodingObject decode(XMLStreamReader reader) throws EncodingException {
-
- QName qname = reader.getName();
-
- EnDeCoder decoder = decoderRegistry.get(qname);
- if (decoder == null) {
- throw new EncodingException("No decoder defined for " + qname);
- }
- return decoder.decode(reader);
- }
-
- public void stop() {
- encoderRegistry.clear();
- decoderRegistry.clear();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java
deleted file mode 100644
index bf6094582e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface EnDeCoder<E extends EncodingObject> {
-
- /**
- * Encodes an object to the specified stream writer.
- *
- * @param encodingObject Object to be serialized.
- * @param writer Stream writer to which the infoset is serialized.
- * @throws EncodingException In case of any encoding error.
- */
- void encode(E encodingObject, XMLStreamWriter writer) throws EncodingException;
-
- /**
- * Decodes an XML stream to an object.
- *
- * @param reader XML stream from where the encoded XML is read.
- * @return Encoding object.
- * @throws EncodingException In case of any encoding error.
- */
- E decode(XMLStreamReader reader) throws EncodingException;
-
- /**
- * Gets the qualified name of the XML fragment for the Encoding
- * object.
- *
- * @return Qualified name of the XML fragment.
- */
- QName getEncodingObjectQName();
-
- /**
- * Returns the type of the encoding object.
- *
- * @return Encoding object type.
- */
- Class<E> getEncodingObjectType();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java
deleted file mode 100644
index ee12161903..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("serial")
-public class EncodingException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- /**
- * Initializes the exception message.
- *
- * @param message Message for the exception.
- */
- public EncodingException(String message) {
- super(message);
- }
-
- /**
- * Initializes the root cause.
- *
- * @param cause Root cause for the exception.
- */
- public EncodingException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java
deleted file mode 100644
index bf94da374c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface EncodingObject {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java
deleted file mode 100644
index 92f10cd4b3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface EncodingRegistry {
-
- /**
- * Registers an en/de coder.
- *
- * @param <E> Encoding object type.
- * @param encodingClass Encoding object class.
- * @param qname Qualified name of the root element of the encoded XML.
- * @param enDeCoder Encoding object enDeCoder.
- */
- <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder);
-
- <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname);
-
- /**
- * Encodes an object.
- *
- * @param encodingObject Encoding object to be encoded.
- * @param writer Writer to which encoded information is written.
- */
- void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException;
-
- /**
- * Decodes an XML stream to an encoding object.
- *
- * @param reader Reader from which encoded information is read.
- * @return Encoding object from the encoded stream.
- */
- EncodingObject decode(XMLStreamReader reader) throws EncodingException;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java
deleted file mode 100644
index 264566aae4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.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.binding.notification.encoding;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EncodingUtils {
-
- private static XMLOutputFactory xof = XMLOutputFactory.newInstance();
- private static XMLInputFactory xif = XMLInputFactory.newInstance();
-
- public static void encodeToStream(EncodingRegistry encodingRegistry,
- EncodingObject eo,
- OutputStream os) throws IOUtilsException {
- try {
- XMLStreamWriter writer = xof.createXMLStreamWriter(os);
- encodingRegistry.encode(eo, writer);
- writer.flush();
- writer.close();
- } catch(Exception e) {
- throw new IOUtilsException(e);
- }
- }
-
- public static EncodingObject decodeFromStream(EncodingRegistry encodingRegistry,
- InputStream istream) throws EncodingException {
- EncodingObject eo = null;
- try {
- XMLStreamReader reader = xif.createXMLStreamReader(istream);
- reader.next();
- eo = encodingRegistry.decode(reader);
- reader.close();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
-
- return eo;
- }
-
- public static EndpointReference createEndpointReference(URL address, String brokerID) {
- EndpointAddress epa = new EndpointAddress();
- epa.setAddress(address);
- EndpointReference epr = new EndpointReference();
- epr.setEndpointAddress(epa);
- if (brokerID != null) {
- BrokerID bi = new BrokerID();
- bi.setID(brokerID);
- ReferenceProperties rp = new ReferenceProperties();
- rp.addProperty(bi);
- epr.setReferenceProperties(rp);
- }
- return epr;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java
deleted file mode 100644
index 8066184da9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndConsumers extends EndpointReferenceSequence {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java
deleted file mode 100644
index 5e3afc8195..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndConsumers> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndConsumers);
-
- public EndConsumersEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<EndConsumers> getEncodingObjectType() {
- return EndConsumers.class;
- }
-
- @Override
- protected void encodeSequenceTypeAttribute(EndConsumers encodingObject, XMLStreamWriter writer) throws EncodingException {
- try {
- writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- @Override
- protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
- return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java
deleted file mode 100644
index b43ad5c214..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndProducers extends EndpointReferenceSequence {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java
deleted file mode 100644
index 3840b1caf9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndProducersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndProducers> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndProducers);
-
- public EndProducersEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<EndProducers> getEncodingObjectType() {
- return EndProducers.class;
- }
-
- @Override
- protected void encodeSequenceTypeAttribute(EndProducers encodingObject, XMLStreamWriter writer) throws EncodingException {
- try {
- writer.writeAttribute(Constants.ProducerSequenceType, encodingObject.getSequenceType());
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- @Override
- protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
- return reader.getAttributeValue(null, Constants.ProducerSequenceType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java
deleted file mode 100644
index f2a36d89db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.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.binding.notification.encoding;
-
-import java.net.URL;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointAddress implements EncodingObject {
-
- private URL address;
-
- public URL getAddress() {
- return address;
- }
-
- public void setAddress(URL address) {
- this.address = address;
- }
-
- public void setAddress(String addressText) throws EncodingException {
- try {
- this.address = new URL(addressText);
- } catch(Exception e) {
- throw new EncodingException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java
deleted file mode 100644
index 8195c80c49..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointAddressEnDeCoder extends AbstractEnDeCoder<EndpointAddress> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.Address);
-
- public EndpointAddressEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(EndpointAddress encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
- writer.writeCharacters(encodingObject.getAddress().toString());
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public EndpointAddress decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- EndpointAddress endpointAddressElement = new EndpointAddress();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- break;
- case XMLStreamConstants.CHARACTERS:
- if (reader.hasText()) {
- String address = reader.getText();
- endpointAddressElement.setAddress(address);
- } else {
- throw new EncodingException("Endpoint address is missing address");
- }
- break;
- case END_ELEMENT:
- return endpointAddressElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<EndpointAddress> getEncodingObjectType() {
-
- return EndpointAddress.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java
deleted file mode 100644
index beba8fdc9b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReference implements EncodingObject {
-
- private EndpointAddress endpointAddress;
- private ReferenceProperties referenceProperties;
-
- public EndpointAddress getEndpointAddress() {
- return this.endpointAddress;
- }
-
- public void setEndpointAddress(EndpointAddress endpointAddress) {
- this.endpointAddress = endpointAddress;
- }
-
- public ReferenceProperties getReferenceProperties() {
- return this.referenceProperties;
- }
-
- public void setReferenceProperties(ReferenceProperties referenceProperties) {
- this.referenceProperties = referenceProperties;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java
deleted file mode 100644
index cfc747f59e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReferenceEnDeCoder extends AbstractEnDeCoder<EndpointReference> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.EndpointReference);
-
- public EndpointReferenceEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(EndpointReference encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
- registry.encode(encodingObject.getEndpointAddress(), writer);
- if (encodingObject.getReferenceProperties() != null) {
- registry.encode(encodingObject.getReferenceProperties(), writer);
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public EndpointReference decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- EndpointReference endpointReferenceElement = new EndpointReference();
- boolean haveEPA = false;
- boolean haveRP = false;
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- if (encodingObject instanceof EndpointAddress && !haveEPA) {
- endpointReferenceElement.setEndpointAddress((EndpointAddress)encodingObject);
- haveEPA = true;
- } else if(encodingObject instanceof ReferenceProperties && !haveRP) {
- endpointReferenceElement.setReferenceProperties((ReferenceProperties)encodingObject);
- haveRP = true;
- } else {
- throw new EncodingException("Invalid encoding object");
- }
- break;
- case END_ELEMENT:
- if (!haveEPA) {
- throw new EncodingException("Missing endpoint address");
- }
- return endpointReferenceElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<EndpointReference> getEncodingObjectType() {
-
- return EndpointReference.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java
deleted file mode 100644
index a9c901a431..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReferenceSequence implements EncodingObject {
-
- private List<EndpointReference> referenceSequence;
- private String sequenceType;
-
- public List<EndpointReference> getReferenceSequence() {
- return referenceSequence;
- }
-
- public void addReferenceToSequence(EndpointReference address) {
- if(this.referenceSequence == null) {
- this.referenceSequence = new ArrayList<EndpointReference>();
- }
- this.referenceSequence.add(address);
- }
-
- public void setReferenceSequence(List<EndpointReference> referenceSequence) {
- this.referenceSequence = referenceSequence;
- }
-
- public String getSequenceType() {
- return this.sequenceType;
- }
-
- public void setSequenceType(String sequenceType) {
- this.sequenceType = sequenceType;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java
deleted file mode 100644
index 864de25fd6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class EndpointReferenceSequenceEnDeCoder<ERS extends EndpointReferenceSequence> extends AbstractEnDeCoder<ERS> {
-
- public EndpointReferenceSequenceEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ERS encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- encodeSequenceTypeAttribute(encodingObject, writer);
- if (encodingObject.getReferenceSequence() != null) {
- for (EndpointReference endpointReference : encodingObject.getReferenceSequence()) {
- registry.encode(endpointReference, writer);
- }
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- protected abstract void encodeSequenceTypeAttribute(ERS encodingObject, XMLStreamWriter writer) throws EncodingException;
-
- public ERS decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ERS endpointReferenceSequenceElement = null;
- try {
- endpointReferenceSequenceElement = getEncodingObjectType().newInstance();
- } catch(Exception e) {
- throw new EncodingException(e);
- }
- String sequenceType = decodeSequenceTypeAttribute(reader);
- endpointReferenceSequenceElement.setSequenceType(sequenceType);
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- endpointReferenceSequenceElement.addReferenceToSequence((EndpointReference)encodingObject);
- break;
- case END_ELEMENT:
- return endpointReferenceSequenceElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
- protected abstract String decodeSequenceTypeAttribute(XMLStreamReader reader);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java
deleted file mode 100644
index b3f2c060fb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReferenceWrapper implements EncodingObject {
-
- private EndpointReference reference;
-
- public EndpointReference getReference() {
- return reference;
- }
-
- public void setReference(EndpointReference reference) {
- this.reference = reference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java
deleted file mode 100644
index 979a6e8e34..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class EndpointReferenceWrapperEnDeCoder<ERW extends EndpointReferenceWrapper> extends AbstractEnDeCoder<ERW> {
-
- public EndpointReferenceWrapperEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ERW encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- registry.encode(encodingObject.getReference(), writer);
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public ERW decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ERW endpointReferenceWrapperElement = null;
- try {
- endpointReferenceWrapperElement = getEncodingObjectType().newInstance();
- } catch(Exception e) {
- throw new EncodingException(e);
- }
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- endpointReferenceWrapperElement.setReference((EndpointReference)encodingObject);
- break;
- case END_ELEMENT:
- return endpointReferenceWrapperElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java
deleted file mode 100644
index 902fd823cd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NeighborBrokerConsumers extends EndpointReferenceSequence {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java
deleted file mode 100644
index ad149e3e4f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NeighborBrokerConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NeighborBrokerConsumers> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NeighborBrokerConsumers);
-
- public NeighborBrokerConsumersEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<NeighborBrokerConsumers> getEncodingObjectType() {
- return NeighborBrokerConsumers.class;
- }
-
- @Override
- protected void encodeSequenceTypeAttribute(NeighborBrokerConsumers encodingObject, XMLStreamWriter writer) throws EncodingException {
- try {
- writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- @Override
- protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
- return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java
deleted file mode 100644
index 42f9e74a27..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.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.binding.notification.encoding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Neighbors implements EncodingObject {
-
- private List<Broker> brokerSequence;
-
- public List<Broker> getBrokerSequence() {
- return brokerSequence;
- }
-
- public void addBrokerToSequence(Broker broker) {
- if(this.brokerSequence == null) {
- this.brokerSequence = new ArrayList<Broker>();
- }
- this.brokerSequence.add(broker);
- }
-
- public void setBrokerSequence(List<Broker> brokerSequence) {
- this.brokerSequence = brokerSequence;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java
deleted file mode 100644
index fa05e2d7bd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NeighborsEnDeCoder extends AbstractEnDeCoder<Neighbors> {
-
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Neighbors);
-
- public NeighborsEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(Neighbors encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- if (encodingObject.getBrokerSequence() != null) {
- for (Broker broker : encodingObject.getBrokerSequence()) {
- registry.encode(broker, writer);
- }
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public Neighbors decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- Neighbors neighborsElement = new Neighbors();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- neighborsElement.addBrokerToSequence((Broker)encodingObject);
- break;
- case END_ELEMENT:
- return neighborsElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<Neighbors> getEncodingObjectType() {
-
- return Neighbors.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java
deleted file mode 100644
index 92578af219..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBroker extends AbstractBroker {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java
deleted file mode 100644
index 48c34ba74f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBrokerAck implements EncodingObject {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java
deleted file mode 100644
index c9a3f1da79..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBrokerAckEnDeCoder extends AbstractEnDeCoder<NewBrokerAck> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerAck);
-
- public NewBrokerAckEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(NewBrokerAck encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public NewBrokerAck decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- NewBrokerAck newBrokerAck = new NewBrokerAck();
- while (true) {
- switch (reader.next()) {
- case END_ELEMENT:
- return newBrokerAck;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<NewBrokerAck> getEncodingObjectType() {
-
- return NewBrokerAck.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java
deleted file mode 100644
index 6e57ad41de..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBrokerEnDeCoder extends AbstractBrokerEnDeCoder<NewBroker> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBroker);
-
- public NewBrokerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<NewBroker> getEncodingObjectType() {
-
- return NewBroker.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java
deleted file mode 100644
index 6f34fc0b7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBrokerResponse implements EncodingObject {
-
- private EndProducers endProducers;
- private EndConsumers endConsumers;
- private Brokers brokers;
- private boolean firstBroker;
-
- public EndProducers getEndProducers() {
- return this.endProducers;
- }
-
- public void setEndProducers(EndProducers endProducers) {
- this.endProducers = endProducers;
- }
-
- public EndConsumers getEndConsumers() {
- return this.endConsumers;
- }
-
- public void setEndConsumers(EndConsumers endConsumers) {
- this.endConsumers = endConsumers;
- }
-
- public Brokers getBrokers() {
- return this.brokers;
- }
-
- public void setBrokers(Brokers brokers) {
- this.brokers = brokers;
- }
-
- public boolean isFirstBroker() {
- return this.firstBroker;
- }
-
- public void setFirstBroker(boolean firstBroker) {
- this.firstBroker = firstBroker;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java
deleted file mode 100644
index 2ad969e1a6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewBrokerResponseEnDeCoder extends AbstractEnDeCoder<NewBrokerResponse> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerResponse);
-
- public NewBrokerResponseEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(NewBrokerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- QName qName = getEncodingObjectQName();
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
- writer.writeAttribute(Constants.FirstBroker, String.valueOf(encodingObject.isFirstBroker()));
- if (encodingObject.isFirstBroker()) {
- registry.encode(encodingObject.getEndConsumers(), writer);
- registry.encode(encodingObject.getEndProducers(), writer);
- } else {
- registry.encode(encodingObject.getBrokers(), writer);
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public NewBrokerResponse decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- NewBrokerResponse newBrokerResponseElement = new NewBrokerResponse();
- boolean firstBroker = Boolean.parseBoolean(reader.getAttributeValue(null, Constants.FirstBroker));
- newBrokerResponseElement.setFirstBroker(firstBroker);
- boolean haveEC = false;
- boolean haveEP = false;
- boolean haveB = false;
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- if (encodingObject instanceof EndProducers && !haveEP && firstBroker) {
- newBrokerResponseElement.setEndProducers((EndProducers)encodingObject);
- haveEP = true;
- } else if(encodingObject instanceof EndConsumers && !haveEC && firstBroker) {
- newBrokerResponseElement.setEndConsumers((EndConsumers)encodingObject);
- haveEC = true;
- } else if(encodingObject instanceof Brokers && !haveB && !firstBroker) {
- newBrokerResponseElement.setBrokers((Brokers)encodingObject);
- haveB = true;
- } else {
- throw new EncodingException("Invalid encoding object");
- }
- break;
- case END_ELEMENT:
- if (!haveEP && firstBroker) {
- throw new EncodingException("Missing end producers");
- }
- if (!haveEC && firstBroker) {
- throw new EncodingException("Missing end consumers");
- }
- if (!haveB && !firstBroker) {
- throw new EncodingException("Missing brokers");
- }
- return newBrokerResponseElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<NewBrokerResponse> getEncodingObjectType() {
-
- return NewBrokerResponse.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java
deleted file mode 100644
index a47e1f4e55..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewConsumer extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java
deleted file mode 100644
index 8eac326019..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewConsumerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewConsumer> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumer);
-
- public NewConsumerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<NewConsumer> getEncodingObjectType() {
- return NewConsumer.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java
deleted file mode 100644
index 60fb23be02..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewConsumerResponse extends EndpointReferenceSequence {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java
deleted file mode 100644
index fbcd041621..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewConsumerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewConsumerResponse> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumerResponse);
-
- public NewConsumerResponseEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<NewConsumerResponse> getEncodingObjectType() {
- return NewConsumerResponse.class;
- }
-
- @Override
- protected void encodeSequenceTypeAttribute(NewConsumerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
- try {
- writer.writeAttribute(Constants.ProducerSequenceType, encodingObject.getSequenceType());
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- @Override
- protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
- return reader.getAttributeValue(null, Constants.ProducerSequenceType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java
deleted file mode 100644
index aa9180dcd7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewProducer extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java
deleted file mode 100644
index 38cf9e9467..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewProducerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewProducer> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducer);
-
- public NewProducerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<NewProducer> getEncodingObjectType() {
- return NewProducer.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java
deleted file mode 100644
index 49a4259333..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewProducerResponse extends EndpointReferenceSequence {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java
deleted file mode 100644
index 74d10fe02d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NewProducerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewProducerResponse> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducerResponse);
-
- public NewProducerResponseEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<NewProducerResponse> getEncodingObjectType() {
- return NewProducerResponse.class;
- }
-
- @Override
- protected void encodeSequenceTypeAttribute(NewProducerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
- try {
- writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- @Override
- protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
- return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java
deleted file mode 100644
index 2ee9320f20..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferenceProperties implements EncodingObject {
-
- private List<EncodingObject> properties;
-
- public List<EncodingObject> getProperties() {
- return properties;
- }
-
- public void addProperty(EncodingObject property) {
- if(this.properties == null) {
- this.properties = new ArrayList<EncodingObject>();
- }
- this.properties.add(property);
- }
-
- @SuppressWarnings("unchecked")
- public <E extends EncodingObject> E getProperty(Class<E> propertyType) {
- if (this.properties == null) {
- return null;
- }
- for (EncodingObject eo : properties) {
- if (propertyType.isInstance(eo)) {
- return (E)eo;
- }
- }
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java
deleted file mode 100644
index 9d06dfea97..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferencePropertiesEnDeCoder extends AbstractEnDeCoder<ReferenceProperties> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.ReferenceProperties);
-
- public ReferencePropertiesEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ReferenceProperties encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
- if (encodingObject.getProperties() != null) {
- for (EncodingObject property : encodingObject.getProperties()) {
- registry.encode(property, writer);
- }
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public ReferenceProperties decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ReferenceProperties referencePropertiesElement = new ReferenceProperties();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject property = registry.decode(reader);
- referencePropertiesElement.addProperty(property);
- break;
- case END_ELEMENT:
- return referencePropertiesElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<ReferenceProperties> getEncodingObjectType() {
-
- return ReferenceProperties.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java
deleted file mode 100644
index 39050d158c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RemoveBroker implements EncodingObject {
-
- private BrokerConsumerReference brokerConsumerReference;
- private NeighborBrokerConsumers neighborBrokerConsumers;
-
- public BrokerConsumerReference getBrokerConsumerReference() {
- return this.brokerConsumerReference;
- }
-
- public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
- this.brokerConsumerReference = brokerConsumerReference;
- }
-
- public NeighborBrokerConsumers getNeighborBrokerConsumers() {
- return this.neighborBrokerConsumers;
- }
-
- public void setNeighborBrokerConsumers(NeighborBrokerConsumers neighborBrokerConsumers) {
- this.neighborBrokerConsumers = neighborBrokerConsumers;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java
deleted file mode 100644
index 97834ea0a9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RemoveBrokerEnDeCoder extends AbstractEnDeCoder<RemoveBroker> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemoveBroker);
-
- public RemoveBrokerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(RemoveBroker encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- registry.encode(encodingObject.getBrokerConsumerReference(), writer);
- if (encodingObject.getNeighborBrokerConsumers() != null) {
- registry.encode(encodingObject.getNeighborBrokerConsumers(), writer);
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public RemoveBroker decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- RemoveBroker removeBrokerElement = new RemoveBroker();
- boolean haveBCR = false;
- boolean haveNBC = false;
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- if (encodingObject instanceof BrokerConsumerReference && !haveBCR) {
- removeBrokerElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
- haveBCR = true;
- } else if(encodingObject instanceof NeighborBrokerConsumers && !haveNBC) {
- removeBrokerElement.setNeighborBrokerConsumers((NeighborBrokerConsumers)encodingObject);
- haveNBC = true;
- } else {
- throw new EncodingException("Invalid encoding object");
- }
- break;
- case END_ELEMENT:
- if (!haveBCR) {
- throw new EncodingException("Missing broker consumer reference");
- }
- return removeBrokerElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<RemoveBroker> getEncodingObjectType() {
-
- return RemoveBroker.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java
deleted file mode 100644
index 047c5e9a58..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RemovedBroker extends EndpointReferenceWrapper {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java
deleted file mode 100644
index 25f92c38c2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.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.binding.notification.encoding;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RemovedBrokerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<RemovedBroker> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemovedBroker);
-
- public RemovedBrokerEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
-
- public QName getEncodingObjectQName() {
- return QNAME;
- }
-
-
- public Class<RemovedBroker> getEncodingObjectType() {
- return RemovedBroker.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java
deleted file mode 100644
index 8145c6b170..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReplaceBrokerConnection implements EncodingObject {
-
- private RemovedBroker removedBroker;
- private Neighbors neighbors;
-
- public RemovedBroker getRemovedBroker() {
- return this.removedBroker;
- }
-
- public void setRemovedBroker(RemovedBroker removedBroker) {
- this.removedBroker = removedBroker;
- }
-
- public Neighbors getNeighbors() {
- return this.neighbors;
- }
-
- public void setNeighbors(Neighbors neighbors) {
- this.neighbors = neighbors;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java
deleted file mode 100644
index 000f6690c7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReplaceBrokerConnectionEnDeCoder extends AbstractEnDeCoder<ReplaceBrokerConnection> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ReplaceBrokerConnection);
-
- public ReplaceBrokerConnectionEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(ReplaceBrokerConnection encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- registry.encode(encodingObject.getRemovedBroker(), writer);
- if (encodingObject.getNeighbors() != null) {
- registry.encode(encodingObject.getNeighbors(), writer);
- }
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public ReplaceBrokerConnection decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- ReplaceBrokerConnection replaceBrokerConnectionElement = new ReplaceBrokerConnection();
- boolean haveRB = false;
- boolean haveN = false;
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- if (encodingObject instanceof RemovedBroker && !haveRB) {
- replaceBrokerConnectionElement.setRemovedBroker((RemovedBroker)encodingObject);
- haveRB = true;
- } else if(encodingObject instanceof Neighbors && !haveN) {
- replaceBrokerConnectionElement.setNeighbors((Neighbors)encodingObject);
- haveN = true;
- } else {
- throw new EncodingException("Invalid encoding object");
- }
- break;
- case END_ELEMENT:
- if (!haveRB) {
- throw new EncodingException("Missing removed broker");
- }
- return replaceBrokerConnectionElement;
- }
- }
- } catch (Exception ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<ReplaceBrokerConnection> getEncodingObjectType() {
-
- return ReplaceBrokerConnection.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java
deleted file mode 100644
index aca5c70641..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.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.binding.notification.encoding;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Subscribe implements EncodingObject {
-
- private ConsumerReference consumerReference;
-
- public ConsumerReference getConsumerReference() {
- return consumerReference;
- }
-
- public void setConsumerReference(ConsumerReference consumerReference) {
- this.consumerReference = consumerReference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java
deleted file mode 100644
index 04ee132b3e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.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.binding.notification.encoding;
-
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SubscribeEnDeCoder extends AbstractEnDeCoder<Subscribe> {
-
- // QName for the root element
- public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Subscribe);
-
- public SubscribeEnDeCoder(EncodingRegistry registry) {
- super(registry);
- }
-
- public void encode(Subscribe encodingObject, XMLStreamWriter writer) throws EncodingException {
-
- try {
- writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
- writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
- registry.encode(encodingObject.getConsumerReference(), writer);
- writer.writeEndElement();
- } catch(XMLStreamException e) {
- throw new EncodingException(e);
- }
- }
-
- public Subscribe decode(XMLStreamReader reader) throws EncodingException {
-
- try {
- Subscribe subscribeElement = new Subscribe();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- EncodingObject encodingObject = registry.decode(reader);
- subscribeElement.setConsumerReference((ConsumerReference)encodingObject);
- break;
- case END_ELEMENT:
- return subscribeElement;
- }
- }
- } catch (XMLStreamException ex) {
- throw new EncodingException(ex);
- }
- }
-
-
- public QName getEncodingObjectQName() {
-
- return QNAME;
- }
-
-
- public Class<Subscribe> getEncodingObjectType() {
-
- return Subscribe.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java
deleted file mode 100644
index daac727cb6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.EOFException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public class IOUtils {
-
- // FIXME: For some reason, tomcat converts the header names to be lower case, see TUSCANY-1791
- public static final String Notification_Source = "notification-source";
- public static final String Notification_Target = "notification-target";
- public static final String Notification_Operation = "notification-operation";
-
- public static final int DEF_BLOCK_SIZE = 512;
-
- public static Object sendHttpRequest(URL targetURL,
- String opName,
- Writeable wbody,
- ReadableContinuation rcont) throws Exception {
- if (opName == null) {
- opName = "";
- }
- Map<String, String> headers = new HashMap<String, String>();
- headers.put(Notification_Operation, opName);
- return sendHttpRequest(targetURL, headers, wbody, rcont);
- }
-
- public static Object sendHttpRequest(URL targetURL,
- Map<String, String> headers,
- Writeable wbody,
- ReadableContinuation rcont) throws Exception {
-
- String targetUri = targetURL.toString();
- String sourceUri = "";
-
- final HttpURLConnection con = (HttpURLConnection) targetURL.openConnection();
- con.setRequestMethod("POST");
- //con.setRequestProperty("Content-Length", Integer.toString(sbody.getBytes().length));
- con.setAllowUserInteraction(false);
- con.setInstanceFollowRedirects(false);
- if (targetUri != null) {
- con.setRequestProperty(Notification_Target, targetUri);
- }
-
- if (sourceUri != null) {
- con.setRequestProperty(Notification_Source, sourceUri);
- }
-
- for (String key : headers.keySet()) {
- con.setRequestProperty(key, headers.get(key));
- }
- con.setDoOutput(true);
- con.setDoInput(true);
- con.connect();
- Object response = null;
- try {
- if (wbody != null) {
- OutputStream ost = con.getOutputStream();
- wbody.write(ost);
- } else {
- throw new IOUtilsException("Missing writeable body");
- }
- final int rc = con.getResponseCode();
- switch (rc) {
- case HttpURLConnection.HTTP_OK:
- if (rcont != null) {
- InputStream ist = con.getInputStream();
- response = rcont.read(ist);
- }
- break;
- case HttpURLConnection.HTTP_NO_CONTENT:
- break;
- default:
- throw new RuntimeException("Unexpected response code: " + rc);
- }
- } finally {
- con.disconnect();
- }
- return response;
- }
-
- public interface Writeable {
- void write(OutputStream os) throws IOUtilsException;
- }
-
- public interface ReadableContinuation {
- Object read(InputStream is) throws IOUtilsException;
- }
-
- @SuppressWarnings("serial")
- public static class IOUtilsException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public IOUtilsException(String message) {
- super(message);
- }
-
- public IOUtilsException(Throwable cause) {
- super(cause);
- }
- }
-
- public static byte [] readFully(final InputStream ist, int len) throws IOException {
- ByteArrayOutputStream baost = new ByteArrayOutputStream();
- copyStream(ist,baost,len);
- return baost.toByteArray();
- }
-
- public static int copyStream(final InputStream ist, final OutputStream ost) throws IOException {
- return copyStream(ist, ost, -1, 0);
- }
-
- public static int copyStream(final InputStream ist, final OutputStream ost, int length) throws IOException {
- return copyStream(ist, ost, length, 0);
- }
-
- public static int copyStream(final InputStream ist, final OutputStream ost, final int length, int blockSize) throws IOException {
-
- int cbCopied = 0;
- if (blockSize <= 0) {
- blockSize = DEF_BLOCK_SIZE;
- }
-
- final byte[] block = new byte[blockSize];
- boolean done = length == 0;
- while (!done) {
- try {
- // determine how many bytes to read
- final int cbToRead = length == -1 ? block.length : (Math.min(length - cbCopied, block.length));
- final int cbRead = ist.read(block, 0, cbToRead);
- if (cbRead == -1) {
- done = true;
- } else {
- ost.write(block, 0, cbRead);
- cbCopied += cbRead;
- done = cbCopied == length;
- }
- } catch (final EOFException e) {
- done = true;
- }
- }
- ost.flush();
- return cbCopied;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java
deleted file mode 100644
index f780514eda..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.util;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.ServletInputStream;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-
-/**
- * Receives notification in HTTP request and dispatches it down the wire
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("serial")
-public class NotificationServlet extends HttpServlet {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
- private NotificationServletHandler handler;
- private NotificationServletStreamHandler servletStreamHandler;
-
- public NotificationServlet(NotificationServletHandler handler) {
- this.handler = handler;
- this.servletStreamHandler = null;
- }
-
- public NotificationServlet(NotificationServletStreamHandler servletStreamHandler) {
- this.handler = null;
- this.servletStreamHandler = servletStreamHandler;
- }
-
- @Override
- public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
- HashMap<String, String> headers = new HashMap<String, String>();
- Enumeration headerNames = request.getHeaderNames();
- while (headerNames.hasMoreElements()) {
- String headerName = (String)headerNames.nextElement();
- headers.put(headerName, request.getHeader(headerName));
- }
- if (handler != null) {
- byte[] requestBody = IOUtils.readFully(request.getInputStream(), request.getContentLength());
- byte[] handlersResponse = handler.handle(headers, requestBody);
- if (handlersResponse != null) {
- response.getOutputStream().write(handlersResponse);
- response.getOutputStream().flush();
- }
- } else {
- try {
- servletStreamHandler.handle(headers, request.getInputStream(), request.getContentLength(), response.getOutputStream());
- } catch(RuntimeException e) {
- e.printStackTrace();
- }
- }
- }
-
- public interface NotificationServletHandler {
- byte[] handle(Map<String, String> headers, byte[] payload);
- }
-
- public interface NotificationServletStreamHandler {
- void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java b/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java
deleted file mode 100644
index 42ccd5cdac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.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.binding.notification.util;
-
-import java.net.URI;
-
-/**
- * @version $Rev$ $Date$
- */
-public class URIUtil {
-
- public static String getPath(URI uri) {
- String path = null;
-
- if (uri.isOpaque()) {
- path = "/" + uri.getSchemeSpecificPart();
- } else if (uri.isAbsolute()) {
- path = uri.getPath();
- } else {
- path = "/" + uri.getPath();
- }
-
- return path;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 5e5ce97054..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.binding.notification.NotificationBindingModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java b/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.java
deleted file mode 100644
index 3d328339a7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/AxiomTestCase.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.binding.notification.encoding;
-
-import java.io.ByteArrayInputStream;
-import java.io.StringWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.junit.Assert;
-
-public class AxiomTestCase extends TestCase {
-
- private static String wsnt = "http://docs.oasis-open.org/wsn/b-2";
- private static String wsa = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
- private static String testUrl1 = "http://localhost:8081/test";
- private static String testUrl2 = "http://localhost:8082/test";
- private static String testNewProducerResponse =
- "<wsnt:NewProducerResponse xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "</wsnt:NewProducerResponse>";
-
- public void testAxiom() {
- try {
- StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(testNewProducerResponse.getBytes()));
- OMElement element = builder.getDocumentElement();
- Assert.assertNotNull(element);
-
- StringWriter sw = new StringWriter();
- element.serialize(sw);
- sw.flush();
- Assert.assertEquals(sw.toString(),testNewProducerResponse);
- } catch(Throwable e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java b/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java
deleted file mode 100644
index 3dcd2b9b00..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-notification/src/test/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingTestCase.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.notification.encoding;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Iterator;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EncodingTestCase extends TestCase {
-
- private static String wsnt = "http://docs.oasis-open.org/wsn/b-2";
- private static String wsa = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
- private static String testUrl = "http://localhost:8080/test";
- private static String testUrl1 = "http://localhost:8081/test";
- private static String testUrl2 = "http://localhost:8082/test";
- private static String bid1 = "UUID1";
- private static String bid2 = "UUID2";
- private static String testSubscribe =
- "<wsnt:Subscribe xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:ConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "</wsnt:ConsumerReference>" +
- "</wsnt:Subscribe>";
- private static String testNewConsumerResponse =
- "<wsnt:NewConsumerResponse xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"EndProducers\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "</wsnt:NewConsumerResponse>";
- private static String testNewProducerResponse =
- "<wsnt:NewProducerResponse xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "</wsnt:NewProducerResponse>";
- private static String testNoProducersResponse =
- "<wsnt:NewConsumerResponse xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"NoProducers\" />";
- private static String testNewBroker =
- "<wsnt:NewBroker xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerConsumerReference>" +
- "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerProducerReference>" +
- "</wsnt:NewBroker>";
- private static String testNewBrokerResponse1 =
- "<wsnt:NewBrokerResponse xmlns:wsnt=\"" + wsnt + "\" FirstBroker=\"true\">" +
- "<wsnt:EndConsumers xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"EndConsumers\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "</wsnt:EndConsumers>" +
- "<wsnt:EndProducers xmlns:wsnt=\"" + wsnt + "\" ProducerSequenceType=\"NoProducers\" />" +
- "</wsnt:NewBrokerResponse>";
- private static String testNewBrokerResponse2 =
- "<wsnt:NewBrokerResponse xmlns:wsnt=\"" + wsnt + "\" FirstBroker=\"false\">" +
- "<wsnt:Brokers xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:Broker xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerConsumerReference>" +
- "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerProducerReference>" +
- "</wsnt:Broker>" +
- "</wsnt:Brokers>" +
- "</wsnt:NewBrokerResponse>";
- private static String testRemoveBroker =
- "<wsnt:RemoveBroker xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerConsumerReference>" +
- "<wsnt:NeighborBrokerConsumers xmlns:wsnt=\"" + wsnt + "\" ConsumerSequenceType=\"BrokerConsumers\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "</wsa:EndpointReference>" +
- "</wsnt:NeighborBrokerConsumers>" +
- "</wsnt:RemoveBroker>";
- private static String testReplaceBrokerConnection =
- "<wsnt:ReplaceBrokerConnection xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:RemovedBroker xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:RemovedBroker>" +
- "<wsnt:Neighbors xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:Broker xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsnt:BrokerConsumerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl1 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid1 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerConsumerReference>" +
- "<wsnt:BrokerProducerReference xmlns:wsnt=\"" + wsnt + "\">" +
- "<wsa:EndpointReference xmlns:wsa=\"" + wsa + "\">" +
- "<wsa:Address xmlns:wsa=\"" + wsa + "\">" + testUrl2 + "</wsa:Address>" +
- "<wsa:ReferenceProperties xmlns:wsa=\"" + wsa + "\">" +
- "<wsnt:BrokerID xmlns:wsnt=\"" + wsnt + "\">" + bid2 + "</wsnt:BrokerID>" +
- "</wsa:ReferenceProperties>" +
- "</wsa:EndpointReference>" +
- "</wsnt:BrokerProducerReference>" +
- "</wsnt:Broker>" +
- "</wsnt:Neighbors>" +
- "</wsnt:ReplaceBrokerConnection>";
-
- public void testSubscribe() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- SubscribeEnDeCoder sed = new SubscribeEnDeCoder(der);
- sed.start();
- ConsumerReferenceEnDeCoder cred = new ConsumerReferenceEnDeCoder(der);
- cred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testSubscribe));
- reader.next();
- Subscribe subscribe = (Subscribe)der.decode(reader);
- Assert.assertEquals(subscribe.getConsumerReference().getReference().getEndpointAddress().getAddress().toString(), testUrl);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(subscribe, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testSubscribe);
- }
-
- public void testNewConsumerResponse() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewConsumerResponseEnDeCoder ncred = new NewConsumerResponseEnDeCoder(der);
- ncred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewConsumerResponse));
- reader.next();
- NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
- Assert.assertEquals(newConsumerResponse.getSequenceType(), "EndProducers");
- Assert.assertEquals(newConsumerResponse.getReferenceSequence().iterator().next().getEndpointAddress().getAddress().toString(),
- testUrl);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newConsumerResponse, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNewConsumerResponse);
- }
-
- public void testNoProducersResponse() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewConsumerResponseEnDeCoder ncred = new NewConsumerResponseEnDeCoder(der);
- ncred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNoProducersResponse));
- reader.next();
- NewConsumerResponse newConsumerResponse = (NewConsumerResponse)der.decode(reader);
- Assert.assertEquals(newConsumerResponse.getSequenceType(), "NoProducers");
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newConsumerResponse, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNoProducersResponse);
- }
-
- public void testNewProducerResponse() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewProducerResponseEnDeCoder npred = new NewProducerResponseEnDeCoder(der);
- npred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewProducerResponse));
- reader.next();
- NewProducerResponse newProducerResponse = (NewProducerResponse)der.decode(reader);
- Assert.assertEquals(newProducerResponse.getSequenceType(), "EndConsumers");
- Iterator<EndpointReference> it = newProducerResponse.getReferenceSequence().iterator();
- it.next();
- Assert.assertEquals(it.next().getEndpointAddress().getAddress().toString(), testUrl2);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newProducerResponse, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNewProducerResponse);
- }
-
- public void testNewBroker() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewBrokerEnDeCoder nbed = new NewBrokerEnDeCoder(der);
- nbed.start();
- BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
- bcred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
- ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
- rped.start();
- BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
- bied.start();
- BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
- bpred.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBroker));
- reader.next();
- NewBroker newBroker = (NewBroker)der.decode(reader);
- Assert.assertEquals(newBroker.getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl1);
- Assert.assertEquals(newBroker.getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl2);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newBroker, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNewBroker);
- }
-
- public void testNewBrokerRespnse1() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewBrokerResponseEnDeCoder nbred = new NewBrokerResponseEnDeCoder(der);
- nbred.start();
- EndProducersEnDeCoder epred = new EndProducersEnDeCoder(der);
- epred.start();
- EndConsumersEnDeCoder ecred = new EndConsumersEnDeCoder(der);
- ecred.start();
- EndpointReferenceEnDeCoder ered = new EndpointReferenceEnDeCoder(der);
- ered.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBrokerResponse1));
- reader.next();
- NewBrokerResponse newBrokerResponse = (NewBrokerResponse)der.decode(reader);
- Assert.assertFalse(!newBrokerResponse.isFirstBroker());
- Assert.assertEquals(newBrokerResponse.getEndProducers().getSequenceType(), "NoProducers");
- Assert.assertEquals(newBrokerResponse.getEndConsumers().getSequenceType(), "EndConsumers");
- Assert.assertEquals(newBrokerResponse.getEndConsumers().getReferenceSequence().get(0).getEndpointAddress().getAddress().toString(),
- testUrl1);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newBrokerResponse, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNewBrokerResponse1);
- }
-
- public void testNewBrokerRespnse2() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- NewBrokerResponseEnDeCoder nbred = new NewBrokerResponseEnDeCoder(der);
- nbred.start();
- BrokersEnDeCoder bsed = new BrokersEnDeCoder(der);
- bsed.start();
- BrokerEnDeCoder bed = new BrokerEnDeCoder(der);
- bed.start();
- BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
- bcred.start();
- BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
- bpred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
- ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
- rped.start();
- BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
- bied.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testNewBrokerResponse2));
- reader.next();
- NewBrokerResponse newBrokerResponse = (NewBrokerResponse)der.decode(reader);
- Assert.assertFalse(newBrokerResponse.isFirstBroker());
- Assert.assertEquals(newBrokerResponse.getBrokers().getBrokerSequence().get(0)
- .getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl1);
- Assert.assertEquals(newBrokerResponse.getBrokers().getBrokerSequence().get(0)
- .getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl2);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(newBrokerResponse, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testNewBrokerResponse2);
- }
-
- public void testRemoveBroker() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- RemoveBrokerEnDeCoder rbed = new RemoveBrokerEnDeCoder(der);
- rbed.start();
- BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
- bcred.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
- ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
- rped.start();
- BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
- bied.start();
- NeighborBrokerConsumersEnDeCoder nbced = new NeighborBrokerConsumersEnDeCoder(der);
- nbced.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testRemoveBroker));
- reader.next();
- RemoveBroker removeBroker = (RemoveBroker)der.decode(reader);
- Assert.assertEquals(removeBroker.getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl);
- NeighborBrokerConsumers neighborBrokerConsumers = removeBroker.getNeighborBrokerConsumers();
- Assert.assertEquals(neighborBrokerConsumers.getSequenceType(), "BrokerConsumers");
- Iterator<EndpointReference> it = neighborBrokerConsumers.getReferenceSequence().iterator();
- it.next();
- Assert.assertEquals(it.next().getEndpointAddress().getAddress().toString(), testUrl2);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(removeBroker, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testRemoveBroker);
- }
-
- public void testReplaceBrokerConnection() throws Exception {
- DefaultEncodingRegistry der = new DefaultEncodingRegistry();
- ReplaceBrokerConnectionEnDeCoder rbced = new ReplaceBrokerConnectionEnDeCoder(der);
- rbced.start();
- RemovedBrokerEnDeCoder rbed = new RemovedBrokerEnDeCoder(der);
- rbed.start();
- EndpointReferenceEnDeCoder epred = new EndpointReferenceEnDeCoder(der);
- epred.start();
- EndpointAddressEnDeCoder eaed = new EndpointAddressEnDeCoder(der);
- eaed.start();
- ReferencePropertiesEnDeCoder rped = new ReferencePropertiesEnDeCoder(der);
- rped.start();
- BrokerIDEnDeCoder bied = new BrokerIDEnDeCoder(der);
- bied.start();
- BrokerEnDeCoder bed = new BrokerEnDeCoder(der);
- bed.start();
- BrokerConsumerReferenceEnDeCoder bcred = new BrokerConsumerReferenceEnDeCoder(der);
- bcred.start();
- BrokerProducerReferenceEnDeCoder bpred = new BrokerProducerReferenceEnDeCoder(der);
- bpred.start();
- NeighborsEnDeCoder nced = new NeighborsEnDeCoder(der);
- nced.start();
-
- XMLInputFactory xif = XMLInputFactory.newInstance();
- XMLStreamReader reader = xif.createXMLStreamReader(new StringReader(testReplaceBrokerConnection));
- reader.next();
- ReplaceBrokerConnection replaceBrokerConnection = (ReplaceBrokerConnection)der.decode(reader);
- Assert.assertEquals(replaceBrokerConnection.getRemovedBroker().getReference().getEndpointAddress().getAddress().toString(),
- testUrl);
- Neighbors neighbors = replaceBrokerConnection.getNeighbors();
- Assert.assertEquals(neighbors.getBrokerSequence().get(0)
- .getBrokerConsumerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl1);
- Assert.assertEquals(neighbors.getBrokerSequence().get(0)
- .getBrokerProducerReference().getReference().getEndpointAddress().getAddress().toString(),
- testUrl2);
-
- XMLOutputFactory xof = XMLOutputFactory.newInstance();
- StringWriter testWriter = new StringWriter();
- XMLStreamWriter writer = xof.createXMLStreamWriter(testWriter);
- der.encode(replaceBrokerConnection, writer);
- writer.flush();
- String encoded = testWriter.toString();
- Assert.assertEquals(encoded, testReplaceBrokerConnection);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/LICENSE b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/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-java-1.5.1/modules/binding-rmi-runtime/NOTICE b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/pom.xml b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/pom.xml
deleted file mode 100644
index 8f0e6f2aca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/pom.xml
+++ /dev/null
@@ -1,99 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-rmi-runtime</artifactId>
- <name>Apache Tuscany SCA RMI Binding Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rmi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-rmi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rmi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.rmi*</Export-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingProviderFactory.java
deleted file mode 100644
index 746aa4dac1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIBindingProviderFactory.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.binding.rmi.provider;
-
-import org.apache.tuscany.sca.binding.rmi.RMIBinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.rmi.ExtensibleRMIHost;
-import org.apache.tuscany.sca.host.rmi.RMIHost;
-import org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- *
- */
-public class RMIBindingProviderFactory implements BindingProviderFactory<RMIBinding> {
- private RMIHost rmiHost;
-
- public RMIBindingProviderFactory(ExtensionPointRegistry registry) {
- super();
- RMIHostExtensionPoint hosts = registry.getExtensionPoint(RMIHostExtensionPoint.class);
- rmiHost = new ExtensibleRMIHost(hosts);
- }
-
- public Class<RMIBinding> getModelType() {
- return RMIBinding.class;
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- RMIBinding binding) {
- return new RMIReferenceBindingProvider(component, reference, binding, rmiHost);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- RMIBinding binding) {
- return new RMIServiceBindingProvider(component, service, binding, rmiHost);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java
deleted file mode 100644
index d09ea1f903..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.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.binding.rmi.provider;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.binding.rmi.RMIBinding;
-import org.apache.tuscany.sca.host.rmi.RMIHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * InvokerFactory that creates RMIReferenceInvoker instances for the
- * RMIBinding.
- *
- * @version $Rev$ $Date$
- */
-public class RMIReferenceBindingProvider implements ReferenceBindingProvider {
- private RuntimeComponentReference reference;
- private RMIHost rmiHost;
- private RMIBinding binding;
-
- public RMIReferenceBindingProvider(RuntimeComponent rc, RuntimeComponentReference rcr, RMIBinding binding, RMIHost rmiHost) {
- this.reference = rcr;
- this.rmiHost = rmiHost;
- this.binding = binding;
- }
-
- public Invoker createInvoker(Operation operation) {
- try {
-
- Class<?> iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
- Method remoteMethod = JavaInterfaceUtil.findMethod(iface, operation);
-
- return new RMIReferenceInvoker(rmiHost, binding.getHost(), binding.getPort(), binding.getServiceName(), remoteMethod);
-
- } catch (NoSuchMethodException e) {
- throw new ServiceRuntimeException(operation.toString(), e);
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceInvoker.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceInvoker.java
deleted file mode 100644
index d300cb7d05..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceInvoker.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.binding.rmi.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-
-import org.apache.tuscany.sca.host.rmi.RMIHost;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-
-/**
- * Invoker for RMI References.
- *
- * @version $Rev$ $Date$
- */
-public class RMIReferenceInvoker implements Invoker, DataExchangeSemantics {
-
- private RMIHost rmiHost;
- private String host;
- private String port;
- private String svcName;
- private Method remoteMethod;
- private Remote proxy;
-
- public RMIReferenceInvoker(RMIHost rmiHost, String host, String port, String svcName, Method remoteMethod) {
- this.rmiHost = rmiHost;
- this.remoteMethod = remoteMethod;
- this.host = host;
- this.port = port;
- this.svcName = svcName;
- }
-
- public Message invoke(Message msg) {
- try {
-
- Object[] args = msg.getBody();
- Object resp = invokeTarget(args);
- msg.setBody(resp);
-
- } catch (InvocationTargetException e) {
- msg.setFaultBody(e.getCause());
- } catch (Throwable e) {
- msg.setFaultBody(e);
- }
-
- return msg;
- }
-
- public Object invokeTarget(final Object payload) throws InvocationTargetException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException {
- if (proxy == null) {
- proxy = rmiHost.findService(host, port, svcName);
- // proxy = Naming.lookup(serviceURI);
- }
-
- remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(), remoteMethod.getParameterTypes());
-
- if (payload != null && !payload.getClass().isArray()) {
- return remoteMethod.invoke(proxy, payload);
- } else {
- return remoteMethod.invoke(proxy, (Object[])payload);
- }
- }
-
- public boolean allowsPassByReference() {
- // RMI always pass by value
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.java
deleted file mode 100644
index c237654c74..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIServiceBindingProvider.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.binding.rmi.provider;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.rmi.Remote;
-import java.rmi.server.UnicastRemoteObject;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import net.sf.cglib.asm.ClassWriter;
-import net.sf.cglib.asm.Type;
-import net.sf.cglib.core.Constants;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.apache.tuscany.sca.binding.rmi.RMIBinding;
-import org.apache.tuscany.sca.host.rmi.RMIHost;
-import org.apache.tuscany.sca.host.rmi.RMIHostException;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Implementation of a Service for the RMIBinding.
- *
- * @version $Rev$ $Date$
- */
-public class RMIServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private RMIBinding binding;
- private RMIHost rmiHost;
- private RuntimeWire wire;
-
- public RMIServiceBindingProvider(RuntimeComponent rc, RuntimeComponentService rcs, RMIBinding binding, RMIHost rmiHost) {
- this.component = rc;
- this.service = rcs;
- this.binding = binding;
- this.rmiHost = rmiHost;
- }
-
- public void start() {
- // URI uri = URI.create(component.getURI() + "/" + binding.getName());
- // binding.setURI(uri.toString());
-
- wire = service.getRuntimeWire(binding);
- Interface serviceInterface = service.getInterfaceContract().getInterface();
-
- Remote rmiProxy = createRmiService(serviceInterface);
-
- try {
-
- rmiHost.registerService(binding.getServiceName(), getPort(binding.getPort()), rmiProxy);
-
- } catch (RMIHostException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public void stop() {
- rmiHost.unregisterService(binding.getServiceName(), getPort(binding.getPort()));
- }
-
- protected int getPort(String port) {
- int portNumber = RMIHost.RMI_DEFAULT_PORT;
- if (port != null && port.length() > 0) {
- portNumber = Integer.decode(port);
- if (portNumber == -1) {
- portNumber = RMIHost.RMI_DEFAULT_PORT;
- }
- }
- return portNumber;
- }
-
- protected Remote createRmiService(final Interface serviceInterface) {
- Enhancer enhancer = new Enhancer();
- enhancer.setSuperclass(UnicastRemoteObject.class);
- enhancer.setCallback(new MethodInterceptor() {
- public Object intercept(Object arg0, Method method, Object[] args, MethodProxy arg3) throws Throwable {
- try {
- return invokeTarget(JavaInterfaceUtil.findOperation(method, serviceInterface.getOperations()), args);
- } catch (InvocationTargetException e) {
- final Throwable cause = e.getCause();
- for (Class<?> declaredType : method.getExceptionTypes()) {
- if (declaredType.isInstance(cause)) {
- throw e;
- }
- }
-
- if (cause.getCause() != null) {
- // TUSCANY-2545: don't inlcude nested cause object
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- Field field = Throwable.class.getDeclaredField("cause");
- field.setAccessible(true);
- field.set(cause, null);
- field.setAccessible(false);
- return null;
- }
- });
- }
-
- throw cause;
- }
- }
- });
- Class targetJavaInterface = getTargetJavaClass(serviceInterface);
- if (!Remote.class.isAssignableFrom(targetJavaInterface)) {
- RMIServiceClassLoader classloader = new RMIServiceClassLoader(targetJavaInterface.getClassLoader());
- final byte[] byteCode = generateRemoteInterface(targetJavaInterface);
- targetJavaInterface = classloader.defineClass(targetJavaInterface.getName(), byteCode);
- enhancer.setClassLoader(classloader);
- }
- enhancer.setInterfaces(new Class[] {targetJavaInterface});
- return (Remote)enhancer.create();
- }
-
- protected Object invokeTarget(Operation op, Object[] args) throws InvocationTargetException {
- return wire.invoke(op, args);
- }
-
- /**
- * if the interface of the component whose serviceBindings must be exposed as RMI Service, does not
- * implement java.rmi.Remote, then generate such an interface. This method will stop with just
- * generating the bytecode. Defining the class from the byte code must be the responsibility of the
- * caller of this method, since it requires a ClassLoader to be created to define and load this interface.
- */
- protected byte[] generateRemoteInterface(Class serviceInterface) {
- String interfazeName = serviceInterface.getName();
- ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
-
- String simpleName = serviceInterface.getSimpleName();
- cw.visit(Constants.V1_5, Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT + Constants.ACC_INTERFACE, interfazeName
- .replace('.', '/'), null, "java/lang/Object", new String[] {"java/rmi/Remote"});
-
- StringBuffer argsAndReturn = null;
- Method[] methods = serviceInterface.getMethods();
- for (Method method : methods) {
- argsAndReturn = new StringBuffer("(");
- Class[] paramTypes = method.getParameterTypes();
- Class returnType = method.getReturnType();
-
- for (Class paramType : paramTypes) {
- argsAndReturn.append(Type.getType(paramType));
- }
- argsAndReturn.append(")");
- argsAndReturn.append(Type.getType(returnType));
-
- cw.visitMethod(Constants.ACC_PUBLIC + Constants.ACC_ABSTRACT,
- method.getName(),
- argsAndReturn.toString(),
- null,
- new String[] {"java/rmi/RemoteException"});
- }
- cw.visitEnd();
- return cw.toByteArray();
- }
-
- protected Class<?> getTargetJavaClass(Interface targetInterface) {
- // TODO: right now assume that the target is always a Java
- // Implementation. Need to figure out
- // how to generate Java Interface in cases where the target is not a
- // Java Implementation
- return ((JavaInterface)targetInterface).getJavaClass();
- }
-
- protected class RMIServiceClassLoader extends ClassLoader {
- public RMIServiceClassLoader(ClassLoader parent) {
- super(parent);
- }
-
- public Class<?> defineClass(String name, byte[] byteArray) {
- return super.defineClass(name, byteArray, 0, byteArray.length);
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index b188c24a20..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.rmi.provider.RMIBindingProviderFactory;model=org.apache.tuscany.sca.binding.rmi.RMIBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloException.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloException.java
deleted file mode 100644
index cbc860ecc6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package helloworld;
-
-/**
- * @version $Rev$ $Date$
- */
-public class HelloException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = 2570611055132507470L;
-
- /**
- *
- */
- public HelloException() {
- }
-
- /**
- * @param message
- */
- public HelloException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public HelloException(Throwable cause) {
- super(cause);
- }
-
- /**
- * @param message
- * @param cause
- */
- public HelloException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldImpl.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldImpl.java
deleted file mode 100644
index 0a1f4283db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldImpl.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 helloworld;
-
-import org.osoa.sca.annotations.Service;
-
-
-/**
- * This class implements the HelloWorld service.
- *
- * @version $Rev$ $Date$
- */
-@Service(HelloWorldService.class)
-public class HelloWorldImpl implements HelloWorldService {
-
- public String sayHello(String name) {
- return "Hello from the RMI Service to - " + name;
- }
-
- public String sayHi(String name, String greeter) throws HelloException {
- if (name == null || greeter == null) {
- throw new HelloException("Invalid name or greeter: name=" + name + " greeter=" + greeter);
- }
- return "Hi from " + greeter + " in RMI Service to - " + name;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiImpl.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiImpl.java
deleted file mode 100644
index 5b20d17c83..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package helloworld;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-
-/**
- * This class implements the HelloWorld service.
- *
- * @version $Rev$ $Date$
- */
-@Service(HelloWorldRmiService.class)
-public class HelloWorldRmiImpl implements HelloWorldRmiService {
- private HelloWorldService extService;
-
- public HelloWorldService getExtService() {
- return extService;
- }
-
- @Reference
- public void setExtService(HelloWorldService extService) {
- this.extService = extService;
- }
-
- public String sayRmiHello(String name) {
- return extService.sayHello(name) + " thro the RMI Reference";
- }
-
- public String sayRmiHi(String name, String greeter) throws HelloException {
- return extService.sayHi(name, greeter) + " thro the RMI Reference";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiService.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiService.java
deleted file mode 100644
index 461c176e1e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldRmiService.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 helloworld;
-
-/**
- * This is the business interface of the HelloWorld greetings service.
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorldRmiService {
-
- String sayRmiHello(String name);
- String sayRmiHi(String name, String greeter) throws HelloException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldService.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldService.java
deleted file mode 100644
index 3b705d2c97..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/helloworld/HelloWorldService.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 helloworld;
-
-/**
- * This is the business interface of the HelloWorld greetings service.
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorldService {
-
- String sayHello(String name);
- String sayHi(String name, String greeter) throws HelloException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java
deleted file mode 100644
index a3c4ae4010..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/java/org/apache/tuscany/sca/binding/rmi/BindingTestCase.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.rmi;
-
-import helloworld.HelloException;
-import helloworld.HelloWorldRmiService;
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Tests for the RMIBinding.
- *
- * @version $Rev$ $Date$
- */
-public class BindingTestCase {
- private static HelloWorldRmiService helloWorldRmiService;
- private static SCANode node;
-
- @Test
- public void testRmiService() {
- String msg = helloWorldRmiService.sayRmiHello("Tuscany World!");
- System.out.println(msg);
- Assert.assertEquals("Hello from the RMI Service to - Tuscany World! thro the RMI Reference", msg);
-
- try {
- msg = helloWorldRmiService.sayRmiHi("Tuscany World!", "Apache World");
- System.out.println(msg);
- Assert.assertEquals("Hi from Apache World in RMI Service to - Tuscany World! thro the RMI Reference", msg);
- } catch (HelloException e) {
- Assert.fail(e.getMessage());
- }
- try {
- msg = helloWorldRmiService.sayRmiHi(null, "Apache World");
- Assert.fail("HelloException should have been thrown");
- } catch (HelloException e) {
- System.out.println("Expected exception :" + e.getClass().getName());
- }
- }
-
- @BeforeClass
- public static void init() throws Exception {
- try {
- node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("RMIBindingTest.composite", BindingTestCase.class.getClassLoader());
- node.start();
- helloWorldRmiService = ((SCAClient) node).getService(HelloWorldRmiService.class, "HelloWorldRmiServiceComponent");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- node.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldImpl.componentType b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldImpl.componentType
deleted file mode 100644
index 224a68f88d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldImpl.componentType
+++ /dev/null
@@ -1,23 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service name="HelloWorldService">
- <interface.java interface="helloworld.HelloWorldService"/>
- </service>
-</componentType>
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldRmiImpl.componentType b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldRmiImpl.componentType
deleted file mode 100644
index a83e7e6d1d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/HelloWorldRmiImpl.componentType
+++ /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.
--->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <service name="HelloWorldRmiService">
- <interface.java interface="helloworld.HelloWorldRmiService"/>
- </service>
- <reference name="extService">
- <interface.java interface="helloworld.HelloWorldService"/>
- </reference>
-</componentType>
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite b/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/RMIBindingTest.composite
deleted file mode 100644
index 65aec1681d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi-runtime/src/test/resources/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 uri="rmi://localhost:8099/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-java-1.5.1/modules/binding-rmi/LICENSE b/branches/sca-java-1.5.1/modules/binding-rmi/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/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-java-1.5.1/modules/binding-rmi/NOTICE b/branches/sca-java-1.5.1/modules/binding-rmi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/pom.xml b/branches/sca-java-1.5.1/modules/binding-rmi/pom.xml
deleted file mode 100644
index e46036d6bf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/pom.xml
+++ /dev/null
@@ -1,93 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-rmi</artifactId>
- <name>Apache Tuscany SCA RMI Binding Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-rmi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rmi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.rmi*</Export-Package>
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.java
deleted file mode 100644
index 4ef3822b5b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBinding.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.binding.rmi;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * RMI Binding model
- */
-public interface RMIBinding extends Binding {
-
- /**
- * @return the host name of the RMI Service
- */
- String getHost();
-
- /**
- * @return the port number for the RMI Service
- */
- String getPort();
-
- /**
- * @return returns the RMI Service Name
- */
- String getServiceName();
-
- /**
- * @param rmiHostName the hostname of the RMI Service
- */
- void setHost(String rmiHostName);
-
- /**
- * @param rmiPort the port number for the RMI Service
- */
- void setPort(String rmiPort);
-
- /**
- * Sets the service name for the RMI Server
- *
- * @param rmiServiceName the name of the RMI service
- */
- void setServiceName(String rmiServiceName);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.java
deleted file mode 100644
index ecfd45def3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/RMIBindingFactory.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.binding.rmi;
-
-/**
- * Factory to create RMIBinding instances
- */
-public interface RMIBindingFactory {
- /**
- * Create RMIBinding model
- * @return
- */
- RMIBinding createRMIBinding();
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingFactoryImpl.java
deleted file mode 100644
index 547fc633a8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingFactoryImpl.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.rmi.impl;
-
-import org.apache.tuscany.sca.binding.rmi.RMIBinding;
-import org.apache.tuscany.sca.binding.rmi.RMIBindingFactory;
-
-/**
- *
- */
-public class RMIBindingFactoryImpl implements RMIBindingFactory {
- public RMIBinding createRMIBinding() {
- // TODO Auto-generated method stub
- return new RMIBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingImpl.java
deleted file mode 100644
index 4acb9783f5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/java/org/apache/tuscany/sca/binding/rmi/impl/RMIBindingImpl.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.rmi.impl;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.tuscany.sca.binding.rmi.RMIBinding;
-
-/**
- * Represents a binding to an RMI service.
- *
- * @version $Rev$ $Date$
- */
-public class RMIBindingImpl implements RMIBinding {
- private String name;
- private String uri;
- private String host;
- private String port;
- private String serviceName;
-
- /**
- * @return the host name of the RMI Service
- */
- public String getHost() {
- return host;
- }
-
- /**
- * @param rmiHostName the hostname of the RMI Service
- */
- public void setHost(String rmiHostName) {
- this.host = rmiHostName;
- }
-
- /**
- * @return the port number for the RMI Service
- */
- public String getPort() {
- return port;
- }
-
- /**
- * @param rmiPort the port number for the RMI Service
- */
- public void setPort(String rmiPort) {
- this.port = rmiPort;
- }
-
- /**
- * @return returns the RMI Service Name
- */
- public String getServiceName() {
- return serviceName;
- }
-
- /**
- * Sets the service name for the RMI Server
- *
- * @param rmiServiceName the name of the RMI service
- */
- public void setServiceName(String rmiServiceName) {
- this.serviceName = rmiServiceName;
- }
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- compose();
- return uri;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- parse(uri);
- }
-
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The sample binding is always resolved
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- /*
- rmi://[host][:port][/[object]]
- rmi:[/][object]
- */
- private void parse(String uriStr) {
- if (uriStr == null) {
- return;
- }
- URI uri = URI.create(uriStr);
- if (host == null) {
- this.host = uri.getHost();
- }
- if (port == null) {
- this.port = String.valueOf(uri.getPort());
- }
- if (serviceName == null) {
- String path = uri.getPath();
- if (path != null && path.charAt(0) == '/') {
- path = path.substring(1);
- }
- this.serviceName = path;
- }
- }
-
- private void compose() {
- if (uri == null) {
- int p = -1;
- if (port != null && port.length() > 0) {
- p = Integer.decode(port);
- }
- String path = serviceName;
- if (path != null) {
- path = "/" + path;
- }
- try {
- uri = new URI("rmi", null, host, p, path, null, null).toString();
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException(e);
- }
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rmi.RMIBindingFactory b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rmi.RMIBindingFactory
deleted file mode 100644
index 889fcafae2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rmi.RMIBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.binding.rmi.impl.RMIBindingFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index d628701a7f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.rmi,model=org.apache.tuscany.sca.binding.rmi.RMIBinding,factory=org.apache.tuscany.sca.binding.rmi.RMIBindingFactory
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/LICENSE b/branches/sca-java-1.5.1/modules/binding-rss-rome/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/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-java-1.5.1/modules/binding-rss-rome/NOTICE b/branches/sca-java-1.5.1/modules/binding-rss-rome/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/pom.xml b/branches/sca-java-1.5.1/modules/binding-rss-rome/pom.xml
deleted file mode 100644
index 997417d63c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/pom.xml
+++ /dev/null
@@ -1,171 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-rss-rome</artifactId>
- <name>Apache Tuscany SCA RSS Feed Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-rss</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>rome</groupId>
- <artifactId>rome</artifactId>
- <version>0.9</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rss.rome</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.rss*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java
deleted file mode 100644
index ed86dc4848..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/Collection.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.rss.collection;
-
-import org.osoa.sca.annotations.Remotable;
-
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndFeed;
-
-
-/**
- * Provides access to a collection of resources using RSS.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Collection {
-
- /**
- * Get an RSS feed for a collection of resources.
- *
- * @return the RSS feed
- */
- SyndFeed getFeed();
-
- /**
- * Get an RSS feed for a collection of resources resulting from a query.
- *
- * @param queryString the query string
- * @return the RSS feed
- */
- SyndFeed query(String queryString);
-
- /**
- * Retrieves an RSS entry.
- *
- * @param id The entry ID
- * @return The requested entry
- * @throws NotFoundException No entry found with the given ID
- */
- SyndEntry get(String id) throws NotFoundException;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.java
deleted file mode 100644
index 2213b50b53..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/MediaCollection.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.binding.rss.collection;
-
-import java.io.InputStream;
-
-import org.osoa.sca.annotations.Remotable;
-
-import com.sun.syndication.feed.atom.Entry;
-
-/**
- * Provides access to a collection of resources using Atom.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface MediaCollection extends Collection {
-
- /**
- * Creates a new media entry
- *
- * @param title
- * @param slug
- * @param contentType
- * @param media
- */
- Entry postMedia(String title, String slug, String contentType, InputStream media);
-
- /**
- * Update a media entry.
- *
- * @param id
- * @param contentType
- * @param media
- * @return
- */
- void putMedia(String id, String contentType, InputStream media) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.java
deleted file mode 100644
index 0912878938..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/collection/NotFoundException.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.binding.rss.collection;
-
-/**
- * Indicates that a resource could not be found.
- *
- * @version $Rev$ $Date$
- */
-public class NotFoundException extends Exception {
- private static final long serialVersionUID = -5046027674128627383L;
-
- public NotFoundException() {
- }
-
- public NotFoundException(String message) {
- super(message);
- }
-
- public NotFoundException(Throwable cause) {
- super(cause);
- }
-
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java
deleted file mode 100644
index e3a177198c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingInvoker.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.rss.provider;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.io.FeedException;
-import com.sun.syndication.io.SyndFeedInput;
-import com.sun.syndication.io.XmlReader;
-
-/**
- * Invoker for the RSS binding.
- *
- * @version $Rev$ $Date$
- */
-class RSSBindingInvoker implements Invoker , DataExchangeSemantics {
- private static final Logger logger = Logger.getLogger(RSSBindingInvoker.class.getName());
-
- private String uri;
-
- RSSBindingInvoker(String uri, String feedType) {
- this.uri = uri;
- }
-
- public Message invoke(Message msg) {
- try {
- logger.fine("invoke " + uri);
-
- // Read an RSS feed into a Synd feed
- SyndFeedInput input = new SyndFeedInput();
- SyndFeed feed = input.build(new XmlReader(new URL(uri)));
-
- //FIXME Support conversion to data-api entries
-
- msg.setBody(feed);
-
- } catch (MalformedURLException e) {
- msg.setFaultBody(e);
- } catch (IllegalArgumentException e) {
- msg.setFaultBody(e);
- } catch (FeedException e) {
- msg.setFaultBody(e);
- } catch (IOException e) {
- msg.setFaultBody(e);
- }
- return msg;
- }
-
- public boolean allowsPassByReference() {
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java
deleted file mode 100644
index 96493a5150..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingListenerServlet.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.rss.provider;
-
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.logging.Logger;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndContentImpl;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndEntryImpl;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.feed.synd.SyndFeedImpl;
-import com.sun.syndication.feed.synd.SyndLink;
-import com.sun.syndication.feed.synd.SyndLinkImpl;
-import com.sun.syndication.io.FeedException;
-import com.sun.syndication.io.SyndFeedOutput;
-
-/**
- * An RSS binding listener, implemented as a Servlet and
- * registered in a Servlet host provided by the SCA hosting runtime.
- *
- * @version $Rev$ $Date$
- */
-class RSSBindingListenerServlet extends HttpServlet {
- private static final Logger logger = Logger.getLogger(RSSBindingListenerServlet.class.getName());
- private static final long serialVersionUID = 1L;
-
- private RuntimeWire wire;
- private Invoker getFeedInvoker;
- private Invoker getAllInvoker;
- private Invoker queryInvoker;
- private MessageFactory messageFactory;
- private Mediator mediator;
- private DataType<?> itemClassType;
- private DataType<?> itemXMLType;
- private boolean supportsFeedEntries;
-
- /**
- * Constructs a new binding listener.
- *
- * @param wire
- * @param messageFactory
- */
- RSSBindingListenerServlet(RuntimeWire wire, MessageFactory messageFactory, Mediator mediator) {
- this.wire = wire;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
-
- // Get the invokers for the supported operations
- Operation getOperation = null;
- for (InvocationChain invocationChain : this.wire.getInvocationChains()) {
- invocationChain.setAllowsPassByReference(true);
- Operation operation = invocationChain.getTargetOperation();
- String operationName = operation.getName();
- if (operationName.equals("getFeed")) {
- getFeedInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("getAll")) {
- getAllInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("query")) {
- queryInvoker = invocationChain.getHeadInvoker();
- } else if (operationName.equals("get")) {
- getOperation = operation;
- }
- }
-
- // Determine the collection item type
- if (getOperation != null) {
- itemXMLType = new DataTypeImpl<Class<?>>(String.class.getName(), String.class, String.class);
- Class<?> itemClass = getOperation.getOutputType().getPhysical();
- if (itemClass == SyndEntry.class) {
- supportsFeedEntries = true;
- }
- DataType<XMLType> outputType = getOperation.getOutputType();
- QName qname = outputType.getLogical().getElementName();
- qname = new QName(qname.getNamespaceURI(), itemClass.getSimpleName());
- itemClassType = new DataTypeImpl<XMLType>("java:complexType", itemClass, new XMLType(qname, null));
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // No authentication required for a get request
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
-
- logger.fine("get " + request.getRequestURI());
-
- // Handle an RSS request
- if (path == null || path.length() == 0 || path.equals("/")) {
-
- // Return an RSS feed containing the entries in the collection
- SyndFeed feed = null;
- if (supportsFeedEntries) {
-
- // The service implementation supports feed entries, invoke its getFeed operation
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage = getFeedInvoker.invoke(requestMessage);
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- feed = (SyndFeed)responseMessage.getBody();
-
- } else {
-
- // The service implementation does not support feed entries, invoke its
- // getAll operation to get the data item collection. then create feed entries
- // from the data items
- Message requestMessage = messageFactory.createMessage();
- Message responseMessage;
- if (request.getQueryString() != null) {
- requestMessage.setBody(new Object[] {request.getQueryString()});
- responseMessage = queryInvoker.invoke(requestMessage);
- } else {
- responseMessage = getAllInvoker.invoke(requestMessage);
- }
- if (responseMessage.isFault()) {
- throw new ServletException((Throwable)responseMessage.getBody());
- }
- org.apache.tuscany.sca.data.collection.Entry<Object, Object>[] collection =
- (org.apache.tuscany.sca.data.collection.Entry<Object, Object>[])responseMessage.getBody();
- if (collection != null) {
- // Create the feed
- feed = new SyndFeedImpl();
- feed.setTitle("Feed");
- feed.setDescription("Feed description");
-
- for (org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry: collection) {
- SyndEntry feedEntry = createFeedEntry(entry);
- feed.getEntries().add(feedEntry);
- }
- }
- }
-
- // Convert to an RSS feed
- if (feed != null) {
- response.setContentType("application/rss+xml; charset=utf-8");
- feed.setFeedType("rss_2.0");
- feed.setLink(path);
- SyndFeedOutput syndOutput = new SyndFeedOutput();
- try {
- syndOutput.output(feed, getWriter(response));
- } catch (FeedException e) {
- throw new ServletException(e);
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
-
- }
-
- /**
- * Create an RSS entry from a data collection entry.
- * @param entry
- * @return
- */
- private SyndEntry createFeedEntry(org.apache.tuscany.sca.data.collection.Entry<Object, Object> entry) {
- Object key = entry.getKey();
- Object data = entry.getData();
- if (data instanceof Item) {
- Item item = (Item)data;
-
- SyndEntry feedEntry = new SyndEntryImpl();
- feedEntry.setUri(key.toString());
- feedEntry.setTitle(item.getTitle());
-
- String value = item.getContents();
- if (value != null) {
- SyndContent content = new SyndContentImpl();
- content.setType("text/xml");
- content.setValue(value);
- List<SyndContent> contents = new ArrayList<SyndContent>();
- contents.add(content);
- feedEntry.setContents(contents);
- }
-
- String href = item.getLink();
- if (href == null) {
- href = key.toString();
- }
- SyndLink link = new SyndLinkImpl();
- link.setRel("edit");
- link.setHref(href);
- feedEntry.getLinks().add(link);
- link = new SyndLinkImpl();
- link.setRel("alternate");
- link.setHref(href);
- feedEntry.getLinks().add(link);
- feedEntry.setLink(href);
-
- Date date = item.getDate();
- if (date == null) {
- date = new Date();
- }
- feedEntry.setPublishedDate(date);
- return feedEntry;
-
- } else if (data != null) {
- SyndEntry feedEntry = new SyndEntryImpl();
- feedEntry.setUri(key.toString());
- feedEntry.setTitle("item");
-
- // Convert the item to XML
- String value = mediator.mediate(data, itemClassType, itemXMLType, null).toString();
-
- SyndContent content = new SyndContentImpl();
- content.setType("text/xml");
- content.setValue(value);
- List<SyndContent> contents = new ArrayList<SyndContent>();
- contents.add(content);
- feedEntry.setContents(contents);
-
- SyndLink link = new SyndLinkImpl();
- link.setRel("edit");
- link.setHref(key.toString());
- feedEntry.getLinks().add(link);
- link = new SyndLinkImpl();
- link.setRel("alternate");
- link.setHref(key.toString());
- feedEntry.getLinks().add(link);
-
- feedEntry.setPublishedDate(new Date());
- return feedEntry;
- } else {
- return null;
- }
- }
-
- /**
- * Create a data collection entry from an RSS entry.
- * @param feedEntry
- * @return
- */
- private org.apache.tuscany.sca.data.collection.Entry<Object, Object> createEntry(SyndEntry feedEntry) {
- if (feedEntry != null) {
- if (itemClassType.getPhysical() == Item.class) {
- String key = feedEntry.getUri();
-
- Item item = new Item();
- item.setTitle(feedEntry.getTitle());
-
- List<?> contents = feedEntry.getContents();
- if (!contents.isEmpty()) {
- SyndContent content = (SyndContent)contents.get(0);
- String value = content.getValue();
- item.setContents(value);
- }
-
- for (Object l : feedEntry.getLinks()) {
- SyndLink link = (SyndLink)l;
- if (link.getRel() == null || "edit".equals(link.getRel())) {
- String href = link.getHref();
- if (href.startsWith("null/")) {
- href = href.substring(5);
- }
- item.setLink(href);
- break;
- }
- }
-
- item.setDate(feedEntry.getPublishedDate());
-
- return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, item);
-
- } else {
- String key = feedEntry.getUri();
-
- // Create the item from XML
- List<?> contents = feedEntry.getContents();
- if (contents.isEmpty()) {
- return null;
- }
- SyndContent content = (SyndContent)contents.get(0);
- String value = content.getValue();
- Object data = mediator.mediate(value, itemXMLType, itemClassType, null);
-
- return new org.apache.tuscany.sca.data.collection.Entry<Object, Object>(key, data);
- }
- } else {
- return null;
- }
- }
-
-
- private Writer getWriter(HttpServletResponse response) throws UnsupportedEncodingException, IOException {
- Writer writer = new OutputStreamWriter(response.getOutputStream(), "UTF-8");
- return writer;
- }
-
- /**
- * Process the authorization header
- *
- * @param request
- * @return
- * @throws ServletException
- */
- private String processAuthorizationHeader(HttpServletRequest request) throws ServletException {
- try {
- String authorization = request.getHeader("Authorization");
- if (authorization != null) {
- StringTokenizer tokens = new StringTokenizer(authorization);
- if (tokens.hasMoreTokens()) {
- String basic = tokens.nextToken();
- if (basic.equalsIgnoreCase("Basic")) {
- String credentials = tokens.nextToken();
- String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
- int colon = userAndPassword.indexOf(":");
- if (colon != -1) {
- String user = userAndPassword.substring(0, colon);
- String password = userAndPassword.substring(colon + 1);
-
- // Authenticate the User.
- if (authenticate(user, password)) {
- return user;
- }
- }
- }
- }
- }
- } catch (Exception e) {
- throw new ServletException(e);
- }
- return null;
- }
-
- /**
- * Authenticate a user.
- *
- * @param user
- * @param password
- * @return
- */
- private boolean authenticate(String user, String password) {
-
- // TODO Handle this using SCA security policies
- //FIXME Why are we using endsWith instead of equals here??
- return ("admin".endsWith(user) && "admin".equals(password));
- }
-
- /**
- * Reject an unauthorized request.
- *
- * @param response
- */
- private void unauthorized(HttpServletResponse response) throws IOException {
- response.setHeader("WWW-Authenticate", "BASIC realm=\"Tuscany\"");
- response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.java
deleted file mode 100644
index d588f041db..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSBindingProviderFactory.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.binding.rss.provider;
-
-import org.apache.tuscany.sca.binding.rss.RSSBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Implementation of the RSS binding provider factory.
- *
- * @version $Rev$ $Date$
- */
-public class RSSBindingProviderFactory implements BindingProviderFactory<RSSBinding> {
-
- private MessageFactory messageFactory;
- private Mediator mediator;
- private ServletHost servletHost;
-
- public RSSBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- RSSBinding binding) {
- return new RSSReferenceBindingProvider(component, reference, binding);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- RSSBinding binding) {
- return new RSSServiceBindingProvider(component, service, binding, servletHost, messageFactory, mediator);
- }
-
- public Class<RSSBinding> getModelType() {
- return RSSBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java
deleted file mode 100644
index 8a30e9d3fb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSReferenceBindingProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.rss.provider;
-
-import org.apache.tuscany.sca.binding.rss.RSSBinding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * Implementation of the RSS binding provider.
- *
- * @version $Rev$ $Date$
- */
-class RSSReferenceBindingProvider implements ReferenceBindingProvider {
-
- private RuntimeComponentReference reference;
- private RSSBinding binding;
-
- RSSReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- RSSBinding binding) {
- this.reference = reference;
- this.binding = binding;
- }
-
- public Invoker createInvoker(Operation operation) {
- return new RSSBindingInvoker(binding.getURI(), "rss_2.0");
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java
deleted file mode 100644
index 4e5429ac83..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/java/org/apache/tuscany/sca/binding/rss/provider/RSSServiceBindingProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.rss.provider;
-
-import org.apache.tuscany.sca.binding.rss.RSSBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of the RSS binding provider.
- *
- * @version $Rev$ $Date$
- */
-class RSSServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeComponentService service;
- private RSSBinding binding;
- private ServletHost servletHost;
- private MessageFactory messageFactory;
- private String servletMapping;
- private Mediator mediator;
-
- RSSServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- RSSBinding binding,
- ServletHost servletHost,
- MessageFactory messageFactory,
- Mediator mediator) {
- this.service = service;
- this.binding = binding;
- this.servletHost = servletHost;
- this.messageFactory = messageFactory;
- this.mediator = mediator;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return service.getInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- RuntimeComponentService componentService = (RuntimeComponentService)service;
- RuntimeWire wire = componentService.getRuntimeWire(binding);
-
- RSSBindingListenerServlet servlet =
- new RSSBindingListenerServlet(wire, messageFactory, mediator);
-
- servletMapping = binding.getURI();
- servletHost.addServletMapping(servletMapping, servlet);
-
- // Save the actual binding URI in the binding
- binding.setURI(servletHost.getURLMapping(binding.getURI()).toString());
- }
-
- public void stop() {
- servletHost.removeServletMapping(servletMapping);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index e60dc2855a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.rss.provider.RSSBindingProviderFactory;model=org.apache.tuscany.sca.binding.rss.RSSBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.java
deleted file mode 100644
index 19370285f5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Consumer.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.binding.rss;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Consumer {
-
- public static void main(String[] args) throws Exception {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Consumer.composite");
-
- CustomerClient testService = scaDomain.getService(CustomerClient.class, "CustomerClient");
- testService.testCustomerCollection();
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java
deleted file mode 100644
index af87155f45..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClient.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.rss;
-
-public interface CustomerClient {
-
- void testCustomerCollection() throws Exception;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.java
deleted file mode 100644
index e71156c379..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerClientImpl.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.binding.rss;
-
-import org.apache.tuscany.sca.binding.rss.collection.Collection;
-import org.osoa.sca.annotations.Reference;
-
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndFeed;
-
-
-public class CustomerClientImpl implements CustomerClient {
-
- @Reference
- public Collection resourceCollection;
-
- public void testCustomerCollection() throws Exception {
-
- System.out.println(">>> get collection");
- SyndFeed feed = resourceCollection.getFeed();
- System.out.println("<<< get collection");
- for (Object o : feed.getEntries()) {
- SyndEntry e = (SyndEntry)o;
- System.out.println("id = " + e.getUri() + " entry = " + e.getTitle());
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.java
deleted file mode 100644
index 02d73ab3ae..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/CustomerCollectionImpl.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.binding.rss;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.tuscany.sca.binding.rss.collection.Collection;
-import org.apache.tuscany.sca.binding.rss.collection.NotFoundException;
-import org.osoa.sca.annotations.Scope;
-
-import com.sun.syndication.feed.synd.SyndContent;
-import com.sun.syndication.feed.synd.SyndContentImpl;
-import com.sun.syndication.feed.synd.SyndEntry;
-import com.sun.syndication.feed.synd.SyndEntryImpl;
-import com.sun.syndication.feed.synd.SyndFeed;
-import com.sun.syndication.feed.synd.SyndFeedImpl;
-import com.sun.syndication.feed.synd.SyndLink;
-import com.sun.syndication.feed.synd.SyndLinkImpl;
-
-@Scope("COMPOSITE")
-public class CustomerCollectionImpl implements Collection {
-
- private Map<String, SyndEntry> entries = new HashMap<String, SyndEntry>();
-
- public CustomerCollectionImpl() {
-
- for (int i = 0; i < 4; i++) {
- String id = "urn:uuid:customer-" + UUID.randomUUID().toString();
-
- SyndEntry entry = new SyndEntryImpl();
- entry.setTitle("customer " + "Jane Doe_" + String.valueOf(i));
- entry.setUri(id);
-
- SyndContent content = new SyndContentImpl();
- content.setValue("Jane Doe_" + String.valueOf(i));
- content.setType("text");
- entry.setContents(Collections.singletonList(content));
-
- List<SyndLink> links = new ArrayList<SyndLink>();
- SyndLink link = new SyndLinkImpl();
- link.setRel("edit");
- link.setHref("" + id);
- links.add(link);
- entry.setLinks(links);
-
- links = new ArrayList<SyndLink>();
- link = new SyndLinkImpl();
- link.setRel("alternate");
- link.setHref("" + id);
- links.add(link);
- entry.setLinks(links);
-
- entry.setPublishedDate(new Date());
-
- entries.put(id, entry);
- System.out.println(">>> id=" + id);
- }
- }
-
- public SyndFeed getFeed() {
- System.out.println(">>> CustomerCollectionImpl.getFeed");
-
- SyndFeed feed = new SyndFeedImpl();
- feed.setTitle("customers");
- feed.setDescription("This is a sample feed");
- feed.getEntries().addAll(entries.values());
- return feed;
- }
-
- public SyndFeed query(String queryString) {
- System.out.println(">>> CustomerCollectionImpl.query");
-
- SyndFeed feed = new SyndFeedImpl();
- feed.setTitle("customers");
- feed.setDescription("This is a sample feed");
- feed.getEntries().addAll(entries.values());
- return feed;
- }
-
- /**
- * {@inheritDoc}
- */
- public SyndEntry get(String id) throws NotFoundException {
- final SyndEntry entry = entries.get(id);
- if (id == null) {
- throw new NotFoundException("No entry found with ID " + id);
- }
-
- return entry;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.java
deleted file mode 100644
index ae7b72834e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/Provider.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.binding.rss;
-
-import java.io.IOException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class Provider {
-
- public static void main(String[] args) {
-
- SCADomain scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/feed/Provider.composite");
- System.out.println("Provider.composite ready...");
-
- try {
- System.in.read();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- scaDomain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.java
deleted file mode 100644
index cb5c280211..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/java/org/apache/tuscany/sca/binding/rss/RSSGetTestCase.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.binding.rss;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Basic test case that will get the feed entries from an RSS feed.
- */
-public class RSSGetTestCase {
- protected static SCADomain scaConsumerDomain;
- protected static SCADomain scaProviderDomain;
- protected static CustomerClient testService;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println(">>>RSSGetTestCase.init entry");
- scaProviderDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/rss/Provider.composite");
- scaConsumerDomain = SCADomain.newInstance("org/apache/tuscany/sca/binding/rss/Consumer.composite");
- testService = scaConsumerDomain.getService(CustomerClient.class, "CustomerClient");
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- // System.out.println(">>>RSSGetTestCase.destroy entry");
- if (scaConsumerDomain != null) {
- scaConsumerDomain.close();
- }
- if (scaProviderDomain != null) {
- scaProviderDomain.close();
- }
- }
-
- @Test
- public void testPrelim() throws Exception {
- Assert.assertNotNull(scaProviderDomain);
- Assert.assertNotNull(scaConsumerDomain);
- Assert.assertNotNull(testService);
- }
-
- @Test
- public void testRSSGet() throws Exception {
- testService.testCustomerCollection();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite
deleted file mode 100644
index 48ab6b94b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Consumer.composite
+++ /dev/null
@@ -1,32 +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"
- targetNamespace="http://customer"
- name="Consumer">
-
- <component name="CustomerClient">
- <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerClientImpl"/>
- <reference name="resourceCollection">
- <tuscany:binding.rss uri="http://localhost:8084/customer"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite b/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite
deleted file mode 100644
index 45718dfedb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss-rome/src/test/resources/org/apache/tuscany/sca/binding/rss/Provider.composite
+++ /dev/null
@@ -1,33 +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"
- targetNamespace = "http://customer"
- name="Provider">
-
- <service name="customer" promote="CustomerCollection">
- <tuscany:binding.rss uri = "http://localhost:8084/customer"/>
- </service>
-
- <component name="CustomerCollection">
- <implementation.java class="org.apache.tuscany.sca.binding.rss.CustomerCollectionImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/LICENSE b/branches/sca-java-1.5.1/modules/binding-rss/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/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-java-1.5.1/modules/binding-rss/NOTICE b/branches/sca-java-1.5.1/modules/binding-rss/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/pom.xml b/branches/sca-java-1.5.1/modules/binding-rss/pom.xml
deleted file mode 100644
index a55c30c490..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/pom.xml
+++ /dev/null
@@ -1,98 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-rss</artifactId>
- <name>Apache Tuscany SCA RSS Feed Binding Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.rss</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.rss*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java b/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.java
deleted file mode 100644
index 2b4989264c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBinding.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.binding.rss;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * RSS Feed binding model.
- */
-public interface RSSBinding extends Binding {
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.java
deleted file mode 100644
index 3e691e636e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/RSSBindingFactory.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.binding.rss;
-
-/**
- * Factory for the RSS binding
- *
- * @version $Rev$ $Date$
- */
-public interface RSSBindingFactory {
-
- /**
- * Creates a new RSS binding.
- * @return the new RSS binding
- */
- RSSBinding createRSSBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.java
deleted file mode 100644
index a4e6a8283d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingFactoryImpl.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.binding.rss.impl;
-
-import org.apache.tuscany.sca.binding.rss.RSSBinding;
-import org.apache.tuscany.sca.binding.rss.RSSBindingFactory;
-
-/**
- * Factory for the RSS binding model.
- *
- * @version $Rev$ $Date$
- */
-public class RSSBindingFactoryImpl implements RSSBindingFactory {
-
- public RSSBinding createRSSBinding() {
- return new RSSBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.java
deleted file mode 100644
index 6158752e7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/java/org/apache/tuscany/sca/binding/rss/impl/RSSBindingImpl.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.binding.rss.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.rss.RSSBinding;
-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;
-
-/**
- * Implementation of the RSS Feed binding model.
- */
-class RSSBindingImpl implements RSSBinding, PolicySetAttachPoint {
-
- private String name;
- private String uri;
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- 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 boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The binding is always resolved
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory b/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory
deleted file mode 100644
index 73c47a3f41..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.rss.RSSBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the model factory
-org.apache.tuscany.sca.binding.rss.impl.RSSBindingFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 2d0597ff01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-rss/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#binding.rss,model=org.apache.tuscany.sca.binding.rss.RSSBinding,factory=org.apache.tuscany.sca.binding.rss.RSSBindingFactory
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/LICENSE b/branches/sca-java-1.5.1/modules/binding-sca-axis2/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/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-java-1.5.1/modules/binding-sca-axis2/NOTICE b/branches/sca-java-1.5.1/modules/binding-sca-axis2/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/pom.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/pom.xml
deleted file mode 100644
index 1a261cf97a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/pom.xml
+++ /dev/null
@@ -1,103 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-sca-axis2</artifactId>
- <name>Apache Tuscany SCA Axis2-based Default Binding Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-axis2</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-endpoint</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.sca.axis2</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.sca.axis2*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
deleted file mode 100644
index e4bb708a01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.sca.axis2.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.osoa.sca.ServiceUnavailableException;
-
-
-/**
- * A wrapper for the Axis2BindingInvoker that ensures that the URL of the target
- * service is correct by looking it up in the service registry if it is not provided
- *
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCABindingInvoker implements Interceptor {
-
- private static final Logger logger = Logger.getLogger(Axis2SCABindingInvoker.class.getName());
-
- private Invoker axis2Invoker;
- private Axis2SCAReferenceBindingProvider provider;
-
- public Axis2SCABindingInvoker(Axis2SCAReferenceBindingProvider provider, Invoker axis2Invoker) {
- this.axis2Invoker = axis2Invoker;
- this.provider = provider;
- }
-
- public void setNext(Invoker next) {
- }
-
- public Invoker getNext() {
- return null;
- }
-
- /**
- * Fix up the URL for the message. The "to" EndPoint comes from the wire
- * target and needs to be replaced with the endpoint from the registry.
- * The default URL for an Endpoint URI where there is no
- * target component or service information, as in the case of a
- * wire crossing a node boundary, is "/"
- */
- public Message invoke(Message msg) {
-
- // make sure that the epr of the target service is set in the TO
- // field of the message
- EndpointReference to = msg.getTo();
-
- // check to see if we either don't have an endpoint set or if the URI
- // is dynamic or the target service is marked as unresolved
- if ((to == null) || (to.getURI().equals("/") || (to.getContract() == null) || (to.getContract().isUnresolved()))) {
-
- EndpointReference eprTo = provider.getServiceEndpoint();
-
- if ( (eprTo == null) || (eprTo.getURI() == null)) {
- throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
- + " can't be found for component: "
- + provider.getComponent().getName()
- + " reference: "
- + provider.getComponentReference().getName());
- }
- msg.setTo(eprTo);
- }
-
- // make sure that the epr of the callback service (if there is one) is set
- // in the callbackReference field of the message.
- EndpointReference callbackEPR = msg.getFrom().getReferenceParameters().getCallbackReference();
-
- if ((callbackEPR == null) || (callbackEPR.getURI().equals("/"))) {
-
- callbackEPR = provider.getCallbackEndpoint();
-
- if (callbackEPR != null) {
- msg.getFrom().getReferenceParameters().setCallbackReference(callbackEPR);
- }
- }
-
- // do the axis2 stuff
- return axis2Invoker.invoke(msg);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.java
deleted file mode 100644
index b105696b5d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingProviderFactory.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.binding.sca.axis2.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The factory for the Axis2 based implementation of the distributed sca binding
- *
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
-
- private ExtensionPointRegistry extensionPoints;
- private List<PolicyHandlerTuple> policyHandlerClassnames = null;
-
- public Axis2SCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- DistributedSCABinding binding) {
- return new Axis2SCAReferenceBindingProvider(component, reference, binding,
- extensionPoints, policyHandlerClassnames);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- DistributedSCABinding binding) {
- return new Axis2SCAServiceBindingProvider(component, service, binding,
- extensionPoints, policyHandlerClassnames);
- }
-
- public Class<DistributedSCABinding> getModelType() {
- return DistributedSCABinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
deleted file mode 100644
index 48d65cb735..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAReferenceBindingProvider.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.axis2.impl;
-
-import java.net.URI;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.axis2.Axis2ReferenceBindingProvider;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * The reference binding provider for the remote sca binding implementation. Relies on the
- * binding-ws-axis implementation for sending messages to remote services to this provider
- * just uses the ws-axis provider.
- *
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCAReferenceBindingProvider implements ReferenceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(Axis2SCAReferenceBindingProvider.class.getName());
-
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private SCABinding binding;
- private Axis2ReferenceBindingProvider axisReferenceBindingProvider;
- private WebServiceBinding wsBinding;
-
- private EndpointReference serviceEPR = null;
- private EndpointReference callbackEPR = null;
-
- public Axis2SCAReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- DistributedSCABinding binding,
- ExtensionPointRegistry extensionPoints,
- List<PolicyHandlerTuple> policyHandlerClassnames) {
-
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- ServletHost servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
-
- this.component = component;
- this.reference = reference;
- this.binding = binding.getSCABinding();
- wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
- wsBinding.setName(this.binding.getName());
-
- // Turn the java interface contract into a WSDL interface contract
- BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, extensionPoints, null);
-
- // Set to use the Axiom data binding
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- contract.getInterface().resetDataBinding(OMElement.class.getName());
-
- axisReferenceBindingProvider = new Axis2ReferenceBindingProvider(component,
- reference,
- wsBinding,
- modelFactories,
- policyHandlerClassnames,
- dataBindings);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsBinding.getBindingInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public Invoker createInvoker(Operation operation) {
- return new Axis2SCABindingInvoker(this, axisReferenceBindingProvider.createInvoker(operation));
- }
-
- /**
- * Uses the distributed domain service discovery feature to locate remote
- * service endpoints
- *
- * @return An EPR for the target service that this reference refers to
- */
- public EndpointReference getServiceEndpoint(){
-
- if (serviceEPR == null){
- String endpointURL = null;
-
- if (binding.getURI() != null) {
- // check if the binding URI is already resolved if it is use is if not
- try {
- URI uri = new URI(binding.getURI());
- if (uri.isAbsolute()) {
- endpointURL = binding.getURI();
- }
- } catch(Exception ex) {
- // do nothing
- }
- }
-
- serviceEPR = new EndpointReferenceImpl(endpointURL);
- }
-
- return serviceEPR;
- }
-
-
- /**
- * Retrieves the URI of the callback service (that this reference has created)
- * returns null if there is no callback service for the sca binding
- *
- * @return the callback endpoint
- */
- public EndpointReference getCallbackEndpoint(){
- if (callbackEPR == null) {
- if (reference.getCallbackService() != null) {
- for (Binding callbackBinding : reference.getCallbackService().getBindings()) {
- if (callbackBinding instanceof SCABinding) {
- callbackEPR = new EndpointReferenceImpl(reference.getName() + "/" + callbackBinding.getName());
- continue;
- }
- }
- }
- }
- return callbackEPR;
- }
-
-
- public SCABinding getSCABinding () {
- return binding;
- }
-
- public RuntimeComponent getComponent () {
- return component;
- }
-
- public RuntimeComponentReference getComponentReference () {
- return reference;
- }
-
- public void start() {
- axisReferenceBindingProvider.start();
- }
-
- public void stop() {
- axisReferenceBindingProvider.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
deleted file mode 100644
index 0450d07071..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceBindingProvider.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.axis2.impl;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * The service binding provider for the remote sca binding implementation. Relies on the
- * binding-ws-axis implementation for providing a remote message endpoint for this service
- *
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCAServiceBindingProvider implements ServiceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(Axis2SCAServiceBindingProvider.class.getName());
-
- private SCABinding binding;
- private Axis2ServiceProvider axisProvider;
- private WebServiceBinding wsBinding;
-
- private boolean started = false;
-
-
- public Axis2SCAServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- DistributedSCABinding binding,
- ExtensionPointRegistry extensionPoints,
- List<PolicyHandlerTuple> policyHandlerClassnames) {
-
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- ServletHost servletHost = servletHosts.getServletHosts().get(0);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
- DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
-
- this.binding = binding.getSCABinding();
- wsBinding = modelFactories.getFactory(WebServiceBindingFactory.class).createWebServiceBinding();
- wsBinding.setName(this.binding.getName());
- wsBinding.setURI(this.binding.getURI());
-
- // Turn the java interface contract into a WSDL interface contract
- BindingWSDLGenerator.generateWSDL(component, service, wsBinding, extensionPoints, null);
-
- // Set to use the Axiom data binding
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- contract.getInterface().resetDataBinding(OMElement.class.getName());
-
- axisProvider = new Axis2SCAServiceProvider(component,
- service,
- this.binding,
- wsBinding,
- servletHost,
- messageFactory,
- policyHandlerClassnames,
- workScheduler);
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsBinding.getBindingInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- if (started) {
- return;
- } else {
- started = true;
- }
-
- axisProvider.start();
- }
-
- public void stop() {
- if (!started) {
- return;
- } else {
- started = false;
- }
-
- axisProvider.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.java
deleted file mode 100644
index dd66415cca..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCAServiceProvider.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.binding.sca.axis2.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceProvider;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * A specialization of the Axis2BindingProvider that just switches in the SCABinding model
- * element when it is required. The SCABinding is required as the service binding provider
- * finds the service wire based in the binding
- *
- * @version $Rev: 563772 $ $Date: 2007-08-08 07:50:49 +0100 (Wed, 08 Aug 2007) $
- */
-public class Axis2SCAServiceProvider extends Axis2ServiceProvider {
-
- private SCABinding binding;
-
- /**
- * Switch in the fake ws binding
- *
- * @param component
- * @param service
- * @param binding
- * @param wsBinding
- * @param servletHost
- * @param messageFactory
- */
- public Axis2SCAServiceProvider(RuntimeComponent component,
- RuntimeComponentService service,
- SCABinding binding,
- WebServiceBinding wsBinding,
- ServletHost servletHost,
- MessageFactory messageFactory,
- List<PolicyHandlerTuple> policyHandlerClassnames,
- WorkScheduler workScheduler) {
-
- super(component,
- service,
- wsBinding,
- servletHost,
- messageFactory,
- policyHandlerClassnames,
- workScheduler);
-
- this.binding = binding;
- }
-
- /**
- * Return the sca binding as wires will be registered against this rather
- * than against the wsBinding that the Axis2SCAServiceProvider is
- * expecting
- *
- * @return the binding
- */
- @Override
- protected Binding getBinding(){
- return binding;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 1b369cde06..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.sca.axis2.impl.Axis2SCABindingProviderFactory;model=org.apache.tuscany.sca.binding.sca.DistributedSCABinding
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java
deleted file mode 100644
index 40d64be9b1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/AsynchTestCase.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.sca.axis2;
-
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class AsynchTestCase {
-
- public static TestNode nodeA;
- public static TestNode nodeB;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println("Setting up nodes");
-
- try {
- // create and start domains
- nodeA = new TestNode("nodeG");
- nodeB = new TestNode("nodeH");
-
- nodeA.start();
- nodeB.start();
-
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- throw ex;
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- nodeA.stop();
- nodeB.stop();
- }
-
- @Test
- public void testHelloWorldAsynch() throws Exception {
- HelloWorldClient helloWorldClientB;
- helloWorldClientB = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
- helloWorldClientB.getGreetings("fred");
- System.out.println("Sleeping ...");
- Thread.sleep(2000);
- System.out.println("... Done");
- Assert.assertEquals("callback fred", HelloWorldClientCallbackOnewayRemoteImpl.result );
-
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java
deleted file mode 100644
index b345e563e3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverFactoryImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.axis2;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
-
-/**
- * The factory for creating endpoint Binding providers
- *
- * @version $Rev$ $Date$
- */
-public class BindingScaEndpointResolverFactoryImpl implements EndpointResolverFactory<SCABinding> {
-
- private ExtensionPointRegistry extensionPoints;
-
- public BindingScaEndpointResolverFactoryImpl(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
-
- return new BindingScaEndpointResolverImpl(extensionPoints, endpoint, binding);
- }
-
- public Class<SCABinding> getModelType() {
- return SCABinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java
deleted file mode 100644
index 472e85116e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/BindingScaEndpointResolverImpl.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.axis2;
-
-
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-
-/**
- * The endpoint resolver allows unresolved endpoints to be plumbed into
- * the runtime start and message send processing as a hook to late resolution
- * of target services
- *
- * @version $Rev$ $Date$
- */
-public class BindingScaEndpointResolverImpl implements EndpointResolver {
-
- private final static Logger logger = Logger.getLogger(BindingScaEndpointResolverImpl.class.getName());
-
- private Endpoint endpoint;
- private SCABinding binding;
-
- public BindingScaEndpointResolverImpl(ExtensionPointRegistry extensionPoints,
- Endpoint endpoint,
- Binding binding) {
- this.endpoint = endpoint;
- this.binding = (SCABinding)binding;
- }
-
- public void start(){
- // do nothing
- }
-
- public void resolve() {
- if (endpoint.isUnresolved()){
- // pretend to resolve the endpoint. In this test case to what we know
- // it should be
- logger.info("Fixing up endpoint soure binding");
- endpoint.setSourceBinding(endpoint.getCandidateBindings().get(0));
- endpoint.getSourceBinding().setURI("http://localhost:8085/BHelloWorldServiceRemote");
- }
- }
-
- public void stop(){
- // do nothing
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.java
deleted file mode 100644
index 76dbc5a5c7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/CallbackTestCase.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.binding.sca.axis2;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class CallbackTestCase {
-
- public static TestNode nodeA;
- public static TestNode nodeB;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println("Setting up nodes");
-
- try {
- // create and start domains
- nodeA = new TestNode("nodeE");
- nodeB = new TestNode("nodeF");
-
- nodeA.start();
- nodeB.start();
-
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- throw ex;
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- nodeA.stop();
- nodeB.stop();
- }
-
- //@Test
- public void testKeepServerRunning() throws Exception {
- System.out.println("press enter to continue");
- System.in.read();
- }
-
- @Test
- public void testHelloWorldCallbackLocal() throws Exception {
- HelloWorldClient helloWorldClientB;
- helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientCallbackLocal");
- Assert.assertEquals("Hello callback fred", helloWorldClientB.getGreetings("fred"));
- }
-
- @Test
- public void testHelloWorldCallbackRemote() throws Exception {
- HelloWorldClient helloWorldClientA;
- helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientCallbackRemote");
- Assert.assertEquals("Hello callback fred", helloWorldClientA.getGreetings("fred"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.java
deleted file mode 100644
index 2deb62e6c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/PromotionTestCase.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.binding.sca.axis2;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class PromotionTestCase {
-
- public static TestNode nodeA;
- public static TestNode nodeB;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println("Setting up nodes");
-
- try {
- // create and start domains
- nodeA = new TestNode("nodeC");
- nodeB = new TestNode("nodeD");
-
- nodeA.start();
- nodeB.start();
-
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- throw ex;
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- nodeA.stop();
- nodeB.stop();
- }
-
- @Test
- public void testHelloWorldPromotion() throws Exception {
- HelloWorldClient helloWorldClientA;
- helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemotePromotion");
- Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.java
deleted file mode 100644
index 2d2a23d7df..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/SimpleTestCase.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.binding.sca.axis2;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osoa.sca.ServiceUnavailableException;
-
-public class SimpleTestCase {
-
- public static TestNode nodeA;
- public static TestNode nodeB;
-
- @BeforeClass
- public static void init() throws Exception {
- System.out.println("Setting up nodes");
-
- try {
- // create and start domains
- nodeA = new TestNode("nodeA");
- nodeB = new TestNode("nodeB");
-
- nodeA.start();
- nodeB.start();
-
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- throw ex;
- }
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- nodeA.stop();
- nodeB.stop();
- }
-
- @Test
- public void testHelloWorldLocal() throws Exception {
- HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocal");
- Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
-
- }
-
- @Test
- public void testHelloWorldRemote() throws Exception {
-
- HelloWorldClient helloWorldClientA;
- helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientRemote");
-
- try {
- helloWorldClientA.getGreetings("fred");
- } catch (ServiceUnavailableException ex){
- Assert.fail();
- }
- }
-
- @Test
- public void testHelloWorldLocalAndRemote() throws Exception {
- HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientLocalAndRemote");
- HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientLocalAndRemote");
- Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
- Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
- }
-
- @Test
- public void testHelloWorldMultipleServices() throws Exception {
- HelloWorldClient helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices");
- HelloWorldClient helloWorldClientA2 = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleServices2");
- HelloWorldClient helloWorldClientB = nodeB.getService(HelloWorldClient.class, "BHelloWorldClientMultipleServices");
- Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
- Assert.assertEquals(helloWorldClientA2.getGreetings("fred"), "Hello fred");
- Assert.assertEquals(helloWorldClientB.getGreetings("fred"), "Hello fred");
- }
-
- @Test
- public void testHelloWorldMultipleBindings() throws Exception {
- HelloWorldClient helloWorldClientA;
- helloWorldClientA = nodeA.getService(HelloWorldClient.class, "AHelloWorldClientMultipleBindings");
- Assert.assertEquals(helloWorldClientA.getGreetings("fred"), "Hello fred");
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
deleted file mode 100644
index e788526069..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/TestNode.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.axis2;
-
-import java.net.URL;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * The very minimum node implementation to get these tests going without creating a dependency on
- * any runtime/hosting implementation
- *
- * @version $Rev: 552343 $ $Date: 2007-09-20 14:53:40 +0100 (Thu, 20 Sep 2007) $
- */
-public class TestNode {
-
- private static final Logger logger = Logger.getLogger(TestNode.class.getName());
-
- private String nodeName;
- private ReallySmallRuntime nodeRuntime;
-
- private ClassLoader cl = TestNode.class.getClassLoader();
-
- private Composite nodeComposite = null;
- private Composite appComposite = null;
-
- public TestNode(String nodeName)
- throws Exception {
- this.nodeName = nodeName;
-
- try {
-
- // create and start domainA
- nodeRuntime = new ReallySmallRuntime(cl);
- nodeRuntime.start();
-
- // Create an in-memory domain level composite
- AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
- nodeComposite = assemblyFactory.createComposite();
- nodeComposite.setName(new QName(Constants.SCA10_NS, "domain"));
- nodeComposite.setURI("http://localhost");
-
- // add the top level composite into the composite activator
- nodeRuntime.getCompositeActivator().setDomainComposite(nodeComposite);
-
- // add a contribution to the domain
- ContributionService contributionService = nodeRuntime.getContributionService();
-
- // find the current directory as a URL. This is where our contribution
- // will come from
- URL contributionURL = Thread.currentThread().getContextClassLoader().getResource(nodeName + "/");
-
- // Contribute the SCA application
- Contribution contribution = contributionService.contribute("http://calculator", contributionURL, null, false);
- appComposite = contribution.getDeployables().get(0);
-
- // Add the deployable composite to the domain
- nodeComposite.getIncludes().add(appComposite);
- nodeRuntime.buildComposite(appComposite);
- nodeRuntime.getCompositeActivator().activate(appComposite);
-
-
- } catch (Exception ex) {
- System.err.println("Exception when creating node " + ex.getMessage());
- ex.printStackTrace(System.err);
- throw ex;
- }
- }
-
- public void start() {
-
- try {
- nodeRuntime.getCompositeActivator().start(appComposite);
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- }
-
- }
-
- public void stop() {
- try {
- nodeRuntime.stop();
- } catch (Exception ex) {
- System.err.println("Exception when creating domain " + ex.getMessage());
- ex.printStackTrace(System.err);
- }
- }
-
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
- if (serviceReference == null) {
- throw new ServiceRuntimeException("Service not found: " + serviceName);
- }
- return serviceReference.getService();
- }
-
- private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
- try {
- AssemblyFactory assemblyFactory = nodeRuntime.getAssemblyFactory();
- Composite composite = assemblyFactory.createComposite();
- composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
- RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
- component.setName("default");
- component.setURI("default");
- nodeRuntime.getCompositeActivator().configureComponentContext(component);
- composite.getComponents().add(component);
- RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
- reference.setName("default");
- ModelFactoryExtensionPoint factories =
- nodeRuntime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
- JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
- InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
- reference.setInterfaceContract(interfaceContract);
- component.getReferences().add(reference);
- reference.setComponent(component);
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- SCABinding binding = scaBindingFactory.createSCABinding();
- binding.setURI(targetURI);
- reference.getBindings().add(binding);
- return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, nodeRuntime
- .getProxyFactory(), nodeRuntime.getCompositeActivator());
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
-
- // Extract the component name
- String componentName;
- String serviceName;
- int i = name.indexOf('/');
- if (i != -1) {
- componentName = name.substring(0, i);
- serviceName = name.substring(i + 1);
-
- } else {
- componentName = name;
- serviceName = null;
- }
-
- // Lookup the component in the domain
-
- Component component = null;
-
- for (Composite composite: nodeComposite.getIncludes()) {
- for (Component componentLoop: composite.getComponents()) {
- if (componentLoop.getName().equals(componentName)) {
- component = componentLoop;
- break;
- }
- }
- }
- if (component == null) {
- // The component is not local in the partition, try to create a remote service ref
- return createServiceReference(businessInterface, name);
- }
- RuntimeComponentContext componentContext = null;
-
- // If the component is a composite, then we need to find the
- // non-composite component that provides the requested service
- if (component.getImplementation() instanceof Composite) {
- for (ComponentService componentService : component.getServices()) {
- if (serviceName == null || serviceName.equals(componentService.getName())) {
- CompositeService compositeService = (CompositeService)componentService.getService();
- if (compositeService != null) {
- if (serviceName != null) {
- serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName;
- }
- componentContext =
- ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
- return componentContext.createSelfReference(businessInterface, compositeService
- .getPromotedService());
- }
- break;
- }
- }
- // No matching service is found
- throw new ServiceRuntimeException("Composite service not found: " + name);
- } else {
- componentContext = ((RuntimeComponent)component).getComponentContext();
- if (serviceName != null) {
- return componentContext.createSelfReference(businessInterface, serviceName);
- } else {
- return componentContext.createSelfReference(businessInterface);
- }
- }
- }
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.java
deleted file mode 100644
index 1a2788ac74..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldCallbackRemote.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.binding.sca.axis2.helloworld;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorldCallbackRemote {
-
- String getGreetingsCallbackRemote(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.java
deleted file mode 100644
index e4d36ac78b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldClient.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.binding.sca.axis2.helloworld;
-
-
-public interface HelloWorldClient {
-
- String getGreetings(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.java
deleted file mode 100644
index a83fcb3069..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackOnewayRemote.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.binding.sca.axis2.helloworld;
-
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.OneWay;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-@Callback(HelloWorldCallbackRemote.class)
-public interface HelloWorldServiceCallbackOnewayRemote {
-
- @OneWay
- void getGreetingsRemote(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.java
deleted file mode 100644
index c41548ec51..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceCallbackRemote.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.binding.sca.axis2.helloworld;
-
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-@Callback(HelloWorldCallbackRemote.class)
-public interface HelloWorldServiceCallbackRemote {
-
- String getGreetingsRemote(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.java
deleted file mode 100644
index 7b8e00eb2a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceLocal.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.binding.sca.axis2.helloworld;
-
-
-public interface HelloWorldServiceLocal {
-
- String getGreetingsLocal(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.java
deleted file mode 100644
index 62d61e4fff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote.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.binding.sca.axis2.helloworld;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorldServiceRemote {
-
- String getGreetingsRemote(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.java
deleted file mode 100644
index 2dcc8cc64b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/HelloWorldServiceRemote2.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.binding.sca.axis2.helloworld;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorldServiceRemote2 {
-
- String getGreetingsRemote2(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.java
deleted file mode 100644
index 8e7d2f8023..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackOnewayRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldClientCallbackOnewayRemoteImpl implements HelloWorldClient {
-
- public static String result;
-
- @Reference
- public HelloWorldServiceCallbackOnewayRemote helloWorldService;
-
- public String getGreetings(String s) {
- helloWorldService.getGreetingsRemote(s);
- return null;
- }
-
- public String getGreetingsCallbackRemote(String s) {
- result = "callback " + s;
- return result;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.java
deleted file mode 100644
index 7d07c4ff43..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientCallbackRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldClientCallbackRemoteImpl implements HelloWorldClient {
-
- public static String result;
-
- @Reference
- public HelloWorldServiceCallbackRemote helloWorldService;
-
- public String getGreetings(String s) {
- return helloWorldService.getGreetingsRemote(s);
- }
-
- public String getGreetingsCallbackRemote(String s) {
- result = "callback " + s;
- return result;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.java
deleted file mode 100644
index 7098f10622..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientLocalImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldClientLocalImpl implements HelloWorldClient {
-
- @Reference
- public HelloWorldServiceLocal helloWorldService;
-
- public String getGreetings(String s) {
- return helloWorldService.getGreetingsLocal(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.java
deleted file mode 100644
index 07ae00bd31..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemote2Impl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldClientRemote2Impl implements HelloWorldClient {
-
- @Reference
- public HelloWorldServiceRemote2 helloWorldService;
-
- public String getGreetings(String s) {
- return helloWorldService.getGreetingsRemote2(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.java
deleted file mode 100644
index 36854cb7b8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldClientRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldClientRemoteImpl implements HelloWorldClient {
-
- @Reference
- public HelloWorldServiceRemote helloWorldService;
-
- public String getGreetings(String s) {
- return helloWorldService.getGreetingsRemote(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.java
deleted file mode 100644
index fd3e3a1158..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackOnewayRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackOnewayRemote;
-import org.osoa.sca.annotations.Callback;
-
-
-public class HelloWorldServiceCallbackOnewayRemoteImpl implements HelloWorldServiceCallbackOnewayRemote {
-
- @Callback
- protected HelloWorldCallbackRemote theCallback;
-
- public void getGreetingsRemote(String s) {
- theCallback.getGreetingsCallbackRemote(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.java
deleted file mode 100644
index 3400e97447..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceCallbackRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldCallbackRemote;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceCallbackRemote;
-import org.osoa.sca.annotations.Callback;
-
-public class HelloWorldServiceCallbackRemoteImpl implements HelloWorldServiceCallbackRemote {
-
- @Callback
- protected HelloWorldCallbackRemote theCallback;
-
- public String getGreetingsRemote(String s) {
- return "Hello " + theCallback.getGreetingsCallbackRemote(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.java
deleted file mode 100644
index 20dd97b74a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceLocalImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-
-public class HelloWorldServiceLocalImpl implements HelloWorldServiceLocal {
-
- public String getGreetingsLocal(String s) {
- return "Hello " + s;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.java
deleted file mode 100644
index 5f8ccf9466..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceMultipleServicesImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceLocal;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote2;
-import org.osoa.sca.annotations.Service;
-
-@Service(interfaces={HelloWorldServiceRemote.class, HelloWorldServiceRemote2.class, HelloWorldServiceLocal.class} )
-public class HelloWorldServiceMultipleServicesImpl implements HelloWorldServiceLocal, HelloWorldServiceRemote, HelloWorldServiceRemote2 {
-
- public String getGreetingsLocal(String s) {
- return "Hello " + s;
- }
-
- public String getGreetingsRemote(String s) {
- return "Hello " + s;
- }
-
- public String getGreetingsRemote2(String s) {
- return "Hello " + s;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.java
deleted file mode 100644
index b25aebd9df..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/java/org/apache/tuscany/sca/binding/sca/axis2/helloworld/impl/HelloWorldServiceRemoteImpl.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.binding.sca.axis2.helloworld.impl;
-
-import org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote;
-
-public class HelloWorldServiceRemoteImpl implements HelloWorldServiceRemote {
-
- public String getGreetingsRemote(String s) {
- return "Hello " + s;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
deleted file mode 100644
index 5e4fd566c3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.sca.axis2.BindingScaEndpointResolverFactoryImpl;model=org.apache.tuscany.sca.assembly.SCABinding
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite
deleted file mode 100644
index 093258051e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/HelloWorld.composite
+++ /dev/null
@@ -1,75 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- local only wire -->
- <component name="AHelloWorldClientLocal">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientLocalImpl"/>
- <reference name="helloWorldService" target="AHelloWorldServiceLocal" />
- </component>
-
- <component name="AHelloWorldServiceLocal">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceLocalImpl" />
- </component>
-
- <!-- unresolved remote wire -->
- <component name="AHelloWorldClientRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
- <reference name="helloWorldService" target="BHelloWorldServiceRemote" />
- </component>
-
- <!-- local and remote wires -->
- <component name="AHelloWorldClientLocalAndRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
- <reference name="helloWorldService">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceLocalAndRemote"/>
- </reference>
- </component>
-
- <!-- multiple services -->
- <component name="AHelloWorldClientMultipleServices">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
- <reference name="helloWorldService">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceMultipleServices/HelloWorldServiceRemote"/>
- </reference>
- </component>
-
- <component name="AHelloWorldClientMultipleServices2">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemote2Impl" />
- <reference name="helloWorldService">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceMultipleServices/HelloWorldServiceRemote2"/>
- </reference>
- </component>
-
- <!-- multiple bindings -->
- <component name="AHelloWorldClientMultipleBindings">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
- <reference name="helloWorldService" >
- <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote" />
- <binding.sca uri="http://localhost:8085/BHelloWorldMultipleBindings/HelloWorldServiceRemote-scabinding"/>
- <binding.ws/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeA/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite
deleted file mode 100644
index 8cf7230ed5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/HelloWorld.composite
+++ /dev/null
@@ -1,84 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- local only wire -->
-
-
- <!-- unresolved remote wire -->
- <component name="BHelloWorldServiceRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
- <service name="HelloWorldServiceRemote">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceRemote"/>
- </service>
- </component>
-
- <!-- local and remote wires -->
- <component name="BHelloWorldServiceLocalAndRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
- <service name="HelloWorldServiceRemote">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceLocalAndRemote"/>
- </service>
- </component>
-
- <component name="BHelloWorldClientLocalAndRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl" />
- <reference name="helloWorldService" target="BHelloWorldServiceLocalAndRemote" />
- </component>
-
- <!-- multiple services -->
- <component name="BHelloWorldServiceMultipleServices">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceMultipleServicesImpl" />
- <service name="HelloWorldServiceLocal">
- </service>
- <service name="HelloWorldServiceRemote">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceMultipleServices/HelloWorldServiceRemote"/>
- </service>
- <service name="HelloWorldServiceRemote2">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceMultipleServices/HelloWorldServiceRemote2"/>
- </service>
- </component>
-
- <component name="BHelloWorldClientMultipleServices">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientLocalImpl" />
- <reference name="helloWorldService" target="BHelloWorldServiceMultipleServices/HelloWorldServiceLocal" />
- </component>
-
- <!-- multiple bindings -->
- <component name="BHelloWorldMultipleBindings">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
- <service name="HelloWorldServiceRemote">
- <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote" />
- <binding.ws uri="http://localhost:8085/BHelloWorldMultipleBindings/HelloWorldServiceRemote-wsbinding"/>
- <binding.sca uri="http://localhost:8085/BHelloWorldMultipleBindings/HelloWorldServiceRemote-scabinding"/>
- </service>
- </component>
-
-
- <!-- Dynamic interfaces -->
- <!--component name="BHelloWorldServiceScript">
- <implementation.script script="calculator/AddServiceImpl.js"/>
- </component-->
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeB/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite
deleted file mode 100644
index 066727f76d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorld.composite
+++ /dev/null
@@ -1,35 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- composite hierarchy -->
- <component name="AHelloWorldClientRemotePromotion">
- <implementation.composite name="sample:HelloWorldComponent" />
- <reference name="AHelloWorldClientRemoteReference">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceRemotePromotion"/>
- </reference>
- </component>
-
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.composite
deleted file mode 100644
index 485e0815d2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/HelloWorldComponent.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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorldComponent">
-
- <service name="AHelloWorldClientRemoteService" promote="AHelloWorldClientRemoteComponent">
- <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldClient"/>
- </service>
-
- <reference name="AHelloWorldClientRemoteReference" promote="AHelloWorldClientRemoteComponent/helloWorldService">
- <interface.java interface="org.apache.tuscany.sca.binding.sca.axis2.helloworld.HelloWorldServiceRemote"/>
- </reference>
-
- <component name="AHelloWorldClientRemoteComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientRemoteImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeC/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite
deleted file mode 100644
index a5a4f04cb5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorld.composite
+++ /dev/null
@@ -1,35 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- composite hierarchy -->
- <component name="BHelloWorldServiceRemotePromotion">
- <implementation.composite name="sample:HelloWorldComponent" />
- <service name="BHelloWorldServiceRemoteService">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceRemotePromotion"/>
- </service>
- </component>
-
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.composite
deleted file mode 100644
index bf30bdf42d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/HelloWorldComponent.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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorldComponent">
-
- <service name="BHelloWorldServiceRemoteService"
- promote="BHelloWorldServiceRemoteComponent/HelloWorldServiceRemote"/>
-
- <component name="BHelloWorldServiceRemoteComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl"/>
- </component>
-
- <component name="BHelloWorldServiceLocalAndRemoteNested">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceRemoteImpl" />
- </component>
-
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeD/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite
deleted file mode 100644
index b519793290..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/HelloWorld.composite
+++ /dev/null
@@ -1,36 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
- <!-- callback remote wire -->
- <component name="AHelloWorldClientCallbackRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackRemoteImpl" />
- <reference name="helloWorldService" >
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceCallbackRemote"/>
- <callback>
- <binding.sca uri="http://localhost:8084/AHelloWorldClientCallbackRemote"/>
- </callback>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeE/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.composite
deleted file mode 100644
index 20a6c54e6e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/HelloWorld.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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- callback remote wire -->
- <component name="BHelloWorldServiceCallbackRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceCallbackRemoteImpl" />
- <service name="HelloWorldServiceCallbackRemote">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceCallbackRemote"/>
- <callback>
- <binding.sca uri="http://localhost:8084/AHelloWorldClientCallbackRemote"/>
- </callback>
- </service>
- </component>
-
- <!-- callback local wire -->
- <component name="BHelloWorldClientCallbackLocal">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackRemoteImpl" />
- <reference name="helloWorldService" target="BHelloWorldServiceCallbackRemote" />
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml
deleted file mode 100644
index d6b9e82250..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeF/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite
deleted file mode 100644
index a76008d0c5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/HelloWorld.composite
+++ /dev/null
@@ -1,36 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
- <!-- callback remote wire -->
- <component name="AHelloWorldClientCallbackRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldClientCallbackOnewayRemoteImpl" />
- <reference name="helloWorldService" >
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceCallbackRemote"/>
- <callback>
- <binding.sca uri="http://localhost:8084/AHelloWorldClientCallbackRemote"/>
- </callback>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml
deleted file mode 100644
index d670354a28..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeG/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,23 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite
deleted file mode 100644
index 0c22af22ab..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/HelloWorld.composite
+++ /dev/null
@@ -1,38 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
-
- <!-- callback remote wire -->
- <component name="BHelloWorldServiceCallbackRemote">
- <implementation.java class="org.apache.tuscany.sca.binding.sca.axis2.helloworld.impl.HelloWorldServiceCallbackOnewayRemoteImpl" />
- <service name="HelloWorldServiceCallbackOnewayRemote">
- <binding.sca uri="http://localhost:8085/BHelloWorldServiceCallbackRemote"/>
- <callback>
- <binding.sca uri="http://localhost:8084/AHelloWorldClientCallbackRemote"/>
- </callback>
- </service>
- </component>
-
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml
deleted file mode 100644
index d670354a28..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-axis2/src/test/resources/nodeH/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,23 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sample="http://sample">
- <deployable composite="sample:HelloWorld"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/LICENSE b/branches/sca-java-1.5.1/modules/binding-sca-corba/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/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-java-1.5.1/modules/binding-sca-corba/NOTICE b/branches/sca-java-1.5.1/modules/binding-sca-corba/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/pom.xml b/branches/sca-java-1.5.1/modules/binding-sca-corba/pom.xml
deleted file mode 100644
index 4457f2c972..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/pom.xml
+++ /dev/null
@@ -1,114 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-sca-corba</artifactId>
- <name>
- Apache Tuscany SCA CORBA-based Default Binding Extension
- </name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jse</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>
- ${tuscany.version}
- </Bundle-Version>
- <Bundle-SymbolicName>
- org.apache.tuscany.sca.binding.sca.corba
- </Bundle-SymbolicName>
- <Bundle-Description>
- ${pom.name}
- </Bundle-Description>
- <Export-Package>
- org.apache.tuscany.sca.binding.sca.corba*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCABindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCABindingProviderFactory.java
deleted file mode 100644
index 2eee714de6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCABindingProviderFactory.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.corba.impl;
-
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-import org.apache.tuscany.sca.host.corba.ExtensibleCorbaHost;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Binding provider factory for SCA default binding over CORBA binding
- */
-public class CorbaSCABindingProviderFactory implements BindingProviderFactory<DistributedSCABinding> {
-
- private CorbaHostExtensionPoint chep;
- private CorbaHost host;
- private ExtensionPointRegistry extensions;
-
- public CorbaSCABindingProviderFactory(ExtensionPointRegistry extensions) {
- this.extensions = extensions;
- chep = extensions.getExtensionPoint(CorbaHostExtensionPoint.class);
- host = new ExtensibleCorbaHost(chep);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- DistributedSCABinding binding) {
- return new CorbaSCAReferenceBindingProvider(binding.getSCABinding(), host, component, reference, extensions);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- DistributedSCABinding binding) {
- return new CorbaSCAServiceBindingProvider(binding.getSCABinding(), host, component, service, extensions);
- }
-
- public Class<DistributedSCABinding> getModelType() {
- return DistributedSCABinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.java
deleted file mode 100644
index a9cc890616..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvocationProxy.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.binding.sca.corba.impl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationException;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy;
-import org.apache.tuscany.sca.binding.corba.impl.service.OperationTypes;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTree;
-import org.apache.tuscany.sca.binding.corba.impl.types.TypeTreeCreator;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Invocation proxy for SCA default binding over CORBA binding
- */
-public class CorbaSCAInvocationProxy implements InvocationProxy {
-
- private static final Logger logger = Logger.getLogger(CorbaSCAInvocationProxy.class.getName());
- private RuntimeWire wire;
- private Interface componentInterface;
- private OperationTypes types = new OperationTypes();
- private MessageFactory messageFactory;
-
- public CorbaSCAInvocationProxy(RuntimeWire wire, Interface componentInterface, MessageFactory messageFactory) {
- this.wire = wire;
- this.componentInterface = componentInterface;
- this.messageFactory = messageFactory;
- try {
- List<TypeTree> inputType = new ArrayList<TypeTree>();
- inputType.add(TypeTreeCreator.createTypeTree(String.class, null));
- types.setInputType(inputType);
- types.setOutputType(TypeTreeCreator.createTypeTree(String.class, null));
- } catch (RequestConfigurationException e) {
- // ignore - string type should not cause this exception
- }
- }
-
- public Object invoke(String operationName, List<Object> arguments) throws InvocationException {
- try {
- OMElement omContent = CorbaSCAInvoker.stringToOM((String)arguments.get(0));
- String componentOperationName = omContent.getQName().getLocalPart();
- Operation componentOperation = null;
- for (Operation operation : componentInterface.getOperations()) {
- if (operation.getName().equals(componentOperationName)) {
- componentOperation = operation;
- break;
- }
- }
- if (componentOperation != null) {
- Message msg = messageFactory.createMessage();
- msg.setOperation(componentOperation);
- Object[] args = new Object[1];
- args[0] = omContent;
- msg.setBody(args);
- OMElement omResult = (OMElement)wire.invoke(componentOperation, msg);
- return omResult.toStringWithConsume();
- }
- } catch (XMLStreamException e) {
- logger.log(Level.WARNING, "XMLStreamException during handling invocation target exception", e);
- } catch (InvocationTargetException e) {
- OMElement omException = (OMElement)((FaultException)e.getCause()).getFaultInfo();
- try {
- WrappedSCAException wrappedException = new WrappedSCAException(omException.toStringWithConsume());
- InvocationException exception = new InvocationException(wrappedException);
- throw exception;
- } catch (XMLStreamException xmle) {
- logger.log(Level.WARNING, "XMLStreamException during handling invocation target exception", xmle);
- }
-
- }
-
- return null;
- }
-
- public OperationTypes getOperationTypes(String operationName) {
- // ignoring operationName - only one operation for this proxy is allowed
- return types;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.java
deleted file mode 100644
index 32d5650f37..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAInvoker.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.binding.sca.corba.impl;
-
-import java.io.ByteArrayInputStream;
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.binding.corba.impl.exceptions.RequestConfigurationException;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaRequest;
-import org.apache.tuscany.sca.binding.corba.impl.reference.DynaCorbaResponse;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.omg.CORBA.Object;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class CorbaSCAInvoker implements Invoker {
-
- private Object remoteObject;
- private Class<?> referenceClass;
-
- public CorbaSCAInvoker(Object remoteObject,
- Class<?> referenceClass,
- Map<Method, String> operationsMap,
- boolean scaBindingRules) {
- this.remoteObject = remoteObject;
- this.referenceClass = referenceClass;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- try {
- DynaCorbaRequest request = new DynaCorbaRequest(remoteObject, "scaService");
- request.setReferenceClass(referenceClass);
- request.setOutputType(String.class);
- request.addExceptionType(WrappedSCAException.class);
- java.lang.Object[] args = msg.getBody();
- OMElement omElement = (OMElement)args[0];
- String arg = omElement.toStringWithConsume();
- request.addArgument(arg);
- DynaCorbaResponse response = request.invoke();
- OMElement responseOM = stringToOM((String)response.getContent());
- msg.setBody(responseOM);
- } catch (WrappedSCAException e) {
- try {
- OMElement exceptionOM = stringToOM(e.getFault());
- // AxisFault axisFault = new AxisFault("");
- // axisFault.setDetail(exceptionOM);
- FaultException f = new FaultException(e.getMessage(), exceptionOM, e);
- f.setFaultName(exceptionOM.getQName());
- msg.setFaultBody(f);
- } catch (XMLStreamException e1) {
- }
- } catch (RequestConfigurationException e) {
- throw new ServiceRuntimeException(e);
- } catch (Exception e) {
- msg.setFaultBody(e);
- }
- return msg;
- }
-
- /**
- * This will help you to create an OMElement from an xml fragment which you have as a string.
- *
- * @param xmlFragment - the well-formed xml fragment
- * @return The OMElement created out of the string xml fragment.
- * @throws XMLStreamException
- */
- static OMElement stringToOM(String xmlFragment) throws XMLStreamException {
- if (xmlFragment != null) {
- return new StAXOMBuilder(new ByteArrayInputStream(xmlFragment.getBytes())).getDocumentElement();
- }
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAReferenceBindingProvider.java
deleted file mode 100644
index c578f8bdf4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAReferenceBindingProvider.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.binding.sca.corba.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.omg.CORBA.Object;
-
-/**
- * Reference binding provider for SCA default binding over CORBA binding
- */
-public class CorbaSCAReferenceBindingProvider implements ReferenceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(CorbaSCAReferenceBindingProvider.class.getName());
-
- private SCABinding binding;
- private CorbaHost host;
- private Object remoteObject;
- private Class<?> referenceClass;
- private InterfaceContract wsdlInterfaceContract;
-
- public CorbaSCAReferenceBindingProvider(SCABinding binding,
- CorbaHost host,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- ExtensionPointRegistry extensions) {
- this.binding = binding;
- this.host = host;
-
- WebServiceBindingFactory wsFactory = extensions.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, extensions, null);
- wsdlInterfaceContract = wsBinding.getBindingInterfaceContract();
- wsdlInterfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsdlInterfaceContract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public Invoker createInvoker(Operation operation) {
- try {
- if (remoteObject == null) {
- remoteObject = host.lookup(binding.getURI());
- }
- return new CorbaSCAInvoker(remoteObject, referenceClass, null, true);
- } catch (Exception e) {
- logger.warning(e.getMessage());
- }
- return null;
- }
-
- public void start() {
-
- }
-
- public void stop() {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAServiceBindingProvider.java
deleted file mode 100644
index 6e74686b61..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/CorbaSCAServiceBindingProvider.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.corba.impl;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
-import org.apache.tuscany.sca.binding.corba.impl.service.InvocationProxy;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Service binding provider for SCA default binding over CORBA binding
- */
-public class CorbaSCAServiceBindingProvider implements ServiceBindingProvider {
-
- private SCABinding binding;
- private CorbaHost host;
- private RuntimeComponentService service;
- private DynaCorbaServant servant;
- private MessageFactory messageFactory;
- private InterfaceContract wsdlInterfaceContract;
-
- public CorbaSCAServiceBindingProvider(SCABinding binding,
- CorbaHost host,
- RuntimeComponent component,
- RuntimeComponentService service,
- ExtensionPointRegistry extensions) {
- this.binding = binding;
- this.host = host;
- this.service = service;
-
- messageFactory = extensions.getExtensionPoint(MessageFactory.class);
-
- WebServiceBindingFactory wsFactory = extensions.getExtensionPoint(WebServiceBindingFactory.class);
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- BindingWSDLGenerator.generateWSDL(component, service, wsBinding, extensions, null);
- wsdlInterfaceContract = wsBinding.getBindingInterfaceContract();
- wsdlInterfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsdlInterfaceContract;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- try {
- InvocationProxy proxy =
- new CorbaSCAInvocationProxy(service.getRuntimeWire(binding), service.getInterfaceContract()
- .getInterface(), messageFactory);
- servant = new DynaCorbaServant(proxy, "IDL:org/apache/tuscany/sca/binding/sca/corba/Service:1.0");
- host.registerServant(binding.getURI(), servant);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public void stop() {
- try {
- host.unregisterServant(binding.getURI());
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/WrappedSCAException.java b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/WrappedSCAException.java
deleted file mode 100644
index 128d5ef159..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/java/org/apache/tuscany/sca/binding/sca/corba/impl/WrappedSCAException.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.binding.sca.corba.impl;
-
-/**
- * Exception holder for SCA default binding over CORBA. Holds fault message in
- * XML
- */
-public class WrappedSCAException extends Exception {
-
- private static final long serialVersionUID = 1L;
- public String fault;
-
- /**
- * Creates exception holder with null fault message. This no argument
- * constructor is needed by CORBA binding.
- */
- public WrappedSCAException() {
-
- }
-
- /**
- * Creates exception holder with fault message
- *
- * @param fault XML fault message
- */
- public WrappedSCAException(String fault) {
- this.fault = fault;
- }
-
- public String getFault() {
- return fault;
- }
-
- public void setFault(String fault) {
- this.fault = fault;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index e07a7cbb95..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.sca.corba.impl.CorbaSCABindingProviderFactory;model=org.apache.tuscany.sca.binding.sca.DistributedSCABinding
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/LICENSE b/branches/sca-java-1.5.1/modules/binding-sca-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-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-java-1.5.1/modules/binding-sca-xml/NOTICE b/branches/sca-java-1.5.1/modules/binding-sca-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/pom.xml b/branches/sca-java-1.5.1/modules/binding-sca-xml/pom.xml
deleted file mode 100644
index 5434cadca7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/pom.xml
+++ /dev/null
@@ -1,77 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-sca-xml</artifactId>
- <name>Apache Tuscany SCA Default Binding XML Model</name>
-
- <dependencies>
-
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.sca.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.sca.xml*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.binding.sca.impl,*</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
deleted file mode 100644
index 034aaf0339..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/java/org/apache/tuscany/sca/binding/sca/xml/SCABindingProcessor.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * A processor to read the XML that describes the SCA binding.
- *
- * @version $Rev$ $Date$
- */
-
-public class SCABindingProcessor implements StAXArtifactProcessor<SCABinding>, Constants{
-
- private SCABindingFactory scaBindingFactory;
- private ExtensionFactory extensionFactory;
- private PolicyFactory policyFactory;
- private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
-
- private PolicyAttachPointProcessor policyProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
-
- private Monitor monitor;
-
- protected static final String BINDING_SCA = "binding.sca";
- protected static final QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
-
- public SCABindingProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.extensionAttributeProcessor = extensionAttributeProcessor;
-
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- return BINDING_SCA_QNAME;
- }
-
- public Class<SCABinding> getModelType() {
- return SCABinding.class;
- }
-
- public SCABinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- SCABinding scaBinding = scaBindingFactory.createSCABinding();
- IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
- bindingType.setName(getArtifactType());
- bindingType.setUnresolved(true);
- ((PolicySetAttachPoint)scaBinding).setType(bindingType);
-
- // Read policies
- policyProcessor.readPolicies(scaBinding, reader);
-
- // Read binding name
- String name = reader.getAttributeValue(null, NAME);
- if (name != null) {
- scaBinding.setName(name);
- }
-
- // Read binding URI
- String uri = reader.getAttributeValue(null, URI);
- if (uri != null) {
- scaBinding.setURI(uri);
- }
-
- // Handle extended attributes
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
- (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- scaBinding.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && BINDING_SCA_QNAME.equals(reader.getName())) {
- break;
- }
- }
- return scaBinding;
- }
-
- public void resolve(SCABinding model, ModelResolver resolver) throws ContributionResolveException {
- policyProcessor.resolvePolicies(model, resolver);
- }
-
- public void write(SCABinding scaBinding, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <binding.sca>
- writer.writeStartElement(Constants.SCA10_NS, BINDING_SCA);
- policyProcessor.writePolicyAttributes(scaBinding, writer);
-
- // Write binding name
- if (scaBinding.getName() != null) {
- writer.writeAttribute(NAME, scaBinding.getName());
- }
-
- // Write binding URI
- if (scaBinding.getURI() != null) {
- writer.writeAttribute(URI, scaBinding.getURI());
- }
-
- // Write extended attributes
- for(Extension extension : scaBinding.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- writer.writeEndElement();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index bc9f9b7d62..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.sca,model=org.apache.tuscany.sca.binding.sca.impl.SCABindingImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
deleted file mode 100644
index a7c7c15eaa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadTestCase.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apace.tuscany.sca.binding.sca.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
-
- }
-
- public void testReadComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ComponentType componentType = (ComponentType)staxProcessor.read(reader);
- assertNotNull(componentType);
-
- SCABinding referenceSCABinding = (SCABinding) componentType.getReferences().get(0).getBindings().get(0);
- assertNotNull(referenceSCABinding);
-
- SCABinding serviceSCABinding = (SCABinding) componentType.getServices().get(0).getBindings().get(0);
- assertNotNull(serviceSCABinding);
-
- //new PrintUtil(System.out).print(componentType);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("/Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
-
- SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
- SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
-
- Assert.assertNotNull(referenceSCABinding);
- Assert.assertNotNull(serviceSCABinding);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadWriteAnyAttributeTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadWriteAnyAttributeTestCase.java
deleted file mode 100644
index b5f9fa4673..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/ReadWriteAnyAttributeTestCase.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apace.tuscany.sca.binding.sca.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.binding.sca.xml.SCABindingProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.xml.AnyAttributeProcessor;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadWriteAnyAttributeTestCase {
-
- private static final QName EXTENDED_ATTRIBUTE = new QName("http://test", "customAttribute");
-
- private static final String XML =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "targetNamespace=\"http://temp\" " +
- "name=\"myComposite\">" +
- "<service name=\"service\">" +
- "<binding.sca xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSAnyAttribute=\"EJB Value\" />" +
- "<interface.java interface=\"com.ibm.MyInterface\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaInterfaceAnyAttribute=\"Java Interface Value\" />" +
- "</service>" +
- "<component name=\"component\">" +
- "<implementation.java class=\"com.ibm.test.MyClass\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaImplAnyAttribute=\"Java Impl Value\" />" +
- "</component>" +
- "<component name=\"component1\">" +
- "<implementation.composite xmlns:ns2=\"http://temp\" name=\"ns2:myComposite\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myCompositeImplAnyAttribute=\"Composite Impl Value\" />" +
- "</component>" +
- "<reference name=\"reference\">" +
- "<interface.wsdl interface=\"http://www.example.org/SpaceWarGame/#wsdl.interface(SpaceWarGame)\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSDLInterfaceAnyAttribute=\"WSDL Interface Value\" />" +
- "</reference>" +
- "</composite>";
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
-
- /**
- * Initialize the test environment
- * This takes care to register attribute processors when provided
- *
- * @param attributeProcessor
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- inputFactory = XMLInputFactory.newInstance();
-
- StAXAttributeProcessor attributeProcessor = new AnyAttributeProcessor(modelFactories,null);
-
- StAXAttributeProcessorExtensionPoint staxAttributeProcessorsExtensionPoint = new DefaultStAXAttributeProcessorExtensionPoint(extensionPoints);
- staxAttributeProcessorsExtensionPoint.addArtifactProcessor(attributeProcessor);
- extensionPoints.addExtensionPoint(staxAttributeProcessorsExtensionPoint);
-
-
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- StAXAttributeProcessor<Object> staxAttributeProcessor = new ExtensibleStAXAttributeProcessor(staxAttributeProcessorsExtensionPoint ,inputFactory, outputFactory, null);
-
- SCABindingProcessor wsbp = new SCABindingProcessor(modelFactories, null, staxAttributeProcessor, null);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(wsbp);
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
-
- @Test
- //@Ignore()
- public void testReadWriteCompositeWithBindings() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML);
- // System.out.println(bos.toString());
-
- assertEquals(XML, bos.toString());
- bos.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.java
deleted file mode 100644
index db611fa413..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/java/org/apace/tuscany/sca/binding/sca/xml/WriteTestCase.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.apace.tuscany.sca.binding.sca.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private StAXArtifactProcessor<Object> staxProcessor;
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("/CalculatorServiceImpl.componentType");
- ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(componentType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
- assertEquals("<?xml version='1.0' encoding='UTF-8'?><componentType xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\"><service name=\"CalculatorService\"><binding.sca /><interface.java interface=\"calculator.CalculatorService\" /></service><reference name=\"addService\"><binding.sca /><interface.java interface=\"calculator.AddService\" /></reference></componentType>",
- bos.toString());
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("/Calculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- assertEquals("<?xml version='1.0' encoding='UTF-8'?><composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://calc\" name=\"Calculator\"><service name=\"CalculatorService\" promote=\"CalculatorServiceComponent\"><binding.sca /><interface.java interface=\"calculator.CalculatorService\" /></service><component name=\"CalculatorServiceComponent\"><implementation.java class=\"calculator.CalculatorServiceImpl\" /><reference name=\"addService\" target=\"AddServiceComponent\"><binding.sca /></reference><reference name=\"subtractService\" target=\"SubtractServiceComponent\" /><reference name=\"multiplyService\" target=\"MultiplyServiceComponent\" /><reference name=\"divideService\" target=\"DivideServiceComponent\" /></component><component name=\"AddServiceComponent\"><implementation.java class=\"calculator.AddServiceImpl\" /><service name=\"AddService\"><binding.sca /><interface.java interface=\"calculator.AddService\" /></service></component><component name=\"SubtractServiceComponent\"><implementation.java class=\"calculator.SubtractServiceImpl\" /></component><component name=\"MultiplyServiceComponent\"><implementation.java class=\"calculator.MultiplyServiceImpl\" /></component><component name=\"DivideServiceComponent\"><implementation.java class=\"calculator.DivideServiceImpl\" /></component></composite>",
- bos.toString());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/Calculator.composite b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/Calculator.composite
deleted file mode 100644
index 0be16ec536..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/Calculator.composite
+++ /dev/null
@@ -1,59 +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"/>
- <binding.sca/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent">
- <binding.sca/>
- </reference>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- <service name="AddService">
- <interface.java interface="calculator.AddService"/>
- <binding.sca/>
- </service>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType b/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
deleted file mode 100644
index 55e8926504..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca-xml/src/test/resources/CalculatorServiceImpl.componentType
+++ /dev/null
@@ -1,33 +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 interface="calculator.CalculatorService" />
- <binding.sca/>
- </service>
-
- <reference name="addService">
- <interface.java interface="calculator.AddService" />
- <binding.sca/>
- </reference>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/LICENSE b/branches/sca-java-1.5.1/modules/binding-sca/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/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-java-1.5.1/modules/binding-sca/NOTICE b/branches/sca-java-1.5.1/modules/binding-sca/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/pom.xml b/branches/sca-java-1.5.1/modules/binding-sca/pom.xml
deleted file mode 100644
index 86a25b74ff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/pom.xml
+++ /dev/null
@@ -1,93 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-sca</artifactId>
- <name>Apache Tuscany SCA Default Binding Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.sca</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.sca*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.java
deleted file mode 100644
index 167c93e86d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/DistributedSCABinding.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.binding.sca;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-
-
-/**
- * Represents an SCA binding used in the distributed runtime.
- * At the moment just provides us with a sensibly named type
- * against which the distributed sca binding providers can be registered
- *
- * @version $Rev: 556322 $ $Date: 2007-07-14 19:53:15 +0100 (Sat, 14 Jul 2007) $
- */
-public interface DistributedSCABinding extends Binding {
-
- SCABinding getSCABinding();
- void setSCABinding(SCABinding scaBinding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java
deleted file mode 100644
index bd24d4b14c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/SCABindingDefinitionsProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class SCABindingDefinitionsProvider implements SCADefinitionsProvider {
- private String definitionsFile = "org/apache/tuscany/sca/binding/sca/definitions.xml";
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public SCABindingDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- // Allow privileged access to load resource. Requires RuntimePermssion in security policy.
- final URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(definitionsFile);
- }
- });
-
- SCADefinitions scaDefn = null;
- try {
- final URI uri = new URI(definitionsFile);
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
- public SCADefinitions run() throws ContributionReadException {
- return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
- }
- });
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- return scaDefn;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.java
deleted file mode 100644
index 43b0cd8f4e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/DistributedSCABindingImpl.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.binding.sca.impl;
-
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-
-/**
- * The Distributed SCA binding wrapper for the SCA binding model object. This is currently
- * just used to locate the remote binding extension and pass the SCA binding to the remote
- * extension. It isn't used in the model itself
- *
- * @version $Rev: 564307 $ $Date: 2007-08-09 18:48:29 +0100 (Thu, 09 Aug 2007) $
- */
-public class DistributedSCABindingImpl implements DistributedSCABinding {
-
- private SCABinding scaBinding;
-
- /**
- * Getter for the wrapped sca binding model object
- *
- * @return the sca binding model element
- */
- public SCABinding getSCABinding(){
- return scaBinding;
- }
-
- /**
- * Setter for the wrapped sca binding model element
- *
- * @param scaBinding the sca binding model element
- */
- public void setSCABinding(SCABinding scaBinding){
- this.scaBinding = scaBinding;
- }
-
-
- // Operation implementations provided to make this class a
- // valid Binding
-
- /**
- * Returns the binding URI.
- *
- * @return the binding URI
- */
- public String getURI(){
- return null;
- }
-
- /**
- * Sets the binding URI.
- *
- * @param uri the binding URI
- */
- public void setURI(String uri){
- }
-
- /**
- * Returns the binding name.
- *
- * @return the binding name
- */
- public String getName(){
- return null;
- }
-
- /**
- * Sets the binding name.
- *
- * @param name the binding name
- */
- public void setName(String name){
- }
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- public boolean isUnresolved(){
- return false;
- }
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- public void setUnresolved(boolean unresolved){
- }
-
- /**
- * Clone the binding
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.java
deleted file mode 100644
index 5ebbea62eb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RemoteBindingHelper.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.binding.sca.impl;
-
-/**
- * TODO: TUSCANY-2578, implement a pluggable mechanism so sca binding impls can
- * add their own code to the decision on whether or not to use
- * the remote binding provider.
- */
-public class RemoteBindingHelper {
-
- private static boolean alwaysRemote;
- static {
- try {
- Class.forName("org.apache.tuscany.sca.binding.sca.jms.JMSSCABindingProviderFactory");
- Class.forName("javax.jms.IllegalStateException");
- alwaysRemote = true;
- } catch (ClassNotFoundException e) {
- alwaysRemote = false;
- }
- }
-
- public static boolean isTargetRemote() {
- return alwaysRemote;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.java
deleted file mode 100644
index 5c1cefb808..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProvider.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.binding.sca.impl;
-
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * The local SCA Binding provider implementation. It is not currently used.
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeSCABindingProvider implements ReferenceBindingProvider {
-
- private RuntimeComponentReference reference;
-
- public RuntimeSCABindingProvider(RuntimeComponent component, RuntimeComponentReference reference, SCABinding binding) {
- this.reference = reference;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return reference.getInterfaceContract();
- }
-
- public Invoker createInvoker(Operation operation) {
- return null;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.java
deleted file mode 100644
index 5dda74f72e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCABindingProviderFactory.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.binding.sca.impl;
-
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The factory for creating SCA Binding providers
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeSCABindingProviderFactory implements BindingProviderFactory<SCABinding> {
-
- private ExtensionPointRegistry extensionPoints;
-
- public RuntimeSCABindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
-
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- SCABinding binding) {
-
- return new RuntimeSCAReferenceBindingProvider(extensionPoints, component, reference, binding);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- SCABinding binding) {
- return new RuntimeSCAServiceBindingProvider(extensionPoints, component, service, binding);
- }
-
- public Class<SCABinding> getModelType() {
- return SCABinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
deleted file mode 100644
index fa5a9b062b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAReferenceBindingProvider.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.impl;
-
-import java.net.URI;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceUnavailableException;
-
-/**
- * The sca reference binding provider mediates between the twin requirements of
- * local sca bindings and remote sca bindings. In the local case is does
- * very little. When the sca binding model is set as being remote (because a
- * reference target can't be resolved in the current model) this binding will
- * try and create a remote connection to it
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeSCAReferenceBindingProvider implements ReferenceBindingProvider {
-
- private static final Logger logger = Logger.getLogger(RuntimeSCAReferenceBindingProvider.class.getName());
-
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private SCABinding binding;
- private boolean started = false;
-
- private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory = null;
- private ReferenceBindingProvider distributedProvider = null;
-
- public RuntimeSCAReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- SCABinding binding) {
- this.component = component;
- this.reference = reference;
- this.binding = binding;
-
- // look to see if a distributed SCA binding implementation has
- // been included on the classpath. This will be needed by the
- // provider itself to do it's thing
- ProviderFactoryExtensionPoint factoryExtensionPoint =
- extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- distributedProviderFactory =
- (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
- .getProviderFactory(DistributedSCABinding.class);
-
- }
-
- public boolean isTargetRemote() {
- boolean targetIsRemote = false;
-
- // first look at the target service and see if this has been resolved
- OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
-
- // The decision is based on the results of the wiring process in the assembly model
- // The SCA binding is used to represent unresolved reference targets, i.e. those
- // reference targets that need resolving at run time. We can tell by lookin if the
- // service to which this binding refers is resolved or not.
- //
- // TODO - When a callback is in operation. A callback reference bindings sometimes has to
- // act as though there is a local wire and sometimes as if there is a remote wire
- // what are the implications of this here?
-
- if (RemoteBindingHelper.isTargetRemote()) {
- if (reference.getInterfaceContract() != null) {
- targetIsRemote = reference.getInterfaceContract().getInterface().isRemotable();
- } else {
- targetIsRemote = true;
- }
- } else if (optimizableBinding.getTargetComponentService() != null) {
- if (optimizableBinding.getTargetComponentService().isUnresolved() == true) {
- targetIsRemote = true;
- } else {
- targetIsRemote = false;
- }
- } else {
- // the case where the wire is specified by URI, e.g. callbacks or user specified bindings, and
- // look at the provided URI to decide whether it is a local or remote case
- try {
- URI uri = new URI(binding.getURI());
- if (uri.isAbsolute()) {
- targetIsRemote = true;
- } else {
- targetIsRemote = false;
- }
- } catch (Exception ex) {
- targetIsRemote = false;
- }
- }
- return targetIsRemote;
- }
-
- private ReferenceBindingProvider getDistributedProvider() {
-
- if (isTargetRemote() || isRemotableCallback()) {
- // initialize the remote provider if it hasn't been done already
- if (distributedProvider == null) {
- if (reference.getInterfaceContract() != null && !reference.getInterfaceContract().getInterface().isRemotable()) {
- throw new IllegalStateException("Reference interface not remotable for component: " + component
- .getName()
- + " and reference: "
- + reference.getName());
- }
-
- if (distributedProviderFactory == null) {
- throw new IllegalStateException("No distributed SCA binding available for component: " + component
- .getName()
- + " and reference: "
- + reference.getName());
- }
-
- // create the remote provider
- DistributedSCABinding distributedBinding = new DistributedSCABindingImpl();
- distributedBinding.setSCABinding(binding);
-
- distributedProvider =
- distributedProviderFactory.createReferenceBindingProvider(component, reference, distributedBinding);
- }
- }
-
- return distributedProvider;
- }
-
- /*
- * This test is needed to make sure the distributed binding provider
- * is started and stopped if this is a callback binding that might
- * need to make a remote invocation.
- */
- private boolean isRemotableCallback() {
- if (reference.isCallback() &&
- reference.getInterfaceContract() != null &&
- reference.getInterfaceContract().getInterface().isRemotable() &&
- distributedProviderFactory != null) {
- return true;
- } else {
- return false;
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- if (isTargetRemote()) {
- return getDistributedProvider().getBindingInterfaceContract();
- } else {
- if (reference.getReference() != null) {
- return reference.getReference().getInterfaceContract();
- } else {
- return reference.getInterfaceContract();
- }
- }
- }
-
- public boolean supportsOneWayInvocation() {
- if (isTargetRemote()) {
- return getDistributedProvider().supportsOneWayInvocation();
- } else {
- return false;
- }
- }
-
- private Invoker getInvoker(RuntimeWire wire, Operation operation) {
- EndpointReference target = wire.getTarget();
- if (target != null) {
- RuntimeComponentService service = (RuntimeComponentService)target.getContract();
- if (service != null) { // not a callback wire
- SCABinding scaBinding = service.getBinding(SCABinding.class);
- InvocationChain chain =
- service.getInvocationChain(scaBinding, wire.getSource().getInterfaceContract(), operation);
- return chain == null ? null : new SCABindingInvoker(chain);
- }
- }
- return null;
- }
-
- public Invoker createInvoker(Operation operation) {
- if (isTargetRemote()) {
- return getDistributedProvider().createInvoker(operation);
- } else {
- RuntimeWire wire = reference.getRuntimeWire(binding);
- Invoker invoker = getInvoker(wire, operation);
- if (invoker == null) {
- throw new ServiceUnavailableException("Unable to create SCA binding invoker for local target " + component.getName()
- + " reference "
- + reference.getName()
- + " (bindingURI="
- + binding.getURI()
- + " operation="
- + operation.getName()
- + ")" );
- }
- return invoker;
- }
- }
-
- public void start() {
- if (started) {
- return;
- } else {
- started = true;
- }
-
- if (getDistributedProvider() != null) {
- distributedProvider.start();
- }
- }
-
- public void stop() {
- if (!started) {
- return;
- } else {
- started = false;
- }
-
- if (getDistributedProvider() != null) {
- distributedProvider.stop();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
deleted file mode 100644
index 8994ba5381..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/RuntimeSCAServiceBindingProvider.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.sca.impl;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.DistributedSCABinding;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The sca service binding provider mediates between the twin requirements of
- * local sca bindings and remote sca bindings. In the local case is does
- * very little. When the sca binding model is set as being remote this binding will
- * try and create a remote service endpoint for remote references to connect to
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeSCAServiceBindingProvider implements ServiceBindingProvider {
-
- private RuntimeComponentService service;
- private BindingProviderFactory<DistributedSCABinding> distributedProviderFactory;
- private ServiceBindingProvider distributedProvider;
- private DistributedSCABinding distributedBinding;
-
- public RuntimeSCAServiceBindingProvider(ExtensionPointRegistry extensionPoints,
- RuntimeComponent component,
- RuntimeComponentService service,
- SCABinding binding) {
- this.service = service;
- // if there is potentially a wire to this service that crosses the node boundary
- if (service.getInterfaceContract().getInterface().isRemotable()) {
-
- // look to see if a distributed SCA binding implementation has
- // been included on the classpath. This will be needed by the
- // provider itself to do it's thing
- ProviderFactoryExtensionPoint factoryExtensionPoint =
- extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- distributedProviderFactory =
- (BindingProviderFactory<DistributedSCABinding>)factoryExtensionPoint
- .getProviderFactory(DistributedSCABinding.class);
-
- // Check the things that will generally be required to set up a
- // distributed sca domain reference provider. I.e. make sure that we have a
- // - distributed implementation of the sca binding available
- // - remotable interface on the service
- if (distributedProviderFactory != null) {
-
- URI serviceURI = null;
- try {
- serviceURI = new URI(binding.getURI());
- } catch(Exception ex) {
-
- }
-
- if (RemoteBindingHelper.isTargetRemote() || ((serviceURI != null) && (serviceURI.isAbsolute()))) {
-
- // create a nested provider to handle the remote case
- distributedBinding = new DistributedSCABindingImpl();
- distributedBinding.setSCABinding(binding);
-
- distributedProvider =
- distributedProviderFactory.createServiceBindingProvider(component, service, distributedBinding);
-
-
- } else {
- /* do nothing at the moment as only apps using the node implementation
- * will currently have the distributed domain set.
- *
- throw new IllegalStateException("No distributed domain available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- */
- }
- } else {
- /* do nothing at the moment as all services with remotable interfaces
- * are marked as remote
- throw new IllegalStateException("No distributed SCA binding available for component: "+
- component.getName() +
- " and service: " +
- service.getName());
- */
- }
- }
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- if (distributedProvider != null) {
- return distributedProvider.getBindingInterfaceContract();
- } else {
- if (service.getService() != null) {
- return service.getService().getInterfaceContract();
- } else {
- return service.getInterfaceContract();
- }
- }
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- if (distributedProvider != null) {
- distributedProvider.start();
- }
- }
-
- public void stop() {
- if (distributedProvider != null) {
- distributedProvider.stop();
- }
-
- if (distributedBinding != null) {
- // reset the binding URI to null so that if the composite containing the component
- // with the service/binding is restarted the binding will have the correct URI set
- SCABinding scaBinding = distributedBinding.getSCABinding();
- try {
- URI tempURI = new URI(scaBinding.getURI());
- if (!tempURI.isAbsolute()){
- scaBinding.setURI(null);
- }
- } catch (Exception ex){
- scaBinding.setURI(null);
- }
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.java
deleted file mode 100644
index ea758823a9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingFactoryImpl.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.binding.sca.impl;
-
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-
-/**
- * A factory for the SCA binding model.
- *
- * @version $Rev$ $Date$
- */
-public class SCABindingFactoryImpl implements SCABindingFactory {
-
- public SCABindingFactoryImpl (){
-
- }
-
- public SCABinding createSCABinding() {
- return new SCABindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
deleted file mode 100644
index 638a263a61..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.sca.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * The assembly mode object for an SCA binding.
- *
- * @version $Rev$ $Date$
- */
-public class SCABindingImpl implements SCABinding, Extensible, PolicySetAttachPoint, OptimizableBinding, AutomaticBinding {
- private String name;
- private String uri;
- private List<Object> extensions = new ArrayList<Object>();
- private List<Extension> attributeExtensions = new ArrayList<Extension>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
-
- private Component targetComponent;
- private ComponentService targetComponentService;
- private Binding targetBinding;
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- private boolean isAutomatic = false;
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- /**
- * Constructs a new SCA binding.
- */
- protected SCABindingImpl() {
- }
-
- // SCA Binding operations
-
- /**
- * Setters for the binding name. Defaults to the
- * name of the service or reference with which the binding is
- * associated
- *
- * @return the binding name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Setter for the binding name
- *
- * @param name the binding name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Getters for the binding URI. The computed URI for the
- * service that the reference is targeting or which the service represents
- * depending on whether the biding is associated with a reference or
- * service
- *
- * @return the binding URI
- */
- public String getURI() {
- return uri;
- }
-
- /**
- * Setter for the binding URI
- *
- * @param uri the binding URI
- */
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public List<Extension> getAttributeExtensions() {
- return attributeExtensions;
- }
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- public boolean isUnresolved() {
- if (targetComponentService == null){
- return true;
- } else {
- return targetComponentService.isUnresolved();
- }
- }
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- public void setUnresolved(boolean unresolved) {
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- // Wireable binding operations
-
- /**
- * @return the targetComponent
- */
- public Component getTargetComponent() {
- return targetComponent;
- }
-
- /**
- * @param targetComponent the targetComponent to set
- */
- public void setTargetComponent(Component targetComponent) {
- this.targetComponent = targetComponent;
- }
-
- /**
- * @return the targetComponentService
- */
- public ComponentService getTargetComponentService() {
- return targetComponentService;
- }
-
- /**
- * @param targetComponentService the targetComponentService to set
- */
- public void setTargetComponentService(ComponentService targetComponentService) {
- this.targetComponentService = targetComponentService;
- }
-
- /**
- * @return the targetBinding
- */
- public Binding getTargetBinding() {
- return targetBinding;
- }
-
- /**
- * @param targetBinding the targetBinding to set
- */
- public void setTargetBinding(Binding targetBinding) {
- this.targetBinding = targetBinding;
- }
-
- public void setPolicySets(List<PolicySet> policySets) {
- this.policySets = policySets;
- }
-
- public void setRequiredIntents(List<Intent> intents) {
- this.requiredIntents = intents;
- }
-
-
- public void setIsAutomatic(boolean isAutomatic){
- this.isAutomatic = isAutomatic;
- }
-
- public boolean getIsAutomatic(){
- return this.isAutomatic;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.java
deleted file mode 100644
index 52c0f64fe5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/java/org/apache/tuscany/sca/binding/sca/impl/SCABindingInvoker.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.binding.sca.impl;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SCABindingInvoker implements Interceptor, DataExchangeSemantics {
- private InvocationChain chain;
-
- /**
- * Construct a SCABindingInvoker that delegates to the service invocaiton chain
- * @param chain
- */
- public SCABindingInvoker(InvocationChain chain) {
- super();
- this.chain = chain;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
- */
- public Invoker getNext() {
- return chain.getHeadInvoker();
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
- */
- public void setNext(Invoker next) {
- // NOOP
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- return getNext().invoke(msg);
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference()
- */
- public boolean allowsPassByReference() {
- return chain.allowsPassByReference();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory b/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
deleted file mode 100644
index 4efa03a933..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.SCABindingFactory
+++ /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.binding.sca.impl.SCABindingFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index 5c6b8e21fc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.sca.impl.RuntimeSCABindingProviderFactory;model=org.apache.tuscany.sca.assembly.SCABinding
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index 22c9a64b05..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.binding.sca.SCABindingDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
deleted file mode 100644
index 8bac9e01c9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
+++ /dev/null
@@ -1,26 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <sca:bindingType type="sca:binding.sca" mayProvide="" alwaysProvides=""/>
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java b/branches/sca-java-1.5.1/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
deleted file mode 100644
index ff396566d6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/test/java/org/apace/tuscany/sca/binding/sca/SCABindingTestCase.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apace.tuscany.sca.binding.sca;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeModelResolver;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * SCABindingTestCase
- *
- * @version $Rev$ $Date$
- */
-public class SCABindingTestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeModelResolver resolver;
- private CompositeBuilder compositeBuilder;
-
- @Before
- public void init() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- resolver = new CompositeModelResolver(null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
-
- }
-
- @Test
- public void testSCABindingFactory() {
- SCABindingFactory factory = new SCABindingFactoryImpl();
- Assert.assertNotNull(factory.createSCABinding());
- }
-
- @Test
- public void testBuildModel() {
- try{
- InputStream is = getClass().getResourceAsStream("/Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
-
- is.close();
- Assert.assertNotNull(composite);
-
- resolver.addModel(composite);
-
- staxProcessor.resolve(composite, resolver);
-
- compositeBuilder.build(composite);
-
- SCABinding referenceSCABinding = (SCABinding) composite.getComponents().get(0).getReferences().get(0).getBindings().get(0);
- SCABinding serviceSCABinding = (SCABinding) composite.getComponents().get(1).getServices().get(0).getBindings().get(0);
-
- Assert.assertNotNull(referenceSCABinding);
- Assert.assertNotNull(serviceSCABinding);
- } catch (Exception ex) {
- Assert.fail(ex.getMessage());
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-sca/src/test/resources/Calculator.composite b/branches/sca-java-1.5.1/modules/binding-sca/src/test/resources/Calculator.composite
deleted file mode 100644
index 37b26f3d68..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-sca/src/test/resources/Calculator.composite
+++ /dev/null
@@ -1,52 +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">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- <service name="AddService">
- <interface.java interface="calculator.AddService"/>
- </service>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/LICENSE b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/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-java-1.5.1/modules/binding-ws-axis2-policy/NOTICE b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/pom.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/pom.xml
deleted file mode 100644
index 0f8a0ce6ed..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/pom.xml
+++ /dev/null
@@ -1,149 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-ws-axis2-policy</artifactId>
- <name>Apache Tuscany SCA Policy Model for Axis2 Web Service Binding</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- <version>1.2.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>1.4.1</version>
- <exclusions>
- <exclusion>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- <version>2.0.4</version>
- <exclusions>
- <exclusion>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ws.axis2.policy</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ws.axis2.policy*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.java
deleted file mode 100644
index 8fecb84bb4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicy.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.binding.ws.axis2.policy.authentication.token;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationPolicy implements Policy {
- public static final QName AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "axis2TokenAuthentication");
- public static final String AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME = "tokenName";
-
- private QName tokenName;
-
- public QName getTokenName() {
- return tokenName;
- }
-
- public void setTokenName(QName tokenName) {
- this.tokenName = tokenName;
- }
-
- public QName getSchemaName() {
- return AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.java
deleted file mode 100644
index e8a7872858..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProcessor.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.binding.ws.axis2.policy.authentication.token;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<Axis2TokenAuthenticationPolicy> {
-
- public QName getArtifactType() {
- return Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_POLICY_QNAME;
- }
-
- public Axis2TokenAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public Axis2TokenAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Axis2TokenAuthenticationPolicy policy = new Axis2TokenAuthenticationPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(getArtifactType()) ) {
- policy.setTokenName(getQName(reader, Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME));
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( getArtifactType().equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(Axis2TokenAuthenticationPolicy policy, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if ( policy.getTokenName() != null ) {
- writer.writeStartElement(prefix,
- Axis2TokenAuthenticationPolicy.AXIS2_TOKEN_AUTHENTICATION_TOKEN_NAME,
- getArtifactType().getNamespaceURI());
- writer.writeCharacters(policy.getTokenName().toString());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- public Class<Axis2TokenAuthenticationPolicy> getModelType() {
- return Axis2TokenAuthenticationPolicy.class;
- }
-
- public void resolve(Axis2TokenAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index cef881af30..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationPolicyProviderFactory implements PolicyProviderFactory<Axis2TokenAuthenticationPolicy> {
- private ExtensionPointRegistry registry;
-
- public Axis2TokenAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new Axis2TokenAuthenticationReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new Axis2TokenAuthenticationServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java
deleted file mode 100644
index c6cd96e647..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyInterceptor.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token;
-
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.Policy;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationReferencePolicyInterceptor implements Interceptor {
-
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private Axis2TokenAuthenticationPolicy policy;
-
- public Axis2TokenAuthenticationReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof Axis2TokenAuthenticationPolicy){
- policy = (Axis2TokenAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- // could call out here to some 3rd party system to get credentials
-
- if ( policy.getTokenName() != null){
- // create Axis representation of header
- Axis2SOAPHeaderString header = new Axis2SOAPHeaderString();
- header.setHeaderName(policy.getTokenName());
- header.setHeaderString("SomeWSAuthorizationToken");
-
- // add header to Tuscany message
- msg.getHeaders().add(header);
- }
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java
deleted file mode 100644
index 147fd1f42a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationReferencePolicyProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public Axis2TokenAuthenticationReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new Axis2TokenAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.java
deleted file mode 100644
index 2928647445..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyInterceptor.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.binding.ws.axis2.policy.authentication.token;
-
-
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyUtil;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeader;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.token.TokenPrincipal;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationServicePolicyInterceptor implements Interceptor {
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private Axis2TokenAuthenticationPolicy policy;
-
- public Axis2TokenAuthenticationServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof Axis2TokenAuthenticationPolicy){
- policy = (Axis2TokenAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
-
- Axis2SOAPHeaderString header = (Axis2SOAPHeaderString)Axis2HeaderPolicyUtil.getHeader(msg, policy.getTokenName());
-
- if (header != null) {
- System.out.println("Web service received token: " + header.getHeaderString());
-
- // call out here to some 3rd party system to do whatever you
- // need to turn header credentials into an authenticated principal
-
- Subject subject = SecurityUtil.getSubject(msg);
- Principal principal = new TokenPrincipal(header.getHeaderString());
- subject.getPrincipals().add(principal);
- }
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.java
deleted file mode 100644
index e3e2a4b9a0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/authentication/token/Axis2TokenAuthenticationServicePolicyProvider.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.binding.ws.axis2.policy.authentication.token;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2TokenAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public Axis2TokenAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new Axis2TokenAuthenticationServicePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java
deleted file mode 100644
index 8d08a3f78e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicy.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.configuration;
-
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2ConfigParamPolicy implements Policy {
- public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "wsConfigParam");
- private Map<String, OMElement> paramElements = new Hashtable<String, OMElement>();
-
- public Map<String, OMElement> getParamElements() {
- return paramElements;
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java
deleted file mode 100644
index 5ac4e3f5fd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyHandler.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.configuration;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-
-/**
- * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class Axis2ConfigParamPolicyHandler implements PolicyHandler {
- private PolicySet applicablePolicySet = null;
-
- public void setUp(Object... context) {
- Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
- Parameter configParam = null;
- for ( Object contextObject : context ) {
- if ( contextObject instanceof ConfigurationContext ) {
- ConfigurationContext configContext = (ConfigurationContext)contextObject;
- for ( Object policy : applicablePolicySet.getPolicies() ) {
- if ( policy instanceof Axis2ConfigParamPolicy ) {
- axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
- for ( String paramName : axis2ConfigParamPolicy.getParamElements().keySet() ) {
- configParam = new Parameter(paramName,
- axis2ConfigParamPolicy.getParamElements().get(paramName).getFirstElement());
- configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName));
- try {
- configContext.getAxisConfiguration().addParameter(configParam);
- } catch ( AxisFault e ) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- }
- }
- }
-
- public void cleanUp(Object... context) {
- }
-
- public void beforeInvoke(Object... context) {
- }
-
- public void afterInvoke(Object... context) {
-
- }
-
- public PolicySet getApplicablePolicySet() {
- return applicablePolicySet;
- }
-
- public void setApplicablePolicySet(PolicySet applicablePolicySet) {
- this.applicablePolicySet = applicablePolicySet;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java
deleted file mode 100644
index 6478fbedad..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProcessor.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.configuration;
-
-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.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Axis2ConfigParamPolicyProcessor implements StAXArtifactProcessor<Axis2ConfigParamPolicy> {
- public static final QName AXIS2_CONFIG_PARAM_POLICY_QNAME = Axis2ConfigParamPolicy.NAME;
- public static final String PARAMETER = "parameter";
- public QName getArtifactType() {
- return AXIS2_CONFIG_PARAM_POLICY_QNAME;
- }
-
- public Axis2ConfigParamPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- public Axis2ConfigParamPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Axis2ConfigParamPolicy policy = new Axis2ConfigParamPolicy();
- int event = reader.getEventType();
- QName name = null;
- OMElement parameterElement = null;
- String paramName = null;
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( PARAMETER.equals(name.getLocalPart()) ) {
- paramName = reader.getAttributeValue(null, Constants.NAME);
- parameterElement = loadElement(reader);
- policy.getParamElements().put(paramName, parameterElement);
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( AXIS2_CONFIG_PARAM_POLICY_QNAME.equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(Axis2ConfigParamPolicy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<Axis2ConfigParamPolicy> getModelType() {
- return Axis2ConfigParamPolicy.class;
- }
-
- public void resolve(Axis2ConfigParamPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
- private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement head = fac.createOMElement(reader.getName());
- OMElement current = head;
- while (true) {
- switch (reader.next()) {
- case XMLStreamConstants.START_ELEMENT:
- //since the axis2 code checks against a no namespace we need to generate accordingly
- QName name = new QName(reader.getName().getLocalPart());
- OMElement child = fac.createOMElement(name, current);
-
- int count = reader.getNamespaceCount();
- for (int i = 0; i < count; i++) {
- String prefix = reader.getNamespacePrefix(i);
- String ns = reader.getNamespaceURI(i);
- child.declareNamespace(ns, prefix);
- }
-
- if(!"".equals(name.getNamespaceURI())) {
- child.declareNamespace(name.getNamespaceURI(), name.getPrefix());
- }
-
- // 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 (ns != null) {
- child.addAttribute(qname, value, fac.createOMNamespace(ns, prefix));
- child.declareNamespace(ns, prefix);
- } else {
- child.addAttribute(qname, value, null);
- }
- }
- current = child;
- break;
- case XMLStreamConstants.CDATA:
- fac.createOMText(current, reader.getText());
- break;
- case XMLStreamConstants.CHARACTERS:
- fac.createOMText(current, reader.getText());
- break;
- case XMLStreamConstants.END_ELEMENT:
- if ( current == head ) {
- return head;
- } else {
- current = (OMElement)current.getParent();
- }
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.java
deleted file mode 100644
index 21261359cb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/Axis2ConfigParamPolicyProviderFactory.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.binding.ws.axis2.policy.configuration;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2ConfigParamPolicyProviderFactory implements PolicyProviderFactory<Axis2ConfigParamPolicy> {
-
- public Axis2ConfigParamPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<Axis2ConfigParamPolicy> getModelType() {
- return Axis2ConfigParamPolicy.class;
- }
-
- // FIXME: [rfeng] I think this should be refactored into the binding.ws axis2 code
- public void setUp(ConfigurationContext configContext, PolicySet ps) {
- Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
- Parameter configParam = null;
- for (Object policy : ps.getPolicies()) {
- if (policy instanceof Axis2ConfigParamPolicy) {
- axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
- for (String paramName : axis2ConfigParamPolicy.getParamElements().keySet()) {
- configParam =
- new Parameter(paramName, axis2ConfigParamPolicy.getParamElements().get(paramName)
- .getFirstElement());
- configParam.setParameterElement(axis2ConfigParamPolicy.getParamElements().get(paramName));
- try {
- configContext.getAxisConfiguration().addParameter(configParam);
- } catch (AxisFault e) {
- throw new ServiceRuntimeException(e);
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.java
deleted file mode 100644
index 244e501901..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicy.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.binding.ws.axis2.policy.header;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderPolicy implements Policy {
- public static final QName AXIS2_HEADER_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "axis2Header");
- public static final String AXIS2_HEADER_NAME = "headerName";
-
- private QName headerName;
-
- public QName getHeaderName() {
- return headerName;
- }
-
- public void setHeaderName(QName headerName) {
- this.headerName = headerName;
- }
-
- public QName getSchemaName() {
- return AXIS2_HEADER_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.java
deleted file mode 100644
index 3466b9def7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProcessor.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.binding.ws.axis2.policy.header;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.logging.Level;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<Axis2HeaderPolicy> {
-
- public QName getArtifactType() {
- return Axis2HeaderPolicy.AXIS2_HEADER_POLICY_QNAME;
- }
-
- public Axis2HeaderPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public Axis2HeaderPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Axis2HeaderPolicy policy = new Axis2HeaderPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(getArtifactType()) ) {
- policy.setHeaderName(getQName(reader, Axis2HeaderPolicy.AXIS2_HEADER_NAME));
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( getArtifactType().equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(Axis2HeaderPolicy policy, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if ( policy.getHeaderName() != null ) {
- writer.writeStartElement(prefix,
- Axis2HeaderPolicy.AXIS2_HEADER_NAME,
- getArtifactType().getNamespaceURI());
- writer.writeCharacters(policy.getHeaderName().toString());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- public Class<Axis2HeaderPolicy> getModelType() {
- return Axis2HeaderPolicy.class;
- }
-
- public void resolve(Axis2HeaderPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java
deleted file mode 100644
index 71833df382..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.header;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderPolicyProviderFactory implements PolicyProviderFactory<Axis2HeaderPolicy> {
- private ExtensionPointRegistry registry;
-
- public Axis2HeaderPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;//new TokenAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new Axis2HeaderReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new Axis2HeaderServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java
deleted file mode 100644
index 98d011a8fc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderPolicyUtil.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.header;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.invocation.Message;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderPolicyUtil {
-
- public static Axis2SOAPHeader getHeader(Message msg, QName headerName){
-
- Axis2SOAPHeader axis2Header = null;
-
- for (Object header : msg.getHeaders()){
- if (header instanceof Axis2SOAPHeader){
- Axis2SOAPHeader tmpHeader = (Axis2SOAPHeader)header;
-
- if (tmpHeader.getHeaderName().equals(headerName)){
- axis2Header = tmpHeader;
- break;
- }
- }
- }
-
- return axis2Header;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.java
deleted file mode 100644
index 1b3315bb76..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyInterceptor.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.binding.ws.axis2.policy.header;
-
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.Policy;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderReferencePolicyInterceptor implements Interceptor {
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private Axis2HeaderPolicy policy;
-
- public Axis2HeaderReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof Axis2HeaderPolicy){
- policy = (Axis2HeaderPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- // TODO - not yet implemented
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java
deleted file mode 100644
index 0af5a09d8d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderReferencePolicyProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.header;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public Axis2HeaderReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2HeaderPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new Axis2HeaderReferencePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.java
deleted file mode 100644
index a758ca5261..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyInterceptor.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.binding.ws.axis2.policy.header;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderServicePolicyInterceptor implements Interceptor {
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private Axis2HeaderPolicy policy;
-
- public Axis2HeaderServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof Axis2HeaderPolicy){
- policy = (Axis2HeaderPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
- // TODO - not yet implemented
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.java
deleted file mode 100644
index 126073beb7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2HeaderServicePolicyProvider.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.binding.ws.axis2.policy.header;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Axis2HeaderServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public Axis2HeaderServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (Axis2HeaderPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new Axis2HeaderServicePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java
deleted file mode 100644
index 7a1f26bf04..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeader.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.header;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2SOAPHeader {
-
- private QName headerName;
-
- public QName getHeaderName() {
- return headerName;
- }
-
- public void setHeaderName(QName headerName) {
- this.headerName = headerName;
- }
-
- public OMElement getAsSOAPHeaderBlock(OMFactory factory) {
- OMNamespace ns1 = factory.createOMNamespace(headerName.getNamespaceURI(),
- headerName.getPrefix());
- OMElement header = ((SOAPFactory)factory).createSOAPHeaderBlock(headerName.getLocalPart(),ns1);
- return header;
- }
-
- public void setAsSOAPHeaderBlock(OMElement header) {
- headerName = header.getQName();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java
deleted file mode 100644
index 0eefeac87b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/header/Axis2SOAPHeaderString.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.header;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2SOAPHeaderString extends Axis2SOAPHeader {
-
- private String headerString;
-
- public String getHeaderString() {
- return headerString;
- }
-
- public void setHeaderString(String headerString) {
- this.headerString = headerString;
- }
-
- public OMElement getAsSOAPHeaderBlock(OMFactory factory) {
- OMElement header = super.getAsSOAPHeaderBlock(factory);
- OMText headerText = factory.createOMText(header, headerString);
- header.addChild(headerText);
- return header;
- }
-
- public void setAsSOAPHeaderBlock(OMElement header) {
- super.setAsSOAPHeaderBlock(header);
- headerString = header.getText();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSSecurityPolicyHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSSecurityPolicyHandler.java
deleted file mode 100644
index fabc07c7cf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/wspolicy/WSSecurityPolicyHandler.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.binding.ws.axis2.policy.wspolicy;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.neethi.Policy;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-/**
- * Policy handler to handle PolicySet containing Policy (WS-Security-Policy) instances
- *
- * @version $Rev$ $Date$
- */
-public class WSSecurityPolicyHandler implements PolicyHandler {
- private PolicySet applicablePolicySet = null;
-
- public void setUp(Object... context) {
- for ( Object contextObject : context ) {
- if ( contextObject instanceof ConfigurationContext ) {
- ConfigurationContext configContext = (ConfigurationContext)contextObject;
- for ( Object policy : applicablePolicySet.getPolicies() ) {
- if ( policy instanceof Policy ) {
- Policy wsPolicy = (Policy)policy;
- try {
- configContext.getAxisConfiguration().applyPolicy(wsPolicy);
-
- // TUSCANY-2824
- // hack to make service side pick up rampart policies
- // "rampartPolicy" comes from RampartMessageData.KEY_RAMPART_POLICY
- // but I'm avoiding adding an explicit dependency just yet.
- // There must be a proper way of getting rampart to recognize
- // these policies
- configContext.setProperty("rampartPolicy", wsPolicy);
-
- } catch ( AxisFault e ) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- }
- }
-
- public void cleanUp(Object... context) {
- }
-
- public void beforeInvoke(Object... context) {
-
- }
-
- public void afterInvoke(Object... context) {
-
- }
-
- public PolicySet getApplicablePolicySet() {
- return applicablePolicySet;
- }
-
- public void setApplicablePolicySet(PolicySet applicablePolicySet) {
- this.applicablePolicySet = applicablePolicySet;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 96782b74bf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wsConfigParam,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#axis2TokenAuthentication,model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#axis2Header,model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
deleted file mode 100644
index 9f1e9450ba..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
-# handler classname;qname=<policy intent addressed>;model=<policy model class>
-org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#authentication,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#integrity,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#confidentiality,model=org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.wspolicy.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#authentication,model=org.apache.neethi.Policy
-org.apache.tuscany.sca.binding.ws.axis2.policy.wspolicy.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#integrity,model=org.apache.neethi.Policy
-org.apache.tuscany.sca.binding.ws.axis2.policy.wspolicy.WSSecurityPolicyHandler;intent=http://www.osoa.org/xmlns/sca/1.0#confidentiality,model=org.apache.neethi.Policy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index ced48cf236..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /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.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy
-org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyProviderFactory;model=org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java
deleted file mode 100644
index cf14e54b5f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/PolicyReadTestCase.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.policy.configuration;
-
-
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-import junit.framework.TestCase;
-
-/**
- *
- * Test the reading of ws config params policy.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyReadTestCase extends TestCase {
-
- public void testPolicyReading() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- URL url = getClass().getResource("mock_policies.xml");
-
- InputStream urlStream = url.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
-
- Axis2ConfigParamPolicy policy = (Axis2ConfigParamPolicy)staxProcessor.read(reader);
- assertEquals(policy.getParamElements().size(), 2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml
deleted file mode 100644
index 77f750cd0d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2-policy/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/policy/configuration/mock_policies.xml
+++ /dev/null
@@ -1,36 +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.
--->
-<tuscany:wsConfigParam xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
- <parameter name="InflowSecurity">
- <action>
- <items>Timestamp Signature</items>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
- </action>
- </parameter>
- <parameter name="OutflowSecurity">
- <action>
- <items>Timestamp Signature</items>
- <user>TuscanyWsUser</user>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/security.properties</signaturePropFile>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.IntegrityPWCBHandler</passwordCallbackClass>" +
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- </action>
- </parameter>
-</tuscany:wsConfigParam> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/LICENSE b/branches/sca-java-1.5.1/modules/binding-ws-axis2/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/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-java-1.5.1/modules/binding-ws-axis2/NOTICE b/branches/sca-java-1.5.1/modules/binding-ws-axis2/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/pom.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/pom.xml
deleted file mode 100644
index fbd89161b1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/pom.xml
+++ /dev/null
@@ -1,351 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-binding-ws-axis2</artifactId>
- <name>Apache Tuscany SCA Axis2-based WS Binding Extension</name>
-
- <repositories>
- <repository>
- <id>apache.ws</id>
- <name>Apache WebServices Repository</name>
- <url>http://ws.zones.apache.org/repository/</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-jaxb-axiom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml-ws</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-axis2-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>1.4.1</version>
- <exclusions>
- <exclusion>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-launcher</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-java2wsdl</artifactId>
- <version>1.4.1</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-launcher</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-codegen</artifactId>
- <version>1.4.1</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- <version>2.0.4</version>
- <exclusions>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-mtompolicy</artifactId>
- <version>1.4.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.santuario</groupId>
- <artifactId>xmlsec</artifactId>
- <version>1.4.2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.security</groupId>
- <artifactId>wss4j</artifactId>
- <version>1.5.4</version>
- <exclusions>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk13</artifactId>
- </exclusion>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>mex</artifactId>
- <version>1.41</version>
- <classifier>impl</classifier>
- </dependency>
-
- <dependency>
- <groupId>org.apache.rampart</groupId>
- <artifactId>rampart-core</artifactId>
- <version>1.4</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant-nodeps</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>addressing</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-xmlbeans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>mex</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-adb</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-codegen</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-adb-codegen</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk13</artifactId>
- </exclusion>
- <exclusion>
- <groupId>bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- xerces, xalan, and xml-apis are required for running in websphere -->
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- <scope>optional</scope>
- </dependency>
-
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
- </dependency>
-
- <dependency>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- <version>1.3.03</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ws.axis2</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ws.axis2*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
deleted file mode 100644
index 3ed48425ab..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingBasicAuthenticationConfigurator;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingHeaderConfigurator;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-
-/**
- * Axis2BindingInvoker uses an Axis2 OperationClient to invoke a remote web service
- *
- * @version $Rev$ $Date$
- */
-public class Axis2BindingInvoker implements Invoker, DataExchangeSemantics {
-
- public static final QName QNAME_WSA_FROM =
- new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM,
- AddressingConstants.WSA_DEFAULT_PREFIX);
- public static final String TUSCANY_PREFIX = "tuscany";
- public static final QName CALLBACK_ID_REFPARM_QN =
- new QName(Constants.SCA10_TUSCANY_NS, "CallbackID", TUSCANY_PREFIX);
- public static final QName CONVERSATION_ID_REFPARM_QN =
- new QName(Constants.SCA10_TUSCANY_NS, "ConversationID", TUSCANY_PREFIX);
- public static long GLOBAL_AXIS_TIMEOUT = 240000L;
-
-
- private Axis2ServiceClient serviceClient;
- private QName wsdlOperationName;
- private Options options;
- private SOAPFactory soapFactory;
- private List<PolicyHandler> policyHandlerList = null;
- private WebServiceBinding wsBinding;
-
- private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
- private Axis2TokenAuthenticationPolicy axis2TokenAuthenticationPolicy = null;
- private List<Axis2HeaderPolicy> axis2HeaderPolicies = new ArrayList<Axis2HeaderPolicy>();
-
- public Axis2BindingInvoker(Axis2ServiceClient serviceClient,
- QName wsdlOperationName,
- Options options,
- SOAPFactory soapFactory,
- List<PolicyHandler> policyHandlerList,
- WebServiceBinding wsBinding) {
- this.serviceClient = serviceClient;
- this.wsdlOperationName = wsdlOperationName;
- this.options = options;
- this.soapFactory = soapFactory;
- this.policyHandlerList = policyHandlerList;
- this.wsBinding = wsBinding;
-
- // find out which policies are active
- if (wsBinding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)wsBinding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
- } else if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- axis2TokenAuthenticationPolicy = (Axis2TokenAuthenticationPolicy)p;
- } else if (Axis2HeaderPolicy.class.isInstance(p)) {
- axis2HeaderPolicies.add((Axis2HeaderPolicy)p);
- }else {
- // etc. check for other types of policy being present
- }
- }
- }
- }
- }
-
- private static final QName EXCEPTION = new QName("", "Exception");
-
- public Message invoke(Message msg) {
- try {
- Object resp = invokeTarget(msg);
-
- msg.setBody(resp);
- } catch (AxisFault e) {
- if (e.getDetail() != null ) {
- FaultException f = new FaultException(e.getMessage(), e.getDetail(), e);
- f.setFaultName(e.getDetail().getQName());
- msg.setFaultBody(f);
- } else {
- msg.setFaultBody(e);
- }
- } catch (Throwable e) {
- msg.setFaultBody(e);
- }
-
- return msg;
- }
-
- protected Object invokeTarget(Message msg) throws AxisFault {
- final OperationClient operationClient = createOperationClient(msg);
-
- // ensure connections are tracked so that they can be closed by the reference binding
- MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
- requestMC.getOptions().setTimeOutInMilliSeconds(GLOBAL_AXIS_TIMEOUT);
-
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.beforeInvoke(msg, requestMC, operationClient);
- }
-
- // set policy specified headers
- for (Axis2HeaderPolicy policy : axis2HeaderPolicies){
- Axis2BindingHeaderConfigurator.setHeader(requestMC, msg, policy.getHeaderName());
- }
-
- if (basicAuthenticationPolicy != null) {
- Axis2BindingBasicAuthenticationConfigurator.setOperationOptions(operationClient, msg, basicAuthenticationPolicy);
- }
-
- if (axis2TokenAuthenticationPolicy != null) {
- Axis2BindingHeaderConfigurator.setHeader(requestMC, msg, axis2TokenAuthenticationPolicy.getTokenName());
- }
-
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws AxisFault {
- operationClient.execute(true);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- operationClient.complete(requestMC);
- throw (AxisFault)e.getException();
- }
-
- MessageContext responseMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.afterInvoke(msg, responseMC, operationClient);
- }
-
- OMElement response = responseMC.getEnvelope().getBody().getFirstElement();
-
- // FIXME: [rfeng] We have to pay performance penalty to build the complete OM as the operationClient.complete() will
- // release the underlying HTTP connection.
- // Force the response to be populated, see https://issues.apache.org/jira/browse/TUSCANY-1541
- if (response != null) {
- response.build();
- }
-
- operationClient.complete(requestMC);
-
- return response;
- }
-
- @SuppressWarnings("deprecation")
- protected OperationClient createOperationClient(Message msg) throws AxisFault {
- SOAPEnvelope env = soapFactory.getDefaultEnvelope();
- Object[] args = (Object[])msg.getBody();
- if (args != null && args.length > 0) {
- SOAPBody body = env.getBody();
- for (Object bc : args) {
- if (bc instanceof OMElement) {
- body.addChild((OMElement)bc);
- } else {
- throw new IllegalArgumentException(
- "Can't handle mixed payloads between OMElements and other types.");
- }
- }
- }
- final MessageContext requestMC = new MessageContext();
- requestMC.setEnvelope(env);
-
- // Axis2 operationClients can not be shared so create a new one for each request
- final OperationClient operationClient = serviceClient.getServiceClient().createClient(wsdlOperationName);
- operationClient.setOptions(options);
-
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
-
- // set callback endpoint and callback ID for WS-Addressing header
- EndpointReference fromEPR = null;
- org.apache.tuscany.sca.runtime.EndpointReference callbackEPR = parameters.getCallbackReference();
- if (callbackEPR != null) {
- fromEPR = new EndpointReference(callbackEPR.getBinding().getURI());
- }
- Object callbackID = parameters.getCallbackID();
- if (callbackID != null) {
- if (fromEPR == null) {
- fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
- }
- //FIXME: serialize callback ID to XML in case it is not a string
- fromEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, callbackID.toString());
- }
-
- // set conversation ID for WS-Addressing header
- Object conversationId = parameters.getConversationID();
- if (conversationId != null) {
- if (fromEPR == null) {
- fromEPR = new EndpointReference(AddressingConstants.Final.WSA_ANONYMOUS_URL);
- }
- //FIXME: serialize conversation ID to XML in case it is not a string
- fromEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
- }
-
- // add WS-Addressing header
- //FIXME: is there any way to use the Axis2 addressing support for this?
- if (fromEPR != null) {
- SOAPEnvelope sev = requestMC.getEnvelope();
- SOAPHeader sh = sev.getHeader();
- OMElement epr =
- EndpointReferenceHelper.toOM(sev.getOMFactory(),
- fromEPR,
- QNAME_WSA_FROM,
- AddressingConstants.Final.WSA_NAMESPACE);
- sh.addChild(epr);
- requestMC.setFrom(fromEPR);
- }
-
- // Set any message headers required by policy
- // Get the header from the tuscany message
- // If its not already an OM convert it to OM
- // add it to the envelope header
-
- // if target endpoint was not specified when this invoker was created,
- // use dynamically specified target endpoint passed in on this call
- if (options.getTo() == null) {
- org.apache.tuscany.sca.runtime.EndpointReference ep = msg.getTo();
- if (ep != null) {
- requestMC.setTo(new EndpointReference(ep.getURI()));
- } else {
- throw new RuntimeException("Unable to determine destination endpoint");
- }
- } else {
- requestMC.setTo(new EndpointReference(options.getTo().getAddress()));
- }
-
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws AxisFault {
- operationClient.addMessageContext(requestMC);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw (AxisFault)e.getException();
- }
- return operationClient;
- }
-
- public boolean allowsPassByReference() {
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java
deleted file mode 100644
index b1923bdf3c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingProviderFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * Axis2BindingProviderFactory
- *
- * @version $Rev$ $Date$
- */
-
-public class Axis2BindingProviderFactory implements BindingProviderFactory<WebServiceBinding> {
-
- private ModelFactoryExtensionPoint modelFactories;
- private List<ServletHost> hosts;
- private List<PolicyHandlerTuple> policyHandlerClassnames = null;
- private DataBindingExtensionPoint dataBindings;
- private WorkScheduler workScheduler;
-
- public Axis2BindingProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- hosts = servletHosts.getServletHosts();
-
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- policyHandlerClassnames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
- dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- workScheduler = utilities.getUtility(WorkScheduler.class);
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- WebServiceBinding binding) {
- return new Axis2ReferenceBindingProvider(component, reference, binding,
- modelFactories, policyHandlerClassnames, dataBindings);
- }
-
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- WebServiceBinding binding) {
- ServletHost servletHost = null;
-
- if (!hosts.isEmpty()) {
- servletHost = hosts.get(0);
- }
-
- return new Axis2ServiceBindingProvider(component, service, binding,
- servletHost, modelFactories,
- policyHandlerClassnames, dataBindings, workScheduler);
- }
-
- public Class<WebServiceBinding> getModelType() {
- return WebServiceBinding.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.java
deleted file mode 100644
index f8d0cf55b0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2OneWayBindingInvoker.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.binding.ws.axis2;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-/**
- * Axis2OneWayBindingInvoker uses an Axis2 OperationClient to invoke a OneWay remote web service.
- *
- * @version $Rev$ $Date$
- */
-public class Axis2OneWayBindingInvoker extends Axis2BindingInvoker {
-
- public Axis2OneWayBindingInvoker(Axis2ServiceClient serviceClient,
- QName wsdlOperationName,
- Options options,
- SOAPFactory soapFactory,
- List<PolicyHandler> policyHandlerList,
- WebServiceBinding wsBinding) {
-
- super(serviceClient, wsdlOperationName, options, soapFactory, policyHandlerList, wsBinding);
- }
-
- @Override
- protected Object invokeTarget(Message msg) throws AxisFault {
- OperationClient operationClient = createOperationClient(msg);
-
- // ensure connections are tracked so that they can be closed by the reference binding
- MessageContext requestMC = operationClient.getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
- //requestMC.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
- Options opt = requestMC.getOptions();
- opt.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
- opt.setUseSeparateListener(true);
- opt.setProperty(HTTPConstants.AUTO_RELEASE_CONNECTION,Boolean.TRUE);
-
- operationClient.execute(false);
-
- // REVIEW it seems ok to return null
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
deleted file mode 100644
index 958d4aa41d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceBindingProvider.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.util.List;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class Axis2ReferenceBindingProvider implements ReferenceBindingProvider {
-
- private WebServiceBinding wsBinding;
- private Axis2ServiceClient axisClient;
-
- public Axis2ReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- WebServiceBinding wsBinding,
- ModelFactoryExtensionPoint modelFactories,
- List<PolicyHandlerTuple> policyHandlerClassnames,
- DataBindingExtensionPoint dataBindings) {
-
- MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.wsBinding = wsBinding;
-
- // A WSDL document should always be present in the binding
- if (wsBinding.getWSDLDocument() == null) {
- throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + reference.getName());
- }
-
- // Set to use the Axiom data binding
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- if (contract.getInterface() != null) {
- contract.getInterface().resetDataBinding(OMElement.class.getName());
- }
-
- axisClient = new Axis2ServiceClient(component, reference, wsBinding, messageFactory, policyHandlerClassnames);
- }
-
- public void start() {
- axisClient.start();
- }
-
- public void stop() {
- axisClient.stop();
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsBinding.getBindingInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
- public Invoker createInvoker(Operation operation) {
- return axisClient.createInvoker(operation);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.java
deleted file mode 100644
index 8a4b64d266..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceBindingProvider.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.binding.ws.axis2;
-
-import java.util.List;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class Axis2ServiceBindingProvider implements ServiceBindingProvider {
-
- private WebServiceBinding wsBinding;
- private Axis2ServiceProvider axisProvider;
-
- public Axis2ServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- WebServiceBinding wsBinding,
- ServletHost servletHost,
- ModelFactoryExtensionPoint modelFactories,
- List<PolicyHandlerTuple> policyHandlerClassnames,
- DataBindingExtensionPoint dataBindings,
- WorkScheduler workScheduler) {
-
- if (servletHost == null) {
- throw new ServiceRuntimeException("No Servlet host is avaible for HTTP web services");
- }
-
- MessageFactory messageFactory = modelFactories.getFactory(MessageFactory.class);
- this.wsBinding = wsBinding;
-
- // A WSDL document should always be present in the binding
- if (wsBinding.getWSDLDocument() == null) {
- throw new ServiceRuntimeException("No WSDL document for " + component.getName() + "/" + service.getName());
- }
-
- // Set to use the Axiom data binding
- InterfaceContract contract = wsBinding.getBindingInterfaceContract();
- contract.getInterface().resetDataBinding(OMElement.class.getName());
-
- axisProvider = new Axis2ServiceProvider(component, service, wsBinding, servletHost, messageFactory, policyHandlerClassnames, workScheduler);
- }
-
- public void start() {
- axisProvider.start();
- }
-
- public void stop() {
- axisProvider.stop();
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return wsBinding.getBindingInterfaceContract();
- }
-
- public boolean supportsOneWayInvocation() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
deleted file mode 100644
index 0d3916019f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceClient.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import static org.apache.tuscany.sca.binding.ws.axis2.AxisPolicyHelper.SOAP12_INTENT;
-import static org.apache.tuscany.sca.binding.ws.axis2.AxisPolicyHelper.isIntentRequired;
-
-import java.io.IOException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.AxisEndpoint;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.threadpool.ThreadPool;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
-import org.apache.commons.httpclient.params.HttpConnectionManagerParams;
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper;
-import org.apache.ws.commons.schema.resolver.URIResolver;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class Axis2ServiceClient {
-
- private RuntimeComponent component;
- private AbstractContract contract;
- private WebServiceBinding wsBinding;
- private ServiceClient serviceClient;
- List<PolicyHandlerTuple> policyHandlerClassnames = null;
- private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>();
-
- public Axis2ServiceClient(RuntimeComponent component,
- AbstractContract contract,
- WebServiceBinding wsBinding,
- MessageFactory messageFactory,
- List<PolicyHandlerTuple> policyHandlerClassnames) {
-
- this.component = component;
- this.contract = contract;
- this.wsBinding = wsBinding;
- this.policyHandlerClassnames = policyHandlerClassnames;
- }
-
- protected void start() {
- if (serviceClient == null) {
- this.serviceClient = createServiceClient();
- }
- }
-
- public ServiceClient getServiceClient() {
- return serviceClient;
- }
-
- protected void configurePolicy(ConfigurationContext context, PolicySet ps) throws AxisFault {
- if (ps == null) {
- return;
- }
- for (Object policy : ps.getPolicies()) {
- if (policy instanceof Axis2ConfigParamPolicy) {
- Axis2ConfigParamPolicy axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
- for (Map.Entry<String, OMElement> param : axis2ConfigParamPolicy.getParamElements().entrySet()) {
- Parameter configParam = new Parameter(param.getKey(), param.getValue().getFirstElement());
- configParam.setParameterElement(param.getValue());
- context.getAxisConfiguration().addParameter(configParam);
- }
- }
- }
- }
-
- /**
- * Create an Axis2 ServiceClient
- */
- protected ServiceClient createServiceClient() {
- try {
- final boolean isRampartRequired = AxisPolicyHelper.isRampartRequired(wsBinding);
- ConfigurationContext configContext;
-
- try {
- // TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
- // Allow privileged access to read properties. Requires PropertyPermission read in
- // security policy.
- TuscanyAxisConfigurator tuscanyAxisConfigurator =
- AccessController.doPrivileged(new PrivilegedExceptionAction<TuscanyAxisConfigurator>() {
- public TuscanyAxisConfigurator run() throws AxisFault {
- return new TuscanyAxisConfigurator(isRampartRequired);
- }
- });
- configContext = tuscanyAxisConfigurator.getConfigurationContext();
- // deployRampartModule();
- // configureSecurity();
- } catch (PrivilegedActionException e) {
- throw new ServiceRuntimeException(e.getException());
- }
-
- createPolicyHandlers();
- setupPolicyHandlers(policyHandlerList, configContext);
-
- Definition definition = wsBinding.getWSDLDocument();
- QName serviceQName = wsBinding.getService().getQName();
- Port port = wsBinding.getPort();
- if (port == null) {
- // service has multiple ports, select one port to use
- Collection<Port> ports = wsBinding.getService().getPorts().values();
- for (Port p : ports) {
- // look for a SOAP 1.1 port first
- if (p.getExtensibilityElements().get(0) instanceof SOAPAddress) {
- port = p;
- break;
- }
- }
- if (port == null) {
- // no SOAP 1.1 port available, so look for a SOAP 1.2 port
- for (Port p : ports) {
- if (p.getExtensibilityElements().get(0) instanceof SOAP12Address) {
- port = p;
- break;
- }
- }
- }
- }
- AxisService axisService =
- createClientSideAxisService(definition, serviceQName, port.getName(), new Options());
-
- HttpClient httpClient = (HttpClient)configContext.getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
- if (httpClient == null) {
- MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
- HttpConnectionManagerParams connectionManagerParams = new HttpConnectionManagerParams();
- connectionManagerParams.setDefaultMaxConnectionsPerHost(2);
- connectionManagerParams.setTcpNoDelay(true);
- connectionManagerParams.setStaleCheckingEnabled(true);
- connectionManagerParams.setLinger(0);
- connectionManager.setParams(connectionManagerParams);
- httpClient = new HttpClient(connectionManager);
- configContext.setThreadPool(new ThreadPool(1, 5));
- configContext.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);
- configContext.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, httpClient);
- }
-
- return new ServiceClient(configContext, axisService);
-
- } catch (AxisFault e) {
- throw new RuntimeException(e); // TODO: better exception
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * URI resolver implementation for XML schema
- */
- public static class URIResolverImpl implements URIResolver {
- private Definition definition;
-
- public URIResolverImpl(Definition definition) {
- this.definition = definition;
- }
-
- public org.xml.sax.InputSource resolveEntity(java.lang.String targetNamespace,
- java.lang.String schemaLocation,
- java.lang.String baseUri) {
- try {
- if (baseUri == null) {
- baseUri = definition.getDocumentBaseURI();
- }
- URL url = new URL(new URL(baseUri), schemaLocation);
- return XMLDocumentHelper.getInputSource(url);
- } catch (IOException e) {
- return null;
- }
- }
- }
-
- /**
- * Workaround for https://issues.apache.org/jira/browse/AXIS2-3205
- * @param definition
- * @param serviceName
- * @return
- */
- private static Definition getDefinition(Definition definition, QName serviceName) {
-
- if (serviceName == null) {
- return definition;
- }
-
- if (definition == null) {
- return null;
- }
- Object service = definition.getServices().get(serviceName);
- if (service != null) {
- return definition;
- }
- for (Object i : definition.getImports().values()) {
- List<Import> imports = (List<Import>)i;
- for (Import imp : imports) {
- Definition d = getDefinition(imp.getDefinition(), serviceName);
- if (d != null) {
- return d;
- }
- }
- }
- return null;
- }
-
- /**
- * This method is copied from AxisService.createClientSideAxisService to
- * work around http://issues.apache.org/jira/browse/WSCOMMONS-228
- *
- * @param wsdlDefinition
- * @param wsdlServiceName
- * @param portName
- * @param options
- * @return
- * @throws AxisFault
- */
- @Deprecated
- public static AxisService createClientSideAxisService(Definition definition,
- QName serviceName,
- String portName,
- Options options) throws AxisFault {
- Definition def = getDefinition(definition, serviceName);
- final WSDL11ToAxisServiceBuilder serviceBuilder = new WSDL11ToAxisServiceBuilder(def, serviceName, portName);
- serviceBuilder.setServerSide(false);
- // [rfeng] Add a custom resolver to work around WSCOMMONS-228
- serviceBuilder.setCustomResolver(new URIResolverImpl(def));
- serviceBuilder.setBaseUri(def.getDocumentBaseURI());
- // [rfeng]
- // Allow access to read properties. Requires PropertiesPermission in security policy.
- AxisService axisService;
- try {
- axisService = AccessController.doPrivileged(new PrivilegedExceptionAction<AxisService>() {
- public AxisService run() throws AxisFault {
- return serviceBuilder.populateService();
- }
- });
- } catch ( PrivilegedActionException e ) {
- throw (AxisFault) e.getException();
- }
-
- AxisEndpoint axisEndpoint = (AxisEndpoint)axisService.getEndpoints().get(axisService.getEndpointName());
- options.setTo(new EndpointReference(axisEndpoint.getEndpointURL()));
- if (axisEndpoint != null) {
- options.setSoapVersionURI((String)axisEndpoint.getBinding().getProperty(WSDL2Constants.ATTR_WSOAP_VERSION));
- }
- return axisService;
- }
-
- /*
- private static <T extends ExtensibilityElement> T getExtensibilityElement(List elements, Class<T> type) {
- for (Object e : elements) {
- if (type.isInstance(e)) {
- return type.cast(e);
- }
- }
- return null;
- }
- */
-
- protected void stop() {
- if (serviceClient != null) {
- // close all connections that we have initiated, so that the jetty server
- // can be restarted without seeing ConnectExceptions
- HttpClient httpClient =
- (HttpClient)serviceClient.getServiceContext().getConfigurationContext()
- .getProperty(HTTPConstants.CACHED_HTTP_CLIENT);
- if (httpClient != null)
- ((MultiThreadedHttpConnectionManager)httpClient.getHttpConnectionManager()).shutdown();
-
- serviceClient = null;
- }
- }
-
- /**
- * Create and configure an Axis2BindingInvoker for each operation
- */
- protected Invoker createInvoker(Operation operation) {
- Options options = new Options();
- EndpointReference epTo = getWSATOEPR(wsBinding);
- if (epTo != null) {
- options.setTo(epTo);
- }
- options.setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
-
- String operationName = operation.getName();
-
- String soapAction = getSOAPAction(operationName);
- if (soapAction != null && soapAction.length() > 1) {
- options.setAction(soapAction);
- }
-
- options.setTimeOutInMilliSeconds(30 * 1000); // 30 seconds
-
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- SOAPFactory soapFactory = AccessController.doPrivileged(new PrivilegedAction<SOAPFactory>() {
- public SOAPFactory run() {
- if (requiresSOAP12())
- return OMAbstractFactory.getSOAP12Factory();
- else
- return OMAbstractFactory.getSOAP11Factory();
-
- }
- });
- QName wsdlOperationQName = new QName(operationName);
- if (requiresMTOM())
- {
- options.setProperty(org.apache.axis2.Constants.Configuration.ENABLE_MTOM, org.apache.axis2.Constants.VALUE_TRUE);
- }
- Axis2BindingInvoker invoker;
- if (operation.isNonBlocking()) {
- invoker = new Axis2OneWayBindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList, wsBinding);
- } else {
- invoker = new Axis2BindingInvoker(this, wsdlOperationQName, options, soapFactory, policyHandlerList, wsBinding);
- }
-
- return invoker;
- }
-
- private boolean requiresSOAP12() {
- return isIntentRequired(wsBinding, SOAP12_INTENT);
- }
-
- private boolean requiresMTOM() {
- return isIntentRequired(wsBinding, AxisPolicyHelper.MTOM_INTENT);
- }
-
- protected EndpointReference getWSATOEPR(WebServiceBinding binding) {
- EndpointReference epr = getEPR(binding);
- if (epr == null) {
- epr = getPortLocationEPR(binding);
- } else if (epr.getAddress() == null || epr.getAddress().length() < 1) {
- EndpointReference bindingEPR = getPortLocationEPR(binding);
- if (bindingEPR != null) {
- epr.setAddress(bindingEPR.getAddress());
- }
- }
- return epr;
- }
-
- protected EndpointReference getPortLocationEPR(WebServiceBinding binding) {
- String ep = null;
- if (binding.getPort() != null) {
- List<?> wsdlPortExtensions = binding.getPort().getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- ep = ((SOAPAddress)extension).getLocationURI();
- break;
- }
- if (extension instanceof SOAP12Address) {
- SOAP12Address address = (SOAP12Address)extension;
- ep = address.getLocationURI();
- break;
- }
- }
- }
- if(ep == null || ep.equals("")) {
- ep = binding.getURI();
- }
- return ep == null || "".equals(ep) ? null : new EndpointReference(ep);
- }
-
- protected org.apache.axis2.addressing.EndpointReference getEPR(WebServiceBinding wsBinding) {
- if (wsBinding.getEndPointReference() == null) {
- return null;
- }
- try {
-
- XMLStreamReader parser =
- XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(wsBinding.getEndPointReference()));
- StAXOMBuilder builder = new StAXOMBuilder(parser);
- OMElement omElement = builder.getDocumentElement();
- org.apache.axis2.addressing.EndpointReference epr = EndpointReferenceHelper.fromOM(omElement);
- return epr;
-
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (XMLStreamException e) {
- throw new RuntimeException(e);
- } catch (FactoryConfigurationError e) {
- throw new RuntimeException(e);
- }
- }
-
- protected String getSOAPAction(String operationName) {
- Binding binding = wsBinding.getBinding();
- if (binding != null) {
- for (Object o : binding.getBindingOperations()) {
- BindingOperation bop = (BindingOperation)o;
- if (bop.getName().equalsIgnoreCase(operationName)) {
- for (Object o2 : bop.getExtensibilityElements()) {
- if (o2 instanceof SOAPOperation) {
- return ((SOAPOperation)o2).getSoapActionURI();
- }
- }
- }
- }
- }
- return null;
- }
-
- private void createPolicyHandlers() throws IllegalAccessException, InstantiationException, ClassNotFoundException {
- if (wsBinding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
- PolicyHandler policyHandler = null;
- for (PolicySet policySet : policiedBinding.getPolicySets()) {
- policyHandler = PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
- if (policyHandler != null) {
- policyHandler.setApplicablePolicySet(policySet);
- policyHandlerList.add(policyHandler);
- }
- }
-
- // code to create policy handlers using the new policy SPI based
- // on policy providers
-/*
- List<PolicyProvider> policyProviders = ((RuntimeComponentReference)contract).getPolicyProviders(wsBinding);
-
- for (PolicyProvider policyProvider : policyProviders){
- policyHandler = policyProvider.createHandler();
- if (policyHandler != null) {
- policyHandlerList.add(policyHandler);
- }
- }
-*/
- }
- }
-
- private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) {
- for (PolicyHandler aHandler : policyHandlers) {
- aHandler.setUp(configContext);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java
deleted file mode 100644
index a0cfab9154..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInMessageReceiver.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.receivers.AbstractInMessageReceiver;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-public class Axis2ServiceInMessageReceiver extends AbstractInMessageReceiver {
-
- protected Operation operation;
-
- private Axis2ServiceProvider provider;
-
- private List<PolicyHandler> policyHandlerList = null;
-
- public Axis2ServiceInMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) {
- this.provider = provider;
- this.operation = operation;
- this.policyHandlerList = policyHandlerList;
- }
-
- public Axis2ServiceInMessageReceiver() {
- }
-
- @Override
- public void invokeBusinessLogic(MessageContext inMC) throws AxisFault {
- try {
- OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- Object[] args = new Object[] {requestOM};
-
- /*
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.beforeInvoke(operation, args, inMC);
- }
- */
-
- provider.invokeTarget(operation, args, inMC);
-
- /*
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.afterInvoke(operation, args, inMC);
- }
- */
-
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof Exception) {
- throw AxisFault.makeFault((Exception)t);
- }
- throw new RuntimeException(e);
- } catch (Exception e) {
- e.printStackTrace();
- throw AxisFault.makeFault(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java
deleted file mode 100644
index d467e0b3c8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceInOutSyncMessageReceiver.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class Axis2ServiceInOutSyncMessageReceiver extends AbstractInOutSyncMessageReceiver {
- private static final Logger logger = Logger.getLogger(Axis2ServiceInOutSyncMessageReceiver.class.getName());
-
- protected Operation operation;
- private List<PolicyHandler> policyHandlerList = null;
-
- private Axis2ServiceProvider provider;
-
- public Axis2ServiceInOutSyncMessageReceiver(Axis2ServiceProvider provider, Operation operation, List<PolicyHandler> policyHandlerList) {
- this.provider = provider;
- this.operation = operation;
- this.policyHandlerList = policyHandlerList;
- }
-
- public Axis2ServiceInOutSyncMessageReceiver() {
- }
-
- @Override
- public void invokeBusinessLogic(MessageContext inMC, MessageContext outMC) throws AxisFault {
- try {
- OMElement requestOM = inMC.getEnvelope().getBody().getFirstElement();
- Object[] args = null;
-
- if (requestOM != null) {
- args = new Object[] {requestOM};
- }
-
- /*
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.beforeInvoke(operation, args, inMC);
- }
- */
-
- OMElement responseOM = (OMElement)provider.invokeTarget(operation, args, inMC);
-
- /*
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.afterInvoke(operation, args, inMC, responseOM);
- }
- */
-
- SOAPEnvelope soapEnvelope = getSOAPFactory(inMC).getDefaultEnvelope();
- if (null != responseOM ) {
- soapEnvelope.getBody().addChild(responseOM);
- }
- outMC.setEnvelope(soapEnvelope);
- outMC.getOperationContext().setProperty(Constants.RESPONSE_WRITTEN, Constants.VALUE_TRUE);
-
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof FaultException && ((FaultException)t).getFaultInfo() instanceof OMElement) {
- OMElement faultDetail = (OMElement)((FaultException)t).getFaultInfo();
- inMC.setProperty(Constants.FAULT_NAME, faultDetail.getQName().getLocalPart());
- AxisFault f = new AxisFault(null, e.getMessage(), "faultNode", "faultRole", faultDetail);
- throw f;
- }
- if (t instanceof Exception) {
- throw AxisFault.makeFault((Exception)t);
- }
- logger.log(Level.SEVERE, e.getMessage(), t);
- throw new ServiceRuntimeException(e);
- } catch (Throwable e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- throw AxisFault.makeFault(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
deleted file mode 100644
index 62a18d62ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
+++ /dev/null
@@ -1,843 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.Constants.Configuration;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.AxisEndpoint;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.description.WSDL11ToAxisServiceBuilder;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.description.WSDLToAxisServiceBuilder;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceClient.URIResolverImpl;
-import org.apache.tuscany.sca.binding.ws.axis2.jms.JMSListener;
-import org.apache.tuscany.sca.binding.ws.axis2.jms.JMSSender;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.authentication.token.Axis2TokenAuthenticationPolicy;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configuration.Axis2ConfigParamPolicy;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingBasicAuthenticationConfigurator;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.configurator.Axis2BindingHeaderConfigurator;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicy;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeaderString;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaExternal;
-import org.apache.ws.security.WSSecurityEngineResult;
-import org.apache.ws.security.handler.WSHandlerConstants;
-import org.apache.ws.security.handler.WSHandlerResult;
-import org.osoa.sca.ServiceRuntimeException;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-public class Axis2ServiceProvider {
- public static final String IMPORT_TAG = "import";
- public static final String INCLUDE_TAG = "include";
-
- private static final Logger logger = Logger.getLogger(Axis2ServiceProvider.class.getName());
-
- private RuntimeComponent component;
- private AbstractContract contract;
- private WebServiceBinding wsBinding;
- private ServletHost servletHost;
- private MessageFactory messageFactory;
- private ConfigurationContext configContext;
- private JMSSender jmsSender;
- private JMSListener jmsListener;
- private List<PolicyHandlerTuple> policyHandlerClassnames = null;
- private List<PolicyHandler> policyHandlerList = new ArrayList<PolicyHandler>();
- private Map<String, Port> urlMap = new HashMap<String, Port>();
-
- private BasicAuthenticationPolicy basicAuthenticationPolicy = null;
- private Axis2TokenAuthenticationPolicy axis2TokenAuthenticationPolicy = null;
- private List<Axis2HeaderPolicy> axis2HeaderPolicies = new ArrayList<Axis2HeaderPolicy>();
- private WorkScheduler workScheduler;
-
- public static final QName QNAME_WSA_ADDRESS =
- new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_ADDRESS);
- public static final QName QNAME_WSA_FROM =
- new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_FROM);
- public static final QName QNAME_WSA_REFERENCE_PARAMETERS =
- new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.EPR_REFERENCE_PARAMETERS);
-
- private static final QName TRANSPORT_JMS_QUALIFIED_INTENT =
- new QName("http://www.osoa.org/xmlns/sca/1.0", "transport.jms");
- private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
-
- //Schema element names
- public static final String ELEM_SCHEMA = "schema";
-
- //Schema URI
- public static final String NS_URI_XSD_1999 = "http://www.w3.org/1999/XMLSchema";
- public static final String NS_URI_XSD_2000 = "http://www.w3.org/2000/10/XMLSchema";
- public static final String NS_URI_XSD_2001 = "http://www.w3.org/2001/XMLSchema";
-
- //Schema QNames
- public static final QName Q_ELEM_XSD_1999 = new QName(NS_URI_XSD_1999, ELEM_SCHEMA);
- public static final QName Q_ELEM_XSD_2000 = new QName(NS_URI_XSD_2000, ELEM_SCHEMA);
- public static final QName Q_ELEM_XSD_2001 = new QName(NS_URI_XSD_2001, ELEM_SCHEMA);
- public static final List<QName> XSD_QNAME_LIST =
- Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
-
- public Axis2ServiceProvider(RuntimeComponent component,
- AbstractContract contract,
- WebServiceBinding wsBinding,
- ServletHost servletHost,
- MessageFactory messageFactory,
- List<PolicyHandlerTuple> policyHandlerClassnames,
- WorkScheduler workScheduler) {
-
- this.component = component;
- this.contract = contract;
- this.wsBinding = wsBinding;
- this.servletHost = servletHost;
- this.messageFactory = messageFactory;
- this.policyHandlerClassnames = policyHandlerClassnames;
- this.workScheduler = workScheduler;
-
- final boolean isRampartRequired = AxisPolicyHelper.isRampartRequired(wsBinding);
- try {
- // TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
- // Allow privileged access to read properties. Requires PropertyPermission read in
- // security policy.
- TuscanyAxisConfigurator tuscanyAxisConfigurator =
- AccessController.doPrivileged(new PrivilegedExceptionAction<TuscanyAxisConfigurator>() {
- public TuscanyAxisConfigurator run() throws AxisFault {
- return new TuscanyAxisConfigurator(isRampartRequired);
- }
- });
- configContext = tuscanyAxisConfigurator.getConfigurationContext();
- // deployRampartModule();
- // configureSecurity();
- } catch (PrivilegedActionException e) {
- throw new ServiceRuntimeException(e.getException());
- } catch (AxisFault e) {
- throw new ServiceRuntimeException(e); // TODO: better exception
- }
-
- configContext.setContextRoot(servletHost.getContextPath());
-
- // Enable MTOM if the policy intent is specified.
- if (AxisPolicyHelper.isIntentRequired(wsBinding, AxisPolicyHelper.MTOM_INTENT)) {
- configContext.getAxisConfiguration().getParameter(Configuration.ENABLE_MTOM).setLocked(false);
- configContext.getAxisConfiguration().getParameter(Configuration.ENABLE_MTOM).setValue("true");
- }
-
- // Update port addresses with runtime information, and create a
- // map from endpoint URIs to WSDL ports that eliminates duplicate
- // ports for the same endpoint.
- for (Object port : wsBinding.getService().getPorts().values()) {
- String portAddress = getPortAddress((Port)port);
- String endpointURI = computeEndpointURI(portAddress, servletHost);
- setPortAddress((Port)port, endpointURI);
- urlMap.put(endpointURI, (Port)port);
- }
-
- // find out which policies are active
- if (wsBinding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)wsBinding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- basicAuthenticationPolicy = (BasicAuthenticationPolicy)p;
- } else if (Axis2TokenAuthenticationPolicy.class.isInstance(p)) {
- axis2TokenAuthenticationPolicy = (Axis2TokenAuthenticationPolicy)p;
- } else if (Axis2HeaderPolicy.class.isInstance(p)) {
- axis2HeaderPolicies.add((Axis2HeaderPolicy)p);
- } else {
- // etc. check for other types of policy being present
- }
- }
- }
- }
- }
-
- static String getPortAddress(Port port) {
- Object ext = port.getExtensibilityElements().get(0);
- if (ext instanceof SOAPAddress) {
- return ((SOAPAddress)ext).getLocationURI();
- }
- if (ext instanceof SOAP12Address) {
- return ((SOAP12Address)ext).getLocationURI();
- }
- return null;
- }
-
- static void setPortAddress(Port port, String locationURI) {
- Object ext = port.getExtensibilityElements().get(0);
- if (ext instanceof SOAPAddress) {
- ((SOAPAddress)ext).setLocationURI(locationURI);
- }
- if (ext instanceof SOAP12Address) {
- ((SOAP12Address)ext).setLocationURI(locationURI);
- }
- }
-
- private String computeEndpointURI(String uri, ServletHost servletHost) {
-
- if (uri == null) {
- return null;
- }
-
- // pull out the binding intents to see what sort of transport is required
- PolicySet transportJmsPolicySet = AxisPolicyHelper.getPolicySet(wsBinding, TRANSPORT_JMS_QUALIFIED_INTENT);
- if (transportJmsPolicySet != null){
- if (!uri.startsWith("jms:/")) {
- uri = "jms:" + uri;
- }
-
- // construct the rest of the URI based on the policy. All the details are put
- // into the URI here rather than being place directly into the Axis configuration
- // as the Axis JMS sender relies on parsing the target URI
- Axis2ConfigParamPolicy axis2ConfigParamPolicy = null;
- for ( Object policy : transportJmsPolicySet.getPolicies() ) {
- if ( policy instanceof Axis2ConfigParamPolicy ) {
- axis2ConfigParamPolicy = (Axis2ConfigParamPolicy)policy;
- Iterator paramIterator = axis2ConfigParamPolicy.getParamElements().get(DEFAULT_QUEUE_CONNECTION_FACTORY).getChildElements();
-
- if (paramIterator.hasNext()){
- StringBuffer uriParams = new StringBuffer("?");
-
- while (paramIterator.hasNext()){
- OMElement parameter = (OMElement)paramIterator.next();
- uriParams.append(parameter.getAttributeValue(new QName("","name")));
- uriParams.append("=");
- uriParams.append(parameter.getText());
-
- if (paramIterator.hasNext()){
- uriParams.append("&");
- }
- }
-
- uri = uri + uriParams;
- }
- }
- }
- } else {
- if (!uri.startsWith("jms:")) {
- uri = servletHost.getURLMapping(uri).toString();
- }
- }
-
- return uri;
- }
-
- public void start() {
-
- try {
- createPolicyHandlers();
- for (Map.Entry<String, Port> entry : urlMap.entrySet()) {
- AxisService axisService = createAxisService(entry.getKey(), entry.getValue());
- configContext.getAxisConfiguration().addService(axisService);
- }
- setupPolicyHandlers(policyHandlerList, configContext);
-
- Axis2ServiceServlet servlet = null;
- for (String endpointURL : urlMap.keySet()) {
- if (endpointURL.startsWith("http://") || endpointURL.startsWith("https://") || endpointURL.startsWith("/")) {
- if (servlet == null) {
- servlet = new Axis2ServiceServlet();
- servlet.init(configContext);
- }
- //[nash] configContext.setContextRoot(endpointURL);
- servletHost.addServletMapping(endpointURL, servlet);
- } else if (endpointURL.startsWith("jms")) {
- logger.log(Level.INFO,"Axis2 JMS URL=" + endpointURL);
-
- jmsListener = new JMSListener(workScheduler);
- jmsSender = new JMSSender();
- ListenerManager listenerManager = configContext.getListenerManager();
- TransportInDescription trsIn = configContext.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_JMS);
-
- if (trsIn == null){
- trsIn = new TransportInDescription(Constants.TRANSPORT_JMS);
- }
-
- // get JMS transport parameters from the computed URL
- Map<String, String> jmsProps = JMSUtils.getProperties(endpointURL);
-
- // collect the parameters used to configure the JMS transport
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement parms = fac.createOMElement(DEFAULT_QUEUE_CONNECTION_FACTORY, null);
-
- for ( String key : jmsProps.keySet() ) {
- OMElement param = fac.createOMElement("parameter", null);
- param.addAttribute( "name", key, null );
- param.addChild(fac.createOMText(param, jmsProps.get(key)));
- parms.addChild(param);
- }
-
- Parameter queueConnectionFactory = new Parameter(DEFAULT_QUEUE_CONNECTION_FACTORY, parms);
- trsIn.addParameter( queueConnectionFactory );
-
- trsIn.setReceiver(jmsListener);
-
- configContext.getAxisConfiguration().addTransportIn( trsIn );
- TransportOutDescription trsOut = configContext.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_JMS);
- //configContext.getAxisConfiguration().addTransportOut( trsOut );
- trsOut.setSender(jmsSender);
-
- if (listenerManager == null) {
- listenerManager = new ListenerManager();
- listenerManager.init(configContext);
- }
- listenerManager.addListener(trsIn, true);
- jmsSender.init(configContext, trsOut);
- jmsListener.init(configContext, trsIn);
- jmsListener.start();
- }
- }
- } catch (AxisFault e) {
- throw new RuntimeException(e);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void stop() {
- if ( jmsListener != null ) {
- jmsListener.stop();
- jmsListener.destroy();
- }
- else {
- for (String endpointURL : urlMap.keySet()) {
- servletHost.removeServletMapping(endpointURL);
- }
- }
-
- servletHost = null;
-
- if ( jmsSender != null )
- jmsSender.stop();
-
- try {
- for (String endpointURL : urlMap.keySet()) {
- // get the path to the service
- URI uriPath = new URI(endpointURL);
- String stringURIPath = uriPath.getPath();
-
- /* [nash] Need a leading slash for WSDL imports to work with ?wsdl
- // remove any "/" from the start of the path
- if (stringURIPath.startsWith("/")) {
- stringURIPath = stringURIPath.substring(1, stringURIPath.length());
- }
- */
-
- configContext.getAxisConfiguration().removeService(stringURIPath);
- }
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- } catch (AxisFault e) {
- throw new RuntimeException(e);
- }
- }
-
- private AxisService createAxisService(String endpointURL, Port port) throws AxisFault {
- AxisService axisService;
- if (wsBinding.getWSDLDocument() != null) {
- axisService = createWSDLAxisService(endpointURL, port);
- } else {
- axisService = createJavaAxisService(endpointURL);
- }
- initAxisOperations(axisService);
- return axisService;
- }
-
- /**
- * Create an AxisService from the interface class from the SCA service interface
- */
- protected AxisService createJavaAxisService(String endpointURL) throws AxisFault {
- AxisService axisService = new AxisService();
- String path = URI.create(endpointURL).getPath();
- axisService.setName(path);
- axisService.setServiceDescription("Tuscany configured AxisService for service: " + endpointURL);
- axisService.setClientSide(false);
- Parameter classParam =
- new Parameter(Constants.SERVICE_CLASS, ((JavaInterface)contract.getInterfaceContract().getInterface())
- .getJavaClass().getName());
- axisService.addParameter(classParam);
- try {
- Utils.fillAxisService(axisService, configContext.getAxisConfiguration(), null, null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return axisService;
- }
-
- /**
- * Workaround for https://issues.apache.org/jira/browse/AXIS2-3205
- * @param definition
- * @param serviceName
- * @return
- */
- private static Definition getDefinition(Definition definition, QName serviceName) {
-
- if (serviceName == null){
- return definition;
- }
-
- if (definition == null) {
- return null;
- }
- Object service = definition.getServices().get(serviceName);
- if (service != null) {
- return definition;
- }
- for (Object i : definition.getImports().values()) {
- List<Import> imports = (List<Import>)i;
- for (Import imp : imports) {
- Definition d = getDefinition(imp.getDefinition(), serviceName);
- if (d != null) {
- return d;
- }
- }
- }
- return null;
- }
-
- /**
- * Create an AxisService from the WSDL doc used by ws binding
- */
- protected AxisService createWSDLAxisService(String endpointURL, Port port) throws AxisFault {
-
- Definition definition = wsBinding.getWSDLDocument();
- QName serviceQName = wsBinding.getService().getQName();
- Definition def = getDefinition(definition, serviceQName);
-
- // TUSCANY-2824 fix the target namespace of the definition to be the same as
- // that for the port. Without this Axis fails during policy application
- // when it tries to match binding operation names to port type operation
- // names
- //def.setTargetNamespace(port.getBinding().getPortType().getQName().getNamespaceURI());
-
-
- final WSDLToAxisServiceBuilder builder = new WSDL11ToAxisServiceBuilder(def, serviceQName, port.getName());
- builder.setServerSide(true);
- // [rfeng] Add a custom resolver to work around WSCOMMONS-228
- builder.setCustomResolver(new URIResolverImpl(def));
- builder.setBaseUri(def.getDocumentBaseURI());
- // [rfeng]
- // AxisService axisService = builder.populateService();
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- AxisService axisService;
- try {
- axisService = AccessController.doPrivileged(new PrivilegedExceptionAction<AxisService>() {
- public AxisService run() throws AxisFault {
- return builder.populateService();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (AxisFault)e.getException();
- }
-
- String name = URI.create(endpointURL).getPath();
- //[nash] HTTP endpoints need a leading slash for WSDL imports to work with ?wsdl
- if (endpointURL.startsWith("jms")) {
- name = name.startsWith("/") ? name.substring(1) : name;
- }
- axisService.setName(name);
- axisService.setEndpointURL(endpointURL);
- axisService.setDocumentation("Tuscany configured AxisService for service: " + endpointURL);
- for ( Iterator i = axisService.getEndpoints().values().iterator(); i.hasNext(); ) {
- AxisEndpoint ae = (AxisEndpoint)i.next();
- if (endpointURL.startsWith("jms") ) {
- Parameter qcf = new Parameter(JMSConstants.CONFAC_PARAM, null);
- qcf.setValue(DEFAULT_QUEUE_CONNECTION_FACTORY);
- axisService.addParameter(qcf);
- break;
- }
- }
-
- // Add schema information to the AxisService (needed for "?xsd=" support)
- addSchemas(wsBinding.getWSDLDefinition(), axisService);
-
- // Use the existing WSDL
- Parameter wsdlParam = new Parameter(WSDLConstants.WSDL_4_J_DEFINITION, null);
- wsdlParam.setValue(definition);
- axisService.addParameter(wsdlParam);
- Parameter userWSDL = new Parameter("useOriginalwsdl", "true");
- axisService.addParameter(userWSDL);
-
- // Modify schema imports and includes to add "servicename?xsd=" prefix.
- // Axis2 does this for schema extensibility elements, but Tuscany has
- // overriden the WSDl4J deserializer to create UnknownExtensibilityElement
- // elements in place of these.
- modifySchemaImportsAndIncludes(definition, name);
-
- // Axis2 1.3 has a bug with returning incorrect values for the port
- // addresses. To work around this, compute the values here.
- Parameter modifyAddr = new Parameter("modifyUserWSDLPortAddress", "false");
- axisService.addParameter(modifyAddr);
-
- return axisService;
- }
-
- private void addSchemas(WSDLDefinition wsdlDef, AxisService axisService) {
- for (XSDefinition xsDef : wsdlDef.getXmlSchemas()) {
- if (xsDef.getSchema() != null) {
- axisService.addSchema(xsDef.getSchema());
- updateSchemaRefs(xsDef.getSchema(), axisService.getName());
- }
- }
- for (WSDLDefinition impDef : wsdlDef.getImportedDefinitions()) {
- addSchemas(impDef, axisService);
- }
- }
-
- private void updateSchemaRefs(XmlSchema parentSchema, String name) {
- for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) {
- Object obj = iter.next();
- if (obj instanceof XmlSchemaExternal) {
- XmlSchemaExternal extSchema = (XmlSchemaExternal)obj;
- String location = extSchema.getSchemaLocation();
- if (location.length() > 0 && location.indexOf(":/") < 0 && location.indexOf("?xsd=") < 0) {
- extSchema.setSchemaLocation(name + "?xsd=" + location);
- }
- if (extSchema.getSchema() != null) {
- updateSchemaRefs(extSchema.getSchema(), name);
- }
- }
- }
- }
-
- private void modifySchemaImportsAndIncludes(Definition definition, String name){
- // adjust the schema locations in types section
- Types types = definition.getTypes();
- if (types != null) {
- for (Iterator iter = types.getExtensibilityElements().iterator(); iter.hasNext();) {
- Object ext = iter.next();
- if (ext instanceof UnknownExtensibilityElement &&
- XSD_QNAME_LIST.contains(((UnknownExtensibilityElement)ext).getElementType())) {
- changeLocations(((UnknownExtensibilityElement)ext).getElement(), name);
- }
- }
- }
- for (Iterator iter = definition.getImports().values().iterator(); iter.hasNext();) {
- Vector values = (Vector)iter.next();
- for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
- Import wsdlImport = (Import)valuesIter.next();
- modifySchemaImportsAndIncludes(wsdlImport.getDefinition(), name);
- }
- }
- }
-
- private void changeLocations(Element element, String name) {
- NodeList nodeList = element.getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++) {
- String tagName = nodeList.item(i).getLocalName();
- if (IMPORT_TAG.equals(tagName) || INCLUDE_TAG.equals(tagName)) {
- processImport(nodeList.item(i), name);
- }
- }
- }
-
- private void processImport(Node importNode, String name) {
- NamedNodeMap nodeMap = importNode.getAttributes();
- for (int i = 0; i < nodeMap.getLength(); i++) {
- Node attribute = nodeMap.item(i);
- if (attribute.getNodeName().equals("schemaLocation")) {
- String location = attribute.getNodeValue();
- if (location.indexOf(":/") < 0 & location.indexOf("?xsd=") < 0) {
- attribute.setNodeValue(name + "?xsd=" + location);
- }
- }
- }
- }
-
- protected void initAxisOperations(AxisService axisService) {
- for (Iterator<?> i = axisService.getOperations(); i.hasNext();) {
- AxisOperation axisOp = (AxisOperation)i.next();
- Operation op = getOperation(axisOp);
- if (op != null) {
-
- if (op.isNonBlocking()) {
- axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_ONLY);
- } else {
- axisOp.setMessageExchangePattern(WSDL2Constants.MEP_URI_IN_OUT);
- }
-
- MessageReceiver msgrec = null;
- if (op.isNonBlocking()) {
- msgrec = new Axis2ServiceInMessageReceiver(this, op, policyHandlerList);
- } else {
- msgrec = new Axis2ServiceInOutSyncMessageReceiver(this, op, policyHandlerList);
- }
- axisOp.setMessageReceiver(msgrec);
- }
- }
- }
-
- protected Operation getOperation(AxisOperation axisOp) {
- String operationName = axisOp.getName().getLocalPart();
- Interface iface = wsBinding.getBindingInterfaceContract().getInterface();
- for (Operation op : iface.getOperations()) {
- if (op.getName().equalsIgnoreCase(operationName)) {
- return op;
- }
- }
- return null;
- }
-
- // methods for Axis2 message receivers
-
- public Object invokeTarget(Operation op, Object[] args, MessageContext inMC) throws InvocationTargetException {
- String callbackAddress = null;
- String callbackID = null;
- Object conversationID = null;
-
- // create a message object and set the args as its body
- Message msg = messageFactory.createMessage();
- msg.setBody(args);
- msg.setOperation(op);
-
- //FIXME: can we use the Axis2 addressing support for this?
- SOAPHeader header = inMC.getEnvelope().getHeader();
- if (header != null) {
- OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
- if (from != null) {
- OMElement callbackAddrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
- if (callbackAddrElement != null) {
- if (contract.getInterfaceContract().getCallbackInterface() != null) {
- callbackAddress = callbackAddrElement.getText();
- }
- }
- OMElement params = from.getFirstChildWithName(QNAME_WSA_REFERENCE_PARAMETERS);
- if (params != null) {
- OMElement convIDElement =
- params.getFirstChildWithName(Axis2BindingInvoker.CONVERSATION_ID_REFPARM_QN);
- if (convIDElement != null) {
- if (isConversational()) {
- conversationID = convIDElement.getText();
- }
- }
- OMElement callbackIDElement =
- params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
- if (callbackIDElement != null) {
- callbackID = callbackIDElement.getText();
- }
- }
- }
-
- // get policy specified headers
- for (Axis2HeaderPolicy policy : axis2HeaderPolicies){
- //Axis2BindingHeaderConfigurator.getHeader(inMC, msg, policy.getHeaderName());
- }
-
- if (axis2TokenAuthenticationPolicy != null) {
- Axis2SOAPHeaderString tokenHeader = new Axis2SOAPHeaderString();
- Axis2BindingHeaderConfigurator.getHeader(inMC,
- msg,
- axis2TokenAuthenticationPolicy.getTokenName(),
- tokenHeader);
- }
- }
-
- //fill message with QoS context info
- fillQoSContext(msg, inMC);
-
- // if reference parameters are needed, create a new "From" EPR to hold them
- EndpointReference from = null;
- ReferenceParameters parameters = null;
- if (callbackAddress != null ||
- callbackID != null ||
- conversationID != null) {
- from = new EndpointReferenceImpl(null);
- parameters = from.getReferenceParameters();
- msg.setFrom(from);
- }
-
- // set the reference parameters into the "From" EPR
- if (callbackAddress != null) {
- parameters.setCallbackReference(new EndpointReferenceImpl(callbackAddress));
- }
- if (callbackID != null) {
- parameters.setCallbackID(callbackID);
- }
- if (conversationID != null) {
- parameters.setConversationID(conversationID);
- }
-
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.beforeInvoke(msg, inMC);
- }
-
- if (basicAuthenticationPolicy != null) {
- Axis2BindingBasicAuthenticationConfigurator.parseHTTPHeader(inMC, msg, basicAuthenticationPolicy);
- }
-
- // find the runtime wire and invoke it with the message
- RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
- Object response = wire.invoke(op, msg);
-
- for ( PolicyHandler policyHandler : policyHandlerList ) {
- policyHandler.afterInvoke(response, inMC);
- }
-
- return response;
- }
-
- public boolean isConversational() {
- return wsBinding.getBindingInterfaceContract().getInterface().isConversational();
- }
-
- /**
- * Return the binding for this provider as a primitive binding type
- * For use when looking up wires registered against the binding.
- *
- * @return the binding
- */
- protected Binding getBinding() {
- return wsBinding;
- }
-
- private void setupPolicyHandlers(List<PolicyHandler> policyHandlers, ConfigurationContext configContext) {
- for ( PolicyHandler aHandler : policyHandlers ) {
- aHandler.setUp(configContext);
- }
- }
-
- private void createPolicyHandlers() throws IllegalAccessException,
- InstantiationException,
- ClassNotFoundException {
- if (wsBinding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
- PolicyHandler policyHandler = null;
-
- for (PolicySet policySet : policiedBinding.getPolicySets()) {
- policyHandler =
- PolicyHandlerUtils.findPolicyHandler(policySet, policyHandlerClassnames);
-
- if (policyHandler != null) {
- policyHandler.setApplicablePolicySet(policySet);
- policyHandlerList.add(policyHandler);
- }
- }
-
- // code to create policy handlers using a policy SPI based
- // on policy providers
-/*
- List<PolicyProvider> policyProviders = ((RuntimeComponentService)contract).getPolicyProviders(wsBinding);
-
- for (PolicyProvider policyProvider : policyProviders){
- policyHandler = policyProvider.createHandler();
- if (policyHandler != null) {
- policyHandlerList.add(policyHandler);
- }
- }
-*/
- }
- }
-
- private void fillQoSContext(Message message, MessageContext axis2MsgCtx) {
- if ( axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS) != null &&
- axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS) instanceof Vector ) {
- Vector recvResults = (Vector)axis2MsgCtx.getProperty(WSHandlerConstants.RECV_RESULTS);
- for ( int count1 = 0 ; count1 < recvResults.size() ; ++count1 ) {
- if ( recvResults.elementAt(count1) instanceof WSHandlerResult ) {
- WSHandlerResult wshr = (WSHandlerResult)recvResults.elementAt(count1);
- Vector results = wshr.getResults();
- for ( int count2 = 0 ; count2 < results.size() ; ++count2 ) {
- if ( results.elementAt(count2) instanceof WSSecurityEngineResult ) {
- WSSecurityEngineResult securityResult =
- (WSSecurityEngineResult)wshr.getResults().elementAt(count2);
- if ( securityResult.get("principal") != null ) {
- message.getHeaders().add(securityResult.get("principal"));
- }
- }
- }
- }
- }
-
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
deleted file mode 100644
index debb2c5764..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceServlet.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.net.MalformedURLException;
-import java.net.SocketException;
-import java.net.URI;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Set;
-import java.util.Vector;
-
-import javax.servlet.GenericServlet;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.transport.http.AxisServlet;
-import org.apache.axis2.transport.http.ListingAgent;
-import org.apache.axis2.transport.http.server.HttpUtils;
-
-/**
- * This overrides the Servlet init of the AxisServlet so Tuscany can use
- * a single Axis2 ConfigurationContext instance shared between AxisServlet
- * instances for each SCA service with a ws binding.
- * TODO: need to review if thats really what we want to be doing
- *
- * @version $Rev$ $Date$
- */
-public class Axis2ServiceServlet extends AxisServlet {
-
- protected TuscanyListingAgent agent;
-
- private static final long serialVersionUID = 1L;
- private static final ServletConfig DUMMY_CONFIG = createDummyServletConfig();
-
- private boolean initCalled = false;
-
-//JIRA TUSCANY-1561 Port to Axis2 1.3
- private ConfigurationContext tmpconfigContext;
-
- public void init(ConfigurationContext configContext) {
- this.tmpconfigContext = configContext;
- try {
- //super.init(DUMMY_CONFIG);
- init(DUMMY_CONFIG);
- } catch (ServletException e) {
- throw new RuntimeException(e);
- }
- agent = new TuscanyListingAgent(configContext);
- }
-
- /**
- * Override Axis2 Servlet method to avoid loop when init
- * is called after servletConfig already initialized by
- * this classes init(ConfigurationContext) method.
- */
- @Override
- public void init() throws ServletException {
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- ServletContext servletContext = config.getServletContext();
- servletContext.setAttribute(CONFIGURATION_CONTEXT, tmpconfigContext);
-
- //super.init(config);
-
- // A copy of the init method from the base class because we need to replace the
- // version of the ListenerManager that is used so that we can get it's
- // shutdown hook removed properly.
-
- // prevent this method from being called more than once per instance
- if (initCalled == false) {
- initCalled = true;
- // We can't call super.init() as it will just call the AxisServlet version
- // which we are replacing here. So reflect on the base class and
- // set the private config field in the base class.
- //super.init(config);
- try {
- Field field = GenericServlet.class.getDeclaredField("config");
- field.setAccessible(true);
- field.set(this, config);
- } catch (Exception ex){
- ex.printStackTrace();
- }
-
- try {
- this.servletConfig = config;
- //ServletContext servletContext = servletConfig.getServletContext();
- this.configContext =
- (ConfigurationContext) servletContext.getAttribute(CONFIGURATION_CONTEXT);
- if(configContext == null){
- configContext = initConfigContext(config);
- config.getServletContext().setAttribute(CONFIGURATION_CONTEXT, configContext);
- }
- axisConfiguration = configContext.getAxisConfiguration();
-
- ListenerManager listenerManager = new TuscanyListenerManager();
- listenerManager.init(configContext);
- TransportInDescription transportInDescription = new TransportInDescription(
- Constants.TRANSPORT_HTTP);
- transportInDescription.setReceiver(this);
- listenerManager.addListener(transportInDescription, true);
- listenerManager.start();
- ListenerManager.defaultConfigurationContext = configContext;
- super.agent = new ListingAgent(configContext);
-
- initParams();
-
- } catch (Exception e) {
- throw new ServletException(e);
- }
- }
- }
-
- /**
- * We've setup the Servlet by passing in a ConfigurationContext on our init method
- * override this method to just return that
- */
- @Override
- protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException {
- return this.tmpconfigContext;
- }
-
- @Override
- public ServletConfig getServletConfig() {
- return DUMMY_CONFIG;
- }
-
- @Override
- public String getServletName() {
- return "TuscanyAxis2Servlet";
- }
-
- /**
- * The AxisServlet gets NPE during init without a ServletConfig so this is a mocked up one to prevent that.
- */
- private static ServletConfig createDummyServletConfig() {
- ServletConfig sc = new ServletConfig() {
-
- public String getServletName() {
- return "TuscanyAxis2DummyServlet";
- }
-
- public ServletContext getServletContext() {
- return new ServletContext() {
-
- public ServletContext getContext(String uripath) {
- return null;
- }
-
- @SuppressWarnings("unused") // it's on the Servlet 2.5 API so we need it
- public String getContextPath() {
- return null;
- }
-
- public int getMajorVersion() {
- return 0;
- }
-
- public int getMinorVersion() {
- return 0;
- }
-
- public String getMimeType(String file) {
- return null;
- }
-
- public Set<?> getResourcePaths(String path) {
- return Collections.emptySet();
- }
-
- public URL getResource(String path) throws MalformedURLException {
- if("/".equals(path)) {
- // HACK: To avoid NPE
- return new URL("/axis2");
- }
- return null;
- }
-
- public InputStream getResourceAsStream(String path) {
- return null;
- }
-
- public RequestDispatcher getRequestDispatcher(String path) {
- return null;
- }
-
- public RequestDispatcher getNamedDispatcher(String arg0) {
- return null;
- }
-
- public Servlet getServlet(String arg0) throws ServletException {
- return null;
- }
-
- public Enumeration getServlets() {
- return null;
- }
-
- public Enumeration getServletNames() {
- return null;
- }
-
- public void log(String arg0) {
- }
-
- public void log(Exception arg0, String arg1) {
- }
-
- public void log(String arg0, Throwable arg1) {
- }
-
- public String getRealPath(String arg0) {
- return null;
- }
-
- public String getServerInfo() {
- return null;
- }
-
- public String getInitParameter(String arg0) {
- return null;
- }
-
- public Enumeration getInitParameterNames() {
- return null;
- }
-
- public Object getAttribute(String arg0) {
- return null;
- }
-
- public Enumeration getAttributeNames() {
- return null;
- }
-
- public void setAttribute(String arg0, Object arg1) {
- }
-
- public void removeAttribute(String arg0) {
- }
-
- public String getServletContextName() {
- return null;
- }
- };
- }
-
- public String getInitParameter(String arg0) {
- return null;
- }
-
- public Enumeration getInitParameterNames() {
- return new Vector().elements();
- }
- };
- return sc;
- }
-
- @Override
- public void destroy() {
- try {
- super.destroy();
- servletConfig = null;
- if (tmpconfigContext.getListenerManager() != null){
- tmpconfigContext.getListenerManager().destroy();
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- * Override the AxisServlet doGet to use the TuscanyListingAgent for ?wsdl
- */
- @Override
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response) throws ServletException, IOException {
-
- initContextRoot(request);
-
- String query = request.getQueryString();
- if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
- query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0 ||
- query.indexOf("policy") >= 0)) {
- agent.processListService(request, response);
- } else {
- super.doGet(request, response);
- }
- }
-
- /**
-
- /**
- * Override the AxisServlet method so as to not add "/services" into the URL
- * and to work with Tuscany service names. can go once moved to Axis2 1.3
- */
- @Override
- public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
- //RUNNING_PORT
- String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
- if (port == null) {
- port = "8080";
- }
- if (ip == null) {
- try {
- ip = HttpUtils.getIpAddress();
- if (ip == null) {
- ip = "localhost";
- }
- } catch (SocketException e) {
-//TUSCANY-1561 Port to Axis2 1.3
-// throw new AxisFault.(e);
- throw AxisFault.makeFault(e);
- }
- }
-
- URI epURI = URI.create("http://" + ip + ":" + port + "/" + serviceName).normalize();
-
- return new EndpointReference[]{new EndpointReference(epURI.toString())};
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java
deleted file mode 100644
index 1f389b422f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/AxisPolicyHelper.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-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;
-
-/**
- * @version $Rev$ $Date$
- */
-public class AxisPolicyHelper {
-
- public static final String XMLNS_SCA_1_0 = "http://www.osoa.org/xmlns/sca/1.0";
- public static final QName AUTHENTICATION_INTENT = new QName(XMLNS_SCA_1_0, "authentication");
- public static final QName CONFIDENTIALITY_INTENT = new QName(XMLNS_SCA_1_0, "confidentiality");
- public static final QName INTEGRITY_INTENT = new QName(XMLNS_SCA_1_0, "integrity");
- public static final QName MTOM_INTENT = new QName(XMLNS_SCA_1_0, "MTOM");
- public static final QName SOAP12_INTENT = new QName(XMLNS_SCA_1_0, "SOAP12");
-
- public static PolicySet getPolicySet(Binding wsBinding, QName intentName) {
- PolicySet returnPolicySet = null;
-
- if (wsBinding instanceof PolicySetAttachPoint) {
- PolicySetAttachPoint policiedBinding = (PolicySetAttachPoint)wsBinding;
- for (PolicySet policySet : policiedBinding.getPolicySets()) {
- for (Intent intent : policySet.getProvidedIntents()) {
- if (intent.getName().equals(intentName)) {
- returnPolicySet = policySet;
- break;
- }
- }
- }
- }
-
- return returnPolicySet;
- }
-
- public static boolean isIntentRequired(Binding wsBinding, QName intent) {
- if (wsBinding instanceof IntentAttachPoint) {
- List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
- for (Intent i : intents) {
- if (intent.equals(i.getName())) {
- return true;
- }
- }
- }
- return getPolicySet(wsBinding, intent) != null;
- }
-
- public static boolean isRampartRequired(Binding wsBinding) {
- return isIntentRequired(wsBinding, AUTHENTICATION_INTENT) || isIntentRequired(wsBinding, INTEGRITY_INTENT)
- || isIntentRequired(wsBinding, CONFIDENTIALITY_INTENT);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
deleted file mode 100644
index bd154dbc67..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyAxisConfigurator.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.deployment.DeploymentErrorMsgs;
-import org.apache.axis2.deployment.DeploymentException;
-import org.apache.axis2.deployment.ModuleBuilder;
-import org.apache.axis2.deployment.URLBasedAxisConfigurator;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisConfigurator;
-import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.util.Loader;
-
-/**
- * Helps configure Axis2 from a resource in binding.ws.axis2 instead of Axis2.xml
- * <p/> TODO: Review: should there be a single global Axis ConfigurationContext
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyAxisConfigurator extends URLBasedAxisConfigurator implements AxisConfigurator {
-
- /* these two fields are part of a temporary fix to solve problems that Maven has with including
- * rampart-1.4.mar into the classpath and also at the time of Release 1.0 rampart-1.4.mar seems
- * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded
- * as a Maven dependency and has been packed with this module
- */
- /************start of fix *********************************************************************/
- private URL axis2_xml =
- getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml");
- private URL axis2_repository = null;
- private URL rampart_mar_url =
- getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.4.mar");
- /************** end of fix *************************************************************/
-
- private boolean isRampartRequired;
-
- public TuscanyAxisConfigurator(boolean isRampartRequired) throws AxisFault {
- //super(TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
- // TuscanyAxisConfigurator.class.getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart.mar"));
- super(getResource("/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml"),
- null);
- this.isRampartRequired = isRampartRequired;
- }
-
- private static URL getResource(final String name) {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return TuscanyAxisConfigurator.class.getResource(name);
- }
- });
- }
-
- public ConfigurationContext getConfigurationContext() throws AxisFault {
- if (configContext == null) {
- configContext = ConfigurationContextFactory.createConfigurationContext(this);
- }
- return configContext;
- }
-
- /* these three methods are part of a temporary fix to solve problems that Maven has with including
- * rampart-1.3.mar into the classpath and also at the time of Release 1.0 rampart-1.3.mar seems
- * to pull in a SNAPSHOT version of rampart-project pom. Hence rampart.mar has been excluded
- * as a Maven dependency and has been packed with this module
- */
- /************start of fix *********************************************************************/
- @Override
- public AxisConfiguration getAxisConfiguration() throws AxisFault {
- InputStream axis2xmlStream;
- try {
- if (axis2_xml == null) {
- axis2xmlStream =
- Loader.getResourceAsStream(DeploymentConstants.AXIS2_CONFIGURATION_RESOURCE);
- } else {
- axis2xmlStream = axis2_xml.openStream();
- }
- axisConfig = populateAxisConfiguration(axis2xmlStream);
- if (isRampartRequired) {
- axisConfig.addGlobalModuleRef("rampart");
- }
- if (axis2_repository == null) {
- Parameter axis2repoPara = axisConfig.getParameter(DeploymentConstants.AXIS2_REPO);
- if (axis2repoPara != null) {
- String repoValue = (String) axis2repoPara.getValue();
- if (repoValue != null && !"".equals(repoValue.trim())) {
- if (repoValue.startsWith("file:/")) {
- // we treat this case specially , by assuming file is
- // located in the local machine
- loadRepository(repoValue);
- } else {
- loadRepositoryFromURL(new URL(repoValue));
- }
- }
- } else {
- //log.info("No repository found , module will be loaded from classpath");
- try {
- loadFromClassPath();
- } catch ( Exception e ) {
- if (isRampartRequired) {
- loadRampartModule();
- }
- }
- }
-
- } else {
- loadRepositoryFromURL(axis2_repository);
- }
-
- } catch (IOException e) {
- throw new AxisFault(e.getMessage());
- }
- axisConfig.setConfigurator(this);
- return axisConfig;
- }
-
- public void loadRampartModule() throws DeploymentException {
- try {
- ClassLoader deploymentClassLoader =
- org.apache.axis2.deployment.util.Utils.createClassLoader(
- new URL[]{rampart_mar_url},
- axisConfig.getModuleClassLoader(),
- true,
- (File) axisConfig.getParameterValue(Constants.Configuration.ARTIFACTS_TEMP_DIR));
- final AxisModule module = new AxisModule();
- module.setModuleClassLoader(deploymentClassLoader);
- module.setParent(axisConfig);
- //String moduleFile = fileUrl.substring(0, fileUrl.indexOf(".mar"));
- if (module.getName() == null) {
- module.setName(org.apache.axis2.util.Utils.getModuleName("rampart-1.4"));
- module.setVersion(org.apache.axis2.util.Utils.getModuleVersion("rampart-1.4"));
- }
- populateModule(module, rampart_mar_url);
- module.setFileName(rampart_mar_url);
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws IOException {
- addNewModule(module, axisConfig);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw (AxisFault)e.getException();
- }
-
- org.apache.axis2.util.Utils.
- calculateDefaultModuleVersion(axisConfig.getModules(), axisConfig);
- axisConfig.validateSystemPredefinedPhases();
- } catch (IOException e) {
- throw new DeploymentException(e);
- }
- }
-
- private void populateModule(AxisModule module, URL moduleUrl) throws DeploymentException {
- try {
- ClassLoader classLoader = module.getModuleClassLoader();
- InputStream moduleStream = classLoader.getResourceAsStream("META-INF/module.xml");
- if (moduleStream == null) {
- moduleStream = classLoader.getResourceAsStream("meta-inf/module.xml");
- }
- if (moduleStream == null) {
- throw new DeploymentException(
- Messages.getMessage(
- DeploymentErrorMsgs.MODULE_XML_MISSING, moduleUrl.toString()));
- }
- ModuleBuilder moduleBuilder = new ModuleBuilder(moduleStream, module, axisConfig);
- moduleBuilder.populateModule();
- } catch (IOException e) {
- throw new DeploymentException(e);
- }
- }
-
- /************** end of fix *************************************************************/
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.java
deleted file mode 100644
index 34899a4af0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyDispatcher.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.binding.ws.axis2;
-
-import java.net.URI;
-import java.util.HashMap;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.RequestURIBasedDispatcher;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * A Tuscany specific Axis2 Dispatcher that enables using services
- * exposed at the SCA defined service URI instead of /services/<serviceName>
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyDispatcher extends RequestURIBasedDispatcher {
-
- public static final String NAME = "TuscanyDispatcher";
- private static final Log log = LogFactory.getLog(RequestURIBasedDispatcher.class);
- private static final boolean isDebugEnabled = log.isDebugEnabled();
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.axis2.engine.AbstractDispatcher#findService(org.apache.axis2.context.MessageContext)
- */
- @Override
- public AxisService findService(MessageContext messageContext) throws AxisFault {
- EndpointReference toEPR = messageContext.getTo();
-
- if (toEPR != null) {
- if(isDebugEnabled){
- log.debug("Checking for Service using target endpoint address : " + toEPR.getAddress());
- }
-
- String path = URI.create(toEPR.getAddress()).getPath();
-
- ConfigurationContext configurationContext = messageContext.getConfigurationContext();
- AxisConfiguration registry = configurationContext.getAxisConfiguration();
-
- String serviceName = findAxisServiceName(registry, path);
- return registry.getService(serviceName);
-
- } else {
- if(isDebugEnabled){
- log.debug("Attempted to check for Service using null target endpoint URI");
- }
- return null;
- }
- }
-
- @Override
- public void initDispatcher() {
- init(new HandlerDescription(NAME));
- }
-
- protected String findAxisServiceName(AxisConfiguration registry, String path) {
- HashMap services = registry.getServices();
- if (services == null) {
- return null;
- }
- String[] parts = JavaUtils.split(path, '/');
- String serviceName = "";
- for (int i=parts.length-1; i>=0; i--) {
- serviceName = parts[i] + serviceName;
- if (services.containsKey(serviceName)) {
- return serviceName;
- }
- serviceName = "/" + serviceName;
- if (services.containsKey(serviceName)) {
- return serviceName;
- }
- }
-
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.java
deleted file mode 100644
index 7d331aa6c8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListenerManager.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.binding.ws.axis2;
-
-import java.lang.reflect.Field;
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.transport.TransportListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * A Tuscany specific Axis2 ListenerManager. Created purely as part of
- * TUSCANY-3149 to unregister the ListenerManager from the runtime
- * shutown hook
- */
-public class TuscanyListenerManager extends ListenerManager {
- private static final Log log = LogFactory.getLog(TuscanyListenerManager.class);
-
- private ListenerManagerShutdownThread shutdownThread = null;
-
- /**
- * To start all the transports
- */
- public synchronized void start() {
-
- ConfigurationContext configctx = getConfigctx();
-
- // very nasty! but this is in order to get someone running who keeps
- // getting perm gen errors. This will all go away when we move up to Axis2 1.5
- HashMap startedTransports = null;
-
- try {
- Field field = ListenerManager.class.getDeclaredField("startedTransports");
- field.setAccessible(true);
- startedTransports = (HashMap)field.get(this);
- } catch (Exception ex){
- ex.printStackTrace();
- }
-
- for (Iterator transportNames =
- configctx.getAxisConfiguration().getTransportsIn().values().iterator();
- transportNames.hasNext();) {
- try {
- TransportInDescription transportIn = (TransportInDescription) transportNames.next();
- TransportListener listener = transportIn.getReceiver();
- if (listener != null &&
- startedTransports.get(transportIn.getName()) == null) {
- listener.init(configctx, transportIn);
- listener.start();
- if (startedTransports.get(transportIn.getName()) == null) {
- startedTransports.put(transportIn.getName(), listener);
- }
- }
- } catch (Exception e) {
- log.info(e.getMessage(), e);
- }
- }
- shutdownThread = new ListenerManagerShutdownThread(this);
- Runtime.getRuntime().addShutdownHook(shutdownThread);
- }
-
- public synchronized void stop() throws AxisFault {
- super.stop();
- Runtime.getRuntime().removeShutdownHook(shutdownThread);
- }
-
- static class ListenerManagerShutdownThread extends Thread {
- ListenerManager listenerManager;
-
- public ListenerManagerShutdownThread(ListenerManager listenerManager) {
- super();
- this.listenerManager = listenerManager;
- }
-
- public void run() {
- try {
- listenerManager.stop();
- } catch (AxisFault axisFault) {
- log.error(axisFault.getMessage(), axisFault);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
deleted file mode 100644
index 21fef3e5d8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/TuscanyListingAgent.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.attachments.utils.IOUtils;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.deployment.DeploymentConstants;
-import org.apache.axis2.description.AxisDescription;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.PolicyInclude;
-import org.apache.axis2.transport.http.ListingAgent;
-import org.apache.axis2.transport.http.server.HttpUtils;
-import org.apache.axis2.util.ExternalPolicySerializer;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.axis2.wsdl.WSDLConstants;
-import org.apache.neethi.Policy;
-import org.apache.neethi.PolicyRegistry;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaExternal;
-
-/**
- * A Tuscany specific Axis2 ListingAgent as the Axis2 one does not work
- * with the Tuscany service names which include slash ('/') characters.
- * Unfortunately it ends up having to copy a fair amount of Axis2 code to do this.
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyListingAgent extends ListingAgent {
-
- private static final String LIST_SINGLE_SERVICE_JSP_NAME =
- "listSingleService.jsp";
-
- public TuscanyListingAgent(ConfigurationContext aConfigContext) {
- super(aConfigContext);
- }
-
- /**
- * This method overrides the Axis2 listing agent's computation of the
- * service name.
- */
- @Override
- public String extractServiceName(String urlString) {
- String serviceName = findAxisServiceName(urlString);
- setContextRoot(urlString, serviceName);
- return serviceName;
- }
-
- /**
- * Override ?xsd processing so that WSDL documents with XSD imports
- * and includes work correctly. When we move to Axis2 1.4, we may
- * be able to use SchemaSupplier to do this in a cleaner way. Also
- * ensure that the correct IP address and port are returned by ?wsdl.
- */
- @Override
- public void processListService(HttpServletRequest req,
- HttpServletResponse res)
- throws IOException, ServletException {
-
- String url = req.getRequestURL().toString();
- String query = req.getQueryString();
-
- // for ?wsdl requests, need to update the WSDL with correct IPaddr and port
- int wsdl = query.indexOf("wsdl");
- if (wsdl >= 0) {
- String serviceName = extractServiceName(url);
- HashMap services = configContext.getAxisConfiguration().getServices();
- if ((services != null) && !services.isEmpty()) {
- AxisService axisService = (AxisService)services.get(serviceName);
- Parameter wsld4jdefinition = axisService.getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
- Definition definition = (Definition)wsld4jdefinition.getValue();
- for (Object s : definition.getServices().values()) {
- for (Object p : ((Service)s).getPorts().values()) {
- String endpointURL = Axis2ServiceProvider.getPortAddress((Port)p);
- String modifiedURL = setIPAddress(endpointURL, url);
- Axis2ServiceProvider.setPortAddress((Port)p, modifiedURL);
- }
- }
- }
- }
-
- // handle ?xsd requests here
- int xsd = query.indexOf("xsd");
- if (xsd >= 0) {
- String serviceName = extractServiceName(url);
- HashMap services = configContext.getAxisConfiguration().getServices();
- if ((services != null) && !services.isEmpty()) {
- Object serviceObj = services.get(serviceName);
- if (serviceObj != null) {
- String xsds = req.getParameter("xsd");
- if (xsds != null && !"".equals(xsds)) {
- // a schema name (perhaps with path) is present
- AxisService axisService = (AxisService)serviceObj;
- ArrayList schemas = axisService.getSchema();
- for (Object rootSchema : axisService.getSchema()) {
- XmlSchema schema = getSchema(((XmlSchema)rootSchema), xsds);
- if (schema != null) {
- // found the schema
- res.setContentType("text/xml");
- OutputStream out = res.getOutputStream();
- schema.write(new OutputStreamWriter(out, "UTF8"));
- out.flush();
- out.close();
- return;
- }
- }
- }
- }
- }
- }
-
- // in all other cases, delegate to the Axis2 code
- super.processListService(req, res);
- }
-
- private XmlSchema getSchema(XmlSchema parentSchema, String name) {
- for (Iterator iter = parentSchema.getIncludes().getIterator(); iter.hasNext();) {
- Object obj = iter.next();
- if (obj instanceof XmlSchemaExternal) {
- XmlSchemaExternal extSchema = (XmlSchemaExternal)obj;
- if (extSchema.getSchemaLocation().endsWith(name)) {
- return extSchema.getSchema();
- } else {
- XmlSchema schema = getSchema(extSchema.getSchema(), name);
- if (schema != null) {
- return schema;
- }
- }
- }
- }
- return null;
- }
-
- private String findAxisServiceName(String path) {
- HashMap services = configContext.getAxisConfiguration().getServices();
- if (services == null) {
- return null;
- }
- String[] parts = JavaUtils.split(path, '/');
- String serviceName = "";
- for (int i=parts.length-1; i>=0; i--) {
- serviceName = parts[i] + serviceName;
- if (services.containsKey(serviceName)) {
- return serviceName;
- }
- serviceName = "/" + serviceName;
- if (services.containsKey(serviceName)) {
- return serviceName;
- }
- }
-
- return null;
- }
-
- /**
- * Hack for Tuscany to get ?wsdl working with Tuscany service names
- * Can go once moved up to Axis2 1.3
- */
- private void setContextRoot(String filePart, String serviceName) {
- String contextRoot = configContext.getContextRoot();
- if (contextRoot != null && contextRoot.length() > 0) {
- if (contextRoot.equals("/")) {
- configContext.setServicePath("/");
- } else {
- int i = filePart.indexOf(contextRoot) + contextRoot.length();
- int j = filePart.lastIndexOf(serviceName);
- if (i>=j || (i+1 == j)) {
- configContext.setServicePath("/");
- } else {
- String mapping = filePart.substring(i+1, j);
- configContext.setServicePath(mapping);
- }
- }
- configContext.setContextRoot(contextRoot);
- }
- }
-
- private static String setIPAddress(String wsdlURI, String requestURI) {
- try {
- URI wsdlURIObj = new URI(wsdlURI);
- String wsdlHost = wsdlURIObj.getHost();
- int wsdlPort = wsdlURIObj.getPort();
- String wsdlAddr = wsdlHost + (wsdlPort != -1 ? ":" + Integer.toString(wsdlPort) : "");
- URI requestURIObj = new URI(requestURI);
- String ipAddr = HttpUtils.getIpAddress();
- int requestPort = requestURIObj.getPort();
- String newAddr = ipAddr + (requestPort != -1 ? ":" + Integer.toString(requestPort) : "");
- return wsdlURI.replace(wsdlAddr, newAddr);
- } catch (Exception e) {
- // URI string not in expected format, so return the WSDL URI unmodified
- return wsdlURI;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.java
deleted file mode 100644
index 5254a5716c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/WSBindingDefinitionsProvider.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.binding.ws.axis2;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class WSBindingDefinitionsProvider implements SCADefinitionsProvider {
- private String definitionsFile = "org/apache/tuscany/sca/binding/ws/axis2/definitions.xml";
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public WSBindingDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- final URL definitionsFileUrl = getClass().getClassLoader().getResource(definitionsFile);
- SCADefinitions scaDefn = null;
- try {
- final URI uri = new URI(definitionsFile);
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
- public SCADefinitions run() throws ContributionReadException {
- return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
- }
- });
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- return scaDefn;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/AxisJMSException.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/AxisJMSException.java
deleted file mode 100644
index 09a1960ce4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/AxisJMSException.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.binding.ws.axis2.jms;
-
-public class AxisJMSException extends RuntimeException {
-
- AxisJMSException() {
- super();
- }
-
- AxisJMSException(String msg) {
- super(msg);
- }
-
- AxisJMSException(String msg, Exception e) {
- super(msg, e);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSConnectionFactory.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSConnectionFactory.java
deleted file mode 100644
index a96ec0b1c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSConnectionFactory.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.jms;
-
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * Encapsulate a JMS Connection factory definition within an Axis2.xml
- * <p/>
- * More than one JMS connection factory could be defined within an Axis2 XML
- * specifying the JMSListener as the transportReceiver.
- * <p/>
- * These connection factories are created at the initialization of the
- * transportReceiver, and any service interested in using any of these could
- * specify the name of the factory and the destination through Parameters named
- * JMSConstants.CONFAC_PARAM and JMSConstants.DEST_PARAM as shown below.
- * <p/>
- * <parameter name="transport.jms.ConnectionFactory" locked="true">myQueueConnectionFactory</parameter>
- * <parameter name="transport.jms.Destination" locked="true">TestQueue</parameter>
- * <p/>
- * If a connection factory is defined by a parameter named
- * JMSConstants.DEFAULT_CONFAC_NAME in the Axis2 XML, services which does not
- * explicitly specify a connection factory will be defaulted to it - if it is
- * defined in the Axis2 configuration.
- * <p/>
- * e.g.
- * <transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener">
- * <parameter name="myTopicConnectionFactory" locked="false">
- * <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- * <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
- * <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter>
- * <parameter name="transport.jms.Destination" locked="false">myTopicOne, myTopicTwo</parameter>
- * </parameter>
- * <parameter name="myQueueConnectionFactory" locked="false">
- * <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- * <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
- * <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">QueueConnectionFactory</parameter>
- * <parameter name="transport.jms.Destination" locked="false">myQueueOne, myQueueTwo</parameter>
- * </parameter>
- * <parameter name="default" locked="false">
- * <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- * <parameter name="java.naming.provider.url" locked="false">tcp://localhost:61616</parameter>
- * <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">ConnectionFactory</parameter>
- * <parameter name="transport.jms.Destination" locked="false">myDestinationOne, myDestinationTwo</parameter>
- * </parameter>
- * </transportReceiver>
- */
-public class JMSConnectionFactory {
-
- private static final Log log = LogFactory.getLog(JMSConnectionFactory.class);
-
- /**
- * The name used for the connection factory definition within Axis2
- */
- private String name = null;
- /**
- * The JNDI name of the actual connection factory
- */
- private String jndiName = null;
- /**
- * The JNDI name of the actual connection factory username
- */
- private String jndiUser = null;
- /**
- * The JNDI name of the actual connection factory password
- */
- private String jndiPass = null;
- /**
- * Map of destination JNDI names to service names
- */
- private Map serviceJNDINameMapping = null;
- /**
- * Map of destinations to service names
- */
- private Map serviceDestinationMapping = null;
- /**
- * The JMS Sessions listening for messages
- */
- private Map jmsSessions = null;
- /**
- * Properties of the connection factory
- */
- private Hashtable properties = null;
- /**
- * The JNDI Context used
- */
- private Context context = null;
- /**
- * The actual ConnectionFactory instance held within
- */
- private ConnectionFactory conFactory = null;
- /**
- * The JMS Connection is opened.
- */
- private Connection connection = null;
- /**
- * The JMS Message receiver for this connection factory
- */
- private JMSMessageReceiver msgRcvr = null;
- /**
- * The actual password for the connection factory after retrieval from JNDI.
- * If this is not supplied, the OS username will be used by default
- */
- private String user = null;
- /**
- * The actual password for the connection factory after retrieval from JNDI.
- * If this is not supplied, the OS credentials will be used by default
- */
- private String pass = null;
-
- private WorkScheduler workScheduler;
- private boolean consumerRunning;
-
- /**
- * Create a JMSConnectionFactory for the given Axis2 name and JNDI name
- *
- * @param name the local Axis2 name of the connection factory
- * @param jndiName the JNDI name of the actual connection factory used
- */
- JMSConnectionFactory(String name, String jndiName, WorkScheduler workScheduler) {
- this.name = name;
- this.jndiName = jndiName;
- serviceJNDINameMapping = new HashMap();
- serviceDestinationMapping = new HashMap();
- properties = new Hashtable();
- jmsSessions = new HashMap();
- this.workScheduler = workScheduler;
- }
-
- /**
- * Create a JMSConnectionFactory for the given Axis2 name
- *
- * @param name the local Axis2 name of the connection factory
- */
- JMSConnectionFactory(String name, WorkScheduler workScheduler) {
- this(name, null, workScheduler);
- }
-
- /**
- * Connect to the actual JMS connection factory specified by the JNDI name
- *
- * @throws NamingException if the connection factory cannot be found
- */
- public void connect() throws NamingException {
- if (context == null) {
- createInitialContext();
- }
- conFactory = (ConnectionFactory) context.lookup(jndiName);
-
- if (jndiUser != null)
- user = (String ) context.lookup(jndiUser);
-
- if (jndiPass != null)
- pass = (String ) context.lookup(jndiPass);
-
- log.debug("Connected to the actual connection factory : " + jndiName);
- }
-
- /**
- * Creates the initial context using the set properties
- *
- * @throws NamingException
- */
- private void createInitialContext() throws NamingException {
- context = new InitialContext(properties);
- }
-
- /**
- * Set the JNDI connection factory name
- *
- * @param jndiName
- */
- public void setJndiName(String jndiName) {
- this.jndiName = jndiName;
- }
-
- /**
- * Get the JNDI name of the actual factory username
- *
- * @return the jndi name of the actual connection factory username
- */
- public void setJndiUser(String jndiUser) {
- this.jndiUser = jndiUser;
- }
-
- /**
- * Get the JNDI name of the actual factory password
- *
- * @return the jndi name of the actual connection factory password
- */
- public void setJndiPass(String jndiPass) {
- this.jndiPass = jndiPass;
- }
-
- /**
- * Add a listen destination on this connection factory on behalf of the given service
- *
- * @param destinationJndi destination JNDI name
- * @param serviceName the service to which it belongs
- */
- public void addDestination(String destinationJndi, String serviceName) {
-
- serviceJNDINameMapping.put(destinationJndi, serviceName);
- String destinationName = getDestinationName(destinationJndi);
-
- if (destinationName == null) {
- log.warn("JMS Destination with JNDI name : " + destinationJndi + " does not exist");
-
- Connection con = null;
- try {
- if ((jndiUser == null) || (jndiPass == null)){
- // Use the OS username and credentials
- con = conFactory.createConnection();
- } else{
- // use an explicit username and password
- con = conFactory.createConnection(user, pass);
- }
- Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Queue queue = session.createQueue(destinationJndi);
- destinationName = queue.getQueueName();
- log.warn("JMS Destination with JNDI name : " + destinationJndi + " created");
-
- } catch (JMSException e) {
- log.error("Unable to create a Destination with JNDI name : " + destinationJndi, e);
- // mark service as faulty
- JMSUtils.markServiceAsFaulty(
- (String) serviceJNDINameMapping.get(destinationJndi),
- "Error looking up JMS destination : " + destinationJndi,
- msgRcvr.getAxisConf().getAxisConfiguration());
-
- } finally {
- if (con != null) {
- try {
- con.close();
- } catch (JMSException ignore) {}
- }
- }
- }
-
- serviceDestinationMapping.put(destinationName, serviceName);
- log.info("Mapping JNDI name : " + destinationJndi + " and JMS Destination name : " +
- destinationName + " against service : " + serviceName);
- }
-
- /**
- * Remove listen destination on this connection factory
- *
- * @param destinationJndi the JMS destination to be removed
- * @throws if an error occurs trying to stop listening for messages before removal
- */
- public void removeDestination(String destinationJndi) throws JMSException {
- // find and save provider specific Destination name before we delete
- String providerSpecificDestination = getDestinationName(destinationJndi);
- stoplistenOnDestination(destinationJndi);
- serviceJNDINameMapping.remove(destinationJndi);
- if (providerSpecificDestination != null) {
- serviceDestinationMapping.remove(providerSpecificDestination);
- }
- }
-
- /**
- * Add a property to the connection factory
- *
- * @param key
- * @param value
- */
- public void addProperty(String key, String value) {
- properties.put(key, value);
- }
-
- /**
- * Return the name of the connection factory
- *
- * @return the Axis2 name of this factory
- */
- public String getName() {
- return name;
- }
-
- /**
- * Get the JNDI name of the actual factory
- *
- * @return the jndi name of the actual connection factory
- */
- public String getJndiName() {
- return jndiName;
- }
-
- /**
- * Get the JNDI name of the actual factory username
- *
- * @return the jndi name of the actual connection factory username
- */
- public String getJndiUser() {
- return jndiUser;
- }
-
- /**
- * Get the JNDI name of the actual factory password
- *
- * @return the jndi name of the actual connection factory password
- */
- public String getJndiPass() {
- return jndiPass;
- }
-
-
- /**
- * This is the real password for the connection factory after the JNDI lookup
- *
- * @return the real password for the connection factory after the JNDI lookup
- */
- public String getPass() {
- return pass;
- }
-
- /**
- * This is the real username for the connection factory after the JNDI lookup
- *
- * @return the eal username for the connection factory after the JNDI lookup
- */
- public String getUser() {
- return user;
- }
-
- /**
- * Get the actual underlying connection factory
- *
- * @return actual connection factory
- */
- public ConnectionFactory getConFactory() {
- return conFactory;
- }
-
- /**
- * Get the list of destinations (JNDI) associated with this connection factory
- *
- * @return destinations to service maping
- */
- public Map getDestinations() {
- return serviceJNDINameMapping;
- }
-
- /**
- * Get the connection factory properties
- *
- * @return properties
- */
- public Hashtable getProperties() {
- return properties;
- }
-
- /**
- * Begin listening for messages on the list of destinations associated
- * with this connection factory. (Called during Axis2 initialization of
- * the Transport receivers)
- *
- * @param msgRcvr the message receiver which will process received messages
- * @throws JMSException on exceptions
- */
- public void listen(JMSMessageReceiver msgRcvr) throws JMSException {
-
- // save a reference to the message receiver
- this.msgRcvr = msgRcvr;
-
- log.debug("Connection factory : " + name + " initializing...");
-
- if (conFactory == null || context == null) {
- handleException(
- "Connection factory must be 'connected' before listening");
- } else {
- try {
- if ((jndiUser == null) || (jndiPass == null)){
- // User the OS username and credentials
- connection = conFactory.createConnection();
- } else{
- // use an explicit username and password
- connection = conFactory.createConnection(user, pass);
- }
- } catch (JMSException e) {
- handleException("Error creating a JMS connection using the " +
- "factory : " + jndiName, e);
- }
- }
-
- Iterator iter = serviceJNDINameMapping.keySet().iterator();
- while (iter.hasNext()) {
- String destinationJndi = (String) iter.next();
- listenOnDestination(destinationJndi);
- }
-
- // start the connection
- if (!consumerRunning) {
- connection.start();
- }
- log.info("Connection factory : " + name + " initialized...");
- }
-
- /**
- * Listen on the given destination from this connection factory. Used to
- * start listening on a destination associated with a newly deployed service
- *
- * @param destinationJndi the JMS destination to listen on
- * @throws JMSException on exception
- */
- public void listenOnDestination(String destinationJndi) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Destination destination = null;
- try {
- Object o = context.lookup(destinationJndi);
- destination = (Destination) o;
-
- } catch (NameNotFoundException e) {
- log.warn("Cannot find destination : " + destinationJndi +
- " Creating a Queue with this name");
- destination = session.createQueue(destinationJndi);
-
- } catch (NamingException e) {
- log.warn("Error looking up destination : " + destinationJndi, e);
- // mark service as faulty
- JMSUtils.markServiceAsFaulty(
- (String) serviceJNDINameMapping.get(destinationJndi),
- "Error looking up JMS destination : " + destinationJndi,
- this.msgRcvr.getAxisConf().getAxisConfiguration());
- }
-
- MessageConsumer consumer = session.createConsumer(destination);
-// consumer.setMessageListener(this.msgRcvr); replace with new Tuscany method:
- registerMessageReceiver(consumer, this.msgRcvr);
- jmsSessions.put(destinationJndi, session);
- }
-
- private void registerMessageReceiver(final MessageConsumer consumer, final JMSMessageReceiver messageReceiver) throws JMSException {
-
- try {
-
- consumer.setMessageListener(messageReceiver);
-
- } catch (javax.jms.JMSException e) {
-
- // setMessageListener not allowed in JEE container so use Tuscany threads
-
- connection.start();
- consumerRunning = true;
-
- workScheduler.scheduleWork(new Runnable() {
-
- public void run() {
- try {
- while (consumerRunning) {
- final Message msg = consumer.receive();
- if (msg != null) {
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- try {
- messageReceiver.onMessage(msg);
- } catch (Exception e) {
- log.error("Exception on message receiver thread", e);
- }
- }
- });
- }
- }
- } catch (Exception e) {
- log.error("Exception on consumer receive thread", e);
- }
- }
- });
- }
- }
-
- /**
- * Stop listening on the given destination - for undeployment of services
- *
- * @param destinationJndi the JNDI name of the JMS destination
- * @throws JMSException on exception
- */
- private void stoplistenOnDestination(String destinationJndi) throws JMSException {
- ((Session) jmsSessions.get(destinationJndi)).close();
- }
-
- /**
- * Return the service name using this destination
- *
- * @param destination the destination name
- * @return the service which uses the given destination, or null
- */
- public String getServiceNameForDestination(String destination) {
-
- return (String) serviceJNDINameMapping.get(destination);
- }
-
- /**
- * Close all connections, sessions etc.. and stop this connection factory
- */
- public void stop() {
- try {
- consumerRunning = false;
- connection.close();
- } catch (JMSException e) {
- log.warn("Error shutting down connection factory : " + name, e);
- }
- }
-
- /**
- * Return the provider specific Destination name if any for the destination with the given
- * JNDI name
- * @param destinationJndi the JNDI name of the destination
- * @return the provider specific Destination name or null if cannot be found
- */
- public String getDestinationName(String destinationJndi) {
- try {
- Destination destination = (Destination) context.lookup(destinationJndi);
- if (destination != null && destination instanceof Queue) {
- return ((Queue) destination).getQueueName();
- } else if (destination != null && destination instanceof Topic) {
- return ((Topic) destination).getTopicName();
- }
- } catch (JMSException e) {
- log.warn("Error reading provider specific JMS destination name for destination " +
- "with JNDI name : " + destinationJndi, e);
- } catch (NamingException e) {
- log.warn("Error looking up destination with JNDI name : " + destinationJndi +
- " to map its corresponding provider specific Destination name");
- }
- return null;
- }
-
- /**
- * Return the EPR for the JMS Destination with the given JNDI name and using
- * this connection factory
- * @param destination the JNDI name of the JMS Destionation
- * @return the EPR
- */
- public EndpointReference getEPRForDestination(String destination) {
-
- StringBuffer sb = new StringBuffer();
- sb.append(JMSConstants.JMS_PREFIX).append(destination);
- sb.append("?").append(JMSConstants.CONFAC_JNDI_NAME_PARAM).
- append("=").append(getJndiName());
- Iterator props = getProperties().keySet().iterator();
- while (props.hasNext()) {
- String key = (String) props.next();
- String value = (String) getProperties().get(key);
- sb.append("&").append(key).append("=").append(value);
- }
-
- return new EndpointReference(sb.toString());
- }
-
- public String getServiceByDestination(String destinationName) {
- return (String) serviceDestinationMapping.get(destinationName);
- }
-
- private void handleException(String msg) throws AxisJMSException {
- log.error(msg);
- throw new AxisJMSException(msg);
- }
-
- private void handleException(String msg, Exception e) throws AxisJMSException {
- log.error(msg, e);
- throw new AxisJMSException(msg, e);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSListener.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSListener.java
deleted file mode 100644
index 08190fb57c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSListener.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.jms;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.jms.JMSException;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.SessionContext;
-import org.apache.axis2.description.AxisModule;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.AxisServiceGroup;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.description.ParameterIncludeImpl;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.AxisEvent;
-import org.apache.axis2.engine.AxisObserver;
-import org.apache.axis2.transport.TransportListener;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-import edu.emory.mathcs.backport.java.util.concurrent.ExecutorService;
-import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
-import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
-import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
-
-/**
- * The JMS Transport listener implementation. A JMS Listner will hold one or
- * more JMS connection factories, which would be created at initialization
- * time. This implementation does not support the creation of connection
- * factories at runtime. This JMS Listener registers with Axis to be notified
- * of service deployment/undeployment/start and stop, and enables or disables
- * listening for messages on the destinations as appropriate.
- * <p/>
- * A Service could state the JMS connection factory name and the destination
- * name for use as Parameters in its services.xml as shown in the example
- * below. If the connection name was not specified, it will use the connection
- * factory named "default" (JMSConstants.DEFAULT_CONFAC_NAME) - if such a
- * factory is defined in the Axis2.xml. If the destination name is not specified
- * it will default to a JMS queue by the name of the service. If the destination
- * should be a Topic, it should be created on the JMS implementation, and
- * specified in the services.xml of the service.
- * <p/>
- * <parameter name="transport.jms.ConnectionFactory" locked="true">
- * myTopicConnectionFactory</parameter>
- * <parameter name="transport.jms.Destination" locked="true">
- * dynamicTopics/something.TestTopic</parameter>
- */
-public class JMSListener implements TransportListener {
-
- private static final Log log = LogFactory.getLog(JMSListener.class);
-
- /**
- * The maximum number of threads used for the worker thread pool
- */
- private static final int WORKERS_MAX_THREADS = 100;
- /**
- * The keep alive time of an idle worker thread
- */
- private static final long WORKER_KEEP_ALIVE = 60L;
- /**
- * The worker thread timeout time unit
- */
- private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS;
-
- /**
- * A Map containing the connection factories managed by this, keyed by name
- */
- private Map connectionFactories = new HashMap();
- /**
- * A Map of service name to the JMS EPR addresses
- */
- private Map serviceNameToEprMap = new HashMap();
- /**
- * The Axis2 Configuration context
- */
- private ConfigurationContext configCtx = null;
-
- private ExecutorService workerPool;
-
- private WorkScheduler workScheduler;
-
- public JMSListener(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- }
-
- /**
- * This is the TransportListener initialization method invoked by Axis2
- *
- * @param axisConf the Axis configuration context
- * @param transprtIn the TransportIn description
- */
- public void init(ConfigurationContext axisConf,
- TransportInDescription transprtIn) {
-
- // save reference to the configuration context
- this.configCtx = axisConf;
-
- // initialize the defined connection factories
- initializeConnectionFactories(transprtIn);
-
- // if no connection factories are defined, we cannot listen
- if (connectionFactories.isEmpty()) {
- log.warn("No JMS connection factories are defined." +
- "Will not listen for any JMS messages");
- return;
- }
-
- // iterate through deployed services and validate connection factory
- // names, and mark services as faulty where appropriate.
- Iterator services =
- axisConf.getAxisConfiguration().getServices().values().iterator();
-
- while (services.hasNext()) {
- AxisService service = (AxisService) services.next();
- if (JMSUtils.isJMSService(service)) {
- processService(service);
- }
- }
-
- // register to receive updates on services for lifetime management
- axisConf.getAxisConfiguration().addObservers(new JMSAxisObserver());
-
- log.info("JMS Transport Receiver (Listener) initialized...");
- }
-
-
- /**
- * Prepare to listen for JMS messages on behalf of this service
- *
- * @param service
- */
- private void processService(AxisService service) {
- JMSConnectionFactory cf = getConnectionFactory(service);
- if (cf == null) {
- String msg = "Service " + service.getName() + " does not specify" +
- "a JMS connection factory or refers to an invalid factory. " +
- "This service is being marked as faulty and will not be " +
- "available over the JMS transport";
- log.warn(msg);
- JMSUtils.markServiceAsFaulty(
- service.getName(), msg, service.getAxisConfiguration());
- return;
- }
-
- String destination = JMSUtils.getDestination(service);
-
- // compute service EPR and keep for later use
- serviceNameToEprMap.put(service.getName(), getEPR(cf, destination));
-
- // add the specified or implicit destination of this service
- // to its connection factory
- cf.addDestination(destination, service.getName());
- }
-
- /**
- * Return the connection factory name for this service. If this service
- * refers to an invalid factory or defaults to a non-existent default
- * factory, this returns null
- *
- * @param service the AxisService
- * @return the JMSConnectionFactory to be used, or null if reference is invalid
- */
- private JMSConnectionFactory getConnectionFactory(AxisService service) {
- Parameter conFacParam = service.getParameter(JMSConstants.CONFAC_PARAM);
-
- // validate connection factory name (specified or default)
- if (conFacParam != null) {
- String conFac = (String) conFacParam.getValue();
- if (connectionFactories.containsKey(conFac)) {
- return (JMSConnectionFactory) connectionFactories.get(conFac);
- } else {
- return null;
- }
-
- } else if (connectionFactories.containsKey(JMSConstants.DEFAULT_CONFAC_NAME)) {
- return (JMSConnectionFactory) connectionFactories.
- get(JMSConstants.DEFAULT_CONFAC_NAME);
-
- } else {
- return null;
- }
- }
-
- /**
- * Initialize the defined connection factories, parsing the TransportIn
- * descriptions
- *
- * @param transprtIn The Axis2 Transport in for the JMS
- */
- private void initializeConnectionFactories(TransportInDescription transprtIn) {
- // iterate through all defined connection factories
- Iterator conFacIter = transprtIn.getParameters().iterator();
-
- while (conFacIter.hasNext()) {
-
- Parameter param = (Parameter) conFacIter.next();
- JMSConnectionFactory jmsConFactory =
- new JMSConnectionFactory(param.getName(), workScheduler);
-
- ParameterIncludeImpl pi = new ParameterIncludeImpl();
- try {
- pi.deserializeParameters((OMElement) param.getValue());
- } catch (AxisFault axisFault) {
- handleException("Error reading Parameters for JMS connection " +
- "factory" + jmsConFactory.getName(), axisFault);
- }
-
- // read connection facotry properties
- Iterator params = pi.getParameters().iterator();
-
- while (params.hasNext()) {
- Parameter p = (Parameter) params.next();
-
- if (Context.INITIAL_CONTEXT_FACTORY.equals(p.getName())) {
- jmsConFactory.addProperty(
- Context.INITIAL_CONTEXT_FACTORY, (String) p.getValue());
- } else if (Context.PROVIDER_URL.equals(p.getName())) {
- jmsConFactory.addProperty(
- Context.PROVIDER_URL, (String) p.getValue());
- } else if (Context.SECURITY_PRINCIPAL.equals(p.getName())) {
- jmsConFactory.addProperty(
- Context.SECURITY_PRINCIPAL, (String) p.getValue());
- } else if (Context.SECURITY_CREDENTIALS.equals(p.getName())) {
- jmsConFactory.addProperty(
- Context.SECURITY_CREDENTIALS, (String) p.getValue());
- } else if (JMSConstants.CONFAC_JNDI_NAME_PARAM.equals(p.getName())) {
- jmsConFactory.setJndiName((String) p.getValue());
- } else if (JMSConstants.CONFAC_JNDI_NAME_USER.equals(p.getName())) {
- jmsConFactory.setJndiUser((String) p.getValue());
- } else if (JMSConstants.CONFAC_JNDI_NAME_PASS.equals(p.getName())) {
- jmsConFactory.setJndiPass((String) p.getValue());
- } else if (JMSConstants.DEST_PARAM.equals(p.getName())) {
- StringTokenizer st =
- new StringTokenizer((String) p.getValue(), " ,");
- while (st.hasMoreTokens()) {
- jmsConFactory.addDestination(st.nextToken(), null);
- }
- }
- }
-
- // connect to the actual connection factory
- try {
- jmsConFactory.connect();
- connectionFactories.put(jmsConFactory.getName(), jmsConFactory);
- } catch (NamingException e) {
- handleException("Error connecting to JMS connection factory : " +
- jmsConFactory.getJndiName(), e);
- }
- }
- }
-
- /**
- * Get the EPR for the given JMS connection factory and destination
- * the form of the URL is
- * jms:/<destination>?[<key>=<value>&]*
- *
- * @param cf the Axis2 JMS connection factory
- * @param destination the JNDI name of the destination
- * @return the EPR as a String
- */
- private static String getEPR(JMSConnectionFactory cf, String destination) {
- StringBuffer sb = new StringBuffer();
- sb.append(JMSConstants.JMS_PREFIX).append(destination);
- sb.append("?").append(JMSConstants.CONFAC_JNDI_NAME_PARAM).
- append("=").append(cf.getJndiName());
- Iterator props = cf.getProperties().keySet().iterator();
- while (props.hasNext()) {
- String key = (String) props.next();
- String value = (String) cf.getProperties().get(key);
- sb.append("&").append(key).append("=").append(value);
- }
- return sb.toString();
- }
-
- /**
- * Start this JMS Listener (Transport Listener)
- *
- * @throws AxisFault
- */
- public void start() throws AxisFault {
- // create thread pool of workers
- workerPool = new ThreadPoolExecutor(
- 1,
- WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TIME_UNIT,
- new LinkedBlockingQueue(),
- new org.apache.axis2.util.threadpool.DefaultThreadFactory(
- new ThreadGroup("JMS Worker thread group"),
- "JMSWorker"));
-
- Iterator iter = connectionFactories.values().iterator();
- while (iter.hasNext()) {
- JMSConnectionFactory conFac = (JMSConnectionFactory) iter.next();
- JMSMessageReceiver msgRcvr =
- new JMSMessageReceiver(conFac, workerPool, configCtx);
-
- try {
- conFac.listen(msgRcvr);
- } catch (JMSException e) {
- handleException("Error starting connection factory : " +
- conFac.getName(), e);
- }
- }
- }
-
- /**
- * Stop this transport listener and shutdown all of the connection factories
- */
- public void stop() {
- Iterator iter = connectionFactories.values().iterator();
- while (iter.hasNext()) {
- ((JMSConnectionFactory) iter.next()).stop();
- }
- if (workerPool != null) {
- workerPool.shutdown();
- }
- }
-
- /**
- * Returns EPRs for the given service and IP. (Picks up precomputed EPR)
- *
- * @param serviceName service name
- * @param ip ignored
- * @return the EPR for the service
- * @throws AxisFault not used
- */
- public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
- //Strip out the operation name
- if (serviceName.indexOf('/') != -1) {
- serviceName = serviceName.substring(0, serviceName.indexOf('/'));
- }
-
- String endpointName = (String) serviceNameToEprMap.get(serviceName);
- if (endpointName == null){
- if (serviceName.indexOf(".") != -1){
- serviceName = serviceName.substring(0, serviceName.indexOf("."));
- endpointName = (String) serviceNameToEprMap.get(serviceName);
- }
- }
- return new EndpointReference[]{new EndpointReference(endpointName)};
- }
-
- /**
- * Returns the EPR for the given service and IP. (Picks up precomputed EPR)
- *
- * @param serviceName service name
- * @param ip ignored
- * @return the EPR for the service
- * @throws AxisFault not used
- */
- public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
- return getEPRsForService(serviceName, ip)[0];
- }
-
- /**
- * Starts listening for messages on this service
- *
- * @param service the AxisService just deployed
- */
- private void startListeningForService(AxisService service) {
- processService(service);
- JMSConnectionFactory cf = getConnectionFactory(service);
- if (cf == null) {
- String msg = "Service " + service.getName() + " does not specify" +
- "a JMS connection factory or refers to an invalid factory." +
- "This service is being marked as faulty and will not be " +
- "available over the JMS transport";
- log.warn(msg);
- JMSUtils.markServiceAsFaulty(
- service.getName(), msg, service.getAxisConfiguration());
- return;
- }
-
- String destination = JMSUtils.getDestination(service);
- try {
- cf.listenOnDestination(destination);
- log.info("Started listening on destination : " + destination +
- " for service " + service.getName());
-
- } catch (JMSException e) {
- handleException(
- "Could not listen on JMS for service " + service.getName(), e);
- JMSUtils.markServiceAsFaulty(
- service.getName(), e.getMessage(), service.getAxisConfiguration());
- }
- }
-
- /**
- * Stops listening for messages for the service undeployed
- *
- * @param service the AxisService just undeployed
- */
- private void stopListeningForService(AxisService service) {
-
- JMSConnectionFactory cf = getConnectionFactory(service);
- if (cf == null) {
- String msg = "Service " + service.getName() + " does not specify" +
- "a JMS connection factory or refers to an invalid factory." +
- "This service is being marked as faulty and will not be " +
- "available over the JMS transport";
- log.warn(msg);
- JMSUtils.markServiceAsFaulty(
- service.getName(), msg, service.getAxisConfiguration());
- return;
- }
-
- // remove from the serviceNameToEprMap
- serviceNameToEprMap.remove(service.getName());
-
- String destination = JMSUtils.getDestination(service);
- try {
- cf.removeDestination(destination);
- } catch (JMSException e) {
- handleException(
- "Error while terminating listening on JMS destination : " + destination, e);
- }
- }
-
- private void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new AxisJMSException(msg, e);
- }
-
- /**
- * An AxisObserver which will start listening for newly deployed services,
- * and stop listening when services are undeployed.
- */
- class JMSAxisObserver implements AxisObserver {
-
- // The initilization code will go here
- public void init(AxisConfiguration axisConfig) {
- }
-
- public void serviceUpdate(AxisEvent event, AxisService service) {
-
- if (JMSUtils.isJMSService(service)) {
- switch (event.getEventType()) {
- case AxisEvent.SERVICE_DEPLOY :
- startListeningForService(service);
- break;
- case AxisEvent.SERVICE_REMOVE :
- stopListeningForService(service);
- break;
- case AxisEvent.SERVICE_START :
- startListeningForService(service);
- break;
- case AxisEvent.SERVICE_STOP :
- stopListeningForService(service);
- break;
- }
- }
- }
-
- public void moduleUpdate(AxisEvent event, AxisModule module) {
- }
-
- //--------------------------------------------------------
- public void addParameter(Parameter param) throws AxisFault {
- }
-
- public void removeParameter(Parameter param) throws AxisFault {
- }
-
- public void deserializeParameters(OMElement parameterElement) throws AxisFault {
- }
-
- public Parameter getParameter(String name) {
- return null;
- }
-
- public ArrayList getParameters() {
- return null;
- }
-
- public boolean isParameterLocked(String parameterName) {
- return false;
- }
-
- public void serviceGroupUpdate(AxisEvent event, AxisServiceGroup serviceGroup) {
- }
- }
-
- public ConfigurationContext getConfigurationContext() {
- return this.configCtx;
- }
-
-
- public SessionContext getSessionContext(MessageContext messageContext) {
- return null;
- }
-
- public void destroy() {
- this.configCtx = null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSMessageReceiver.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSMessageReceiver.java
deleted file mode 100644
index e9e9f04ab2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSMessageReceiver.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.jms;
-
-import java.io.InputStream;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.addressing.RelatesTo;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.axis2.util.MessageContextBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-
-/**
- * This is the actual receiver which listens for and accepts JMS messages, and
- * hands them over to be processed by a worker thread. An instance of this
- * class is created for each JMSConnectionFactory, but all instances may and
- * will share the same worker thread pool.
- */
-public class JMSMessageReceiver implements MessageListener {
-
- private static final Log log = LogFactory.getLog(JMSMessageReceiver.class);
-
- /**
- * The thread pool of workers
- */
- private Executor workerPool = null;
- /**
- * The Axis configuration context
- */
- private ConfigurationContext axisConf = null;
- /**
- * A reference to the JMS Connection Factory
- */
- private JMSConnectionFactory jmsConFac = null;
-
- /**
- * Create a new JMSMessage receiver
- *
- * @param jmsConFac the JMS connection factory associated with
- * @param workerPool the worker thead pool to be used
- * @param axisConf the Axis2 configuration
- */
- JMSMessageReceiver(JMSConnectionFactory jmsConFac,
- Executor workerPool, ConfigurationContext axisConf) {
- this.jmsConFac = jmsConFac;
- this.workerPool = workerPool;
- this.axisConf = axisConf;
- }
-
- /**
- * Return the Axis configuration
- *
- * @return the Axis configuration
- */
- public ConfigurationContext getAxisConf() {
- return axisConf;
- }
-
- /**
- * Set the worker thread pool
- *
- * @param workerPool the worker thead pool
- */
- public void setWorkerPool(Executor workerPool) {
- this.workerPool = workerPool;
- }
-
- /**
- * The entry point on the recepit of each JMS message
- *
- * @param message the JMS message received
- */
- public void onMessage(Message message) {
- // directly create a new worker and delegate processing
- try {
- if (log.isDebugEnabled()) {
- StringBuffer sb = new StringBuffer();
- sb.append("Received JMS message to destination : " + message.getJMSDestination());
- sb.append("\nMessage ID : " + message.getJMSMessageID());
- sb.append("\nCorrelation ID : " + message.getJMSCorrelationID());
- sb.append("\nReplyTo ID : " + message.getJMSReplyTo());
- log.debug(sb.toString());
- }
- } catch (JMSException e) {
- e.printStackTrace();
- }
- workerPool.execute(new Worker(message));
- }
-
- /**
- * Creates an Axis MessageContext for the received JMS message and
- * sets up the transports and various properties
- *
- * @param message the JMS message
- * @return the Axis MessageContext
- */
- private MessageContext createMessageContext(Message message) {
-
- InputStream in = JMSUtils.getInputStream(message);
-
- try {
- MessageContext msgContext = axisConf.createMessageContext();
-
- // get destination and create correct EPR
- Destination dest = message.getJMSDestination();
- String destinationName = null;
- if (dest instanceof Queue) {
- destinationName = ((Queue) dest).getQueueName();
- } else if (dest instanceof Topic) {
- destinationName = ((Topic) dest).getTopicName();
- }
-
- String serviceName = jmsConFac.getServiceByDestination(destinationName);
-
- // hack to get around the crazy Active MQ dynamic queue and topic issues
- if (serviceName == null) {
- String provider = (String) jmsConFac.getProperties().get(
- Context.INITIAL_CONTEXT_FACTORY);
- if (provider.indexOf("activemq") != -1) {
- serviceName = jmsConFac.getServiceNameForDestination(
- ((dest instanceof Queue ?
- JMSConstants.ACTIVEMQ_DYNAMIC_QUEUE :
- JMSConstants.ACTIVEMQ_DYNAMIC_TOPIC) + destinationName));
- }
- }
-
-
- if (serviceName != null) {
- // set to bypass dispatching and handover directly to this service
- msgContext.setAxisService(
- axisConf.getAxisConfiguration().getService(serviceName));
- }
-
- msgContext.setIncomingTransportName(Constants.TRANSPORT_JMS);
- msgContext.setTransportIn(
- axisConf.getAxisConfiguration().getTransportIn(Constants.TRANSPORT_JMS));
-
- msgContext.setTransportOut(
- axisConf.getAxisConfiguration().getTransportOut(Constants.TRANSPORT_JMS));
- // the reply is assumed to be on the JMSReplyTo destination, using
- // the same incoming connection factory
-
-
- JMSOutTransportInfo jmsOutTransportInfo;
-
- if ((jmsConFac.getJndiUser() == null) || (jmsConFac.getJndiPass() == null))
- jmsOutTransportInfo= new JMSOutTransportInfo(jmsConFac.getConFactory(), message.getJMSReplyTo());
- else
- jmsOutTransportInfo= new JMSOutTransportInfo(jmsConFac.getConFactory(), jmsConFac.getUser(), jmsConFac.getPass(), message.getJMSReplyTo());
-
- msgContext.setProperty(Constants.OUT_TRANSPORT_INFO, jmsOutTransportInfo);
-
- msgContext.setServerSide(true);
- msgContext.setMessageID(message.getJMSMessageID());
-
- Destination replyTo = message.getJMSReplyTo();
- String jndiDestinationName = null;
- if (replyTo == null) {
- Parameter param = msgContext.getAxisService().getParameter(JMSConstants.REPLY_PARAM);
- if (param != null && param.getValue() != null) {
- jndiDestinationName = (String) param.getValue();
- }
- }
-
- if (jndiDestinationName != null) {
- msgContext.setReplyTo(jmsConFac.getEPRForDestination(jndiDestinationName));
- }
-
- String soapAction = JMSUtils.getProperty(message, JMSConstants.SOAPACTION);
- if (soapAction != null) {
- msgContext.setSoapAction(soapAction);
- }
-
- msgContext.setEnvelope(
- JMSUtils.getSOAPEnvelope(message, msgContext, in));
-
- // set correlation id
- String correlationId = message.getJMSCorrelationID();
- if (correlationId != null && correlationId.length() > 0) {
- msgContext.setProperty(JMSConstants.JMS_COORELATION_ID, correlationId);
- msgContext.setRelationships(
- new RelatesTo[] { new RelatesTo(correlationId) });
- }
-
- return msgContext;
-
- } catch (JMSException e) {
- handleException("JMS Exception reading the destination name", e);
- } catch (AxisFault e) {
- handleException("Axis fault creating the MessageContext", e);
- } catch (XMLStreamException e) {
- handleException("Error reading the SOAP envelope", e);
- }
- return null;
- }
-
- private void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new AxisJMSException(msg, e);
- }
-
- /**
- * The actual Runnable Worker implementation which will process the
- * received JMS messages in the worker thread pool
- */
- class Worker implements Runnable {
-
- private Message message = null;
-
- Worker(Message message) {
- this.message = message;
- }
-
- public void run() {
- MessageContext msgCtx = createMessageContext(message);
-
- AxisEngine engine = new AxisEngine(msgCtx.getConfigurationContext());
- try {
- log.debug("Delegating JMS message for processing to the Axis engine");
- try {
- engine.receive(msgCtx);
- } catch (AxisFault e) {
- log.debug("Exception occured when receiving the SOAP message", e);
- if (msgCtx.isServerSide()) {
- MessageContext faultContext = MessageContextBuilder.createFaultMessageContext(msgCtx, e);
- engine.sendFault(faultContext);
- }
- }
- } catch (AxisFault af) {
- log.error("JMS Worker [" + Thread.currentThread().getName() +
- "] Encountered an Axis Fault : " + af.getMessage(), af);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSOutTransportInfo.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSOutTransportInfo.java
deleted file mode 100644
index 5fa6542eec..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSOutTransportInfo.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.jms;
-
-import java.util.Hashtable;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-
-import org.apache.axis2.transport.OutTransportInfo;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The JMS OutTransportInfo
- */
-public class JMSOutTransportInfo implements OutTransportInfo {
-
- private static final Log log = LogFactory.getLog(JMSOutTransportInfo.class);
-
- private ConnectionFactory connectionFactory = null;
- private String connectionFactoryUser = null;
- private String connectionFactoryPassword = null;
- private Destination destination = null;
-
- private String contentType = null;
-
- /**
- * Creates an instance using the given connection factory and destination
- *
- * @param connectionFactory the connection factory
- * @param dest the destination
- */
- JMSOutTransportInfo(ConnectionFactory connectionFactory, Destination dest) {
- this.connectionFactory = connectionFactory;
- this.destination = dest;
- }
-
- /**
- * Creates an instance using the given connection factory and destination
- *
- * @param connectionFactory the connection factory
- * @param dest the destination
- */
- JMSOutTransportInfo(ConnectionFactory connectionFactory, String connectionFactoryUser, String connectionFactoryPassword, Destination dest) {
- this.connectionFactory = connectionFactory;
- this.connectionFactoryUser = connectionFactoryUser;
- this.connectionFactoryPassword = connectionFactoryPassword;
- this.destination = dest;
- }
-
- /**
- * Creates and instance using the given URL
- *
- * @param url the URL
- */
- JMSOutTransportInfo(String url) {
- if (!url.startsWith(JMSConstants.JMS_PREFIX)) {
- handleException("Invalid JMS URL : " + url +
- " Must begin with the prefix " + JMSConstants.JMS_PREFIX);
- } else {
- Context context = null;
- Hashtable props = JMSUtils.getProperties(url);
- try {
- context = new InitialContext(props);
- } catch (NamingException e) {
- handleException("Could not get the initial context", e);
- }
-
- connectionFactory = getConnectionFactory(context, props);
- connectionFactoryUser = getConnectionFactoryUser(context, props);
- connectionFactoryPassword = getConnectionFactoryPass(context, props);
- destination = getDestination(context, url);
- }
- }
-
- /**
- * Get the referenced ConnectionFactory using the properties from the context
- *
- * @param context the context to use for lookup
- * @param props the properties which contains the JNDI name of the factory
- * @return the connection factory
- */
- private ConnectionFactory getConnectionFactory(Context context, Hashtable props) {
- try {
-
- String conFacJndiName = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_PARAM);
- if (conFacJndiName != null) {
- return (ConnectionFactory) context.lookup(conFacJndiName);
- } else {
- throw new NamingException(
- "JMS Connection Factory JNDI name cannot be determined from url");
- }
- } catch (NamingException e) {
- handleException("Cannot get JMS Connection factory with props : " + props, e);
- }
- return null;
- }
-
- /**
- * Get the referenced ConnectionFactory Username (if supplied) using the properties from the context
- *
- * @param context the context to use for lookup
- * @param props the properties which contains the JNDI name of the factory username
- * @return the connection factory username (or null if one is not in the JNDI tree)
- */
- private String getConnectionFactoryUser(Context context, Hashtable props) {
- try {
-
- String conFacJndiUser = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_USER);
- if (conFacJndiUser != null) {
- return (String) context.lookup(conFacJndiUser);
- } else {
- return null;
- }
- } catch (NamingException e) {
- handleException("Cannot get JMS Connection factory username with props : " + props, e);
- }
- return null;
- }
-
- /**
- * Get the referenced ConnectionFactory Password (if supplied) using the properties from the context
- *
- * @param context the context to use for lookup
- * @param props the properties which contains the JNDI name of the factory password
- * @return the connection factory password (or null if one is not in the JNDI tree)
- */
- private String getConnectionFactoryPass(Context context, Hashtable props) {
- try {
-
- String conFacJndiPass = (String) props.get(JMSConstants.CONFAC_JNDI_NAME_PASS);
- if (conFacJndiPass != null) {
- return (String) context.lookup(conFacJndiPass);
- } else {
- return null;
- }
- } catch (NamingException e) {
- handleException("Cannot get JMS Connection factory password with props : " + props, e);
- }
- return null;
- }
-
- /**
- * Get the JMS destination specified by the given URL from the context
- *
- * @param context the Context to lookup
- * @param url URL
- * @return the JMS destination, or null if it does not exist
- */
- private Destination getDestination(Context context, String url) {
- String destinationName = JMSUtils.getDestination(url);
- try {
- return (Destination) context.lookup(destinationName);
-
- } catch (NameNotFoundException e) {
- log.warn("Cannot get or lookup JMS destination : " + destinationName +
- " from url : " + url + " : " + e.getMessage());
-
- } catch (NamingException e) {
- handleException("Cannot get JMS destination : " + destinationName +
- " from url : " + url, e);
- }
- return null;
- }
-
-
- private void handleException(String s) {
- log.error(s);
- throw new AxisJMSException(s);
- }
-
- private void handleException(String s, Exception e) {
- log.error(s, e);
- throw new AxisJMSException(s, e);
- }
-
- public Destination getDestination() {
- return destination;
- }
-
- public ConnectionFactory getConnectionFactory() {
- return connectionFactory;
- }
-
- public String getConnectionFactoryPassword() {
- return connectionFactoryPassword;
- }
-
- public String getConnectionFactoryUser() {
- return connectionFactoryUser;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSSender.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSSender.java
deleted file mode 100644
index 7caa045015..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/JMSSender.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.jms;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Hashtable;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.TransportOutDescription;
-import org.apache.axis2.description.WSDL2Constants;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.axis2.java.security.AccessController;
-import org.apache.axis2.transport.TransportSender;
-import org.apache.axis2.transport.http.HTTPTransportUtils;
-import org.apache.axis2.transport.http.SOAPMessageFormatter;
-import org.apache.axis2.transport.jms.JMSConstants;
-import org.apache.axis2.transport.jms.JMSUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * The TransportSender for JMS
- */
-public class JMSSender extends AbstractHandler implements TransportSender {
-
- private static final Log log = LogFactory.getLog(JMSSender.class);
-
- /**
- * Performs the actual sending of the JMS message
- *
- * @param msgContext the message context to be sent
- * @throws AxisFault on exception
- */
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- log.debug("JMSSender invoke()");
-
- /* Added due to possible bug in Axis2, MTOM enablement is based on msgContext.isDoingMTOM
- * However msgContext.isDoingMTOM will always return false unless set programmatically.
- * HTTP sets this boolean programmatically by looking up whether enableMTOM has been set
- * in axis2.xml or as an option on the client.
- */
- msgContext.setDoingMTOM(HTTPTransportUtils.doWriteMTOM(msgContext));
-
- JMSOutTransportInfo transportInfo = null;
- String targetAddress = null;
-
- // is there a transport url? which may be different from the WS-A To..
- targetAddress = (String) msgContext.getProperty(
- Constants.Configuration.TRANSPORT_URL);
-
- if (targetAddress != null) {
- transportInfo = new JMSOutTransportInfo(targetAddress);
- } else if (targetAddress == null && msgContext.getTo() != null &&
- !msgContext.getTo().hasAnonymousAddress()) {
- targetAddress = msgContext.getTo().getAddress();
-
- if (!msgContext.getTo().hasNoneAddress()) {
- transportInfo = new JMSOutTransportInfo(targetAddress);
- } else {
- //Don't send the message.
- return InvocationResponse.CONTINUE;
- }
- } else if (msgContext.isServerSide()) {
- // get the jms ReplyTo
- transportInfo = (JMSOutTransportInfo)
- msgContext.getProperty(Constants.OUT_TRANSPORT_INFO);
- }
-
- // get the ConnectionFactory to be used for the send
- ConnectionFactory connectionFac = transportInfo.getConnectionFactory();
-
- Connection con = null;
- try {
- String user = transportInfo.getConnectionFactoryUser();
- String password = transportInfo.getConnectionFactoryPassword();
-
- if ((user == null) || (password == null)){
- // Use the OS username and credentials
- con = connectionFac.createConnection();
- } else{
- // use an explicit username and password
- con = connectionFac.createConnection(user, password);
- }
-
- Session session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
- Message message = createJMSMessage(msgContext, session);
-
- // get the JMS destination for the message being sent
- Destination dest = transportInfo.getDestination();
-
- if (dest == null) {
- if (targetAddress != null) {
-
- // if it does not exist, create it
- String name = JMSUtils.getDestination(targetAddress);
- if (log.isDebugEnabled()) {
- log.debug("Creating JMS Destination : " + name);
- }
-
- try {
- dest = session.createQueue(name);
- } catch (JMSException e) {
- handleException("Error creating destination Queue : " + name, e);
- }
- } else {
- handleException("Cannot send reply to unknown JMS Destination");
- }
- }
-
- MessageProducer producer = session.createProducer(dest);
- Destination replyDest = null;
-
- boolean waitForResponse =
- msgContext.getOperationContext() != null &&
- WSDL2Constants.MEP_URI_OUT_IN.equals(
- msgContext.getOperationContext().getAxisOperation().getMessageExchangePattern());
-
- if (waitForResponse) {
- String replyToJNDIName = (String) msgContext.getProperty(JMSConstants.REPLY_PARAM);
- if (replyToJNDIName != null && replyToJNDIName.length() > 0) {
- Context context = null;
- final Hashtable props = JMSUtils.getProperties(targetAddress);
- try {
- try {
- context = (Context) AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws NamingException{
- return new InitialContext(props);
- }
- }
- )
- ;
- } catch (PrivilegedActionException e) {
- throw (NamingException) e.getException();
- }
- } catch (NamingException e) {
- handleException("Could not get the initial context", e);
- }
-
- try {
- replyDest = (Destination) context.lookup(replyToJNDIName);
-
- } catch (NameNotFoundException e) {
- log.warn("Cannot get or lookup JMS response destination : " +
- replyToJNDIName + " : " + e.getMessage() +
- ". Attempting to create a Queue named : " + replyToJNDIName);
- replyDest = session.createQueue(replyToJNDIName);
-
- } catch (NamingException e) {
- handleException("Cannot get JMS response destination : " +
- replyToJNDIName + " : ", e);
- }
-
- } else {
- try {
- // create temporary queue to receive reply
- replyDest = session.createTemporaryQueue();
- } catch (JMSException e) {
- handleException("Error creating temporary queue for response");
- }
- }
- message.setJMSReplyTo(replyDest);
- if (log.isDebugEnabled()) {
- log.debug("Expecting a response to JMS Destination : " +
- (replyDest instanceof Queue ?
- ((Queue) replyDest).getQueueName() : ((Topic) replyDest).getTopicName()));
- }
- }
-
- try {
- log.debug("[" + (msgContext.isServerSide() ? "Server" : "Client") +
- "]Sending message to destination : " + dest);
- producer.send(message);
- producer.close();
-
- } catch (JMSException e) {
- handleException("Error sending JMS message to destination : " +
- dest.toString(), e);
- }
-
- if (waitForResponse) {
- try {
- // wait for reply
- MessageConsumer consumer = session.createConsumer(replyDest);
-
- long timeout = JMSConstants.DEFAULT_JMS_TIMEOUT;
- Long waitReply = (Long) msgContext.getProperty(JMSConstants.JMS_WAIT_REPLY);
- if (waitReply != null) {
- timeout = waitReply.longValue();
- }
-
- log.debug("Waiting for a maximum of " + timeout +
- "ms for a response message to destination : " + replyDest);
- con.start();
- Message reply = consumer.receive(timeout);
-
- if (reply != null) {
- msgContext.setProperty(MessageContext.TRANSPORT_IN,
- JMSUtils.getInputStream(reply));
- } else {
- log.warn("Did not receive a JMS response within " +
- timeout + " ms to destination : " + dest);
- }
-
- } catch (JMSException e) {
- handleException("Error reading response from temporary " +
- "queue : " + replyDest, e);
- }
- }
- } catch (JMSException e) {
- handleException("Error preparing to send message to destination", e);
-
- } finally {
- if (con != null) {
- try {
- con.close(); // closes all sessions, producers, temp Q's etc
- } catch (JMSException e) {
- } // ignore
- }
- }
- return InvocationResponse.CONTINUE;
- }
-
- public void cleanup(MessageContext msgContext) throws AxisFault {
- // do nothing
- }
-
- public void init(ConfigurationContext confContext,
- TransportOutDescription transportOut) throws AxisFault {
- // do nothing
- }
-
- public void stop() {
- // do nothing
- }
-
- /**
- * Create a JMS Message from the given MessageContext and using the given
- * session
- *
- * @param msgContext the MessageContext
- * @param session the JMS session
- * @return a JMS message from the context and session
- * @throws JMSException on exception
- */
- private Message createJMSMessage(MessageContext msgContext, Session session)
- throws JMSException {
-
- Message message = null;
- String msgType = getProperty(msgContext, JMSConstants.JMS_MESSAGE_TYPE);
-
- OMElement msgElement = msgContext.getEnvelope();
- if (msgContext.isDoingREST()) {
- msgElement = msgContext.getEnvelope().getBody().getFirstElement();
- }
-
- if (msgType != null && JMSConstants.JMS_BYTE_MESSAGE.equals(msgType)) {
-
- message = session.createBytesMessage();
- BytesMessage bytesMsg = (BytesMessage) message;
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- OMOutputFormat format = new OMOutputFormat();
-
- /* Added due to possible bug in Axis2, OMOutputFormat's boolean isSOAP11 defaults to true.
- * This means that if left untouched all JMS byte messages must be SOAP 1.1
- * We set the boolean here based on the messageContexts value, which is assertained from
- * the soap namespace used. This is what HTTP does also.
- */
- format.setSOAP11(msgContext.isSOAP11());
- format.setCharSetEncoding(
- getProperty(msgContext, Constants.Configuration.CHARACTER_SET_ENCODING));
- format.setDoOptimize(msgContext.isDoingMTOM());
- try {
- msgElement.serializeAndConsume(baos, format);
- baos.flush();
- } catch (XMLStreamException e) {
- handleException("XML serialization error creating BytesMessage", e);
- } catch (IOException e) {
- handleException("IO Error while creating BytesMessage", e);
- }
- bytesMsg.writeBytes(baos.toByteArray());
-
- /* Added due to possible bug in Axis2, the content type is never set for a JMS byte message. This
- * goes unnoticed when MTOM is not used, as the server can handle the message. However once MTOM
- * is used a contentType of multipart/related is required.
- */
- bytesMsg.setStringProperty(JMSConstants.CONTENT_TYPE,
- new SOAPMessageFormatter().getContentType(msgContext, format, null));
- } else {
- message = session.createTextMessage(); // default
- TextMessage txtMsg = (TextMessage) message;
- txtMsg.setText(msgElement.toString());
- }
-
- // set the JMS correlation ID if specified
- String correlationId = getProperty(msgContext, JMSConstants.JMS_COORELATION_ID);
- if (correlationId == null && msgContext.getRelatesTo() != null) {
- correlationId = msgContext.getRelatesTo().getValue();
- }
-
- if (correlationId != null) {
- message.setJMSCorrelationID(correlationId);
- }
-
- if (msgContext.isServerSide()) {
- // set SOAP Action and context type as properties on the JMS message
- setProperty(message, msgContext, JMSConstants.SOAPACTION);
- setProperty(message, msgContext, JMSConstants.CONTENT_TYPE);
- } else {
- String action = msgContext.getOptions().getAction();
- if (action != null) {
- message.setStringProperty(JMSConstants.SOAPACTION, action);
- }
- }
-
- return message;
- }
-
- private void setProperty(Message message, MessageContext msgCtx, String key) {
-
- String value = getProperty(msgCtx, key);
- if (value != null) {
- try {
- message.setStringProperty(key, value);
- } catch (JMSException e) {
- log.warn("Couldn't set message property : " + key + " = " + value, e);
- }
- }
- }
-
- private String getProperty(MessageContext mc, String key) {
- return (String) mc.getProperty(key);
- }
-
- private static void handleException(String s) {
- log.error(s);
- throw new AxisJMSException(s);
- }
-
- private static void handleException(String s, Exception e) {
- log.error(s, e);
- throw new AxisJMSException(s, e);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/README b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/README
deleted file mode 100644
index 5df1751298..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/README
+++ /dev/null
@@ -1,14 +0,0 @@
-The classes in this package are a copy of the same classes from the
-Axis2 package org.apache.axis2.transport.jms in the Axis2 1.4.1 release.
-
-The only change is in the listenOnDestination method in JMSConnectionFactory
-to use Tuscany threads instead of the setMessageListener call approach when
-running in a JEE container where setMessageListener is prohibited. There are
-several classes copied in this Tuscany package as many of the constructors
-and methods are not public so we can't just subclass to fix the problem.
-
-In Axis2 1.5 and the new separately released JMS transport will fix this
-problem so when we move up to that in Tuscany we can get rid of this package.
-
-
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.java
deleted file mode 100644
index 4c18c89353..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingBasicAuthenticationConfigurator.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.binding.ws.axis2.policy.configurator;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.security.auth.Subject;
-
-import org.apache.axiom.om.util.Base64;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.transport.http.HttpTransportProperties;
-import org.apache.axis2.transport.http.HttpTransportProperties.Authenticator;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class Axis2BindingBasicAuthenticationConfigurator {
-
-
- public static void setOperationOptions(OperationClient operationClient, Message msg, BasicAuthenticationPolicy policy) {
- String username = null;
- String password = null;
-
- // get the security context
- Subject subject = SecurityUtil.getSubject(msg);
- BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
- BasicAuthenticationPrincipal.class);
-
- // could use the security principal to look up basic auth credentials
- if ( principal != null ) {
- username = ((BasicAuthenticationPrincipal)principal).getName();
- password = ((BasicAuthenticationPrincipal)principal).getPassword();
- }
-
- if (username == null || password == null ){
- throw new ServiceRuntimeException("Basic authentication username or password is null");
- }
-
- HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
- List<String> auth = new ArrayList<String>();
- auth.add(Authenticator.BASIC);
- authenticator.setAuthSchemes(auth);
- authenticator.setPreemptiveAuthentication(true);
- authenticator.setUsername(username);
- authenticator.setPassword(password);
-
- operationClient.getOptions().setProperty(HTTPConstants.AUTHENTICATE,
- authenticator);
- }
-
- public static void parseHTTPHeader(MessageContext messageContext, Message msg, BasicAuthenticationPolicy policy) {
-
- Map httpHeaderProperties = (Map)messageContext.getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
-
- String basicAuthString = (String)httpHeaderProperties.get("Authorization");
- String decodedBasicAuthString = null;
- String username = null;
- String password = null;
-
- if (basicAuthString != null) {
- basicAuthString = basicAuthString.trim();
-
- if (basicAuthString.startsWith("Basic ")) {
- decodedBasicAuthString = new String(Base64.decode(basicAuthString.substring(6)));
- }
-
- int collonIndex = decodedBasicAuthString.indexOf(':');
-
- if (collonIndex == -1){
- username = decodedBasicAuthString;
- } else {
- username = decodedBasicAuthString.substring(0, collonIndex);
- password = decodedBasicAuthString.substring(collonIndex + 1);
- }
- }
-
- // get the security context
- Subject subject = SecurityUtil.getSubject(msg);
- BasicAuthenticationPrincipal principal = new BasicAuthenticationPrincipal(username,
- password);
- subject.getPrincipals().add(principal);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingHeaderConfigurator.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingHeaderConfigurator.java
deleted file mode 100644
index 647f934c02..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/policy/configurator/Axis2BindingHeaderConfigurator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.policy.configurator;
-
-
-
-import javax.xml.namespace.QName;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axis2.context.MessageContext;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2HeaderPolicyUtil;
-import org.apache.tuscany.sca.binding.ws.axis2.policy.header.Axis2SOAPHeader;
-import org.apache.tuscany.sca.invocation.Message;
-
-
-/**
- * Policy handler to handle PolicySet that contain Axis2ConfigParamPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class Axis2BindingHeaderConfigurator {
-
-
- public static void setHeader(MessageContext messageContext, Message msg, QName headerQName) {
-
- if (headerQName != null){
- SOAPEnvelope envelope = messageContext.getEnvelope();
- OMFactory factory = envelope.getOMFactory();
- SOAPHeader soapHeader = envelope.getHeader();
-
- Axis2SOAPHeader header = Axis2HeaderPolicyUtil.getHeader(msg, headerQName) ;
-
- if (header != null){
- soapHeader.addChild(header.getAsSOAPHeaderBlock(factory));
- }
- }
- }
-
- public static void getHeader(MessageContext messageContext, Message msg, QName headerQName, Axis2SOAPHeader header) {
-
- SOAPEnvelope sev = messageContext.getEnvelope();
- SOAPHeader sh = sev.getHeader();
- OMElement omHeader = sh.getFirstChildWithName(headerQName);
-
- header.setAsSOAPHeaderBlock(omHeader);
-
- msg.getHeaders().add(header);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
deleted file mode 100644
index a48ff54c77..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.binding.ws.axis2.Axis2BindingProviderFactory;model=org.apache.tuscany.sca.binding.ws.WebServiceBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index 370b83f87b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.binding.ws.axis2.WSBindingDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
deleted file mode 100644
index 6bff613a7c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/definitions.xml
+++ /dev/null
@@ -1,54 +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.
--->
-
-<!-- $Rev$ $Date$ -->
-
-<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <sca:bindingType type="sca:binding.ws" mayProvide="SOAP SOAP.1_1 SOAP.1_2 MTOM" alwaysProvides=""/>
-
- <!-- PolicyIntents defined by the SCA Runtime Extension for WS Binding Axis 2 -->
- <sca:intent name="SOAP" constrains="sca:binding.ws">
- <sca:description>
- Communication through this binding requires SOAP
- </sca:description>
- </sca:intent>
-
- <sca:intent name="SOAP.1_1">
- <sca:description>
- Communication through this binding requires SOAP 1.1
- </sca:description>
- </sca:intent>
-
- <sca:intent name="SOAP.1_2">
- <sca:description>
- Communication through this binding requires SOAP 1.2
- </sca:description>
- </sca:intent>
-
- <sca:intent name="MTOM" constrains="sca:binding.ws">
- <sca:description>
- Communication through this binding requires MTOM support
- </sca:description>
- </sca:intent>
- </sca:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
deleted file mode 100644
index f75a2e8cdb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/axis2.xml
+++ /dev/null
@@ -1,504 +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.
- -->
-
-<axisconfig name="AxisJava2.0">
- <!-- ================================================= -->
- <!-- Parameters -->
- <!-- ================================================= -->
- <parameter name="hotdeployment">true</parameter>
- <parameter name="hotupdate">false</parameter>
- <parameter name="enableMTOM">false</parameter>
- <parameter name="enableSwA">false</parameter>
-
- <!-- Customized by Tuscany -->
- <!-- parameter name="OutflowSecurity">
- <action>
- <items>Timestamp</items>
- </action>
- </parameter-->
-
- <!--Uncomment if you want to enable file caching for attachments -->
- <!--parameter name="cacheAttachments">true</parameter>
- <parameter name="attachmentDIR"></parameter>
- <parameter name="sizeThreshold">4000</parameter-->
-
- <!--This will give out the timout of the configuration contexts, in milliseconds-->
- <parameter name="ConfigContextTimeoutInterval">30000</parameter>
-
- <!--During a fault, stacktrace can be sent with the fault message. The following flag will control -->
- <!--that behavior.-->
-
- <!-- Customized by Tuscany -->
- <parameter name="sendStacktraceDetailsWithFaults">true</parameter>
-
- <!--If there aren't any information available to find out the fault reason, we set the message of the exception-->
- <!--as the faultreason/Reason. But when a fault is thrown from a service or some where, it will be -->
- <!--wrapped by different levels. Due to this the initial exception message can be lost. If this flag-->
- <!--is set, then Axis2 tries to get the first exception and set its message as the faultreason/Reason.-->
- <parameter name="DrillDownToRootCauseForFaultReason">false</parameter>
-
- <parameter name="userName">admin</parameter>
- <parameter name="password">axis2</parameter>
-
- <!--To override repository/services you need to uncomment following parameter and value SHOULD be absolute file path.-->
- <!--ServicesDirectory only works on the following cases-->
- <!---File based configurator and in that case the value should be a file URL (http:// not allowed)-->
- <!---When creating URL Based configurator with URL “file://†-->
- <!--- War based configurator with expanded case , -->
-
- <!--All the other scenarios it will be ignored.-->
- <!--<parameter name="ServicesDirectory">service</parameter>-->
- <!--To override repository/modules you need to uncomment following parameter and value SHOULD be absolute file path-->
- <!--<parameter name="ModulesDirectory">modules</parameter>-->
-
-
-
- <!--Following params will set the proper context paths for invocations. All the endpoints will have a commons context-->
- <!--root which can configured using the following contextRoot parameter-->
- <!--<parameter name="contextRoot">axis2</parameter>-->
-
- <!--Our HTTP endpoints can handle both REST and SOAP. Following parameters can be used to distinguiush those endpoints-->
- <!--In case of a servlet, if you change this you have to manually change the settings of your servlet container to map this -->
- <!--context path to proper Axis2 servlets-->
-
- <!-- Customized by Tuscany -->
- <parameter name="servicePath">/</parameter>
-
- <!--<parameter name="restPath">rest</parameter>-->
-
- <!-- Following parameter will completely disable REST handling in Axis2-->
-
- <parameter name="disableREST" locked="true">false</parameter>
-
- <!--POJO deployer , this will alow users to drop .class file and make that into a service-->
- <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
-
- <!-- Following parameter will set the host name for the epr-->
- <!--<parameter name="hostname" locked="true">myhost.com</parameter>-->
-
- <!-- If you have a frontend host which exposes this webservice using a different public URL -->
- <!-- use this parameter to override autodetected url -->
- <!--<parameter name="httpFrontendHostUrl">https://someotherhost/context</parameter>-->
-
-
- <!-- The way of adding listener to the system-->
- <!-- <listener class="org.apache.axis2.ObserverIMPL">-->
- <!-- <parameter name="RSS_URL">http://127.0.0.1/rss</parameter>-->
- <!-- </listener>-->
-
- <!-- ================================================= -->
- <!-- Message Receivers -->
- <!-- ================================================= -->
- <!--This is the deafult MessageReceiver for the system , if you want to have MessageReceivers for -->
- <!--all the other MEP implement it and add the correct entry to here , so that you can refer from-->
- <!--any operation -->
- <!--Note : You can ovrride this for a particular service by adding the same element with your requirement-->
- <messageReceivers>
-
- <!-- Added by Tuscany -->
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
- class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
-
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
- class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
- class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-
- <!-- Added by Tuscany -->
- <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
- class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
-
- <!-- Added by Tuscany -->
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
- class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInMessageReceiver"/>
-
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-only"
- class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
- class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
-
- <!-- Added by Tuscany -->
- <messageReceiver mep="http://www.w3.org/2006/01/wsdl/in-out"
- class="org.apache.tuscany.sca.binding.ws.axis2.Axis2ServiceInOutSyncMessageReceiver"/>
-
- </messageReceivers>
- <!-- ================================================= -->
- <!-- Message Formatter -->
- <!-- ================================================= -->
- <!--Following content type to message formatter mapping can be used to implement support for different message -->
- <!--format serialization in Axis2. These message formats are expected to be resolved based on the content type. -->
- <messageFormatters>
- <messageFormatter contentType="application/x-www-form-urlencoded"
- class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
- <messageFormatter contentType="multipart/form-data"
- class="org.apache.axis2.transport.http.MultipartFormDataFormatter"/>
- <messageFormatter contentType="application/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- </messageFormatters>
-
- <!-- ================================================= -->
- <!-- Message Builders -->
- <!-- ================================================= -->
- <!--Following content type to builder mapping can be used to implement support for different message -->
- <!--formats in Axis2. These message formats are expected to be resolved based on the content type. -->
- <messageBuilders>
- <messageBuilder contentType="application/xml"
- class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
- <messageBuilder contentType="application/x-www-form-urlencoded"
- class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
- <messageBuilder contentType="multipart/form-data"
- class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
- </messageBuilders>
-
- <!-- ================================================= -->
- <!-- Transport Ins -->
- <!-- ================================================= -->
- <transportReceiver name="http"
- class="org.apache.axis2.transport.http.SimpleHTTPServer">
-
- <!-- Customized by Tuscany -->
- <parameter name="port" locked="false">6060</parameter>
-
- <!-- Here is the complete list of supported parameters (see example settings further below):
- port: the port to listen on (default 6060)
- hostname: if non-null, url prefix used in reply-to endpoint references (default null)
- originServer: value of http Server header in outgoing messages (default "Simple-Server/1.1")
- requestTimeout: value in millis of time that requests can wait for data (default 20000)
- requestTcpNoDelay: true to maximize performance and minimize latency (default true)
- false to minimize bandwidth consumption by combining segments
- requestCoreThreadPoolSize: number of threads available for request processing (unless queue fills up) (default 25)
- requestMaxThreadPoolSize: number of threads available for request processing if queue fills up (default 150)
- note that default queue never fills up: see HttpFactory
- threadKeepAliveTime: time to keep threads in excess of core size alive while inactive (default 180)
- note that no such threads can exist with default unbounded request queue
- threadKeepAliveTimeUnit: TimeUnit of value in threadKeepAliveTime (default SECONDS) (default SECONDS)
- -->
- <!-- <parameter name="hostname">http://www.myApp.com/ws</parameter> -->
- <!-- <parameter name="originServer">My-Server/1.1</parameter> -->
- <!-- <parameter name="requestTimeout">10000</parameter> -->
- <!-- <parameter name="requestTcpNoDelay">false</parameter> -->
- <!-- <parameter name="requestCoreThreadPoolSize">50</parameter> -->
- <!-- <parameter name="RequestMaxThreadPoolSize">100</parameter> -->
- <!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
- <!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
- </transportReceiver>
-
- <!-- Added by Tuscany -->
- <!-- transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"-->
- <!-- These configuation parameters now come from the binding.ws uri
- or from a policy set
- <parameter name="myTopicConnectionFactory">
- <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
- <parameter name="transport.jms.ConnectionFactoryJNDIName">TopicConnectionFactory</parameter>
- </parameter>
-
- <parameter name="myQueueConnectionFactory">
- <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
- <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
- </parameter>
-
- <parameter name="default">
- <parameter name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
- <parameter name="java.naming.provider.url">tcp://localhost:61616</parameter>
- <parameter name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
- </parameter>
- -->
- <!-- /transportReceiver-->
-
- <!-- ================================================= -->
- <!-- Non-blocking http/s Transport Listener -->
-
- <!-- the non blocking http transport based on HttpCore + NIO extensions
- <transportReceiver name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOListener">
- <parameter name="port" locked="false">9000</parameter>
- <parameter name="non-blocking" locked="false">true</parameter>
- </transportReceiver>-->
-
- <!-- the non blocking https transport based on HttpCore + SSL-NIO extensions
- <transportReceiver name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLListener">
- <parameter name="port" locked="false">9002</parameter>
- <parameter name="non-blocking" locked="false">true</parameter>
- <parameter name="keystore" locked="false">
- <KeyStore>
- <Location>identity.jks</Location>
- <Type>JKS</Type>
- <Password>password</Password>
- <KeyPassword>password</KeyPassword>
- </KeyStore>
- </parameter>
- <parameter name="truststore" locked="false">
- <TrustStore>
- <Location>trust.jks</Location>
- <Type>JKS</Type>
- <Password>password</Password>
- </TrustStore>
- </parameter>-->
- <!--<parameter name="SSLVerifyClient">require</parameter>
- supports optional|require or defaults to none -->
- <!--</transportReceiver>-->
-
- <!-- ================================================= -->
- <!-- Mail Transport Listener -->
- <!-- This is a sample configuration. It assumes a mail server running in localhost.
- Listener pops messages that comes to the email address red@localhost. Users
- password is red. Listener connect to the server every 3000 milliseconds.
- Parameters with "transport." prefix is Axis2 specific. Others are all from Java Mail API.
- http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
- -->
- <!-- ================================================= -->
- <!--<transportReceiver name="mailto" class="org.apache.axis2.transport.mail.SimpleMailListener">
- <parameter name="mail.pop3.host">localhost</parameter>
- <parameter name="mail.pop3.user">red</parameter>
- <parameter name="mail.store.protocol">pop3</parameter>
- <parameter name="transport.mail.pop3.password">red</parameter>
- <parameter name="transport.mail.replyToAddress">red@localhost</parameter>
- <parameter name="transport.listener.interval">3000</parameter>
- </transportReceiver>-->
-
- <!--Uncomment if you want to have TCP transport support-->
- <!--transportReceiver name="tcp"
- class="org.apache.axis2.transport.tcp.TCPServer">
- <parameter name="port">6060</parameter-->>
- <!--If you want to give your own host address for EPR generation-->
- <!--uncomment the following paramter , and set it as you required.-->
- <!--<parameter name="hostname">tcp://myApp.com/ws</parameter>-->
- <!-- /transportReceiver -->
-
- <!-- ================================================= -->
- <!-- Transport Outs -->
- <!-- ================================================= -->
-
- <transportSender name="tcp"
- class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
- <transportSender name="local"
- class="org.apache.axis2.transport.local.LocalTransportSender"/>
- <transportSender name="http"
- class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
- <parameter name="PROTOCOL">HTTP/1.1</parameter>
- <parameter name="Transfer-Encoding">chunked</parameter>
-
- <!-- If following is set to 'true', optional action part of the Content-Type will not be added to the SOAP 1.2 messages -->
- <!-- <parameter name="OmitSOAP12Action">true</parameter> -->
- </transportSender>
-
- <transportSender name="https"
- class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
- <parameter name="PROTOCOL">HTTP/1.1</parameter>
- <parameter name="Transfer-Encoding">chunked</parameter>
- </transportSender>
- <transportSender name="jms"
- class="org.apache.axis2.transport.jms.JMSSender"/>
-
- <!-- ================================================= -->
- <!-- Non-blocking http/s Transport Sender -->
-
- <!-- the non-blocking http transport sender based on HttpCore + NIO extensions
- <transportSender name="http" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSender">
- <parameter name="non-blocking" locked="false">true</parameter>
- </transportSender>-->
-
- <!-- the non-blocking https transport sender based on HttpCore + NIO SSL extensions
- <transportSender name="https" class="org.apache.axis2.transport.nhttp.HttpCoreNIOSSLSender">
- <parameter name="non-blocking" locked="false">true</parameter>
- <parameter name="keystore" locked="false">
- <KeyStore>
- <Location>identity.jks</Location>
- <Type>JKS</Type>
- <Password>password</Password>
- <KeyPassword>password</KeyPassword>
- </KeyStore>
- </parameter>
- <parameter name="truststore" locked="false">
- <TrustStore>
- <Location>trust.jks</Location>
- <Type>JKS</Type>
- <Password>password</Password>
- </TrustStore>
- </parameter>-->
- <!--<parameter name="HostnameVerifier">DefaultAndLocalhost</parameter>
- supports Strict|AllowAll|DefaultAndLocalhost or the default if none specified -->
- <!--</transportSender>-->
-
- <!-- ================================================= -->
- <!-- Mail Transport Sender -->
- <!--Only need to uncomment the sender. Configuration is achieved with every client.
- At any instant mail host should be given. Sample configuration has been given.
- http://people.apache.org/~pzf/SMTPBase64Binding-0.2.html
- -->
- <!-- ================================================= -->
- <!--<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
- <parameter name="mail.smtp.host">localhost</parameter>
- </transportSender>-->
-
- <!-- ================================================= -->
- <!-- Global Modules -->
- <!-- ================================================= -->
- <!-- Comment this to disable Addressing -->
-
- <!-- Commented out by Tuscany
- <module ref="addressing"/>
- -->
-
- <!-- Added by Tuscany -->
- <!--
- <module ref="rampart"/>
- -->
-
- <!-- wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
- </wsp:Policy>
- </sp:SignedSupportingTokens>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:passwordType>PasswordText</ramp:passwordType>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.ClientPWCBHandler</ramp:passwordCallbackClass>
- </ramp:RampartConfig>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy-->
-
- <!--Configuring module , providing parameters for modules whether they refer or not-->
- <!--<moduleConfig name="addressing">-->
- <!--<parameter name="addressingPara">N/A</parameter>-->
- <!--</moduleConfig>-->
-
- <!-- ================================================= -->
- <!-- Clustering -->
- <!-- ================================================= -->
- <!-- Configure and uncomment following for preparing Axis2 to a clustered environment -->
- <!--
- <cluster class="org.apache.axis2.cluster.tribes.TribesClusterManager">
- <parameter name="param1">value1</parameter>
- <parameter name="domain">apache.axis2.domain</parameter>
- <configurationManager class="org.apache.axis2.cluster.configuration.TribesConfigurationManager">
- <listener class="org.apache.axis2.cluster.configuration.DefaultConfigurationManagerListener"/>
- </configurationManager>
- <contextManager class="org.apache.axis2.cluster.context.TribesContextManager">
- <listener class="org.apache.axis2.cluster.context.DefaultContextManagerListener"/>
- </contextManager>
- </cluster>
- -->
-
- <!-- ================================================= -->
- <!-- Phases -->
- <!-- ================================================= -->
- <phaseOrder type="InFlow">
- <!-- System pre defined phases -->
- <phase name="Transport">
-
- <!-- Added by Tuscany -->
- <handler name="TuscanyDispatcher"
- class="org.apache.tuscany.sca.binding.ws.axis2.TuscanyDispatcher">
- <order phase="Transport"/>
- </handler>
-
- <handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher">
- <order phase="Transport"/>
- </handler>
- <handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher">
- <order phase="Transport"/>
- </handler>
- </phase>
- <phase name="Addressing">
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Addressing"/>
- </handler>
- </phase>
- <phase name="Security"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
- <handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
- <handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
- <handler name="RequestURIOperationDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
- <handler name="SOAPMessageBodyBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
-<!--
- <handler name="HTTPLocationBasedDispatcher"
- class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
--->
- </phase>
- <phase name="RMPhase"/>
- <!-- System pre defined phases -->
- <!-- After Postdispatch phase module author or service author can add any phase he want -->
- <phase name="OperationInPhase"/>
- <phase name="soapmonitorPhase"/>
- </phaseOrder>
- <phaseOrder type="OutFlow">
- <!-- user can add his own phases to this area -->
- <phase name="soapmonitorPhase"/>
- <phase name="OperationOutPhase"/>
- <!--system predefined phase-->
- <!--these phase will run irrespective of the service-->
- <phase name="RMPhase"/>
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
- <phaseOrder type="InFaultFlow">
- <phase name="Addressing">
- <handler name="AddressingBasedDispatcher"
- class="org.apache.axis2.dispatchers.AddressingBasedDispatcher">
- <order phase="Addressing"/>
- </handler>
- </phase>
- <phase name="Security"/>
- <phase name="PreDispatch"/>
- <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase">
- <handler name="RequestURIBasedDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"/>
- <handler name="SOAPActionBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"/>
- <handler name="RequestURIOperationDispatcher"
- class="org.apache.axis2.dispatchers.RequestURIOperationDispatcher"/>
- <handler name="SOAPMessageBodyBasedDispatcher"
- class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"/>
-<!--
- <handler name="HTTPLocationBasedDispatcher"
- class="org.apache.axis2.dispatchers.HTTPLocationBasedDispatcher"/>
--->
- </phase>
- <phase name="RMPhase"/>
- <!-- user can add his own phases to this area -->
- <phase name="OperationInFaultPhase"/>
- <phase name="soapmonitorPhase"/>
- </phaseOrder>
- <phaseOrder type="OutFaultFlow">
- <!-- user can add his own phases to this area -->
- <phase name="soapmonitorPhase"/>
- <phase name="OperationOutFaultPhase"/>
- <phase name="RMPhase"/>
- <phase name="PolicyDetermination"/>
- <phase name="MessageOut"/>
- <phase name="Security"/>
- </phaseOrder>
-</axisconfig>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
deleted file mode 100644
index e6e70dfd4b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/modules.list
+++ /dev/null
@@ -1 +0,0 @@
-rampart-1.4.mar \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.4.mar b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.4.mar
deleted file mode 100644
index ec870734a5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/modules/rampart-1.4.mar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list
deleted file mode 100644
index e69de29bb2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/main/resources/org/apache/tuscany/sca/binding/ws/axis2/engine/config/services/services.list
+++ /dev/null
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.java
deleted file mode 100644
index 2ce23bf2c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ReferenceTestCase.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.binding.ws.axis2;
-
-import junit.framework.TestCase;
-
-public class Axis2ReferenceTestCase extends TestCase {
-
- public void testInvokeService() throws Exception {
-// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
-// ServiceContract contract = new JavaServiceContract();
-// Operation operation = new Operation<Type>("sayHi", null, null, null, false, null, NO_CONVERSATION);
-// TargetInvoker targetInvoker = axis2Reference.createTargetInvoker(contract, operation);
-// assertNotNull(targetInvoker);
-// assertFalse(targetInvoker instanceof Axis2AsyncTargetInvoker);
- }
-
- public void testAsyncTargetInvoker() throws Exception {
-// Axis2ReferenceBinding axis2Reference = createAxis2Reference("testWebAppName", "testServiceName");
-// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
-// Wire inboundWire = EasyMock.createNiceMock(Wire.class);
-// JavaServiceContract contract = new JavaServiceContract(Greeter.class);
-// contract.setCallbackName("");
-// contract.setCallbackClass(GreetingCallback.class);
-// Operation<Type> callbackOp =
-// new Operation<Type>("sayHiCallback", null, null, null, true, null, NO_CONVERSATION);
-// HashMap<String, Operation<Type>> callbackOps = new HashMap<String, Operation<Type>>();
-// callbackOps.put("sayHiCallback", callbackOp);
-// contract.setCallbackOperations(callbackOps);
-// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
-// EasyMock.replay(inboundWire);
-//
-// axis2Reference.setWire(inboundWire);
-// Operation operation = new Operation<Type>("sayHi", null, null, null, true, null, NO_CONVERSATION);
-// TargetInvoker asyncTargetInvoker = axis2Reference.createTargetInvoker(contract, operation);
-// assertNotNull(asyncTargetInvoker);
-// assertTrue(asyncTargetInvoker instanceof Axis2AsyncTargetInvoker);
- }
-
-// @SuppressWarnings("unchecked")
-// private Axis2ReferenceBinding createAxis2Reference(String webAppName, String serviceName) throws Exception {
-// //Create WebServiceBindingDefinition
-// String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
-// URL url = getClass().getResource(wsdlLocation);
-// assertNotNull("Could not find wsdl " + url.toString(), url);
-//
-// WSDLFactory factory = WSDLFactory.newInstance();
-// WSDLReader reader = factory.newWSDLReader();
-// reader.setFeature("javax.wsdl.verbose", false);
-// InputSource input = new InputSource(url.openStream());
-// Definition wsdlDef = reader.readWSDL(url.toString(), input);
-// Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
-// "SOAPService"));
-// Port port = wsdlService.getPort("SoapPort");
-// WebServiceBindingDefinition wsBinding =
-// new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
-// //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
-// // TODO figure out what to do with the service contract
-// ServiceContract<?> contract = new WSDLServiceContract();
-// contract.setInterfaceClass(Greeter.class);
-// return new Axis2ReferenceBinding(URI.create(serviceName),
-// wsBinding,
-// contract,
-// null,
-// null);
-// }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.java
deleted file mode 100644
index d4d20414e5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceTestCase.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.binding.ws.axis2;
-
-import junit.framework.TestCase;
-
-public class Axis2ServiceTestCase extends TestCase {
-
- public void testInvokeService() throws Exception {
-// TestServletHost tomcatHost = new TestServletHost();
-// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, false);
-// axis2Service.start();
-//
-// if (true) return;
-// Servlet servlet = tomcatHost.getMapping("testWebAppName/serviceBindings/testServiceName");
-// assertNotNull(servlet);
-//
-// //Create mocked HttpRequest and HttpResponse object to test the Axis2Servlet
-// //To be done:
-
- }
-
- public void testAsyncMessageReceiver() throws Exception {
-
-// TestServletHost tomcatHost = new TestServletHost();
-// Axis2ServiceBinding axis2Service = createAxis2Service("testServiceName", tomcatHost, true);
-// axis2Service.start();
- }
-
-// @SuppressWarnings("unchecked")
-// private Axis2ServiceBinding createAxis2Service(String serviceName, ServletHost tomcatHost, boolean callback)
-// throws Exception {
-// //Create WebServiceBindingDefinition
-// String wsdlLocation = "/wsdl/hello_world_doc_lit.wsdl";
-// URL url = getClass().getResource(wsdlLocation);
-// assertNotNull("Could not find wsdl " + url.toString(), url);
-//
-// WSDLFactory factory = WSDLFactory.newInstance();
-// WSDLReader reader = factory.newWSDLReader();
-// reader.setFeature("javax.wsdl.verbose", false);
-// InputSource input = new InputSource(url.openStream());
-// Definition wsdlDef = reader.readWSDL(url.toString(), input);
-// Service wsdlService = wsdlDef.getService(new QName("http://objectweb.org/hello_world_soap_http",
-// "SOAPService"));
-// Port port = wsdlService.getPort("SoapPort");
-// WebServiceBindingDefinition wsBinding = new WebServiceBindingDefinition(wsdlDef, port, "uri", "portURI", wsdlService);
-//
-// //Create a mocked WireService, make the call of ServiceBindingExtension.getServiceInstance() returns a proxy instance.
-//// WireService wireService = EasyMock.createNiceMock(WireService.class);
-//// wireService.createProxy(EasyMock.isA(Class.class), EasyMock.isA(Wire.class));
-//// EasyMock.expectLastCall().andReturn(null);
-//// EasyMock.replay(wireService);
-//
-// //Create a mocked InboundWire, make the call of ServiceBindingExtension.getInterface() returns a Class
-// Wire inboundWire = EasyMock.createNiceMock(Wire.class);
-// JavaServiceContract contract = new JavaServiceContract(Greeter.class);
-// Map<String, Operation<Type>> opMap = new HashMap<String, Operation<Type>>();
-// for (Method m : Greeter.class.getMethods()) {
-// opMap.put(m.getName(), new Operation<Type>(m.getName(), null, null, null));
-// }
-// contract.setOperations(opMap);
-// EasyMock.expect(inboundWire.getTargetContract()).andReturn(contract).anyTimes();
-// if (callback) {
-// contract.setCallbackName("");
-// }
-// EasyMock.replay(inboundWire);
-//
-// Wire outboundWire = EasyMock.createNiceMock(Wire.class);
-// Map<Operation<?>, InvocationChain> map = new HashMap<Operation<?>, InvocationChain>();
-// EasyMock.expect(outboundWire.getInvocationChains()).andReturn(map).once();
-// EasyMock.replay(outboundWire);
-//
-// TuscanyAxisConfigurator tuscanyAxisConfigurator = new TuscanyAxisConfigurator();
-// ConfigurationContext configurationContext = tuscanyAxisConfigurator.getConfigurationContext();
-// Axis2ServiceBinding axis2Service =
-// new Axis2ServiceBinding(URI.create(serviceName),
-// contract,
-// null,
-// wsBinding,
-// tomcatHost,
-// configurationContext, null);
-// axis2Service.setWire(inboundWire);
-//// axis2Service.setOutboundWire(outboundWire);
-//
-// return axis2Service;
-// }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.java
deleted file mode 100644
index 767f59646f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/Greeter.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.binding.ws.axis2;
-
-public interface Greeter {
-
- String sayHi();
-
- String greetMe(String requestType);
-
- void greetMeOneWay(String requestType);
-
- void greetMeWithCallback(String requestType);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java
deleted file mode 100644
index e5e76af0b7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/GreetingCallback.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2;
-
-public interface GreetingCallback {
-
- void greetMeCallback(String greetMeResponse);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Account.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Account.java
deleted file mode 100644
index 4e7c1b0539..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Account.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Account {
-
- CustomerProfileData getCustomerProfile(String loginID);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/AccountService.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/AccountService.java
deleted file mode 100644
index 5edb4ddc5a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/AccountService.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.binding.ws.axis2.itests;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-public class AccountService implements Account {
-
- public CustomerProfileData getCustomerProfile(String loginID) {
- return new CustomerProfileData(loginID);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java
deleted file mode 100644
index 2dc7d8dee4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Bar.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import java.io.Serializable;
-
-public class Bar implements Serializable {
- private static final long serialVersionUID = 1249963611910502668L;
-
- private String s;
- private int x;
- private Integer y;
-
- private Boolean b;
-
- public Boolean getB() {
- return b;
- }
- public void setB(Boolean b) {
- this.b = b;
- }
- public String getS() {
- return s;
- }
- public void setS(String s) {
- this.s = s;
- }
- public int getX() {
- return x;
- }
- public void setX(int x) {
- this.x = x;
- }
- public Integer getY() {
- return y;
- }
- public void setY(Integer y) {
- this.y = y;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/CustomerProfileData.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/CustomerProfileData.java
deleted file mode 100644
index 5c1ee6a435..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/CustomerProfileData.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-public class CustomerProfileData {
-
- private String firstName;
- private String lastName;
- private String address;
- private String email;
- private String loginID;
- private String password;
- private int id;
-
- public CustomerProfileData(String loginID) {
- firstName = "John";
- lastName = "Doe";
- address = "345 Main Street";
- email = "john@doe.org";
- this.loginID = loginID;
- password = "hello";
- id = 1234;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String firstName) {
- this.lastName = lastName;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getLoginID() {
- return loginID;
- }
-
- public void setLoginID(String loginID) {
- this.loginID = loginID;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.java
deleted file mode 100644
index 6fccbcfd00..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Echo.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.binding.ws.axis2.itests;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface Echo {
-
- Foo echoFoo(Foo foo);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.java
deleted file mode 100644
index 5e1a4cf259..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoComponent.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.binding.ws.axis2.itests;
-
-import org.osoa.sca.annotations.Reference;
-
-public class EchoComponent implements Echo {
-
- @Reference
- public Echo echoWS;
-
- public Foo echoFoo(Foo foo) {
- return echoWS.echoFoo(foo);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.java
deleted file mode 100644
index d028ced69e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/EchoImpl.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.binding.ws.axis2.itests;
-
-
-public class EchoImpl implements Echo {
-
- public Foo echoFoo(Foo foo) {
- return foo;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.java
deleted file mode 100644
index c7b503af17..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/Foo.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.binding.ws.axis2.itests;
-
-import java.io.Serializable;
-
-public class Foo implements Serializable {
- private static final long serialVersionUID = 4879476066850018458L;
-
- private Bar[] bars;
-
- public Bar[] getBars() {
- return bars;
- }
-
- public void setBars(Bar[] bars) {
- this.bars = bars;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.java
deleted file mode 100644
index f474c12af3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.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.binding.ws.axis2.itests;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorld {
-
- String getGreetings(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.java
deleted file mode 100644
index 88705c1a95..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldComponent.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.binding.ws.axis2.itests;
-
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldComponent implements HelloWorld {
-
- @Reference
- public HelloWorld helloWorldWS;
-
- public String getGreetings(String s) {
- return helloWorldWS.getGreetings(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.java
deleted file mode 100644
index f30286feea..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldMultiService.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.binding.ws.axis2.itests;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-
-public class HelloWorldMultiService implements HelloWorldOM, HelloWorldOM2 {
-
- public OMElement getGreetings(OMElement requestOM) {
- String name = requestOM.getFirstElement().getText();
-
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
- OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
- responseOM.addChild(param);
- param.addChild(omFactory.createOMText("Hello " + name));
-
- return responseOM;
- }
-
- public OMElement getGreetings2(OMElement requestOM) {
- String name = requestOM.getFirstElement().getText();
-
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
- OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
- responseOM.addChild(param);
- param.addChild(omFactory.createOMText("Hello2 " + name));
-
- return responseOM;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.java
deleted file mode 100644
index 7ee48d4451..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDLTestCase.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.binding.ws.axis2.itests ;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldNoWSDLTestCase extends TestCase {
-
- private SCADomain domain;
-
- public void testHelloWorld() throws Exception {
- HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
-
- /**
- * Test a a WS call with a complex type
- */
- public void testEchoFoo() throws Exception {
- Echo echo = domain.getService(Echo.class, "EchoComponent");
-
- Foo f = new Foo();
- Bar b1 = new Bar();
- b1.setS("petra");
- b1.setX(1);
- b1.setY(new Integer(2));
- b1.setB(Boolean.TRUE);
- Bar b2 = new Bar();
- b2.setS("beate");
- b2.setX(3);
- b2.setY(new Integer(4));
- b2.setB(Boolean.FALSE);
- f.setBars(new Bar[] { b1, b2} );
-
- Foo f2 = echo.echoFoo(f);
-
- assertEquals("petra", f2.getBars()[0].getS());
- assertEquals(1, f2.getBars()[0].getX());
- assertEquals(2, f2.getBars()[0].getY().intValue());
- assertTrue(f2.getBars()[0].getB().booleanValue());
- assertEquals("beate", f2.getBars()[1].getS());
- assertEquals(3, f2.getBars()[1].getX());
- assertEquals(4, f2.getBars()[1].getY().intValue());
- assertFalse(f2.getBars()[1].getB().booleanValue());
-
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.java
deleted file mode 100644
index 274f6c8d28..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM.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.binding.ws.axis2.itests;
-
-import org.apache.axiom.om.OMElement;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorldOM {
-
- OMElement getGreetings(OMElement parmE);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.java
deleted file mode 100644
index bf371430a1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOM2.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.binding.ws.axis2.itests;
-
-import org.apache.axiom.om.OMElement;
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface HelloWorldOM2 {
-
- OMElement getGreetings2(OMElement parmE);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java
deleted file mode 100644
index d1cbfb88fd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMComponent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import org.apache.axiom.om.OMElement;
-import org.osoa.sca.annotations.Reference;
-
-public class HelloWorldOMComponent implements HelloWorldOM {
-
- @Reference
- public HelloWorldOM helloWorldWS;
-
- public OMElement getGreetings(OMElement om) {
- return helloWorldWS.getGreetings(om);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.java
deleted file mode 100644
index 71d7bf68fb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMService.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.binding.ws.axis2.itests;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-
-public class HelloWorldOMService implements HelloWorldOM {
-
- public OMElement getGreetings(OMElement requestOM) {
- System.out.println(" **** getGreetings **** ");
- String name = requestOM.getFirstElement().getText();
-
- OMFactory omFactory = OMAbstractFactory.getOMFactory();
- OMElement responseOM = omFactory.createOMElement("getGreetingsResponse", "http://helloworld-om", "helloworld");
- OMElement param = omFactory.createOMElement("getGreetingsReturn", "http://helloworld-om", "helloworld");
- responseOM.addChild(param);
- param.addChild(omFactory.createOMText("Hello " + name));
-
- return responseOM;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java
deleted file mode 100644
index e7511027c2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldOMTestCase.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldOMTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testHelloWorld() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite");
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.java
deleted file mode 100644
index 017d9bb478..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldService.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.binding.ws.axis2.itests;
-
-public class HelloWorldService implements HelloWorld {
-
- public String getGreetings(String s) {
- return "Hello " + s;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.java
deleted file mode 100644
index a3a43d032f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldTestCase.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.binding.ws.axis2.itests;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorld helloWorld;
-
- public void testCalculator() throws Exception {
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite");
- helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java
deleted file mode 100644
index 8e17b89f33..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldWSDLMergedTestCase.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldWSDLMergedTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testHelloWorld() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite");
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldWSDLMergedComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.java
deleted file mode 100644
index b276d8210f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLImportTestCase.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.binding.ws.axis2.itests;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.transport.http.server.HttpUtils;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-public class QuestionMarkWSDLImportTestCase extends TestCase {
-
- private SCADomain domain;
-
- /**
- * Tests ?wsdl works and returns the correct port endpoint from the WSDL
- */
- public void testWSDLImportPortEndpoint() throws Exception {
- InputStream inp = new URL("http://localhost:8086/AccountService?wsdl").openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(inp));
- String line;
- while((line = br.readLine()) != null) {
- System.out.println(line);
- }
- br.close();
-
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose", false);
- wsdlReader.setFeature("javax.wsdl.importDocuments", true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8086/AccountService?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName("http://account2/AccountService/$promoted$ep1", "AccountService"));
- Port port = service.getPort("AccountSoapPort");
-
- String endpoint = getEndpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8086/AccountService", endpoint);
- }
-
- private String getEndpoint(Port port) {
- List wsdlPortExtensions = port.getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- return ((SOAPAddress) extension).getLocationURI();
- }
- }
- throw new RuntimeException("no SOAPAddress");
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java
deleted file mode 100644
index 0d10881e7b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLIncludeTestCaseFIXME.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.transport.http.server.HttpUtils;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * ********* Currently broken, see TUSCANY-2942
- *
- * @version $Rev: 660340 $ $Date: 2008-05-27 01:08:32 +0100 (Tue, 27 May 2008) $
- */
-public class QuestionMarkWSDLIncludeTestCaseFIXME extends TestCase {
-
- private SCADomain domain;
-
- /**
- * Tests ?wsdl works and returns the correct port endpoint from the WSDL
- */
- public void testWSDLIncludePortEndpoint() throws Exception {
- InputStream inp = new URL("http://localhost:8085/AccountService?wsdl").openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(inp));
- String line;
- while((line = br.readLine()) != null) {
- System.out.println(line);
- }
- br.close();
-
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose", false);
- wsdlReader.setFeature("javax.wsdl.importDocuments", true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/AccountService?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName("http://accounts/AccountService/$promoted$ep1", "AccountService"));
- Port port = service.getPort("AccountSoapPort");
-
- String endpoint = getEndpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/AccountService", endpoint);
- }
-
- private String getEndpoint(Port port) {
- List wsdlPortExtensions = port.getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- return ((SOAPAddress) extension).getLocationURI();
- }
- }
- throw new RuntimeException("no SOAPAddress");
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
deleted file mode 100644
index 0508f28e11..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/QuestionMarkWSDLTestCase.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests;
-
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.transport.http.server.HttpUtils;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-public class QuestionMarkWSDLTestCase extends TestCase {
-
- private SCADomain domain;
-
- /**
- * Tests ?wsdl works and returns the correct port endpoint from the WSDL
- */
- public void testWSDLPortEndpoint() throws Exception {
- InputStream inp = new URL("http://localhost:8085/services/HelloWorldWebService?wsdl").openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(inp));
- String line;
- while((line = br.readLine()) != null) {
- System.out.println(line);
- }
- br.close();
-
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose",false);
- wsdlReader.setFeature("javax.wsdl.importDocuments",true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/services/HelloWorldWebService?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName("http://helloworld/HelloWorldService/$promoted$ep1",
- "HelloWorldService"));
- Port port = service.getPort("HelloWorldSoapPort");
-
- String endpoint = getEndpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/services/HelloWorldWebService", endpoint);
- }
-
- /**
- * Tests ?wsdl works and returns the correct port endpoint from binding.ws with a custom URI
- */
- public void testCustomEndpoint() throws Exception {
- InputStream inp = new URL("http://localhost:8085/foo/bar?wsdl").openStream();
- BufferedReader br = new BufferedReader(new InputStreamReader(inp));
- String line;
- while((line = br.readLine()) != null) {
- System.out.println(line);
- }
- br.close();
-
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose",false);
- wsdlReader.setFeature("javax.wsdl.importDocuments",true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/foo/bar?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName("http://itests.axis2.ws.binding.sca.tuscany.apache.org/",
- "HelloWorldService"));
- Port port = service.getPort("HelloWorldPort");
-
- String endpoint = getEndpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/foo/bar", endpoint);
- }
-
- protected String getEndpoint(Port port) {
- List wsdlPortExtensions = port.getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- return ((SOAPAddress) extension).getLocationURI();
- }
- }
- throw new RuntimeException("no SOAPAddress");
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.java
deleted file mode 100644
index 5efbedba4c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/UriPrecedenceTestCase.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.binding.ws.axis2.itests;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * This test verifies that the Endpoint URI specified in the wsdl takes precedence over the URI specified
- * in binding. Ref: WS Binding Specification V1.00 - Section 2.1.1
- *
- * @version $Rev$ $Date$
- */
-public class UriPrecedenceTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testUriPrecedence() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-prec", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-prec", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- try {
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- } catch (ServiceRuntimeException e) {
- fail("Endpoint URI from wsdl did not take precedence over URI in binding.");
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite");
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java
deleted file mode 100644
index 56d0537a44..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/AbstractHelloWorldOMTestCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public abstract class AbstractHelloWorldOMTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testCalculator() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance(getCompositeName());
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
- protected String getCompositeName() {
- String className = this.getClass().getName();
- return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java
deleted file mode 100644
index 661afdddad..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiServiceTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints;
-
-public class DefaultMultiServiceTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java
deleted file mode 100644
index 9b2e0eafa0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleServiceTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints;
-
-public class DefaultSingleServiceTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java
deleted file mode 100644
index 98d9a73926..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURITestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints;
-
-public class WSDLExplicitURITestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java
deleted file mode 100644
index 201d11a79f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURITestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.endpoints;
-
-public class WSDLRelativeURITestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java
deleted file mode 100644
index f5d87cdcee..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorldTestCase.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.epr;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorld helloWorld;
-
- public void testCalculator() throws Exception {
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite");
- helloWorld = domain.getService(HelloWorld.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
deleted file mode 100644
index cf5e4947d6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferClient.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
-
-import javax.activation.DataHandler;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Service;
-import java.awt.Image;
-import org.apache.axiom.om.OMElement;
-import javax.xml.transform.Source;
-
-/**
- * This client program shows how to create an SCA runtime, start it,
- * locate the FileTransfer service and invoke it.
- */
-@Service(FileTransferServiceClient.class)
-public class FileTransferClient implements FileTransferServiceClient {
-
- @Reference
- public FileTransferService fileTransferService;
-
- public String uploadImageFileForward (Image attachment) throws Exception {
- return fileTransferService.uploadImageFile(attachment);
- }
-
- public String uploadSourceFileForward (Source attachment) throws Exception {
- return fileTransferService.uploadSourceFile(attachment);
- }
-
- public String uploadDataHandlerFileForward (DataHandler attachment) throws Exception {
- return fileTransferService.uploadDataHandlerFile(attachment);
- }
-
- public String uploadOMElementFileForward (OMElement attachment) throws Exception {
- return fileTransferService.uploadOMElementFile(attachment);
- }
-
- public String sendMyExceptionForward (MyException attachment) throws Exception {
- return fileTransferService.sendMyException(attachment);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.java
deleted file mode 100644
index 35bf6888e3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferMTOMTestCase.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.binding.ws.axis2.itests.mtom;
-
-import javax.activation.DataHandler;
-import javax.activation.FileDataSource;
-import java.awt.Image;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMText;
-import javax.xml.transform.dom.DOMSource;
-import org.apache.axiom.om.OMFactory;
-import java.awt.image.BufferedImage;
-
-import junit.framework.TestCase;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferServiceClient;
-import org.apache.tuscany.sca.databinding.xml.String2Node;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class FileTransferMTOMTestCase extends TestCase {
-
- private SCADomain domain;
- private FileTransferServiceClient filetransfer;
-
- /**
- * Runs once before the tests
- */
- @BeforeClass
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite");
- filetransfer = domain.getService(FileTransferServiceClient.class, "FileTransferClientComponent");
- }
-
- /**
- * Runs once after the tests
- */
- @AfterClass
- protected void tearDown() throws Exception {
- domain.close();
- }
-
- @Test
- public void testImageFileTransfer() throws Exception {
- try {
- Image image = new BufferedImage(80, 24, BufferedImage.TYPE_INT_RGB);
- assertEquals("File uploaded Sucessfully", filetransfer.uploadImageFileForward(image));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @Test
- public void testSourceFileTransfer() throws Exception {
- try {
- String xml = "<a>A<b>B</b><c>C</c></a>";
- Source source = new DOMSource(new String2Node().transform(xml, null));
- assertEquals("File uploaded Sucessfully", filetransfer.uploadSourceFileForward(source));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @Test
- public void testDataHandlerFileTransfer() throws Exception {
- try {
- // For testing purpose lets try uploading LICENSE file.
- DataHandler dataHandler = new DataHandler(new FileDataSource("./LICENSE"));
- assertEquals("File uploaded Sucessfully", filetransfer.uploadDataHandlerFileForward(dataHandler));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @Test
- public void testOMElementFileTransfer() throws Exception {
- try {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement imageElement = factory.createOMElement(new QName("image"));
-
- DataHandler dataHandler = new DataHandler(new FileDataSource("./LICENSE"));
-
- OMText textData = factory.createOMText(dataHandler, true);
- imageElement.addChild(textData);
- assertEquals("File uploaded Sucessfully", filetransfer.uploadOMElementFileForward(imageElement));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-
- @Test
- public void testSendMyException() throws Exception {
- try {
- MyException exp = new MyExceptionImpl();
- assertEquals("File uploaded Sucessfully", filetransfer.sendMyExceptionForward(exp));
- } catch (Exception ex){
- ex.printStackTrace();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.java
deleted file mode 100644
index ab7fc9c43a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferService.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.binding.ws.axis2.itests.mtom;
-
-import org.osoa.sca.annotations.Remotable;
-import javax.activation.DataHandler;
-import java.awt.Image;
-import javax.xml.transform.Source;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.apache.axiom.om.OMElement;
-
-/**
- * This is the business interface of the MTOM FileTransfer service.
- */
-@Remotable
-public interface FileTransferService {
-
- public String uploadImageFile(Image attachment) throws Exception;
-
- public String uploadSourceFile(Source attachment) throws Exception;
-
- public String uploadDataHandlerFile(DataHandler attachment) throws Exception;
-
- public String uploadOMElementFile(OMElement attachment) throws Exception;
-
- //This method uses an user defined interface MyException as parameter type.
- public String sendMyException(@XmlJavaTypeAdapter(MyExceptionAdapter.class) MyException attachment)
- throws Exception;
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceClient.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceClient.java
deleted file mode 100644
index 5fc95441b0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceClient.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.binding.ws.axis2.itests.mtom;
-
-import javax.activation.DataHandler;
-import java.awt.Image;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.transform.Source;
-import org.apache.axiom.om.OMElement;
-
-/**
- * This is the client interface of the File Transfer service.
- */
-public interface FileTransferServiceClient {
-
- public String uploadImageFileForward (Image attachment) throws Exception;
-
- public String uploadSourceFileForward (Source attachment) throws Exception;
-
- public String uploadDataHandlerFileForward (DataHandler attachment) throws Exception;
-
- public String uploadOMElementFileForward (OMElement attachment) throws Exception;
-
- public String sendMyExceptionForward (MyException attachment) throws Exception;
-}
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
deleted file mode 100644
index cc757e5e33..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/FileTransferServiceImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
-
-import org.osoa.sca.annotations.Service;
-import javax.activation.DataHandler;
-import java.awt.Image;
-import javax.xml.transform.Source;
-import org.apache.axiom.om.OMElement;
-
-/**
- * This class implements the HelloWorld service.
- */
-@Service(interfaces={FileTransferService.class})
-public class FileTransferServiceImpl implements FileTransferService {
-
- public String uploadImageFile(Image attachment) throws Exception {
- System.out.println("Content type = " + attachment.toString());
- return "File uploaded Sucessfully";
- }
-
- public String uploadSourceFile(Source attachment) throws Exception {
- System.out.println("Content type = " + attachment.toString());
- return "File uploaded Sucessfully";
- }
-
- public String uploadDataHandlerFile(DataHandler attachment) throws Exception {
- System.out.println("Content type = " + attachment.toString());
- return "File uploaded Sucessfully";
- }
-
- public String uploadOMElementFile(OMElement attachment) throws Exception {
- System.out.println("Content type = " + attachment.toString());
- return "File uploaded Sucessfully";
- }
-
- public String sendMyException(MyException attachment) throws Exception {
- System.out.println("Content type = " + attachment.toString());
- return "File uploaded Sucessfully";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyException.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyException.java
deleted file mode 100644
index 5ecc22572b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyException.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
-
-//@XmlJavaTypeAdapter(MyExceptionAdapter.class)
-public interface MyException {
-
- public String getMessage();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionAdapter.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionAdapter.java
deleted file mode 100644
index 4c4e8a3fcf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionAdapter.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.binding.ws.axis2.itests.mtom;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-public class MyExceptionAdapter extends XmlAdapter<MyExceptionImpl, MyException> {
- public MyException unmarshal(MyExceptionImpl v) {
- return v;
- }
-
- public MyExceptionImpl marshal(MyException v) {
- return (MyExceptionImpl)v;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionImpl.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionImpl.java
deleted file mode 100644
index 1bd9b9b1a0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/MyExceptionImpl.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.mtom;
-
-public class MyExceptionImpl extends Exception implements MyException {
-
- public String getMessage() {
- return "good job......";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java
deleted file mode 100644
index 6cdb12c221..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/AbstractHelloWorldOMTestCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public abstract class AbstractHelloWorldOMTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testHelloWorld() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance(getCompositeName());
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
- protected String getCompositeName() {
- String className = this.getClass().getName();
- return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.java
deleted file mode 100644
index 67d6f1c56e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ClientPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ClientPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Client UserId/Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.java
deleted file mode 100644
index 45c5472100..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/IntegrityPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class IntegrityPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Integrity Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.java
deleted file mode 100644
index 7a4b50cc2c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.configparams;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ServerPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Server User/Passwd Handler....");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java
deleted file mode 100644
index 18a713a243..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthenticationTestCaseFIXME.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams;
-
-public class WSSecurityAuthenticationTestCaseFIXME extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java
deleted file mode 100644
index 1fd1b8d48e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.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.binding.ws.axis2.itests.policy.configparams;
-
-import java.security.Provider;
-import java.security.Security;
-
-public class WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue extends AbstractHelloWorldOMTestCase {
-
- /**
- * @see org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.AbstractHelloWorldOMTestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- // Workaround an issue with IBM JDK
- Provider jce = Security.getProvider("IBMJCE");
- if (jce != null) {
- // Make sure IBMJCE is used first
- Security.removeProvider("IBMJCE");
- Security.insertProviderAt(jce, 1);
- }
- super.setUp();
- }
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java
deleted file mode 100644
index 824132161c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrityTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams;
-
-public class WSSecurityIntegrityTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.java
deleted file mode 100644
index 458a472479..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/AbstractHelloWorldOMTestCase.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.binding.ws.axis2.itests.policy.mixed;
-
-import junit.framework.Assert;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public abstract class AbstractHelloWorldOMTestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- @Test
- public void testHelloWorld() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Before
- public void setUp() throws Exception {
- domain = SCADomain.newInstance(getCompositeName());
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @After
- public void tearDown() throws Exception {
- domain.close();
- }
-
- protected String getCompositeName() {
- String className = this.getClass().getName();
- return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java
deleted file mode 100644
index 88fc0d63fa..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ClientPWCBHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ClientPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Client UserId/Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
-
- System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
- System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
- System.out.println(" **** 3. Usage : " + pwcb.getUsage());
-
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java
deleted file mode 100644
index 0d8914156f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/IntegrityPWCBHandler.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class IntegrityPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Integrity Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
-
- System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
- System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
- System.out.println(" **** 3. Usage : " + pwcb.getUsage());
-
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.java
deleted file mode 100644
index 5840f71057..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.mixed;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ServerPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Server User/Passwd Handler....");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- System.out.println(" **** 1. UserId : " + pwcb.getIdentifer());
- System.out.println(" **** 2. Passwd : " + pwcb.getPassword());
- System.out.println(" **** 3. Usage : " + pwcb.getUsage());
-
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java
deleted file mode 100644
index db5b88f9ac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixedTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed;
-
-public class WSSecurityMixedTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java
deleted file mode 100644
index 04de589fb1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/AbstractHelloWorldOMTestCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOM;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public abstract class AbstractHelloWorldOMTestCase extends TestCase {
-
- private SCADomain domain;
- private HelloWorldOM helloWorld;
-
- public void testHelloWorld() throws Exception {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement requestOM = fac.createOMElement("getGreetings", "http://helloworld-om", "helloworld");
- OMElement parmE = fac.createOMElement("name", "http://helloworld-om", "helloworld");
- requestOM.addChild(parmE);
- parmE.addChild(fac.createOMText("petra"));
- OMElement responseOM = helloWorld.getGreetings(requestOM);
- OMElement child = (OMElement)responseOM.getFirstElement();
- Assert.assertEquals("Hello petra", ((OMText)child.getFirstOMChild()).getText());
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance(getCompositeName());
- helloWorld = domain.getService(HelloWorldOM.class, "HelloWorldComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
- protected String getCompositeName() {
- String className = this.getClass().getName();
- return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.java
deleted file mode 100644
index cf342653c7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ClientPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ClientPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Client UserId/Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.java
deleted file mode 100644
index 84b64d3902..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/IntegrityPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class IntegrityPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Integrity Password Handler .... ");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.java
deleted file mode 100644
index 04825b6b56..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ServerPWCBHandler.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.binding.ws.axis2.itests.policy.wspolicy;
-
-import java.io.IOException;
-
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.ws.security.WSPasswordCallback;
-
-/**
- * Sample userid passwd generation class
- *
- * @version $Rev$ $Date$
- */
-public class ServerPWCBHandler implements CallbackHandler {
-
- public void handle(Callback[] callbacks) throws IOException,
- UnsupportedCallbackException {
- for (int i = 0; i < callbacks.length; i++) {
- System.out.println("*** Calling Server User/Passwd Handler....");
- WSPasswordCallback pwcb = (WSPasswordCallback)callbacks[i];
- pwcb.setPassword("TuscanyWsUserPasswd");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java
deleted file mode 100644
index a439ff4c8f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthenticationTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy;
-
-public class WSSecurityAuthenticationTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.java
deleted file mode 100644
index f37a8deeb7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue.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.binding.ws.axis2.itests.policy.wspolicy;
-
-import java.security.Provider;
-import java.security.Security;
-
-public class WSSecurityConfidentialityTestCaseFIXBouncyCastleIssue extends AbstractHelloWorldOMTestCase {
-
- /**
- * @see org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.AbstractHelloWorldOMTestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- // Workaround an issue with IBM JDK
- Provider jce = Security.getProvider("IBMJCE");
- if (jce != null) {
- // Make sure IBMJCE is used first
- Security.removeProvider("IBMJCE");
- Security.insertProviderAt(jce, 1);
- }
- super.setUp();
- }
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java
deleted file mode 100644
index 18bbf98628..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrityTestCase.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy;
-
-public class WSSecurityIntegrityTestCase extends AbstractHelloWorldOMTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java
deleted file mode 100644
index b2ccd7f97d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12TestCase.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.soap12 ;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-public class HelloWorldSOAP12TestCase extends TestCase {
-
- private SCADomain domain;
-
- public void testHelloWorld() throws Exception {
- HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClient");
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
- public void testHelloWorldSOAP() throws Exception {
- HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP");
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
- public void testHelloWorldSOAP11() throws Exception {
- HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP11");
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
- public void testHelloWorldSOAP12() throws Exception {
- HelloWorld helloWorld = domain.getService(HelloWorld.class, "HelloWorldClientSOAP12");
- assertEquals("Hello petra", helloWorld.getGreetings("petra"));
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java
deleted file mode 100644
index 8d378565d4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/QuestionMarkWSDLTestCase.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.axis2.itests.soap12;
-
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.transport.http.server.HttpUtils;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * Test ?wsdl works and that the returned WSDL has the correct endpoint
- *
- * @version $Rev$ $Date$
- */
-public class QuestionMarkWSDLTestCase extends TestCase {
-
- private static boolean newGenerator = true;
- private SCADomain domain;
-
- /**
- * Tests ?wsdl returns a soap 1.1 port by default
- */
- public void testSOAPDefault() throws Exception {
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose",false);
- wsdlReader.setFeature("javax.wsdl.importDocuments",true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep1?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName(
- "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
- newGenerator ? "HelloWorldService" : "HelloWorld"));
- Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
-
- String endpoint = getSOAP11Endpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/ep1", endpoint);
- }
-
- /**
- * Tests ?wsdl returns a soap 1.1 port when binding uses requires="SOAP.1_1"
- */
- public void testSOAP11Endpoint() throws Exception {
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose",false);
- wsdlReader.setFeature("javax.wsdl.importDocuments",true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep2?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName(
- "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
- newGenerator ? "HelloWorldService" : "HelloWorld"));
- Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP11port_http");
-
- String endpoint = getSOAP11Endpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/ep2", endpoint);
- }
-
- /**
- * Tests ?wsdl returns a soap 1.2 port when binding uses requires="SOAP.1_2"
- */
- public void testSOAP12Endpoint() throws Exception {
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- wsdlReader.setFeature("javax.wsdl.verbose",false);
- wsdlReader.setFeature("javax.wsdl.importDocuments",true);
-
- Definition definition = wsdlReader.readWSDL("http://localhost:8085/ep3?wsdl");
- assertNotNull(definition);
- Service service = definition.getService(new QName(
- "http://itests.axis2.ws.binding.sca.tuscany.apache.org" + (newGenerator ? "/" : ""),
- newGenerator ? "HelloWorldService" : "HelloWorld"));
- Port port = service.getPort(newGenerator ? "HelloWorldPort" : "HelloWorldSOAP12port_http");
-
- String endpoint = getSOAP12Endpoint(port);
- String ip = HttpUtils.getIpAddress();
- assertEquals("http://" + ip + ":8085/ep3", endpoint);
- }
-
- protected String getSOAP11Endpoint(Port port) {
- List wsdlPortExtensions = port.getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- return ((SOAPAddress) extension).getLocationURI();
- }
- }
- throw new RuntimeException("no SOAPAddress");
- }
-
- protected String getSOAP12Endpoint(Port port) {
- List wsdlPortExtensions = port.getExtensibilityElements();
- for (final Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAP12Address) {
- return ((SOAP12Address) extension).getLocationURI();
- }
- }
- throw new RuntimeException("no SOAPAddress");
- }
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
deleted file mode 100644
index 32b042402b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/META-INF/services/org.apache.tuscany.sca.policy.util.PolicyHandler
+++ /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.
-#
-# PolicyHandlerClasses to interpret specific PolicyModels against specific QoS infrastructures
-# handler classname;qname=<policy intent addressed>;model=<policy model class>
-org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicyHandler;intent=http://tuscany.apache.org/xmlns/sca/1.0#wsAuthentication,model=org.apache.tuscany.sca.policy.security.ws.Axis2ConfigParamPolicy
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite
deleted file mode 100644
index 5cea469e3d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorld.composite
+++ /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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorld">
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws wsdlElement="http://helloworld#wsdl.binding(HelloWorldSoapBinding)">
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/services/HelloWorldWebService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
-
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite
deleted file mode 100644
index b11c50b00c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/HelloWorldNoWSDL.composite
+++ /dev/null
@@ -1,61 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorldNoWSDL">
-
- <service name="helloWorld" promote="HelloWorldService">
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <!-- interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" / -->
- <!-- interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorld" / -->
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </reference>
-
- <service name="Echo" promote="EchoService">
- <binding.ws uri="http://localhost:8085/Echo"/>
- </service>
-
- <component name="EchoService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoImpl"/>
- </component>
-
- <component name="EchoComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.EchoComponent"/>
- <reference name="echoWS" />
- </component>
-
- <reference name="echoWS" promote="EchoComponent/echoWS">
- <binding.ws uri="http://localhost:8085/Echo"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd
deleted file mode 100644
index f09ed09b6a..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd
+++ /dev/null
@@ -1,36 +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.
--->
-<xsd:schema elementFormDefault="qualified"
- targetNamespace="http://accounts"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:complexType name="CustomerProfileData">
- <xsd:sequence>
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- <xsd:element name="address" type="xsd:string" />
- <xsd:element name="email" type="xsd:string" />
- <xsd:element name="loginID" type="xsd:string" />
- <xsd:element name="password" type="xsd:string" />
- <xsd:element name="id" type="xsd:int" />
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd
deleted file mode 100644
index ec67b84851..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdefs.xsd
+++ /dev/null
@@ -1,27 +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.
--->
-<xsd:schema elementFormDefault="qualified"
- targetNamespace="http://accounts"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:include schemaLocation="customerdata.xsd" />
- <xsd:include schemaLocation="/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd" />
-
-</xsd:schema>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd
deleted file mode 100644
index 7c903c6394..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/customerinfo.xsd
+++ /dev/null
@@ -1,31 +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.
--->
-<xsd:schema elementFormDefault="qualified"
- targetNamespace="http://accounts"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:complexType name="CustomerProfileInfo">
- <xsd:sequence>
- <xsd:element name="firstName" type="xsd:string" />
- <xsd:element name="lastName" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
-
-</xsd:schema>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite
deleted file mode 100644
index 394bf05506..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultMultiService.composite
+++ /dev/null
@@ -1,51 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint1">
-
- <!--
- exposing a component which has multiple services with a WS binding,
- endpoint should be <componentURI>/<serviceName> so for this composite:
- http://localhost:8085/HelloWorldService/service1
- -->
-
- <service name="helloWorld" promote="HelloWorldService/HelloWorldOM">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
- wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldMultiService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite
deleted file mode 100644
index c7081b9a72..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/DefaultSingleService.composite
+++ /dev/null
@@ -1,51 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint1">
-
- <!--
- exposing a component with a WS binding, endpoint should be <componentURI>/<serviceName>
- unless the component has just a single service in which case its just <componentURI>
- so for this composite: http://localhost:8085/HelloWorldService
- -->
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"
- wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite
deleted file mode 100644
index 7d3e1d1327..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLExplicitURI.composite
+++ /dev/null
@@ -1,49 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite
deleted file mode 100644
index c2cd598508..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/WSDLRelativeURI.composite
+++ /dev/null
@@ -1,49 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint4">
-
- <!--
- exposing a component with a WS binding using a WSDL port with a relative URL
- so for this composite the service is: http://localhost:8085/HelloWorldService/myRelativeURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-relative-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-relative-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/HelloWorldService/helloWorld/myRelativeURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl
deleted file mode 100644
index fe68755c47..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/endpoints/helloworld-om-relative-uri.wsdl
+++ /dev/null
@@ -1,78 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld-om-relative-uri" xmlns:tns="http://helloworld-om-relative-uri" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-om">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-relative-uri" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/HelloWorldService/helloWorld/myRelativeURI"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite
deleted file mode 100644
index 47ce6cc1a3..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/epr/HelloWorld.composite
+++ /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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorld">
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" />
- <binding.ws>
- <EndpointReference>
- <wsa:Address xmlns:wsa="http://www.w3.org/2005/08/addressing">http://localhost:8085/myService</wsa:Address>
- </EndpointReference>
- </binding.ws>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <binding.ws>
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/myService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl
deleted file mode 100644
index 7bf47bc412..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-binding.wsdl
+++ /dev/null
@@ -1,45 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld-om-merged" xmlns:tns="http://helloworld-om-merged" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-om-bindings">
-
- <wsdl:import namespace="http://helloworld-om-merged"
- location="helloworld-om-porttype.wsdl"/>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://endpoint.not.used"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite
deleted file mode 100644
index dee0effd99..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-merged.composite
+++ /dev/null
@@ -1,42 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorldOM-Merged">
-
- <service name="helloWorld" promote="HelloWorldMergedService">
- <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
-
- <component name="HelloWorldMergedService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldWSDLMergedComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- </component>
-
- <reference name="mergedHelloWorldWS" promote="HelloWorldWSDLMergedComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om-merged#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl
deleted file mode 100644
index c66fa51c34..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-porttype.wsdl
+++ /dev/null
@@ -1,59 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld-om-merged" xmlns:tns="http://helloworld-om-merged" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-om-porttype">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-merged" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl
deleted file mode 100644
index baa223f41c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om-uri.wsdl
+++ /dev/null
@@ -1,78 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld-om-uri" xmlns:tns="http://helloworld-om-uri" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-om">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om-uri" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/myExplicitURI"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.composite
deleted file mode 100644
index 8fcbdef33d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorldOM">
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-om#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld" />
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl
deleted file mode 100644
index 73ca02246d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-om.wsdl
+++ /dev/null
@@ -1,78 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld-om" xmlns:tns="http://helloworld-om" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-om">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld-om" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://endpoint.not.used"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite
deleted file mode 100644
index c506b09bb2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.composite
+++ /dev/null
@@ -1,47 +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.
--->
-
-<!-- $Rev$ $Date$ -->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorldPrec">
-
- <service name="helloWorld" promote="HelloWorldService">
- <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
- <binding.ws uri="http://localhost:8085/HelloWorldService/helloWorld"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS">
- <interface.wsdl interface="http://helloworld-prec#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-prec#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
- uri="http://INVALID.END.POINT" />
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.wsdl
deleted file mode 100644
index 5908c43e7d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld-prec.wsdl
+++ /dev/null
@@ -1,81 +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.
--->
-
-<!-- $Rev$ $Date$ -->
-
-<wsdl:definitions targetNamespace="http://helloworld-prec" xmlns:tns="http://helloworld-prec" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld-prec">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld-prec" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/HelloWorldService/helloWorld"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl
deleted file mode 100644
index 1a2272d7ee..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/helloworld.wsdl
+++ /dev/null
@@ -1,86 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="helloworld">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/services/HelloWorldWebService"/>
- </wsdl:port>
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort2">
- <wsdlsoap:address location="http://localhost:8085/services/HelloWorldWebService2"/>
- </wsdl:port>
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort3">
- <wsdlsoap:address location="http://localhost:8085/services/HelloWorldWebService3"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
deleted file mode 100644
index df52fff9b1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransfer.wsdl
+++ /dev/null
@@ -1,220 +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.
--->
-<wsdl:definitions
- targetNamespace="http://filetransfer"
- xmlns:tns="http://filetransfer"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
- xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="filetransfer">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://filetransfer" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="uploadImageFile">
- <complexType>
- <sequence>
- <element name="attachment" type="xsd:base64Binary"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadImageFileResponse">
- <complexType>
- <sequence>
- <element name="uploadImageFileReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadSourceFile">
- <complexType>
- <sequence>
- <element name="attachment" type="xsd:base64Binary"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadSourceFileResponse">
- <complexType>
- <sequence>
- <element name="uploadSourceFileReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadDataHandlerFile">
- <complexType>
- <sequence>
- <element name="attachment" type="xsd:base64Binary"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadDataHandlerFileResponse">
- <complexType>
- <sequence>
- <element name="uploadDataHandlerFileReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadOMElementFile">
- <complexType>
- <sequence>
- <element name="attachment" type="xsd:base64Binary"/>
- </sequence>
- </complexType>
- </element>
- <element name="uploadOMElementFileResponse">
- <complexType>
- <sequence>
- <element name="uploadOMElementFileReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- <element name="sendMyException">
- <complexType>
- <sequence>
- <element name="attachment" type="xsd:anyType"/>
- </sequence>
- </complexType>
- </element>
- <element name="sendMyExceptionResponse">
- <complexType>
- <sequence>
- <element name="sendMyExceptionReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="uploadImageFileRequest">
- <wsdl:part element="tns:uploadImageFile" name="parameters"/>
- </wsdl:message>
- <wsdl:message name="uploadImageFileResponse">
- <wsdl:part element="tns:uploadImageFileResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="uploadSourceFileRequest">
- <wsdl:part element="tns:uploadSourceFile" name="parameters"/>
- </wsdl:message>
- <wsdl:message name="uploadSourceFileResponse">
- <wsdl:part element="tns:uploadSourceFileResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="uploadDataHandlerFileRequest">
- <wsdl:part element="tns:uploadDataHandlerFile" name="parameters"/>
- </wsdl:message>
- <wsdl:message name="uploadDataHandlerFileResponse">
- <wsdl:part element="tns:uploadDataHandlerFileResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="uploadOMElementFileRequest">
- <wsdl:part element="tns:uploadOMElementFile" name="parameters"/>
- </wsdl:message>
- <wsdl:message name="uploadOMElementFileResponse">
- <wsdl:part element="tns:uploadOMElementFileResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="sendMyExceptionRequest">
- <wsdl:part element="tns:sendMyException" name="parameters"/>
- </wsdl:message>
- <wsdl:message name="sendMyExceptionResponse">
- <wsdl:part element="tns:sendMyExceptionResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="FileTransfer">
- <wsdl:operation name="uploadImageFile">
- <wsdl:input message="tns:uploadImageFileRequest" name="uploadImageFileRequest" wsaw:Action="attachment"/>
- <wsdl:output message="tns:uploadImageFileResponse" name="uploadImageFileResponse"/>
- </wsdl:operation>
- <wsdl:operation name="uploadSourceFile">
- <wsdl:input message="tns:uploadSourceFileRequest" name="uploadSourceFileRequest" wsaw:Action="attachment"/>
- <wsdl:output message="tns:uploadSourceFileResponse" name="uploadSourceFileResponse"/>
- </wsdl:operation>
- <wsdl:operation name="uploadDataHandlerFile">
- <wsdl:input message="tns:uploadDataHandlerFileRequest" name="uploadDataHandlerFileRequest" wsaw:Action="attachment"/>
- <wsdl:output message="tns:uploadDataHandlerFileResponse" name="uploadDataHandlerFileResponse"/>
- </wsdl:operation>
- <wsdl:operation name="uploadOMElementFile">
- <wsdl:input message="tns:uploadOMElementFileRequest" name="uploadOMElementFileRequest" wsaw:Action="attachment"/>
- <wsdl:output message="tns:uploadOMElementFileResponse" name="uploadOMElementFileResponse"/>
- </wsdl:operation>
- <wsdl:operation name="sendMyException">
- <wsdl:input message="tns:sendMyExceptionRequest" name="sendMyExceptionRequest"/>
- <wsdl:output message="tns:sendMyExceptionResponse" name="sendMyExceptionResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="FileTransferSoapBinding" type="tns:FileTransfer">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="uploadImageFile">
- <wsdlsoap:operation soapAction="attachment" style="document"/>
- <wsdl:input name="uploadImageFileRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="uploadImageFileResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="uploadSourceFile">
- <wsdlsoap:operation soapAction="attachment" style="document"/>
- <wsdl:input name="uploadSourceFileRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="uploadSourceFileResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="uploadDataHandlerFile">
- <wsdlsoap:operation soapAction="attachment" style="document"/>
- <wsdl:input name="uploadDataHandlerFileRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="uploadDataHandlerFileResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="uploadOMElementFile">
- <wsdlsoap:operation soapAction="attachment" style="document"/>
- <wsdl:input name="uploadOMElementFileRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="uploadOMElementFileResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- <wsdl:operation name="sendMyException">
- <wsdlsoap:operation soapAction="" style="document"/>
- <wsdl:input name="sendMyExceptionRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="sendMyExceptionResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="FileTransferService">
- <wsdl:port binding="tns:FileTransferSoapBinding" name="FileTransferSoapPort">
- <wsdlsoap:address location="http://localhost:8085/FileTransferServiceComponent"/>
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
deleted file mode 100644
index beba2512da..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/mtom/filetransferservice.composite
+++ /dev/null
@@ -1,42 +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"
- targetNamespace="http://filetransfer"
- xmlns:hw="http://filetransfer"
- name="filetransferws">
-
- <component name="FileTransferServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferServiceImpl" />
- <service name="FileTransferService">
- <interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferService"/>
- <!-- interface.wsdl interface="http://filetransfer#wsdl.interface(FileTransfer)" /-->
- <binding.ws uri="http://localhost:8085/FileTransferService" requires="MTOM"/>
- </service>
- </component>
-
- <component name="FileTransferClientComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferClient"/>
- <reference name="fileTransferService">
- <interface.java interface="org.apache.tuscany.sca.binding.ws.axis2.itests.mtom.FileTransferService"/>
- <binding.ws uri="http://localhost:8085/FileTransferService" requires="MTOM"/>
- </reference>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite
deleted file mode 100644
index da5bab45e8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityAuthentication.composite
+++ /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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" requires="authentication">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsClientAuthenticationPolicy">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite
deleted file mode 100644
index 13e002be1b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityConfidentiality.composite
+++ /dev/null
@@ -1,49 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" requires="confidentiality">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" requires="confidentiality">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite
deleted file mode 100644
index 2f6fab0d07..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/WSSecurityIntegrity.composite
+++ /dev/null
@@ -1,49 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" requires="integrity">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" requires="integrity">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml
deleted file mode 100644
index 8fa2d3b8c0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/definitions.xml
+++ /dev/null
@@ -1,101 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <!-- WS Security POLICY SETS -->
- <sca:policySet name="wsAuthenticationPolicy"
- provides="sca:authentication"
- appliesTo="//sca:binding.ws"
- >
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>UsernameToken</items>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.ServerPWCBHandler</passwordCallbackClass>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsClientAuthenticationPolicy"
- provides="tuscany:wsAuthentication"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="OutflowSecurity">
- <action>
- <items>UsernameToken</items>
- <user>TuscanyWsUser</user>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.ClientPWCBHandler</passwordCallbackClass>" +
- <passwordType>PasswordText</passwordType>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsIntegrityPolicy"
- provides="sca:integrity"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>Timestamp Signature</items>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
- </action>
- </parameter>
- <parameter name="OutflowSecurity">
- <action>
- <items>Timestamp Signature</items>
- <user>TuscanyWsUser</user>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>" +
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsConfidentialityPolicy"
- provides="sca:confidentiality"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>Timestamp Signature Encrypt</items>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
- </action>
- </parameter>
- <parameter name="OutflowSecurity">
- <action>
- <items>Timestamp Signature Encrypt</items>
- <user>TuscanyWsUser</user>
- <encryptionUser>TuscanyWsUser</encryptionUser>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.configparams.IntegrityPWCBHandler</passwordCallbackClass>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties</signaturePropFile>
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- <encryptionKeyIdentifier>SKIKeyIdentifier</encryptionKeyIdentifier>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties
deleted file mode 100644
index 592edf183b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/security.properties
+++ /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.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
-org.apache.ws.security.crypto.merlin.keystore.type=jks
-org.apache.ws.security.crypto.merlin.keystore.password=TuscanyWsUserPasswd
-org.apache.ws.security.crypto.merlin.file=org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
deleted file mode 100644
index 0b4f2399f0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml
deleted file mode 100644
index 65f8cb67d8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/intent/definitions.xml
+++ /dev/null
@@ -1,32 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <sca:intent name="wsAuthentication"
- constrains="sca:binding.ws">
- <description>
- Communitcation thro this binding required Authentication.
- </description>
- </sca:intent>
-
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite
deleted file mode 100644
index 12b2b18e55..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/WSSecurityMixed.composite
+++ /dev/null
@@ -1,52 +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"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService"
- policySets="tuscany:serverWsPolicyForAuthentication">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS"
- policySets="tuscany:clientWsPolicyForAuthentication">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
deleted file mode 100644
index 871e889835..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/definitions.xml
+++ /dev/null
@@ -1,323 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <!-- WS Security POLICY SETS -->
- <sca:policySet name="wsAuthenticationPolicy"
- provides="sca:authentication"
- appliesTo="//sca:binding.ws"
- >
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>UsernameToken</items>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsClientAuthenticationPolicy"
- provides="tuscany:wsAuthentication"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="OutflowSecurity">
- <action>
- <items>UsernameToken</items>
- <user>TuscanyWsUser</user>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</passwordCallbackClass>" +
- <passwordType>PasswordText</passwordType>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsMixedReceiverIntegrityPolicy"
- provides="sca:integrity"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>Signature</items>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsMixedSenderIntegrityPolicy"
- provides="sca:integrity"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="OutflowSecurity">
- <action>
- <items>Signature</items>
- <user>TuscanyWsUser</user>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.IntegrityPWCBHandler</passwordCallbackClass>
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsServerAuthenticationIntegrityPolicy"
- provides="sca:authentication sca:integrity"
- appliesTo="//sca:binding.ws"
- >
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>UsernameToken Signature</items>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
- </action>
- </parameter>
- <parameter name="OutflowSecurity">
- <action>
- <items>Signature</items>
- <user>TuscanyWsUser</user>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</passwordCallbackClass>
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="wsClientAuthenticationIntegrityPolicy"
- provides="tuscany:wsAuthentication"
- appliesTo="//sca:binding.ws">
- <tuscany:wsConfigParam>
- <parameter name="InflowSecurity">
- <action>
- <items>Signature</items>
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- </action>
- </parameter>
- <parameter name="OutflowSecurity">
- <action>
- <items>UsernameToken Signature</items>
- <user>TuscanyWsUser</user>
- <passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</passwordCallbackClass>" +
- <signaturePropFile>org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties</signaturePropFile>
- <passwordType>PasswordText</passwordType>
- <signatureKeyIdentifier>DirectReference</signatureKeyIdentifier>
- </action>
- </parameter>
- </tuscany:wsConfigParam>
- </sca:policySet>
-
- <sca:policySet name="clientWsPolicyForAuthentication"
- provides="sca:authentication"
- appliesTo="//sca:binding.ws"
- >
- <wsp:Policy wsu:Id="UTOverTransport"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
- </wsp:Policy>
- </sp:SignedSupportingTokens>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <!-- ramp:passwordType>PasswordText</ramp:passwordType-->
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ClientPWCBHandler</ramp:passwordCallbackClass>
- </ramp:RampartConfig>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet>
-
- <sca:policySet name="serverWsPolicyForAuthentication"
- provides="sca:authentication"
- appliesTo="//sca:binding.ws"
- >
- <wsp:Policy wsu:Id="UTOverTransport"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
- </wsp:Policy>
- </sp:SignedSupportingTokens>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.ServerPWCBHandler</ramp:passwordCallbackClass>
- </ramp:RampartConfig>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet>
-
- <!-- A policyset that uses WS Policy -->
- <sca:policySet name="serverWsPolicyForIntegrity"
- provides="sca:integrity"
- appliesTo="//sca:binding.ws">
- <wsp:Policy wsu:Id="SignOnly"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:InitiatorToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:InitiatorToken>
- <sp:RecipientToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:RecipientToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
- <sp:TripleDesRsa15/>
- </wsp:Policy>
- </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
- <sp:Strict/>
- </wsp:Policy>
- </sp:Layout>
- <sp:IncludeTimestamp/>
- <sp:OnlySignEntireHeadersAndBody/>
- </wsp:Policy>
- </sp:AsymmetricBinding>
- <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:MustSupportRefKeyIdentifier/>
- <sp:MustSupportRefIssuerSerial/>
- </wsp:Policy>
- </sp:Wss10>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <sp:Body/>
- </sp:SignedParts>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
-
- <ramp:signatureCrypto>
- <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
- </ramp:crypto>
- </ramp:signatureCrypto>
- </ramp:RampartConfig>
-
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet>
-
-
- <!-- A policyset that uses WS Policy -->
- <!-- sca:policySet name="tuscany:wsSecurityPolicyForIntegritys"
- provides="sca:integrity"
- appliesTo="sca:binding.ws">
- <wsp:Policy wsu:Id="SignOnly"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:InitiatorToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:InitiatorToken>
- <sp:RecipientToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:RecipientToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
- <sp:TripleDesRsa15/>
- </wsp:Policy>
- </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
- <sp:Strict/>
- </wsp:Policy>
- </sp:Layout>
- <sp:IncludeTimestamp/>
- <sp:OnlySignEntireHeadersAndBody/>
- </wsp:Policy>
- </sp:AsymmetricBinding>
- <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:MustSupportRefKeyIdentifier/>
- <sp:MustSupportRefIssuerSerial/>
- </wsp:Policy>
- </sp:Wss10>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <sp:Body/>
- </sp:SignedParts>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.mixed.IntegrityPWCBHandler</ramp:passwordCallbackClass>
-
- <ramp:signatureCrypto>
- <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
- </ramp:crypto>
- </ramp:signatureCrypto>
- </ramp:RampartConfig>
-
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet-->
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties
deleted file mode 100644
index cb188e6676..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/security.properties
+++ /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.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
-org.apache.ws.security.crypto.merlin.keystore.type=jks
-org.apache.ws.security.crypto.merlin.keystore.password=TuscanyWsUserPasswd
-org.apache.ws.security.crypto.merlin.file=org/apache/tuscany/sca/binding/ws/axis2/itests/policy/configparams/tuscanyKeys.jks \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks
deleted file mode 100644
index 0b4f2399f0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/mixed/tuscanyKeys.jks
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
deleted file mode 100644
index 2a22a0905d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
+++ /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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForAuthentication">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForAuthentication">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite
deleted file mode 100644
index e6f999aad7..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityConfidentiality.composite
+++ /dev/null
@@ -1,49 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" policySets="wsSecurityPolicyForConfidentiality">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="wsSecurityPolicyForConfidentiality">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite
deleted file mode 100644
index d9e889768b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityIntegrity.composite
+++ /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.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="endpoint3">
-
- <!--
- exposing a component with a WS binding using a WSDL port with an explicit URL
- so for this composite the service is: http://localhost:8085/myExplicitURI
- -->
-
- <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForIntegrity">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMService"/>
- </component>
-
- <component name="HelloWorldComponent">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldOMComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForIntegrity">
- <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)" />
- <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
- uri="http://localhost:8085/myExplicitURI"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
deleted file mode 100644
index bfa9b1a222..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
+++ /dev/null
@@ -1,204 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <!-- WS Security POLICY SETS -->
- <!-- A policyset that uses WS Policy -->
- <sca:policySet name="wsSecurityPolicyForAuthentication"
- provides="sca:authentication"
- appliesTo="sca:binding.ws">
- <wsp:Policy wsu:Id="UTOverTransport"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
- </wsp:Policy>
- </sp:SignedSupportingTokens>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:passwordType>PasswordText</ramp:passwordType>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.ClientPWCBHandler</ramp:passwordCallbackClass>
- </ramp:RampartConfig>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet>
-
-
- <!-- A policyset that uses WS Policy -->
- <sca:policySet name="wsSecurityPolicyForIntegrity"
- provides="sca:integrity"
- appliesTo="sca:binding.ws">
- <wsp:Policy wsu:Id="SignOnly"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:InitiatorToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:InitiatorToken>
- <sp:RecipientToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:RecipientToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
- <sp:TripleDesRsa15/>
- </wsp:Policy>
- </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
- <sp:Strict/>
- </wsp:Policy>
- </sp:Layout>
- <sp:IncludeTimestamp/>
- <sp:OnlySignEntireHeadersAndBody/>
- </wsp:Policy>
- </sp:AsymmetricBinding>
- <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:MustSupportRefKeyIdentifier/>
- <sp:MustSupportRefIssuerSerial/>
- </wsp:Policy>
- </sp:Wss10>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <sp:Body/>
- </sp:SignedParts>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
-
- <ramp:signatureCrypto>
- <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
- </ramp:crypto>
- </ramp:signatureCrypto>
- </ramp:RampartConfig>
-
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </sca:policySet>
-
- <!-- A policyset that uses WS Policy -->
- <sca:policySet name="wsSecurityPolicyForConfidentiality"
- provides="sca:confidentiality"
- appliesTo="sca:binding.ws">
- <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:InitiatorToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:InitiatorToken>
- <sp:RecipientToken>
- <wsp:Policy>
- <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
- <wsp:Policy>
- <sp:WssX509V3Token10/>
- </wsp:Policy>
- </sp:X509Token>
- </wsp:Policy>
- </sp:RecipientToken>
- <sp:AlgorithmSuite>
- <wsp:Policy>
- <sp:TripleDesRsa15/>
- </wsp:Policy>
- </sp:AlgorithmSuite>
- <sp:Layout>
- <wsp:Policy>
- <sp:Strict/>
- </wsp:Policy>
- </sp:Layout>
- <sp:IncludeTimestamp/>
- <sp:OnlySignEntireHeadersAndBody/>
- </wsp:Policy>
- </sp:AsymmetricBinding>
- <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <wsp:Policy>
- <sp:MustSupportRefKeyIdentifier/>
- <sp:MustSupportRefIssuerSerial/>
- </wsp:Policy>
- </sp:Wss10>
- <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <sp:Body/>
- </sp:SignedParts>
- <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
- <sp:Body/>
- </sp:EncryptedParts>
-
- <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
- <ramp:user>TuscanyWsUser</ramp:user>
- <ramp:encryptionUser>TuscanyWsUser</ramp:encryptionUser>
- <ramp:passwordCallbackClass>org.apache.tuscany.sca.binding.ws.axis2.itests.policy.wspolicy.IntegrityPWCBHandler</ramp:passwordCallbackClass>
- <ramp:signatureCrypto>
- <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
- </ramp:crypto>
- </ramp:signatureCrypto>
-
- <ramp:encryptionCypto>
- <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.file">org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks</ramp:property>
- <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">TuscanyWsUserPasswd</ramp:property>
- </ramp:crypto>
- </ramp:encryptionCypto>
- </ramp:RampartConfig>
-
- </wsp:All>
- </wsp:ExactlyOne>
-</wsp:Policy>
- </sca:policySet>
-
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks
deleted file mode 100644
index d77c889141..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/tuscanyKeys.jks
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl
deleted file mode 100644
index 41a491361f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl
+++ /dev/null
@@ -1,70 +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.
--->
-<wsdl:definitions targetNamespace="http://account3"
- xmlns:tns="http://account3"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="questionmark-import-nested">
-
- <wsdl:types>
- <xsd:schema elementFormDefault="qualified"
- targetNamespace="http://account3"
- xmlns:account="http://accounts"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:import namespace="http://accounts" schemaLocation="customerdefs.xsd" />
-
- <xsd:element name="getCustomerProfile">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="loginID" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getCustomerProfileResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="customerProfile"
- type="account:CustomerProfileData" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- </xsd:schema>
- </wsdl:types>
-
- <wsdl:message name="getCustomerProfileRequest">
- <wsdl:part element="tns:getCustomerProfile" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="getCustomerProfileResponse">
- <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:portType name="Account">
- <wsdl:operation name="getCustomerProfile">
- <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
- <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
- </wsdl:operation>
- </wsdl:portType>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl
deleted file mode 100644
index 99a8c6d81d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import.wsdl
+++ /dev/null
@@ -1,49 +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.
--->
-<wsdl:definitions targetNamespace="http://account2"
- xmlns:tns="http://account2"
- xmlns:account3="http://account3"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="questionmark-import">
-
- <wsdl:import namespace="http://account3" location="/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-import-nested.wsdl" />
-
- <wsdl:binding name="AccountSoapBinding" type="account3:Account">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCustomerProfile">
- <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getCustomerProfileRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
- <wsdl:output name="getCustomerProfileResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
- <wsdlsoap:address location="http://localhost:8086/AccountService" />
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl
deleted file mode 100644
index 80e4b62801..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-include.wsdl
+++ /dev/null
@@ -1,94 +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.
--->
-<wsdl:definitions targetNamespace="http://accounts"
- xmlns:tns="http://accounts"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="questionmark-include">
-
- <wsdl:types>
- <xsd:schema elementFormDefault="qualified"
- targetNamespace="http://accounts"
- xmlns:account="http://accounts"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <xsd:include schemaLocation="/org/apache/tuscany/sca/binding/ws/axis2/itests/customerdata.xsd" />
-
- <xsd:element name="getCustomerProfile">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="loginID" type="xsd:string" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="getCustomerProfileResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="customerProfile"
- type="xsd:string" />
- <!--
- <xsd:element name="customerProfile"
- type="account:CustomerProfileData" />
- -->
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- </xsd:schema>
- </wsdl:types>
-
- <wsdl:message name="getCustomerProfileRequest">
- <wsdl:part element="tns:getCustomerProfile" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="getCustomerProfileResponse">
- <wsdl:part element="tns:getCustomerProfileResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:portType name="Account">
- <wsdl:operation name="getCustomerProfile">
- <wsdl:input message="tns:getCustomerProfileRequest" name="getCustomerProfileRequest" />
- <wsdl:output message="tns:getCustomerProfileResponse" name="getCustomerProfileResponse" />
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="AccountSoapBinding" type="tns:Account">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getCustomerProfile">
- <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getCustomerProfileRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
- <wsdl:output name="getCustomerProfileResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:service name="AccountService">
- <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
- <wsdlsoap:address location="http://localhost:8085/AccountService" />
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite
deleted file mode 100644
index 008d42d03d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-import.composite
+++ /dev/null
@@ -1,31 +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"
- name="QuestionMarkWSDLImport">
-
- <service name="ep1" promote="AccountService">
- <binding.ws wsdlElement="http://account2#wsdl.port(AccountService/AccountSoapPort)" />
- </service>
-
- <component name="AccountService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.AccountService" />
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite
deleted file mode 100644
index 7fff56377b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl-include.composite
+++ /dev/null
@@ -1,31 +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"
- name="QuestionMarkWSDLInclude">
-
- <service name="ep1" promote="AccountService">
- <binding.ws wsdlElement="http://accounts#wsdl.port(AccountService/AccountSoapPort)" />
- </service>
-
- <component name="AccountService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.AccountService" />
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite
deleted file mode 100644
index c042ae5675..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/questionmark-wsdl.composite
+++ /dev/null
@@ -1,39 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="QuestionMarkWSDLTests">
-
- <service name="ep1" promote="HelloWorldService">
- <binding.ws wsdlElement="http://helloworld#wsdl.service(HelloWorldService)"/>
- <!--
- <binding.ws wsdlElement="http://helloworld#wsdl.port(HelloWorldService/HelloWorldSoapPort)"/>
- -->
- </service>
-
- <service name="ep2" promote="HelloWorldService">
- <binding.ws uri="http://localhost:8085/foo/bar" />
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
deleted file mode 100644
index fbd4c66c45..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/HelloWorldSOAP12.composite
+++ /dev/null
@@ -1,71 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="HelloWorld">
-
- <service name="helloWorld" promote="HelloWorldService">
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </service>
- <service name="helloWorldSOAP" promote="HelloWorldService">
- <binding.ws requires="SOAP" uri="http://localhost:8085/helloWorldSOAP"/>
- </service>
- <service name="helloWorldSOAP11" promote="HelloWorldService">
- <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/helloWorldSOAP11"/>
- </service>
- <service name="helloWorldSOAP12" promote="HelloWorldService">
- <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/helloWorldSOAP12"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
- <component name="HelloWorldClient">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
- <component name="HelloWorldClientSOAP">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
- <component name="HelloWorldClientSOAP11">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
- <component name="HelloWorldClientSOAP12">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldComponent"/>
- <reference name="helloWorldWS" />
- </component>
-
- <reference name="helloWorldWS" promote="HelloWorldClient/helloWorldWS">
- <binding.ws uri="http://localhost:8085/helloWorld"/>
- </reference>
- <reference name="helloWorldWS" promote="HelloWorldClientSOAP/helloWorldWS">
- <binding.ws uri="http://localhost:8085/helloWorldSOAP" requires="SOAP"/>
- </reference>
- <reference name="helloWorldWS" promote="HelloWorldClientSOAP11/helloWorldWS">
- <binding.ws uri="http://localhost:8085/helloWorldSOAP11" requires="SOAP.1_1"/>
- </reference>
- <reference name="helloWorldWS" promote="HelloWorldClientSOAP12/helloWorldWS">
- <binding.ws uri="http://localhost:8085/helloWorldSOAP12" requires="SOAP.1_2"/>
- </reference>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite b/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite
deleted file mode 100644
index 033a77eea6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/soap12/questionmark-wsdl.composite
+++ /dev/null
@@ -1,40 +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:sca="http://www.osoa.org/xmlns/sca/1.0"
- name="QuestionMarkWSDLTests">
-
- <service name="ep1" promote="HelloWorldService">
- <binding.ws uri="http://localhost:8085/ep1"/>
- </service>
-
- <service name="ep2" promote="HelloWorldService">
- <binding.ws requires="SOAP.1_1" uri="http://localhost:8085/ep2"/>
- </service>
-
- <service name="ep3" promote="HelloWorldService">
- <binding.ws requires="SOAP.1_2" uri="http://localhost:8085/ep3"/>
- </service>
-
- <component name="HelloWorldService">
- <implementation.java class="org.apache.tuscany.sca.binding.ws.axis2.itests.HelloWorldService"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/LICENSE b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/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-java-1.5.1/modules/binding-ws-wsdlgen/NOTICE b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/pom.xml b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/pom.xml
deleted file mode 100644
index 38af8be345..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/pom.xml
+++ /dev/null
@@ -1,108 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
- <name>Apache Tuscany SCA Web Service binding WSDL Generator</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-jaxws</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ws.wsdlgen</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ws.wsdlgen*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
deleted file mode 100644
index 6bfd00220e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGenerator.java
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.wsdl.WSDLException;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.InvalidWSDLException;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLInterfaceIntrospectorImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BindingWSDLGenerator {
- private static final Logger logger = Logger.getLogger(BindingWSDLGenerator.class.getName());
- private static final QName SOAP12_INTENT = new QName("http://www.osoa.org/xmlns/sca/1.0", "SOAP.1_2");
-
- public static boolean printWSDL; // external code sets this to print generated WSDL
-
- private BindingWSDLGenerator() {
- // this class has static methods only and cannot be instantiated
- }
-
- /**
- * Log a warning message.
- * @param problem
- */
- private static void logWarning(Problem problem) {
- Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
- if (problemLogger != null){
- problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams());
- } else {
- logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
- }
- }
-
- /**
- * Report a warning.
- * @param message
- * @param binding
- * @param parameters
- */
- private static void warning(Monitor monitor, String message, WebServiceBinding wsBinding, String... messageParameters) {
- Problem problem = new ProblemImpl(BindingWSDLGenerator.class.getName(), "wsdlgen-validation-messages", Severity.WARNING, wsBinding, message, (Object[])messageParameters);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- logWarning(problem);
- }
- }
-
- /**
- * Report an error.
- * @param message
- * @param binding
- * @param parameters
- */
- private static void error(Monitor monitor, String message, WebServiceBinding wsBinding, String... messageParameters) {
- Problem problem = new ProblemImpl(BindingWSDLGenerator.class.getName(), "wsdlgen-validation-messages", Severity.ERROR, wsBinding, message, (Object[])messageParameters);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- throw new WSDLGenerationException(problem.toString(), null, problem);
- }
- }
-
- /**
- * Report an exception error.
- * @param message
- * @param binding
- * @param exception
- */
- private static void error(Monitor monitor, String message, WebServiceBinding wsBinding, Exception ex) {
- Problem problem = new ProblemImpl(BindingWSDLGenerator.class.getName(), "wsdlgen-validation-messages", Severity.ERROR, wsBinding, message, ex);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- throw new WSDLGenerationException(problem.toString(), ex, problem);
- }
- }
-
- /**
- * Report a fatal error.
- * @param message
- * @param binding
- * @param exception
- */
- private static void fatal(Monitor monitor, String message, WebServiceBinding wsBinding, String... messageParameters) {
- Problem problem = new ProblemImpl(BindingWSDLGenerator.class.getName(), "wsdlgen-validation-messages", Severity.ERROR,wsBinding, message, (Object[])messageParameters);
- throw new WSDLGenerationException(problem.toString(), null, problem);
- }
-
- /**
- * Report a fatal exception error.
- * @param message
- * @param binding
- * @param exception
- */
- private static void fatal(Monitor monitor, String message, WebServiceBinding wsBinding, Exception ex) {
- Problem problem = new ProblemImpl(BindingWSDLGenerator.class.getName(), "wsdlgen-validation-messages", Severity.ERROR, wsBinding, message, ex);
- throw new WSDLGenerationException(problem.toString(), ex, problem);
- }
-
- /**
- * This method can be called from the binding builder or from the runtime.
- * Report problems and exceptions in the most appropriate way for both
- * of these cases.
- */
- public static void generateWSDL(Component component,
- AbstractContract contract,
- WebServiceBinding wsBinding,
- ExtensionPointRegistry extensionPoints,
- Monitor monitor) {
- try {
- createWSDLDocument(component, contract, wsBinding, extensionPoints, monitor);
- } catch (WSDLGenerationException ex) {
- if (ex.getProblem() != null) {
- warning(monitor, "WsdlGenProblem", wsBinding, component.getName(), contract.getName());
- if (monitor != null) {
- monitor.problem(ex.getProblem());
- } else {
- throw ex;
- }
- } else if (ex.getCause() instanceof Exception) {
- warning(monitor, "WsdlGenException", wsBinding, component.getName(), contract.getName());
- error(monitor, "UnexpectedException", wsBinding, (Exception)ex.getCause());
- } else { // should never happen
- throw new IllegalStateException(ex);
- }
- } catch (RuntimeException ex) {
- warning(monitor, "WsdlGenException", wsBinding, component.getName(), contract.getName());
- error(monitor, "UnexpectedException", wsBinding, ex);
- }
- }
-
- private static void createWSDLDocument(Component component,
- AbstractContract contract,
- WebServiceBinding wsBinding,
- ExtensionPointRegistry extensionPoints,
- Monitor monitor) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- DataBindingExtensionPoint dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
- WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
-
- if (((Contract)contract).getInterfaceContract(wsBinding) == null) {
- // can happen if incorrect component service name
- fatal(monitor, "MissingInterfaceContract", wsBinding, component.getName(), contract.getName());
- }
-
- InterfaceContract icontract = wsBinding.getBindingInterfaceContract();
- if (icontract == null) {
- icontract = ((Contract)contract).getInterfaceContract(wsBinding).makeUnidirectional(false);
- if (icontract instanceof JavaInterfaceContract) {
- ModelResolver resolver = component instanceof ResolverExtension ?
- ((ResolverExtension)component).getModelResolver() : null;
- icontract = createWSDLInterfaceContract(
- (JavaInterfaceContract)icontract,
- requiresSOAP12(wsBinding),
- resolver,
- dataBindings,
- wsdlFactory,
- xsdFactory,
- monitor);
- } else {
- try {
- //TUSCANY-2316 Cloning the Interface Contract to avoid overriding data binding information
- icontract = (InterfaceContract)icontract.clone();
- } catch (Exception e) {
- //ignore
- }
- }
- wsBinding.setBindingInterfaceContract(icontract);
- }
-
- // TODO - fix up the conversational flag and operation sequences in case the contract has come from WSDL
- // as we don't yet support requires="conversational" or sca:endConversation annotations
- // in WSDL interface descriptions (see section 1.5.4 of the Assembly Specification V1.0)
- if (contract.getInterfaceContract().getInterface() != null ) {
- icontract.getInterface().setConversational(contract.getInterfaceContract().getInterface().isConversational());
-
- for (Operation operation : icontract.getInterface().getOperations()){
- Operation serviceOperation = null;
-
- for (Operation tmpOp : contract.getInterfaceContract().getInterface().getOperations()){
- if (operation.getName().equals(tmpOp.getName())) {
- serviceOperation = tmpOp;
- break;
- }
- }
-
- if (serviceOperation != null ){
- operation.setConversationSequence(serviceOperation.getConversationSequence());
- }
- }
- }
-
- /*
- // Look at all the Web Service bindings of the SCA service to see if any
- // of them have an existing generated WSDL definitions document. If found,
- // use it for this binding as well. If not found, generate a new document.
- Definition definition = null;
- for (Binding binding : contract.getBindings()) {
- if (binding instanceof WebServiceBinding) {
- definition = ((WebServiceBinding)binding).getWSDLDocument();
- if (definition != null) {
- wsBinding.setWSDLDocument(definition);
- break;
- }
- }
- }
- */
- // The above code is currently not used. Instead, we only look
- // for a WSDL definitions document in this binding and don't
- // attempt to share the same document across multiple bindings.
-
- // generate a WSDL definitions document if needed
- Definition definition = wsBinding.getWSDLDocument();
- if (definition == null) {
- definition = WSDLServiceGenerator.configureWSDLDefinition(wsBinding, component, contract, monitor);
- wsBinding.setWSDLDocument(definition);
- }
- }
-
- protected static boolean requiresSOAP12(WebServiceBinding wsBinding) {
- if (wsBinding instanceof IntentAttachPoint) {
- List<Intent> intents = ((IntentAttachPoint)wsBinding).getRequiredIntents();
- for (Intent intent : intents) {
- if (SOAP12_INTENT.equals(intent.getName())) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Create a WSDLInterfaceContract from a JavaInterfaceContract
- */
- protected static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract,
- boolean requiresSOAP12,
- ModelResolver resolver,
- DataBindingExtensionPoint dataBindings,
- WSDLFactory wsdlFactory,
- XSDFactory xsdFactory,
- Monitor monitor) {
-
- WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
- WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
- wsdlContract.setInterface(wsdlInterface);
-
- WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
- JavaInterface iface = (JavaInterface)contract.getInterface();
-
- Definition def = null;
- try {
- Interface2WSDLGenerator wsdlGenerator =
- new Interface2WSDLGenerator(requiresSOAP12, resolver, dataBindings, xsdFactory, monitor);
- def = wsdlGenerator.generate(iface, wsdlDefinition);
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
-
- // for debugging
- if (printWSDL) {
- try {
- System.out.println("Generated WSDL for Java interface " + iface.getName() + " class " + iface.getJavaClass().getName());
- WSDLWriter writer = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
- writer.writeWSDL(def, System.out);
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- wsdlDefinition.setDefinition(def);
- wsdlInterface.setWsdlDefinition(wsdlDefinition);
- wsdlInterface.setRemotable(true);
- wsdlInterface.setConversational(contract.getInterface().isConversational());
- wsdlInterface.setUnresolved(false);
- wsdlInterface.setRemotable(true);
- PortType portType = (PortType)def.getAllPortTypes().values().iterator().next();
- wsdlInterface.setPortType(portType);
-
- try {
- for (Operation op : iface.getOperations()) {
- javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null);
- wsdlInterface.getOperations().add(WSDLInterfaceIntrospectorImpl.getOperation(
- wsdlOp, wsdlDefinition, resolver, xsdFactory));
- }
- } catch (InvalidWSDLException e) {
- throw new WSDLGenerationException(e);
- }
-
- return wsdlContract;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
deleted file mode 100644
index 4c63122eff..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
+++ /dev/null
@@ -1,913 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-import java.lang.reflect.Method;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.OperationType;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.PortType;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.factory.WSDLFactory;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaException;
-import org.apache.ws.commons.schema.utils.NamespaceMap;
-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;
-
-/**
- * @version $Rev: 670103 $ $Date: 2008-06-21 01:35:00 +0100 (Sat, 21 Jun 2008) $
- */
-public class Interface2WSDLGenerator {
- private static final Logger logger = Logger.getLogger(Interface2WSDLGenerator.class.getName());
- private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
- private static final String SCHEMA_NAME = "schema";
- private static final QName SCHEMA_QNAME = new QName(SCHEMA_NS, SCHEMA_NAME);
- private static final String XMLNS_NS = "http://www.w3.org/2000/xmlns/";
-
- private static final String ANYTYPE_NAME = "anyType";
- private static final QName ANYTYPE_QNAME = new QName(SCHEMA_NS, ANYTYPE_NAME);
-
-
- private WSDLFactory factory;
- private DataBindingExtensionPoint dataBindings;
- private WSDLDefinitionGenerator definitionGenerator;
- private boolean requiresSOAP12;
- private ModelResolver resolver;
- private XSDFactory xsdFactory;
- private Monitor monitor;
-
- public Interface2WSDLGenerator(boolean requiresSOAP12,
- ModelResolver resolver,
- DataBindingExtensionPoint dataBindings,
- XSDFactory xsdFactory,
- Monitor monitor) throws WSDLException {
- super();
- this.requiresSOAP12 = requiresSOAP12;
- this.resolver = resolver;
- definitionGenerator = new WSDLDefinitionGenerator(requiresSOAP12, false);
- this.dataBindings = dataBindings;
- this.xsdFactory = xsdFactory;
- this.monitor = monitor;
- this.factory = WSDLFactory.newInstance();
- }
-
- /**
- * Log a warning message.
- * @param problem
- */
- private static void logWarning(Problem problem) {
- Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
- if (problemLogger != null){
- problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams());
- } else {
- logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
- }
- }
-
- /**
- * Report a warning.
- * @param message
- * @param binding
- * @param parameters
- */
- private void warning(String message, Interface interfaze, String... messageParameters) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "wsdlgen-validation-messages", Severity.WARNING, interfaze, message, (Object[])messageParameters);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- logWarning(problem);
- }
- }
-
- /**
- * Report a fatal error.
- * @param message
- * @param binding
- * @param parameters
- */
- private void fatal(String message, Interface interfaze, String... messageParameters) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "wsdlgen-validation-messages", Severity.ERROR, interfaze, message, (Object[])messageParameters);
- throw new WSDLGenerationException(problem.toString(), null, problem);
- }
-
- private XMLTypeHelper getTypeHelper(DataType type, Map<String, XMLTypeHelper> helpers) {
- if (type == null) {
- return null;
- }
- String db = type.getDataBinding();
- if (db == null) {
- return null;
- }
- if ("java:array".equals(db)) {
- DataType dt = (DataType)type.getLogical();
- db = dt.getDataBinding();
- }
- return helpers.get(db);
- }
-
- private boolean inputTypesCompatible(DataType wrapperType, DataType<List<DataType>> inputType, Map<String, XMLTypeHelper> helpers) {
- XMLTypeHelper wrapperHelper = getTypeHelper(wrapperType, helpers);
- for (DataType dt : inputType.getLogical()) {
- if (getTypeHelper(dt, helpers) != wrapperHelper) {
- return false;
- }
- }
- return true;
- }
-
- private boolean outputTypeCompatible(DataType wrapperType, DataType outputType, Map<String, XMLTypeHelper> helpers) {
- if (getTypeHelper(outputType, helpers) != getTypeHelper(wrapperType, helpers)) {
- return false;
- } else {
- return true;
- }
- }
-
- private void addDataType(Map<XMLTypeHelper, List<DataType>> map, DataType type, Map<String, XMLTypeHelper> helpers) {
- if (type == null) {
- return;
- }
- String db = type.getDataBinding();
- if (db == null) {
- return;
- }
- if ("java:array".equals(db)) {
- DataType dt = (DataType)type.getLogical();
- db = dt.getDataBinding();
- }
- XMLTypeHelper helper = helpers.get(db);
- List<DataType> types = map.get(helper);
- if (types == null) {
- types = new ArrayList<DataType>();
- map.put(helper, types);
- }
- types.add(type);
- }
-
- private Map<XMLTypeHelper, List<DataType>> getDataTypes(Interface intf, boolean useWrapper, Map<String, XMLTypeHelper> helpers) {
- Map<XMLTypeHelper, List<DataType>> dataTypes = new HashMap<XMLTypeHelper, List<DataType>>();
- for (Operation op : intf.getOperations()) {
- WrapperInfo inputWrapper = op.getInputWrapper();
- DataType dt1 = null;
- boolean useInputWrapper = useWrapper & inputWrapper != null;
- if (useInputWrapper) {
- dt1 = inputWrapper.getWrapperType();
- useInputWrapper &= inputTypesCompatible(dt1, op.getInputType(), helpers);
- }
- if (useInputWrapper) {
- addDataType(dataTypes, dt1, helpers);
- } else {
- for (DataType dt : op.getInputType().getLogical()) {
- addDataType(dataTypes, dt, helpers);
- }
- }
-
- DataType dt2 = null;
- WrapperInfo outputWrapper = op.getOutputWrapper();
- boolean useOutputWrapper = useWrapper & outputWrapper != null;
- if (useOutputWrapper) {
- dt2 = outputWrapper.getWrapperType();
- useOutputWrapper &= outputTypeCompatible(dt2, op.getOutputType(), helpers);
- }
- if (useOutputWrapper) {
- addDataType(dataTypes, dt2, helpers);
- } else {
- dt2 = op.getOutputType();
- addDataType(dataTypes, dt2, helpers);
- }
-
- for (DataType<DataType> dt3 : op.getFaultTypes()) {
- DataType dt4 = dt3.getLogical();
- addDataType(dataTypes, dt4, helpers);
- }
- }
- // Adding classes referenced by @XmlSeeAlso in the java interface
- if (intf instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)intf;
- Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
- if (seeAlso != null) {
- for (Class<?> cls : seeAlso) {
- DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN);
- addDataType(dataTypes, dt, helpers);
- }
- }
- seeAlso = getSeeAlso(javaInterface.getCallbackClass());
- if (seeAlso != null) {
- for (Class<?> cls : seeAlso) {
- DataType dt = new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN);
- addDataType(dataTypes, dt, helpers);
- }
- }
- }
- return dataTypes;
- }
-
- private static Class<?>[] getSeeAlso(Class<?> interfaze) {
- if (interfaze == null) {
- return null;
- }
- XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
- if (seeAlso == null) {
- return null;
- } else {
- return seeAlso.value();
- }
- }
-
-
- public Definition generate(Interface interfaze, WSDLDefinition wsdlDefinition) throws WSDLException {
- if (interfaze == null) {
- return null;
- }
- if (interfaze instanceof WSDLInterface) {
- return ((WSDLInterface)interfaze).getWsdlDefinition().getDefinition();
- }
- JavaInterface iface = (JavaInterface)interfaze;
- if (!interfaze.isRemotable()) {
- fatal("InterfaceNotRemotable", interfaze, iface.getName());
- }
- QName name = getQName(iface);
- Definition definition = factory.newDefinition();
- if (requiresSOAP12) {
- definition.addNamespace("SOAP12", "http://schemas.xmlsoap.org/wsdl/soap12/");
- } else {
- definition.addNamespace("SOAP", "http://schemas.xmlsoap.org/wsdl/soap/");
- }
- definition.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
- definition.addNamespace("xs", SCHEMA_NS);
-
- String namespaceURI = name.getNamespaceURI();
- definition.setTargetNamespace(namespaceURI);
- definition.setQName(new QName(namespaceURI, name.getLocalPart() + "Service", name.getPrefix()));
- definition.addNamespace(name.getPrefix(), namespaceURI);
-
- PortType portType = definition.createPortType();
- portType.setQName(name);
- Binding binding = definitionGenerator.createBinding(definition, portType);
- Map<String, XMLTypeHelper> helpers = new HashMap<String, XMLTypeHelper>();
- Map<QName, List<ElementInfo>> wrappers = new HashMap<QName, List<ElementInfo>>();
- for (Operation op : interfaze.getOperations()) {
- javax.wsdl.Operation operation = generateOperation(definition, op, helpers, wrappers);
- portType.addOperation(operation);
- String action = ((JavaOperation)op).getAction();
- if ((action == null || "".equals(action)) && !op.isInputWrapperStyle() && op.getInputWrapper() == null) {
- // Bare style
- action = "urn:" + op.getName();
- }
- BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition, operation, action);
- binding.addBindingOperation(bindingOp);
- }
- portType.setUndefined(false);
- definition.addPortType(portType);
- binding.setUndefined(false);
- definition.addBinding(binding);
- wsdlDefinition.setBinding(binding);
-
- // call each helper in turn to populate the wsdl.types element
- XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
-
- for (Map.Entry<XMLTypeHelper, List<DataType>> en: getDataTypes(interfaze, false, helpers).entrySet()) {
- XMLTypeHelper helper = en.getKey();
- if (helper == null) {
- continue;
- }
- List<XSDefinition> xsDefinitions = helper.getSchemaDefinitions(xsdFactory, resolver, en.getValue());
- for (XSDefinition xsDef: xsDefinitions) {
- // TUSCANY-2757 and TUSCANY-3267 - flip global wrapper elements with nillable
- // set true to be set to false. The JAXB RI seems to be generating this setting
- // incorrectly according to the JAXB spec.
- Document doc = xsDef.getDocument();
- if (doc != null) {
- NodeList nodes = doc.getFirstChild().getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++) {
- Node aNode = nodes.item(i);
- if (aNode.getLocalName() != null && aNode.getLocalName().equals("element")) {
- NamedNodeMap attributes = aNode.getAttributes();
- Node nameAttr = attributes.getNamedItem("name");
- if (nameAttr != null) {
- QName elementName = new QName(xsDef.getNamespace(), nameAttr.getNodeValue());
- if (wrappers.containsKey(elementName)) {
- Node nillable = attributes.getNamedItem("nillable");
- if (nillable != null) {
- nillable.setNodeValue("false");
- }
- }
- }
- }
- }
- }
- addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
- }
- }
-
- // remove global wrapper elements with schema definitions from generation list
- for (QName wrapperName: new HashSet<QName>(wrappers.keySet())) {
- if (wsdlDefinition.getXmlSchemaElement(wrapperName) != null) {
- wrappers.remove(wrapperName);
- }
- }
-
- // generate schema elements for wrappers that aren't defined in the schemas
- if (wrappers.size() > 0) {
- int i = 0;
- int index = 0;
- Map<String, XSDefinition> wrapperXSDs = new HashMap<String, XSDefinition>();
- Map<Element, Map<String, String>> prefixMaps = new HashMap<Element, Map<String, String>>();
- for (Map.Entry<QName, List<ElementInfo>> entry: wrappers.entrySet()) {
- String targetNS = entry.getKey().getNamespaceURI();
- Document schemaDoc = null;
- Element schema = null;
- XSDefinition xsDef = wrapperXSDs.get(targetNS);
- if (xsDef != null) {
- schemaDoc = xsDef.getDocument();
- schema = schemaDoc.getDocumentElement();
- } else {
- schemaDoc = createDocument();
- schema = schemaDoc.createElementNS(SCHEMA_NS, "xs:schema");
- // The elementFormDefault should be set to unqualified, see TUSCANY-2388
- schema.setAttribute("elementFormDefault", "unqualified");
- schema.setAttribute("attributeFormDefault", "qualified");
- schema.setAttribute("targetNamespace", targetNS);
- schema.setAttributeNS(XMLNS_NS, "xmlns:xs", SCHEMA_NS);
- schemaDoc.appendChild(schema);
- Schema schemaExt = createSchemaExt(definition);
- schemaExt.setElement(schema);
- prefixMaps.put(schema, new HashMap<String, String>());
- xsDef = xsdFactory.createXSDefinition();
- xsDef.setUnresolved(true);
- xsDef.setNamespace(targetNS);
- xsDef.setDocument(schemaDoc);
- // TUSCANY-2465: Set the system id to avoid schema conflict
- xsDef.setLocation(URI.create("xsd_" + index + ".xsd"));
- index++;
- wrapperXSDs.put(targetNS, xsDef);
- }
- Element wrapper = schemaDoc.createElementNS(SCHEMA_NS, "xs:element");
- schema.appendChild(wrapper);
- wrapper.setAttribute("name", entry.getKey().getLocalPart());
- if (entry.getValue().size() == 1 && entry.getValue().get(0).getQName() == null) {
- // special case for global fault element
- QName typeName = entry.getValue().get(0).getType().getQName();
- String nsURI = typeName.getNamespaceURI();
- if ("".equals(nsURI)) {
- wrapper.setAttribute("type", typeName.getLocalPart());
- addSchemaImport(schema, "", schemaDoc);
- } else if (targetNS.equals(nsURI)) {
- wrapper.setAttribute("type", typeName.getLocalPart());
- } else if (SCHEMA_NS.equals(nsURI)) {
- wrapper.setAttribute("type", "xs:" + typeName.getLocalPart());
- } else {
- Map<String, String> prefixMap = prefixMaps.get(schema);
- String prefix = prefixMap.get(nsURI);
- if (prefix == null) {
- prefix = "ns" + i++;
- prefixMap.put(nsURI, prefix);
- schema.setAttributeNS(XMLNS_NS, "xmlns:" + prefix, nsURI);
- addSchemaImport(schema, nsURI, schemaDoc);
- }
- wrapper.setAttribute("type", prefix + ":" + typeName.getLocalPart());
- }
- } else {
- // normal wrapper containing type definition inline
- Element complexType = schemaDoc.createElementNS(SCHEMA_NS, "xs:complexType");
- wrapper.appendChild(complexType);
- if (entry.getValue().size() > 0) {
- Element sequence = schemaDoc.createElementNS(SCHEMA_NS, "xs:sequence");
- complexType.appendChild(sequence);
- for (ElementInfo element: entry.getValue()) {
- Element xsElement = schemaDoc.createElementNS(SCHEMA_NS, "xs:element");
- if (element.isMany()) {
- xsElement.setAttribute("maxOccurs", "unbounded");
- }
- xsElement.setAttribute("minOccurs", "0");
- xsElement.setAttribute("name", element.getQName().getLocalPart());
- if (element.isNillable()) {
- xsElement.setAttribute("nillable", "true");
- }
- QName typeName = element.getType().getQName();
- String nsURI = typeName.getNamespaceURI();
- if ("".equals(nsURI)) {
- xsElement.setAttribute("type", typeName.getLocalPart());
- addSchemaImport(schema, "", schemaDoc);
- } else if (SCHEMA_NS.equals(nsURI)) {
- xsElement.setAttribute("type", "xs:" + typeName.getLocalPart());
- } else {
- Map<String, String> prefixMap = prefixMaps.get(schema);
- String prefix = prefixMap.get(nsURI);
- if (prefix == null) {
- if (targetNS.equals(nsURI)) {
- prefix = "tns";
- } else {
- prefix = "ns" + i++;
- addSchemaImport(schema, nsURI, schemaDoc);
- }
- prefixMap.put(nsURI, prefix);
- schema.setAttributeNS(XMLNS_NS, "xmlns:" + prefix, nsURI);
- }
- xsElement.setAttribute("type", prefix + ":" + typeName.getLocalPart());
- }
- sequence.appendChild(xsElement);
- }
- }
- }
- }
-
- // resolve XSDefinitions containing generated wrappers
- for (XSDefinition xsDef: wrapperXSDs.values()) {
- loadXSD(schemaCollection, xsDef);
- wsdlDefinition.getXmlSchemas().add(xsDef);
- }
- }
-
- return definition;
- }
-
- private static void addSchemaImport(Element schema, String nsURI, Document schemaDoc) {
- Element imp = schemaDoc.createElementNS(SCHEMA_NS, "xs:import");
- if (!"".equals(nsURI)) {
- imp.setAttribute("namespace", nsURI);
- }
- // Scan all xs:import elements to match namespace
- NodeList childNodes = schema.getElementsByTagNameNS(SCHEMA_NS, "import");
- for (int i = 0; i < childNodes.getLength(); i++) {
- Node childNode = childNodes.item(i);
- if (childNode instanceof Element) {
- String ns = ((Element)childNode).getAttributeNS(SCHEMA_NS, "namespace");
- if (nsURI.equals(ns)) {
- // The xs:import with the same namespace has been declared
- return;
- }
- }
- }
- // Try to find the first node after the import elements
- Node firstNodeAfterImport = null;
- if (childNodes.getLength() > 0) {
- firstNodeAfterImport = childNodes.item(childNodes.getLength() - 1).getNextSibling();
- } else {
- firstNodeAfterImport = schema.getFirstChild();
- }
-
- if (firstNodeAfterImport == null) {
- schema.appendChild(imp);
- } else {
- schema.insertBefore(imp, firstNodeAfterImport);
- }
- }
-
- private void addSchemaExtension(XSDefinition xsDef,
- XmlSchemaCollection schemaCollection,
- WSDLDefinition wsdlDefinition,
- Definition definition) throws WSDLException {
- if (xsDef.getAggregatedDefinitions() != null) {
- for (XSDefinition xsd: xsDef.getAggregatedDefinitions()) {
- addSchemaExtension(xsd, schemaCollection, wsdlDefinition, definition);
- }
- } else {
- String nsURI = xsDef.getNamespace();
- Document document = xsDef.getDocument();
- if (document == null) {
- try {
- NamespaceMap prefixMap = new NamespaceMap();
- prefixMap.add("xs", SCHEMA_NS);
- prefixMap.add("tns", nsURI);
- XmlSchema schemaDef = xsDef.getSchema();
- schemaDef.setNamespaceContext(prefixMap);
- Document[] docs = schemaDef.getAllSchemas();
- document = docs[docs.length-1];
- document.setDocumentURI(xsDef.getLocation().toString());
- xsDef.setDocument(document);
- } catch (XmlSchemaException e) {
- throw new RuntimeException(e);
- }
- }
- loadXSD(schemaCollection, xsDef);
- wsdlDefinition.getXmlSchemas().add(xsDef);
- Element schema = document.getDocumentElement();
- Schema schemaExt = createSchemaExt(definition);
- schemaExt.setDocumentBaseURI(document.getDocumentURI());
- schemaExt.setElement(schema);
- }
- }
-
- private static void loadXSD(XmlSchemaCollection schemaCollection, XSDefinition definition) {
- if (definition.getSchema() != null) {
- return;
- }
- if (definition.getDocument() != null) {
- String uri = null;
- if (definition.getLocation() != null) {
- uri = definition.getLocation().toString();
- }
- XmlSchema schema = schemaCollection.read(definition.getDocument(), uri, null);
- if (definition.getSchemaCollection() == null) {
- definition.setSchemaCollection(schemaCollection);
- }
- if (definition.getSchema() == null) {
- definition.setSchema(schema);
- }
- }
- }
-
- public Schema createSchemaExt(Definition definition) throws WSDLException {
- Types types = definition.getTypes();
- if (types == null) {
- types = definition.createTypes();
- definition.setTypes(types);
- }
-
- Schema schemaExt = createSchema(definition);
- types.addExtensibilityElement(schemaExt);
-
- return schemaExt;
- }
-
- public Schema createSchema(Definition definition) throws WSDLException {
- return (Schema)definition.getExtensionRegistry().createExtension(Types.class, SCHEMA_QNAME);
- }
-
- private DocumentBuilderFactory documentBuilderFactory;
-
- public Document createDocument() {
- Document document;
- try {
- if (documentBuilderFactory == null) {
- documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setNamespaceAware(true);
- }
- document = documentBuilderFactory.newDocumentBuilder().newDocument();
- } catch (ParserConfigurationException ex) {
- throw new WSDLGenerationException(ex);
- }
- // document.setDocumentURI("http://");
- return document;
- }
-
- protected QName getQName(Interface interfaze) {
- JavaInterface iface = (JavaInterface)interfaze;
- QName qname = iface.getQName();
- if (qname != null) {
- return qname;
- } else {
- Class<?> javaClass = iface.getJavaClass();
- return new QName(JavaXMLMapper.getNamespace(javaClass), javaClass.getSimpleName(), "tns");
- }
- }
-
- public javax.wsdl.Operation generateOperation(Definition definition,
- Operation op,
- Map<String, XMLTypeHelper> helpers,
- Map<QName, List<ElementInfo>> wrappers)
- throws WSDLException {
- javax.wsdl.Operation operation = definition.createOperation();
- operation.setName(op.getName());
- operation.setUndefined(false);
-
- Input input = definition.createInput();
- Message inputMsg = definition.createMessage();
- String namespaceURI = definition.getQName().getNamespaceURI();
- QName inputMsgName = new QName(namespaceURI, op.getName());
- inputMsg.setQName(inputMsgName);
- inputMsg.setUndefined(false);
- definition.addMessage(inputMsg);
-
- List<ElementInfo> elements = null;
- // FIXME: By default, java interface is mapped to doc-lit-wrapper style WSDL
- if (op.getInputWrapper() != null) {
- // Generate doc-lit-wrapper style
- inputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, true));
- } else {
- // Bare style
- int i = 0;
- for (DataType d : op.getInputType().getLogical()) {
- inputMsg.addPart(generatePart(definition, d, "arg" + i));
- elements = new ArrayList<ElementInfo>();
- ElementInfo element = getElementInfo(d.getPhysical(), d, null, helpers);
- elements.add(element);
- QName elementName = ((XMLType)d.getLogical()).getElementName();
- wrappers.put(elementName, elements);
- i++;
- }
- }
- input.setMessage(inputMsg);
- operation.setInput(input);
-
- if (!op.isNonBlocking()) {
- Output output = definition.createOutput();
- Message outputMsg = definition.createMessage();
- QName outputMsgName = new QName(namespaceURI, op.getName() + "Response");
- outputMsg.setQName(outputMsgName);
- outputMsg.setUndefined(false);
- definition.addMessage(outputMsg);
-
- if (op.getOutputWrapper() != null) {
- outputMsg.addPart(generateWrapperPart(definition, op, helpers, wrappers, false));
- } else {
- DataType outputType = op.getOutputType();
- if (outputType != null) {
- outputMsg.addPart(generatePart(definition, outputType, "return"));
- elements = new ArrayList<ElementInfo>();
- ElementInfo element = getElementInfo(outputType.getPhysical(), outputType, null, helpers);
- elements.add(element);
- QName elementName = ((XMLType)outputType.getLogical()).getElementName();
- wrappers.put(elementName, elements);
- }
- }
- output.setMessage(outputMsg);
-
- operation.setOutput(output);
- operation.setStyle(OperationType.REQUEST_RESPONSE);
- } else {
- operation.setStyle(OperationType.ONE_WAY);
- }
-
- for (DataType<DataType> faultType: op.getFaultTypes()) {
- Fault fault = definition.createFault();
- QName faultName = ((XMLType)faultType.getLogical().getLogical()).getElementName();
- fault.setName(faultName.getLocalPart());
- Message faultMsg = definition.getMessage(faultName);
- if (faultMsg == null) {
- faultMsg = definition.createMessage();
- faultMsg.setQName(faultName);
- faultMsg.setUndefined(false);
- definition.addMessage(faultMsg);
- faultMsg.addPart(generatePart(definition, faultType.getLogical(), faultName.getLocalPart()));
- }
- fault.setMessage(faultMsg);
- operation.addFault(fault);
- if (faultType.getLogical().getPhysical() != faultType.getPhysical()) {
- // create special wrapper for type indirection to real fault bean
- DataType logical = faultType.getLogical();
- elements = new ArrayList<ElementInfo>();
- elements.add(getElementInfo(logical.getPhysical(), logical, null, helpers));
- } else {
- // convert synthesized fault bean to a wrapper type
- for (DataType<XMLType> propDT: op.getFaultBeans().get(faultName)) {
- XMLType logical = propDT.getLogical();
- elements = new ArrayList<ElementInfo>();
- elements.add(getElementInfo(propDT.getPhysical(), propDT, logical.getElementName(), helpers));
- }
- }
- wrappers.put(faultName, elements);
- }
-
- operation.setUndefined(false);
- return operation;
- }
-
- public Part generatePart(Definition definition, DataType arg, String partName) {
- Part part = definition.createPart();
- part.setName(partName);
- if (arg != null && arg.getLogical() instanceof XMLType) {
- XMLType xmlType = (XMLType)arg.getLogical();
- QName elementName = xmlType.getElementName();
- part.setElementName(elementName);
- addNamespace(definition, elementName);
- if (xmlType.getElementName() == null) {
- QName typeName = xmlType.getTypeName();
- part.setTypeName(typeName);
- addNamespace(definition, typeName);
- }
- }
- return part;
- }
-
- public Part generateWrapperPart(Definition definition,
- Operation operation,
- Map<String, XMLTypeHelper> helpers,
- Map<QName, List<ElementInfo>> wrappers,
- boolean input) throws WSDLException {
- Part part = definition.createPart();
- String partName = input ? operation.getName() : (operation.getName() + "Response");
- part.setName(partName);
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- if ((inputWrapperInfo != null) && (outputWrapperInfo != null)) {
- ElementInfo elementInfo =
- input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
- List<ElementInfo> elements =
- input ? inputWrapperInfo.getChildElements() : outputWrapperInfo.getChildElements();
- QName wrapperName = elementInfo.getQName();
- part.setElementName(wrapperName);
- addNamespace(definition, wrapperName);
- wrappers.put(wrapperName, elements);
-
- // FIXME: [rfeng] Ideally, we should try to register the wrappers only. But we are
- // expriencing the problem that we cannot handle XSD imports
- /*
- Class<?> wrapperClass = input ? opWrapper.getInputWrapperClass() : opWrapper.getOutputWrapperClass();
- DataType wrapperDT = input ? opWrapper.getInputWrapperType() : opWrapper.getOutputWrapperType();
- if (wrapperClass != null) {
- getElementInfo(wrapperClass, wrapperDT, wrapperName, helpers);
- return part;
- }
- */
-
- Method method = ((JavaOperation)operation).getJavaMethod();
- if (input) {
- Class<?>[] paramTypes = method.getParameterTypes();
- for (int i = 0; i < paramTypes.length; i++) {
- DataType dataType = operation.getInputType().getLogical().get(i);
- elements.set(i, getElementInfo(paramTypes[i], dataType, elements.get(i).getQName(), helpers));
- }
- } else {
- Class<?> returnType = method.getReturnType();
- if (returnType != Void.TYPE) {
- DataType dataType = operation.getOutputType();
- elements.set(0, getElementInfo(returnType, dataType, elements.get(0).getQName(), helpers));
- }
- }
- }
- return part;
- }
-
- private ElementInfo getElementInfo(Class javaType,
- DataType dataType,
- QName name,
- Map<String, XMLTypeHelper> helpers) {
- String db = dataType.getDataBinding();
- while ("java:array".equals(db)) {
- dataType = (DataType)dataType.getLogical();
- db = dataType.getDataBinding();
- }
- XMLTypeHelper helper = helpers.get(db);
- if (helper == null) {
- DataBinding dataBinding = dataBindings.getDataBinding(db);
- if (dataBinding == null) {
- QName element = name;
- if (element == null || dataType.getLogical() instanceof XMLType) {
- XMLType xmlType = (XMLType)dataType.getLogical();
- if (xmlType.getElementName() != null) {
- element = xmlType.getElementName();
- }
- }
- return new ElementInfo(element, new TypeInfo(ANYTYPE_QNAME, false, null));
- // throw new ServiceRuntimeException("No data binding for " + db);
- }
-
- helper = dataBinding.getXMLTypeHelper();
- if (helper == null) {
- // Default to JAXB
- helper = helpers.get(JAXBDataBinding.NAME);
- if (helper == null) {
- helper = dataBindings.getDataBinding(JAXBDataBinding.NAME).getXMLTypeHelper();
- helpers.put(JAXBDataBinding.NAME, helper);
- }
- }
- helpers.put(db, helper);
- }
- TypeInfo typeInfo = helper.getTypeInfo(javaType.isArray() ? javaType.getComponentType() : javaType,
- dataType.getLogical());
- ElementInfo element = new ElementInfo(name, typeInfo);
- element.setMany(byte[].class != javaType && javaType.isArray());
- element.setNillable(!javaType.isPrimitive());
- return element;
- }
-
- private static void addNamespace(Definition definition, QName name) {
- String namespace = name.getNamespaceURI();
- if (definition.getPrefix(namespace) == null) {
- definition.addNamespace("ns" + definition.getNamespaces().size(), namespace);
- }
- }
-
- /*
- // currently not using the next three methods
- public XmlSchemaType getXmlSchemaType(DataType type) {
- return null;
- }
-
- // FIXME: WE need to add databinding-specific Java2XSD generation
- public Element generateXSD(DataType dataType) {
- DataBinding dataBinding = dataBindings.getDataBinding(dataType.getDataBinding());
- if (dataBinding != null) {
- // return dataBinding.generateSchema(dataType);
- }
- return null;
- }
-
- public void generateWrapperElements(Operation op) {
- XmlSchemaCollection collection = new XmlSchemaCollection();
- String ns = getQName(op.getInterface()).getNamespaceURI();
- XmlSchema schema = new XmlSchema(ns, collection);
- schema.setAttributeFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
- schema.setElementFormDefault(new XmlSchemaForm(XmlSchemaForm.QUALIFIED));
-
- XmlSchemaElement inputElement = new XmlSchemaElement();
- inputElement.setQName(new QName(ns, op.getName()));
- XmlSchemaComplexType inputType = new XmlSchemaComplexType(schema);
- inputType.setName("");
- XmlSchemaSequence inputSeq = new XmlSchemaSequence();
- inputType.setParticle(inputSeq);
- List<DataType> argTypes = op.getInputType().getLogical();
- for (DataType argType : argTypes) {
- XmlSchemaElement child = new XmlSchemaElement();
- Object logical = argType.getLogical();
- if (logical instanceof XMLType) {
- child.setName(((XMLType)logical).getElementName().getLocalPart());
- XmlSchemaType type = getXmlSchemaType(argType);
- child.setType(type);
- }
- inputSeq.getItems().add(child);
- }
- inputElement.setType(inputType);
-
- XmlSchemaElement outputElement = new XmlSchemaElement();
- outputElement.setQName(new QName(ns, op.getName() + "Response"));
- XmlSchemaComplexType outputType = new XmlSchemaComplexType(schema);
- outputType.setName("");
- XmlSchemaSequence outputSeq = new XmlSchemaSequence();
- outputType.setParticle(outputSeq);
- DataType returnType = op.getOutputType();
- XmlSchemaElement child = new XmlSchemaElement();
- Object logical = returnType.getLogical();
- if (logical instanceof XMLType) {
- child.setName(((XMLType)logical).getElementName().getLocalPart());
- XmlSchemaType type = getXmlSchemaType(returnType);
- child.setType(type);
- }
- outputSeq.getItems().add(child);
- outputElement.setType(outputType);
-
- schema.getElements().add(inputElement.getQName(), inputElement);
- schema.getElements().add(outputElement.getQName(), outputElement);
-
- }
- */
-
- public WSDLFactory getFactory() {
- return factory;
- }
-
- public void setFactory(WSDLFactory factory) {
- this.factory = factory;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
deleted file mode 100644
index 989a12d43c..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-import java.util.Iterator;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingFault;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPFault;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.extensions.soap12.SOAP12Binding;
-import javax.wsdl.extensions.soap12.SOAP12Body;
-import javax.wsdl.extensions.soap12.SOAP12Fault;
-import javax.wsdl.extensions.soap12.SOAP12Operation;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-
-/**
- *
- * @version $Rev: 668025 $ $Date: 2008-06-16 01:06:34 +0100 (Mon, 16 Jun 2008) $
- */
-public class WSDLDefinitionGenerator {
- private static final String SOAP_NS = "http://schemas.xmlsoap.org/wsdl/soap/";
- public static final QName SOAP_ADDRESS = new QName(SOAP_NS, "address");
- private static final QName SOAP_BINDING = new QName(SOAP_NS, "binding");
- private static final QName SOAP_BODY = new QName(SOAP_NS, "body");
- private static final QName SOAP_FAULT = new QName(SOAP_NS, "fault");
- private static final QName SOAP_OPERATION = new QName(SOAP_NS, "operation");
- private static final String SOAP12_NS = "http://schemas.xmlsoap.org/wsdl/soap12/";
- public static final QName SOAP12_ADDRESS = new QName(SOAP12_NS, "address");
- private static final QName SOAP12_BINDING = new QName(SOAP12_NS, "binding");
- private static final QName SOAP12_BODY = new QName(SOAP12_NS, "body");
- private static final QName SOAP12_FAULT = new QName(SOAP12_NS, "fault");
- private static final QName SOAP12_OPERATION = new QName(SOAP12_NS, "operation");
-
- private static final String BINDING_SUFFIX = "Binding";
- private static final String SERVICE_SUFFIX = "Service";
- private static final String PORT_SUFFIX = "Port";
-
- private boolean requiresSOAP12;
- private boolean requiresJMS;
- private QName soapAddress;
- private QName soapBinding;
- private QName soapBody;
- private QName soapFault;
- private QName soapOperation;
-
- public WSDLDefinitionGenerator(boolean requiresSOAP12, boolean requiresJMS) {
- super();
- this.requiresSOAP12 = requiresSOAP12;
- this.requiresJMS = requiresJMS;
- soapAddress = requiresSOAP12 ? SOAP12_ADDRESS : SOAP_ADDRESS;
- soapBinding = requiresSOAP12 ? SOAP12_BINDING : SOAP_BINDING;
- soapBody = requiresSOAP12 ? SOAP12_BODY : SOAP_BODY;
- soapFault = requiresSOAP12 ? SOAP12_FAULT : SOAP_FAULT;
- soapOperation = requiresSOAP12 ? SOAP12_OPERATION : SOAP_OPERATION;
- }
-
- public Definition cloneDefinition(WSDLFactory factory, Definition definition) throws WSDLException {
- Element root = definition.getDocumentationElement();
- root = (Element)root.cloneNode(true);
- WSDLReader reader = factory.newWSDLReader();
- return reader.readWSDL(definition.getDocumentBaseURI(), root);
- }
-
- public Types createTypes(Definition definition) {
- Types types = definition.createTypes();
- definition.setTypes(types);
- return types;
- }
-
- public Binding createBinding(Definition definition, PortType portType) {
- try {
- Binding binding = definition.createBinding();
- binding.setPortType(portType);
- configureBinding(definition, binding, portType);
- ExtensibilityElement bindingExtension =
- definition.getExtensionRegistry().createExtension(Binding.class, soapBinding);
- if (requiresSOAP12) {
- ((SOAP12Binding)bindingExtension).setStyle("document");
- if (requiresJMS){
- ((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms");
- } else {
- ((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
- }
- } else {
- ((SOAPBinding)bindingExtension).setStyle("document");
- if (requiresJMS){
- ((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms");
- } else {
- ((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http");
- }
- }
- binding.addExtensibilityElement(bindingExtension);
- return binding;
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
-
- protected void configureBinding(Definition definition, Binding binding, PortType portType) throws WSDLException {
- QName portTypeName = portType.getQName();
- if (portTypeName != null) {
- // Choose <porttype>Binding if available. If this name is in use, insert
- // separating underscores until there is no clash.
- for (String suffix = BINDING_SUFFIX; ; suffix = "_" + suffix) {
- QName name = new QName(definition.getTargetNamespace(), portTypeName.getLocalPart() + suffix);
- if (definition.getBinding(name) == null) {
- binding.setQName(name);
- break;
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public void createBindingOperations(Definition definition, Binding binding, PortType portType) {
- try {
- for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) {
- Operation operation = (Operation)oi.next();
- BindingOperation bindingOperation =
- createBindingOperation(definition, operation, "urn:" + operation.getName());
- binding.addBindingOperation(bindingOperation);
- }
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- public BindingOperation createBindingOperation(Definition definition, Operation operation, String action)
- throws WSDLException {
- BindingOperation bindingOperation = definition.createBindingOperation();
- bindingOperation.setOperation(operation);
- configureBindingOperation(bindingOperation, operation);
- ExtensibilityElement operationExtension =
- definition.getExtensionRegistry().createExtension(BindingOperation.class, soapOperation);
- if (requiresSOAP12) {
- ((SOAP12Operation)operationExtension).setSoapActionURI(action);
- } else {
- ((SOAPOperation)operationExtension).setSoapActionURI(action);
- }
- bindingOperation.addExtensibilityElement(operationExtension);
- if (operation.getInput() != null) {
- BindingInput bindingInput = definition.createBindingInput();
- configureBindingInput(bindingInput, operation.getInput());
- ExtensibilityElement inputExtension =
- definition.getExtensionRegistry().createExtension(BindingInput.class, soapBody);
- if (requiresSOAP12) {
- ((SOAP12Body)inputExtension).setUse("literal");
- } else {
- ((SOAPBody)inputExtension).setUse("literal");
- }
- bindingInput.addExtensibilityElement(inputExtension);
- bindingOperation.setBindingInput(bindingInput);
- }
- if (operation.getOutput() != null) {
- BindingOutput bindingOutput = definition.createBindingOutput();
- configureBindingOutput(bindingOutput, operation.getOutput());
- ExtensibilityElement outputExtension =
- definition.getExtensionRegistry().createExtension(BindingOutput.class, soapBody);
- if (requiresSOAP12) {
- ((SOAP12Body)outputExtension).setUse("literal");
- } else {
- ((SOAPBody)outputExtension).setUse("literal");
- }
- bindingOutput.addExtensibilityElement(outputExtension);
- bindingOperation.setBindingOutput(bindingOutput);
- }
- for (Iterator fi = operation.getFaults().values().iterator(); fi.hasNext();) {
- Fault fault = (Fault)fi.next();
- BindingFault bindingFault = definition.createBindingFault();
- ExtensibilityElement faultExtension =
- definition.getExtensionRegistry().createExtension(BindingFault.class, soapFault);
- configureBindingFault(bindingFault, faultExtension, fault);
- bindingFault.addExtensibilityElement(faultExtension);
- bindingOperation.addBindingFault(bindingFault);
- }
- return bindingOperation;
- }
-
- protected void configureBindingOperation(BindingOperation bindingOperation, Operation operation)
- throws WSDLException {
- bindingOperation.setName(operation.getName());
- }
-
- protected void configureBindingInput(BindingInput bindingInput, Input input) throws WSDLException {
- bindingInput.setName(input.getName());
- }
-
- protected void configureBindingOutput(BindingOutput bindingOutput, Output output) throws WSDLException {
- bindingOutput.setName(output.getName());
- }
-
- protected void configureBindingFault(BindingFault bindingFault,
- ExtensibilityElement faultExtension,
- Fault fault)
- throws WSDLException {
- String faultName = fault.getName();
- bindingFault.setName(faultName);
- if (requiresSOAP12) {
- ((SOAP12Fault)faultExtension).setName(faultName);
- ((SOAP12Fault)faultExtension).setUse("literal");
- } else {
- ((SOAPFault)faultExtension).setName(faultName);
- ((SOAPFault)faultExtension).setUse("literal");
- }
- }
-
- public Service createService(Definition definition, PortType portType) {
- try {
- Service service = definition.createService();
- configureService(definition, service, portType);
- // createPort(definition, binding, service);
- definition.addService(service);
- return service;
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- public Service createService(Definition definition, Binding binding) {
- try {
- Service service = definition.createService();
- configureService(definition, service, binding.getPortType());
- // createPort(definition, binding, service);
- definition.addService(service);
- return service;
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- protected void configureService(Definition definition, Service service, PortType portType) throws WSDLException {
- QName portTypeName = portType.getQName();
- if (portTypeName != null) {
- // Choose <porttype>Service if available. If this name is in use, insert
- // separating underscores until there is no clash.
- for (String suffix = SERVICE_SUFFIX; ; suffix = "_" + suffix) {
- QName name = new QName(definition.getTargetNamespace(), portTypeName.getLocalPart() + suffix);
- if (definition.getService(name) == null) {
- service.setQName(name);
- break;
- }
- }
- }
- }
-
- public Port createPort(Definition definition, Binding binding, Service service, String uri) {
- try {
- Port port = definition.createPort();
- port.setBinding(binding);
- configurePort(port, binding);
- if (uri != null) {
- ExtensibilityElement portExtension =
- definition.getExtensionRegistry().createExtension(Port.class, soapAddress);
- if (requiresSOAP12) {
- ((SOAP12Address)portExtension).setLocationURI(uri);
- } else {
- ((SOAPAddress)portExtension).setLocationURI(uri);
- }
- port.addExtensibilityElement(portExtension);
- }
- service.addPort(port);
- return port;
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- protected void configurePort(Port port, Binding binding) throws WSDLException {
- if (binding.getPortType() != null && binding.getPortType().getQName() != null) {
- port.setName(binding.getPortType().getQName().getLocalPart() + PORT_SUFFIX);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLGenerationException.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLGenerationException.java
deleted file mode 100644
index bf9e22f645..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLGenerationException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-import org.apache.tuscany.sca.monitor.Problem;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class WSDLGenerationException extends ServiceRuntimeException {
- private static final long serialVersionUID = 1L;
- private Problem problem;
-
- public WSDLGenerationException() {
- super();
- }
-
- public WSDLGenerationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public WSDLGenerationException(String message) {
- super(message);
- }
-
- public WSDLGenerationException(Throwable cause) {
- super(cause);
- }
-
- public WSDLGenerationException(String message, Throwable cause, Problem problem) {
- super(message, cause);
- this.problem = problem;
- }
-
- public Problem getProblem() {
- return problem;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
deleted file mode 100644
index e57900f6cd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-//FIXME: trim the import list down to what's really needed
-
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap12.SOAP12Address;
-import javax.wsdl.extensions.soap12.SOAP12Binding;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-/**
- * WSDLServiceGenerator generates a binding WSDL service document.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLServiceGenerator {
- // the following switch is temporary for debugging
- public static boolean printWSDL; // external code sets this to print generated WSDL
-
- private static final Logger logger = Logger.getLogger(WSDLServiceGenerator.class.getName());
- private static final QName TRANSPORT_JMS_QUALIFIED_INTENT =
- new QName("http://www.osoa.org/xmlns/sca/1.0", "transport.jms");
- private static final String DEFAULT_QUEUE_CONNECTION_FACTORY = "TuscanyQueueConnectionFactory";
- private static final String ADDRESS = "Address";
-
- private WSDLServiceGenerator() {
- // this class has static methods only and cannot be instantiated
- }
-
- /**
- * Log a warning message.
- * @param problem
- */
- private static void logWarning(Problem problem) {
- Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
- if (problemLogger != null){
- problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null, problem.getMessageId(), problem.getMessageParams());
- } else {
- logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
- }
- }
-
- /**
- * Report a warning.
- * @param message
- * @param binding
- * @param parameters
- */
- private static void warning(Monitor monitor, String message, WebServiceBinding wsBinding, String... messageParameters) {
- Problem problem = new ProblemImpl(WSDLServiceGenerator.class.getName(), "wsdlgen-validation-messages", Severity.WARNING, wsBinding, message, (Object[])messageParameters);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- logWarning(problem);
- }
- }
-
- /**
- * Report an error.
- * @param message
- * @param binding
- * @param parameters
- */
- private static void error(Monitor monitor, String message, WebServiceBinding wsBinding, String... messageParameters) {
- Problem problem = new ProblemImpl(WSDLServiceGenerator.class.getName(), "wsdlgen-validation-messages", Severity.ERROR, wsBinding, message, (Object[])messageParameters);
- if (monitor != null) {
- monitor.problem(problem);
- } else {
- throw new WSDLGenerationException(problem.toString(), null, problem);
- }
- }
-
- /**
- * Generate a suitably configured WSDL definition
- */
- protected static Definition configureWSDLDefinition(WebServiceBinding wsBinding,
- Component component,
- AbstractContract contract,
- Monitor monitor) {
-
- //[nash] changes to the builder sequence avoid calling this for a CompositeService
- assert !(contract instanceof CompositeService);
- /*
- // For every promoted composite service, the underlying component
- // gets a copy of the service with the name prefixed by "$promoted$."
- String contractName = (contract instanceof CompositeService ? "$promoted$." : "") + contract.getName();
- */
- String contractName = contract.getName();
-
- List<Port> ports = new ArrayList<Port>();
- WSDLDefinition wsdlDefinition = wsBinding.getWSDLDefinition();
- if (wsdlDefinition == null) {
- error(monitor, "NoWsdlInterface", wsBinding, component.getName(), contract.getName());
- return null;
- }
- Definition def = wsdlDefinition.getDefinition();
-
- boolean wsdlProvidedByUser = (wsdlDefinition.getBinding() == null);
-
- if (wsdlProvidedByUser) {
- // The WSDL document was provided by the user. Generate a new
- // WSDL document with imports from the user-provided document.
- WSDLFactory factory = null;
- try {
- factory = WSDLFactory.newInstance();
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- Definition newDef = factory.newDefinition();
-
- // Construct a target namespace from the base URI of the user's
- // WSDL document (is this what we should be using?) and a path
- // computed according to the SCA Web Service binding spec.
- String nsName = component.getName() + "/" + contractName;
- String namespaceURI = null;
- try {
- URI userTNS = new URI(def.getTargetNamespace());
- namespaceURI = userTNS.resolve("/" + nsName).toString();
- } catch (URISyntaxException e1) {
- throw new WSDLGenerationException(e1);
- } catch (IllegalArgumentException e2) {
- throw new WSDLGenerationException(e2);
- }
-
- // set name and targetNamespace attributes on the definition
- String defsName = component.getName() + "." + contractName;
- newDef.setQName(new QName(namespaceURI, defsName));
- newDef.setTargetNamespace(namespaceURI);
- newDef.addNamespace("tns", namespaceURI);
-
- // set wsdl namespace prefix on the definition
- newDef.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
-
- // import the service or reference interface portType
- List<WSDLDefinition> imports = new ArrayList<WSDLDefinition>();
- Interface interfaze = wsBinding.getBindingInterfaceContract().getInterface();
- if (interfaze instanceof WSDLInterface) {
- PortType portType = ((WSDLInterface)interfaze).getPortType();
- boolean ok = importPortType(portType, wsdlDefinition, newDef, imports);
- if (!ok) {
- error(monitor, "PortTypeNotFound", wsBinding, portType.getQName().toString(),
- component.getName(), contract.getName());
- }
- }
-
- // import an existing binding if specified
- Binding binding = wsBinding.getBinding();
- if (binding != null) {
- boolean ok = importBinding(binding, wsdlDefinition, newDef, imports);
- if (ok) {
- boolean ok2 = importPortType(binding.getPortType(), wsdlDefinition, newDef, imports);
- if (!ok2) {
- error(monitor, "PortTypeNotFound", wsBinding, binding.getPortType().getQName().toString(),
- component.getName(), contract.getName());
- }
- } else {
- error(monitor, "BindingNotFound", wsBinding, binding.getQName().toString(),
- component.getName(), contract.getName());
- }
- }
-
- // import bindings and portTypes needed by services and ports
- QName serviceQName = wsBinding.getServiceName();
- String portName = wsBinding.getPortName();
- if (serviceQName != null) {
- Service service = def.getService(serviceQName);
- if (portName != null) {
- Port port = service.getPort(portName);
- Port newPort = copyPort(newDef, port, wsBinding);
- if (newPort != null) {
- importBinding(port.getBinding(), wsdlDefinition, newDef, imports);
- ports.add(newPort);
- } else {
- error(monitor, "InvalidPort", wsBinding, serviceQName.toString(), portName,
- component.getName(), contract.getName());
- }
- } else {
- for (Object port : service.getPorts().values()) {
- Port newPort = copyPort(newDef, (Port)port, wsBinding);
- if (newPort != null) {
- importBinding(((Port)port).getBinding(), wsdlDefinition, newDef, imports);
- ports.add(newPort);
- } else {
- // not an error, just ignore the port
- warning(monitor, "IgnoringPort", wsBinding, serviceQName.toString(), ((Port)port).getName(),
- component.getName(), contract.getName());
- }
- }
- if (ports.size() == 0) {
- error(monitor, "NoValidPorts", wsBinding, serviceQName.toString(),
- component.getName(), contract.getName());
- }
- }
- }
-
- // replace original WSDL definition by the generated definition
- def = newDef;
-
- } else {
- // The WSDL definition was generated by Interface2WSDLGenerator.
- // Reuse it instead of creating a new definition here.
- }
-
- // add a service and ports to the generated definition
- WSDLDefinitionGenerator helper =
- new WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),false);
- WSDLInterface wi = (WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface();
- PortType portType = wi.getPortType();
- Service service = helper.createService(def, portType);
- if (wsBinding.getBinding() == null && ports.size() == 0) {
- Binding binding = helper.createBinding(def, portType);
- if (BindingWSDLGenerator.requiresSOAP12(wsBinding)) {
- def.addNamespace("SOAP12", "http://schemas.xmlsoap.org/wsdl/soap12/");
- } else {
- def.addNamespace("SOAP11", "http://schemas.xmlsoap.org/wsdl/soap/");
- }
- helper.createBindingOperations(def, binding, portType);
- binding.setUndefined(false);
- def.addBinding(binding);
-
- String endpointURI = computeActualURI(wsBinding, null);
- Port port = helper.createPort(def, binding, service, endpointURI);
- wsBinding.setService(service);
- wsBinding.setPort(port);
- } else {
- if (ports.size() > 0) {
- // there are one or more user-specified valid ports
- for (Port port : ports) {
- service.addPort(port);
- }
- if (ports.size() == 1) {
- // only one port, so use it
- wsBinding.setPort(ports.get(0));
- } else {
- // multiple ports, make them all available
- wsBinding.setPort(null);
- }
- } else {
- // no valid user-specified ports, so create a suitably configured port
- String endpointURI = computeActualURI(wsBinding, null);
- Port port = helper.createPort(def, wsBinding.getBinding(), service, endpointURI);
- if (BindingWSDLGenerator.requiresSOAP12(wsBinding)) {
- def.addNamespace("SOAP12", "http://schemas.xmlsoap.org/wsdl/soap12/");
- } else {
- def.addNamespace("SOAP11", "http://schemas.xmlsoap.org/wsdl/soap/");
- }
- wsBinding.setPort(port);
- }
- wsBinding.setService(service);
- }
-
- // TUSCANY-2900 - add jms binding and service port if required
- // TODO - remove service/ports from any imported WSDL
- // - find away to allow users to retrieve WSDL with JMS bindings
- // as a jms binding on it's own provides not target for ?wsdl
- if ((!wsdlProvidedByUser) &&
- (wsBinding.getURI() != null) &&
- (wsBinding.getURI().startsWith("jms"))){
-
- // need to work out how to check if user has already specified a binding
-
- // create jms binding
- helper = new WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),true);
- Binding binding = helper.createBinding(def, portType);
- helper.createBindingOperations(def, binding, portType);
- binding.setUndefined(false);
- def.addBinding(binding);
-
- // create a jms port
- String endpointURI = computeActualURI(wsBinding, null);
- Port port = helper.createPort(def, binding, service, endpointURI);
- wsBinding.setService(service);
- wsBinding.setPort(port);
-
- //printWSDL = true;
- }
-
- // for debugging
- if (printWSDL) {
- try {
- System.out.println("Generated WSDL for " + component.getName() + "/" + contractName);
- WSDLWriter writer = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
- writer.writeWSDL(def, System.out);
- } catch (WSDLException e) {
- throw new WSDLGenerationException(e);
- }
- }
-
- return def;
- }
-
- private static boolean importPortType(PortType portType,
- WSDLDefinition wsdlDef,
- Definition newDef,
- List<WSDLDefinition> imports) {
- return addImport(portType.getQName(), PortType.class, wsdlDef, newDef, imports);
- }
-
- private static boolean importBinding(Binding binding,
- WSDLDefinition wsdlDef,
- Definition newDef,
- List<WSDLDefinition> imports) {
- boolean ok = addImport(binding.getQName(), Binding.class, wsdlDef, newDef, imports);
- if (ok) {
- List bindingExtensions = binding.getExtensibilityElements();
- for (final Object extension : bindingExtensions) {
- if (extension instanceof SOAPBinding) {
- newDef.addNamespace("SOAP11", "http://schemas.xmlsoap.org/wsdl/soap/");
- }
- if (extension instanceof SOAP12Binding) {
- newDef.addNamespace("SOAP12", "http://schemas.xmlsoap.org/wsdl/soap12/");
- }
- }
- }
- return ok;
- }
-
- private static boolean addImport(QName name,
- Class type,
- WSDLDefinition wsdlDef,
- Definition newDef,
- List<WSDLDefinition> imports) {
- String namespace = name.getNamespaceURI();
- if (newDef.getImports(namespace) == null) {
- WSDLDefinition impDef = findDefinition(wsdlDef, name, type);
- if (impDef != null) {
- Import imp = newDef.createImport();
- imp.setNamespaceURI(namespace);
- imp.setLocationURI(impDef.getURI().toString());
- imp.setDefinition(impDef.getDefinition());
- newDef.addNamespace("ns" + imports.size(), namespace);
- newDef.addImport(imp);
- imports.add(impDef);
- return true;
- } else {
- // import was not added because element not found
- return false;
- }
- }
- return true;
- }
-
- private static WSDLDefinition findDefinition(WSDLDefinition wsdlDef, QName name, Class type) {
- if (wsdlDef == null || name == null) {
- return wsdlDef;
- }
- if (wsdlDef.getURI() != null) { // not a facade
- Definition def = wsdlDef.getDefinition();
- Map types = type == PortType.class ? def.getPortTypes() : def.getBindings();
- if (types.get(name) != null) {
- return wsdlDef;
- }
- }
- for (WSDLDefinition impDef : wsdlDef.getImportedDefinitions()) {
- WSDLDefinition d = findDefinition(impDef, name, type);
- if (d != null) {
- return d;
- }
- }
- return null;
- }
-
- private static Port copyPort(Definition def, Port port, WebServiceBinding wsBinding) {
- Port newPort = def.createPort();
- newPort.setName(port.getName());
- newPort.setBinding(port.getBinding());
- List portExtensions = port.getExtensibilityElements();
- for (final Object extension : portExtensions) {
- ExtensibilityElement newExt = null;
- if (extension instanceof SOAPAddress) {
- def.addNamespace("SOAP11", "http://schemas.xmlsoap.org/wsdl/soap/");
- try {
- newExt = def.getExtensionRegistry().createExtension(
- Port.class, WSDLDefinitionGenerator.SOAP_ADDRESS);
- } catch (WSDLException e) {
- }
- String uri = computeActualURI(wsBinding, port);
- ((SOAPAddress)newExt).setLocationURI(uri);
- newPort.addExtensibilityElement(newExt);
- } else if (extension instanceof SOAP12Address) {
- def.addNamespace("SOAP12", "http://schemas.xmlsoap.org/wsdl/soap12/");
- try {
- newExt = def.getExtensionRegistry().createExtension(
- Port.class, WSDLDefinitionGenerator.SOAP12_ADDRESS);
- } catch (WSDLException e) {
- }
- String uri = computeActualURI(wsBinding, port);
- ((SOAP12Address)newExt).setLocationURI(uri);
- newPort.addExtensibilityElement(newExt);
- } else {
- // we don't support ports with other extensibility elements such as HTTPAddress
- return null;
- }
- }
- return newPort;
- }
-
- /**
- * Compute the endpoint URI based on section 2.1.1 of the WS binding Specification 1.
- * The URIs in the endpoint(s) of the referenced WSDL, which may be relative
- * 2. The URI specified by the wsa:Address element of the
- * wsa:EndpointReference, which may be relative 3. The explicitly stated URI
- * in the "uri" attribute of the binding.ws element, which may be relative,
- * 4. The implicit URI as defined by in section 1.7 in the SCA Assembly Specification
- * If the <binding.ws> has no wsdlElement but does have a uri attribute then
- * the uri takes precedence over any implicitly used WSDL.
- *
- */
- private static String computeActualURI(WebServiceBinding wsBinding, Port port) {
-
- URI eprURI = null;
- if (wsBinding.getEndPointReference() != null) {
- eprURI = getEPR(wsBinding);
- }
-
- URI wsdlURI = null;
- if (wsBinding.getServiceName() != null && wsBinding.getBindingName() == null) {
- // <binding.ws> explicitly points at a WSDL port, may be a relative URI
- wsdlURI = getEndpoint(port);
- }
-
- // if the WSDL port/endpoint has an absolute URI use that
- if (wsdlURI != null && wsdlURI.isAbsolute()) {
- return wsdlURI.toString();
- }
-
- // if the wsa:EndpointReference has an address element with an absolute URI use that
- if (eprURI != null && eprURI.isAbsolute()) {
- return eprURI.toString();
- }
-
- // either there is no WSDL port endpoint URI or that URI is relative
- String actualURI = wsBinding.getURI();
- if (eprURI != null && eprURI.toString().length() != 0) {
- // there is a relative URI in the binding EPR
- actualURI = actualURI + "/" + eprURI;
- }
-
- if (wsdlURI != null && wsdlURI.toString().length() != 0) {
- // there is a relative URI in the WSDL port
- actualURI = actualURI + "/" + wsdlURI;
- }
-
- if (actualURI != null) {
- actualURI = URI.create(actualURI).normalize().toString();
- }
-
- return actualURI;
- }
-
- private static URI getEPR(WebServiceBinding wsBinding) {
- NodeList nodeList = wsBinding.getEndPointReference().getChildNodes();
- for (int i = 0; i < nodeList.getLength(); i++) {
- Node childNode = nodeList.item(i);
- if (childNode instanceof Element && ADDRESS.equals(childNode.getLocalName())) {
- NodeList addrNodes = childNode.getChildNodes();
- for (int j = 0; j < addrNodes.getLength(); j++) {
- Node addrNode = addrNodes.item(j);
- if (addrNode instanceof Text) {
- return URI.create(((Text)addrNode).getWholeText());
- }
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the endpoint of a given port.
- */
- private static URI getEndpoint(Port wsdlPort) {
- if (wsdlPort != null) {
- List<?> wsdlPortExtensions = wsdlPort.getExtensibilityElements();
- for (Object extension : wsdlPortExtensions) {
- if (extension instanceof SOAPAddress) {
- String uri = ((SOAPAddress)extension).getLocationURI();
- return (uri == null || "".equals(uri)) ? null : URI.create(uri);
- }
- if (extension instanceof SOAP12Address) {
- SOAP12Address address = (SOAP12Address)extension;
- String uri = address.getLocationURI();
- return (uri == null || "".equals(uri)) ? null : URI.create(uri);
- }
- }
- }
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties
deleted file mode 100644
index 4bfbdd2901..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/main/resources/wsdlgen-validation-messages.properties
+++ /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.
-#
-#
-WsdlGenProblem = Unable to generate WSDL for {0}/{1}
-WsdlGenException = Exception while generating WSDL for {0}/{1}
-UnexpectedException = Exception thrown was: {0}
-MissingInterfaceContract = No interface contract for {0}/{1}
-InterfaceNotRemotable = Interface not remotable: {0}
-IgnoringPort = Port {0}/{1} in {2}/{3} is not supported and was ignored
-PortTypeNotFound = PortType {0} in {1}/{2} was not found
-BindingNotFound = Binding {0} in {1}/{2} was not found
-InvalidPort = Port {0}/{1} in {2}/{3} is not supported
-NoValidPorts = No valid ports for service {0} in {1}/{2}
-NoWsdlInterface = No WSDL interface definition for {1}/{2}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/Other.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/Other.java
deleted file mode 100644
index 7e6a1de546..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/Other.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws.other;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Other {
- private String name;
-
- public String getName() {
- return name;
- }
- public void setName(String name ) {
- this.name = name;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/package-info.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/package-info.java
deleted file mode 100644
index f10a2286e6..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/other/package-info.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://other.ws.binding.sca.tuscany.apache.org/")
-package org.apache.tuscany.sca.binding.ws.other;
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.java
deleted file mode 100644
index e474c7a318..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/BindingWSDLGeneratorTestCase.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.binding.ws.wsdlgen;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.PortType;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.xml.XSDModelResolver;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BindingWSDLGeneratorTestCase extends TestCase {
-
- public void testCreateWSDLInterfaceContract() throws InvalidInterfaceException {
- DefaultModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
- WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- XSDFactory xsdFactory = modelFactories.getFactory(XSDFactory.class);
- DefaultJavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
- JavaInterfaceContract javaIC = factory.createJavaInterfaceContract();
- JavaInterface iface = factory.createJavaInterface(HelloWorld.class);
- DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint();
- JAXWSFaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, null);
- new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface);
- new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface);
- javaIC.setInterface(iface);
- WSDLInterfaceContract wsdlIC = BindingWSDLGenerator.createWSDLInterfaceContract(javaIC, false, new XSDModelResolver(null, null), dataBindings, wsdlFactory, xsdFactory, null);
- assertNotNull(wsdlIC);
- WSDLInterface wsdlInterface = (WSDLInterface)wsdlIC.getInterface();
- assertNotNull(wsdlInterface);
- assertEquals(1, wsdlInterface.getOperations().size());
- assertEquals("sayHello", wsdlInterface.getOperations().get(0).getName());
- assertNotNull(wsdlInterface.getPortType());
-
- JavaInterfaceContract javaIC2 = factory.createJavaInterfaceContract();
- JavaInterface iface2 = factory.createJavaInterface(TestJavaInterface.class);
- new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface2);
- new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface2);
- javaIC2.setInterface(iface2);
- WSDLInterfaceContract wsdlIC2 = BindingWSDLGenerator.createWSDLInterfaceContract(javaIC2, false, new XSDModelResolver(null, null), dataBindings, wsdlFactory, xsdFactory, null);
- assertNotNull(wsdlIC2);
- }
-
-}
-
-@Remotable
-interface HelloWorld {
- String sayHello(String s);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.java
deleted file mode 100644
index f1e12f8ce0..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGeneratorTestCase.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.binding.ws.wsdlgen;
-
-import java.io.StringWriter;
-
-import javax.wsdl.Definition;
-import javax.wsdl.xml.WSDLWriter;
-
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
-import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.xsd.DefaultXSDFactory;
-import org.apache.tuscany.sca.xsd.xml.XSDModelResolver;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Interface2WSDLGeneratorTestCase {
-
- @Test
- public void testGenerate() throws Exception {
- DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory();
- JavaInterface iface = iFactory.createJavaInterface(TestJavaInterface.class);
- DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint();
- JAXWSFaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, null);
- new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, null).visitInterface(iface);
- new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface);
- DefaultModelFactoryExtensionPoint modelFactories = new DefaultModelFactoryExtensionPoint();
- WSDLDefinition wsdlDefinition = new DefaultWSDLFactory(modelFactories).createWSDLDefinition();
- DefaultXSDFactory factory = new DefaultXSDFactory();
- Interface2WSDLGenerator generator = new Interface2WSDLGenerator(false, new XSDModelResolver(null, null), dataBindings, factory, null);
- Definition definition = generator.generate(iface, wsdlDefinition);
-
- // print the generated WSDL file and inline schemas
- WSDLWriter writer = generator.getFactory().newWSDLWriter();
- StringWriter sw = new StringWriter();
- writer.writeWSDL(definition, sw);
- System.out.println(sw.toString());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestException.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestException.java
deleted file mode 100644
index 1e4f802e01..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestException extends Exception {
-
- private String userdata;
-
- public TestException(String message) {
- super(message);
- }
-
- public TestException(String message, String userdata) {
- super(message);
- this.userdata = userdata;
- }
-
- public String getUserdata() {
- return userdata;
- }
-
- public void setUserdata(String userdata) {
- this.userdata = userdata;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFault.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFault.java
deleted file mode 100644
index da2c285bac..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFault.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.binding.ws.wsdlgen;
-
-import javax.xml.ws.WebFault;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-@WebFault(faultBean="org.apache.tuscany.sca.binding.ws.wsdlgen.TestFaultBean")
-public class TestFault extends Exception {
-
- private TestFaultBean bean;
-
- public TestFault(TestFaultBean bean, String message) {
- super(message);
- this.bean = bean;
- }
-
- public TestFault(TestFaultBean bean, String message, Throwable cause) {
- super(message, cause);
- this.bean = bean;
- }
-
- public TestFaultBean getFaultInfo() {
- return bean;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFaultBean.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFaultBean.java
deleted file mode 100644
index 64cce0e49d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestFaultBean.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestFaultBean {
- private String lastName;
- private String firstName;
- private float age;
-
- public String getLastName() {
- return lastName;
- }
-
- public void setLastName(String lastName) {
- this.lastName = lastName;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- public void setFirstName(String firstName) {
- this.firstName = firstName;
- }
-
- public float getAge() {
- return age;
- }
-
- public void setAge(float age) {
- this.age = age;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaClass.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaClass.java
deleted file mode 100644
index 3fd7361ae1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaClass.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.wsdlgen;
-import org.apache.tuscany.sca.binding.ws.other.Other;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestJavaClass {
- public Other other;
- public String name;
- public int number;
- public float balance;
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java b/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.java
deleted file mode 100644
index 729ed9c146..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-wsdlgen/src/test/java/org/apache/tuscany/sca/binding/ws/wsdlgen/TestJavaInterface.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.binding.ws.wsdlgen;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPBinding.ParameterStyle;
-
-import org.osoa.sca.annotations.OneWay;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-@WebService
-public interface TestJavaInterface {
- String m1(String str);
-
- @OneWay
- @WebMethod
- void m2(int i);
-
- @WebMethod
- String m3();
-
- void m4();
-
- @WebMethod
- String m5(String str, int i);
-
- @WebMethod(exclude = true)
- void dummy();
-
- @WebMethod
- void m6(TestJavaClass info) throws TestException;
-
- @WebMethod
- void m7(TestJavaClass info) throws TestFault;
-
- @WebMethod
- @SOAPBinding(parameterStyle=ParameterStyle.BARE)
- void m8(String str);
-
- @WebMethod
- @SOAPBinding(parameterStyle=ParameterStyle.BARE)
- int m9(String str);
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/LICENSE b/branches/sca-java-1.5.1/modules/binding-ws-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-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-java-1.5.1/modules/binding-ws-xml/NOTICE b/branches/sca-java-1.5.1/modules/binding-ws-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/pom.xml b/branches/sca-java-1.5.1/modules/binding-ws-xml/pom.xml
deleted file mode 100644
index 51c2ea537f..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/pom.xml
+++ /dev/null
@@ -1,100 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-ws-xml</artifactId>
- <name>Apache Tuscany SCA WS Binding XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-ws-wsdlgen</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ws.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ws.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/BindingBuilderImpl.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/BindingBuilderImpl.java
deleted file mode 100644
index f2376231ab..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/BindingBuilderImpl.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.binding.ws.xml;
-
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator;
-import org.apache.tuscany.sca.assembly.AbstractContract;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A factory for the calculated WSDL document needed by Web Service bindings.
- *
- * @version $Rev$ $Date$
- */
-public class BindingBuilderImpl implements BindingBuilder {
-
- private ExtensionPointRegistry extensionPoints;
-
- public BindingBuilderImpl(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- /**
- * Create a calculated WSDL document and save it in the Web Service binding.
- */
- public void build(Component component, AbstractContract contract, Binding binding, Monitor monitor) {
- BindingWSDLGenerator.generateWSDL(component, contract, (WebServiceBinding)binding, extensionPoints, monitor);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java
deleted file mode 100644
index ad2540e5fe..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/EndPointReferenceHelper.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.xml;
-
-import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
-
-import java.io.StringWriter;
-
-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.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-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;
-
-/**
- * Helper methods to read and write a wsa:endpointReference
- * TODO: almost direct copy of code for Assembly properties
- * must be able to move to a common utility
- *
- * @version $Rev$ $Date$
- */
-public class EndPointReferenceHelper {
-
- /**
- * Read a wsa:endpointReference into a DOM Element
- */
- public static Element readEndPointReference(XMLStreamReader reader) {
- try {
-
- return loadElement(reader);
-
- } catch (XMLStreamException e) {
- throw new RuntimeException(e);
- } catch (ParserConfigurationException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Write a wsa:endpointReference from a DOM Element
- */
- public static void writeEndPointReference(Element element, XMLStreamWriter writer) {
- try {
-
- saveElement(element, writer);
-
- } catch (XMLStreamException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static Element loadElement(XMLStreamReader reader) throws XMLStreamException, ParserConfigurationException {
- Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
- Node root = document;
- Node current = root;
- while (true) {
- switch (reader.getEventType()) {
- 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 ("EndpointReference".equals(reader.getName().getLocalPart())) {
- return document.getDocumentElement();
- }
-
- // pop the element off the stack
- current = current.getParentNode();
- }
- if ( reader.hasNext()) reader.next();
- }
- }
-
- private static Element createElement(Document document, QName name) {
- String prefix = name.getPrefix();
- String qname =
- (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name.getLocalPart();
- return document.createElementNS(name.getNamespaceURI(), qname);
- }
-
- private static 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);
- }
- }
-
- private static void saveElement(Element element, XMLStreamWriter writer) throws XMLStreamException{
-
- XMLStreamReader reader =
- XMLInputFactory.newInstance().createXMLStreamReader(new DOMSource(element));
-
- 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;
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
deleted file mode 100644
index a3dfcc3c5b..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.ws.DefaultWebServiceBindingFactory;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-import com.ibm.wsdl.OperationImpl;
-
-/**
- * This is the StAXArtifactProcessor for the Web Services Binding.
- *
- * @version $Rev$ $Date$
- */
-public class WebServiceBindingProcessor implements StAXArtifactProcessor<WebServiceBinding>, WebServiceConstants {
-
- private ExtensionPointRegistry extensionPoints;
- private WSDLFactory wsdlFactory;
- private WebServiceBindingFactory wsFactory;
- private PolicyFactory policyFactory;
- private ExtensionFactory extensionFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private ConfiguredOperationProcessor configuredOperationProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- public WebServiceBindingProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
-
- this.extensionPoints = extensionPoints;
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.wsFactory = new DefaultWebServiceBindingFactory();
- this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- this.monitor = monitor;
- this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
-
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
- this.extensionAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
- }
-
- /**
- * Report a warning.
- *
- * @param problem
- * @param model
- * @param message data
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an error.
- *
- * @param problem
- * @param model
- * @param message data
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an exception.
- *
- * @param problem
- * @param model
- * @param exception
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-wsxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read a <binding.ws>
- WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- /*IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
- bindingType.setName(getArtifactType());
- bindingType.setUnresolved(true);
- ((PolicySetAttachPoint)wsBinding).setType(bindingType);*/
- wsBinding.setUnresolved(true);
- wsBinding.setBuilder(new BindingBuilderImpl(extensionPoints));
-
- // Read policies
- policyProcessor.readPolicies(wsBinding, reader);
-
- // Read the binding name
- String name = reader.getAttributeValue(null, NAME);
- if (name != null) {
- wsBinding.setName(name);
- }
-
- // Read URI
- String uri = reader.getAttributeValue(null, URI);
- if (uri != null) {
- wsBinding.setURI(uri);
- }
-
- // Read a qname in the form:
- // namespace#wsdl.???(name)
- Boolean wsdlElementIsBinding = null;
- String wsdlElement = reader.getAttributeValue(null, WSDL_ELEMENT);
- if (wsdlElement != null) {
- int index = wsdlElement.indexOf('#');
- if (index == -1) {
- error("InvalidWsdlElementAttr", reader, wsdlElement);
- //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
- return wsBinding;
- }
- String namespace = wsdlElement.substring(0, index);
- wsBinding.setNamespace(namespace);
- String localName = wsdlElement.substring(index + 1);
- if (localName.startsWith("wsdl.service")) {
-
- // Read a wsdl.service
- localName = localName.substring("wsdl.service(".length(), localName.length() - 1);
- wsBinding.setServiceName(new QName(namespace, localName));
-
- } else if (localName.startsWith("wsdl.port")) {
-
- // Read a wsdl.port
- localName = localName.substring("wsdl.port(".length(), localName.length() - 1);
- int s = localName.indexOf('/');
- if (s == -1) {
- error("InvalidWsdlElementAttr", reader, wsdlElement);
- //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
- } else {
- wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
- wsBinding.setPortName(localName.substring(s + 1));
- }
- } else if (localName.startsWith("wsdl.endpoint")) {
-
- // Read a wsdl.endpoint
- localName = localName.substring("wsdl.endpoint(".length(), localName.length() - 1);
- int s = localName.indexOf('/');
- if (s == -1) {
- error("InvalidWsdlElementAttr", reader, wsdlElement);
- //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
- } else {
- wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
- wsBinding.setEndpointName(localName.substring(s + 1));
- }
- } else if (localName.startsWith("wsdl.binding")) {
-
- // Read a wsdl.binding
- localName = localName.substring("wsdl.binding(".length(), localName.length() - 1);
- wsBinding.setBindingName(new QName(namespace, localName));
-
- wsdlElementIsBinding = true;
-
- } else {
- error("InvalidWsdlElementAttr", reader, wsdlElement);
- //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
- }
- }
-
- // Read wsdlLocation
- wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
-
- // Handle extended attributes
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI() != WSDLI_NS && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
- (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- wsBinding.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
-
-
- ConfiguredOperation confOp = null;
- // Skip to end element
- while (reader.hasNext()) {
- int event = reader.next();
- switch (event) {
- case START_ELEMENT: {
- if (END_POINT_REFERENCE.equals(reader.getName().getLocalPart())) {
- if (wsdlElement != null && (wsdlElementIsBinding == null || !wsdlElementIsBinding)) {
- error("MustUseWsdlBinding", reader, wsdlElement);
- throw new ContributionReadException(wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
- }
- wsBinding.setEndPointReference(EndPointReferenceHelper.readEndPointReference(reader));
- } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
- confOp = configuredOperationProcessor.read(reader);
- if (confOp != null) {
- ((OperationsConfigurator)wsBinding).getConfiguredOperations().add(confOp);
- }
- }
- }
- break;
-
- }
-
- if (event == END_ELEMENT && BINDING_WS_QNAME.equals(reader.getName())) {
- break;
- }
- }
- return wsBinding;
- }
-
- protected void processEndPointReference(XMLStreamReader reader, WebServiceBinding wsBinding) {
- }
-
- public void write(WebServiceBinding wsBinding, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
-
- // Write a <binding.ws>
- writer.writeStartElement(Constants.SCA10_NS, BINDING_WS);
- policyProcessor.writePolicyAttributes(wsBinding, writer);
-
- // Write binding name
- if (wsBinding.getName() != null) {
- writer.writeAttribute(NAME, wsBinding.getName());
- }
-
- // Write binding URI
- if (wsBinding.getURI() != null) {
- writer.writeAttribute(URI, wsBinding.getURI());
- }
-
- // Write wsdlElement attribute
- if (wsBinding.getPortName() != null) {
-
- // Write namespace#wsdl.port(service/port)
- String wsdlElement =
- wsBinding.getServiceName().getNamespaceURI() + "#wsdl.port("
- + wsBinding.getServiceName().getLocalPart()
- + "/"
- + wsBinding.getPortName()
- + ")";
- writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
-
- } else if (wsBinding.getEndpointName() != null) {
-
- // Write namespace#wsdl.endpoint(service/endpoint)
- String wsdlElement =
- wsBinding.getServiceName().getNamespaceURI() + "#wsdl.endpoint("
- + wsBinding.getServiceName().getLocalPart()
- + "/"
- + wsBinding.getEndpointName()
- + ")";
- writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
-
- } else if (wsBinding.getBindingName() != null) {
-
- // Write namespace#wsdl.binding(binding)
- String wsdlElement =
- wsBinding.getBindingName().getNamespaceURI() + "#wsdl.binding("
- + wsBinding.getBindingName().getLocalPart()
- + ")";
- writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
-
- } else if (wsBinding.getServiceName() != null) {
-
- // Write namespace#wsdl.service(service)
- String wsdlElement =
- wsBinding.getServiceName().getNamespaceURI() + "#wsdl.service("
- + wsBinding.getServiceName().getLocalPart()
- + ")";
- writer.writeAttribute(WSDL_ELEMENT, wsdlElement);
- }
-
- // Write location
- if (wsBinding.getLocation() != null) {
- writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsBinding.getLocation());
- }
-
- // Write extended attributes
- for(Extension extension : wsBinding.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- if (wsBinding.getEndPointReference() != null) {
- EndPointReferenceHelper.writeEndPointReference(wsBinding.getEndPointReference(), writer);
- }
-
- writer.writeEndElement();
- }
-
- public void resolve(WebServiceBinding model, ModelResolver resolver) throws ContributionResolveException {
-
- if (model == null || !model.isUnresolved())
- return;
-
- WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
- wsdlDefinition.setUnresolved(true);
- wsdlDefinition.setNamespace(model.getNamespace());
- WSDLDefinition resolved = null;
- try {
- resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
- } catch (ContributionRuntimeException e) {
- ContributionResolveException ce = new ContributionResolveException(e.getCause());
- error("ContributionResolveException", wsdlDefinition, ce);
- //throw ce;
- }
-
- if (resolved != null && !resolved.isUnresolved()) {
- wsdlDefinition.setDefinition(resolved.getDefinition());
- wsdlDefinition.setLocation(resolved.getLocation());
- wsdlDefinition.setURI(resolved.getURI());
- wsdlDefinition.getImportedDefinitions().addAll(resolved.getImportedDefinitions());
- wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
- wsdlDefinition.setUnresolved(false);
- model.setDefinition(wsdlDefinition);
- if (model.getBindingName() != null) {
- WSDLObject<Binding> binding = wsdlDefinition.getWSDLObject(Binding.class, model.getBindingName());
- if (binding != null) {
- wsdlDefinition.setDefinition(binding.getDefinition());
- model.setBinding(binding.getElement());
- } else {
- warning("WsdlBindingDoesNotMatch", wsdlDefinition, model.getBindingName());
- }
- }
- if (model.getServiceName() != null) {
- WSDLObject<Service> service = wsdlDefinition.getWSDLObject(Service.class, model.getServiceName());
- if (service != null) {
- wsdlDefinition.setDefinition(service.getDefinition());
- model.setService(service.getElement());
- if (model.getPortName() != null) {
- Port port = service.getElement().getPort(model.getPortName());
- if (port != null) {
- model.setPort(port);
- model.setBinding(port.getBinding());
- } else {
- warning("WsdlPortTypeDoesNotMatch", wsdlDefinition, model.getPortName());
- }
- }
- } else {
- warning("WsdlServiceDoesNotMatch", wsdlDefinition, model.getServiceName());
- }
- }
-
- PortType portType = getPortType(model);
- if (portType != null) {
- // Introspect the WSDL portType and validate the input/output messages.
- List<OperationImpl> operations = portType.getOperations();
- for (OperationImpl operation : operations) {
- if (operation.getInput() != null && operation.getInput().getMessage() == null) {
- ContributionResolveException ce = new ContributionResolveException("WSDL binding operation input name " + operation.getInput().getName() + " does not match with PortType Definition");
- error("ContributionResolveException", wsdlDefinition, ce);
- }
- if (operation.getOutput() != null && operation.getOutput().getMessage() == null) {
- ContributionResolveException ce = new ContributionResolveException("WSDL binding operation output name " + operation.getOutput().getName() + " does not match with PortType Definition");
- error("ContributionResolveException", wsdlDefinition, ce);
- }
- }
-
- WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
- WSDLInterface wsdlInterface = null;
- try {
- wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
- interfaceContract.setInterface(wsdlInterface);
- model.setBindingInterfaceContract(interfaceContract);
- } catch (InvalidInterfaceException e) {
- warning("InvalidInterfaceException", wsdlFactory, model.getName());
- }
- }
- }
- policyProcessor.resolvePolicies(model, resolver);
- OperationsConfigurator opCongigurator = (OperationsConfigurator)model;
- for (ConfiguredOperation confOp : opCongigurator.getConfiguredOperations()) {
- policyProcessor.resolvePolicies(confOp, resolver);
- }
- }
-
- private PortType getPortType(WebServiceBinding model) {
- PortType portType = null;
- if (model.getPort() != null) {
- portType = model.getPort().getBinding().getPortType();
- } else if (model.getEndpoint() != null) {
- portType = model.getPort().getBinding().getPortType();
- } else if (model.getBinding() != null) {
- portType = model.getBinding().getPortType();
- } else if (model.getService() != null) {
- // FIXME: How to find the compatible port?
- Map ports = model.getService().getPorts();
- if (!ports.isEmpty()) {
- Port port = (Port)ports.values().iterator().next();
- portType = port.getBinding().getPortType();
- }
- }
- return portType;
- }
-
- public QName getArtifactType() {
- return WebServiceConstants.BINDING_WS_QNAME;
- }
-
- public Class<WebServiceBinding> getModelType() {
- return WebServiceBinding.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.java
deleted file mode 100644
index 03c84a6b41..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceConstants.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.binding.ws.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Constants for the Web Services Binding.
- *
- * @version $Rev$ $Date$
- */
-public interface WebServiceConstants {
-
- String BINDING_WS = "binding.ws";
- QName BINDING_WS_QNAME = new QName(Constants.SCA10_NS, BINDING_WS);
- String WSDL_ELEMENT = "wsdlElement";
- QName WSDL_ELEMENT_QNAME = new QName(Constants.SCA10_NS, WSDL_ELEMENT);
- String WSDL_LOCATION = "wsdlLocation";
- String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
- QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
- String NAME = "name";
- String URI = "uri";
- String END_POINT_REFERENCE = "EndpointReference";
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index cb982e8647..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.ws.xml.WebServiceBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.ws,model=org.apache.tuscany.sca.binding.ws.WebServiceBinding
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
deleted file mode 100644
index 9e2ff5830d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/main/resources/binding-wsxml-validation-messages.properties
+++ /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.
-#
-#
-InvalidWsdlElementAttr = Invalid WebService binding wsdlElement attribute: {0}
-MustUseWsdlBinding = {0} must use wsdl.binding when using wsa:EndpointReference
-InvalidInterfaceException = Exception creating interface from WSDL for binding: {0}
-WsdlBindingDoesNotMatch = The #wsdl.binding({0}) does not match with the WSDL Definitions
-WsdlServiceDoesNotMatch = The #wsdl.service({0}) does not match with the WSDL Definitions
-WsdlPortTypeDoesNotMatch = The #wsdl.port({0}) does not match with the WSDL Definitions
-ContributionResolveException = Error in contribution: {0}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
deleted file mode 100644
index ef955254c1..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadTestCase.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ComponentType componentType = (ComponentType)staxProcessor.read(reader);
- assertNotNull(componentType);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- }
-
- public void testReadPolicies() throws Exception {
- InputStream is = getClass().getResourceAsStream("PoliciedCalculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
-
- assertEquals(((OperationsConfigurator)composite.getServices().get(0).getBindings().get(0))
- .getConfiguredOperations().get(0).getRequiredIntents().size(), 2);
- }
-
- /**
- * This test makes sure that an exception is thrown when a bad wsdlElement is present along with EndpointReference.
- *
- * Ref: Web Service Binding Specification v1.0 - Sec 2.1 - Lines 61 to 65.
- * When an EndpointReference is present along with the wsdlElement attribute on the parent element, the wsdlElement attribute value MUST
- * be of the 'Binding' form.
- */
- public void testReadBadWsdlElement() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator-bad-wsdlElement.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- try {
- staxProcessor.read(reader);
- fail("ContributionReadException expected.");
- } catch(ContributionReadException e) {
- // Expected
- assertNotSame(-1, e.getMessage().indexOf("must use wsdl.binding when using wsa:EndpointReference"));
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadWriteAnyAttributeTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadWriteAnyAttributeTestCase.java
deleted file mode 100644
index 742c6783a8..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/ReadWriteAnyAttributeTestCase.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.xml.AnyAttributeProcessor;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test reading SCA XML assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class ReadWriteAnyAttributeTestCase {
-
- private static final QName EXTENDED_ATTRIBUTE = new QName("http://test", "customAttribute");
-
- private static final String XML =
- "<?xml version='1.0' encoding='UTF-8'?>" +
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "xmlns:ns1=\"http://www.osoa.org/xmlns/sca/1.0\" " +
- "targetNamespace=\"http://temp\" " +
- "name=\"myComposite\">" +
- "<service name=\"service\">" +
- "<interface.java interface=\"com.ibm.MyInterface\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaInterfaceAnyAttribute=\"Java Interface Value\" />" +
- "<binding.ws xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSAnyAttribute=\"WS Value\" />" +
- "</service>" +
- "<component name=\"component\">" +
- "<implementation.java class=\"com.ibm.test.MyClass\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myJavaImplAnyAttribute=\"Java Impl Value\" />" +
- "</component>" +
- "<component name=\"component1\">" +
- "<implementation.composite xmlns:ns2=\"http://temp\" name=\"ns2:myComposite\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myCompositeImplAnyAttribute=\"Composite Impl Value\" />" +
- "</component>" +
- "<reference name=\"reference\">" +
- "<interface.wsdl interface=\"http://www.example.org/SpaceWarGame/#wsdl.interface(SpaceWarGame)\" xmlns:myPrefix=\"http://myPrefix\" myPrefix:myWSDLInterfaceAnyAttribute=\"WSDL Interface Value\" />" +
- "</reference>" +
- "</composite>";
-
- private XMLInputFactory inputFactory;
- private ExtensibleStAXArtifactProcessor staxProcessor;
-
-
- /**
- * Initialize the test environment
- * This takes care to register attribute processors when provided
- *
- * @param attributeProcessor
- * @throws Exception
- */
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- inputFactory = XMLInputFactory.newInstance();
-
- StAXAttributeProcessor attributeProcessor = new AnyAttributeProcessor(modelFactories,null);
-
- StAXAttributeProcessorExtensionPoint staxAttributeProcessors = new DefaultStAXAttributeProcessorExtensionPoint(extensionPoints);
- staxAttributeProcessors.addArtifactProcessor(attributeProcessor);
- extensionPoints.addExtensionPoint(staxAttributeProcessors);
-
- WebServiceBindingProcessor wsbp = new WebServiceBindingProcessor(extensionPoints,null);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(wsbp);
-
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance(), null);
- }
-
- @After
- public void tearDown() throws Exception {
-
- }
-
-
- @Test
- //@Ignore()
- public void testReadWriteCompositeWithBindings() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(XML));
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
- reader.close();
-
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, bos);
-
- // used for debug comparison
- // System.out.println(XML);
- // System.out.println(bos.toString());
-
- assertEquals(XML, bos.toString());
- bos.close();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
deleted file mode 100644
index 7ab9b19a56..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/java/org/apache/tuscany/sca/binding/ws/xml/WriteTestCase.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- StAXAttributeProcessorExtensionPoint staxAttributeProcessors = new DefaultStAXAttributeProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-/*
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(componentType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
- }
-*/
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- System.out.println(bos.toString());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite
deleted file mode 100644
index d8d1b3401e..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator-bad-wsdlElement.composite
+++ /dev/null
@@ -1,59 +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://sample.calculator"
- targetNamespace="http://calc"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- name="Calculator-bad-wsdlElement">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)">
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/Calculator</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.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-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
deleted file mode 100644
index f7460813cd..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/Calculator.composite
+++ /dev/null
@@ -1,63 +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://sample.calculator"
- targetNamespace="http://calc"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
- <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
- <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)">
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>http://localhost:8085/services/HelloWorldWebService</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </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-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
deleted file mode 100644
index 959802af43..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/CalculatorImpl.componentType
+++ /dev/null
@@ -1,45 +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"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance">
-
- <service name="CalculatorService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
- <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)"/>
- <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
- </service>
-
- <reference name="divideService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
- <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.service(DivideService)"/>
- <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(DivideBinding)"/>
- <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.port(DivideService/DividePort)"/>
- <binding.ws uri="tempuri.org" wsdlElement="http://sample/calculator#wsdl.endpoint(DivideService/DivideEndpoint)"/>
- <binding.ws>
- <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
- <wsa:Address>myURI</wsa:Address>
- </wsa:EndpointReference>
- </binding.ws>
- </reference>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite
deleted file mode 100644
index 37c80aa910..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/PoliciedCalculator.composite
+++ /dev/null
@@ -1,60 +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://sample.calculator"
- targetNamespace="http://calc"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"/>
- <binding.ws uri="http://localhost:8085/Calculator" wsdlElement="http://sample/calculator#wsdl.service(CalculatorService)">
- <operation name="add" requires="IntentOne IntentTwo"/>
- </binding.ws>
- <binding.ws wsdli:wsdlLocation="http://tempuri.org" wsdlElement="http://sample/calculator#wsdl.binding(CalculatorBinding)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.port(CalculatorService/CalculatorPort)"/>
- <binding.ws wsdlElement="http://sample/calculator#wsdl.endpoint(CalculatorService/CalculatorEndpoint)"/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl
deleted file mode 100644
index 5e8e5dad0d..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/example.wsdl
+++ /dev/null
@@ -1,26 +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.
--->
-<wsdl:definitions targetNamespace="http://www.example.org"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- name="example">
-
- <wsdl:portType name="HelloWorld">
- </wsdl:portType>
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
deleted file mode 100644
index ad81fc7867..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/invalid-stockquote.wsdl
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice1">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput" />
- <output message="tns:GetLastTradePriceOutput" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd
deleted file mode 100644
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
deleted file mode 100644
index 39cd5547d9..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/stockquote.wsdl
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput" />
- <output message="tns:GetLastTradePriceOutput" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl
deleted file mode 100644
index 8e26f7b4b5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.wsdl
+++ /dev/null
@@ -1,45 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:import location="test2.wsdl" namespace="http://helloworld"></wsdl:import>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
deleted file mode 100644
index c2210f4a94..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test1.xsd
+++ /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.
--->
-<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO" xmlns:tns="http://www.example.com/Customer">
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
-
- <complexType name="Customer">
- <sequence>
- <element name="customerID" type="string"></element>
- <element name="name" type="string"></element>
- <element name="order" type="ipo:PurchaseOrderType" />
- </sequence>
- </complexType>
- <element name="customer" type="tns:Customer"></element>
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl
deleted file mode 100644
index 529b395fd5..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/test2.wsdl
+++ /dev/null
@@ -1,63 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string" />
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string" />
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest" />
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse" />
- </wsdl:operation>
- </wsdl:portType>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl b/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl
deleted file mode 100644
index 666a7e4069..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws-xml/src/test/resources/org/apache/tuscany/sca/binding/ws/xml/unwrapped-stockquote.wsdl
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput1">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput1">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <message name="GetLastTradePriceInput2">
- <part name="body" element="xsd1:getLastTradePrice" />
- <part name="other" type="xsd:string"/>
- </message>
-
- <message name="GetLastTradePriceOutput2">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput1" />
- <output message="tns:GetLastTradePriceOutput1" />
- </operation>
- <operation name="getLastTradePrice1">
- <input message="tns:GetLastTradePriceInput1" />
- <output message="tns:GetLastTradePriceOutput1" />
- </operation>
- <operation name="getLastTradePrice2">
- <input message="tns:GetLastTradePriceInput2" />
- <output message="tns:GetLastTradePriceOutput2" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/LICENSE b/branches/sca-java-1.5.1/modules/binding-ws/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/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-java-1.5.1/modules/binding-ws/NOTICE b/branches/sca-java-1.5.1/modules/binding-ws/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/pom.xml b/branches/sca-java-1.5.1/modules/binding-ws/pom.xml
deleted file mode 100644
index 9fd2f351c4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/pom.xml
+++ /dev/null
@@ -1,85 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-ws</artifactId>
- <name>Apache Tuscany SCA WS Binding Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.6.2</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <!-- Apache repository for Web Services artifacts -->
- <repository>
- <id>apache.ws.zone</id>
- <name>Apache WS Zone Repository</name>
- <url>http://ws.zones.apache.org/repository2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.ws</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.ws*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.java
deleted file mode 100644
index 2ccaa5dc58..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/DefaultWebServiceBindingFactory.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.binding.ws;
-
-import org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingFactoryImpl;
-
-/**
- * A factory for the Web Service binding model.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class DefaultWebServiceBindingFactory extends WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
deleted file mode 100644
index 9e1a261dcf..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBinding.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.binding.ws;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.w3c.dom.Element;
-
-
-/**
- * Represents a WebService binding.
- *
- * @version $Rev$ $Date$
- */
-public interface WebServiceBinding extends Binding, BindingBuilderExtension, Extensible {
-
- /**
- * Sets the WSDL location.
- * @param location the WSDL location
- */
- void setLocation(String location);
-
- /**
- * Returns the WSDL location
- * @return the WSDL location
- */
- String getLocation();
-
- /**
- * Returns the name of the WSDL service.
- *
- * @return the name of the WSDL service
- */
- QName getServiceName();
-
- /**
- * Sets the name of the WSDL service.
- *
- * @param serviceName the name of the WSDL service
- */
- void setServiceName(QName serviceName);
-
- /**
- * Returns the name of the WSDL port.
- *
- * @return the name of the WSDL port
- */
- String getPortName();
-
- /**
- * Sets the name of the WSDL port.
- *
- * @param portName the name of the WSDL port
- */
- void setPortName(String portName);
-
- /**
- * Returns the name of the WSDL binding.
- *
- * @return the name of the WSDL binding
- */
- QName getBindingName();
-
- /**
- * Sets the name of the WSDL binding.
- *
- * @param bindingName the name of the WSDL binding
- */
- void setBindingName(QName bindingName);
-
- /**
- * Returns the name of the WSDL endpoint.
- *
- * @return the name of the WSDL endpoint
- */
- String getEndpointName();
-
- /**
- * Sets the name of the WSDL endpoint.
- *
- * @param endpointName the name of the WSDL endpoint
- */
- void setEndpointName(String endpointName);
-
- /**
- * Returns the WSDL service
- * @return the WSDL service
- */
- Service getService();
-
- /**
- * Sets the WSDL service.
- * @param service the WSDL service
- */
- void setService(Service service);
-
- /**
- * Returns the WSDL port
- * @return the WSDL port
- */
- Port getPort();
-
- /**
- * Sets the WSDL endpoint
- * @param endpoint the WSDL endpoint
- */
- void setEndpoint(Port endpoint);
-
- /**
- * Returns the WSDL endpoint
- * @return the WSDL endpoint
- */
- Port getEndpoint();
-
- /**
- * Sets the WSDL port
- * @param port the WSDL port
- */
- void setPort(Port port);
-
- /**
- * Returns the WSDL binding.
- * @return the WSDL binding
- */
- javax.wsdl.Binding getBinding();
-
- /**
- * Sets the WSDL binding
- * @param binding the WSDL binding
- */
- void setBinding(javax.wsdl.Binding binding);
-
- /**
- * Returns the WSDL definition.
- * @return the WSDL definition
- */
- WSDLDefinition getWSDLDefinition();
-
- /**
- * Sets the WSDL definition.
- * @param wsdlDefinition the WSDL definition
- */
- void setDefinition(WSDLDefinition wsdlDefinition);
-
- /**
- * Returns the WSDL namespace.
- * @return the WSDL namespace
- */
- String getNamespace();
-
- /**
- * Sets the WSDL namespace
- * @param namespace the WSDL namespace
- */
- void setNamespace(String namespace);
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
- InterfaceContract getBindingInterfaceContract();
-
- void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract);
-
- Element getEndPointReference();
-
- void setEndPointReference(Element element);
-
- /**
- * Returns the generated WSDL definitions document.
- * @return the generated WSDL definitions document
- */
- Definition getWSDLDocument();
-
- /**
- * Sets the generated WSDL definitions document.
- * @param definition the generated WSDL definitions document
- */
- void setWSDLDocument(Definition definition);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.java
deleted file mode 100644
index 1ad38c69e4..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/WebServiceBindingFactory.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.binding.ws;
-
-/**
- * Factory for the Web Service binding model.
- *
- * @version $Rev$ $Date$
- */
-public interface WebServiceBindingFactory {
-
- /**
- * Creates a new WebService binding.
- *
- * @return a new WebService binding
- */
- WebServiceBinding createWebServiceBinding();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.java
deleted file mode 100644
index a13584a3c2..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/addressing/EndPointReference.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.binding.ws.addressing;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * Defines a model for WS-Addressing
- * &lt;wsa:EndpointReference&gt;
- * &lt;wsa:Address&gt;xs:anyURI&lt;/wsa:Address&gt;
- * &lt;wsa:ReferenceProperties&gt;... &lt;/wsa:ReferenceProperties&gt; ?
- * &lt;wsa:ReferenceParameters&gt;... &lt;/wsa:ReferenceParameters&gt; ?
- * &lt;wsa:PortType&gt;xs:QName&lt;/wsa:PortType&gt; ?
- * &lt;wsa:ServiceName PortName="xs:NCName"?&gt;xs:QName&lt;/wsa:ServiceName&gt; ?
- * &lt;wsp:Policy&gt; ... &lt;/wsp:Policy&gt;*
- * &lt;/wsa:EndpointReference&gt;
- * @version $Rev$ $Date$
- */
-public interface EndPointReference {
- URI getAddress();
-
- void setAddress(URI address);
-
- QName getPortType();
-
- void setPortType(QName portType);
-
- QName getServiceName();
-
- void setServiceName(QName serviceName);
-
- QName getPortName();
-
- void setPortName(QName portName);
-
- List<Object> getReferenceProperties();
-
- List<Object> getReferenceParameters();
-
- List<Object> getPolicies();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.java
deleted file mode 100644
index 055e2012dc..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingFactoryImpl.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.binding.ws.impl;
-
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory;
-
-/**
- * A factory for the WSDL model.
- *
- * @version $Rev$ $Date$
- */
-public class WebServiceBindingFactoryImpl implements WebServiceBindingFactory {
-
- public WebServiceBinding createWebServiceBinding() {
- return new WebServiceBindingImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java b/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
deleted file mode 100644
index 245031f3cb..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.binding.ws.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
-import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.w3c.dom.Element;
-
-/**
- * Represents a WebService binding.
- *
- * @version $Rev$ $Date$
- */
-class WebServiceBindingImpl implements WebServiceBinding, PolicySetAttachPoint, OperationsConfigurator {
- private String name;
- private String uri;
- private boolean unresolved;
- private List<Object> extensions = new ArrayList<Object>();
- private List<Extension> attributeExtensions = new ArrayList<Extension>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private IntentAttachPointType intentAttachPointType;
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private String location;
- private Binding binding;
- private Service service;
- private Port port;
- private Port endpoint;
- private QName bindingName;
- private String portName;
- private QName serviceName;
- private String endpointName;
- private WSDLDefinition wsdlDefinition;
- private String wsdlNamespace;
- private InterfaceContract bindingInterfaceContract;
- private Element endPointReference;
- private Definition generatedWSDLDocument;
- private BindingBuilder builder;
-
- protected WebServiceBindingImpl() {
- }
-
- public String getName() {
- return name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public List<Extension> getAttributeExtensions() {
- return attributeExtensions;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public Binding getBinding() {
- if (binding == null) {
- if (getWSDLDefinition() != null && wsdlDefinition.getBinding() != null) {
- binding = wsdlDefinition.getBinding();
- }
- }
- return binding;
- }
-
- public QName getBindingName() {
- if (isUnresolved()) {
- return bindingName;
- } else if (binding != null) {
- return binding.getQName();
- } else {
- return null;
- }
- }
-
- public String getEndpointName() {
- if (isUnresolved()) {
- return endpointName;
- } else if (endpoint != null) {
- //TODO support WSDL 2.0
- return endpoint.getName();
- } else {
- return null;
- }
- }
-
- public Port getEndpoint() {
- return endpoint;
- }
-
- public Port getPort() {
- return port;
- }
-
- public String getPortName() {
- if (isUnresolved()) {
- return portName;
- } else if (port != null) {
- return port.getName();
- } else {
- return null;
- }
- }
-
- public Service getService() {
- return service;
- }
-
- public QName getServiceName() {
- if (isUnresolved()) {
- return serviceName;
- } else if (service != null) {
- return service.getQName();
- } else {
- return null;
- }
- }
-
- public void setBinding(Binding binding) {
- this.binding = binding;
- }
-
- public void setBindingName(QName bindingName) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.bindingName = bindingName;
- }
-
- public void setEndpoint(Port endpoint) {
- this.endpoint = endpoint;
- }
-
- public void setEndpointName(String endpointName) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.endpointName = endpointName;
- }
-
- public void setPort(Port port) {
- this.port = port;
- }
-
- public void setPortName(String portName) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.portName = portName;
- }
-
- public void setService(Service service) {
- this.service = service;
- }
-
- public void setServiceName(QName serviceName) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.serviceName = serviceName;
- }
-
- public WSDLDefinition getWSDLDefinition() {
- if (wsdlDefinition == null) {
- Interface iface = bindingInterfaceContract.getInterface();
- if (iface instanceof WSDLInterface) {
- wsdlDefinition = ((WSDLInterface) iface).getWsdlDefinition();
- }
- }
- return wsdlDefinition;
- }
-
- public void setDefinition(WSDLDefinition wsdlDefinition) {
- this.wsdlDefinition = wsdlDefinition;
- }
-
- public String getNamespace() {
- return wsdlNamespace;
- }
-
- public void setNamespace(String namespace) {
- this.wsdlNamespace = namespace;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return bindingInterfaceContract;
- }
-
- public void setBindingInterfaceContract(InterfaceContract bindingInterfaceContract) {
- this.bindingInterfaceContract = bindingInterfaceContract;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public Element getEndPointReference() {
- return endPointReference;
- }
-
- public void setEndPointReference(Element epr) {
- this.endPointReference = epr;
- }
-
- public Definition getWSDLDocument() {
- return generatedWSDLDocument;
- }
-
- public void setWSDLDocument(Definition definition) {
- this.generatedWSDLDocument = definition;
- }
-
- public BindingBuilder getBuilder() {
- return builder;
- }
-
- public void setBuilder(BindingBuilder builder) {
- this.builder = builder;
- }
-
- 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-java-1.5.1/modules/binding-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory b/branches/sca-java-1.5.1/modules/binding-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory
deleted file mode 100644
index 6d50a24b93..0000000000
--- a/branches/sca-java-1.5.1/modules/binding-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.binding.ws.WebServiceBindingFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the model factory
-org.apache.tuscany.sca.binding.ws.impl.WebServiceBindingFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/LICENSE b/branches/sca-java-1.5.1/modules/contribution-groovy/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/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-java-1.5.1/modules/contribution-groovy/NOTICE b/branches/sca-java-1.5.1/modules/contribution-groovy/NOTICE
deleted file mode 100644
index 917b66ba7f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/NOTICE
+++ /dev/null
@@ -1,8 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product uses Relax WS (http://code.google.com/p/relax-ws/) with the following copyright:
- * Copyright 2008 Jason Sando
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/pom.xml b/branches/sca-java-1.5.1/modules/contribution-groovy/pom.xml
deleted file mode 100644
index 382c77a3e0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/pom.xml
+++ /dev/null
@@ -1,84 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-contribution-groovy</artifactId>
- <name>Apache Tuscany SCA Groovy contributions</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all-minimal</artifactId>
- <version>1.5.4</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.groovy</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.groovy*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java b/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.java
deleted file mode 100644
index 77dab193b9..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifact.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.contribution.groovy;
-
-import java.net.URL;
-
-/**
- * GroovyArtifact holds the URL to the Groovy script.
- *
- * @version $Rev$ $Date$
- */
-public class GroovyArtifact {
-
- private URL artifactURL;
-
- public GroovyArtifact(URL artifactURL) {
- this.artifactURL = artifactURL;
- }
-
- public URL getArtifactURL() {
- return artifactURL;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java
deleted file mode 100644
index 4b7df4d9f8..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyArtifactProcessor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.groovy;
-
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A URLArtifactProcessor for Groovy scripts
- *
- * @version $Rev$ $Date$
- */
-public class GroovyArtifactProcessor implements URLArtifactProcessor<GroovyArtifact> {
-
- public GroovyArtifactProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- public GroovyArtifact read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- return new GroovyArtifact(artifactURL);
- }
-
- public String getArtifactType() {
- return ".groovy";
- }
-
- public Class<GroovyArtifact> getModelType() {
- return GroovyArtifact.class;
- }
-
- public void resolve(GroovyArtifact groovyModel, ModelResolver arg1) throws ContributionResolveException {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java
deleted file mode 100644
index 82fe0326df..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/java/org/apache/tuscany/sca/contribution/groovy/GroovyModelResolver.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.groovy;
-
-import groovy.lang.GroovyClassLoader;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A ModelResolver that compiles Groovy scripts into the contribution
- * class loader so they can be used just like a regular java class.
- *
- * @version $Rev$ $Date$
- */
-public class GroovyModelResolver implements ModelResolver {
-
- protected ModelResolver modelresolver;
- protected Contribution contribution;
-
- public GroovyModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- modelresolver = contribution.getModelResolver();
- this.contribution = contribution;
- }
-
- public void addModel(Object model) {
- ClassLoader cl = contribution.getClassLoader();
- if (!(cl instanceof GroovyClassLoader)) {
- // replace the contribution class loader with a Groovy one
- // If the contribution does not have a ClassLoader, use this ClassLoader as parent
- if (cl == null) cl = this.getClass().getClassLoader();
- cl = new GroovyClassLoader(cl);
- contribution.setClassLoader(cl);
- }
- try {
-
- ((GroovyClassLoader)cl).parseClass(((GroovyArtifact)model).getArtifactURL().openStream());
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object removeModel(Object arg0) {
- return null;
- }
-
- public <T> T resolveModel(Class<T> arg0, T arg1) {
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index f9dbee53bb..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.groovy.GroovyArtifactProcessor;type=.groovy,model=org.apache.tuscany.sca.contribution.groovy.GroovyArtifact
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 86434ac4bf..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.contribution.groovy.GroovyModelResolver;model=org.apache.tuscany.sca.contribution.groovy.GroovyArtifact
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java b/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.java
deleted file mode 100644
index 788c42f07d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorld.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.contribution.groovy;
-
-/**
- * HelloWorld Service interface used for testing.
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorld {
-
- String sayHello(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.java
deleted file mode 100644
index 02be3acd23..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/java/org/apache/tuscany/sca/contribution/groovy/HelloWorldTestCase.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.contribution.groovy;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Runs a distributed domain in a single VM by using and in memory implementation of the distributed domain
- *
- * @version $Rev$ $Date$
- */
-public class HelloWorldTestCase {
-
- private static HelloWorld helloWorld;
- private static SCADomain scaDomain;
-
- @BeforeClass
- public static void init() throws Exception {
- scaDomain = SCADomain.newInstance("org/apache/tuscany/sca/contribution/groovy/helloworld.composite");
- helloWorld = scaDomain.getService(HelloWorld.class, "HelloWolrdComponent");
- }
-
- @AfterClass
- public static void destroy() throws Exception {
- if (scaDomain != null) {
- scaDomain.close();
- }
- }
-
- @Test
- public void testCalculator() throws Exception {
- Assert.assertEquals("Hello Petra", helloWorld.sayHello("Petra"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy b/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy
deleted file mode 100644
index c172528538..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/HelloWorld.groovy
+++ /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.contribution.groovy
-
-class HelloWorldImpl implements org.apache.tuscany.sca.contribution.groovy.HelloWorld {
-
- String sayHello(String you) {
- return "Hello $you"
- }
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite b/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite
deleted file mode 100644
index 0d4c17a15b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-groovy/src/test/resources/org/apache/tuscany/sca/contribution/groovy/helloworld.composite
+++ /dev/null
@@ -1,29 +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"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="HelloWorld">
-
- <component name="HelloWolrdComponent">
- <implementation.java class="org.apache.tuscany.sca.contribution.groovy.HelloWorldImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/LICENSE b/branches/sca-java-1.5.1/modules/contribution-impl/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/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-java-1.5.1/modules/contribution-impl/NOTICE b/branches/sca-java-1.5.1/modules/contribution-impl/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/pom.xml b/branches/sca-java-1.5.1/modules/contribution-impl/pom.xml
deleted file mode 100644
index 315ffb5bc3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-impl</artifactId>
- <name>Apache Tuscany SCA Contribution Model Implementation</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.impl</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
deleted file mode 100644
index 9bd4d23680..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/FolderContributionProcessor.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * Folder contribution package processor.
- *
- * @version $Rev$ $Date$
- */
-public class FolderContributionProcessor implements PackageProcessor {
-
- public FolderContributionProcessor() {
- }
-
- public String getPackageType() {
- return PackageType.FOLDER;
- }
-
- /**
- * Recursively traverse a root directory
- *
- * @param fileList
- * @param file
- * @param root
- * @throws IOException
- */
- private static void traverse(List<URI> fileList, final File file, final File root) throws IOException {
- // Allow privileged access to test file. Requires FilePermissions in security policy file.
- Boolean isFile = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return file.isFile();
- }
- });
- if (isFile) {
- fileList.add(AccessController.doPrivileged(new PrivilegedAction<URI>() {
- public URI run() {
- return root.toURI().relativize(file.toURI());
- }
- }));
- } else {
- // Allow privileged access to test file. Requires FilePermissions in security policy
- // file.
- Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return file.isDirectory();
- }
- });
- if (isDirectory) {
- String uri = AccessController.doPrivileged(new PrivilegedAction<URI>() {
- public URI run() {
- return root.toURI().relativize(file.toURI());
- }
- }).toString();
-
- if (uri.endsWith("/")) {
- uri = uri.substring(0, uri.length() - 1);
- }
- try {
- fileList.add(new URI(null, uri, null));
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException("Invalid artifact uri:" + uri);
- }
-
- // Allow privileged access to list files. Requires FilePermission in security
- // policy.
- File[] files = AccessController.doPrivileged(new PrivilegedAction<File[]>() {
- public File[] run() {
- return file.listFiles();
- }
- });
- for (File f : files) {
- if (!f.getName().startsWith(".")) {
- traverse(fileList, f, root);
- }
- }
- }
- }
- }
-
- public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
- return new URL(sourceURL, artifact.toString());
- }
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
- IOException {
- if (packageSourceURL == null) {
- throw new IllegalArgumentException("Invalid null package source URL.");
- }
-
- List<URI> artifacts = new ArrayList<URI>();
-
- try {
- // Assume the root is a jar file
- final File rootFolder = new File(packageSourceURL.toURI());
- // Allow privileged access to test file. Requires FilePermissions in security policy
- // file.
- Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return rootFolder.isDirectory();
- }
- });
- if (isDirectory) {
- // Allow privileged access to test file. Requires FilePermissions in security policy
- // file.
- Boolean folderExists = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return rootFolder.exists();
- }
- });
- if (!folderExists) {
- throw new ContributionReadException(rootFolder.getAbsolutePath());
- }
-
- // Security consideration. This method gathers URIs of enclosed
- // artifacts. The URIs are protected by the policy when a user
- // yries to open those URLs.
- traverse(artifacts, rootFolder, rootFolder);
- }
-
- } catch (URISyntaxException e) {
- throw new ContributionReadException(packageSourceURL.toExternalForm(), e);
- }
-
- return artifacts;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
deleted file mode 100644
index 47a0f95687..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/processor/impl/JarContributionProcessor.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-
-/**
- * Jar Contribution package processor.
- *
- * @version $Rev$ $Date$
- */
-public class JarContributionProcessor implements PackageProcessor {
-
- public JarContributionProcessor() {
- }
-
- public String getPackageType() {
- return PackageType.JAR;
- }
-
- public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
- if (sourceURL.toString().startsWith("jar:")) {
- return new URL(sourceURL, artifact.toString());
- } else if(!artifact.toString().equals("")) {
- return new URL("jar:" + sourceURL.toExternalForm() + "!/" + artifact);
- } else {
- return sourceURL;
- }
- }
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
- IOException {
- if (packageSourceURL == null) {
- throw new IllegalArgumentException("Invalid null package source URL.");
- }
-
- if (inputStream == null) {
- throw new IllegalArgumentException("Invalid null source inputstream.");
- }
-
- // Assume the root is a jar file
- JarInputStream jar = new JarInputStream(inputStream);
- try {
- Set<String> names = new HashSet<String>();
- while (true) {
- JarEntry entry = jar.getNextJarEntry();
- if (entry == null) {
- // EOF
- break;
- }
-
- // FIXME: Maybe we should externalize the filter as a property
- String name = entry.getName();
- if (!name.startsWith(".")) {
-
- // Trim trailing /
- if (name.endsWith("/")) {
- name = name.substring(0, name.length() - 1);
- }
-
- // Add the entry name
- if (!names.contains(name)) {
- names.add(name);
-
- // Add parent folder names to the list too
- for (;;) {
- int s = name.lastIndexOf('/');
- if (s == -1) {
- name = "";
- } else {
- name = name.substring(0, s);
- }
- if (!names.contains(name)) {
- names.add(name);
- } else {
- break;
- }
- }
- }
- }
- }
-
- // Return list of URIs
- List<URI> artifacts = new ArrayList<URI>();
- for (String name: names) {
- try {
- artifacts.add(new URI(null, name, null));
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException("Invalid artifact uri:" + name);
- }
- }
- return artifacts;
-
- } finally {
- jar.close();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
deleted file mode 100644
index e658054381..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service.impl;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * The default implementation of ContributionRepository
- *
- * @version $Rev$ $Date$
- */
-public class ContributionRepositoryImpl implements ContributionRepository {
- private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
- private static final String DOMAIN_INDEX_FILENAME = "sca-domain.xml";
- private boolean initialized = false;
- private String repository = null;
- private File rootFile = null;
- private Map<String, String> contributionLocations = new HashMap<String, String>();
-
- private Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
- private List<Contribution> contributions = new ArrayList<Contribution>();
-
- private URI domain;
- private XMLInputFactory factory;
- private Monitor monitor;
-
- /**
- * Marshals warnings into the monitor
- *
- * @param message
- * @param model
- * @param messageParameters
- */
- protected void warning(String message, Object model, String... messageParameters) {
- if (monitor != null){
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals errors into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Marshals exceptions into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Constructor with repository root
- *
- * @param repository
- * @param factory
- */
- public ContributionRepositoryImpl(final String repository, XMLInputFactory factory, Monitor monitor) throws IOException {
- this.monitor = monitor;
- this.repository = repository;
- this.factory = factory;
- }
-
-
- public URI getDomain() {
- return domain;
- }
-
- public URL store(final String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
- if(! initialized) {
- try {
- initializeRepository();
- } catch(Exception e) {
- //ignore
- }
- }
-
-
- // where the file should be stored in the repository
- final File location = mapToFile(sourceURL);
- FileHelper.forceMkdir(location.getParentFile());
-
- copy(contributionStream, location);
-
- // add contribution to repositoryContent
- // Allow ability to read user.dir property. Requires PropertyPermission in security policy.
- URL contributionURL;
- try {
- contributionURL= AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
- public URL run() throws IOException {
- URL contributionURL = location.toURL();
- URI relative = rootFile.toURI().relativize(location.toURI());
- contributionLocations.put(contribution, relative.toString());
- return contributionURL;
- }
- });
- } catch (PrivilegedActionException e) {
- error("PrivilegedActionException", location, (IOException)e.getException());
- throw (IOException)e.getException();
- }
- saveMap();
-
- return contributionURL;
- }
-
- public URL store(String contribution, URL sourceURL) throws IOException {
- if(! initialized) {
- try {
- initializeRepository();
- } catch(Exception e) {
- //ignore
- }
- }
-
- // where the file should be stored in the repository
- File location = mapToFile(sourceURL);
- File source = FileHelper.toFile(sourceURL);
- if (source == null || source.isFile()) {
- URLConnection connection = sourceURL.openConnection();
- connection.setUseCaches(false);
- InputStream is = connection.getInputStream();
- try {
- return store(contribution, sourceURL, is);
- } finally {
- IOHelper.closeQuietly(is);
- }
- }
-
- FileHelper.forceMkdir(location);
- FileHelper.copyDirectory(source, location);
-
- // add contribution to repositoryContent
- URI relative = rootFile.toURI().relativize(location.toURI());
- contributionLocations.put(contribution, relative.toString());
- saveMap();
-
- return location.toURL();
- }
-
- public URL find(String contribution) {
- if(! initialized) {
- try {
- initializeRepository();
- } catch(Exception e) {
- //ignore
- }
- }
-
-
- if (contribution == null) {
- return null;
- }
- String location = contributionLocations.get(contribution);
- if (location == null) {
- return null;
- }
- try {
- return new File(rootFile, location).toURL();
- } catch (MalformedURLException e) {
- // Should not happen
- error("MalformedURLException", location, new AssertionError(e));
- throw new AssertionError(e);
- }
- }
-
- public void remove(String contribution) {
- if(! initialized) {
- try {
- initializeRepository();
- } catch(Exception e) {
- //ignore
- }
- }
-
-
- URL contributionURL = this.find(contribution);
- if (contributionURL != null) {
- // remove
- try {
- FileHelper.forceDelete(FileHelper.toFile(contributionURL));
- this.contributionLocations.remove(contribution);
- saveMap();
- } catch (IOException ioe) {
- // handle file could not be removed
- }
- }
- }
-
- public List<String> list() {
- return new ArrayList<String>(contributionLocations.keySet());
- }
-
- /**
- * Contribution Registry methods
- */
-
-
- public void addContribution(Contribution contribution) {
- contributionMap.put(contribution.getURI(), contribution);
- contributions.add(contribution);
- }
-
- public void removeContribution(Contribution contribution) {
- contributionMap.remove(contribution.getURI());
- contributions.remove(contribution);
- }
-
- public void updateContribution(Contribution contribution) {
- Contribution oldContribution = contributionMap.remove(contribution.getURI());
- contributions.remove(oldContribution);
- contributionMap.put(contribution.getURI(), contribution);
- contributions.add(contribution);
- }
-
- public Contribution getContribution(String uri) {
- return contributionMap.get(uri);
- }
-
- public List<Contribution> getContributions() {
- return Collections.unmodifiableList(contributions);
- }
-
-
- /**
- * Resolve contribution location in the repository -> root repository /
- * contribution file -> contribution group id / artifact id / version
- *
- * @param contribution
- * @return
- */
- private File mapToFile(URL sourceURL) {
- String fileName = FileHelper.toFile(sourceURL).getName();
- return new File(rootFile, "contributions" + File.separator + fileName);
- }
-
-
- /**
- * Persist contribution state to xml file in the repository
- */
- private void saveMap() {
- File domainFile = new File(rootFile, DOMAIN_INDEX_FILENAME);
- FileOutputStream os = null;
- try {
- os = new FileOutputStream(domainFile);
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
- writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- writer.println("<domain uri=\"" + getDomain() + "\" xmlns=\"" + NS + "\">");
- for (Map.Entry<String, String> e : contributionLocations.entrySet()) {
- writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
- }
- writer.println("</domain>");
- writer.flush();
- } catch (IOException e) {
- IllegalArgumentException ae = new IllegalArgumentException(e);
- error("IllegalArgumentException", os, ae);
- throw ae;
- } finally {
- IOHelper.closeQuietly(os);
- }
- }
-
- /**
- * Initialize contribution repository
- * @throws IOException
- */
- private void initializeRepository() throws IOException {
- String root = this.repository;
- if (root == null) {
- root = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- // Default to <user.home>/.tuscany/domains/local/
- String userHome = System.getProperty("user.home");
- String slash = File.separator;
- return userHome + slash + ".tuscany" + slash + "domains" + slash + "local" + slash;
- }
- });
- }
-
- // Allow privileged access to File. Requires FilePermission in security policy file.
- final String finalRoot = root;
- this.rootFile = AccessController.doPrivileged(new PrivilegedAction<File>() {
- public File run() {
- return new File(finalRoot);
- }
- });
-
- // Allow privileged access to File. Requires FilePermission in security policy file.
- this.domain = AccessController.doPrivileged(new PrivilegedAction<URI>() {
- public URI run() {
- return rootFile.toURI();
- }
- });
-
- // Allow privileged access to mkdir. Requires FilePermission in security policy file.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws IOException {
- FileHelper.forceMkdir(rootFile);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- error("PrivilegedActionException", rootFile, (IOException)e.getException());
- throw (IOException)e.getException();
- }
-
- // Allow privileged access to test file. Requires FilePermissions in security policy file.
- Boolean notDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead());
- }
- });
- if (notDirectory) {
- error("RootNotDirectory", rootFile, repository);
- throw new IOException("The root is not a directory: " + repository);
- }
-
- }
-
-
- /**
- *
- */
- void init() {
- if(! initialized) {
- try {
- initializeRepository();
- } catch(Exception e) {
- //ignore
- }
- }
-
- File domainFile = new File(rootFile, "sca-domain.xml");
- if (!domainFile.isFile()) {
- return;
- }
- FileInputStream is;
- try {
- is = new FileInputStream(domainFile);
- } catch (FileNotFoundException e) {
- warning("DomainFileNotFound", domainFile, domainFile.getAbsolutePath());
- return;
- }
- try {
- XMLStreamReader reader = factory.createXMLStreamReader(new InputStreamReader(is, "UTF-8"));
- while (reader.hasNext()) {
- switch (reader.getEventType()) {
- case XMLStreamConstants.START_ELEMENT:
- String name = reader.getName().getLocalPart();
- if ("domain".equals(name)) {
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null) {
- domain = URI.create(uri);
- }
- }
- if ("contribution".equals(name)) {
- String uri = reader.getAttributeValue(null, "uri");
- String location = reader.getAttributeValue(null, "location");
- contributionLocations.put(uri, location);
- }
- break;
- default:
- break;
- }
- reader.next();
- }
- } catch (Exception e) {
- // Ignore
- } finally {
- IOHelper.closeQuietly(is);
- }
- }
-
- /**
- * Utility functions
- */
-
- /**
- * Write a specific source InputStream to a file on disk
- *
- * @param source contents of the file to be written to disk
- * @param target file to be written
- * @throws IOException
- */
- private static void copy(InputStream source, File target) throws IOException {
- BufferedOutputStream out = null;
- BufferedInputStream in = null;
-
- try {
- out = new BufferedOutputStream(new FileOutputStream(target));
- in = new BufferedInputStream(source);
- IOHelper.copy(in, out);
- } finally {
- IOHelper.closeQuietly(out);
- IOHelper.closeQuietly(in);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
deleted file mode 100644
index 64f61fc6c8..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionServiceImpl.java
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.service.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Service interface that manages artifacts contributed to a Tuscany runtime.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionServiceImpl implements ContributionService {
- private ExtensionPointRegistry extensionPoints;
-
- /**
- * Repository where contributions are stored. Usually set by injection.
- */
- private ContributionRepository contributionRepository;
-
- /**
- * Registry of available package processors.
- */
- private PackageProcessor packageProcessor;
-
- /**
- * Registry of available artifact processors
- */
-
- private URLArtifactProcessor artifactProcessor;
-
- /**
- * Registry of available StAX processors,
- * used for loading contribution metadata in a extensible way
- */
- private StAXArtifactProcessor staxProcessor;
-
- /**
- * Event listener for contribution operations
- */
- private ExtensibleContributionListener contributionListener;
-
- /**
- * Registry of available model resolvers
- */
-
- private ModelResolverExtensionPoint modelResolvers;
-
- /**
- * Model factory extension point
- */
-
- private ModelFactoryExtensionPoint modelFactories;
-
- /**
- * XML factory used to create reader instance to load contribution metadata
- */
- private XMLInputFactory xmlFactory;
-
- /**
- * Assembly factory
- */
- private AssemblyFactory assemblyFactory;
-
- /**
- * Contribution model factory
- */
- private ContributionFactory contributionFactory;
-
-
- private ModelResolver policyDefinitionsResolver;
-
- private List policyDefinitions;
-
- private Monitor monitor;
-
- private String COMPOSITE_FILE_EXTN = ".composite";
-
- private TypeDescriber packageTypeDescriber;
-
- public ContributionServiceImpl(ContributionRepository repository,
- PackageProcessor packageProcessor,
- URLArtifactProcessor documentProcessor,
- StAXArtifactProcessor staxProcessor,
- ExtensibleContributionListener contributionListener,
- ModelResolver policyDefinitionsResolver,
- ModelResolverExtensionPoint modelResolvers,
- ModelFactoryExtensionPoint modelFactories,
- AssemblyFactory assemblyFactory,
- ContributionFactory contributionFactory,
- XMLInputFactory xmlFactory,
- List<SCADefinitions> policyDefinitions,
- ExtensionPointRegistry extensionPoints,
- Monitor monitor) {
- super();
- this.extensionPoints = extensionPoints;
- this.contributionRepository = repository;
- this.packageProcessor = packageProcessor;
- this.artifactProcessor = documentProcessor;
- this.staxProcessor = staxProcessor;
- this.contributionListener = contributionListener;
- this.modelResolvers = modelResolvers;
- this.modelFactories = modelFactories;
- this.xmlFactory = xmlFactory;
- this.assemblyFactory = assemblyFactory;
- this.contributionFactory = contributionFactory;
- this.policyDefinitionsResolver = policyDefinitionsResolver;
- this.policyDefinitions = policyDefinitions;
- this.monitor = monitor;
-
- this.packageTypeDescriber = new PackageTypeDescriberImpl();
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-impl-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository)
- throws ContributionException, IOException {
- if (contributionURI == null) {
- error("ContributionURINull", contributionURI);
- throw new IllegalArgumentException("URI for the contribution is null");
- }
- if (sourceURL == null) {
- error("SourceURLNull", sourceURL);
- throw new IllegalArgumentException("Source URL for the contribution is null");
- }
- return addContribution(contributionURI, sourceURL, null, null, storeInRepository);
- }
-
- public Contribution contribute(String contributionURI,
- URL sourceURL,
- ModelResolver modelResolver,
- boolean storeInRepository) throws ContributionException, IOException {
- if (contributionURI == null) {
- error("ContributionURINull", contributionURI);
- throw new IllegalArgumentException("URI for the contribution is null");
- }
- if (sourceURL == null) {
- error("SourceURLNull", sourceURL);
- throw new IllegalArgumentException("Source URL for the contribution is null");
- }
-
- return addContribution(contributionURI, sourceURL, null, modelResolver, storeInRepository);
- }
-
- public Contribution contribute(String contributionURI, URL sourceURL, InputStream input)
- throws ContributionException, IOException {
-
- return addContribution(contributionURI, sourceURL, input, null, true);
- }
-
- public Contribution contribute(String contributionURI, URL sourceURL, InputStream input, ModelResolver modelResolver)
- throws ContributionException, IOException {
-
- return addContribution(contributionURI, sourceURL, input, modelResolver, true);
- }
-
- public Contribution getContribution(String uri) {
- return this.contributionRepository.getContribution(uri);
- }
-
- /**
- * Remove a contribution and notify listener that contribution was removed
- */
- public void remove(String uri) throws ContributionException {
- Contribution contribution = contributionRepository.getContribution(uri);
- this.contributionRepository.removeContribution(contribution);
- this.contributionListener.contributionRemoved(this.contributionRepository, contribution);
- }
-
- /**
- * Add a composite model to the contribution
- */
- public void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException {
- Artifact artifact = this.contributionFactory.createArtifact();
- artifact.setURI(composite.getURI());
- artifact.setModel(composite);
-
- contribution.getArtifacts().add(artifact);
-
- contribution.getDeployables().add(composite);
- }
-
- /**
- * Utility/Helper methods for contribution service
- */
-
- /**
- * Perform read of the contribution metadata loader (sca-contribution.xml and sca-contribution-generated.xml)
- * When the two metadata files are available, the information provided are merged, and the sca-contribution has priorities
- *
- * @param sourceURL
- * @return Contribution
- * @throws ContributionException
- */
- /*
- private Contribution readContributionMetadata(URL sourceURL) throws ContributionException {
- Contribution contributionMetadata = contributionFactory.createContribution();
-
- ContributionMetadataDocumentProcessor metadataDocumentProcessor =
- new ContributionMetadataDocumentProcessor(modelFactories, staxProcessor, monitor);
-
- final URL[] urls = {sourceURL};
- // Allow access to create classloader. Requires RuntimePermission in security policy.
- URLClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<URLClassLoader>() {
- public URLClassLoader run() {
- return new URLClassLoader(urls, null);
- }
- });
- for (String path: new String[]{
- Contribution.SCA_CONTRIBUTION_GENERATED_META,
- Contribution.SCA_CONTRIBUTION_META}) {
- URL url = cl.getResource(path);
- if (url != null) {
- ContributionMetadata contribution = metadataDocumentProcessor.read(sourceURL, URI.create(path), url);
- contributionMetadata.getImports().addAll(contribution.getImports());
- contributionMetadata.getExports().addAll(contribution.getExports());
- contributionMetadata.getDeployables().addAll(contribution.getDeployables());
- }
- }
-
- // For debugging purposes, write it back to XML
- // if (contributionMetadata != null) {
- // try {
- // ByteArrayOutputStream bos = new ByteArrayOutputStream();
- // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
- // staxProcessor.write(contributionMetadata, outputFactory.createXMLStreamWriter(bos));
- // Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new ByteArrayInputStream(bos.toByteArray()));
- // OutputFormat format = new OutputFormat();
- // format.setIndenting(true);
- // format.setIndent(2);
- // XMLSerializer serializer = new XMLSerializer(System.out, format);
- // serializer.serialize(document);
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // }
-
- return contributionMetadata;
- }
- */
-
- private static boolean isDirectory(URL url) {
- if ("file".equals(url.getProtocol())) {
- try {
- final URI uri = url.toURI();
- return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return new File(uri).isDirectory();
- }
- });
- } catch (URISyntaxException e) {
- // Ignore
- }
- }
- return false;
- }
-
- /**
- * Note:
- *
- * @param contributionURI ContributionID
- * @param sourceURL contribution location
- * @param contributionStream contribution content
- * @param storeInRepository flag if we store the contribution into the
- * repository or not
- * @return the contribution model representing the contribution
- * @throws IOException
- * @throws DeploymentException
- */
- private Contribution addContribution(String contributionURI,
- URL sourceURL,
- InputStream contributionStream,
- ModelResolver modelResolver,
- boolean storeInRepository) throws IOException, ContributionException {
-
- if (contributionStream == null && sourceURL == null) {
- error("ContributionContentNull", contributionStream);
- throw new IllegalArgumentException("The content of the contribution is null.");
- }
-
- // store the contribution in the contribution repository
- URL locationURL = sourceURL;
- if (contributionRepository != null && storeInRepository) {
- if (contributionStream == null) {
- locationURL = contributionRepository.store(contributionURI, sourceURL);
- } else {
- locationURL = contributionRepository.store(contributionURI, sourceURL, contributionStream);
- }
- }
-
- Contribution contribution = contributionFactory.createContribution();
-
- // Create contribution model resolver
- if (modelResolver == null) {
- //FIXME Remove this domain resolver, visibility of policy declarations should be handled by
- // the contribution import/export mechanism instead of this domainResolver hack.
- modelResolver = new ExtensibleModelResolver(contribution, extensionPoints, modelResolvers, modelFactories, policyDefinitionsResolver);
- }
-
- //set contribution initial information
- contribution.setURI(contributionURI);
- contribution.setLocation(locationURL.toString());
- contribution.setModelResolver(modelResolver);
- contribution.setType(packageTypeDescriber.getType(locationURL, null));
-
- List<URI> contributionArtifacts = null;
-
- //NOTE: if a contribution is stored on the repository
- //the stream would be consumed at this point
- if (storeInRepository || contributionStream == null) {
- if (isDirectory(sourceURL)) {
- // TUSCANY-2702: This is a directory
- contributionStream = null;
- } else {
- URLConnection connection = sourceURL.openConnection();
- connection.setUseCaches(false);
- // Allow access to open URL stream. Add FilePermission to added to security policy file.
- final URLConnection finalConnection = connection;
- try {
- contributionStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
- public InputStream run() throws IOException {
- return finalConnection.getInputStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-
- try {
- // process the contribution
- contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
- } finally {
- IOHelper.closeQuietly(contributionStream);
- contributionStream = null;
- }
- } else {
- // process the contribution
- contributionArtifacts = this.packageProcessor.getArtifacts(locationURL, contributionStream);
- }
-
- // Read all artifacts in the contribution
- try {
- // Allow access to read system properties. Requires PropertyPermission in security policy.
- // Any security exceptions are caught and wrapped as ContributionException.
- processReadPhase(contribution, contributionArtifacts);
- } catch ( Exception e ) {
- throw new ContributionException(e);
- }
-
- readContributionMetadata(contribution);
-
- //
- this.contributionListener.contributionAdded(this.contributionRepository, contribution);
-
- // Resolve them
- processResolvePhase(contribution);
-
- // Add all composites under META-INF/sca-deployables to the
- // list of deployables
- String prefix = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof Composite) {
- if (artifact.getURI().startsWith(prefix)) {
- Composite composite = (Composite)artifact.getModel();
- if (!contribution.getDeployables().contains(composite)) {
- contribution.getDeployables().add(composite);
- }
- }
- }
- }
-
- processApplicationComposite(contribution);
-
- // store the contribution on the registry
- this.contributionRepository.addContribution(contribution);
-
- return contribution;
- }
-
- private void readContributionMetadata(Contribution contribution) {
- ContributionMetadata m1 = null, m2 = null;
- for(Artifact a: contribution.getArtifacts()) {
- if(Contribution.SCA_CONTRIBUTION_GENERATED_META.equals(a.getURI())) {
- m1 = (ContributionMetadata) a.getModel();
- }
- if(Contribution.SCA_CONTRIBUTION_META.equals(a.getURI())) {
- m2 = (ContributionMetadata) a.getModel();
- }
- }
- if (m1 != null) {
- contribution.getImports().addAll(m1.getImports());
- contribution.getExports().addAll(m1.getExports());
- contribution.getDeployables().addAll(m1.getDeployables());
- }
- if (m2 != null) {
- contribution.getImports().addAll(m2.getImports());
- contribution.getExports().addAll(m2.getExports());
- contribution.getDeployables().addAll(m2.getDeployables());
- }
- }
-
- /**
- * Process any application composite (eg see 5.1.3 of SCA JEE spec)
- * TODO: see TUSCANY-2581
- */
- private void processApplicationComposite(Contribution contribution) {
-
- Composite composite = findComposite("web-inf/web.composite", contribution);
- if (composite != null) {
- if (!contribution.getDeployables().contains(composite)) {
- contribution.getDeployables().add(createDeploymentComposite(composite));
- }
- }
- }
-
- /**
- * Create a deployment composite for the composite
- * See line 247 section 5.1.3 of SCA JEE spec
- */
- private Composite createDeploymentComposite(Composite composite) {
- // TODO: for now just use as-is
- return composite;
- }
-
- private Composite findComposite(String name, Contribution contribution) {
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof Composite) {
- if (name.equalsIgnoreCase(artifact.getURI())) {
- return (Composite)artifact.getModel();
- }
- }
- }
- return null;
- }
-
- /**
- * This utility method process each artifact and delegates to proper
- * artifactProcessor to read the model and generate the in-memory representation
- *
- * @param contribution
- * @param artifacts
- * @throws ContributionException
- * @throws MalformedURLException
- */
- private void processReadPhase(Contribution contribution, List<URI> artifacts) throws ContributionException,
- MalformedURLException, XMLStreamException {
-
- ModelResolver modelResolver = contribution.getModelResolver();
- URL contributionURL = new URL(contribution.getLocation());
-
- List<URI> compositeUris = new ArrayList<URI>();
-
- Object model = null;
- for (URI anArtifactUri : artifacts) {
- if ( anArtifactUri.toString().endsWith(COMPOSITE_FILE_EXTN)) {
- compositeUris.add(anArtifactUri);
- } else {
- URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
-
- // Add the deployed artifact model to the resolver
- Artifact artifact = this.contributionFactory.createArtifact();
- artifact.setURI(anArtifactUri.toString());
- artifact.setLocation(artifactURL.toString());
- contribution.getArtifacts().add(artifact);
- modelResolver.addModel(artifact);
-
- model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
-
- if (model != null) {
- artifact.setModel(model);
-
- // Add the loaded model to the model resolver
- modelResolver.addModel(model);
-
- // Add policy definitions to the list of policy definitions
- if (model instanceof SCADefinitions) {
- policyDefinitions.add(model);
-
- SCADefinitions definitions = (SCADefinitions)model;
- for (Intent intent : definitions.getPolicyIntents() ) {
- policyDefinitionsResolver.addModel(intent);
- }
-
- for (PolicySet policySet : definitions.getPolicySets() ) {
- policyDefinitionsResolver.addModel(policySet);
- }
-
- for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
- policyDefinitionsResolver.addModel(attachPointType);
- }
-
- for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
- policyDefinitionsResolver.addModel(attachPointType);
- }
- for (Object binding : definitions.getBindings() ) {
- policyDefinitionsResolver.addModel(binding);
- }
- }
- }
- }
- }
-
- for (URI anArtifactUri : compositeUris) {
- URL artifactURL = packageProcessor.getArtifactURL(new URL(contribution.getLocation()), anArtifactUri);
-
- // Add the deployed artifact model to the resolver
- Artifact artifact = this.contributionFactory.createArtifact();
- artifact.setURI(anArtifactUri.toString());
- artifact.setLocation(artifactURL.toString());
- contribution.getArtifacts().add(artifact);
- modelResolver.addModel(artifact);
-
- model = this.artifactProcessor.read(contributionURL, anArtifactUri, artifactURL);
- if (model != null) {
- artifact.setModel(model);
- // Add the loaded model to the model resolver
- modelResolver.addModel(model);
- }
- }
- }
-
- /**
- * This utility method process each artifact and delegates to proper
- * artifactProcessor to resolve the model references
- *
- * @param contribution
- * @throws ContributionException
- */
- @SuppressWarnings("unchecked")
- private void processResolvePhase(Contribution contribution) throws ContributionException {
- List<Artifact> composites = new ArrayList<Artifact>();
-
- // for each artifact that was processed on the contribution
- for (Artifact artifact : contribution.getArtifacts()) {
- //leave the composites to be resolved at the end
- if (artifact.getURI().endsWith(".composite")) {
- composites.add(artifact);
- } else {
- // resolve the model object
- if (artifact.getModel() != null) {
- // System.out.println("Processing Resolve Phase : " + artifact.getURI());
- this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
- }
- }
- }
-
- //process each composite file
- for (Artifact artifact : composites) {
- // resolve the model object
- if (artifact.getModel() != null) {
- this.artifactProcessor.resolve(artifact.getModel(), contribution.getModelResolver());
- }
- }
-
- //resolve deployables from contribution metadata
- List<Composite> resolvedDeployables = new ArrayList<Composite>();
- for (Composite deployableComposite : contribution.getDeployables()) {
- Composite resolvedDeployable =
- contribution.getModelResolver().resolveModel(Composite.class, deployableComposite);
-
- resolvedDeployables.add(resolvedDeployable);
- }
- contribution.getDeployables().clear();
- contribution.getDeployables().addAll(resolvedDeployables);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.java
deleted file mode 100644
index a052e43356..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImpl.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.contribution.service.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-
-/**
- * Implementation of the content describer for contribution packages
- *
- * @version $Rev$ $Date$
- */
-public class PackageTypeDescriberImpl implements TypeDescriber {
- private final Map<String, String> contentTypeRegistry = new HashMap<String, String>();
-
- public PackageTypeDescriberImpl() {
- super();
- init();
- }
-
- /**
- * Initialize contentType registry with know types based on known file extensions
- */
- private void init() {
- contentTypeRegistry.put("EAR", PackageType.EAR);
- contentTypeRegistry.put("JAR", PackageType.JAR);
- contentTypeRegistry.put("WAR", PackageType.WAR);
- contentTypeRegistry.put("ZIP", PackageType.ZIP);
- }
-
- protected String resolveContentyTypeByExtension(URL resourceURL) {
- String artifactExtension = FileHelper.getExtension(resourceURL.getPath());
- if (artifactExtension == null) {
- return null;
- }
- return contentTypeRegistry.get(artifactExtension.toUpperCase());
- }
-
- /**
- * Build contentType for a specific resource. We first check if the file is a supported one
- * (looking into our registry based on resource extension) If not found, we try to check file
- * contentType Or we return defaultContentType provided
- *
- * @param resourceURL The artifact URL
- * @param defaultContentType The default content type if we can't find the correct one
- * @return The content type
- */
- public String getType(URL resourceURL, String defaultContentType) {
- URLConnection connection = null;
- String contentType = defaultContentType;
- final String urlProtocol = resourceURL.getProtocol();
-
- if (urlProtocol.equals("file")) {
- final File fileOrDir = FileHelper.toFile(resourceURL);
- // Allow privileged access to test file. Requires FilePermissions in security policy.
- Boolean isDirectory = AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return fileOrDir.isDirectory();
- }
- });
- if (isDirectory) {
- // Special case : contribution is a folder
- contentType = PackageType.FOLDER;
- }
-
- String type = resolveContentyTypeByExtension(resourceURL);
- if (type != null) {
- return type;
- }
- } else if (urlProtocol.equals("bundle") || urlProtocol.equals("bundleresource")) {
- contentType = PackageType.BUNDLE;
- } else {
- contentType = resolveContentyTypeByExtension(resourceURL);
- if (contentType == null) {
- try {
- connection = resourceURL.openConnection();
- connection.setUseCaches(false);
- contentType = connection.getContentType();
-
- if (contentType == null || contentType.equals("content/unknown")) {
- // here we couldn't figure out from our registry or from URL and it's not a
- // special file
- // return defaultContentType if provided
- contentType = defaultContentType;
- }
- } catch (IOException io) {
- // could not access artifact, just ignore and we will return
- // null contentType
- }
- }
- }
- return contentType == null ? defaultContentType : contentType;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
deleted file mode 100644
index cd5e87ca42..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
+++ /dev/null
@@ -1,701 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service.util;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.regex.Pattern;
-
-public class FileHelper {
- /**
- * The extension separator character.
- */
- private static final char EXTENSION_SEPARATOR = '.';
-
- /**
- * The Unix separator character.
- */
- private static final char UNIX_SEPARATOR = '/';
-
- /**
- * The Windows separator character.
- */
- private static final char WINDOWS_SEPARATOR = '\\';
-
- /**
- * Returns the index of the last directory separator character.
- * <p>
- * This method will handle a file in either Unix or Windows format. The
- * position of the last forward or backslash is returned.
- * <p>
- * The output will be the same irrespective of the machine that the code is
- * running on.
- *
- * @param filename the filename to find the last path separator in, null
- * returns -1
- * @return the index of the last separator character, or -1 if there is no
- * such character
- */
- public static int indexOfLastSeparator(String filename) {
- if (filename == null) {
- return -1;
- }
- int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR);
- int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR);
- return Math.max(lastUnixPos, lastWindowsPos);
- }
-
- /**
- * Returns the index of the last extension separator character, which is a
- * dot.
- * <p>
- * This method also checks that there is no directory separator after the
- * last dot. To do this it uses {@link #indexOfLastSeparator(String)} which
- * will handle a file in either Unix or Windows format.
- * <p>
- * The output will be the same irrespective of the machine that the code is
- * running on.
- *
- * @param filename the filename to find the last path separator in, null
- * returns -1
- * @return the index of the last separator character, or -1 if there is no
- * such character
- */
- public static int indexOfExtension(String filename) {
- if (filename == null) {
- return -1;
- }
- int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR);
- int lastSeparator = indexOfLastSeparator(filename);
- return lastSeparator > extensionPos ? -1 : extensionPos;
- }
-
- /**
- * Gets the name minus the path from a full filename.
- * <p>
- * This method will handle a file in either Unix or Windows format. The text
- * after the last forward or backslash is returned.
- *
- * <pre>
- * a/b/c.txt --&gt; c.txt
- * a.txt --&gt; a.txt
- * a/b/c --&gt; c
- * a/b/c/ --&gt; &quot;&quot;
- * </pre>
- *
- * <p>
- * The output will be the same irrespective of the machine that the code is
- * running on.
- *
- * @param fileName the filename to query, null returns null
- * @return the name of the file without the path, or an empty string if none
- * exists
- */
- public static String getName(String fileName) {
- if (fileName == null) {
- return null;
- }
- int index = indexOfLastSeparator(fileName);
- return fileName.substring(index + 1);
- }
-
- /**
- * Gets the extension of a filename.
- * <p>
- * This method returns the textual part of the filename after the last dot.
- * There must be no directory separator after the dot.
- *
- * <pre>
- * foo.txt --&gt; &quot;txt&quot;
- * a/b/c.jpg --&gt; &quot;jpg&quot;
- * a/b.txt/c --&gt; &quot;&quot;
- * a/b/c --&gt; &quot;&quot;
- * </pre>
- *
- * <p>
- * The output will be the same irrespective of the machine that the code is
- * running on.
- *
- * @param filename the filename to retrieve the extension of.
- * @return the extension of the file or an empty string if none exists.
- */
- public static String getExtension(String filename) {
- if (filename == null) {
- return null;
- }
- int index = indexOfExtension(filename);
- if (index == -1) {
- return "";
- } else {
- return filename.substring(index + 1);
- }
- }
-
- /**
- * Make a directory, including any necessary but nonexistent parent
- * directories. If there already exists a file with specified name or the
- * directory cannot be created then an exception is thrown.
- *
- * @param directory directory to create, not null
- * @throws NullPointerException if the directory is null
- * @throws IOException if the directory cannot be created
- */
- public static void forceMkdir(File directory) throws IOException {
- if (directory.exists()) {
- if (directory.isFile()) {
- String message =
- "File " + directory + " exists and is " + "not a directory. Unable to create directory.";
- throw new IOException(message);
- }
- } else {
- if (!directory.mkdirs()) {
- String message = "Unable to create directory " + directory;
- throw new IOException(message);
- }
- }
- }
-
- /**
- * Delete a file. If file is a directory, delete it and all sub-directories.
- * <p>
- * The difference between File.delete() and this method are:
- * <ul>
- * <li>A directory to be deleted does not have to be empty.</li>
- * <li>You get exceptions when a file or directory cannot be deleted.
- * (java.io.File methods returns a boolean)</li>
- * </ul>
- *
- * @param file file or directory to delete, not null
- * @throws NullPointerException if the directory is null
- * @throws IOException in case deletion is unsuccessful
- */
- public static void forceDelete(File file) throws IOException {
- if (file.isDirectory()) {
- deleteDirectory(file);
- } else {
- if (!file.exists()) {
- throw new FileNotFoundException("File does not exist: " + file);
- }
- if (!file.delete()) {
- String message = "Unable to delete file: " + file;
- throw new IOException(message);
- }
- }
- }
-
- /**
- * Convert from a <code>URL</code> to a <code>File</code>.
- * <p>
- * From version 1.1 this method will decode the URL. Syntax such as
- * <code>file:///my%20docs/file.txt</code> will be correctly decoded to
- * <code>/my docs/file.txt</code>.
- *
- * @param url the file URL to convert, null returns null
- * @return the equivalent <code>File</code> object, or <code>null</code>
- * if the URL's protocol is not <code>file</code>
- * @throws IllegalArgumentException if the file is incorrectly encoded
- */
- public static File toFile(URL url) {
- if (url == null || !url.getProtocol().equals("file")) {
- return null;
- } else {
- String filename = url.getFile().replace('/', File.separatorChar);
- int pos = 0;
- while ((pos = filename.indexOf('%', pos)) >= 0) { // NOPMD
- if (pos + 2 < filename.length()) {
- String hexStr = filename.substring(pos + 1, pos + 3);
- char ch = (char)Integer.parseInt(hexStr, 16);
- filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
- }
- }
- return new File(filename);
- }
- }
-
- public static FileFilter getFileFilter(String regExp, boolean ignoreCase) {
- return new RegExpFilter(regExp, ignoreCase);
- }
-
- /**
- * A regular-expression based resource filter
- */
- public static class RegExpFilter implements FileFilter {
- private Pattern pattern;
-
- public RegExpFilter(Pattern pattern) {
- this.pattern = pattern;
- }
-
- public RegExpFilter(String patternStr, boolean ignoreCase) {
- this.pattern = Pattern.compile(patternStr, ignoreCase ? Pattern.CASE_INSENSITIVE : 0);
- }
-
- public boolean accept(File file) {
- return pattern.matcher(file.getName()).matches();
- }
-
- /**
- * Convert wildcard into a regex pattern
- *
- * @param str
- * @return
- */
- public static RegExpFilter getWildcardFilter(String str, boolean ignoreCase) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < str.length(); i++) {
- char ch = str.charAt(i);
- if (ch == '?') {
- buffer.append('.');
- } else if (ch == '*') {
- buffer.append(".*");
- } else {
- buffer.append(ch);
- }
- }
- return new RegExpFilter(buffer.toString(), ignoreCase);
- }
-
- }
-
- /**
- * Clean a directory without deleting it.
- *
- * @param directory directory to clean
- * @throws IOException in case cleaning is unsuccessful
- */
- public static void cleanDirectory(File directory) throws IOException {
- if (!directory.exists()) {
- String message = directory + " does not exist";
- throw new IllegalArgumentException(message);
- }
-
- if (!directory.isDirectory()) {
- String message = directory + " is not a directory";
- throw new IllegalArgumentException(message);
- }
-
- File[] files = directory.listFiles();
- if (files == null) { // null if security restricted
- throw new IOException("Failed to list contents of " + directory);
- }
-
- IOException exception = null;
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- try {
- forceDelete(file);
- } catch (IOException ioe) {
- exception = ioe;
- }
- }
-
- if (null != exception) {
- throw exception;
- }
- }
-
- /**
- * Clean a directory without deleting it.
- *
- * @param directory directory to clean, must not be <code>null</code>
- * @throws NullPointerException if the directory is <code>null</code>
- * @throws IOException in case cleaning is unsuccessful
- */
- private static void cleanDirectoryOnExit(File directory) throws IOException {
- if (!directory.exists()) {
- String message = directory + " does not exist";
- throw new IllegalArgumentException(message);
- }
-
- if (!directory.isDirectory()) {
- String message = directory + " is not a directory";
- throw new IllegalArgumentException(message);
- }
-
- File[] files = directory.listFiles();
- if (files == null) { // null if security restricted
- throw new IOException("Failed to list contents of " + directory);
- }
-
- IOException exception = null;
- for (int i = 0; i < files.length; i++) {
- File file = files[i];
- try {
- forceDeleteOnExit(file);
- } catch (IOException ioe) {
- exception = ioe;
- }
- }
-
- if (null != exception) {
- throw exception;
- }
- }
-
- /**
- * Copies a whole directory to a new location preserving the file dates.
- * <p>
- * This method copies the specified directory and all its child directories
- * and files to the specified destination. The destination is the new
- * location and name of the directory.
- * <p>
- * The destination directory is created if it does not exist. If the
- * destination directory did exist, then this method merges the source with
- * the destination, with the source taking precedence.
- *
- * @param srcDir an existing directory to copy, must not be
- * <code>null</code>
- * @param destDir the new directory, must not be <code>null</code>
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @since Commons IO 1.1
- */
- public static void copyDirectory(File srcDir, File destDir) throws IOException {
- copyDirectory(srcDir, destDir, true);
- }
-
- /**
- * Copies a whole directory to a new location.
- * <p>
- * This method copies the contents of the specified source directory to
- * within the specified destination directory.
- * <p>
- * The destination directory is created if it does not exist. If the
- * destination directory did exist, then this method merges the source with
- * the destination, with the source taking precedence.
- *
- * @param srcDir an existing directory to copy, must not be
- * <code>null</code>
- * @param destDir the new directory, must not be <code>null</code>
- * @param preserveFileDate true if the file date of the copy should be the
- * same as the original
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @since Commons IO 1.1
- */
- public static void copyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
- if (srcDir == null) {
- throw new NullPointerException("Source must not be null");
- }
- if (destDir == null) {
- throw new NullPointerException("Destination must not be null");
- }
- if (!srcDir.exists()) {
- throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
- }
- if (!srcDir.isDirectory()) {
- throw new IOException("Source '" + srcDir + "' exists but is not a directory");
- }
- if (srcDir.getCanonicalPath().equals(destDir.getCanonicalPath())) {
- throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same");
- }
- doCopyDirectory(srcDir, destDir, preserveFileDate);
- }
-
- // -----------------------------------------------------------------------
- /**
- * Copies a directory to within another directory preserving the file dates.
- * <p>
- * This method copies the source directory and all its contents to a
- * directory of the same name in the specified destination directory.
- * <p>
- * The destination directory is created if it does not exist. If the
- * destination directory did exist, then this method merges the source with
- * the destination, with the source taking precedence.
- *
- * @param srcDir an existing directory to copy, must not be
- * <code>null</code>
- * @param destDir the directory to place the copy in, must not be
- * <code>null</code>
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @since Commons IO 1.2
- */
- public static void copyDirectoryToDirectory(File srcDir, File destDir) throws IOException {
- if (srcDir == null) {
- throw new NullPointerException("Source must not be null");
- }
- if (!(srcDir.exists() && srcDir.isDirectory())) {
- throw new IllegalArgumentException("Source '" + destDir + "' is not a directory");
- }
- if (destDir == null) {
- throw new NullPointerException("Destination must not be null");
- }
- if (!(destDir.exists() && destDir.isDirectory())) {
- throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
- }
- copyDirectory(srcDir, new File(destDir, srcDir.getName()), true);
- }
-
- /**
- * Copies a file to a new location preserving the file date.
- * <p>
- * This method copies the contents of the specified source file to the
- * specified destination file. The directory holding the destination file is
- * created if it does not exist. If the destination file exists, then this
- * method will overwrite it.
- *
- * @param srcFile an existing file to copy, must not be <code>null</code>
- * @param destFile the new file, must not be <code>null</code>
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @see #copyFileToDirectory(File, File)
- */
- public static void copyFile(File srcFile, File destFile) throws IOException {
- copyFile(srcFile, destFile, true);
- }
-
- /**
- * Copies a file to a new location.
- * <p>
- * This method copies the contents of the specified source file to the
- * specified destination file. The directory holding the destination file is
- * created if it does not exist. If the destination file exists, then this
- * method will overwrite it.
- *
- * @param srcFile an existing file to copy, must not be <code>null</code>
- * @param destFile the new file, must not be <code>null</code>
- * @param preserveFileDate true if the file date of the copy should be the
- * same as the original
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @see #copyFileToDirectory(File, File, boolean)
- */
- public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
- if (srcFile == null) {
- throw new NullPointerException("Source must not be null");
- }
- if (destFile == null) {
- throw new NullPointerException("Destination must not be null");
- }
- if (!srcFile.exists()) {
- throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
- }
- if (srcFile.isDirectory()) {
- throw new IOException("Source '" + srcFile + "' exists but is a directory");
- }
- if (srcFile.getCanonicalPath().equals(destFile.getCanonicalPath())) {
- throw new IOException("Source '" + srcFile + "' and destination '" + destFile + "' are the same");
- }
- if (!(destFile.getParentFile() != null && destFile.getParentFile().exists())) {
- if (!destFile.getParentFile().mkdirs()) { //NOPMD
- throw new IOException("Destination '" + destFile + "' directory cannot be created");
- }
- }
- if (!(destFile.exists() && destFile.canWrite())) {
- throw new IOException("Destination '" + destFile + "' exists but is read-only");
- }
- doCopyFile(srcFile, destFile, preserveFileDate);
- }
-
- // -----------------------------------------------------------------------
- /**
- * Copies a file to a directory preserving the file date.
- * <p>
- * This method copies the contents of the specified source file to a file of
- * the same name in the specified destination directory. The destination
- * directory is created if it does not exist. If the destination file
- * exists, then this method will overwrite it.
- *
- * @param srcFile an existing file to copy, must not be <code>null</code>
- * @param destDir the directory to place the copy in, must not be
- * <code>null</code>
- * @throws NullPointerException if source or destination is null
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @see #copyFile(File, File, boolean)
- */
- public static void copyFileToDirectory(File srcFile, File destDir) throws IOException {
- copyFileToDirectory(srcFile, destDir, true);
- }
-
- /**
- * Copies a file to a directory optionally preserving the file date.
- * <p>
- * This method copies the contents of the specified source file to a file of
- * the same name in the specified destination directory. The destination
- * directory is created if it does not exist. If the destination file
- * exists, then this method will overwrite it.
- *
- * @param srcFile an existing file to copy, must not be <code>null</code>
- * @param destDir the directory to place the copy in, must not be
- * <code>null</code>
- * @param preserveFileDate true if the file date of the copy should be the
- * same as the original
- * @throws NullPointerException if source or destination is
- * <code>null</code>
- * @throws IOException if source or destination is invalid
- * @throws IOException if an IO error occurs during copying
- * @see #copyFile(File, File, boolean)
- * @since Commons IO 1.3
- */
- public static void copyFileToDirectory(File srcFile, File destDir, boolean preserveFileDate) throws IOException {
- if (destDir == null) {
- throw new NullPointerException("Destination must not be null");
- }
- if (!(destDir.exists() && destDir.isDirectory())) {
- throw new IllegalArgumentException("Destination '" + destDir + "' is not a directory");
- }
- copyFile(srcFile, new File(destDir, srcFile.getName()), preserveFileDate);
- }
-
- // -----------------------------------------------------------------------
- /**
- * Recursively delete a directory.
- *
- * @param directory directory to delete
- * @throws IOException in case deletion is unsuccessful
- */
- public static void deleteDirectory(File directory) throws IOException {
- if (!directory.exists()) {
- return;
- }
-
- cleanDirectory(directory);
- if (!directory.delete()) {
- String message = "Unable to delete directory " + directory + ".";
- throw new IOException(message);
- }
- }
-
- /**
- * Recursively schedule directory for deletion on JVM exit.
- *
- * @param directory directory to delete, must not be <code>null</code>
- * @throws NullPointerException if the directory is <code>null</code>
- * @throws IOException in case deletion is unsuccessful
- */
- private static void deleteDirectoryOnExit(File directory) throws IOException {
- if (!directory.exists()) {
- return;
- }
-
- cleanDirectoryOnExit(directory);
- directory.deleteOnExit();
- }
-
- /**
- * Internal copy directory method.
- *
- * @param srcDir the validated source directory, must not be
- * <code>null</code>
- * @param destDir the validated destination directory, must not be
- * <code>null</code>
- * @param preserveFileDate whether to preserve the file date
- * @throws IOException if an error occurs
- * @since Commons IO 1.1
- */
- private static void doCopyDirectory(File srcDir, File destDir, boolean preserveFileDate) throws IOException {
- if (destDir.exists()) {
- if (!destDir.isDirectory()) {
- throw new IOException("Destination '" + destDir + "' exists but is not a directory");
- }
- } else {
- if (!destDir.mkdirs()) {
- throw new IOException("Destination '" + destDir + "' directory cannot be created");
- }
- if (preserveFileDate) {
- destDir.setLastModified(srcDir.lastModified());
- }
- }
- if (!destDir.canWrite()) {
- throw new IOException("Destination '" + destDir + "' cannot be written to");
- }
- // recurse
- File[] files = srcDir.listFiles();
- if (files == null) { // null if security restricted
- throw new IOException("Failed to list contents of " + srcDir);
- }
- for (int i = 0; i < files.length; i++) {
- File copiedFile = new File(destDir, files[i].getName());
- if (files[i].isDirectory()) {
- doCopyDirectory(files[i], copiedFile, preserveFileDate);
- } else {
- doCopyFile(files[i], copiedFile, preserveFileDate);
- }
- }
- }
-
- /**
- * Internal copy file method.
- *
- * @param srcFile the validated source file, must not be <code>null</code>
- * @param destFile the validated destination file, must not be
- * <code>null</code>
- * @param preserveFileDate whether to preserve the file date
- * @throws IOException if an error occurs
- */
- private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
- if (destFile.exists() && destFile.isDirectory()) {
- throw new IOException("Destination '" + destFile + "' exists but is a directory");
- }
-
- FileInputStream input = new FileInputStream(srcFile);
- try {
- FileOutputStream output = new FileOutputStream(destFile);
- try {
- IOHelper.copy(input, output);
- } finally {
- IOHelper.closeQuietly(output);
- }
- } finally {
- IOHelper.closeQuietly(input);
- }
-
- if (srcFile.length() != destFile.length()) {
- throw new IOException("Failed to copy full contents from '" + srcFile + "' to '" + destFile + "'");
- }
- if (preserveFileDate) {
- destFile.setLastModified(srcFile.lastModified());
- }
- }
-
- /**
- * Schedule a file to be deleted when JVM exits. If file is directory delete
- * it and all sub-directories.
- *
- * @param file file or directory to delete, must not be <code>null</code>
- * @throws NullPointerException if the file is <code>null</code>
- * @throws IOException in case deletion is unsuccessful
- */
- public static void forceDeleteOnExit(File file) throws IOException {
- if (file.isDirectory()) {
- deleteDirectoryOnExit(file);
- } else {
- file.deleteOnExit();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
deleted file mode 100644
index 630d1f6bf4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.jar.JarFile;
-
-public class IOHelper {
- /**
- * The default buffer size to use.
- */
- private static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
-
- /**
- * Unconditionally close an <code>InputStream</code>.
- * <p>
- * Equivalent to {@link InputStream#close()}, except any exceptions will be ignored.
- * This is typically used in finally blocks.
- *
- * @param input the InputStream to close, may be null or already closed
- */
- public static void closeQuietly(InputStream input) {
- try {
- if (input != null) {
- input.close();
- }
- } catch (IOException ioe) {
- // ignore
- }
- }
-
- /**
- * Unconditionally close an <code>OutputStream</code>.
- * <p>
- * Equivalent to {@link OutputStream#close()}, except any exceptions will be ignored.
- * This is typically used in finally blocks.
- *
- * @param output the OutputStream to close, may be null or already closed
- */
- public static void closeQuietly(OutputStream output) {
- try {
- if (output != null) {
- output.close();
- }
- } catch (IOException ioe) {
- // ignore
- }
- }
-
- /**
- * Copy bytes from an <code>InputStream</code> to an
- * <code>OutputStream</code>.
- * <p>
- * This method buffers the input internally, so there is no need to use a
- * <code>BufferedInputStream</code>.
- *
- * @param input the <code>InputStream</code> to read from
- * @param output the <code>OutputStream</code> to write to
- * @return the number of bytes copied
- * @throws NullPointerException if the input or output is null
- * @throws IOException if an I/O error occurs
- * @since Commons IO 1.1
- */
- public static int copy(InputStream input, OutputStream output) throws IOException {
- byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
- int count = 0;
- int n = 0;
- while (-1 != (n = input.read(buffer))) { // NOPMD
- output.write(buffer, 0, n);
- count += n;
- }
- return count;
- }
-
- public static InputStream getInputStream(URL url) throws IOException {
- return new SafeURLInputStream(url);
- }
-
- /**
- * This class is a workaround for URL stream issue as illustrated below.
- * InputStream is=url.getInputStream(); is.close(); // This line doesn't close
- * the JAR file if the URL is a jar entry like "jar:file:/a.jar!/my.composite" We
- * also need to turn off the JarFile cache.
- *
- * @see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4950148
- *
- * @version $Rev$ $Date$
- */
- public static class SafeURLInputStream extends InputStream {
- private JarFile jarFile;
- private InputStream is;
-
- public SafeURLInputStream(URL url) throws IOException {
- String protocol = url.getProtocol();
- if (protocol != null && (protocol.equals("jar"))) {
- JarURLConnection connection = (JarURLConnection)url.openConnection();
- // We cannot use cache
- connection.setUseCaches(false);
- try {
- is = connection.getInputStream();
- } catch (IOException e) {
- throw e;
- }
- jarFile = connection.getJarFile();
- } else {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- is = connection.getInputStream();
- }
- }
-
- public SafeURLInputStream(JarURLConnection connection) throws IOException {
- // We cannot use cache
- connection.setUseCaches(false);
- is = connection.getInputStream();
- jarFile = connection.getJarFile();
- }
-
- @Override
- public int available() throws IOException {
- return is.available();
- }
-
- @Override
- public void close() throws IOException {
- is.close();
- // We need to close the JAR file
- if (jarFile != null) {
- jarFile.close();
- }
- }
-
- @Override
- public synchronized void mark(int readlimit) {
- is.mark(readlimit);
- }
-
- @Override
- public boolean markSupported() {
- return is.markSupported();
- }
-
- @Override
- public int read() throws IOException {
- return is.read();
- }
-
- @Override
- public int read(byte[] b, int off, int len) throws IOException {
- return is.read(b, off, len);
- }
-
- @Override
- public int read(byte[] b) throws IOException {
- return is.read(b);
- }
-
- @Override
- public synchronized void reset() throws IOException {
- is.reset();
- }
-
- @Override
- public long skip(long n) throws IOException {
- return is.skip(n);
- }
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
deleted file mode 100644
index b644709266..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;type=application/vnd.tuscany.folder
-org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;type=application/x-compressed
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
deleted file mode 100644
index 158ee2102d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/main/resources/contribution-impl-validation-messages.properties
+++ /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.
-#
-#
-ContributionURINull =URI for the contribution is null
-SourceURLNull = Source URL for the contribution is null
-ContributionContentNull = The content of the contribution is null
-PrivilegedActionException = Exception occured due to FilePermissions in security policy file
-RootNotDirectory = The root is not a directory {0}
-IllegalArgumentException = IllegalArgumentException occured due to :
-DomainFileNotFound = Domain file "sca-domain.xml" not found ({0})
-MalformedURLException = MalformedURLException occured due to : \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
deleted file mode 100644
index c33b31b550..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.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.contribution.processor;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
-
-/**
- * Folder Package Processor test case
- * Verifies proper handle of File System structured contributions
- *
- * @version $Rev$ $Date$
- */
-public class FolderContributionPackageProcessorTestCase extends TestCase {
- private static final String FOLDER_CONTRIBUTION = ".";
-
- public final void testProcessPackageArtifacts() throws Exception {
- FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
- URL contributionURL = new File(FOLDER_CONTRIBUTION).toURL().toURI().toURL();
-
- List<URI> artifacts = folderProcessor.getArtifacts(contributionURL, null);
- assertNotNull(artifacts);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
deleted file mode 100644
index 9b3dce7029..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.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.contribution.processor;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-
-/**
- * JAR Package Processor test case
- * Verifies proper handle of JAR Archives contributions
- *
- * @version $Rev$ $Date$
- */
-
-public class JarContributionPackageProcessorTestCase extends TestCase {
- private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
-
- public final void testProcessPackageArtifacts() throws Exception {
- JarContributionProcessor jarProcessor = new JarContributionProcessor();
-
- URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
- InputStream jarStream = jarURL.openStream();
- List<URI> artifacts = null;
- try {
- artifacts = jarProcessor.getArtifacts(jarURL, jarStream);
- } finally {
- IOHelper.closeQuietly(jarStream);
- }
-
- assertNotNull(artifacts);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.java
deleted file mode 100644
index 46b4183380..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/URLartifactProcessorExtensionPointTestCase.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.contribution.processor;
-
-import java.net.URI;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-
-/**
- * URL Artifact Processor Extension Point test case
- * Verifies the right registration and lookup for processors that handle filename and file types
- *
- * @version $Rev$ $Date$
- */
-public class URLartifactProcessorExtensionPointTestCase extends TestCase {
-
- private URLArtifactProcessorExtensionPoint artifactProcessors;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- artifactProcessors = new DefaultURLArtifactProcessorExtensionPoint(extensionPoints);
- artifactProcessors.addArtifactProcessor(new FileTypeArtifactProcessor());
- artifactProcessors.addArtifactProcessor(new FileNameArtifactProcessor());
- }
-
-
- public final void testFileTypeProcessor() {
- assertNotNull(artifactProcessors.getProcessor(".m1"));
- }
-
-
- public final void testFileNameProcessor() {
- assertNotNull(artifactProcessors.getProcessor("file.m2"));
-
- }
-
- /**
- * Internal mock classes
- *
- */
-
- private class M1 {
- }
-
- private class M2 {
- }
-
- private class FileTypeArtifactProcessor implements URLArtifactProcessor<M1> {
- public FileTypeArtifactProcessor() {
- }
-
- public M1 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- return null;
- }
-
- public void resolve(M1 m1, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public String getArtifactType() {
- return ".m1";
- }
-
- public Class<M1> getModelType() {
- return M1.class;
- }
- }
-
- private class FileNameArtifactProcessor implements URLArtifactProcessor<M2> {
- public FileNameArtifactProcessor() {
- }
-
- public M2 read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- return null;
- }
-
- public void resolve(M2 m2, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public String getArtifactType() {
- return "file.m2";
- }
-
- public Class<M2> getModelType() {
- return M2.class;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.java
deleted file mode 100644
index 98852e951c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverTestCase.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.contribution.resolver;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-
-/**
- * Test the default model resolver implementation.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultModelResolverTestCase extends TestCase {
-
- private ModelResolver resolver;
- private ContributionFactory factory;
-
- @Override
- protected void setUp() throws Exception {
- resolver = new DefaultModelResolver();
- factory = new DefaultContributionFactory();
- }
-
- public void testResolved() {
- Model a = new Model("a");
- resolver.addModel(a);
- Model x = new Model("a");
- x = resolver.resolveModel(Model.class, x);
- assertTrue(x == a);
- }
-
- public void testUnresolved() {
- Model x = new Model("a");
- Model y = resolver.resolveModel(Model.class, x);
- assertTrue(x == y);
- }
-
- public void testResolvedArtifact() {
- Artifact artifact = factory.createArtifact();
- artifact.setURI("foo/bar");
- resolver.addModel(artifact);
- Artifact x = factory.createArtifact();
- x.setURI("foo/bar");
- x = resolver.resolveModel(Artifact.class, x);
- assertTrue(x == artifact);
- }
-
- class Model {
- private String name;
-
- Model(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return name.equals(((Model)obj).name);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java
deleted file mode 100644
index f66b429d65..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolverTestCase.java
+++ /dev/null
@@ -1,126 +0,0 @@
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-
-/**
- * Test DefaultArtifactResolver.
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleModelResolverTestCase extends TestCase {
- private ExtensibleModelResolver resolver;
-
- private ContributionFactory factory;
-
- @Override
- protected void setUp() throws Exception {
-
- ModelResolverExtensionPoint resolvers = new DefaultModelResolverExtensionPoint(null);
- resolvers.addResolver(Model.class, TestModelResolver.class);
-
- ModelFactoryExtensionPoint factories = new DefaultModelFactoryExtensionPoint();
-
- resolver = new ExtensibleModelResolver(null, null, resolvers, factories, null);
-
- factory = new DefaultContributionFactory();
- }
-
- public void testResolvedDefault() {
- OtherModel a = new OtherModel("a");
- resolver.addModel(a);
- OtherModel x = new OtherModel("a");
- x = resolver.resolveModel(OtherModel.class, x);
- assertTrue(x == a);
- }
-
- public void testResolvedRegisteredClass() {
- Model a = new Model("a");
- resolver.addModel(a);
- Model x = new Model("a");
- x = resolver.resolveModel(Model.class, x);
- assertTrue(x == a);
- }
-
- public void testUnresolvedDefault() {
- OtherModel x = new OtherModel("a");
- OtherModel y = resolver.resolveModel(OtherModel.class, x);
- assertTrue(x == y);
- }
-
- public void testUnresolved() {
- Model x = new Model("a");
- Model y = resolver.resolveModel(Model.class, x);
- assertTrue(x == y);
- }
-
- public void testResolvedArtifact() {
- Artifact artifact = factory.createArtifact();
- artifact.setURI("foo/bar");
- resolver.addModel(artifact);
- Artifact x = factory.createArtifact();
- x.setURI("foo/bar");
- x = resolver.resolveModel(Artifact.class, x);
- assertTrue(x == artifact);
- }
-
- private class Model {
- private String name;
-
- Model(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return name.equals(((Model)obj).name);
- }
- }
-
- private class OtherModel {
- private String name;
-
- OtherModel(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- return name.equals(((OtherModel)obj).name);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java
deleted file mode 100644
index 66ecd33da6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/TestModelResolver.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-
-/**
- * A test implementation of a model resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- public TestModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
- // Return the resolved object
- return modelClass.cast(resolved);
- }
- // Return the unresolved object
- return unresolved;
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryTestCase.java
deleted file mode 100644
index a90f5b36ad..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryTestCase.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.contribution.service.impl;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-
-public class ContributionRepositoryTestCase extends TestCase {
- private ContributionRepositoryImpl repository;
-
- @Override
- protected void setUp() throws Exception {
- // create repository (this should re-create the root directory)
- this.repository = new ContributionRepositoryImpl("target/repository/", XMLInputFactory.newInstance(), null);
- repository.init();
- }
-
- public void testStore() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- URL contributionURL = repository.find(contribution);
- assertNotNull(contributionURL);
- }
-
- public void testRemove() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- repository.remove(contribution);
- URL contributionURL = repository.find(contribution);
- assertNull(contributionURL);
- }
-
- public void testList() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- assertEquals(1, repository.list().size());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- FileHelper.deleteDirectory(new File("target/repository"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImplTestCase.java b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImplTestCase.java
deleted file mode 100644
index 49e9cc166b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/service/impl/PackageTypeDescriberImplTestCase.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.contribution.service.impl;
-
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
-
-public class PackageTypeDescriberImplTestCase extends TestCase {
- private PackageTypeDescriberImpl packageTypeDescriber;
-
- public void testResolveArchivePackageType() throws Exception {
- URL artifactURL = getClass().getResource("/deployables/sample-calculator.jar");
- assertEquals(PackageType.JAR, this.packageTypeDescriber.getType(artifactURL, null));
- }
-
- public void testResolveFolderPackageType() throws Exception {
- URL artifactURL = getClass().getResource("/deployables/");
- assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null));
- }
-
- public void testResolveFolder2PackageType() throws Exception {
- URL artifactURL = getClass().getResource("/deployables");
- assertEquals(PackageType.FOLDER, this.packageTypeDescriber.getType(artifactURL, null));
- }
-
-
- public void testResolveUnknownPackageType() throws Exception {
- URL artifactURL = getClass().getResource("/test.ext");
- assertNull(this.packageTypeDescriber.getType(artifactURL, null));
- }
-
- public void testDefaultPackageType() throws Exception {
- URL artifactURL = getClass().getResource("/test.ext");
- assertEquals("application/vnd.tuscany.ext",
- packageTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
- }
-
- @Override
- protected void setUp() throws Exception {
- packageTypeDescriber = new PackageTypeDescriberImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
deleted file mode 100644
index 0ca3a1b781..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/deployables/sample-calculator.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
deleted file mode 100644
index 7c042e64f1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository/sample-calculator.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository3/contribution.zip b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository3/contribution.zip
deleted file mode 100644
index b293aa4bcc..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/repository3/contribution.zip
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.composite b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.composite
deleted file mode 100644
index 1e09549194..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.composite
+++ /dev/null
@@ -1,22 +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>
- This file just needs to exist
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.ext b/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.ext
deleted file mode 100644
index e69de29bb2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-impl/src/test/resources/test.ext
+++ /dev/null
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/LICENSE b/branches/sca-java-1.5.1/modules/contribution-java/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/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-java-1.5.1/modules/contribution-java/NOTICE b/branches/sca-java-1.5.1/modules/contribution-java/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/pom.xml b/branches/sca-java-1.5.1/modules/contribution-java/pom.xml
deleted file mode 100644
index 36ff393bb3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/pom.xml
+++ /dev/null
@@ -1,77 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-java</artifactId>
- <name>Apache Tuscany SCA Java Import/Export Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.java</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.java*</Export-Package>
- <DynamicImport-Package>org.apache.tuscany.sca.contribution.osgi.impl</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassLoaderProvider.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassLoaderProvider.java
deleted file mode 100644
index aa314dd13f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassLoaderProvider.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.contribution.java;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-
-/**
- * A pluggable utility to provide a classloader for a given contribution
- */
-public interface ContributionClassLoaderProvider {
-
- /**
- * Get the contribution type that this object will provide
- * classloaders for. Takes values from o.a.t.s.contribution.PackageType
- *
- * @return
- */
- String getContributionType();
-
- /**
- * Get the classloader for the given contribution
- * @param contribution
- * @param parent
- * @return
- */
- ClassLoader getClassLoader(Contribution contribution, ClassLoader parent);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassloaderProviderExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassloaderProviderExtensionPoint.java
deleted file mode 100644
index b714090ff2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/ContributionClassloaderProviderExtensionPoint.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.contribution.java;
-
-/**
- * An extension point for contribution classloaders. Contribution
- * classloaders respect the classloading strategy for the contribution
- * in question. For example, a JAR contribution loads classes from its
- * root directory while an EAR contribution follows the JEE classloading
- * strategy. The choice of classloader is driven by the type of
- * contribution being loaded.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionClassloaderProviderExtensionPoint {
-
- /**
- * Add a contribution classloader provider extension.
- *
- * @param provider The provider to add
- */
- void addProvider(ContributionClassLoaderProvider provider);
-
- /**
- * Remove a contribution classloader provider extension.
- *
- * @param provider The provider to remove
- */
- void removeProvider(ContributionClassLoaderProvider provider);
-
- /**
- * Get a contribution classloader provider for the given contribution type.
- * @param contributionType the lookup key
- * @return The provider
- */
- ContributionClassLoaderProvider getProvider(String contributionType);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassLoaderProvider.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassLoaderProvider.java
deleted file mode 100644
index 8fd1898ad6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassLoaderProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.java.impl.ContributionClassLoader;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * The default implementation of the ContributionClassLoaderProvider
- */
-public class DefaultContributionClassLoaderProvider implements ContributionClassLoaderProvider {
-
- public DefaultContributionClassLoaderProvider() {
- super();
- }
-
- /**
- * returns null as it is the default provider and applies when no specific
- * provider has been specified
- */
- public String getContributionType() {
- return null;
- }
-
- public ClassLoader getClassLoader(Contribution contribution, ClassLoader parent) {
- return new ContributionClassLoader(contribution, parent);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassloaderProviderExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassloaderProviderExtensionPoint.java
deleted file mode 100644
index 7ffecdf312..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultContributionClassloaderProviderExtensionPoint.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-
-/**
- * Default implementation of a contribution classloader provider extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultContributionClassloaderProviderExtensionPoint implements ContributionClassloaderProviderExtensionPoint {
-
- private HashMap<String, ContributionClassLoaderProvider> providers = new HashMap<String, ContributionClassLoaderProvider>();
- private boolean loaded;
-
- /**
- * Constructs a new DefaultModelFactoryExtensionPoint.
- */
- public DefaultContributionClassloaderProviderExtensionPoint() {
- }
-
- /**
- * Add a contribution classloader provider extension.
- *
- * @param provider The provider to add
- */
- public void addProvider(ContributionClassLoaderProvider provider){
- providers.put(provider.getContributionType(), provider);
- }
-
- /**
- * Remove a contribution classloader provider extension.
- *
- * @param provider The provider to remove
- */
- public void removeProvider(ContributionClassLoaderProvider provider){
- providers.remove(provider.getContributionType());
- }
-
- /**
- * Get a contribution classloader provider for the given contribution type.
- * @param contributionType the lookup key
- * @return The provider
- */
- public ContributionClassLoaderProvider getProvider(String contributionType){
- loadProviders();
- return providers.get(contributionType);
- }
-
- private synchronized void loadProviders() {
- if (loaded)
- return;
-
- // Get the processor service declarations
- Set<ServiceDeclaration> processorDeclarations;
- try {
- processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionClassLoaderProvider.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration processorDeclaration: processorDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
-
- // Load a URL artifact processor
- String contributionType = attributes.get("type");
-
- // Create a processor wrapper and register it
- ContributionClassLoaderProvider provider = new LazyContributionClassLoaderProvider(contributionType, processorDeclaration);
- addProvider(provider);
- }
-
- loaded = true;
- }
-
- /**
- * A facade for package processors.
- */
- private static class LazyContributionClassLoaderProvider implements ContributionClassLoaderProvider {
-
- private ServiceDeclaration processorDeclaration;
- private String contributionType;
- private ContributionClassLoaderProvider provider;
-
- private LazyContributionClassLoaderProvider(String contributionType, ServiceDeclaration processorDeclaration) {
- this.processorDeclaration = processorDeclaration;
- this.contributionType = contributionType;
- }
-
- public String getContributionType() {
- return contributionType;
- }
-
- @SuppressWarnings("unchecked")
- public ClassLoader getClassLoader(Contribution contribution, ClassLoader parent){
- if (provider == null) {
- try {
- Class<ContributionClassLoaderProvider> providerClass = (Class<ContributionClassLoaderProvider>)processorDeclaration.loadClass();
- Constructor<ContributionClassLoaderProvider> constructor = providerClass.getConstructor();
- provider = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return provider.getClassLoader(contribution, parent);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.java
deleted file mode 100644
index 886c61c00a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/DefaultJavaImportExportFactory.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.contribution.java;
-
-import org.apache.tuscany.sca.contribution.java.impl.JavaImportExportFactoryImpl;
-
-/**
- * Default Java Import/Export Factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class DefaultJavaImportExportFactory extends JavaImportExportFactoryImpl implements JavaImportExportFactory {
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.java
deleted file mode 100644
index 41e93ec148..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaExport.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.contribution.java;
-
-import org.apache.tuscany.sca.contribution.Export;
-
-/**
- * Base Java Export model interface
- *
- * @version $Rev$ $Date$
- */
-public interface JavaExport extends Export {
- /**
- * Get java package that identifies the import
- *
- * @return The package name
- */
- String getPackage();
-
- /**
- * Set java package that identifies the import
- *
- * @param packageName The package name
- */
- void setPackage(String packageName);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java
deleted file mode 100644
index d3568f6283..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImport.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java;
-
-import org.apache.tuscany.sca.contribution.Import;
-
-/**
- * Base Java Import model interface
- *
- * @version $Rev$ $Date$
- */
-public interface JavaImport extends Import {
-
- /**
- * Get the location used to resolve the definitions for this import
- *
- * @return The import location
- */
- String getLocation();
-
- /**
- * Set the location used to resolve the definitions for this import
- *
- * @param location The import location
- */
- void setLocation(String location);
-
- /**
- * Get java package that identifies the import
- *
- * @return The package name
- */
- String getPackage();
-
- /**
- * Set java package that identifies the import
- *
- * @param packageName The package name
- */
- void setPackage(String packageName);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.java
deleted file mode 100644
index af2ca9cd57..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/JavaImportExportFactory.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.contribution.java;
-
-/**
- * Base Java Import/Export model factory
- *
- * @version $Rev$ $Date$
- */
-public interface JavaImportExportFactory {
-
- /**
- * Create a java import model object
- *
- * @return The new JavaImport model object
- */
- JavaImport createJavaImport();
-
- /**
- * Create a java export model object
- *
- * @return The new JavaExport model object
- */
- JavaExport createJavaExport();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
deleted file mode 100644
index e1243dbc6a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassLoaderModelResolver.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.DefaultDelegatingModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * A Model Resolver for ClassReferences.
- *
- * @version $Rev$ $Date$
- */
-public class ClassLoaderModelResolver extends URLClassLoader implements ModelResolver {
- private Contribution contribution;
- private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>();
-
- private static ClassLoader parentClassLoader() {
- ClassLoader parentClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
- return parentClassLoader;
- }
-
- private static URL[] getContributionURLs(final Contribution contribution) throws IOException {
- List<URL> urls = new ArrayList<URL>();
- urls.add(new URL(contribution.getLocation()));
- urls.addAll(ContributionHelper.getNestedJarUrls(contribution));
- return urls.toArray(new URL[urls.size()]);
- }
-
- public ClassLoaderModelResolver(final Contribution contribution, ModelFactoryExtensionPoint modelFactories) throws IOException {
- super(getContributionURLs(contribution), parentClassLoader());
- this.contribution = contribution;
-
- // Index Java import resolvers by package name
- Map<String, List<ModelResolver>> resolverMap = new HashMap<String, List<ModelResolver>>();
- for (Import import_: this.contribution.getImports()) {
- if (import_ instanceof JavaImport) {
- JavaImport javaImport = (JavaImport)import_;
- List<ModelResolver> resolvers = resolverMap.get(javaImport.getPackage());
- if (resolvers == null) {
- resolvers = new ArrayList<ModelResolver>();
- resolverMap.put(javaImport.getPackage(), resolvers);
- }
- resolvers.add(javaImport.getModelResolver());
- }
- }
-
- // Create a delegating model resolver for each imported package
- for (Map.Entry<String, List<ModelResolver>> entry: resolverMap.entrySet()) {
- importResolvers.put(entry.getKey(), new DefaultDelegatingModelResolver(entry.getValue()));
- }
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- if (!(unresolved instanceof ClassReference)) {
- return unresolved;
- }
-
- try {
-
- // Load the class and return a class reference for it
- String className = ((ClassReference)unresolved).getClassName();
- Class<?> clazz = Class.forName(className, true, this);
- return modelClass.cast(new ClassReference(clazz));
-
- } catch (ClassNotFoundException e) {
- return unresolved;
- } catch (NoClassDefFoundError e) {
- return unresolved;
- }
- }
-
- @Override
- public URL findResource(String name) {
-
- //TODO delegate to the Java import resolvers
-
- URL url = super.findResource(name);
- return url;
- }
-
- @Override
- public Enumeration<URL> findResources(String name) throws IOException {
-
- //TODO delegate to the Java import resolvers
- //Enumeration<URL> importedResources;
-
- Enumeration<URL> resources = super.findResources(name);
- List<URL> allResources = new ArrayList<URL>();
- //for (; importedResources.hasMoreElements(); ) {
- // allResources.add(importedResources.nextElement());
- //}
- for (; resources.hasMoreElements(); ) {
- allResources.add(resources.nextElement());
- }
- return Collections.enumeration(allResources);
- }
-
- @Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
-
- // Extract the package name
- int d = name.lastIndexOf('.');
- String packageName;
- if (d != -1) {
- packageName = name.substring(0, d);
- } else {
- packageName = null;
- }
-
- // First try to load the class using the Java import resolvers
- ModelResolver importResolver = importResolvers.get(packageName);
- if (importResolver != null) {
- ClassReference classReference = importResolver.resolveModel(ClassReference.class, new ClassReference(name));
- if (!classReference.isUnresolved()) {
- return classReference.getJavaClass();
- }
- }
-
- // Next, try to load the class from the current contribution
- Class<?> clazz = super.findClass(name);
- return clazz;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java
deleted file mode 100644
index 0b1c035ff4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceModelResolver.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import java.lang.ref.WeakReference;
-import java.lang.reflect.Constructor;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider;
-import org.apache.tuscany.sca.contribution.java.ContributionClassloaderProviderExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.DefaultContributionClassLoaderProvider;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * A Model Resolver for ClassReferences.
- *
- * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
- */
-public class ClassReferenceModelResolver implements ModelResolver {
- private final ExtensionPointRegistry registry;
- private final Contribution contribution;
- private WeakReference<ClassLoader> classLoader;
- private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
-
- private ModelResolver osgiResolver;
-
- public ClassReferenceModelResolver(final Contribution contribution, ExtensionPointRegistry registry) {
- this.contribution = contribution;
- this.registry = registry;
- if (this.contribution != null) {
- // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
- // ClassLoader cl = contribution.getClassLoader();
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return contribution.getClassLoader();
- }
- });
-
- if (cl == null) {
- // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
- //ClassLoader contextClassLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- // public ClassLoader run() {
- // return Thread.currentThread().getContextClassLoader();
- // }
- //});
- ClassLoader contextClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
- ContributionClassLoaderProvider provider = null;
- try {
- ContributionClassloaderProviderExtensionPoint providers =
- registry.getExtensionPoint(ContributionClassloaderProviderExtensionPoint.class);
-
- provider = providers.getProvider(contribution.getType());
-
- } catch (Throwable e) {
- // Ignore errors
- }
- if (provider == null) {
- provider = new DefaultContributionClassLoaderProvider();
- }
- cl = provider.getClassLoader(contribution, contextClassLoader);
- contribution.setClassLoader(cl);
- }
- this.classLoader = new WeakReference<ClassLoader>(cl);
- } else {
- // This path should be used only for unit testing.
- // Allow privileged access to get ClassLoader. Requires RuntimePermission in security policy.
- // this.classLoader = new WeakReference<ClassLoader>(this.getClass().getClassLoader());
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return this.getClass().getClassLoader();
- }
- });
- this.classLoader = new WeakReference<ClassLoader>( cl );
- }
-
- try {
- Class<?> osgiResolverClass =
- Class.forName("org.apache.tuscany.sca.contribution.osgi.impl.OSGiClassReferenceModelResolver");
- if (osgiResolverClass != null) {
- Constructor constructor =
- osgiResolverClass.getConstructor(Contribution.class, ExtensionPointRegistry.class);
- this.osgiResolver = (ModelResolver)constructor.newInstance(contribution, registry);
- }
- } catch (Throwable e) {
- // Ignore error, non-OSGi classloading is used in this case
- }
- }
-
- public void addModel(Object resolved) {
- ClassReference clazz = (ClassReference)resolved;
- map.put(clazz.getClassName(), clazz);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((ClassReference)resolved).getClassName());
- }
-
-
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- if (!(unresolved instanceof ClassReference)) {
- return unresolved;
- }
- Object resolved = map.get(((ClassReference)unresolved).getClassName());
-
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
-
- //Load a class on demand
- Class clazz = null;
-
- if (osgiResolver != null) {
- resolved = osgiResolver.resolveModel(modelClass, unresolved);
- clazz = ((ClassReference)resolved).getJavaClass();
- }
-
- if (clazz == null) {
- try {
- // Search contribution ClassLoader (which has visibility of classes in the contribution
- // as well as explicitly imported packages from other contributions)
- clazz = Class.forName(((ClassReference)unresolved).getClassName(), true, classLoader.get());
- } catch (ClassNotFoundException e) {
- } catch (NoClassDefFoundError e) {
- }
- }
-
- if (clazz != null) {
- //if we load the class
- // Store a new ClassReference wrapping the loaded class
- ClassReference classReference = new ClassReference(clazz);
- map.put(clazz.getName(), classReference);
-
- // Return the resolved ClassReference
- return modelClass.cast(classReference);
- } else {
- return unresolved;
- }
-
- }
-
-
- /***************
- * Helper methods
- ***************/
-
- private String getPackageName(ClassReference clazz) {
- int pos = clazz.getClassName().lastIndexOf(".");
- return clazz.getClassName().substring(0, pos);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
deleted file mode 100644
index b167d9af4e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoader.java
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-
-
-public class ContributionClassLoader extends URLClassLoader {
-// public class ContributionClassLoader {
-
- private Contribution contribution;
- // private b urlClassLoader;
-
- /**
- * Constructor for contribution ClassLoader
- *
- * @param contribution
- * @param parent
- * @throws MalformedURLException
- */
- public ContributionClassLoader(Contribution contribution, final ClassLoader parent) {
- super(new URL[0], parent);
- // Note that privileged use of getContextClassLoader have been promoted to callers.
- // super(new URL[0], parent == null?Thread.currentThread().getContextClassLoader(): null);
- this.contribution = contribution;
- if (contribution.getLocation() != null) {
- try {
- this.addURL(new URL(contribution.getLocation()));
- for (URL url : ContributionHelper.getNestedJarUrls(contribution)) {
- this.addURL(url);
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- /*
- * Return the ClassLoader corresponding to a contribution providing an export
- * Create a new ClassLoader for the contribution if one does not exist
- */
- private ClassLoader getExportClassLoader(Contribution exportingContribution) {
- ClassLoader cl = exportingContribution.getClassLoader();
- if (!(cl instanceof ContributionClassLoader)) {
- if (cl == null) {
- cl = getParent();
- }
-
- cl = new ContributionClassLoader(exportingContribution, cl);
- exportingContribution.setClassLoader(cl);
- }
- return cl;
- }
-
- /* (non-Javadoc)
- * @see java.net.URLClassLoader#findClass(java.lang.String)
- *
- * Search path for class:
- * This contribution
- * Imported contributions
- */
- @Override
- protected Class<?> findClass(String className) throws ClassNotFoundException {
-
- Class<?> clazz = null;
- try {
- clazz = findClassFromContribution(className);
- } catch (ClassNotFoundException e) {
-
- for (Import import_ : this.contribution.getImports()) {
- if (classNameMatchesImport(className, import_)) {
- // Delegate the resolution to the imported contribution
- for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
-
- ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
- if (exportClassLoader instanceof ContributionClassLoader) {
-
- for (Export export : exportingContribution.getExports()) {
- try {
- if (import_.match(export)) {
- clazz = ((ContributionClassLoader)exportClassLoader).findClassFromContribution(className);
- break;
- }
- } catch (ClassNotFoundException e1) {
- continue;
- }
-
- }
- if (clazz != null) break;
- }
- }
- if (clazz != null) break;
- }
- }
-
- if (clazz == null) throw e;
- }
- return clazz;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
- *
- * Search path for class:
- * Parent ClassLoader
- * This contribution
- * Imported contributions
- *
- */
- @Override
- protected synchronized Class<?> loadClass(String className, boolean resolveClass)
- throws ClassNotFoundException {
-
- Class<?> clazz = null;
- try {
-
- if (this.getParent() != null)
- clazz = this.getParent().loadClass(className);
-
- } catch (ClassNotFoundException e) {
- }
-
- if (clazz == null)
- clazz = findClass(className);
-
-
- if (resolveClass)
- this.resolveClass(clazz);
- return clazz;
-
- }
-
-
-
- /*
- * (non-Javadoc)
- *
- * @see java.net.URLClassLoader#findResource(java.lang.String)
- */
- @Override
- public URL findResource(String name) {
-
- URL url = findResourceFromContribution(name);
-
- if (url == null) {
- for (Import import_ : this.contribution.getImports()) {
- if (resourceNameMatchesImport(name, import_)) {
- // Delegate the resolution to the imported contribution
- for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
-
- ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
- if (exportClassLoader instanceof ContributionClassLoader) {
-
- for (Export export : exportingContribution.getExports()) {
- if (import_.match(export)) {
- url = ((ContributionClassLoader)exportClassLoader).findResourceFromContribution(name);
- if (url != null) break;
- }
- }
- if (url != null) break;
- }
- }
- if (url != null) break;
- }
- }
-
- }
- return url;
- }
-
-
- /* (non-Javadoc)
- * @see java.net.URLClassLoader#findResources(java.lang.String)
- */
- @Override
- public Enumeration<URL> findResources(String name) throws IOException {
-
- return Collections.enumeration(findResourceSet(name));
- }
-
-
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResource(java.lang.String)
- *
- * Find a resource.
- * Search path for resource:
- * Parent ClassLoader
- * This contribution
- * Imported contributions
- */
- @Override
- public URL getResource(String resName) {
-
- URL resource = null;
-
- if (this.getParent() != null) {
- resource = this.getParent().getResource(resName);
- }
- if (resource == null)
- resource = findResource(resName);
-
- return resource;
- }
-
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResources(java.lang.String)
- *
- * Return list of resources from this contribution, resources
- * imported through imported contributions and resources from parent
- * ClassLoader.
- */
- @Override
- public Enumeration<URL> getResources(String resName) throws IOException {
-
- HashSet<URL> resourceSet = findResourceSet(resName);
- addEnumerationToCollection(resourceSet, super.getResources(resName));
-
- return Collections.enumeration(resourceSet);
- }
-
-
- /*
- * Find set of resources
- */
- private HashSet<URL> findResourceSet(String name) throws IOException {
-
- HashSet<URL> resources = new HashSet<URL>();
-
- addEnumerationToCollection(resources, super.findResources(name));
-
- for (Import import_ : this.contribution.getImports()) {
- if (!(import_ instanceof JavaImport)) {
- continue;
- }
- if (resourceNameMatchesImport(name, import_)) {
- // Delegate the resolution to the imported contribution
- for (Contribution exportingContribution : ((JavaImportModelResolver)import_.getModelResolver()).getExportContributions()) {
-
- ClassLoader exportClassLoader = getExportClassLoader(exportingContribution);
- if (exportClassLoader instanceof ContributionClassLoader) {
-
- for (Export export : exportingContribution.getExports()) {
- if (import_.match(export)) {
- addEnumerationToCollection(resources,
- ((ContributionClassLoader)exportClassLoader).findResources(name));
- }
- }
- }
- }
- }
- }
-
- return resources;
- }
-
-
- /*
- * Find class from contribution. If class has already been loaded, return loaded class.
- */
- private Class<?> findClassFromContribution(String className) throws ClassNotFoundException {
-
- Class<?> clazz = findLoadedClass(className);
- if (clazz == null)
- clazz = super.findClass(className);
- return clazz;
-
- }
-
- /*
- * Find resource from contribution.
- */
- private URL findResourceFromContribution(String name) {
-
- return super.findResource(name);
- }
-
- /**
- * Check if a class name matches an import statement.
- * Class matches if the package name used in <import.java/> matches
- *
- * @param name Name of class
- * @param import_ SCA contribution import
- * @return true if this is a matching import
- */
- private boolean classNameMatchesImport(String name, Import import_) {
-
- if (import_ instanceof JavaImport && name != null && name.lastIndexOf('.') > 0) {
- JavaImport javaImport = (JavaImport) import_;
-
- String packageName = name.substring(0, name.lastIndexOf('.'));
- if (javaImport.getPackage().endsWith(".*")) {
- String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
- if (packageName.startsWith(prefix)) {
- return true;
- }
- } else {
- return packageName.equals(javaImport.getPackage());
- }
- }
-
- return false;
- }
-
- /**
- * Check if a resource name matches an import statement.
- * Resource matches if package/namespace match the directory of resource.
- *
- * @param name Name of resource
- * @param import_ SCA contribution import
- * @return true if this is a matching import
- */
- private boolean resourceNameMatchesImport(String name, Import import_) {
-
-
- if (name == null || name.lastIndexOf('/') <= 0)
- return false;
- else if (import_ instanceof JavaImport) {
- JavaImport javaImport = (JavaImport) import_;
-
- if (javaImport.getPackage().endsWith(".*")) {
- String packageName = name.substring(0, name.lastIndexOf('/')).replace('/', '.');
- String prefix = javaImport.getPackage().substring(0, javaImport.getPackage().length() -1);
- if (packageName.startsWith(prefix)) {
- return true;
- }
- } else {
- // 'name' is a resource : contains "/" as separators
- // Get package name from resource name
- String packageName = name.substring(0, name.lastIndexOf('/'));
- return packageName.equals(javaImport.getPackage().replaceAll("\\.", "/"));
- }
- }
- return false;
- }
-
- /*
- * Add an enumeration to a Collection
- */
- private <T extends Object> void addEnumerationToCollection(Collection<T> collection, Enumeration<T> enumeration) {
-
- while (enumeration.hasMoreElements())
- collection.add(enumeration.nextElement());
- }
-
-
- @Override
- public String toString() {
- return "SCA Contribution ClassLoader location: " + contribution.getLocation() + " parent ClassLoader: " + getParent();
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.java
deleted file mode 100644
index e913495789..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/ContributionHelper.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.contribution.java.impl;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-
-public class ContributionHelper {
-
- public static List<URL> getNestedJarUrls(final Contribution contribution) throws IOException {
- List<URL> urls = new ArrayList<URL>();
- boolean isZipContribution = contribution.getLocation().endsWith(".zip");
- URI uri = URI.create(contribution.getLocation());
- boolean isFolderContribution = !isZipContribution && uri.getScheme().equals("file") && new File(uri).isDirectory();
- if (isZipContribution || isFolderContribution) {
- for (Artifact a : contribution.getArtifacts()) {
- if (a.getLocation().endsWith(".jar")) {
- if (isZipContribution) {
- urls.add(createTempJar(a, contribution));
- } else {
- urls.add(new URL(a.getLocation()));
- }
- }
- }
- }
- return urls;
- }
-
- /**
- * URLClassLoader doesn't seem to work with URLs to jars within an archive so as a work around
- * copy the jar to a temp file and use the url to that.
- */
- private static URL createTempJar(Artifact artifact, Contribution contribution) throws IOException {
- FileOutputStream fileOutputStream = null;
- ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(new File(URI.create(contribution.getLocation()))));
- try {
- ZipEntry zipEntry = zipInputStream.getNextEntry();
- while (zipEntry != null) {
- if (artifact.getLocation().endsWith(zipEntry.getName())) {
-
- String tempName = ("tmp." + artifact.getURI().substring(0, artifact.getURI().length() - 3)).replace('/', '.');
- File tempFile = File.createTempFile(tempName, ".jar");
- tempFile.deleteOnExit();
- fileOutputStream = new FileOutputStream(tempFile);
-
- byte[] buf = new byte[2048];
- int n;
- while ((n = zipInputStream.read(buf, 0, buf.length)) > -1) {
- fileOutputStream.write(buf, 0, n);
- }
-
- fileOutputStream.close();
- zipInputStream.closeEntry();
-
- return tempFile.toURI().toURL();
-
- }
- zipEntry = zipInputStream.getNextEntry();
- }
- } finally {
- zipInputStream.close();
- if (fileOutputStream != null) {
- fileOutputStream.close();
- }
- }
-
- throw new IllegalStateException();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.java
deleted file mode 100644
index c0bd9465e4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportImpl.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.contribution.java.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * Implementation of a Java Import model
- *
- * @version $Rev$ $Date$
- */
-public class JavaExportImpl extends ExtensibleImpl implements JavaExport {
- private ModelResolver modelResolver;
-
- /**
- * Java package being exported
- */
- private String packageName;
-
- public JavaExportImpl() {
- super();
- }
-
- public String getPackage() {
- return this.packageName;
- }
-
- public void setPackage(String packageName) {
- this.packageName = packageName;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java
deleted file mode 100644
index 8d5412f6d7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportModelResolver.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A model resolver for Java exports.
- *
- * @version $Rev$ $Date$
- */
-public class JavaExportModelResolver implements ModelResolver {
-
- private JavaExport export;
- private ModelResolver resolver;
-
- public JavaExportModelResolver(JavaExport export, ModelResolver resolver) {
- this.export = export;
- this.resolver = resolver;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- if (!(unresolved instanceof ClassReference)) {
- return unresolved;
- }
-
- // Filter package name
- ClassReference classReference = (ClassReference)unresolved;
- String className = classReference.getClassName();
- int d = className.lastIndexOf('.');
- String packageName;
- if (d != -1) {
- packageName = className.substring(0, d);
- } else {
- packageName = "";
- }
- if (export.getPackage().equals(packageName)) {
-
- // Package matches the exported package, delegate to the
- // contribution's resolver
- return resolver.resolveModel(modelClass, unresolved);
- } else {
-
- // Package is not exported, return the unresolved object
- return unresolved;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java
deleted file mode 100644
index b79aa32dc3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessor.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact processor for Java Export
- *
- * @version $Rev$ $Date$
- */
-public class JavaExportProcessor implements StAXArtifactProcessor<JavaExport> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName EXPORT_JAVA = new QName(SCA10_NS, "export.java");
-
- private static final String PACKAGE = "package";
-
- private final JavaImportExportFactory factory;
- private final Monitor monitor;
-
- public JavaExportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- super();
- this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return EXPORT_JAVA;
- }
-
- public Class<JavaExport> getModelType() {
- return JavaExport.class;
- }
-
- /**
- * Process <export package=""/>
- */
- public JavaExport read(XMLStreamReader reader) throws ContributionReadException {
- JavaExport javaExport = this.factory.createJavaExport();
- QName element = null;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <export.java>
- if (EXPORT_JAVA.equals(element)) {
- String packageName = reader.getAttributeValue(null, PACKAGE);
- if (packageName == null) {
- error("AttributePackageMissing", reader);
- //throw new ContributionReadException("Attribute 'package' is missing");
- } else
- javaExport.setPackage(packageName);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (EXPORT_JAVA.equals(reader.getName())) {
- return javaExport;
- }
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return javaExport;
- }
-
- public void write(JavaExport javaExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <export.java>
- writer.writeStartElement(EXPORT_JAVA.getNamespaceURI(), EXPORT_JAVA.getLocalPart());
-
- if (javaExport.getPackage() != null) {
- writer.writeAttribute(PACKAGE, javaExport.getPackage());
- }
-
- writer.writeEndElement();
- }
-
- public void resolve(JavaExport javaExport, ModelResolver resolver) throws ContributionResolveException {
-
- if (javaExport.getPackage() != null)
- // Initialize the export resolver
- javaExport.setModelResolver(new JavaExportModelResolver(javaExport, resolver));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.java
deleted file mode 100644
index e5dc397f4e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportFactoryImpl.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.contribution.java.impl;
-
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
-
-/**
- * Java Import/Export Factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportExportFactoryImpl implements JavaImportExportFactory {
-
- public JavaImport createJavaImport() {
- return new JavaImportImpl();
- }
-
- public JavaExport createJavaExport() {
- return new JavaExportImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java
deleted file mode 100644
index 47cdc9767b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportExportListener.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionListener;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-
-/**
- * Java Import/Export contribution listener
- * The listener would process all import/export from a given contribution
- * and initialize the model resolvers properly
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportExportListener implements ContributionListener {
-
- private ContributionFactory contributionFactory;
-
- /**
- * Constructs a new JavaImportExportListener
- */
- public JavaImportExportListener(ModelFactoryExtensionPoint modelFactories) {
- contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- }
-
- /**
- * Initialize the import/export model resolvers
- * Export model resolvers are same as Contribution model resolver
- * Import model resolvers are matched to a specific contribution if a location URI is specified,
- * otherwise it try to resolve against all the other contributions
- * Also set the exporting contributions used by contribution ClassLoaders to
- * match import/export for class loading.
- */
- public void contributionAdded(ContributionRepository repository, Contribution contribution) {
-
- // If the contribution does not contain sca-contribution.xml metadata
- // (for example it's an existing JAR developed before SCA existed)
- // export all its Java packages
- ModelResolver modelResolver = contribution.getModelResolver();
-
- // Look for META-INF/sca-contribution.xml
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(Contribution.SCA_CONTRIBUTION_META);
- artifact = modelResolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() == null) {
-
- // Look for META-INF/sca-contribution-generated.xml
- artifact.setURI(Contribution.SCA_CONTRIBUTION_GENERATED_META);
- artifact = modelResolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() == null) {
-
- // No contribution metadata file was found, default to export all the
- // Java packages found in the contribution
- Set<String> packages = new HashSet<String>();
- for (Artifact a: contribution.getArtifacts()) {
- String uri = a.getURI();
- if (uri.endsWith(".class")) {
- uri = uri.substring(0, uri.length() - 6);
- int d = uri.lastIndexOf('/');
- if (d != -1) {
- packages.add(uri.substring(0, d).replace('/', '.'));
- }
- }
- }
-
- // Add Java export model objects for all the packages we found
- for (String pkg: packages) {
- JavaExport export = new JavaExportImpl();
- export.setPackage(pkg);
- contribution.getExports().add(export);
- }
- }
- }
-
- // Initialize the contribution exports
- for (Export export: contribution.getExports()) {
- export.setModelResolver(contribution.getModelResolver());
- }
-
- // Initialize the contribution imports
- for (Import import_: contribution.getImports()) {
- boolean initialized = false;
-
- if(import_ instanceof JavaImport) {
- JavaImport javaImport = (JavaImport) import_;
-
- //Find a matching contribution
- if(javaImport.getLocation() != null) {
- Contribution targetContribution = repository.getContribution(javaImport.getLocation());
- if (targetContribution != null) {
-
- // Find a matching contribution export
- for (Export export: targetContribution.getExports()) {
- if (export instanceof JavaExport) {
- JavaExport javaExport = (JavaExport)export;
- if (javaImport.getPackage().equals(javaExport.getPackage())) {
- List<Contribution> exportingContributions = new ArrayList<Contribution>();
- exportingContributions.add(targetContribution);
- javaImport.setModelResolver(new JavaImportModelResolver(exportingContributions, javaExport.getModelResolver()));
- initialized = true;
- break;
- }
- }
- }
- }
- }
-
- //if no location was specified, try to resolve with any contribution
- if (!initialized) {
- //Use a resolver that will consider all contributions
- import_.setModelResolver(new JavaImportModelResolver(repository.getContributions(), new DefaultImportAllModelResolver(import_, repository.getContributions())));
- }
- }
- }
- }
-
- public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
-
- }
-
- public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.java
deleted file mode 100644
index f2fdb3278e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportImpl.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.contribution.java.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * Implementation of a Java Import model
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportImpl extends ExtensibleImpl implements JavaImport {
- private ModelResolver modelResolver;
- private List<Contribution> contributions;
- /**
- * Java package name being imported
- */
- private String packageName;
- /**
- * Contribution URI where the artifact is imported from
- */
- private String location;
-
- public JavaImportImpl() {
- super();
- }
-
- public String getLocation() {
- return this.location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getPackage() {
- return this.packageName;
- }
-
- public void setPackage(String packageName) {
- this.packageName = packageName;
- }
-
- public ModelResolver getModelResolver() {
- return this.modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
- public List<Contribution> getExportContributions() {
- return contributions;
- }
-
- public void setExportContributions(List<Contribution> contributions) {
- this.contributions = contributions;
- }
-
- /**
- * Match a JavaImport to a given JavaExport based on :
- * location is not provided
- * import and export packages match
- */
- public boolean match(Export export) {
- if(export instanceof JavaExport) {
- JavaExport javaExport = (JavaExport)export;
- String exportedPackage = javaExport.getPackage();
- if (packageName.equals(exportedPackage)) {
- return true;
- } else {
- if (packageName.endsWith(".*")) {
- String prefix = packageName.substring(0, packageName.length() - 1);
- if (exportedPackage.startsWith(prefix)) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
- @Override
- public String toString() {
- return String.valueOf(packageName);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.java
deleted file mode 100644
index 484eddd222..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportModelResolver.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.contribution.java.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A JavaImport specific model resolver. This model resolver is temporary
- * and provides the ContributionClassLoader with the list of exporting
- * contributions that it currently needs.
- *
- * FIXME Remove this class after the ContributionClassLoader is simplified
- * and cleaned up.
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportModelResolver implements ModelResolver {
-
- private ModelResolver modelResolver;
- private List<Contribution> contributions;
-
- public JavaImportModelResolver(List<Contribution> contributions, ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- this.contributions = contributions;
- }
-
- public List<Contribution> getExportContributions() {
- return contributions;
- }
-
- public void addModel(Object resolved) {
- modelResolver.addModel(resolved);
- }
-
- public Object removeModel(Object resolved) {
- return modelResolver.removeModel(resolved);
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- return modelResolver.resolveModel(modelClass, unresolved);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
deleted file mode 100644
index d18977714c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessor.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact Processor for Java Imports
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportProcessor implements StAXArtifactProcessor<JavaImport> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName IMPORT_JAVA = new QName(SCA10_NS, "import.java");
-
- private static final String PACKAGE = "package";
- private static final String LOCATION = "location";
-
- private final JavaImportExportFactory factory;
- private final Monitor monitor;
-
- public JavaImportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- super();
- this.factory = modelFactories.getFactory(JavaImportExportFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-java-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return IMPORT_JAVA;
- }
-
- public Class<JavaImport> getModelType() {
- return JavaImport.class;
- }
-
- /**
- * Process <import.java package="" location=""/>
- */
- public JavaImport read(XMLStreamReader reader) throws ContributionReadException {
- JavaImport javaImport = this.factory.createJavaImport();
- QName element = null;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <import.java>
- if (IMPORT_JAVA.equals(element)) {
- String packageName = reader.getAttributeValue(null, PACKAGE);
- if (packageName == null) {
- error("AttributePackageMissing", reader);
- //throw new ContributionReadException("Attribute 'package' is missing");
- } else
- javaImport.setPackage(packageName);
-
- String location = reader.getAttributeValue(null, LOCATION);
- javaImport.setLocation(location);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (IMPORT_JAVA.equals(reader.getName())) {
- return javaImport;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return javaImport;
- }
-
- public void write(JavaImport javaImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <import.java>
- writer.writeStartElement(IMPORT_JAVA.getNamespaceURI(), IMPORT_JAVA.getLocalPart());
-
- if (javaImport.getPackage() != null) {
- writer.writeAttribute(PACKAGE, javaImport.getPackage());
- }
- if (javaImport.getLocation() != null) {
- writer.writeAttribute(LOCATION, javaImport.getLocation());
- }
-
- writer.writeEndElement();
- }
-
-
- public void resolve(JavaImport model, ModelResolver resolver) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider
deleted file mode 100644
index caf247750d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.contribution.java.DefaultContributionClassLoaderProvider;type=application/x-compressed
-org.apache.tuscany.sca.contribution.java.DefaultContributionClassLoaderProvider;type=application/vnd.tuscany.folder
-org.apache.tuscany.sca.contribution.java.DefaultContributionClassLoaderProvider;type=application/osgi.bundle
-
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassloaderProviderExtensionPoint b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassloaderProviderExtensionPoint
deleted file mode 100644
index e6cf964e81..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassloaderProviderExtensionPoint
+++ /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.contribution.java.DefaultContributionClassloaderProviderExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
deleted file mode 100644
index a293330a57..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.JavaImportExportFactory
+++ /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.contribution.java.impl.JavaImportExportFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index ac1fa9aade..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.java.impl.JavaImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import.java,model=org.apache.tuscany.sca.contribution.java.JavaImport
-org.apache.tuscany.sca.contribution.java.impl.JavaExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export.java,model=org.apache.tuscany.sca.contribution.java.JavaExport
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index c69eb40636..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.contribution.java.impl.ClassReferenceModelResolver;model=org.apache.tuscany.sca.contribution.resolver.ClassReference
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
deleted file mode 100644
index 7debb3d3c6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
+++ /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.contribution.java.impl.JavaImportExportListener
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
deleted file mode 100644
index 09fc3e9fff..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/main/resources/contribution-java-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-AttributePackageMissing = Attribute 'package' is missing
-XMLStreamException = XMLStreamException occured due to : {0}
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java b/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
deleted file mode 100644
index 52c8567f3f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ClassReferenceArtifactResolverTestCase.java
+++ /dev/null
@@ -1,70 +0,0 @@
- /*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Test ClassReferenceArtifactResolver.
- *
- * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
- */
-public class ClassReferenceArtifactResolverTestCase extends TestCase {
- private ExtensibleModelResolver resolver;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-
- ModelResolverExtensionPoint resolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- resolvers.addResolver(ClassReference.class, ClassReferenceModelResolver.class);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- resolver = new ExtensibleModelResolver(null, extensionPoints);
- }
-
- /**
- * Test ClassReference resolution
- *
- */
- public void testResolveClass() {
- ClassReference ref = new ClassReference(getClass().getName());
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertFalse(clazz.isUnresolved());
- assertTrue(clazz.getJavaClass() == getClass());
- }
-
- /**
- * Test ClassReference resolution of inexistent class
- *
- */
- public void testUnresolvedClass() {
- ClassReference ref = new ClassReference("NonExistentClass");
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertTrue(clazz.isUnresolved());
- assertTrue(clazz.getJavaClass() == null);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java b/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.java
deleted file mode 100644
index 3ae161642d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/ContributionClassLoaderTestCase.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.contribution.java.impl;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.java.JavaImportExportFactory;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-
-/**
- * Test ContributionClassLoader.
- *
- */
-public class ContributionClassLoaderTestCase {
-
- private ContributionFactory contributionFactory;
- private JavaImportExportFactory javaImportExportFactory;
-
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- javaImportExportFactory = modelFactories.getFactory(JavaImportExportFactory.class);
- }
-
- private Contribution createContribution(String fileName) throws MalformedURLException {
- Contribution contrib = contributionFactory.createContribution();
- File contribDir = new File(fileName);
- contrib.setLocation(contribDir.toURI().toURL().toString());
- ClassLoader contextClassLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- contrib.setClassLoader(new ContributionClassLoader(contrib, contextClassLoader));
- return contrib;
- }
-
-
- @Test
- public void testClassLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
-
- Contribution contribA = createContribution("target/test-classes");
- Contribution contribB = createContribution("target");
- Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
-
- // Class present in contribution, also in parent. Class is loaded from parent
- Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
- Assert.assertNotNull(testClassA);
- Assert.assertSame(this.getClass(), testClassA);
-
- // Class not present in contribution, but present in parent ClassLoader
- Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
- Assert.assertNotNull(testClassB);
- Assert.assertSame(this.getClass(), testClassB);
-
- // Class present in contribution, but not in parent
- Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
- Assert.assertNotNull(testClassC);
-
- // Class not present in contribution or in parent
- try {
- contribA.getClassLoader().loadClass("NonExistent");
-
- Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
-
- } catch (ClassNotFoundException e) {
- }
-
-
-
- }
-
- @Test
- public void testResourceLoadingFromContribution() throws ClassNotFoundException, MalformedURLException {
-
- Contribution contribA = createContribution("target/test-classes");
- Contribution contribB = createContribution("target");
- Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
-
- // Resource present in contribution, and in parent
- URL resA = contribA.getClassLoader().getResource("deployables/sample-calculator.jar");
- Assert.assertNotNull(resA);
-
- // Resource not present in contribution, but present in parent ClassLoader
- URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
- Assert.assertNotNull(resB);
-
- // Resource present in contribution, but not in parent
- URL resC = contribC.getClassLoader().getResource("calculator/AddService.class");
- Assert.assertNotNull(resC);
-
- // Load Java class as resource from parent
- String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
- URL classResA = contribA.getClassLoader().getResource(classResName);
- Assert.assertNotNull(classResA);
-
- // Non-existent resource
- URL res = contribA.getClassLoader().getResource("deployables/NonExistent");
- Assert.assertNull(res);
-
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- @Test
- public void testClassLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
-
- Contribution contribA = createContribution("target/test-classes");
- Contribution contribB = createContribution("target");
- Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
- ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
- exportContribList.add(contribA);
- exportContribList.add(contribC);
-
- JavaImport import_ = javaImportExportFactory.createJavaImport();
- import_.setPackage(getPackageName(getClass()));
- import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
- contribB.getImports().add(import_);
- import_ = javaImportExportFactory.createJavaImport();
- import_.setPackage("calculator");
- import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
- contribB.getImports().add(import_);
-
- JavaExport export = javaImportExportFactory.createJavaExport();
- export.setPackage(getPackageName(getClass()));
- contribA.getExports().add(export);
- export = javaImportExportFactory.createJavaExport();
- export.setPackage("calculator");
- contribC.getExports().add(export);
-
- // Load class from parent, class is also present in imported contribution. Class should
- // be loaded from parent
- Class<?> testClassB = contribB.getClassLoader().loadClass(this.getClass().getName());
- Assert.assertNotNull(testClassB);
- Assert.assertSame(this.getClass(), testClassB);
-
- // Load class from parent, class is also present in parent. Class should be loaded
- // from parent.
- Class<?> testClassA = contribA.getClassLoader().loadClass(this.getClass().getName());
- Assert.assertNotNull(testClassA);
- Assert.assertSame(this.getClass(), testClassA);
-
- // Imported class should be the same as the one loaded by the exporting contribution
- Assert.assertSame(testClassA, testClassB);
-
- // Load class from imported contribution, class is not present in parent
- Class<?> testClassB1 = contribB.getClassLoader().loadClass("calculator.AddService");
- Assert.assertNotNull(testClassB1);
-
- // Imported class should be the same as the one loaded by the exporting contribution
- Class<?> testClassC = contribC.getClassLoader().loadClass("calculator.AddService");
- Assert.assertNotNull(testClassC);
- Assert.assertSame(testClassC, testClassB1);
-
-
- // Try to load class from package which is not explicitly imported - should throw ClassNotFoundException
- try {
- contribA.getClassLoader().loadClass("calculator.AddService");
-
- Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
-
- } catch (ClassNotFoundException e) {
- }
-
- // Try to load non-existent class from imported package - should throw ClassNotFoundException
- try {
- contribB.getClassLoader().loadClass(getPackageName(getClass()) + ".NonExistentClass");
-
- Assert.assertTrue("ClassNotFoundException not thrown as expected", false);
-
- } catch (ClassNotFoundException e) {
- }
-
- }
-
- @Test
- public void testResourceLoadingFromImportedContribution() throws ClassNotFoundException, MalformedURLException {
-
- Contribution contribA = createContribution("target/test-classes");
- Contribution contribB = createContribution("target");
- Contribution contribC = createContribution("target/test-classes/deployables/sample-calculator.jar");
-
- ArrayList<Contribution> exportContribList = new ArrayList<Contribution>();
- exportContribList.add(contribA);
- exportContribList.add(contribC);
-
- JavaImport import_ = javaImportExportFactory.createJavaImport();
- import_.setPackage(getPackageName(getClass()));
- import_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
- contribB.getImports().add(import_);
- JavaImport import1_ = javaImportExportFactory.createJavaImport();
- import1_.setPackage("calculator");
- import1_.setModelResolver(new JavaImportModelResolver(exportContribList, null));
- contribB.getImports().add(import1_);
-
- JavaExport export = javaImportExportFactory.createJavaExport();
- export.setPackage(getPackageName(getClass()));
- contribA.getExports().add(export);
- JavaExport export1 = javaImportExportFactory.createJavaExport();
- export1.setPackage("calculator");
- contribC.getExports().add(export1);
-
-
- // Load resource from parent
- URL resB = contribB.getClassLoader().getResource("deployables/sample-calculator.jar");
- Assert.assertNotNull(resB);
-
- // Load Java class as resource from imported contribution with JavaImport
- String classResName = this.getClass().getName().replaceAll("\\.", "/") + ".class";
- URL classResB = contribB.getClassLoader().getResource(classResName);
- Assert.assertNotNull(classResB);
-
- // Load Java class as resource from imported contribution with JavaImport
- URL classResB1 = contribB.getClassLoader().getResource("calculator/AddService.class");
- Assert.assertNotNull(classResB1);
-
- // Try to load resource not explicitly imported by contribution
- URL classResA1 = contribA.getClassLoader().getResource("calculator/AddService.class");
- Assert.assertNull(classResA1);
-
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
deleted file mode 100644
index 0ec5bfba39..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaExportProcessorTestCase.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.java.impl;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test JavaExportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class JavaExportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\"/>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- /**
- * Test loading a valid export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- JavaExport javaExport = (JavaExport)staxProcessor.read(reader);
- assertEquals("org.apache.tuscany.sca.contribution.java", javaExport.getPackage());
- }
-
- /**
- * Test loading an INVALID export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributePackageMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.java
deleted file mode 100644
index 9e43b744cf..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/test/java/org/apache/tuscany/sca/contribution/java/impl/JavaImportProcessorTestCase.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.contribution.java.impl;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test JavaImportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class JavaImportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" package=\"org.apache.tuscany.sca.contribution.java\" location=\"sca://contributions/001\"/>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import.java xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- /**
- * Test loading a valid import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- JavaImport javaImport = (JavaImport)staxProcessor.read(reader);
-
- assertEquals("org.apache.tuscany.sca.contribution.java", javaImport.getPackage());
- assertEquals("sca://contributions/001", javaImport.getLocation());
- }
-
- /**
- * Test loading a INVALID import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributePackageMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar b/branches/sca-java-1.5.1/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
deleted file mode 100644
index 0ca3a1b781..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-java/src/test/resources/deployables/sample-calculator.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/LICENSE b/branches/sca-java-1.5.1/modules/contribution-jee-impl/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/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-java-1.5.1/modules/contribution-jee-impl/NOTICE b/branches/sca-java-1.5.1/modules/contribution-jee-impl/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/pom.xml b/branches/sca-java-1.5.1/modules/contribution-jee-impl/pom.xml
deleted file mode 100644
index ef31ab481e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/pom.xml
+++ /dev/null
@@ -1,127 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-jee-impl</artifactId>
- <name>Apache Tuscany SCA Java EE Impl</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-jee</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <!-- TUSCANY-3165 Waiting for 3.0.2 to be released so
- reverting to 3.0.1 for now. JEE itest will no work on
- windows due to this
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-core</artifactId>
- <version>3.0.2-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-jee</artifactId>
- <version>3.0.2-SNAPSHOT</version>
- </dependency>
- -->
-
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-core</artifactId>
- <version>3.0.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.openejb</groupId>
- <artifactId>openejb-jee</artifactId>
- <version>3.0.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.jee</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.jee*</Export-Package>
- <DynamicImport-Package>org.apache.tuscany.sca.contribution.osgi.impl</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JEEDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JEEDefinitionsProvider.java
deleted file mode 100644
index 262875c49a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JEEDefinitionsProvider.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class JEEDefinitionsProvider implements SCADefinitionsProvider {
- private static final String definitionsFile = "org/apache/tuscany/sca/contribution/jee/definitions.xml";
-
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public JEEDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- SCADefinitions scaDefns = null;
- try {
- // Allow privileged access to load resource. Requires
- // RuntimePermssion in security policy.
- URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(definitionsFile);
- }
- });
-
- URI uri = new URI(definitionsFile);
-
- scaDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
-
- return scaDefns;
-
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEModuleHelper.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEModuleHelper.java
deleted file mode 100644
index ccb66e8965..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEModuleHelper.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.contribution.jee;
-
-import java.io.File;
-
-import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.config.AnnotationDeployer;
-import org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.DeploymentLoader;
-import org.apache.openejb.config.ReadDescriptors;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaEEModuleHelper {
-
- public AppModule getMetadataCompleteModules(String jarFilePath) throws ContributionReadException {
- DeploymentLoader loader = new DeploymentLoader();
- AppModule appModule = null;
- try {
- appModule = loader.load(new File(jarFilePath));
- } catch (OpenEJBException e) {
- throw new ContributionReadException(e);
- }
-
- // Process deployment descriptor files
- ReadDescriptors readDescriptors = new ReadDescriptors();
- try {
- readDescriptors.deploy(appModule);
- } catch (OpenEJBException e) {
- throw new ContributionReadException(e);
- }
-
- // Process annotations
- AnnotationDeployer annDeployer = new AnnotationDeployer();
- try {
- annDeployer.deploy(appModule);
- } catch (OpenEJBException e) {
- throw new ContributionReadException(e);
- }
-
- return appModule;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoader.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoader.java
deleted file mode 100644
index 87cdaa2cf3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoader.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-
-
-public class EARContributionClassLoader extends URLClassLoader {
-
- private Contribution contribution;
- private List<EjbModuleInfo> ejbModules = new ArrayList<EjbModuleInfo>();
-
- /**
- * Constructor for contribution ClassLoader
- *
- * @param contribution
- * @param parent
- * @throws MalformedURLException
- */
- public EARContributionClassLoader(Contribution contribution, final ClassLoader parent) {
- super(new URL[0], parent);
-
- this.contribution = contribution;
-
- // get the classloaders for any EAR archive that is a contribution
- for (Artifact artifact : contribution.getArtifacts()){
- if (artifact.getModel() instanceof JavaEEApplicationInfo){
- JavaEEApplicationInfo jeeAppInfo = (JavaEEApplicationInfo)artifact.getModel();
- // TODO - won't these all have the same classloader?
- ejbModules.addAll(jeeAppInfo.getEjbModuleInfos().values());
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see java.net.URLClassLoader#findClass(java.lang.String)
- *
- * Search path for class:
- * This contribution
- * Imported contributions
- */
- @Override
- protected Class<?> findClass(String className) throws ClassNotFoundException {
-
- Class<?> clazz = null;
- ClassNotFoundException cne = null;
-
- // TODO - Won't these classloaders all be the same?
- for (EjbModuleInfo ejbModuleInfo : ejbModules){
- try {
- clazz = ejbModuleInfo.getModuleClassloader().loadClass(className);
- } catch (ClassNotFoundException e) {
- cne = e;
- }
-
- if (clazz != null){
- break;
- }
- }
-
- if (clazz == null){
- throw cne;
- }
-
- return clazz;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
- *
- * Search path for class:
- * Parent ClassLoader
- * This contribution
- * Imported contributions
- *
- */
- @Override
- protected synchronized Class<?> loadClass(String className, boolean resolveClass)
- throws ClassNotFoundException {
-
- Class<?> clazz = null;
- try {
-
- if (this.getParent() != null)
- clazz = this.getParent().loadClass(className);
-
- } catch (ClassNotFoundException e) {
- }
-
- if (clazz == null)
- clazz = findClass(className);
-
-
- if (resolveClass)
- this.resolveClass(clazz);
- return clazz;
-
- }
-
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResource(java.lang.String)
- *
- * Find a resource.
- * Search path for resource:
- * Parent ClassLoader
- * This contribution
- */
- @Override
- public URL getResource(String resName) {
-
- URL resource = null;
-
- if (this.getParent() != null) {
- resource = this.getParent().getResource(resName);
- }
- if (resource == null) {
-// TODO Which classloader?
-// resource = webModuleInfo.getModuleClassloader().getResource(resName);
- }
-
- return resource;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResources(java.lang.String)
- *
- * Return list of resources from this contribution, resources
- * imported through imported contributions and resources from parent
- * ClassLoader.
- */
- @Override
- public Enumeration<URL> getResources(String resName) throws IOException {
-
- HashSet<URL> resourceSet = new HashSet<URL>();
-
-// TODO - which classloader
-// addEnumerationToCollection(resourceSet, webModuleInfo.getModuleClassloader().getResources(resName));
- addEnumerationToCollection(resourceSet, super.getResources(resName));
-
- return Collections.enumeration(resourceSet);
- }
-
- /*
- * Add an enumeration to a Collection
- */
- private <T extends Object> void addEnumerationToCollection(Collection<T> collection, Enumeration<T> enumeration) {
-
- while (enumeration.hasMoreElements())
- collection.add(enumeration.nextElement());
- }
-
-
- @Override
- public String toString() {
- return "SCA JEE ClassLoader, parent ClassLoader: " + getParent();
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoaderProvider.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoaderProvider.java
deleted file mode 100644
index 5ea7dc55f7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EARContributionClassLoaderProvider.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.contribution.jee.impl;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider;
-import org.apache.tuscany.sca.contribution.java.impl.ContributionClassLoader;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * The default implementation of the ContributionClassLoaderProvider
- */
-public class EARContributionClassLoaderProvider implements ContributionClassLoaderProvider {
-
- public EARContributionClassLoaderProvider() {
- super();
- }
-
- public String getContributionType() {
- return PackageType.EAR;
- }
-
- public ClassLoader getClassLoader(Contribution contribution, ClassLoader parent) {
- // TODO - This is not quite right at the CCL will load up the nested jars
- // also. However we do need to pick up the import processing so
- // need a bit of a refactor
- ContributionClassLoader ccl = new ContributionClassLoader(contribution, parent);
- return new EARContributionClassLoader(contribution, ccl);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEIntrospectorImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEIntrospectorImpl.java
deleted file mode 100644
index 89a09c84c5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEIntrospectorImpl.java
+++ /dev/null
@@ -1,421 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Map;
-
-import org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.config.UnknownModuleTypeException;
-import org.apache.openejb.config.UnsupportedModuleTypeException;
-import org.apache.openejb.config.WebModule;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.EjbRef;
-import org.apache.openejb.jee.EjbRefType;
-import org.apache.openejb.jee.EjbReference;
-import org.apache.openejb.jee.EnterpriseBean;
-import org.apache.openejb.jee.EnvEntry;
-import org.apache.openejb.jee.Filter;
-import org.apache.openejb.jee.Listener;
-import org.apache.openejb.jee.MessageDrivenBean;
-import org.apache.openejb.jee.Servlet;
-import org.apache.openejb.jee.SessionBean;
-import org.apache.openejb.jee.SessionType;
-import org.apache.openejb.jee.WebApp;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector;
-import org.apache.tuscany.sca.contribution.jee.JavaEEModuleHelper;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo.EjbType;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaEEIntrospectorImpl implements JavaEEIntrospector {
-
- public WebModuleInfo introspectWebArchive(URL artifactURL) throws ContributionReadException {
- // Create a temporary file since openejb extracts the archive to process
- InputStream inp = null;
- File tempFile = null;
- try {
- URLConnection connection = artifactURL.openConnection();
- connection.setUseCaches(false);
- inp = connection.getInputStream();
- tempFile = File.createTempFile("temp", ".war");
- FileOutputStream fout = new FileOutputStream(tempFile);
- IOHelper.copy(inp, fout);
- fout.close();
- inp.close();
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
-
- JavaEEModuleHelper jmh = new JavaEEModuleHelper();
- WebModule wm = jmh.getMetadataCompleteModules(tempFile.getAbsolutePath()).getWebModules().get(0);
- if(!tempFile.delete()) {
- tempFile.deleteOnExit();
- }
- return createWebModuleInfo(wm);
- }
-
- private WebModuleInfo createWebModuleInfo(WebModule webModule) {
- WebModuleInfo wmInfo = new WebModuleInfoImpl();
-
- WebApp webApp = webModule.getWebApp();
- ClassLoader classLoader = webModule.getClassLoader();
- wmInfo.setmoduleClassloader(classLoader);
-
- // Process Remote EJB References
- for (Map.Entry<String, EjbRef> entry : webApp.getEjbRefMap().entrySet()) {
- EjbRef ejbRef = entry.getValue();
- if(ejbRef.getHome() != null) {
- // References to only EJB3 beans need to be considered.
- // Skip the current on as it is not a reference to an EJB3 bean.
- continue;
- }
- if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
- // Only Remote EJB references need to be considered.
- // Skip the current one as it is not a remote reference.
- continue;
- }
- //FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
- if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
- // Only references to Session beans need to be considered.
- // Skip the current one as it is not a Session bean.
- continue;
- }
-
- try {
- wmInfo.getEjbReferences().put(ejbRef.getEjbRefName(), createEjbReferenceInfo(ejbRef, classLoader));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process env-entries to compute properties
- for (Map.Entry<String, EnvEntry> entry : webApp.getEnvEntryMap().entrySet()) {
- EnvEntry envEntry = entry.getValue();
- wmInfo.getEnvEntries().put(envEntry.getEnvEntryName(), createEnvEntryInfo(envEntry));
- }
-
- // Process Servlets
- for(Servlet servlet: webApp.getServlet()) {
- try {
- wmInfo.getServletClasses().add(classLoader.loadClass(servlet.getServletClass()));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process Filters
- for(Filter filter: webApp.getFilter()) {
- try {
- wmInfo.getFilterClasses().add(classLoader.loadClass(filter.getFilterClass()));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process Listeners
- for(Listener listener: webApp.getListener()) {
- try {
- wmInfo.getListenerClasses().add(classLoader.loadClass(listener.getListenerClass()));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // TODO: Process JSF Managed beans
-
- // TODO: Process JSP pages
-
- return wmInfo;
- }
-
- private org.apache.tuscany.sca.contribution.jee.EnvEntryInfo createEnvEntryInfo(EnvEntry envEntry) {
- org.apache.tuscany.sca.contribution.jee.EnvEntryInfo envEntryInfo = new org.apache.tuscany.sca.contribution.jee.EnvEntryInfo();
- envEntryInfo.name = envEntry.getEnvEntryName();
- envEntryInfo.type = envEntry.getEnvEntryType();
- envEntryInfo.value = envEntry.getEnvEntryValue();
-
- return envEntryInfo;
- }
-
- private org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo createEjbReferenceInfo(EjbRef ejbRef, ClassLoader classLoader) throws ClassNotFoundException {
- org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo ejbReferenceInfo = new org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo();
-
- ejbReferenceInfo.referenceName = ejbRef.getEjbRefName();
- ejbReferenceInfo.referenceType = ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) == 0 ? org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo.RefType.REMOTE : ejbRef.getRefType().compareTo(EjbReference.Type.LOCAL) == 0 ? org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo.RefType.LOCAL : org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo.RefType.UNKNOWN;
- ejbReferenceInfo.businessInterface = classLoader.loadClass(ejbRef.getInterface());
-
- ejbReferenceInfo.ejbType = EjbType.UNKNOWN;
- if(ejbRef.getEjbRefType() != null) {
- if(ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) == 0) {
- ejbReferenceInfo.ejbType = EjbType.SESSION_UNKNOWN;
- }
- }
-
- ejbReferenceInfo.ejbLink = ejbRef.getEjbLink();
- ejbReferenceInfo.mappedName = ejbRef.getMappedName();
-
- return ejbReferenceInfo;
- }
-
- public EjbModuleInfo introspectEjbArchive(URL artifactURL) throws ContributionReadException {
- // Create a temporary file since openejb extracts the archive to process
- InputStream inp = null;
- File tempFile = null;
- try {
- URLConnection connection = artifactURL.openConnection();
- connection.setUseCaches(false);
- inp = connection.getInputStream();
- tempFile = File.createTempFile("temp", ".jar");
- FileOutputStream fout = new FileOutputStream(tempFile);
- IOHelper.copy(inp, fout);
- fout.close();
- inp.close();
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
-
- JavaEEModuleHelper jmh = new JavaEEModuleHelper();
- EjbModule em;
- try {
- em = jmh.getMetadataCompleteModules(tempFile.getAbsolutePath()).getEjbModules().get(0);
- } catch(ContributionReadException e) {
- if((e.getCause() instanceof UnknownModuleTypeException) ||
- (e.getCause() instanceof UnsupportedModuleTypeException)) {
- // Not an EJB jar
- return null;
- } else {
- throw e;
- }
- } finally {
- if(!tempFile.delete()) {
- tempFile.deleteOnExit();
- }
- }
- return createEjbModuleInfo(em);
- }
-
- private EjbModuleInfo createEjbModuleInfo(EjbModule ejbModule) {
- EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
-
- EjbJar ejbJar = ejbModule.getEjbJar();
- if (!ejbJar.getVersion().startsWith("3")) {
- // Not an EJB3 module
- // TODO: should throw an exception
- return null;
- }
-
- ClassLoader classLoader = ejbModule.getClassLoader();
- ejbModuleInfo.setmoduleClassloader(classLoader);
- Map<String, EnterpriseBean> beansMap = ejbJar.getEnterpriseBeansByEjbName();
- for (Map.Entry<String, EnterpriseBean> entry : beansMap.entrySet()) {
- EnterpriseBean bean = entry.getValue();
- EjbInfo ejbInfo = null;
- if (bean instanceof SessionBean) {
- SessionBean sbean = (SessionBean)bean;
- ejbInfo = createEjbInfo(sbean, classLoader);
- } else if (bean instanceof MessageDrivenBean) {
- MessageDrivenBean mdbean = (MessageDrivenBean)bean;
- ejbInfo = createEjbInfo(mdbean, classLoader);
- } else {
- continue;
- }
- if (ejbInfo != null) {
- // Bean is an EJB3 bean
- ejbModuleInfo.getEjbInfos().put(bean.getEjbName(), ejbInfo);
- }
- }
-
- return ejbModuleInfo;
- }
-
- private EjbInfo createEjbInfo(MessageDrivenBean bean, ClassLoader classLoader) {
- try {
- if(javax.ejb.MessageDrivenBean.class.isAssignableFrom(classLoader.loadClass(bean.getEjbClass()))) {
- // Not an EJB3 bean
- return null;
- }
- } catch (ClassNotFoundException ignored) {
- // Should not happen
- }
- EjbInfo ejbInfo = new EjbInfo();
-
- ejbInfo.beanName = bean.getEjbName();
-
- try {
- ejbInfo.beanClass = classLoader.loadClass(bean.getEjbClass());
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- ejbInfo.ejbType = org.apache.tuscany.sca.contribution.jee.EjbInfo.EjbType.MESSAGE_DRIVEN;
-
- ejbInfo.mappedName = bean.getMappedName();
-
- processReferencesEnvEntries(bean, classLoader, ejbInfo);
-
- return ejbInfo;
- }
-
- private EjbInfo createEjbInfo(SessionBean bean, ClassLoader classLoader) {
- if(bean.getBusinessRemote().size() == 0 && bean.getBusinessLocal().size() == 0) {
- // Not an EJB3 Session bean
- return null;
- }
- EjbInfo ejbInfo = new EjbInfo();
-
- ejbInfo.beanName = bean.getEjbName();
-
- try {
- ejbInfo.beanClass = classLoader.loadClass(bean.getEjbClass());
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- ejbInfo.ejbType = bean.getSessionType().equals(SessionType.STATEFUL) ? org.apache.tuscany.sca.contribution.jee.EjbInfo.EjbType.SESSION_STATEFUL : bean.getSessionType().equals(SessionType.STATELESS) ? org.apache.tuscany.sca.contribution.jee.EjbInfo.EjbType.SESSION_STATELESS : org.apache.tuscany.sca.contribution.jee.EjbInfo.EjbType.SESSION_UNKNOWN;
-
- ejbInfo.mappedName = bean.getMappedName();
- //FIXME: Is it ok to use beanName when mapped name is null?
- if(ejbInfo.mappedName == null) {
- ejbInfo.mappedName = ejbInfo.beanName;
- }
-
- // Process Remote Business interfaces of the SessionBean
- for (String intfName : bean.getBusinessRemote()) {
- try {
- ejbInfo.businessRemote.add(classLoader.loadClass(intfName));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process Local Business interfaces of the SessionBean
- for (String intfName : bean.getBusinessLocal()) {
- try {
- ejbInfo.businessLocal.add(classLoader.loadClass(intfName));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- processReferencesEnvEntries(bean, classLoader, ejbInfo);
-
- return ejbInfo;
- }
-
- private void processReferencesEnvEntries(EnterpriseBean bean, ClassLoader classLoader, EjbInfo ejbInfo) {
- // Process Remote EJB References
- for (Map.Entry<String, EjbRef> entry : bean.getEjbRefMap().entrySet()) {
- EjbRef ejbRef = entry.getValue();
- if(ejbRef.getHome() != null) {
- // References to only EJB3 beans need to be considered.
- // Skip the current on as it is not a reference to an EJB3 bean.
- continue;
- }
- if (ejbRef.getRefType().compareTo(EjbReference.Type.REMOTE) != 0) {
- // Only Remote EJB references need to be considered.
- // Skip the current one as it is not a remote reference.
- continue;
- }
- //FIXME: ejbRef.getEjbRefType() is null sometimes. Need a different way to figure the type.
- if(ejbRef.getEjbRefType() != null && ejbRef.getEjbRefType().compareTo(EjbRefType.SESSION) != 0) {
- // Only references to Session beans need to be considered.
- // Skip the current one as it is not a Session bean.
- continue;
- }
-
- try {
- ejbInfo.ejbReferences.put(ejbRef.getEjbRefName(), createEjbReferenceInfo(ejbRef, classLoader));
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process env-entries
- for (Map.Entry<String, EnvEntry> entry : bean.getEnvEntryMap().entrySet()) {
- EnvEntry envEntry = entry.getValue();
-
- ejbInfo.envEntries.put(envEntry.getEnvEntryName(), createEnvEntryInfo(envEntry));
- }
- }
-
- public JavaEEApplicationInfo introspectJeeArchive(URL artifactURL) throws ContributionReadException {
- // Create a temporary file since openejb extracts the archive to process
- InputStream inp = null;
- File tempFile = null;
- try {
- URLConnection connection = artifactURL.openConnection();
- connection.setUseCaches(false);
- inp = connection.getInputStream();
- tempFile = File.createTempFile("temp", ".ear");
- FileOutputStream fout = new FileOutputStream(tempFile);
- IOHelper.copy(inp, fout);
- fout.close();
- inp.close();
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
-
- JavaEEModuleHelper jmh = new JavaEEModuleHelper();
- AppModule appModule = jmh.getMetadataCompleteModules(tempFile.getAbsolutePath());
- if(!tempFile.delete()) {
- tempFile.deleteOnExit();
- }
- return createJavaEEApplicationInfo(appModule);
- }
-
- private org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo createJavaEEApplicationInfo(AppModule appModule) {
- JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
- for(EjbModule em : appModule.getEjbModules()){
- EjbModuleInfo ejbModuleInfo = createEjbModuleInfo(em);
- ejbModuleInfo.setModuleName(em.getModuleId());
- appInfo.getEjbModuleInfos().put(em.getModuleId(), ejbModuleInfo);
- }
-
- for(WebModule wm : appModule.getWebModules()) {
- WebModuleInfo webModuleInfo = createWebModuleInfo(wm);
- webModuleInfo.setModuleName(wm.getModuleId());
- appInfo.getWebModuleInfos().put(wm.getModuleId(), webModuleInfo);
- }
-
- return appInfo;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoader.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoader.java
deleted file mode 100644
index 4047371583..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoader.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-
-
-public class WARContributionClassLoader extends URLClassLoader {
-
- private Contribution contribution;
- private WebModuleInfo webModuleInfo = null;
-
- /**
- * Constructor for contribution ClassLoader
- *
- * @param contribution
- * @param parent
- * @throws MalformedURLException
- */
- public WARContributionClassLoader(Contribution contribution, final ClassLoader parent) {
- super(new URL[0], parent);
-
- this.contribution = contribution;
-
- // get the classloaders for any WAR archive that is a contribution
- // TODO extend to case where JEE archive is outside the contribution
- for (Artifact artifact : contribution.getArtifacts()){
- if (artifact.getModel() instanceof WebModuleInfo){
- webModuleInfo = (WebModuleInfo)artifact.getModel();
- break;
- }
- }
-
- }
-
- /* (non-Javadoc)
- * @see java.net.URLClassLoader#findClass(java.lang.String)
- *
- * Search path for class:
- * This contribution
- * Imported contributions
- */
- @Override
- protected Class<?> findClass(String className) throws ClassNotFoundException {
-
- Class<?> clazz = null;
- ClassNotFoundException cne = null;
-
- try {
- clazz = webModuleInfo.getModuleClassloader().loadClass(className);
- } catch (ClassNotFoundException e) {
- cne = e;
- }
-
- if (clazz == null){
- throw cne;
- }
-
- return clazz;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#loadClass(java.lang.String, boolean)
- *
- * Search path for class:
- * Parent ClassLoader
- * This contribution
- * Imported contributions
- *
- */
- @Override
- protected synchronized Class<?> loadClass(String className, boolean resolveClass)
- throws ClassNotFoundException {
-
- Class<?> clazz = null;
- try {
-
- if (this.getParent() != null)
- clazz = this.getParent().loadClass(className);
-
- } catch (ClassNotFoundException e) {
- }
-
- if (clazz == null)
- clazz = findClass(className);
-
-
- if (resolveClass)
- this.resolveClass(clazz);
- return clazz;
-
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResource(java.lang.String)
- *
- * Find a resource.
- * Search path for resource:
- * Parent ClassLoader
- * This contribution
- */
- @Override
- public URL getResource(String resName) {
-
- URL resource = null;
-
- if (this.getParent() != null) {
- resource = this.getParent().getResource(resName);
- }
- if (resource == null)
- resource = webModuleInfo.getModuleClassloader().getResource(resName);
-
- return resource;
- }
-
-
- /* (non-Javadoc)
- * @see java.lang.ClassLoader#getResources(java.lang.String)
- *
- * Return list of resources from this contribution, resources
- * imported through imported contributions and resources from parent
- * ClassLoader.
- */
- @Override
- public Enumeration<URL> getResources(String resName) throws IOException {
-
- HashSet<URL> resourceSet = new HashSet<URL>();
-
- addEnumerationToCollection(resourceSet, webModuleInfo.getModuleClassloader().getResources(resName));
- addEnumerationToCollection(resourceSet, super.getResources(resName));
-
- return Collections.enumeration(resourceSet);
- }
-
-
- /*
- * Add an enumeration to a Collection
- */
- private <T extends Object> void addEnumerationToCollection(Collection<T> collection, Enumeration<T> enumeration) {
-
- while (enumeration.hasMoreElements())
- collection.add(enumeration.nextElement());
- }
-
-
- @Override
- public String toString() {
- return "SCA WAR ClassLoader, parent ClassLoader: " + getParent();
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoaderProvider.java b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoaderProvider.java
deleted file mode 100644
index d2af85a7d5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WARContributionClassLoaderProvider.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.contribution.jee.impl;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider;
-import org.apache.tuscany.sca.contribution.java.impl.ContributionClassLoader;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * The default implementation of the ContributionClassLoaderProvider
- */
-public class WARContributionClassLoaderProvider implements ContributionClassLoaderProvider {
-
- public WARContributionClassLoaderProvider() {
- super();
- }
-
- public String getContributionType() {
- return PackageType.WAR;
- }
-
- public ClassLoader getClassLoader(Contribution contribution, ClassLoader parent) {
- // TODO - This is not quite right at the CCL will load up the nested jars
- // also. However we do need to pick up the import processing so
- // need a bit of a refactor
- ContributionClassLoader ccl = new ContributionClassLoader(contribution, parent);
- return new WARContributionClassLoader(contribution, ccl);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider
deleted file mode 100644
index 460bf3206c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.java.ContributionClassLoaderProvider
+++ /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.contribution.jee.impl.EARContributionClassLoaderProvider;type=application/ear
-org.apache.tuscany.sca.contribution.jee.impl.WARContributionClassLoaderProvider;type=application/war \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector
deleted file mode 100644
index 35c1b709a5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector
+++ /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.contribution.jee.impl.JavaEEIntrospectorImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index cd81aab7a0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.contribution.jee.JEEDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/org/apache/tuscany/sca/contribution/jee/definitions.xml b/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/org/apache/tuscany/sca/contribution/jee/definitions.xml
deleted file mode 100644
index bfc7f9097c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee-impl/src/main/resources/org/apache/tuscany/sca/contribution/jee/definitions.xml
+++ /dev/null
@@ -1,35 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
-
- <!-- JEE Intents Defined by the SCA Runtime -->
- <intent name="ejb"
- constrains="sca:service sca:reference">
- <description>
- This intent is used to indicate that a message passing
- through a service or reference observers the same rules
- as if it had been received/sent by a vanilla Java EE EJB.
- </description>
- </intent>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/LICENSE b/branches/sca-java-1.5.1/modules/contribution-jee/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/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-java-1.5.1/modules/contribution-jee/NOTICE b/branches/sca-java-1.5.1/modules/contribution-jee/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/pom.xml b/branches/sca-java-1.5.1/modules/contribution-jee/pom.xml
deleted file mode 100644
index c1aec3d0df..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/pom.xml
+++ /dev/null
@@ -1,100 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-jee</artifactId>
- <name>Apache Tuscany SCA Java EE</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.eclipse.emf</groupId>
- <artifactId>common</artifactId>
- <version>2.2.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.jee</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.jee*</Export-Package>
- <DynamicImport-Package>org.apache.tuscany.sca.contribution.osgi.impl</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.java
deleted file mode 100644
index 770fb08279..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EJBImplementationGenerated.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.contribution.jee;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-
-/**
- * The model representing an EJB implementation in an SCA assembly model when the
- * EJB implementation has been generated by introspecting a non-enhanced EAR
- */
-public interface EJBImplementationGenerated extends Implementation {
-
- /**
- * Return the EjbInfo which generated this EJB component implementation
- * @return
- */
- EjbInfo getEJBInfo();
-
- /**
- * Set the EjbInfo which generated this EJB component implementation
- * @param ejbInfo
- */
- void setEJBInfo(EjbInfo ejbInfo);
-
- /**
- * return the EjbModuleInfo which contains the EJB Info used to generate this object
- *
- * @return
- */
- EjbModuleInfo getEjbModuleInfo();
-
- /**
- * Set the EjbModuleInfo which contains the EJB Info used to generate this object
- *
- * @param ejbModuleInfo
- */
- void setEjbModuleInfo(EjbModuleInfo ejbModuleInfo);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbInfo.java
deleted file mode 100644
index c3cb4e7b90..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EjbInfo {
- public enum EjbType {SESSION_STATELESS, SESSION_STATEFUL, SESSION_UNKNOWN, MESSAGE_DRIVEN};
- public String beanName;
- public Class<?> beanClass;
- public String mappedName;
- public EjbType ejbType;
- public Collection<Class<?>> businessRemote = new ArrayList<Class<?>>();
- public Collection<Class<?>> businessLocal = new ArrayList<Class<?>>();
- public Map<String, EjbReferenceInfo> ejbReferences = new HashMap<String, EjbReferenceInfo>();
- public Map<String, EnvEntryInfo> envEntries = new HashMap<String, EnvEntryInfo>();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleInfo.java
deleted file mode 100644
index 00f7011111..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleInfo.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface EjbModuleInfo {
- URI getUri();
- void setUri(URI uri);
-
- String getModuleName();
- void setModuleName(String moduleName);
-
- ClassLoader getModuleClassloader();
- void setmoduleClassloader(ClassLoader classLoader);
-
- Map<String, EjbInfo> getEjbInfos();
- EjbInfo getEjbInfo(String beanName);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleModelResolver.java
deleted file mode 100644
index 72d594c4d0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbModuleModelResolver.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for EjbModule models.
- *
- * @version $Rev$ $Date$
- */
-public class EjbModuleModelResolver implements ModelResolver {
-
- private Map<URI, EjbModuleInfo> map = new HashMap<URI, EjbModuleInfo>();
- private Contribution contribution;
-
- public EjbModuleModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- EjbModuleInfo ejbModule = (EjbModuleInfo)resolved;
- map.put(ejbModule.getUri(), ejbModule);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((EjbModuleInfo)resolved).getUri());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- // Lookup a EjbModuleInfo for the given URI
- URI uri = ((EjbModuleInfo)unresolved).getUri();
- if (uri != null) {
- EjbModuleInfo resolved = (EjbModuleInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- } else {
- uri = URI.create("");
- resolved = (EjbModuleInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- }
- }
- return unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbReferenceInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbReferenceInfo.java
deleted file mode 100644
index 109a32d62c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EjbReferenceInfo.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.contribution.jee;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EjbReferenceInfo {
- public enum EjbType {STATELESS, STATEFUL, SESSION_UNKNOWN, UNKNOWN};
- public enum RefType {LOCAL, REMOTE, UNKNOWN};
- public String referenceName;
- public EjbType ejbType;
- public RefType referenceType;
- public Class<?> businessInterface;
- public String ejbLink;
- public String mappedName;
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EnvEntryInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EnvEntryInfo.java
deleted file mode 100644
index 26ce44c07e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/EnvEntryInfo.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.contribution.jee;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class EnvEntryInfo {
- public String type;
- public String name;
- public String value;
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ExternalEarInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ExternalEarInfo.java
deleted file mode 100644
index c0b54156ea..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ExternalEarInfo.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.contribution.jee;
-
-import org.apache.tuscany.sca.assembly.Composite;
-
-
-/**
- * @version $Rev: 755722 $ $Date: 2009-03-18 20:23:02 +0000 (Wed, 18 Mar 2009) $
- */
-public interface ExternalEarInfo {
-
- JavaEEApplicationInfo getAppInfo();
- Composite getAppComposite();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationInfo.java
deleted file mode 100644
index 107c251ea7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationInfo.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface JavaEEApplicationInfo {
- URI getUri();
- void setUri(URI uri);
-
- String getApplicationName();
- void setApplicationName(String applicationName);
-
- Map<String, WebModuleInfo> getWebModuleInfos();
- WebModuleInfo getWebModuleInfo(String moduleName);
- Map<String, EjbModuleInfo> getEjbModuleInfos();
- EjbModuleInfo getEjbModuleInfo(String moduleName);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationModelResolver.java
deleted file mode 100644
index e27fa5ae44..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEApplicationModelResolver.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for JavaEEApplicationInfo models.
- *
- * @version $Rev$ $Date$
- */
-public class JavaEEApplicationModelResolver implements ModelResolver {
-
- private Map<URI, JavaEEApplicationInfo> map = new HashMap<URI, JavaEEApplicationInfo>();
- private Contribution contribution;
-
- public JavaEEApplicationModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- JavaEEApplicationInfo jeeApp = (JavaEEApplicationInfo)resolved;
- map.put(jeeApp.getUri(), jeeApp);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((JavaEEApplicationInfo)resolved).getUri());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- // Lookup a JavaEEApplicationInfo for the given URI
- URI uri = ((JavaEEApplicationInfo)unresolved).getUri();
- if (uri != null) {
- JavaEEApplicationInfo resolved = (JavaEEApplicationInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- } else {
- uri = URI.create("");
- resolved = (JavaEEApplicationInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- }
- }
- return unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java
deleted file mode 100644
index 7b7d1f161f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEExtension.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-
-/**
- * Compute componentType with EJB3 business interfaces translating into SCA services.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaEEExtension {
- // The EJBImplementation model is a straight implementation so we deal in
- // component types
- ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName);
-
- // The JEEImplemenation model is a composite and so we have to fluff
- // up the composite contents to match the JEE artifact
- void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite);
- void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEIntrospector.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEIntrospector.java
deleted file mode 100644
index ab89ce2bf7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEIntrospector.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * Introspect JavaEE modules and applications.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaEEIntrospector {
- WebModuleInfo introspectWebArchive(URL artifactURL) throws ContributionReadException;
- EjbModuleInfo introspectEjbArchive(URL artifactURL) throws ContributionReadException;
- JavaEEApplicationInfo introspectJeeArchive(URL artifactURL) throws ContributionReadException;
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.java
deleted file mode 100644
index 50a449ce78..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JavaEEOptionalExtension.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.contribution.jee;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-
-/**
- * Compute componentType with Remote EJB references translating into SCA references and env-entries translating into
- * SCA properties.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaEEOptionalExtension {
- // The EJBImplementation and WEBImplemenation models are straight implementations so
- // we deals in component types
- ComponentType createImplementationWebComponentType(WebModuleInfo webModule);
- ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName);
-
- // The JEEImplemenation model is a composite and so we have to fluff
- // up the composite contents to match the JEE artifact
- void createImplementationJeeComposite(WebModuleInfo webModule, Composite composite);
- void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite);
- void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JspReferenceTagInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JspReferenceTagInfo.java
deleted file mode 100644
index e36aea2790..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/JspReferenceTagInfo.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.contribution.jee;
-
-
-/**
- * @version $Rev$ $Date$
- *
- * Information on SCA reference tags in JSP pages.
- */
-public class JspReferenceTagInfo {
- public String name;
- public Class<?> type;
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObject.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObject.java
deleted file mode 100644
index e981339733..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObject.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface ModelObject {
- URI getUri();
- void setUri(URI uri);
-
- Object getObject();
- void setObject(Object obj);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObjectModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObjectModelResolver.java
deleted file mode 100644
index aa24dcac2c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/ModelObjectModelResolver.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.impl.ModelObjectImpl;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for obtaining any model object using URI.
- *
- * @version $Rev$ $Date$
- */
-public class ModelObjectModelResolver implements ModelResolver {
-
- private Map<URI, ModelObject> map = new HashMap<URI, ModelObject>();
- private Contribution contribution;
-
- public ModelObjectModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- map.put(((ModelObject)resolved).getUri(), (ModelObject)resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((ModelObject)resolved).getUri());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- URI uri = ((ModelObject)unresolved).getUri();
- if (uri != null) {
- ModelObject resolved = (ModelObject) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- } else {
- for(Artifact artifact : contribution.getArtifacts()) {
- if(artifact.getURI().equals(uri.toString())) {
- resolved = new ModelObjectImpl();
- resolved.setUri(uri);
- resolved.setObject(artifact.getModel());
- return modelClass.cast(resolved);
- }
- }
- }
- }
- return unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.java
deleted file mode 100644
index ee3b057ee6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebImplementationGenerated.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.contribution.jee;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-
-/**
- * The model representing a WEB implementation in an SCA assembly model when the
- * WEB implementation has been generated by introspecting a non-enhanced EAR
- */
-public interface WebImplementationGenerated extends Implementation {
-
- /**
- * Return the WebModuleInfo which generated this Web component implementation
- * @return
- */
- WebModuleInfo getWebInfo();
-
- /**
- * Set the WebModuleInfo which generated this Web component implementation
- * @param webInfo
- */
- void setWebInfo(WebModuleInfo webInfo);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleInfo.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleInfo.java
deleted file mode 100644
index 79e9019b11..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface WebModuleInfo {
- URI getUri();
- void setUri(URI uri);
-
- String getModuleName();
- void setModuleName(String moduleName);
-
- ClassLoader getModuleClassloader();
- void setmoduleClassloader(ClassLoader classLoader);
-
- Map<String, EjbReferenceInfo> getEjbReferences();
- Map<String, EnvEntryInfo> getEnvEntries();
-
- EjbReferenceInfo getEjbReference(String ejbRefName);
- EnvEntryInfo getEnvEntry(String envEntryName);
-
- Collection<Class<?>> getServletClasses();
- Collection<Class<?>> getListenerClasses();
- Collection<Class<?>> getFilterClasses();
- Collection<Class<?>> getJSFClasses();
-
- Collection<JspReferenceTagInfo> getJspReferenceTags();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleModelResolver.java
deleted file mode 100644
index 74117a13f0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/WebModuleModelResolver.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for WebModuleInfo models.
- *
- * @version $Rev$ $Date$
- */
-public class WebModuleModelResolver implements ModelResolver {
-
- private Map<URI, WebModuleInfo> map = new HashMap<URI, WebModuleInfo>();
- private Contribution contribution;
-
- public WebModuleModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- WebModuleInfo webModule = (WebModuleInfo)resolved;
- map.put(webModule.getUri(), webModule);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((WebModuleInfo)resolved).getUri());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- // Lookup a WebModuleInfo for the given URI
- URI uri = ((WebModuleInfo)unresolved).getUri();
- if (uri != null) {
- WebModuleInfo resolved = (WebModuleInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- } else {
- uri = URI.create("");
- resolved = (WebModuleInfo) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- }
- }
- return unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.java
deleted file mode 100644
index eb5b8d8463..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedImpl.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.contribution.jee.impl;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-
-/**
- * The model representing an EJB implementation in an SCA assembly model when the
- * EJB implementation has been generated by introspecting a non-enhanced EAR $
- */
-class EJBImplementationGeneratedImpl extends ImplementationImpl implements EJBImplementationGenerated {
-
- private EjbInfo ejbInfo;
- private EjbModuleInfo ejbModuleInfo;
-
- /**
- * Constructs a new EJB implementation.
- */
- EJBImplementationGeneratedImpl() {
- super();
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The EJB implementation does not support constrainingTypes
- return null;
- }
-
- @Override
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The EJB implementation does not support constrainingTypes
- }
-
- public EjbInfo getEJBInfo() {
- return ejbInfo;
- }
-
- public void setEJBInfo(EjbInfo ejbInfo) {
- this.ejbInfo = ejbInfo;
- }
-
- public EjbModuleInfo getEjbModuleInfo() {
- return ejbModuleInfo;
- }
-
- public void setEjbModuleInfo(EjbModuleInfo ejbModuleInfo) {
- this.ejbModuleInfo = ejbModuleInfo;
- }
-
- // make sure the generated implementation can be distinguished
- // based on the ejb info that is referenced
- @Override
- public int hashCode() {
- return getEJBInfo().hashCode();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.java
deleted file mode 100644
index bc8bc99770..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EJBImplementationGeneratedProcessor.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.contribution.jee.impl;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Dummy processor that's used to mark EJBImplementationGeneratedImpl instance
- * as resolved at the appropriate point in the resolution processing
- *
- * @version $Rev$ $Date$
- */
-public class EJBImplementationGeneratedProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<EJBImplementationGeneratedImpl> {
-
- public EJBImplementationGeneratedProcessor(ExtensionPointRegistry registry,
- Monitor monitor) {
- }
-
- public QName getArtifactType() {
- return null;
- }
-
- public Class<EJBImplementationGeneratedImpl> getModelType() {
- // Returns the type of model processed by this processor
- return EJBImplementationGeneratedImpl.class;
- }
-
- public EJBImplementationGeneratedImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- return null;
- }
-
- public void resolve(EJBImplementationGeneratedImpl implementation, ModelResolver resolver) throws ContributionResolveException {
- implementation.setUnresolved(false);
- }
-
- public void write(EJBImplementationGeneratedImpl implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EarContributionProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EarContributionProcessor.java
deleted file mode 100644
index b0eb155636..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EarContributionProcessor.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-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.net.URLStreamHandler;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.eclipse.emf.common.archive.ArchiveURLConnection;
-
-/**
- * Ear Contribution package processor.
- *
- * @version $Rev$ $Date$
- */
-public class EarContributionProcessor implements PackageProcessor {
-
- /* URL stream handler for "archive" */
- private static URLStreamHandler archiveUrlStreamHandler = new URLStreamHandler() {
- @Override
- protected URLConnection openConnection(URL u) throws IOException {
- return new ArchiveURLConnection(u);
- }
- };
-
- public URL getArtifactURL(URL packageSourceURL, URI artifact)
- throws MalformedURLException {
- if(artifact.toString().equals("")) {
- return packageSourceURL;
- }
- if (packageSourceURL.toString().startsWith("archive:")) {
- return new URL(packageSourceURL, artifact.toString(), archiveUrlStreamHandler);
- } else {
- return new URL("archive", "", -1, packageSourceURL.toExternalForm() + "!/" + artifact, archiveUrlStreamHandler);
- }
- }
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException {
- if (packageSourceURL == null) {
- throw new IllegalArgumentException("Invalid null package source URL.");
- }
-
- if (inputStream == null) {
- throw new IllegalArgumentException("Invalid null source inputstream.");
- }
-
- // The root is a jar file
- JarInputStream jar = new JarInputStream(inputStream);
- try {
- Set<String> names = new HashSet<String>();
- while (true) {
- JarEntry entry = jar.getNextJarEntry();
- if (entry == null) {
- // EOF
- break;
- }
-
- String name = entry.getName();
- if (!name.startsWith(".")) {
-
- // Trim trailing /
- if (name.endsWith("/")) {
- name = name.substring(0, name.length() - 1);
- }
-
- // Add the entry name
- if (!names.contains(name)) {
- names.add(name);
-
- // Add parent folder names to the list too
- for (;;) {
- int s = name.lastIndexOf('/');
- if (s == -1) {
- name = "";
- } else {
- name = name.substring(0, s);
- }
- if (!names.contains(name)) {
- names.add(name);
- } else {
- break;
- }
- }
- }
- }
- if(entry.getName().indexOf("/") == -1 && (entry.getName().toLowerCase().endsWith(".war") || entry.getName().toLowerCase().endsWith(".jar"))) {
- // A WAR or an EJB JAR file in the root of the archive.
- // Get entries from the nested archive.
- ByteArrayOutputStream bout = new ByteArrayOutputStream();
- int b;
- while((b = jar.read()) != -1) {
- bout.write(b);
- }
- bout.close();
- ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
-
- PackageProcessor archiveProcessor = entry.getName().toLowerCase().endsWith(".war") ? new WarContributionProcessor() : new JarContributionProcessor();
- List<URI> artifacts = archiveProcessor.getArtifacts(packageSourceURL, bin);
- bin.close();
- for(URI artifact : artifacts) {
- // don't add in nested application composites
- if ((artifact.toString().endsWith("ejb-jar.composite") == false) &&
- (artifact.toString().endsWith("web.composite") == false)) {
- names.add(entry.getName()+"!/"+artifact);
- }
- }
- }
- }
-
- // Return list of URIs
- List<URI> artifacts = new ArrayList<URI>();
- for (String name: names) {
- artifacts.add(URI.create(name));
- }
- return artifacts;
-
- } finally {
- jar.close();
- }
- }
-
- public String getPackageType() {
- return PackageType.EAR;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbArchiveProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbArchiveProcessor.java
deleted file mode 100644
index 36aabefa99..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbArchiveProcessor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector;
-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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * URLArtifactProcessor for EJB jars.
- *
- * @version $Rev$ $Date$
- */
-public class EjbArchiveProcessor implements URLArtifactProcessor<EjbModuleInfo> {
- private JavaEEIntrospector jeeIntrospector;
-
- public EjbArchiveProcessor(ExtensionPointRegistry registry, Monitor monitor) {
- jeeIntrospector = registry.getExtensionPoint(JavaEEIntrospector.class);
- }
-
- public String getArtifactType() {
- return ".jar";
- }
-
- public EjbModuleInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- if (jeeIntrospector != null) {
- EjbModuleInfo ejbModuleInfo = jeeIntrospector.introspectEjbArchive(artifactURL);
- if(ejbModuleInfo != null) {
- ejbModuleInfo.setUri(artifactURI);
- ejbModuleInfo.setModuleName(new File(artifactURL.getFile()).getName());
- }
- return ejbModuleInfo;
- }
- return null;
- }
-
- public Class<EjbModuleInfo> getModelType() {
- return EjbModuleInfo.class;
- }
-
- public void resolve(EjbModuleInfo arg0, ModelResolver arg1)
- throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbModuleInfoImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbModuleInfoImpl.java
deleted file mode 100644
index 830aa81b19..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/EjbModuleInfoImpl.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.contribution.jee.impl;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-
-public class EjbModuleInfoImpl implements EjbModuleInfo {
-
- private URI uri;
- private String moduleName;
- private ClassLoader moduleClassLoader;
- private Map<String, EjbInfo> ejbInfos = new HashMap<String, EjbInfo>();
-
- public EjbInfo getEjbInfo(String beanName) {
- return ejbInfos.get(beanName);
- }
-
- public Map<String, EjbInfo> getEjbInfos() {
- return ejbInfos;
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
- public ClassLoader getModuleClassloader() {
- return moduleClassLoader;
- }
-
- public void setmoduleClassloader(ClassLoader classLoader) {
- this.moduleClassLoader = classLoader;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEApplicationInfoImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEApplicationInfoImpl.java
deleted file mode 100644
index 993605ebe5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEApplicationInfoImpl.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.contribution.jee.impl;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-
-public class JavaEEApplicationInfoImpl implements JavaEEApplicationInfo {
-
- private URI uri;
- private String applicationName;
- private Map<String, EjbModuleInfo> ejbModuleInfos = new HashMap<String, EjbModuleInfo>();
- private Map<String, WebModuleInfo> webModuleInfos = new HashMap<String, WebModuleInfo>();
-
-
- public String getApplicationName() {
- return applicationName;
- }
-
- public void setApplicationName(String applicationName) {
- this.applicationName = applicationName;
- }
-
- public EjbModuleInfo getEjbModuleInfo(String moduleName) {
- return ejbModuleInfos.get(moduleName);
- }
-
- public Map<String, EjbModuleInfo> getEjbModuleInfos() {
- return ejbModuleInfos;
- }
-
- public WebModuleInfo getWebModuleInfo(String moduleName) {
- return webModuleInfos.get(moduleName);
- }
-
- public Map<String, WebModuleInfo> getWebModuleInfos() {
- return webModuleInfos;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEArchiveProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEArchiveProcessor.java
deleted file mode 100644
index 53201b5e2b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEArchiveProcessor.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.contribution.jee.impl;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector;
-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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-public class JavaEEArchiveProcessor implements URLArtifactProcessor<JavaEEApplicationInfo> {
- private JavaEEIntrospector jeeIntrospector;
-
- public JavaEEArchiveProcessor(ExtensionPointRegistry registry, Monitor monitor) {
- jeeIntrospector = registry.getExtensionPoint(JavaEEIntrospector.class);
- }
-
- public String getArtifactType() {
- return ".ear";
- }
-
- public JavaEEApplicationInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- JavaEEApplicationInfo jeeAppInfo = jeeIntrospector.introspectJeeArchive(artifactURL);
- jeeAppInfo.setUri(artifactURI);
- jeeAppInfo.setApplicationName(new File(artifactURL.getFile()).getName());
- return jeeAppInfo;
- }
-
- public Class<JavaEEApplicationInfo> getModelType() {
- return JavaEEApplicationInfo.class;
- }
-
- public void resolve(JavaEEApplicationInfo arg0, ModelResolver arg1)
- throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.java
deleted file mode 100644
index 4271a93399..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEExtensionImpl.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.contribution.jee.impl;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo.EjbType;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-public class JavaEEExtensionImpl implements JavaEEExtension {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaInterfaceFactory;
- private PolicyFactory policyFactory;
- private Intent EJB_INTENT;
-
- public JavaEEExtensionImpl(ModelFactoryExtensionPoint modelFactories) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
-
- EJB_INTENT = policyFactory.createIntent();
- EJB_INTENT.setName(new QName("http://www.osoa.org/xmlns/sca/1.0", "ejb"));
- }
-
- public ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName) {
- ComponentType componentType = assemblyFactory.createComponentType();
- EjbInfo ejbInfo = ejbModule.getEjbInfo(ejbName);
- if(ejbInfo == null) {
- return null;
- }
- if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
- for(Class<?> intf : ejbInfo.businessRemote) {
- Service service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- componentType.getServices().add(service);
- }
-
- for(Class<?> intf : ejbInfo.businessLocal) {
- Service service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- componentType.getServices().add(service);
- }
- }
- return componentType;
- }
-
- public void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite) {
-
- for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
- EjbInfo ejbInfo = entry.getValue();
-
- Component component = findComponent(composite, ejbInfo, ejbModule);
-
- if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
- for(Class<?> intf : ejbInfo.businessRemote) {
- ComponentService service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- serviceName = ejbInfo.beanName+"_"+serviceName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- addComponentService(composite, component, service);
- }
-
- for(Class<?> intf : ejbInfo.businessLocal) {
- ComponentService service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- serviceName = ejbInfo.beanName+"_"+serviceName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- addComponentService(composite, component, service);
- }
- }
- }
- }
-
- public void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite) {
-
- for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
- EjbModuleInfo ejbModule = entry0.getValue();
-
- for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
- EjbInfo ejbInfo = entry.getValue();
-
- Component component = findComponent(composite, ejbInfo, ejbModule);
-
- if(ejbInfo.ejbType.compareTo(EjbType.MESSAGE_DRIVEN) != 0) {
- for(Class<?> intf : ejbInfo.businessRemote) {
- ComponentService service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- serviceName = ejbInfo.mappedName+"_"+serviceName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- addComponentService(composite, component, service);
- }
-
- for(Class<?> intf : ejbInfo.businessLocal) {
- ComponentService service = assemblyFactory.createComponentService();
- String intfName = intf.getName();
- String serviceName = intfName.lastIndexOf(".") != -1 ? intfName.substring(intfName.lastIndexOf(".") + 1) : intfName;
- serviceName = ejbInfo.mappedName+"_"+serviceName;
- service.setName(serviceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(intf));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- service.setInterfaceContract(ic);
- service.getRequiredIntents().add(EJB_INTENT);
-
- addComponentService(composite, component, service);
- }
- }
- }
- }
- }
-
- /**
- * We are fluffing up the JEEImplemention composite to represented the components
- * in the JEE archive. Given the JEEimplemenation composite find a named component
- * it if already exists or create it if it doesn't.
- *
- * @param ejbInfo
- * @param componentName
- * @return
- */
- private Component findComponent(Composite composite, EjbInfo ejbInfo, EjbModuleInfo ejbmoduleInfo){
- String componentName = ejbInfo.beanName;
- Component component = null;
-
- for (Component tmpComponent : composite.getComponents()){
- if (tmpComponent.getName().equals(componentName)){
- component = tmpComponent;
- break;
- }
- }
-
- if (component == null){
- component = assemblyFactory.createComponent();
- component.setName(componentName);
- component.setUnresolved(true);
- composite.getComponents().add(component);
-
- EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
- implementation.setUnresolved(true);
- implementation.setEJBInfo(ejbInfo);
- implementation.setEjbModuleInfo(ejbmoduleInfo);
- component.setImplementation(implementation);
- }
-
- return component;
- }
-
- /**
- * Add a component service and fluff up a composite service to match
- *
- * @param composite
- * @param component
- * @param service
- */
- private void addComponentService(Composite composite, Component component, ComponentService service){
- component.getImplementation().getServices().add(service);
-
- CompositeService compositeService = assemblyFactory.createCompositeService();
- composite.getServices().add(compositeService);
-
- compositeService.setName(service.getName());
- compositeService.setPromotedComponent(component);
- compositeService.setPromotedService(service);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java
deleted file mode 100644
index e07b6e8aba..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/JavaEEOptionalExtensionImpl.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.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.Multiplicity;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.EJBImplementationGenerated;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo;
-import org.apache.tuscany.sca.contribution.jee.EnvEntryInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
-import org.apache.tuscany.sca.contribution.jee.WebImplementationGenerated;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-public class JavaEEOptionalExtensionImpl implements JavaEEOptionalExtension {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaInterfaceFactory;
- private PolicyFactory policyFactory;
- private Intent EJB_INTENT;
-
- public static final Map<String, QName> ALLOWED_ENV_ENTRY_TYPES;
- static {
- ALLOWED_ENV_ENTRY_TYPES = new HashMap<String, QName>();
- ALLOWED_ENV_ENTRY_TYPES.put(String.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "string",
- "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Character.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "string",
- "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Byte.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "byte", "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Short.class.getName(),
- new QName("http://www.w3.org/2001/XMLSchema", "short", "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Integer.class.getName(),
- new QName("http://www.w3.org/2001/XMLSchema", "int", "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Long.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "long", "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Boolean.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "boolean",
- "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Double.class.getName(), new QName("http://www.w3.org/2001/XMLSchema", "double",
- "xsd"));
- ALLOWED_ENV_ENTRY_TYPES.put(Float.class.getName(),
- new QName("http://www.w3.org/2001/XMLSchema", "float", "xsd"));
- }
-
- public JavaEEOptionalExtensionImpl(ModelFactoryExtensionPoint modelFactories) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
-
- EJB_INTENT = policyFactory.createIntent();
- EJB_INTENT.setName(new QName("http://www.osoa.org/xmlns/sca/1.0", "ejb"));
- }
-
- public ComponentType createImplementationWebComponentType(WebModuleInfo webModule) {
- ComponentType componentType = assemblyFactory.createComponentType();
-
- // Process Remote EJB References
- for(Map.Entry<String, EjbReferenceInfo> entry : webModule.getEjbReferences().entrySet()) {
- EjbReferenceInfo ejbRef = entry.getValue();
- String referenceName = entry.getKey();
- referenceName = referenceName.replace("/", "_");
- Reference reference = assemblyFactory.createComponentReference();
- reference.setName(referenceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(ejbRef.businessInterface));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- reference.setInterfaceContract(ic);
- reference.getRequiredIntents().add(EJB_INTENT);
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- componentType.getReferences().add(reference);
- }
-
- // Process env-entries to compute properties
- for (Map.Entry<String, EnvEntryInfo> entry : webModule.getEnvEntries().entrySet()) {
- EnvEntryInfo envEntry = entry.getValue();
- String type = envEntry.type;
- if (!ALLOWED_ENV_ENTRY_TYPES.containsKey(type)) {
- continue;
- }
- String propertyName = envEntry.name;
- propertyName = propertyName.replace("/", "_");
- String value = envEntry.value;
- Property property = assemblyFactory.createComponentProperty();
- property.setName(propertyName);
- property.setXSDType(ALLOWED_ENV_ENTRY_TYPES.get(type));
- property.setValue(value);
- componentType.getProperties().add(property);
- }
-
- return componentType;
- }
- public ComponentType createImplementationEjbComponentType(EjbModuleInfo ejbModule, String ejbName) {
- ComponentType componentType = assemblyFactory.createComponentType();
- EjbInfo ejbInfo = ejbModule.getEjbInfo(ejbName);
- if(ejbInfo == null) {
- return null;
- }
-
- // Process Remote EJB References
- for(Map.Entry<String, EjbReferenceInfo> entry : ejbInfo.ejbReferences.entrySet()) {
- EjbReferenceInfo ejbRef = entry.getValue();
- String referenceName = entry.getKey();
- referenceName = referenceName.replace("/", "_");
- Reference reference = assemblyFactory.createComponentReference();
- reference.setName(referenceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(ejbRef.businessInterface));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- reference.setInterfaceContract(ic);
- reference.getRequiredIntents().add(EJB_INTENT);
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- componentType.getReferences().add(reference);
- }
-
- // Process env-entries to compute properties
- for (Map.Entry<String, EnvEntryInfo> entry : ejbInfo.envEntries.entrySet()) {
- EnvEntryInfo envEntry = entry.getValue();
- String type = envEntry.type;
- if (!ALLOWED_ENV_ENTRY_TYPES.containsKey(type)) {
- continue;
- }
- String propertyName = envEntry.name;
- propertyName = propertyName.replace("/", "_");
- String value = envEntry.value;
- Property property = assemblyFactory.createComponentProperty();
- property.setName(propertyName);
- property.setXSDType(ALLOWED_ENV_ENTRY_TYPES.get(type));
- property.setValue(value);
- componentType.getProperties().add(property);
- }
- return componentType;
- }
-
- public void createImplementationJeeComposite(WebModuleInfo webModule, Composite composite) {
-
- Component component = findComponent(composite, webModule);
-
- // Process Remote EJB References
- for(Map.Entry<String, EjbReferenceInfo> entry : webModule.getEjbReferences().entrySet()) {
- EjbReferenceInfo ejbRef = entry.getValue();
- String referenceName = entry.getKey();
- referenceName = referenceName.replace("/", "_");
- ComponentReference reference = assemblyFactory.createComponentReference();
- reference.setName(referenceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(ejbRef.businessInterface));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- reference.setInterfaceContract(ic);
- reference.getRequiredIntents().add(EJB_INTENT);
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
-
- addComponentReference(composite, component, reference);
- }
- }
-
- public void createImplementationJeeComposite(EjbModuleInfo ejbModule, Composite composite) {
-
- for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
- EjbInfo ejbInfo = entry.getValue();
-
- Component component = findComponent(composite, ejbInfo, ejbModule);
-
- // Process Remote EJB References
- for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
- EjbReferenceInfo ejbRef = entry1.getValue();
- String referenceName = ejbRef.referenceName;
- referenceName = referenceName.replace("/", "_");
- referenceName = ejbInfo.beanName + "_" + referenceName;
- ComponentReference reference = assemblyFactory.createComponentReference();
- reference.setName(referenceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(ejbRef.businessInterface));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- reference.setInterfaceContract(ic);
- reference.getRequiredIntents().add(EJB_INTENT);
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
-
- addComponentReference(composite, component, reference);
- }
- }
- }
-
-
- public void createImplementationJeeComposite(JavaEEApplicationInfo appInfo, Composite composite) {
-
- for(Map.Entry<String, EjbModuleInfo> entry0 : appInfo.getEjbModuleInfos().entrySet()) {
- EjbModuleInfo ejbModule = entry0.getValue();
-
- for(Map.Entry<String, EjbInfo> entry : ejbModule.getEjbInfos().entrySet()) {
- EjbInfo ejbInfo = entry.getValue();
-
- Component component = findComponent(composite, ejbInfo, ejbModule);
-
- // Process Remote EJB References
- for(Map.Entry<String, EjbReferenceInfo> entry1 : ejbInfo.ejbReferences.entrySet()) {
- EjbReferenceInfo ejbRef = entry1.getValue();
- String referenceName = ejbRef.referenceName;
- referenceName = referenceName.replace("/", "_");
- referenceName = ejbInfo.beanName + "_" + referenceName;
- ComponentReference reference = assemblyFactory.createComponentReference();
- reference.setName(referenceName);
- InterfaceContract ic = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- ic.setInterface(javaInterfaceFactory.createJavaInterface(ejbRef.businessInterface));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- reference.setInterfaceContract(ic);
- reference.getRequiredIntents().add(EJB_INTENT);
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
-
- addComponentReference(composite, component, reference);
- }
- }
- }
- }
-
- /**
- * We are fluffing up the JEEImplemention composite to represent the components
- * in the JEE archive. Given the JEEimplemenation composite find a named component
- * it if already exists or create it if it doesn't.
- *
- * @param composite
- * @param ejbInfo
- * @return
- */
- private Component findComponent(Composite composite, EjbInfo ejbInfo, EjbModuleInfo ejbmoduleInfo){
- String componentName = ejbInfo.beanName;
- Component component = null;
-
- for (Component tmpComponent : composite.getComponents()){
- if (tmpComponent.getName().equals(componentName)){
- component = tmpComponent;
- break;
- }
- }
-
- if (component == null){
- component = assemblyFactory.createComponent();
- component.setName(componentName);
- component.setUnresolved(true);
- composite.getComponents().add(component);
-
- EJBImplementationGenerated implementation = new EJBImplementationGeneratedImpl();
- implementation.setUnresolved(true);
- implementation.setEJBInfo(ejbInfo);
- implementation.setEjbModuleInfo(ejbmoduleInfo);
- component.setImplementation(implementation);
- }
-
- return component;
- }
-
- /**
- * We are fluffing up the JEEImplemention composite to represent the components
- * in the JEE archive. Given the JEEimplemenation composite find a named component
- * it if already exists or create it if it doesn't.
- *
- * @param composite
- * @param ejbInfo
- * @return
- */
- private Component findComponent(Composite composite, WebModuleInfo webInfo){
- String componentName = webInfo.getModuleName();
- Component component = null;
-
- for (Component tmpComponent : composite.getComponents()){
- if (tmpComponent.getName().equals(componentName)){
- component = tmpComponent;
- break;
- }
- }
-
- if (component == null){
- component = assemblyFactory.createComponent();
- component.setName(componentName);
- component.setUnresolved(true);
- composite.getComponents().add(component);
-
- WebImplementationGenerated implementation = new WebImplementationGeneratedImpl();
- implementation.setUnresolved(true);
- // need generated impl to represent web modules
- implementation.setWebInfo(webInfo);
- component.setImplementation(implementation);
- }
-
- return component;
- }
-
- /**
- * Add a component reference and fluff up a composite reference to match
- *
- * @param composite
- * @param component
- * @param service
- */
- private void addComponentReference(Composite composite, Component component, ComponentReference reference){
- component.getImplementation().getReferences().add(reference);
-
- CompositeReference compositeReference = assemblyFactory.createCompositeReference();
- composite.getReferences().add(compositeReference);
-
- compositeReference.setName(reference.getName());
- compositeReference.getPromotedReferences().add(reference);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/ModelObjectImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/ModelObjectImpl.java
deleted file mode 100644
index 95050dfd88..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/ModelObjectImpl.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.contribution.jee.impl;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.contribution.jee.ModelObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ModelObjectImpl implements ModelObject {
-
- private URI uri;
- private Object obj;
-
- public ModelObjectImpl() {
- }
-
- public Object getObject() {
- return obj;
- }
-
- public void setObject(Object obj) {
- this.obj = obj;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.java
deleted file mode 100644
index 17974e831f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WarContributionProcessor.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.contribution.jee.impl;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-
-/**
- * War Contribution package processor.
- *
- * @version $Rev$ $Date$
- */
-public class WarContributionProcessor extends JarContributionProcessor implements PackageProcessor {
- @Override
- public String getPackageType() {
- return PackageType.WAR;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebArchiveProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebArchiveProcessor.java
deleted file mode 100644
index 9e9bfb8bc1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebArchiveProcessor.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.contribution.jee.impl;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.jee.JavaEEIntrospector;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-public class WebArchiveProcessor implements URLArtifactProcessor<WebModuleInfo> {
- private JavaEEIntrospector jeeIntrospector;
-
- public WebArchiveProcessor(ExtensionPointRegistry registry, Monitor monitor) {
- jeeIntrospector = registry.getExtensionPoint(JavaEEIntrospector.class);
- }
-
- public String getArtifactType() {
- return ".war";
- }
-
- public WebModuleInfo read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- WebModuleInfo webModuleInfo = jeeIntrospector.introspectWebArchive(artifactURL);
- webModuleInfo.setUri(artifactURI);
- webModuleInfo.setModuleName(new File(artifactURL.getFile()).getName());
- return webModuleInfo;
- }
-
- public Class<WebModuleInfo> getModelType() {
- return WebModuleInfo.class;
- }
-
- public void resolve(WebModuleInfo arg0, ModelResolver arg1)
- throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java
deleted file mode 100644
index d898bd4ea0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.contribution.jee.WebImplementationGenerated;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-
-
-/**
- * The model representing a WEB implementation in an SCA assembly model when the
- * WEB implementation has been generated by introspecting a non-enhanced EAR
- */
-class WebImplementationGeneratedImpl extends ImplementationImpl implements WebImplementationGenerated {
-
- private WebModuleInfo webInfo;
-
- /**
- * Constructs a new EJB implementation.
- */
- WebImplementationGeneratedImpl() {
- super();
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The Web implementation does not support constrainingTypes
- return null;
- }
-
- @Override
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The Web implementation does not support constrainingTypes
- }
-
- public WebModuleInfo getWebInfo() {
- return webInfo;
- }
-
- public void setWebInfo(WebModuleInfo webInfo) {
- this.webInfo = webInfo;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.java
deleted file mode 100644
index 4e50b15960..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebImplementationGeneratedProcessor.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.contribution.jee.impl;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Dummy processor that's used to mark WebImplementationGeneratedImpl instance
- * as resolved at the appropriate point in the resolution processing
- *
- */
-public class WebImplementationGeneratedProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WebImplementationGeneratedImpl> {
-
- public WebImplementationGeneratedProcessor(ExtensionPointRegistry registry,
- Monitor monitor) {
- }
-
- public QName getArtifactType() {
- return null;
- }
-
- public Class<WebImplementationGeneratedImpl> getModelType() {
- // Returns the type of model processed by this processor
- return WebImplementationGeneratedImpl.class;
- }
-
- public WebImplementationGeneratedImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- return null;
- }
-
- public void resolve(WebImplementationGeneratedImpl implementation, ModelResolver resolver) throws ContributionResolveException {
- implementation.setUnresolved(false);
- }
-
- public void write(WebImplementationGeneratedImpl implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebModuleInfoImpl.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebModuleInfoImpl.java
deleted file mode 100644
index ceca698356..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/java/org/apache/tuscany/sca/contribution/jee/impl/WebModuleInfoImpl.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.jee.impl;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.jee.EjbReferenceInfo;
-import org.apache.tuscany.sca.contribution.jee.EnvEntryInfo;
-import org.apache.tuscany.sca.contribution.jee.JspReferenceTagInfo;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-
-public class WebModuleInfoImpl implements WebModuleInfo {
-
- private URI uri;
- private String moduleName;
- private ClassLoader moduleClassLoader;
-
- private Collection<Class<?>> servletClasses = new ArrayList<Class<?>>();
- private Collection<Class<?>> listenerClasses = new ArrayList<Class<?>>();
- private Collection<Class<?>> filterClasses = new ArrayList<Class<?>>();
- private Collection<Class<?>> jsfClasses = new ArrayList<Class<?>>();
-
- private Collection<JspReferenceTagInfo> jspReferenceTags = new ArrayList<JspReferenceTagInfo>();
-
- private Map<String, EjbReferenceInfo> ejbReferences = new HashMap<String, EjbReferenceInfo>();
- private Map<String, EnvEntryInfo> envEntries = new HashMap<String, EnvEntryInfo>();
-
- public WebModuleInfoImpl() {
- }
- public Collection<Class<?>> getServletClasses() {
- return servletClasses;
- }
-
- public Collection<Class<?>> getListenerClasses() {
- return listenerClasses;
- }
-
- public Collection<Class<?>> getFilterClasses() {
- return filterClasses;
- }
-
- public Collection<Class<?>> getJSFClasses() {
- return jsfClasses;
- }
-
- public Collection<JspReferenceTagInfo> getJspReferenceTags() {
- return jspReferenceTags;
- }
-
- public EjbReferenceInfo getEjbReference(String ejbRefName) {
- return ejbReferences.get(ejbRefName);
- }
-
- public Map<String, EjbReferenceInfo> getEjbReferences() {
- return ejbReferences;
- }
-
- public Map<String, EnvEntryInfo> getEnvEntries() {
- return envEntries;
- }
-
- public EnvEntryInfo getEnvEntry(String envEntryName) {
- return envEntries.get(envEntryName);
- }
-
- public String getModuleName() {
- return moduleName;
- }
-
- public void setModuleName(String moduleName) {
- this.moduleName = moduleName;
- }
-
- public URI getUri() {
- return uri;
- }
-
- public void setUri(URI uri) {
- this.uri = uri;
- }
-
- public ClassLoader getModuleClassloader() {
- return moduleClassLoader;
- }
-
- public void setmoduleClassloader(ClassLoader classLoader) {
- this.moduleClassLoader = classLoader;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEExtension b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEExtension
deleted file mode 100644
index c79600bca6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEExtension
+++ /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.contribution.jee.impl.JavaEEExtensionImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension
deleted file mode 100644
index 5ce036e6b0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension
+++ /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.contribution.jee.impl.JavaEEOptionalExtensionImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
deleted file mode 100644
index 88c69658f6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.jee.impl.EarContributionProcessor;type=application/ear
-org.apache.tuscany.sca.contribution.jee.impl.WarContributionProcessor;type=application/war
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index b0bb63225a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# $Rev: 685124 $ $Date: 2008-08-12 12:46:19 +0100 (Tue, 12 Aug 2008) $
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.jee.impl.EJBImplementationGeneratedProcessor;qname=http://dummy_namespace/#dummy.name,model=org.apache.tuscany.sca.contribution.jee.impl.EJBImplementationGeneratedImpl,factory=dummy
-org.apache.tuscany.sca.contribution.jee.impl.WebImplementationGeneratedProcessor;qname=http://dummy_namespace/#dummy.name,model=org.apache.tuscany.sca.contribution.jee.impl.WebImplementationGeneratedImpl,factory=dummy
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 71575b5ddd..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.jee.impl.WebArchiveProcessor;type=.war,model=org.apache.tuscany.sca.contribution.jee.WebModuleInfo
-org.apache.tuscany.sca.contribution.jee.impl.EjbArchiveProcessor;type=.jar,model=org.apache.tuscany.sca.contribution.jee.EjbModuleInfo
-org.apache.tuscany.sca.contribution.jee.impl.JavaEEArchiveProcessor;type=.ear,model=org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 90ff87e0b1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.jee.WebModuleModelResolver;model=org.apache.tuscany.sca.contribution.jee.WebModuleInfo
-org.apache.tuscany.sca.contribution.jee.EjbModuleModelResolver;model=org.apache.tuscany.sca.contribution.jee.EjbModuleInfo
-org.apache.tuscany.sca.contribution.jee.JavaEEApplicationModelResolver;model=org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo
-org.apache.tuscany.sca.contribution.jee.ModelObjectModelResolver;model=org.apache.tuscany.sca.contribution.jee.ModelObject
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/EarContributionProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/EarContributionProcessorTestCase.java
deleted file mode 100644
index 9495df70b7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/EarContributionProcessorTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.contribution.jee.impl.EarContributionProcessor;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-import org.junit.Test;
-
-/**
- * Ear Contribution package processor test case.
- * Verifies proper handling of EAR contributions.
- *
- * @version $Rev$ $Date$
- */
-public class EarContributionProcessorTestCase {
- private static final String EAR_CONTRIBUTION = "/ejb-injection-sample.ear";
-
- @Test
- public void testProcessPackageArtifacts() throws Exception {
- EarContributionProcessor earProcessor = new EarContributionProcessor();
-
- URL earURL = getClass().getResource(EAR_CONTRIBUTION);
- InputStream earStream = earURL.openStream();
- List<URI> artifacts = null;
- try {
- artifacts = earProcessor.getArtifacts(earURL, earStream);
- } finally {
- IOHelper.closeQuietly(earStream);
- }
-
- Assert.assertNotNull(artifacts);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java
deleted file mode 100644
index e315c417b9..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/java/org/apache/tuscany/sca/contribution/jee/WarContributionProcessorTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.jee;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.contribution.jee.impl.WarContributionProcessor;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-import org.junit.Test;
-
-/**
- * War Contribution package processor test case.
- * Verifies proper handling of WAR contributions.
- *
- * @version $Rev$ $Date$
- */
-public class WarContributionProcessorTestCase {
- private static final String WAR_CONTRIBUTION = "/sample-web-app.war";
-
- @Test
- public void testProcessPackageArtifacts() throws Exception {
- WarContributionProcessor warProcessor = new WarContributionProcessor();
-
- URL warURL = getClass().getResource(WAR_CONTRIBUTION);
- InputStream warStream = warURL.openStream();
- List<URI> artifacts = null;
- try {
- artifacts = warProcessor.getArtifacts(warURL, warStream);
- } finally {
- IOHelper.closeQuietly(warStream);
- }
-
- Assert.assertNotNull(artifacts);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.ear b/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.ear
deleted file mode 100644
index 3efdd206c7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.ear
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.jar b/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.jar
deleted file mode 100644
index 4b9e3b79f4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/ejb-injection-sample.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/sample-web-app.war b/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/sample-web-app.war
deleted file mode 100644
index 681b203fab..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-jee/src/test/resources/sample-web-app.war
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/LICENSE b/branches/sca-java-1.5.1/modules/contribution-namespace/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/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-java-1.5.1/modules/contribution-namespace/NOTICE b/branches/sca-java-1.5.1/modules/contribution-namespace/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/pom.xml b/branches/sca-java-1.5.1/modules/contribution-namespace/pom.xml
deleted file mode 100644
index 3ef07ed4b4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <name>Apache Tuscany SCA Namespace Import/Export Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.namespace</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.namespace*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java
deleted file mode 100644
index a71fa61a54..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.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.contribution.namespace;
-
-import org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl;
-
-/**
- * Default Namespace Import/Export model factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class DefaultNamespaceImportExportFactory extends NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory {
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java
deleted file mode 100644
index c68aee8521..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.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.contribution.namespace;
-
-import org.apache.tuscany.sca.contribution.Export;
-
-
-/**
- * The representation of an XML namespace export.
- *
- * @version $Rev$ $Date$
- */
-public interface NamespaceExport extends Export {
-
- /**
- * Get Namespace that identifies the export
- *
- * @return The exported namespace
- */
- String getNamespace();
-
- /**
- * Set Namespace that identifies the export
- *
- * @param namespace The exported namespace
- */
- void setNamespace(String namespace);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java
deleted file mode 100644
index 8af36d7da0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.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.contribution.namespace;
-
-import org.apache.tuscany.sca.contribution.Import;
-
-/**
- * The representation of an XML namespace import.
- *
- * @version $Rev$ $Date$
- */
-public interface NamespaceImport extends Import {
-
- /**
- * Get the location used to resolve the definitions for this import
- *
- * @return The import location
- */
- String getLocation();
-
- /**
- * Set the location used to resolve the definitions for this import
- *
- * @param location The import location
- */
- void setLocation(String location);
-
- /**
- * Get Namespace that identifies the import
- *
- * @return The namespace
- */
- String getNamespace();
-
- /**
- * Set Namespace that identifies the import
- *
- * @param namespace The namespace
- */
- void setNamespace(String namespace);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java
deleted file mode 100644
index cfbac8bb1f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.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.contribution.namespace;
-
-/**
- * Base Namespace import/export model factory
- *
- * @version $Rev$ $Date$
- */
-public interface NamespaceImportExportFactory {
-
- /**
- * Create a namespace import model object
- *
- * @return The new NamespaceImport model object
- */
- NamespaceImport createNamespaceImport();
-
- /**
- * Create a namespace export model object
- *
- * @return The new NamespaceExport model object
- */
- NamespaceExport createNamespaceExport();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java
deleted file mode 100644
index 99af328964..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.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.contribution.namespace.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an export for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceExportImpl extends ExtensibleImpl implements NamespaceExport {
- private String namespace;
- private ModelResolver modelResolver;
-
- protected NamespaceExportImpl() {
- super();
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java
deleted file mode 100644
index 5c5ae22f77..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.namespace.impl;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A model resolver for namespace exports.
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceExportModelResolver implements ModelResolver {
-
- private ModelResolver resolver;
-
- public NamespaceExportModelResolver(ModelResolver resolver) {
- this.resolver = resolver;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Just delegate to the contribution's model resolver, namespace
- // based filtering is implemented in the model specific model
- // resolver, which know how to get the namespace of the particular
- // type of model that they handle
- return resolver.resolveModel(modelClass, unresolved);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
deleted file mode 100644
index 25ddb7573b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.namespace.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact processor for Namespace export
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceExportProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<NamespaceExport> {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final QName EXPORT = new QName(SCA10_NS, "export");
- private static final String NAMESPACE = "namespace";
-
- private final NamespaceImportExportFactory factory;
- private final Monitor monitor;
- private final ExtensionFactory extensionFactory;
- private final StAXArtifactProcessor<Object> extensionProcessor;
- private final StAXAttributeProcessor<Object> attributeProcessor;
-
- public NamespaceExportProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- StAXAttributeProcessor<Object> attributeProcessor,
- Monitor monitor) {
- this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.extensionProcessor = extensionProcessor;
- this.attributeProcessor = attributeProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return EXPORT;
- }
-
- public Class<NamespaceExport> getModelType() {
- return NamespaceExport.class;
- }
-
- /**
- * Process <export namespace=""/>
- */
- public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException {
- NamespaceExport namespaceExport = this.factory.createNamespaceExport();
- QName element = null;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <export>
- if (EXPORT.equals(element)) {
- String ns = reader.getAttributeValue(null, NAMESPACE);
- if (ns == null) {
- error("AttributeNameSpaceMissing", reader);
- //throw new ContributionReadException("Attribute 'namespace' is missing");
- } else {
- namespaceExport.setNamespace(ns);
- }
- readExtendedAttributes(reader, namespaceExport, attributeProcessor, extensionFactory);
- } else {
- readExtendedElement(reader, namespaceExport, extensionProcessor);
- }
-
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (EXPORT.equals(reader.getName())) {
- return namespaceExport;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return namespaceExport;
- }
-
- public void write(NamespaceExport namespaceExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <export>
- writer.writeStartElement(EXPORT.getNamespaceURI(), EXPORT.getLocalPart());
-
- if (namespaceExport.getNamespace() != null) {
- writer.writeAttribute(NAMESPACE, namespaceExport.getNamespace());
- }
-
- writeExtendedAttributes(writer, namespaceExport, attributeProcessor);
-
- writeExtendedElements(writer, namespaceExport, extensionProcessor);
-
- writer.writeEndElement();
- }
-
- public void resolve(NamespaceExport namespaceExport, ModelResolver resolver) throws ContributionResolveException {
-
- if (namespaceExport.getNamespace() != null)
- // Initialize the export's resolver
- namespaceExport.setModelResolver(new NamespaceExportModelResolver(resolver));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java
deleted file mode 100644
index 1146e593a9..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.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.contribution.namespace.impl;
-
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
-
-/**
- * Namespace Import/Export model factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory {
-
- public NamespaceImport createNamespaceImport() {
- return new NamespaceImportImpl();
- }
-
- public NamespaceExport createNamespaceExport() {
- return new NamespaceExportImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
deleted file mode 100644
index 7ea09a47c7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.namespace.impl;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionListener;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-
-/**
- * Namespace Import/Export contribution listener
- * The listener would process all import/export from a given contribution
- * and initialize the model resolvers properly
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceImportExportListener implements ContributionListener {
-
- /**
- * Initialize the import/export model resolvers
- * Export model resolvers are same as Contribution model resolver
- * Import model resolvers are matched to a specific contribution if a location URI is specified,
- * otherwise it try to resolve against all the other contributions
- * Also set the exporting contributions used by contribution ClassLoaders to
- * match import/export for class loading.
- */
- public void contributionAdded(ContributionRepository repository, Contribution contribution) {
- // Initialize the contribution exports
- for (Export export: contribution.getExports()) {
- export.setModelResolver(contribution.getModelResolver());
- }
-
- // Initialize the contribution imports
- for (Import import_: contribution.getImports()) {
- boolean initialized = false;
-
- if (import_ instanceof NamespaceImport) {
- NamespaceImport namespaceImport = (NamespaceImport)import_;
-
- // Find a matching contribution
- if (namespaceImport.getLocation() != null) {
- Contribution targetContribution = repository.getContribution(namespaceImport.getLocation());
- if (targetContribution != null) {
-
- // Find a matching contribution export
- for (Export export: targetContribution.getExports()) {
- if (export instanceof NamespaceExport) {
- NamespaceExport namespaceExport = (NamespaceExport)export;
- if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) {
- namespaceImport.setModelResolver(namespaceExport.getModelResolver());
- initialized = true;
- break;
- }
- }
- }
- }
- }
-
- //if no location was specified, try to resolve with any contribution
- if( !initialized ) {
- // Use a resolver that will consider all contributions
- import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions()));
- }
- }
- }
-
- }
-
- public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
-
- }
-
- public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java
deleted file mode 100644
index 35e2d539d4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.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.contribution.namespace.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an import for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceImportImpl extends ExtensibleImpl implements NamespaceImport {
- private ModelResolver modelResolver;
-
- /**
- * The namespace to be imported
- */
- private String namespace;
- /**
- * Optional location URI pointing to a Contribution that exports the namespace
- */
- private String location;
-
-
- protected NamespaceImportImpl() {
- super();
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-
- /**
- * Match a NamespaceImport to a given NamespaceExport based on :
- * location is not provided
- * import and export namespaces match
- */
- public boolean match(Export export) {
- if (export instanceof NamespaceExport) {
- if (this.getNamespace().equals(((NamespaceExport)export).getNamespace())) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public String toString() {
- return String.valueOf(namespace);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
deleted file mode 100644
index ab7c76114a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.namespace.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact processor for Namespace import
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceImportProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<NamespaceImport> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName IMPORT = new QName(SCA10_NS, "import");
-
- private static final String NAMESPACE = "namespace";
- private static final String LOCATION = "location";
-
- private final NamespaceImportExportFactory factory;
- private final ExtensionFactory extensionFactory;
- private final StAXArtifactProcessor<Object> extensionProcessor;
- private final StAXAttributeProcessor<Object> attributeProcessor;
- private final Monitor monitor;
-
- public NamespaceImportProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- StAXAttributeProcessor<Object> attributeProcessor,
- Monitor monitor) {
- this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class);
- this.monitor = monitor;
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.extensionProcessor = extensionProcessor;
- this.attributeProcessor = attributeProcessor;
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return IMPORT;
- }
-
- public Class<NamespaceImport> getModelType() {
- return NamespaceImport.class;
- }
-
- /**
- * Process <import namespace="" location=""/>
- */
- public NamespaceImport read(XMLStreamReader reader) throws ContributionReadException {
- NamespaceImport namespaceImport = this.factory.createNamespaceImport();
- QName element;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <import>
- if (IMPORT.equals(element)) {
- String ns = reader.getAttributeValue(null, NAMESPACE);
- if (ns == null) {
- error("AttributeNameSpaceMissing", reader);
- //throw new ContributionReadException("Attribute 'namespace' is missing");
- } else {
- namespaceImport.setNamespace(ns);
- }
-
- String location = reader.getAttributeValue(null, LOCATION);
- if (location != null) {
- namespaceImport.setLocation(location);
- }
- readExtendedAttributes(reader, namespaceImport, attributeProcessor, extensionFactory);
- } else {
- readExtendedElement(reader, namespaceImport, extensionProcessor);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (IMPORT.equals(reader.getName())) {
- return namespaceImport;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return namespaceImport;
- }
-
- public void write(NamespaceImport namespaceImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <import>
- writer.writeStartElement(IMPORT.getNamespaceURI(), IMPORT.getLocalPart());
-
- if (namespaceImport.getNamespace() != null) {
- writer.writeAttribute(NAMESPACE, namespaceImport.getNamespace());
- }
- if (namespaceImport.getLocation() != null) {
- writer.writeAttribute(LOCATION, namespaceImport.getLocation());
- }
-
- writeExtendedAttributes(writer, namespaceImport, attributeProcessor);
- writeExtendedElements(writer, namespaceImport, extensionProcessor);
- writer.writeEndElement();
- }
-
-
- public void resolve(NamespaceImport model, ModelResolver resolver) throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory
deleted file mode 100644
index 095866fb6f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory
+++ /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.contribution.namespace.impl.NamespaceImportExportFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 86f199368b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import,model=org.apache.tuscany.sca.contribution.namespace.NamespaceImport
-org.apache.tuscany.sca.contribution.namespace.impl.NamespaceExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export,model=org.apache.tuscany.sca.contribution.namespace.NamespaceExport
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
deleted file mode 100644
index cdf16a383f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
+++ /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.contribution.namespace.impl.NamespaceImportExportListener
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties
deleted file mode 100644
index c1cbd06e7f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-AttributeNameSpaceMissing = Attribute 'namespace' is missing
-XMLStreamException = XMLStreamException occured due to : {0}
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java
deleted file mode 100644
index 5e213e3729..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.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.contribution.namespace.impl;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test NamespaceExportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceExportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\""
- + " ns:ext=\"extended\" namespace=\"http://foo\">"
- + "<ns:foo/></export>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- }
-
- /**
- * Test loading a valid export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader);
- assertEquals("http://foo", namespaceExport.getNamespace());
- assertEquals(1, namespaceExport.getAttributeExtensions().size());
- assertEquals(1, namespaceExport.getExtensions().size());
- }
-
- /**
- * Test loading an INVALID export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeNameSpaceMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java
deleted file mode 100644
index 7e889ec3ea..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.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.contribution.namespace.impl;
-
-
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test NamespaceImportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class NamespaceImportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\""
- + " ns:ext=\"extended\" namespace=\"http://foo\" location=\"sca://contributions/001\">"
- + "<ns:foo/></import>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- }
-
- /**
- * Test loading a valid import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- NamespaceImport namespaceImport = (NamespaceImport)staxProcessor.read(reader);
-
- assertEquals("http://foo", namespaceImport.getNamespace());
- assertEquals("sca://contributions/001", namespaceImport.getLocation());
- assertEquals(1, namespaceImport.getAttributeExtensions().size());
- assertEquals(1, namespaceImport.getExtensions().size());
- }
-
- /**
- * Test loading a INVALID import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeNameSpaceMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/LICENSE b/branches/sca-java-1.5.1/modules/contribution-osgi/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/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-java-1.5.1/modules/contribution-osgi/NOTICE b/branches/sca-java-1.5.1/modules/contribution-osgi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/pom.xml b/branches/sca-java-1.5.1/modules/contribution-osgi/pom.xml
deleted file mode 100644
index a8803f27fe..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/pom.xml
+++ /dev/null
@@ -1,96 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-osgi</artifactId>
- <name>Apache Tuscany SCA Contribution Service OSGi </name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-osgi-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.main</artifactId>
- <version>1.0.4</version>
- </dependency>
-
-
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.osgi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.osgi*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java
deleted file mode 100644
index 0bbb8b707a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/BundleReference.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi;
-
-
-/**
- * A weak reference to a class, which should be used to register classes
- * with an ArtifactResolver and resolve these classes later.
- *
- * @version $Rev$ $Date$
- */
-public class BundleReference {
-
- /**
- * The bundle.
- */
- private Object bundle;
-
- /**
- * The bundle name.
- */
- private String bundleName;
-
- /**
- * The bundle version.
- */
- private String bundleVersion;
-
- /**
- * The bundle name and version.
- */
- private String bundleUniqueName;
-
- /**
- * The bundle relative path.
- */
- private String bundleRelativePath;
-
- /**
- * Constructs a new BundleReference.
- *
- * @param bundle The bundle reference
- * @param bundleName The bundle name
- * @param bundleVersion The bundle version
- * @param bundleRelativePath The relative path for the bundle
- */
- public BundleReference(Object bundle, String bundleName, String bundleVersion, String bundleRelativePath) {
- this.bundle = bundle;
- this.bundleName = bundleName;
- this.bundleVersion = bundleVersion;
- this.bundleRelativePath = bundleRelativePath;
- this.bundleUniqueName = bundleName + "(" + (bundleVersion == null?"0.0.0":bundleVersion) + ")";
- }
-
- /**
- * Constructs a new BundleReference.
- *
- * @param bundleName The bundle name
- * @param bundleVersion The bundle version
- */
- public BundleReference(String bundleName, String bundleVersion) {
- this.bundleName = bundleName;
- this.bundleVersion = bundleVersion;
- this.bundleUniqueName = bundleName + "(" + (bundleVersion == null?"0.0.0":bundleVersion) + ")";
- }
-
- /**
- * Get the referenced bundle.
- *
- * @return The referenced bundle
- */
- public Object getBundle() {
- return bundle;
- }
-
- /**
- * Get the referenced bundle name.
- *
- * @return The bundle name
- */
- public String getBundleName() {
- return bundleName;
- }
-
- /**
- * Get the referenced bundle version.
- *
- * @return The bundle version
- */
- public String getBundleVersion() {
- return bundleVersion;
- }
-
- /**
- * Get the referenced bundle name and version.
- *
- * @return The bundle name
- */
- public String getBundleUniqueName() {
- return bundleUniqueName;
- }
-
- /**
- * Get the relative location of the bundle inside its contribution.
- *
- * @return The bundle path
- */
- public String getBundleRelativePath() {
- return bundleRelativePath;
- }
-
-
-
- /**
- * Returns true if the bundle reference is unresolved.
- *
- * @return Whether or not the bundle has been resolved
- */
- public boolean isUnresolved() {
- return bundle == null;
- }
-
- @Override
- public int hashCode() {
- return bundleUniqueName.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof BundleReference) {
- BundleReference ref = (BundleReference)obj;
- return bundleName.equals(ref.bundleName) &&
- (bundleVersion == null || ref.bundleVersion == null ||
- bundleVersion.equals(ref.bundleVersion));
- } else {
- return false;
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java
deleted file mode 100644
index 5033d7eefc..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleContributionProcessor.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.tuscany.sca.contribution.PackageType;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-import org.osgi.framework.Bundle;
-
-/**
- * Bundle Contribution package processor.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiBundleContributionProcessor implements PackageProcessor {
-
- public OSGiBundleContributionProcessor() {
- }
-
- public String getPackageType() {
- return PackageType.BUNDLE;
- }
-
- public URL getArtifactURL(URL sourceURL, URI artifact) throws MalformedURLException {
- Bundle bundle = null;
- try {
- bundle = OSGiRuntime.findInstalledBundle(sourceURL);
- if (bundle != null) {
- URL url = bundle.getResource(artifact.getPath());
- if (url == null)
- System.out.println("Could not load resource " + artifact);
- return url;
- }
- } catch (Exception e) {
- }
- return null;
- }
-
- public List<URI> getJarArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
- IOException {
- if (packageSourceURL == null) {
- throw new IllegalArgumentException("Invalid null package source URL.");
- }
-
- if (inputStream == null) {
- throw new IllegalArgumentException("Invalid null source inputstream.");
- }
-
- // Assume the root is a jar file
- JarInputStream jar = new JarInputStream(inputStream);
- try {
- Set<String> names = new HashSet<String>();
- while (true) {
- JarEntry entry = jar.getNextJarEntry();
- if (entry == null) {
- // EOF
- break;
- }
-
- // FIXME: Maybe we should externalize the filter as a property
- String name = entry.getName();
- if (!name.startsWith(".") && !entry.isDirectory()) {
-
- // Trim trailing /
- if (name.endsWith("/")) {
- name = name.substring(0, name.length() - 1);
- }
-
- // Add the entry name
- if (!names.contains(name) && name.length() > 0) {
- names.add(name);
-
- }
- }
- }
-
- // Return list of URIs
- List<URI> artifacts = new ArrayList<URI>();
- for (String name: names) {
- artifacts.add(URI.create(name));
- }
- return artifacts;
-
- } finally {
- jar.close();
- }
-}
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException,
- IOException {
-
- Bundle bundle = null;
- try {
- bundle = OSGiRuntime.findInstalledBundle(packageSourceURL);
- } catch (Exception e) {
- }
-
- if (bundle == null) {
- throw new IllegalArgumentException("Could not find OSGi bundle " + packageSourceURL);
- }
-
- if (packageSourceURL == null) {
- throw new IllegalArgumentException("Invalid null package source URL.");
- }
-
- List<URI> artifacts = new ArrayList<URI>();
-
- try {
- Enumeration entries = bundle.findEntries("/", "*", true);
- while (entries.hasMoreElements()) {
- URL entry = (URL)entries.nextElement();
- String entryName = entry.getPath();
- if (entryName.startsWith("/"))
- entryName = entryName.substring(1);
- artifacts.add(new URI(entryName));
-
- if (entryName.endsWith(".jar")) {
-
- URL jarResource = bundle.getResource(entryName);
- artifacts.addAll(getJarArtifacts(jarResource, jarResource.openStream()));
- }
-
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- return artifacts;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java
deleted file mode 100644
index b3c2302f60..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleProcessor.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarInputStream;
-import java.util.jar.Manifest;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.osgi.BundleReference;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-
-/**
- * OSGi bundle processor
- *
- * @version $Rev$ $Date$
- */
-public class OSGiBundleProcessor {
-
- private boolean initializedOSGi;
- private OSGiRuntime osgiRuntime;
-
- public OSGiBundleProcessor() {
- }
-
- public Object installContributionBundle(Contribution contribution) {
-
- JarInputStream jar = null;
- Object bundle = null;
-
- try {
-
- URL contribURL = new URL(contribution.getLocation());
- jar = new JarInputStream(contribURL.openStream());
-
- Manifest manifest = jar.getManifest();
- if (manifest != null && manifest.getMainAttributes()
- .containsKey(new Attributes.Name("Bundle-SymbolicName"))) {
-
- initialize();
- if (osgiRuntime != null)
- bundle = osgiRuntime.installBundle(contribURL.toString(), null);
- }
- } catch (Exception e) {
- // If OSGi cannot process the jar, treat the bundle as a plain jar file.
- } finally {
-
- try {
- if (jar != null)
- jar.close();
- } catch (IOException e) {
- }
- }
-
- return bundle;
- }
-
- public BundleReference installNestedBundle(Contribution contribution,
- String bundleSymbolicName,
- String bundleVersion) {
-
- BundleReference bundleReference = null;
-
- initialize();
- if (osgiRuntime == null)
- return null;
-
- List<Artifact> artifacts = contribution.getArtifacts();
- for (Artifact a : artifacts) {
- if (a.getURI().endsWith(".jar")) {
-
- InputStream stream;
- JarInputStream jar = null;
- Object name;
- Object version;
- try {
-
- URL artifactURL = new URL(a.getLocation());
- stream = artifactURL.openStream();
- jar = new JarInputStream(artifactURL.openStream());
- Manifest manifest = jar.getManifest();
- name = manifest.getMainAttributes().get(new Attributes.Name("Bundle-SymbolicName"));
- version = manifest.getMainAttributes().get(new Attributes.Name("Bundle-Version"));
-
- if (bundleSymbolicName.equals(name) && (bundleVersion == null || version == null || bundleVersion
- .equals(version))) {
-
- Object bundle = osgiRuntime.installBundle(a.getLocation(), stream);
-
- bundleReference = new BundleReference(bundle, bundleSymbolicName, bundleVersion, a.getURI());
-
- break;
- }
-
- } catch (Exception e) {
-
- // If OSGi cannot process the jar, treat the bundle as a plain jar file.
- } finally {
- try {
- if (jar != null)
- jar.close();
- } catch (IOException e) {
- }
- }
- }
- }
- return bundleReference;
- }
-
- private void initialize() {
- try {
- if (!initializedOSGi) {
- initializedOSGi = true;
- osgiRuntime = OSGiRuntime.getRuntime();
- }
- } catch (Exception e) {
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java
deleted file mode 100644
index 07e80f66f3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiBundleReferenceModelResolver.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.osgi.BundleReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-import org.osgi.framework.Bundle;
-
-/**
- * A Model Resolver for BundleReferences.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiBundleReferenceModelResolver implements ModelResolver {
- private Contribution contribution;
- private Map<String, BundleReference> map = new HashMap<String, BundleReference>();
-
- OSGiRuntime osgiRuntime;
- private OSGiBundleProcessor bundleProcessor;
-
- public OSGiBundleReferenceModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- this.bundleProcessor = new OSGiBundleProcessor();
- }
-
- public void addModel(Object resolved) {
- BundleReference bundleRef = (BundleReference)resolved;
- map.put(bundleRef.getBundleUniqueName(), bundleRef);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((BundleReference)resolved).getBundleUniqueName());
- }
-
- /**
- * Handle artifact resolution when the specific class reference is imported from another contribution
- * @param unresolved
- * @return
- */
- private BundleReference resolveImportedModel(BundleReference unresolved) {
- BundleReference resolved = unresolved;
-
- if( this.contribution != null) {
- for (Import import_ : this.contribution.getImports()) {
-
- resolved = import_.getModelResolver().resolveModel(BundleReference.class, unresolved);
- if (resolved != unresolved)
- break;
- }
-
- }
- return resolved;
- }
-
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
-
- if (resolved != null ){
- return modelClass.cast(resolved);
- }
-
- try {
- if (osgiRuntime == null)
- osgiRuntime = OSGiRuntime.getRuntime();
- } catch (Exception e) {
- }
- if (osgiRuntime == null)
- return unresolved;
-
- //Load a class on demand
- Object bundle = null;
- String bundleName = ((BundleReference)unresolved).getBundleName();
- String bundleVersion = ((BundleReference)unresolved).getBundleVersion();
-
- bundle = osgiRuntime.findBundle(bundleName, bundleVersion);
- BundleReference bundleReference;
-
- if (bundle == null)
- bundleReference = bundleProcessor.installNestedBundle(contribution, bundleName, bundleVersion);
- else {
- bundleReference = new BundleReference(bundle,
- ((BundleReference)unresolved).getBundleName(),
- bundleVersion,
- getBundleFileName(bundle)
- );
- }
-
-
- if (bundleReference != null) {
- //if we load the class
-
- map.put(((BundleReference)unresolved).getBundleUniqueName(), bundleReference);
-
- // Return the resolved BundleReference
- return modelClass.cast(bundleReference);
- } else {
- //delegate resolution of the class
- resolved = this.resolveImportedModel((BundleReference)unresolved);
- return modelClass.cast(resolved);
- }
-
-
- }
-
-
- private String getBundleFileName(Object bundle) {
- if (bundle instanceof Bundle) {
- String path = ((Bundle)bundle).getLocation();
- if (path.endsWith("/"))
- path = path.substring(0, path.length()-1);
- if (path.startsWith(contribution.getLocation())) {
- if (path.equals(contribution.getLocation())) {
- int index = path.lastIndexOf('/');
- if (index > 0 && index < path.length()-1)
- path = path.substring(index+1);
- } else {
- path = path.substring(contribution.getLocation().length());
- if (path.startsWith("/"))
- path = path.substring(1);
- }
- } else if (path.lastIndexOf('/') >= 0)
- path = path.substring(path.lastIndexOf('/')+1);
- return path;
- }
- return null;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java
deleted file mode 100644
index 39cdd6fcd3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiClassReferenceModelResolver.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-import org.osgi.framework.Bundle;
-
-/**
- * A Model Resolver for ClassReferences.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiClassReferenceModelResolver implements ModelResolver {
- private Contribution contribution;
- private Map<String, ClassReference> map = new HashMap<String, ClassReference>();
- private Bundle bundle;
- private boolean initialized;
- private boolean useOSGi;
-
- public OSGiClassReferenceModelResolver(Contribution contribution, ExtensionPointRegistry registry) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- ClassReference clazz = (ClassReference)resolved;
- map.put(clazz.getClassName(), clazz);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((ClassReference)resolved).getClassName());
- }
-
- /**
- * Handle artifact resolution when the specific class reference is imported from another contribution
- * @param unresolved
- * @return
- */
- private ClassReference resolveImportedModel(ClassReference unresolved) {
- ClassReference resolved = unresolved;
-
- if (this.contribution != null) {
- for (Import import_ : this.contribution.getImports()) {
-
- if (resolved == unresolved && bundle != null) {
- resolved = import_.getModelResolver().resolveModel(ClassReference.class, unresolved);
- if (resolved != unresolved)
- break;
- }
- }
-
- }
- return resolved;
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
-
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- initialize();
- if (!useOSGi)
- return unresolved;
-
- //Load a class on demand
- Class clazz = null;
- if (bundle != null) {
- try {
- clazz = bundle.loadClass(((ClassReference)unresolved).getClassName());
- } catch (Exception e) {
- // we will later try to delegate to imported model resolvers
- }
- }
-
- if (clazz != null) {
- //if we load the class
- // Store a new ClassReference wrapping the loaded class
- ClassReference classReference = new ClassReference(clazz);
- map.put(getPackageName(classReference), classReference);
-
- // Return the resolved ClassReference
- return modelClass.cast(classReference);
- } else {
- //delegate resolution of the class
- resolved = this.resolveImportedModel((ClassReference)unresolved);
- return modelClass.cast(resolved);
- }
-
- }
-
- /***************
- * Helper methods
- ***************/
-
- private String getPackageName(ClassReference clazz) {
- int pos = clazz.getClassName().lastIndexOf(".");
- return clazz.getClassName().substring(0, pos - 1);
- }
-
- private void initialize() {
- if (initialized)
- return;
-
- initialized = true;
- try {
- bundle = OSGiRuntime.findInstalledBundle(contribution.getLocation());
- useOSGi = bundle != null;
- } catch (Throwable e) {
- // Ignore errors, default to ClassReferenceModelResolver
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java
deleted file mode 100644
index 15ad0bd948..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiImportExportListener.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.java.JavaExport;
-import org.apache.tuscany.sca.contribution.java.JavaImport;
-import org.apache.tuscany.sca.contribution.service.ContributionListener;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-
-/**
- * Namespace Import/Export contribution listener
- * The listener would process all import/export from a given contribution
- * and initialize the model resolvers properly
- *
- * @version $Rev$ $Date$
- */
-public class OSGiImportExportListener implements ContributionListener {
-
- private OSGiBundleProcessor bundleProcessor;
-
- public OSGiImportExportListener() {
- bundleProcessor = new OSGiBundleProcessor();
- }
-
- /**
- * Initialize the import/export model resolvers
- * Export model resolvers are same as Contribution model resolver
- * Import model resolvers are matched to a specific contribution if a location URI is specified,
- * otherwise it try to resolve against all the other contributions
- */
- public void contributionAdded(ContributionRepository repository, Contribution contribution) {
-
- OSGiRuntime osgiRuntime = null;
- try {
- if (bundleProcessor.installContributionBundle(contribution) == null) {
- return;
- } else {
- osgiRuntime = OSGiRuntime.getRuntime();
- }
- } catch (Exception e) {
- return;
- }
-
- HashSet<Contribution> bundlesToInstall = new HashSet<Contribution>();
- // Initialize the contribution imports
- for (Import import_ : contribution.getImports()) {
- boolean initialized = false;
-
- if (import_ instanceof JavaImport) {
- JavaImport javaImport = (JavaImport)import_;
- String packageName = javaImport.getPackage();
-
- //Find a matching contribution
- if (javaImport.getLocation() != null) {
- Contribution targetContribution = repository.getContribution(javaImport.getLocation());
- if (targetContribution != null) {
-
- // Find a matching contribution export
- for (Export export : targetContribution.getExports()) {
- if (export instanceof JavaExport) {
- JavaExport javaExport = (JavaExport)export;
- if (packageName.equals(javaExport.getPackage())) {
-
- if (osgiRuntime.findBundle(targetContribution.getLocation()) == null)
- bundlesToInstall.add(targetContribution);
-
- initialized = true;
-
- }
- }
- if (initialized)
- break;
- }
- }
- }
- }
- if (!initialized) {
- for (Contribution c : repository.getContributions()) {
-
- // Go over all exports in the contribution
- for (Export export : c.getExports()) {
- // If the export matches our namespace, try to the resolve the model object
- if (import_.match(export) && osgiRuntime.findBundle(c.getLocation()) == null) {
- bundlesToInstall.add(c);
- }
- }
- }
- }
- }
- for (Contribution c : bundlesToInstall) {
- try {
- installDummyBundle(osgiRuntime, c);
- } catch (Exception e) {
- }
- }
-
- }
-
- public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
-
- }
-
- public void contributionUpdated(ContributionRepository repository,
- Contribution oldContribution,
- Contribution contribution) {
-
- }
-
- private void installDummyBundle(OSGiRuntime osgiRuntime, Contribution contribution) throws Exception {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- String EOL = System.getProperty("line.separator");
-
- String bundleName = contribution.getURI();
- URL contribURL = new URL(contribution.getLocation());
- String contribName = contribURL.getPath();
- if (contribName.endsWith("/"))
- contribName = contribName.substring(0, contribName.length()-1);
- if (contribName.lastIndexOf("/") >= 0)
- contribName = contribName.substring(contribName.lastIndexOf("/")+1);
-
- StringBuffer exportPackageNames = new StringBuffer();
- for (Export export : contribution.getExports()) {
- if (export instanceof JavaExport) {
- if (exportPackageNames.length() > 0)
- exportPackageNames.append(",");
- exportPackageNames.append(((JavaExport)export).getPackage());
- }
- }
- StringBuffer importPackageNames = new StringBuffer();
- for (Import import_ : contribution.getImports()) {
- if (import_ instanceof JavaImport) {
- if (importPackageNames.length() > 0)
- importPackageNames.append(",");
- importPackageNames.append(((JavaImport)import_).getPackage());
- }
- }
-
- String manifestStr =
- "Manifest-Version: 1.0" + EOL
- + "Bundle-ManifestVersion: 2"
- + EOL
- + "Bundle-Name: "
- + bundleName
- + EOL
- + "Bundle-SymbolicName: "
- + bundleName
- + EOL
- + "Bundle-Version: "
- + "1.0.0"
- + EOL
- + "Bundle-Localization: plugin"
- + EOL;
-
- StringBuilder manifestBuf = new StringBuilder();
- manifestBuf.append(manifestStr);
- manifestBuf.append("Export-Package: " + exportPackageNames + EOL);
- manifestBuf.append("Import-Package: " + importPackageNames + EOL);
- manifestBuf.append("Bundle-ClassPath: .," + contribName + EOL);
-
- ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
- Manifest manifest = new Manifest();
- manifest.read(manifestStream);
-
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- ZipEntry ze = new ZipEntry(contribName);
- jarOut.putNextEntry(ze);
- InputStream stream = contribURL.openStream();
-
- byte[] bytes = new byte[stream.available()];
- stream.read(bytes);
- jarOut.write(bytes);
- stream.close();
-
- jarOut.close();
- out.close();
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- osgiRuntime.installBundle("file://" + bundleName + ".jar", in);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java
deleted file mode 100644
index e624b1d3b5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/java/org/apache/tuscany/sca/contribution/osgi/impl/OSGiModelResolverImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.osgi.impl;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.osgi.BundleReference;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.osgi.framework.Bundle;
-
-/**
- * An implementation of an artifact resolver for OSGi bundles.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiModelResolverImpl implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- private Hashtable<String, Bundle> bundles;
- public OSGiModelResolverImpl(Hashtable<String, Bundle> bundles) {
- this.bundles = bundles;
- }
-
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else if (unresolved instanceof ClassReference) {
-
- // Load a class on demand
- ClassReference classReference = (ClassReference)unresolved;
- Class clazz = null;
- for (Bundle bundle : bundles.values()) {
- try {
- clazz = bundle.loadClass(classReference.getClassName());
- } catch (ClassNotFoundException e) {
- continue;
- }
- break;
- }
- if (clazz == null) {
-
- // Return the unresolved object
- return unresolved;
- }
-
- // Store a new ClassReference wrapping the loaded class
- resolved = new ClassReference(clazz);
- map.put(resolved, resolved);
-
- // Return the resolved ClassReference
- return modelClass.cast(resolved);
-
- } else if (unresolved instanceof BundleReference) {
- for (String bundlePath: bundles.keySet()) {
- Bundle bundle = bundles.get(bundlePath);
- BundleReference bundleRef = (BundleReference)unresolved;
- String bundleVersion = (String)bundle.getHeaders().get("Bundle-Version");
- if (bundle.getSymbolicName().equals(bundleRef.getBundleName())&&
- (bundleVersion == null || bundleRef.getBundleVersion() == null ||
- bundleVersion.equals(bundleRef.getBundleVersion()))) {
-
- resolved = new BundleReference(bundle,
- bundle.getSymbolicName(),
- bundleVersion,
- bundlePath);
- map.put(resolved, resolved);
-
- // Return the resolved BundleReference
- return modelClass.cast(resolved);
-
- }
- }
- }
-
- // Return the unresolved object
- return unresolved;
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
- public Collection<Object> getModels() {
- return map.values();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
deleted file mode 100644
index 632d135cb5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessor
+++ /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.contribution.osgi.impl.OSGiBundleContributionProcessor;type=application/osgi.bundle
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 02e8b411eb..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.contribution.osgi.impl.OSGiBundleReferenceModelResolver;model=org.apache.tuscany.sca.contribution.osgi.BundleReference
diff --git a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
deleted file mode 100644
index 8dec190930..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
+++ /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.contribution.osgi.impl.OSGiImportExportListener
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/LICENSE b/branches/sca-java-1.5.1/modules/contribution-resource/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/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-java-1.5.1/modules/contribution-resource/NOTICE b/branches/sca-java-1.5.1/modules/contribution-resource/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/pom.xml b/branches/sca-java-1.5.1/modules/contribution-resource/pom.xml
deleted file mode 100644
index 5309862ef6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-resource</artifactId>
- <name>Apache Tuscany SCA Resource Import/Export Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.resource</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.resource*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.java
deleted file mode 100644
index 0bd30c19dd..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceExport.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.contribution.resource;
-
-import org.apache.tuscany.sca.contribution.Export;
-
-
-/**
- * The representation of an resource export.
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceExport extends Export {
-
- /**
- * Get Resource URI that identifies the export.
- *
- * @return The exported resource URI
- */
- String getURI();
-
- /**
- * Set Resource URI that identifies the export.
- *
- * @param uri The exported resource URI
- */
- void setURI(String uri);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.java
deleted file mode 100644
index 07eac9d843..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImport.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.contribution.resource;
-
-import org.apache.tuscany.sca.contribution.Import;
-
-/**
- * The representation of an resource import.
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceImport extends Import {
-
- /**
- * Get the location used to resolve the definitions for this import
- *
- * @return The import location
- */
- String getLocation();
-
- /**
- * Set the location used to resolve the definitions for this import
- *
- * @param location The import location
- */
- void setLocation(String location);
-
- /**
- * Get URI that identifies the resource import
- *
- * @return The URI
- */
- String getURI();
-
- /**
- * Set URI that identifies the resource import
- *
- * @param uri The resource URI
- */
- void setURI(String uri);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.java
deleted file mode 100644
index 4119c344ce..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/ResourceImportExportFactory.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.contribution.resource;
-
-/**
- * Base Resource import/export model factory
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceImportExportFactory {
-
- /**
- * Create a resource import model object
- *
- * @return The new ResourceImport model object
- */
- ResourceImport createResourceImport();
-
- /**
- * Create a resource export model object
- *
- * @return The new ResourceExport model object
- */
- ResourceExport createResourceExport();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java
deleted file mode 100644
index 67836748fc..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ArtifactModelResolver.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resource.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-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.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-
-/**
- * A Model Resolver for contribution artifacts.
- *
- * @version $Rev$ $Date$
- */
-public class ArtifactModelResolver implements ModelResolver {
- private Contribution contribution;
- private Map<String, Artifact> map = new HashMap<String, Artifact>();
-
- public ArtifactModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- Artifact artifact = (Artifact)resolved;
- map.put(artifact.getURI(), artifact);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((Artifact)resolved).getURI());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Get the artifact URI
- String uri = ((Artifact)unresolved).getURI();
- if (uri == null) {
- return (T)unresolved;
- }
-
- // Lookup the artifact
- Artifact resolved = (Artifact) 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 resource imports)
- for (Import import_ : this.contribution.getImports()) {
- if (import_ instanceof ResourceImport) {
- ResourceImport resourceImport = (ResourceImport)import_;
- //check the import location against the computed package name from the componentType URI
- if ((resourceImport.getURI().equals(uri)) &&
- (resourceImport.getModelResolver() != null)){
- // Delegate the resolution to the import resolver
- resolved = resourceImport.getModelResolver().resolveModel(Artifact.class, (Artifact)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
-
- return (T)unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.java
deleted file mode 100644
index 50ba5bcd6f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportImpl.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.contribution.resource.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-
-/**
- * The representation of an export for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class ResourceExportImpl extends ExtensibleImpl implements ResourceExport {
- /**
- * The resource URI to be exported
- */
- private String uri;
-
- private ModelResolver modelResolver;
-
- protected ResourceExportImpl() {
- super();
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportModelResolver.java
deleted file mode 100644
index fd568e533d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportModelResolver.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resource.impl;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-
-/**
- * A model resolver for resource exports.
- *
- * @version $Rev$ $Date$
- */
-public class ResourceExportModelResolver implements ModelResolver {
-
- private ResourceExport export;
- private ModelResolver resolver;
-
- public ResourceExportModelResolver(ResourceExport export, ModelResolver resolver) {
- this.export = export;
- this.resolver = resolver;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Filter based on the artifact URI
- Artifact artifact = (Artifact)unresolved;
- if (export.getURI().equals(artifact.getURI())) {
-
- // The artifact URI matches the exported URI, delegate to the
- // contribution's resolver
- return resolver.resolveModel(modelClass, unresolved);
- } else {
-
- // The artifact URI is not exported, return the unresolved object
- return unresolved;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.java
deleted file mode 100644
index dcd806776f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessor.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.contribution.resource.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact processor for Resource export
- *
- * @version $Rev$ $Date$
- */
-public class ResourceExportProcessor implements StAXArtifactProcessor<ResourceExport> {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final QName EXPORT_RESOURCE = new QName(SCA10_NS, "export.resource");
- private static final String URI = "uri";
-
- private final ResourceImportExportFactory factory;
- private final Monitor monitor;
-
- public ResourceExportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.factory = modelFactories.getFactory(ResourceImportExportFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-resource-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-resource-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return EXPORT_RESOURCE;
- }
-
- public Class<ResourceExport> getModelType() {
- return ResourceExport.class;
- }
-
- /**
- * Process <export.resource uri=""/>
- */
- public ResourceExport read(XMLStreamReader reader) throws ContributionReadException {
- ResourceExport resourceExport = this.factory.createResourceExport();
- QName element = null;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <export.resource>
- if (EXPORT_RESOURCE.equals(element)) {
- String uri = reader.getAttributeValue(null, URI);
- if (uri == null) {
- error("AttributeURIMissing", reader);
- //throw new ContributionReadException("Attribute 'uri' is missing");
- } else
- resourceExport.setURI(uri);
- }
-
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (EXPORT_RESOURCE.equals(reader.getName())) {
- return resourceExport;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return resourceExport;
- }
-
- public void write(ResourceExport resourceExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <export.resource>
- writer.writeStartElement(EXPORT_RESOURCE.getNamespaceURI(), EXPORT_RESOURCE.getLocalPart());
-
- if (resourceExport.getURI() != null) {
- writer.writeAttribute(URI, resourceExport.getURI());
- }
-
- writer.writeEndElement();
- }
-
- public void resolve(ResourceExport resourceExport, ModelResolver resolver) throws ContributionResolveException {
-
- if (resourceExport.getURI() != null)
- // Initialize the export's model resolver
- resourceExport.setModelResolver(new ResourceExportModelResolver(resourceExport, resolver));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.java
deleted file mode 100644
index 880f5f5786..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportFactoryImpl.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.contribution.resource.impl;
-
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
-
-/**
- * Resource Import/Export model factory implementation
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImportExportFactoryImpl implements ResourceImportExportFactory {
-
- public ResourceImport createResourceImport() {
- return new ResourceImportImpl();
- }
-
- public ResourceExport createResourceExport() {
- return new ResourceExportImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java
deleted file mode 100644
index e7aecad786..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportExportListener.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resource.impl;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-import org.apache.tuscany.sca.contribution.service.ContributionListener;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-
-/**
- * Resource Import/Export contribution listener
- * The listener would process all import/export from a given contribution
- * and initialize the model resolvers properly
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImportExportListener implements ContributionListener {
-
- /**
- * Initialize the import/export model resolvers
- * Export model resolvers are same as Contribution model resolver
- * Import model resolvers are matched to a specific contribution if a location URI is specified,
- * otherwise it try to resolve against all the other contributions
- * Also set the exporting contributions used by contribution ClassLoaders to
- * match import/export for class loading.
- */
- public void contributionAdded(ContributionRepository repository, Contribution contribution) {
- // Initialize the contribution exports
- for (Export export: contribution.getExports()) {
- export.setModelResolver(contribution.getModelResolver());
- }
-
- // Initialize the contribution imports
- for (Import import_: contribution.getImports()) {
- boolean initialized = false;
-
- if (import_ instanceof ResourceImport) {
- ResourceImport resourceImport = (ResourceImport)import_;
-
- // Find a matching contribution
- if (resourceImport.getLocation() != null) {
- Contribution targetContribution = repository.getContribution(resourceImport.getLocation());
- if (targetContribution != null) {
-
- // Find a matching contribution export
- for (Export export: targetContribution.getExports()) {
- if (export instanceof ResourceExport) {
- ResourceExport resourceExport = (ResourceExport)export;
- if (resourceImport.getURI().equals(resourceExport.getURI())) {
- resourceImport.setModelResolver(resourceExport.getModelResolver());
- initialized = true;
- break;
- }
- }
- }
- }
- }
-
- //if no location was specified, try to resolve with any contribution
- if( !initialized ) {
- // Use a resolver that will consider all contributions
- import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions()));
- }
- }
- }
- }
-
- public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
-
- }
-
- public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.java
deleted file mode 100644
index 6a862a2f04..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportImpl.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.contribution.resource.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-
-/**
- * The representation of an import for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImportImpl extends ExtensibleImpl implements ResourceImport {
- /**
- * The resource URI to be imported
- */
- private String uri;
-
- private ModelResolver modelResolver;
- private List<Contribution> exportContributions;
-
- /**
- * Optional location URI pointing to a Contribution that exports the resource
- */
- private String location;
-
- protected ResourceImportImpl() {
- super();
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
- public List<Contribution> getExportContributions() {
- return exportContributions;
- }
-
- public void setExportContributions(List<Contribution> contributions) {
- this.exportContributions = contributions;
- }
-
- /**
- * Match a ResourceImport to a given ResourceExport based on :
- * location is not provided
- * import and export resource URI match
- */
- public boolean match(Export export) {
- if (export instanceof ResourceExport) {
- if (this.getLocation() == null || this.getLocation().length() == 0) {
- if (this.getURI().equals(((ResourceExport)export).getURI())) {
- return true;
- }
- }
-
- }
- return false;
- }
-
- @Override
- public String toString() {
- return String.valueOf(uri);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java
deleted file mode 100644
index e5d30b389a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessor.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resource.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-import org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Artifact processor for Namespace import
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImportProcessor implements StAXArtifactProcessor<ResourceImport> {
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName IMPORT_RESOURCE = new QName(SCA10_NS, "import.resource");
-
- private static final String URI = "uri";
- private static final String LOCATION = "location";
-
- private final ResourceImportExportFactory factory;
- private final Monitor monitor;
-
- public ResourceImportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.factory = modelFactories.getFactory(ResourceImportExportFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-resource-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-resource-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return IMPORT_RESOURCE;
- }
-
- public Class<ResourceImport> getModelType() {
- return ResourceImport.class;
- }
-
- /**
- * Process <import.resource uri="" location=""/>
- */
- public ResourceImport read(XMLStreamReader reader) throws ContributionReadException {
- ResourceImport resourceImport = this.factory.createResourceImport();
- QName element;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- element = reader.getName();
-
- // Read <import>
- if (IMPORT_RESOURCE.equals(element)) {
- String uri = reader.getAttributeValue(null, URI);
- if (uri == null) {
- error("AttributeURIMissing", reader);
- //throw new ContributionReadException("Attribute 'uri' is missing");
- } else
- resourceImport.setURI(uri);
-
- String location = reader.getAttributeValue(null, LOCATION);
- if (location != null) {
- resourceImport.setLocation(location);
- }
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- if (IMPORT_RESOURCE.equals(reader.getName())) {
- return resourceImport;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- }
- catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return resourceImport;
- }
-
- public void write(ResourceImport resourceImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <import>
- writer.writeStartElement(IMPORT_RESOURCE.getNamespaceURI(), IMPORT_RESOURCE.getLocalPart());
-
- if (resourceImport.getURI() != null) {
- writer.writeAttribute(URI, resourceImport.getURI());
- }
- if (resourceImport.getLocation() != null) {
- writer.writeAttribute(LOCATION, resourceImport.getLocation());
- }
-
- writer.writeEndElement();
- }
-
-
- public void resolve(ResourceImport model, ModelResolver resolver) throws ContributionResolveException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 14eb81546d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.contribution.resource.impl.ResourceImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import.resource,model=org.apache.tuscany.sca.contribution.resource.ResourceImport
-org.apache.tuscany.sca.contribution.resource.impl.ResourceExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export.resource,model=org.apache.tuscany.sca.contribution.resource.ResourceExport
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 08d2b1c338..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.contribution.resource.impl.ArtifactModelResolver;model=org.apache.tuscany.sca.contribution.Artifact \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory
deleted file mode 100644
index d39a5065c2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resource.ResourceImportExportFactory
+++ /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.contribution.resource.impl.ResourceImportExportFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
deleted file mode 100644
index f4751db9aa..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener
+++ /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.contribution.resource.impl.ResourceImportExportListener
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/contribution-resource-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/contribution-resource-validation-messages.properties
deleted file mode 100644
index 9df66cce52..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/main/resources/contribution-resource-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-AttributeURIMissing = Attribute 'uri' is missing
-XMLStreamException = XMLStreamException occured due to : {0}
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.java
deleted file mode 100644
index ea44cb506b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceExportProcessorTestCase.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.contribution.resource.impl;
-
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resource.ResourceExport;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test NamespaceExportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class ResourceExportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\"/>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<export.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- /**
- * Test loading a valid export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ResourceExport resourceExport = (ResourceExport)staxProcessor.read(reader);
- assertEquals("helloworld/HelloWorldService.componentType", resourceExport.getURI());
- }
-
- /**
- * Test loading an INVALID export element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeURIMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java
deleted file mode 100644
index 1ff931c162..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-resource/src/test/java/org/apache/tuscany/sca/contribution/resource/impl/ResourceImportProcessorTestCase.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resource.impl;
-
-
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resource.ResourceImport;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test NamespaceImportProcessorTestCase
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImportProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" uri=\"helloworld/HelloWorldService.componentType\" location=\"sca://contributions/001\"/>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<import.resource xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" location=\"sca://contributions/001\"/>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- /**
- * Test loading a valid import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoad() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ResourceImport namespaceImport = (ResourceImport)staxProcessor.read(reader);
- assertEquals("helloworld/HelloWorldService.componentType", namespaceImport.getURI());
- assertEquals("sca://contributions/001", namespaceImport.getLocation());
- }
-
- /**
- * Test loading a INVALID import element from a contribution metadata stream
- * @throws Exception
- */
- public void testLoadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("readerException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeURIMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/LICENSE b/branches/sca-java-1.5.1/modules/contribution-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-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-java-1.5.1/modules/contribution-xml/NOTICE b/branches/sca-java-1.5.1/modules/contribution-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/pom.xml b/branches/sca-java-1.5.1/modules/contribution-xml/pom.xml
deleted file mode 100644
index 2b78216a2d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution-xml</artifactId>
- <name>Apache Tuscany SCA XML Contribution Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java
deleted file mode 100644
index 0031063c79..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyAttributeProcessor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor.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.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A Policy Processor used for testing.
- *
- * @version $Rev$ $Date$
- */
-public class AnyAttributeProcessor extends BaseStAXArtifactProcessor implements StAXAttributeProcessor<Extension> {
- private static final QName ANY_ATTRIBUTE = new QName(Constants.XMLSCHEMA_NS, "anyAttribute");
-
- private ExtensionFactory extensionFactory;
-
- public AnyAttributeProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- }
-
- public QName getArtifactType() {
- return ANY_ATTRIBUTE;
- }
-
- public Class<Extension> getModelType() {
- return Extension.class;
- }
-
- public Extension read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- String attributeValue = reader.getAttributeValue(attributeName.getNamespaceURI(), attributeName.getLocalPart());
- return extensionFactory.createExtension(attributeName, attributeValue, true);
- }
-
- public void write(Extension attributeExtension, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- writer.writeAttribute(attributeExtension.getQName().getPrefix(),
- attributeExtension.getQName().getNamespaceURI(),
- attributeExtension.getQName().getLocalPart(),
- attributeExtension.getValue().toString()); //for extended attributes, we can assume values
- // are just the string representation fo the attribute
- }
-
- public void resolve(Extension arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java
deleted file mode 100644
index 6e6803a806..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/AnyElementProcessor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor.xml;
-
-import static javax.xml.stream.XMLStreamConstants.CDATA;
-import static javax.xml.stream.XMLStreamConstants.CHARACTERS;
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.stream.events.XMLEvent;
-
-import org.apache.tuscany.sca.contribution.Constants;
-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.monitor.Monitor;
-
-public class AnyElementProcessor implements StAXArtifactProcessor<Object> {
- private static final QName ANY_ELEMENT = new QName(Constants.XMLSCHEMA_NS, "anyElement");
-
- private XMLInputFactory xmlInputFactory;
- @SuppressWarnings("unused")
- private Monitor monitor;
-
- // Map<String, NamespaceContext> map = new HashMap<String,NamespaceContext>();
-
- public AnyElementProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- xmlInputFactory = modelFactories.getFactory(XMLInputFactory.class);
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- return ANY_ELEMENT;
- }
-
- public Class<Object> getModelType() {
- return Object.class;
- }
-
- /**
- * Reads the contetns of the unknown elements and generates a custom
- * implementation of XMLStreamReader i.e. XMLEventsStreamReader
- *
- * @param reader
- * @return
- * @throws XMLStreamException
- */
- @SuppressWarnings("unchecked")
- public Object read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Custom variables
- String currentElement = null;
- List eventsList = new ArrayList();
-
- Map<String, NamespaceContext> eventContext = new HashMap<String, NamespaceContext>();
-
- try {
- // Cast the block of unknown elements into document
- XMLDocumentStreamReader docReader = new XMLDocumentStreamReader(reader);
-
- XMLEventReader xmlEventReader = xmlInputFactory.createXMLEventReader(docReader);
-
- while (xmlEventReader.hasNext()) {
- XMLEvent event = xmlEventReader.nextEvent();
-
- // Populate the eventContext map with the current element's name
- // and corresponding NamesapceContext
- if (currentElement != null && !(eventContext.containsKey(currentElement))) {
- eventContext.put(currentElement, reader.getNamespaceContext());
- }
-
- // Populate the list with the XMLEvents
- eventsList.add(event);
- if (event.isStartElement()) {
- currentElement = reader.getName().getLocalPart();
- }
- if (event.isEndDocument()) {
- return new XMLEventsStreamReader(eventsList, eventContext);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * Writes unknown portions back to the writer
- *
- * @param model
- * @param writer
- */
- public void write(Object model, XMLStreamWriter writer) throws XMLStreamException {
- if (!(model instanceof XMLStreamReader)) {
- return;
- }
- XMLStreamReader reader = (XMLStreamReader)model;
-
- int event = reader.getEventType();
- while (reader.hasNext()) {
- switch (event) {
- case START_ELEMENT:
-
- writer.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader.getNamespaceURI());
- for (int i = 1; i <= reader.getAttributeCount(); i++) {
- writer.writeAttribute(reader.getAttributePrefix(i), reader.getAttributeNamespace(i), reader
- .getAttributeLocalName(i), reader.getAttributeValue(i));
- }
- break;
-
- case CHARACTERS:
- writer.writeCharacters(reader.getText());
- break;
-
- case CDATA:
- writer.writeCData(reader.getText());
- break;
-
- case END_ELEMENT:
- writer.writeEndElement();
- break;
- }
- if (reader.hasNext()) {
- event = reader.next();
- }
- }
- }
-
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
deleted file mode 100644
index d326324a5d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLDocumentStreamReader.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor.xml;
-
-import java.util.NoSuchElementException;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * This class is derived from Apache Axis2 class
- * org.apache.axis2.util.StreamWrapper</a>. It's used wrap a XMLStreamReader to
- * create a XMLStreamReader representing a document and it will produce
- * START_DOCUMENT, END_DOCUMENT events.
- *
- * @version $Rev: 659153 $ $Date: 2008-05-22 09:43:58 -0700 (Thu, 22 May 2008) $
- */
-public class XMLDocumentStreamReader implements XMLStreamReader {
- private static final int STATE_COMPLETE_AT_NEXT = 2; // The wrapper
- // will produce
- // END_DOCUMENT
-
- private static final int STATE_COMPLETED = 3; // Done
-
- private static final int STATE_INIT = 0; // The wrapper will produce
- // START_DOCUMENT
-
- private static final int STATE_SWITCHED = 1; // The real reader will
- // produce events
-
- private XMLStreamReader realReader;
- private boolean fragment;
- private int level = 0;
-
- private int state = STATE_INIT;
-
- public XMLDocumentStreamReader(XMLStreamReader realReader) {
- if (realReader == null) {
- throw new UnsupportedOperationException("Reader cannot be null");
- }
-
- this.realReader = realReader;
-
- if (realReader instanceof XMLFragmentStreamReader) {
- ((XMLFragmentStreamReader)realReader).init();
- }
-
- // If the real reader is positioned at START_DOCUMENT, always use
- // the real reader
- if (realReader.getEventType() == START_DOCUMENT) {
- fragment = false;
- state = STATE_SWITCHED;
- }
- }
-
- public void close() throws XMLStreamException {
- realReader.close();
- }
-
- public int getAttributeCount() {
- if (isDelegating()) {
- return realReader.getAttributeCount();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeLocalName(int i) {
- if (isDelegating()) {
- return realReader.getAttributeLocalName(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public QName getAttributeName(int i) {
- if (isDelegating()) {
- return realReader.getAttributeName(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeNamespace(int i) {
- if (isDelegating()) {
- return realReader.getAttributeNamespace(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributePrefix(int i) {
- if (isDelegating()) {
- return realReader.getAttributePrefix(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeType(int i) {
- if (isDelegating()) {
- return realReader.getAttributeType(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeValue(int i) {
- if (isDelegating()) {
- return realReader.getAttributeValue(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeValue(String s, String s1) {
- if (isDelegating()) {
- return realReader.getAttributeValue(s, s1);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getCharacterEncodingScheme() {
- if (isDelegating()) {
- return realReader.getCharacterEncodingScheme();
- } else {
- return "UTF-8";
- }
- }
-
- public String getElementText() throws XMLStreamException {
- if (isDelegating()) {
- return realReader.getElementText();
- } else {
- throw new XMLStreamException();
- }
- }
-
- public String getEncoding() {
- return realReader.getEncoding();
- }
-
- public int getEventType() {
- int event = -1;
- switch (state) {
- case STATE_SWITCHED:
- case STATE_COMPLETE_AT_NEXT:
- event = realReader.getEventType();
- break;
- case STATE_INIT:
- event = START_DOCUMENT;
- break;
- case STATE_COMPLETED:
- event = END_DOCUMENT;
- break;
- }
- return event;
- }
-
- public String getLocalName() {
- if (isDelegating()) {
- return realReader.getLocalName();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public Location getLocation() {
- if (isDelegating()) {
- return realReader.getLocation();
- } else {
- return null;
- }
- }
-
- public QName getName() {
- if (isDelegating()) {
- return realReader.getName();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public NamespaceContext getNamespaceContext() {
- return realReader.getNamespaceContext();
- }
-
- public int getNamespaceCount() {
- if (isDelegating()) {
- return realReader.getNamespaceCount();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespacePrefix(int i) {
- if (isDelegating()) {
- return realReader.getNamespacePrefix(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI() {
- if (isDelegating()) {
- return realReader.getNamespaceURI();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI(int i) {
- if (isDelegating()) {
- return realReader.getNamespaceURI(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI(String s) {
- if (isDelegating()) {
- return realReader.getNamespaceURI(s);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPIData() {
- if (isDelegating()) {
- return realReader.getPIData();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPITarget() {
- if (isDelegating()) {
- return realReader.getPITarget();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPrefix() {
- if (isDelegating()) {
- return realReader.getPrefix();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public Object getProperty(String s) throws IllegalArgumentException {
- if (isDelegating()) {
- return realReader.getProperty(s);
- } else {
- throw new IllegalArgumentException();
- }
- }
-
- public String getText() {
- if (isDelegating()) {
- return realReader.getText();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public char[] getTextCharacters() {
- if (isDelegating()) {
- return realReader.getTextCharacters();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- if (isDelegating()) {
- return realReader.getTextCharacters(i, chars, i1, i2);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextLength() {
- if (isDelegating()) {
- return realReader.getTextLength();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextStart() {
- if (isDelegating()) {
- return realReader.getTextStart();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getVersion() {
- if (isDelegating()) {
- return realReader.getVersion();
- } else {
- return null;
- }
- }
-
- public boolean hasName() {
- if (isDelegating()) {
- return realReader.hasName();
- } else {
- return false;
- }
- }
-
- public boolean hasNext() throws XMLStreamException {
- if (state == STATE_COMPLETE_AT_NEXT) {
- return true;
- } else if (state == STATE_COMPLETED) {
- return false;
- } else if (state == STATE_SWITCHED) {
- return realReader.hasNext();
- } else {
- return true;
- }
- }
-
- public boolean hasText() {
- if (isDelegating()) {
- return realReader.hasText();
- } else {
- return false;
- }
- }
-
- public boolean isAttributeSpecified(int i) {
- if (isDelegating()) {
- return realReader.isAttributeSpecified(i);
- } else {
- return false;
- }
- }
-
- public boolean isCharacters() {
- if (isDelegating()) {
- return realReader.isCharacters();
- } else {
- return false;
- }
- }
-
- private boolean isDelegating() {
- return state == STATE_SWITCHED || state == STATE_COMPLETE_AT_NEXT;
- }
-
- public boolean isEndElement() {
- if (isDelegating()) {
- return realReader.isEndElement();
- } else {
- return false;
- }
- }
-
- public boolean isStandalone() {
- if (isDelegating()) {
- return realReader.isStandalone();
- } else {
- return false;
- }
- }
-
- public boolean isStartElement() {
- if (isDelegating()) {
- return realReader.isStartElement();
- } else {
- return false;
- }
- }
-
- public boolean isWhiteSpace() {
- if (isDelegating()) {
- return realReader.isWhiteSpace();
- } else {
- return false;
- }
- }
-
- public int next() throws XMLStreamException {
- int returnEvent;
-
- switch (state) {
- case STATE_SWITCHED:
- returnEvent = realReader.next();
- if (returnEvent == END_DOCUMENT) {
- state = STATE_COMPLETED;
- } else if (!realReader.hasNext()) {
- state = STATE_COMPLETE_AT_NEXT;
- }
- if (fragment && returnEvent == END_ELEMENT) {
- level--;
- if (level == -1) {
- // We are now at the end of the top-level element in the fragment
- state = STATE_COMPLETE_AT_NEXT;
- }
- }
- if (fragment && returnEvent == START_ELEMENT) {
- level++;
- }
- break;
- case STATE_INIT:
- state = STATE_SWITCHED;
- returnEvent = realReader.getEventType();
- if (returnEvent == START_ELEMENT) {
- // The real reader is positioned at the top-level element in the fragment
- level = 0;
- fragment = true;
- }
- break;
- case STATE_COMPLETE_AT_NEXT:
- state = STATE_COMPLETED;
- returnEvent = END_DOCUMENT;
- break;
- case STATE_COMPLETED:
- // oops - no way we can go beyond this
- throw new NoSuchElementException("End of stream has reached.");
- default:
- throw new UnsupportedOperationException();
- }
-
- return returnEvent;
- }
-
- public int nextTag() throws XMLStreamException {
- if (isDelegating()) {
- int returnEvent = realReader.nextTag();
- if (fragment && returnEvent == END_ELEMENT) {
- level--;
- if (level == 0) {
- // We are now at the end of the top-level element in the fragment
- state = STATE_COMPLETE_AT_NEXT;
- }
- }
- if (fragment && returnEvent == START_ELEMENT) {
- level++;
- }
- return returnEvent;
- } else {
- throw new XMLStreamException();
- }
- }
-
- public void require(int i, String s, String s1) throws XMLStreamException {
- if (isDelegating()) {
- realReader.require(i, s, s1);
- }
- }
-
- public boolean standaloneSet() {
- if (isDelegating()) {
- return realReader.standaloneSet();
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLEventsStreamReader.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLEventsStreamReader.java
deleted file mode 100644
index 351929d8a1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLEventsStreamReader.java
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor.xml;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Stack;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.events.Attribute;
-import javax.xml.stream.events.Namespace;
-import javax.xml.stream.events.ProcessingInstruction;
-import javax.xml.stream.events.XMLEvent;
-
-
-public class XMLEventsStreamReader implements XMLStreamReader {
-
- @SuppressWarnings("unused")
- private ArrayList<XMLEvent> events = null;
- @SuppressWarnings("unchecked")
- private HashMap<String, NamespaceContext> eventContext = null;
-
- private int state;
- private java.util.Iterator<XMLEvent> iterator;
- private XMLEvent current;
-
- @SuppressWarnings("unchecked")
- public XMLEventsStreamReader(List<XMLEvent> events,Map<String, NamespaceContext> map) {
- this.events = (ArrayList<XMLEvent>) events;
- this.eventContext = (HashMap<String, NamespaceContext>) map;
- this.iterator = events.iterator();
- this.current = iterator.next();
- this.state = current.getEventType();
- }
-
- public void close() throws XMLStreamException {
- this.events = null;
- this.eventContext = null;
- this.iterator = null;
- this.current = null;
- }
-
- private void checkElementState() {
- if (getEventType() != START_ELEMENT && getEventType() != END_ELEMENT) {
- throw new IllegalStateException();
- }
- }
-
- @SuppressWarnings("unchecked")
- public int getAttributeCount() {
- checkElementState();
- int count = 0;
- Iterator<Attribute> iterator = current.asStartElement().getAttributes();
- while (iterator.hasNext()) {
- count++;
- iterator.next();
- }
- return count;
- }
-
- /*
- * Custom method to get attribute from the specified index
- */
- @SuppressWarnings("unchecked")
- private Attribute getAttribute(int index) {
- checkElementState();
- int count = 0;
- Attribute attribute = null;
- Iterator<Attribute> iterator = current.asStartElement().getAttributes();
- while (iterator.hasNext()) {
- count++;
- if (count == index) {
- attribute = iterator.next();
- } else {
- iterator.next();
- }
- }
- return attribute;
- }
-
-
- public String getAttributeLocalName(int index) {
- checkElementState();
- return getAttribute(index).getName().getLocalPart();
- }
-
- public QName getAttributeName(int index) {
- checkElementState();
- return getAttribute(index).getName();
- }
-
- public String getAttributeNamespace(int index) {
- checkElementState();
- return getAttributeName(index).getNamespaceURI();
- }
-
- public String getAttributePrefix(int index) {
- checkElementState();
- return getAttributeName(index).getPrefix();
- }
-
- public String getAttributeType(int index) {
- checkElementState();
- return getAttribute(index).getDTDType();
- }
-
- public String getAttributeValue(int index) {
- checkElementState();
- return getAttribute(index).getValue();
- }
-
- @SuppressWarnings("unchecked")
- public String getAttributeValue(String namespaceURI, String localName) {
- checkElementState();
- Iterator<Attribute> iterator = current.asStartElement().getAttributes();
- Attribute attribute;
- while (iterator.hasNext()) {
- attribute = iterator.next();
- if (attribute.getName().getNamespaceURI().equalsIgnoreCase(
- namespaceURI)
- && attribute.getName().getLocalPart().equalsIgnoreCase(
- localName)) {
- return attribute.getValue();
- }
- }
- return null;
-
- }
-
- public String getCharacterEncodingScheme() {
- return "UTF-8";
- }
-
- public String getElementText() throws XMLStreamException {
- checkElementState();
- int eventType = getEventType();
- String elementText = null;
-
- if (eventType == START_ELEMENT) {
- elementText = current.asStartElement().getName().getLocalPart();
- } else if (eventType == END_ELEMENT) {
- elementText = current.asEndElement().getName().getLocalPart();
- }
- return elementText;
- }
-
- public String getEncoding() {
- return "UTF-8";
- }
-
- public int getEventType() {
- return state;
- }
-
- public String getLocalName() {
- checkElementState();
- switch (current.getEventType()) {
- case START_ELEMENT:
- return current.asStartElement().getName().getLocalPart();
- case END_ELEMENT:
- return current.asEndElement().getName().getLocalPart();
- }
- return null;
- }
-
- public Location getLocation() {
- return current.getLocation();
- }
-
- public QName getName() {
- checkElementState();
- switch (current.getEventType()) {
- case START_ELEMENT:
- return current.asStartElement().getName();
- case END_ELEMENT:
- return current.asEndElement().getName();
- }
- return null;
- }
-
- public NamespaceContext getNamespaceContext() {
- checkElementState();
- //return new TuscanyNamespaceContext(eventContext.get(getLocalName()));
- return eventContext.get(getLocalName());
- }
-
- @SuppressWarnings("unchecked")
- public int getNamespaceCount() {
- int count = 0;
- Iterator<Namespace> itr = current.asStartElement().getNamespaces();
- while (itr.hasNext()) {
- count++;
- itr.next();
- }
- return count;
- }
-
- @SuppressWarnings("unchecked")
- public String getNamespacePrefix(int index) {
- Iterator<Namespace> itr = current.asStartElement().getNamespaces();
- int level = 0;
- Namespace ns = null;
- while (itr.hasNext()) {
- ns = itr.next();
- if (level == index) {
- return ns.getPrefix();
- }
- level++;
- }
- return null;
- }
-
- public String getNamespaceURI() {
- checkElementState();
- switch (current.getEventType()) {
- case START_ELEMENT:
- return current.asStartElement().getName().getNamespaceURI();
- case END_ELEMENT:
- return current.asEndElement().getName().getNamespaceURI();
- }
- return null;
- }
-
- public String getNamespaceURI(String prefix) {
- return getNamespaceContext().getNamespaceURI(prefix);
- }
-
- @SuppressWarnings("unchecked")
- public String getNamespaceURI(int index) {
- Iterator<Namespace> itr = current.asStartElement().getNamespaces();
- int level = 0;
- Namespace ns = null;
- while (itr.hasNext()) {
- ns = itr.next();
- if (level == index) {
- return ns.getNamespaceURI();
- }
- level++;
- }
- return null;
- }
-
- public String getPIData() {
- if (current.isProcessingInstruction()) {
- ProcessingInstruction pi = (ProcessingInstruction) current;
- return pi.getData();
- } else {
- throw new IllegalStateException(current.toString());
- }
- }
-
- public String getPITarget() {
- if (current.isProcessingInstruction()) {
- ProcessingInstruction pi = (ProcessingInstruction) current;
- return pi.getTarget();
- } else {
- throw new IllegalStateException(current.toString());
- }
- }
-
- public String getPrefix() {
- checkElementState();
- if (current.isStartElement()) {
- return current.asStartElement().getName().getPrefix();
- }
- return null;
- }
-
- /*
- * FIXME: Implementation pending...
- *
- * @see (non-Javadoc)
- * javax.xml.stream.util.StreamReaderDelegate#getProperty(java.lang.String)
- */
- public Object getProperty(String name) throws IllegalArgumentException {
- // TODO Auto-generated method stub
-
- return null;
- }
-
- public String getText() {
- if (current.isCharacters()) {
- return current.asCharacters().getData();
- } else {
- throw new IllegalStateException(current.toString());
- }
- }
-
- public char[] getTextCharacters() {
- if (current.isCharacters()) {
- return current.asCharacters().getData().toCharArray();
- } else {
- throw new IllegalStateException(current.toString());
- }
- }
-
- /*
- * FIXME: Implementation pending... (non-Javadoc)
- *
- * @see javax.xml.stream.util.StreamReaderDelegate#getTextCharacters(int,
- * char[], int, int)
- */
- public int getTextCharacters(int sourceStart, char[] target,
- int targetStart, int length) throws XMLStreamException {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * FIXME:Implementaion can be improved (non-Javadoc)
- *
- * @see javax.xml.stream.util.StreamReaderDelegate#getTextLength()
- */
- public int getTextLength() {
- if (current.isCharacters()) {
- return current.asCharacters().getData().length();
- } else {
- throw new IllegalStateException(current.toString());
- }
- }
-
- /*
- * FIXME: Implementation pending... (non-Javadoc)
- *
- * @see javax.xml.stream.util.StreamReaderDelegate#getTextStart()
- */
- public int getTextStart() {
- // TODO Auto-generated method stub
- return 0;
- }
-
- /*
- * FIXME: Implementation pending... (non-Javadoc)
- *
- * @see javax.xml.stream.util.StreamReaderDelegate#getTextStart()
- */
- public String getVersion() {
- // TODO Auto-generated method stub
-
- return null;
- }
-
- public boolean hasName() {
- return false;
- }
-
- public boolean hasNext() throws XMLStreamException {
- return iterator.hasNext() || state != END_DOCUMENT;
-
- }
-
- public boolean hasText() {
- // TODO Auto-generated method stub
- return false;
- }
-
- /*
- * FIXME: Implementation pending... (non-Javadoc)
- *
- * @see javax.xml.stream.util.StreamReaderDelegate#getTextStart()
- */
- public boolean isAttributeSpecified(int index) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isCharacters() {
- return current.isCharacters();
- }
-
- public boolean isEndElement() {
- return current.isEndElement();
- }
-
- public boolean isStandalone() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public boolean isStartElement() {
- return current.isStartElement();
- }
-
- public boolean isWhiteSpace() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public int next() throws XMLStreamException {
- if (!hasNext()) {
- throw new IllegalStateException("No more events");
- }
- if (!iterator.hasNext()) {
- state = END_DOCUMENT;
- current = null;
- return state;
- }
- current = iterator.next();
- state = current.getEventType();
- return state;
- }
-
- public int nextTag() throws XMLStreamException {
- return iterator.next().getEventType();
- }
-
- public void require(int type, String namespaceURI, String localName)
- throws XMLStreamException {
- boolean require = false;
- String uri = getNamespaceURI();
- String name = getLocalName();
- if (state == type && namespaceURI.equals(uri) && localName.equals(name)) {
- require = true;
- }
- if (require != true) {
- throw new XMLStreamException();
- }
- }
-
- public boolean standaloneSet() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLFragmentStreamReader.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLFragmentStreamReader.java
deleted file mode 100644
index 66361e1d76..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/processor/xml/XMLFragmentStreamReader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-public interface XMLFragmentStreamReader extends XMLStreamReader {
- QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
- String NIL_VALUE_TRUE = "true";
-
- /**
- * this will help to handle Text within the current element. user should
- * pass the element text to the property list as this ELEMENT_TEXT as the
- * key. This key deliberately has a space in it so that it is not a valid
- * XML name
- */
- String ELEMENT_TEXT = "Element Text";
-
- /**
- * Extra method to query the state of the pullparser
- */
- boolean isDone();
-
- /**
- * add the parent namespace context to this parser
- */
- void setParentNamespaceContext(NamespaceContext nsContext);
-
- /**
- * Initiate the parser - this will do whatever the needed tasks to initiate
- * the parser and must be called before attempting any specific parsing
- * using this parser
- */
- void init();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
deleted file mode 100644
index a4cf1b3566..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionGeneratedMetadataDocumentProcessor.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.xml;
-
-import javax.xml.stream.XMLInputFactory;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * URLArtifactProcessor that handles sca-contribution-generated.xml files.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionGeneratedMetadataDocumentProcessor extends ContributionMetadataDocumentProcessor {
-
- public ContributionGeneratedMetadataDocumentProcessor(XMLInputFactory inputFactory,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(inputFactory, staxProcessor, monitor);
- }
-
- public ContributionGeneratedMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- super(modelFactories, staxProcessor, monitor);
- }
-
- @Override
- public String getArtifactType() {
- return "sca-contribution-generated.xml";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.java
deleted file mode 100644
index e6aebc21f1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataDocumentProcessor.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.contribution.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * URLArtifactProcessor that handles sca-contribution.xml files.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionMetadataDocumentProcessor implements URLArtifactProcessor<ContributionMetadata>{
- private final StAXArtifactProcessor staxProcessor;
- private final XMLInputFactory inputFactory;
- private final Monitor monitor;
-
- public ContributionMetadataDocumentProcessor(XMLInputFactory inputFactory,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- this.inputFactory = inputFactory;
- this.staxProcessor = staxProcessor;
- this.monitor = monitor;
- }
-
- public ContributionMetadataDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor staxProcessor,
- Monitor monitor) {
- this.inputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
- this.staxProcessor = staxProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public String getArtifactType() {
- return "sca-contribution.xml";
- }
-
- public Class<ContributionMetadata> getModelType() {
- return ContributionMetadata.class;
- }
-
- public ContributionMetadata read(URL contributionURL, URI uri, URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
-
- // Create a stream reader
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- urlStream = connection.getInputStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
- reader.nextTag();
-
- // Read the contribution model
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- return contribution;
-
- } catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", inputFactory, ex);
- throw ex;
- } catch (IOException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("IOException", inputFactory, ex);
- throw ex;
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
- staxProcessor.resolve(contribution, resolver);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
deleted file mode 100644
index 8ab370f93f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessor.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.xml;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Processor for contribution metadata
- *
- * @version $Rev$ $Date$
- */
-public class ContributionMetadataProcessor extends BaseStAXArtifactProcessor implements
- StAXArtifactProcessor<ContributionMetadata> {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private static final QName CONTRIBUTION_QNAME = new QName(SCA10_NS, "contribution");
- private static final QName DEPLOYABLE_QNAME = new QName(SCA10_NS, "deployable");
-
- private final AssemblyFactory assemblyFactory;
- private final ContributionFactory contributionFactory;
- private final ExtensionFactory extensionFactory;
- private final StAXArtifactProcessor<Object> extensionProcessor;
- private final StAXAttributeProcessor<Object> attributeProcessor;
- private Monitor monitor;
-
- public ContributionMetadataProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- StAXAttributeProcessor<Object> attributeProcessor,
- Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.extensionProcessor = extensionProcessor;
- this.attributeProcessor = attributeProcessor;
- this.monitor = monitor;
- }
-
- /*
- public ContributionMetadataProcessor(AssemblyFactory assemblyFactory,
- ContributionFactory contributionFactory,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.assemblyFactory = assemblyFactory;
- this.contributionFactory = contributionFactory;
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
- */
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem =
- new ProblemImpl(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR,
- model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem =
- new ProblemImpl(this.getClass().getName(), "contribution-xml-validation-messages", Severity.ERROR,
- model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return CONTRIBUTION_QNAME;
- }
-
- public Class<ContributionMetadata> getModelType() {
- return ContributionMetadata.class;
- }
-
- public ContributionMetadata read(XMLStreamReader reader) throws ContributionReadException {
- ContributionMetadata contribution = null;
- QName name = null;
-
- try {
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
-
- if (CONTRIBUTION_QNAME.equals(name)) {
-
- // Read <contribution>
- contribution = this.contributionFactory.createContributionMetadata();
- contribution.setUnresolved(true);
- readExtendedAttributes(reader, contribution, attributeProcessor, extensionFactory);
-
- } else if (DEPLOYABLE_QNAME.equals(name)) {
-
- // Read <deployable>
- QName compositeName = getQName(reader, "composite");
- if (compositeName == null) {
- error("AttributeCompositeMissing", reader);
- //throw new ContributionReadException("Attribute 'composite' is missing");
- } else {
- if (contribution != null) {
- Composite composite = assemblyFactory.createComposite();
- composite.setName(compositeName);
- composite.setUnresolved(true);
- contribution.getDeployables().add(composite);
- }
- }
- } else {
-
- // Read an extension element
- Object extension = extensionProcessor.read(reader);
- if (extension != null && contribution != null) {
- if (extension instanceof Import) {
- contribution.getImports().add((Import)extension);
- } else if (extension instanceof Export) {
- contribution.getExports().add((Export)extension);
- } else {
- contribution.getExtensions().add(extension);
- }
- }
- }
- break;
-
- case XMLStreamConstants.END_ELEMENT:
- if (CONTRIBUTION_QNAME.equals(reader.getName())) {
- return contribution;
- }
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- } catch (XMLStreamException e) {
- ContributionReadException ex = new ContributionReadException(e);
- error("XMLStreamException", reader, ex);
- }
-
- return contribution;
- }
-
- public void write(ContributionMetadata contribution, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
-
- // Write <contribution>
- writeStartDocument(writer, CONTRIBUTION_QNAME.getNamespaceURI(), CONTRIBUTION_QNAME.getLocalPart());
- writeExtendedAttributes(writer, contribution, attributeProcessor);
-
- // Write <import>
- for (Import imp : contribution.getImports()) {
- extensionProcessor.write(imp, writer);
- }
-
- // Write <export>
- for (Export export : contribution.getExports()) {
- extensionProcessor.write(export, writer);
- }
-
- // Write <deployable>
- for (Composite deployable : contribution.getDeployables()) {
- writeStart(writer,
- DEPLOYABLE_QNAME.getNamespaceURI(),
- DEPLOYABLE_QNAME.getLocalPart(),
- new XAttr("composite", deployable.getName()));
- writeEnd(writer);
- }
-
- writeEndDocument(writer);
- }
-
- public void resolve(ContributionMetadata contribution, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve imports and exports
- for (Export export : contribution.getExports()) {
- extensionProcessor.resolve(export, resolver);
- }
- for (Import import_ : contribution.getImports()) {
- extensionProcessor.resolve(import_, resolver);
- }
-
- // Resolve deployable composites
- List<Composite> deployables = contribution.getDeployables();
- for (int i = 0, n = deployables.size(); i < n; i++) {
- Composite deployable = deployables.get(i);
- Composite resolved = (Composite)resolver.resolveModel(Composite.class, deployable);
- if (resolved != deployable) {
- deployables.set(i, resolved);
- }
- }
-
- for (Object ext : contribution.getExtensions()) {
- extensionProcessor.resolve(ext, resolver);
- }
-
- contribution.setUnresolved(false);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.java
deleted file mode 100644
index f226dbbee3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/java/org/apache/tuscany/sca/contribution/xml/ContributionModelResolver.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.contribution.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * A Model Resolver for Contribution models.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionModelResolver implements ModelResolver {
-
- private Map<String, Contribution> map = new HashMap<String, Contribution>();
-
- public ContributionModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- }
-
- public void addModel(Object resolved) {
- Contribution contribution = (Contribution)resolved;
- map.put(contribution.getURI(), contribution);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((Contribution)resolved).getURI());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a contribution for the given URI
- String uri = ((Contribution)unresolved).getURI();
- if (uri != null) {
- Contribution resolved = (Contribution) map.get(uri);
- if (resolved != null) {
- return modelClass.cast(resolved);
- }
- return unresolved;
- } else {
-
- // If no URI was specified, just return the first contribution
- if (!map.isEmpty()) {
- Contribution resolved = map.values().iterator().next();
- return modelClass.cast(resolved);
- } else {
- return unresolved;
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index b69ea1e135..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.xml.ContributionMetadataProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#contribution,model=org.apache.tuscany.sca.contribution.ContributionMetadata
-org.apache.tuscany.sca.contribution.processor.xml.AnyElementProcessor;qname=http://www.w3.org/2001/XMLSchema#anyElement,model=java.lang.Object
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor
deleted file mode 100644
index b4a13295bc..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the attribute processor extension
-org.apache.tuscany.sca.contribution.processor.xml.AnyAttributeProcessor;qname=http://www.w3.org/2001/XMLSchema#anyAttribute,model=org.apache.tuscany.sca.assembly.Extension
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 23adab56b9..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.contribution.xml.ContributionMetadataDocumentProcessor;type=sca-contribution.xml,model=org.apache.tuscany.sca.contribution.ContributionMetadata
-org.apache.tuscany.sca.contribution.xml.ContributionGeneratedMetadataDocumentProcessor;type=sca-contribution-generated.xml
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 68030bf6e6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.contribution.xml.ContributionModelResolver;model=org.apache.tuscany.sca.contribution.Contribution
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
deleted file mode 100644
index 4827fd5e94..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/main/resources/contribution-xml-validation-messages.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-XMLStreamException = XMLStreamException occured due to : {0}
-IOException = IOException occured due to : {0}
-AttributeCompositeMissing = Attribute 'composite' is missing
-
diff --git a/branches/sca-java-1.5.1/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java b/branches/sca-java-1.5.1/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
deleted file mode 100644
index cef1f705af..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution-xml/src/test/java/org/apache/tuscany/sca/contribution/xml/ContributionMetadataProcessorTestCase.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.xml;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * Test the contribution metadata processor.
- *
- * @version $Rev$ $Date$
- */
-
-public class ContributionMetadataProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\" ns:bar=\"extended\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable composite=\"ns:Composite2\"/>"
- + "<ns:bar x=\"1\"/>"
- + "</contribution>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable/>"
- + "</contribution>";
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
-
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testRead() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
- assertNotNull(contribution);
- assertEquals(2, contribution.getDeployables().size());
- assertEquals(1, contribution.getAttributeExtensions().size());
- assertEquals(1, contribution.getExtensions().size());
- }
-
- public void testReadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- /*try {
- staxProcessor.read(reader);
- fail("InvalidException should have been thrown");
- } catch (ContributionReadException e) {
- assertTrue(true);
- }*/
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeCompositeMissing", problem.getMessageId());
- }
-
- public void testWrite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- ContributionMetadata contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- validateContribution(contribution);
-
- //write the contribution metadata contents
- StringWriter stringWriter = new StringWriter();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(stringWriter);
- staxProcessor.write(contribution, writer);
- stringWriter.close();
-
- reader = inputFactory.createXMLStreamReader(new StringReader(stringWriter.toString()));
- contribution = (ContributionMetadata)staxProcessor.read(reader);
-
- validateContribution(contribution);
- }
-
- private void validateContribution(ContributionMetadata contribution) {
- QName deployable;
-
- assertNotNull(contribution);
- assertEquals(2, contribution.getDeployables().size());
- deployable = new QName("http://ns", "Composite1");
- assertEquals(deployable, contribution.getDeployables().get(0).getName());
- deployable = new QName("http://ns", "Composite2");
- assertEquals(deployable, contribution.getDeployables().get(1).getName());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/LICENSE b/branches/sca-java-1.5.1/modules/contribution/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/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-java-1.5.1/modules/contribution/NOTICE b/branches/sca-java-1.5.1/modules/contribution/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/contribution/pom.xml b/branches/sca-java-1.5.1/modules/contribution/pom.xml
deleted file mode 100644
index 1ae41ca1d1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/pom.xml
+++ /dev/null
@@ -1,69 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-contribution</artifactId>
- <name>Apache Tuscany SCA Contribution Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0-2</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.contribution</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.contribution*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.java
deleted file mode 100644
index 84a6a9a8f9..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Artifact.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.contribution;
-
-import org.apache.tuscany.sca.assembly.Base;
-
-
-/**
- * Represents an artifact in an SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface Artifact extends Base {
-
- /**
- * Returns the URI that unique identifies the artifact inside the contribution.
- *
- * @return The artifact URI
- */
- String getURI();
-
- /**
- * Sets the URI that uniquely identifies the artifact inside the contribution.
- *
- * @param uri The artifact URI
- */
- void setURI(String uri);
-
- /**
- * Returns the location of the artifact.
- *
- * @return The artifact location
- */
- String getLocation();
-
- /**
- * Set the location of the artifact.
- *
- * @param location The artifact location
- */
- void setLocation(String location);
-
-
- /**
- * Returns the in-memory model representing the artifact.
- *
- * @return The model object
- */
- Object getModel();
-
- /**
- * Sets the in-memory model representing the artifact.
- *
- * @param model The model object
- */
- void setModel(Object model);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java
deleted file mode 100644
index 14131a9806..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Constants.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-/**
- * Constants used in SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface Constants {
- String XMLSCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
-
- String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.java
deleted file mode 100644
index 81b0b08b9d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContentType.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.contribution;
-
-/**
- * Constants for the main supported contribution package type.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public interface ContentType {
-
- /**
- * Java compressed contribution package
- */
- String JAR = "application/x-compressed";
-
- /**
- * Filesystem folder contribution package
- */
- String FOLDER = "application/vnd.tuscany.folder";
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.java
deleted file mode 100644
index 0076e1c89f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Contribution.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.contribution;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface Contribution extends Artifact, Extensible {
-
- /**
- * Default location of contribution metadata in an SCA contribution.
- */
- String SCA_CONTRIBUTION_META = "META-INF/sca-contribution.xml";
-
- /**
- * Default location of a generated contribution metadata in an SCA contribution.
- */
- String SCA_CONTRIBUTION_GENERATED_META = "META-INF/sca-contribution-generated.xml";
-
- /**
- * Default location of deployable composites in an SCA contribution.
- */
- String SCA_CONTRIBUTION_DEPLOYABLES = "META-INF/sca-deployables/";
-
-
- /**
- * Returns a list of exports based on the contribution metadata.
- *
- * @return The list of exports in this contribution
- */
- List<Export> getExports();
-
- /**
- * Returns a list of imports based on the contribution metadata.
- *
- * @return The list of imports in this contribution
- */
- List<Import> getImports();
-
- /**
- * Returns the list of deployable composites in the contribution.
- *
- * @return The list of deployable composites
- */
- List<Composite> getDeployables();
-
- /**
- * Returns the list of artifacts in the contribution.
- *
- * @return The list of artifacts in the contribution
- */
- List<Artifact> getArtifacts();
-
- /**
- * Returns the model resolver for the models representing the artifacts
- * visible in the scope of this contribution.
- *
- * @return The model resolver
- */
- ModelResolver getModelResolver();
-
- /**
- * Sets the model resolver for the models representing the artifacts
- * visible in the scope of this contribution.
- *
- * @param modelResolver The model resolver
- */
- void setModelResolver(ModelResolver modelResolver);
-
- /**
- * Returns the ClassLoader used to load classes and resources from
- * this contribution
- *
- * FIXME Remove this, the base contribution model should not depend
- * on Java ClassLoaders.
- *
- * @return The contribution ClassLoader
- */
- ClassLoader getClassLoader();
-
- /**
- * Sets the ClassLoader used to load classes and resources from
- * this contribution
- *
- * FIXME Remove this, the base contribution model should not depend
- * on Java ClassLoaders.
- *
- * @param classLoader the contribution class loader
- */
- void setClassLoader(ClassLoader classLoader);
-
- /**
- * Returns the type string based on the types that appear in
- * o.a.t.s.contribution.PackageType
- *
- * @return the contribution type string
- */
- String getType();
-
- /**
- * Sets the type string based on the types that appear in
- * o.a.t.s.contribution.PackageType
- *
- * @param contributionType the contribution type string
- */
- void setType(String contributionType);
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
deleted file mode 100644
index 67c9a05a0b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionFactory.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-
-/**
- * A factory for the contribution model.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionFactory {
-
- /**
- * Create a contribution model object
- *
- * @return The new contribution model object
- */
- Contribution createContribution();
-
- /**
- * Create a contribution metadata model object
- *
- * @return The new contribution metadata model object
- */
- ContributionMetadata createContributionMetadata();
-
- /**
- * Create a deployedArtifact model object
- *
- * @return The new deployedArtifact model object
- */
- @Deprecated
- DeployedArtifact createDeployedArtifact();
-
- /**
- * Create an artifact model object
- *
- * @return The new artifact model object
- */
- Artifact createArtifact();
-
- /**
- * Create a default import model object.
- *
- * @return the new default import model object
- */
- DefaultImport createDefaultImport();
-
- /**
- * Create a default export model object.
- *
- * @return the new default export model object
- */
- DefaultExport createDefaultExport();
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.java
deleted file mode 100644
index 5f26c3d907..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ContributionMetadata.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.contribution;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Extensible;
-
-/**
- * The representation of SCA contribution metadata.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionMetadata extends Base, Extensible {
-
- /**
- * Returns a list of exports based on the contribution metadata.
- *
- * @return The list of exports
- */
- List<Export> getExports();
-
- /**
- * Returns a list of imports based on the contribution metadata.
- *
- * @return The list of imports
- */
- List<Import> getImports();
-
- /**
- * Returns the list of deployable based on the contribution metadata.
- *
- * @return The list of deployable composites
- */
- List<Composite> getDeployables();
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java
deleted file mode 100644
index e13e8bcbd6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultContributionFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
-
-
-/**
- * Default implementation of a contribution model factory.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultContributionFactory extends ContributionFactoryImpl implements ContributionFactory {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.java
deleted file mode 100644
index b2eddb8336..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultExport.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.contribution;
-
-
-/**
- * The representation of an export that exports all artifacts in
- * a contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface DefaultExport extends Export {
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.java
deleted file mode 100644
index 20798dcd17..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultImport.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.contribution;
-
-
-/**
- * The representation of a default import that imports artifacts from
- * all contributions.
- *
- * @version $Rev$ $Date$
- */
-public interface DefaultImport extends Import {
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
deleted file mode 100644
index b69c58a0ff..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DefaultModelFactoryExtensionPoint.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-
-/**
- * Default implementation of a model factory extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultModelFactoryExtensionPoint implements ModelFactoryExtensionPoint {
-
- private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
-
- /**
- * Constructs a new DefaultModelFactoryExtensionPoint.
- */
- public DefaultModelFactoryExtensionPoint() {
- }
-
- /**
- * Add a model factory extension.
- *
- * @param factory The factory to add
- */
- public void addFactory(Object factory) {
- Class<?>[] interfaces = factory.getClass().getInterfaces();
- if (interfaces.length == 0) {
- Class<?> sc = factory.getClass().getSuperclass();
- if (sc != Object.class) {
- factories.put(sc, factory);
- }
- } else {
- for (int i = 0; i<interfaces.length; i++) {
- factories.put(interfaces[i], factory);
- }
- }
- }
-
- /**
- * Remove a model factory.
- *
- * @param factory The factory to remove
- */
- public void removeFactory(Object factory) {
- Class<?>[] interfaces = factory.getClass().getInterfaces();
- if (interfaces.length == 0) {
- Class<?> sc = factory.getClass().getSuperclass();
- if (sc != Object.class) {
- factories.remove(sc);
- }
- } else {
- for (int i = 0; i<interfaces.length; i++) {
- factories.remove(interfaces[i]);
- }
- }
- }
-
- /**
- * Get a factory implementing the given interface.
- * @param factoryInterface The lookup key (factory interface)
- * @return The factory
- */
- public <T> T getFactory(Class<T> factoryInterface) {
- Object factory = factories.get(factoryInterface);
- if (factory == null) {
-
- if (factoryInterface.isInterface()) {
-
- // Dynamically load a factory class declared under META-INF/services
- try {
- Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
- if (factoryClass != null) {
-
- try {
- // Default empty constructor
- Constructor<?> constructor = factoryClass.getConstructor();
- factory = constructor.newInstance();
- } catch (NoSuchMethodException e) {
-
- // Constructor taking the model factory extension point
- Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class);
- factory = constructor.newInstance(this);
- }
-
- // Cache the loaded factory
- addFactory(factory);
- }
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- } else {
-
- // Call the newInstance static method on the factory abstract class
- try {
- factory = ServiceDiscovery.getInstance().newFactoryClassInstance(factoryInterface);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
-
- // Cache the factory
- addFactory(factory);
- }
- }
- return factoryInterface.cast(factory);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.java
deleted file mode 100644
index ffe190132c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/DeployedArtifact.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.contribution;
-
-/**
- * Representation of a deployed artifact
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public interface DeployedArtifact extends Artifact {
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java
deleted file mode 100644
index a6e5afe7b8..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Export.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an export.
- *
- * @version $Rev$ $Date$
- */
-public interface Export extends Extensible {
-
- /**
- * Returns the model resolver for the models representing artifacts
- * made available by this export.
- *
- * @return The model resolver
- */
- ModelResolver getModelResolver();
-
- /**
- * Sets the model resolver for the models representing artifacts
- * made available by this export.
- *
- * @param modelResolver
- */
- void setModelResolver(ModelResolver modelResolver);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java
deleted file mode 100644
index 256a2387f1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/Import.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * The representation of an import.
- *
- * @version $Rev$ $Date$
- */
-public interface Import extends Extensible {
-
- /**
- * Returns the model resolver for the models representing artifacts
- * made available by this import.
- *
- * @return The model resolver
- */
- ModelResolver getModelResolver();
-
- /**
- * Sets the model resolver for the models representing artifacts
- * made available by this import.
- *
- * @param modelResolver The model resolver
- */
- void setModelResolver(ModelResolver modelResolver);
-
- /**
- * Verify that a specific export actually exports what is being imported.
- *
- * @param export The Exported being verified
- * @return true/false
- */
- boolean match(Export export);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java
deleted file mode 100644
index 0ada4ebec3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/ModelFactoryExtensionPoint.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-/**
- * An extension point for model factories. Model factories are provided to
- * abstract the classes that represent artifacts in the assembly model away
- * from their creation mechanism. When the runtime needs to extend the model
- * as it reads in contributed artifacts it looks up the factory for the
- * artifact required in this registry
- *
- * @version $Rev$ $Date$
- */
-public interface ModelFactoryExtensionPoint {
-
- /**
- * Add a model factory extension.
- *
- * @param factory The factory to add
- */
- void addFactory(Object factory);
-
- /**
- * Remove a model factory extension.
- *
- * @param factory The factory to remove
- */
- void removeFactory(Object factory);
-
- /**
- * Get a factory implementing the given interface.
- * @param factoryInterface the lookup key (factory interface)
- * @return The factory
- */
- <T> T getFactory(Class<T> factoryInterface);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java
deleted file mode 100644
index 26833bb4c0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/PackageType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution;
-
-/**
- * Constants for the main supported contribution package types.
- *
- * @version $Rev$ $Date$
- */
-public interface PackageType {
-
- /**
- * Java compressed contribution package
- */
- String JAR = "application/x-compressed";
-
- /**
- * Zip archive contribution package
- */
- String ZIP = "application/x-compressed";
-
- /**
- * Filesystem folder contribution package
- */
- String FOLDER = "application/vnd.tuscany.folder";
-
-
- String BUNDLE = "application/osgi.bundle";
-
- /**
- * Java EE Web Application Archive
- */
- String WAR = "application/war";
-
- /**
- * Java EE Enterprise Application Archive
- */
- String EAR = "application/ear";
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.java
deleted file mode 100644
index 3ce27d47c3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ArtifactImpl.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.contribution.impl;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-
-
-/**
- * The model representing an artifact in a contribution.
- *
- * @version $Rev$ $Date$
- */
-class ArtifactImpl implements Artifact {
- private String uri;
- private String location;
- private Object model;
- private boolean unresolved;
-
- ArtifactImpl() {
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public Object getModel() {
- return model;
- }
-
- public void setModel(Object model) {
- this.model = model;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- @Override
- public int hashCode() {
- return uri.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof Artifact) {
- return uri.equals(((Artifact)obj).getURI());
- } else {
- return false;
- }
- }
- }
-
- @Override
- public String toString() {
- return "Artifact:" + uri + "\n" +
- "at: " + location;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.java
deleted file mode 100644
index c678c2eaef..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionFactoryImpl.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.contribution.impl;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
-
-
-/**
- * Default implementation of a contribution model factory.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionFactoryImpl implements ContributionFactory {
-
- protected ContributionFactoryImpl() {
- }
-
- public Contribution createContribution() {
- return new ContributionImpl();
- }
-
- public ContributionMetadata createContributionMetadata() {
- return new ContributionMetadataImpl();
- }
-
- public Artifact createArtifact() {
- return new ArtifactImpl();
- }
-
- public DefaultExport createDefaultExport() {
- return new DefaultExportImpl();
- }
-
- public DefaultImport createDefaultImport() {
- return new DefaultImportImpl();
- }
-
- @Deprecated
- public DeployedArtifact createDeployedArtifact() {
- class DeployedArtifactImpl extends ArtifactImpl implements DeployedArtifact {
- }
- return new DeployedArtifactImpl();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
deleted file mode 100644
index 3bad5c3612..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionImpl.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of a deployed contribution
- *
- * @version $Rev$ $Date$
- */
-class ContributionImpl extends ExtensibleImpl implements Contribution {
- private String type;
- private String uri;
- private String location;
- private Object model;
- private byte[] contents;
- private boolean unresolved;
- private List<Export> exports = new ArrayList<Export>();
- private List<Import> imports = new ArrayList<Import>();
- private List<Composite> deployables = new ArrayList<Composite>();
- private List<Artifact> artifacts = new ArrayList<Artifact>();
- private ModelResolver modelResolver;
-
- // FIXME remove this dependency on Java ClassLoaders
- private ClassLoader classLoader;
-
- ContributionImpl() {
- }
-
- public String getLocation() {
- return this.location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- //FIXME Remove dependency on Java ClassLoaders
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- //FIXME Remove dependency on Java ClassLoaders
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
-
- public String getURI() {
- return this.uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public Object getModel() {
- return model;
- }
-
- public void setModel(Object model) {
- this.model = model;
- }
-
- public byte[] getContents() {
- return contents;
- }
-
- public void setContents(byte[] contents) {
- this.contents = contents;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
- public List<Export> getExports() {
- return exports;
- }
-
- public List<Import> getImports() {
- return imports;
- }
-
- public List<Composite> getDeployables() {
- return deployables;
- }
-
- public List<Artifact> getArtifacts() {
- return artifacts;
- }
-
- @Override
- public int hashCode() {
- return uri.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof Artifact) {
- return uri.equals(((Artifact)obj).getURI());
- } else {
- return false;
- }
- }
- }
-
- @Override
- public String toString() {
- return "Contribution : " + uri + " \n" +
- "from: " + location;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String contributionType) {
- this.type = contributionType;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
deleted file mode 100644
index da8c879a93..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/ContributionMetadataImpl.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-
-/**
- * The representation of a deployed contribution
- *
- * @version $Rev$ $Date$
- */
-class ContributionMetadataImpl extends ExtensibleImpl implements ContributionMetadata {
- private boolean unresolved;
- private List<Export> exports = new ArrayList<Export>();
- private List<Import> imports = new ArrayList<Import>();
- private List<Composite> deployables = new ArrayList<Composite>();
-
- ContributionMetadataImpl() {
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public List<Export> getExports() {
- return exports;
- }
-
- public List<Import> getImports() {
- return imports;
- }
-
- public List<Composite> getDeployables() {
- return deployables;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.java
deleted file mode 100644
index d4614e5427..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultExportImpl.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.contribution.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an export for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class DefaultExportImpl extends ExtensibleImpl implements DefaultExport {
- private ModelResolver modelResolver;
-
- protected DefaultExportImpl() {
- super();
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.java
deleted file mode 100644
index 7ab535f916..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/impl/DefaultImportImpl.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.contribution.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The representation of an import for the contribution
- *
- * @version $Rev$ $Date$
- */
-public class DefaultImportImpl extends ExtensibleImpl implements DefaultImport {
- private ModelResolver modelResolver;
-
- protected DefaultImportImpl() {
- super();
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
-
- public boolean match(Export export) {
- if (export instanceof DefaultExport) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
deleted file mode 100644
index b5f536c431..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-
-/**
- * Base interface for artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public interface ArtifactProcessor<M> {
-
- /**
- * Resolve references from this model to other models. For example references
- * from a composite to another one, or references from a composite to a WSDL
- * model.
- *
- * @param model The model to resolve
- * @param resolver The resolver to use to resolve referenced models
- */
- void resolve(M model, ModelResolver resolver) throws ContributionResolveException;
-
- /**
- * Returns the type of model handled by this artifact processor.
- *
- * @return The type of model handled by this artifact processor
- */
- Class<M> getModelType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java
deleted file mode 100644
index 029df61f0f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ArtifactProcessorExtensionPoint.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-/**
- * An extension point for artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public interface ArtifactProcessorExtensionPoint<P extends ArtifactProcessor> {
-
- /**
- * Add an artifact processor.
- *
- * @param artifactProcessor The artifact processor to add
- */
- void addArtifactProcessor(P artifactProcessor);
-
- /**
- * Remove an artifact processor.
- *
- * @param artifactProcessor The artifact processor to remove
- */
- void removeArtifactProcessor(P artifactProcessor);
-
- /**
- * Returns the processor associated with the given artifact type.
- *
- * @param artifactType An artifact type
- * @return The processor associated with the given artifact type
- */
- P getProcessor(Object artifactType);
-
- /**
- * Returns the processor associated with the given model type.
- *
- * @param modelType A model type
- * @return The processor associated with the given model type
- */
- P getProcessor(Class<?> modelType);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
deleted file mode 100644
index a451316883..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/BaseStAXArtifactProcessor.java
+++ /dev/null
@@ -1,618 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-
-/**
- * A base class with utility methods for the other artifact processors in this module.
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseStAXArtifactProcessor {
-
- /**
- * Returns a QName from a string.
- * @param reader
- * @param value
- * @return
- */
- protected QName getQNameValue(XMLStreamReader reader, String value) {
- if (value != null) {
- int index = value.indexOf(':');
- String prefix = index == -1 ? "" : value.substring(0, index);
- String localName = index == -1 ? value : value.substring(index + 1);
- String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
- if (ns == null) {
- ns = "";
- }
- return new QName(ns, localName, prefix);
- } else {
- return null;
- }
- }
-
- /**
- * Returns the boolean value of an attribute.
- * @param reader
- * @param name
- * @return
- */
- protected boolean getBoolean(XMLStreamReader reader, String name) {
- String value = reader.getAttributeValue(null, name);
- if (value == null) {
- return false;
- }
- return Boolean.valueOf(value);
- }
-
- /**
- * Returns the QName value of an attribute.
- * @param reader
- * @param name
- * @return
- */
- protected QName getQName(XMLStreamReader reader, String name) {
- String qname = reader.getAttributeValue(null, name);
- return getQNameValue(reader, qname);
- }
-
- /**
- * Returns the value of an attribute as a list of QNames.
- * @param reader
- * @param name
- * @return
- */
- protected List<QName> getQNames(XMLStreamReader reader, String name) {
- String value = reader.getAttributeValue(null, name);
- if (value != null) {
- List<QName> qnames = new ArrayList<QName>();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- qnames.add(getQName(reader, tokens.nextToken()));
- }
- return qnames;
- } else {
- return Collections.emptyList();
- }
- }
-
- /**
- * Returns the string value of an attribute.
- * @param reader
- * @param name
- * @return
- */
- protected String getString(XMLStreamReader reader, String name) {
- return reader.getAttributeValue(null, name);
- }
-
- /**
- * Test if an attribute is explicitly set
- * @param reader
- * @param name
- * @return
- */
- protected boolean isSet(XMLStreamReader reader, String name) {
- return reader.getAttributeValue(null, name) != null;
- }
-
- /**
- * Returns the value of xsi:type attribute
- * @param reader The XML stream reader
- * @return The QName of the type, if the attribute is not present, null is
- * returned.
- */
- protected QName getXSIType(XMLStreamReader reader) {
- String qname = reader.getAttributeValue(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
- return getQNameValue(reader, qname);
- }
-
- /**
- * Parse the next child element.
- * @param reader
- * @return
- * @throws XMLStreamException
- */
- protected boolean nextChildElement(XMLStreamReader reader) throws XMLStreamException {
- while (reader.hasNext()) {
- int event = reader.next();
- if (event == END_ELEMENT) {
- return false;
- }
- if (event == START_ELEMENT) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Advance the stream to the next END_ELEMENT event skipping any nested
- * content.
- * @param reader the reader to advance
- * @throws XMLStreamException if there was a problem reading the stream
- */
- protected void skipToEndElement(XMLStreamReader reader) throws XMLStreamException {
- int depth = 0;
- while (reader.hasNext()) {
- int event = reader.next();
- if (event == XMLStreamConstants.START_ELEMENT) {
- depth++;
- } else if (event == XMLStreamConstants.END_ELEMENT) {
- if (depth == 0) {
- return;
- }
- depth--;
- }
- }
- }
-
- /**
- *
- * @param writer
- * @param uri
- * @throws XMLStreamException
- */
- private String writeElementPrefix(XMLStreamWriter writer, String uri) throws XMLStreamException {
- if (uri == null) {
- return null;
- }
- String prefix = writer.getPrefix(uri);
- if (prefix != null) {
- return null;
- } else {
-
- // Find an available prefix and bind it to the given URI
- NamespaceContext nsc = writer.getNamespaceContext();
- for (int i=1; ; i++) {
- prefix = "ns" + i;
- if (nsc.getNamespaceURI(prefix) == null) {
- break;
- }
- }
- // writer.setPrefix(prefix, uri);
- return prefix;
- }
-
- }
-
- /**
- * Start an element.
- * @param uri
- * @param name
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeStart(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
- String prefix = writeElementPrefix(writer, uri);
- writer.writeStartElement(uri, name);
- if (prefix != null){
- writer.writeNamespace(prefix,uri);
- }
- writeAttributePrefixes(writer, attrs);
- writeAttributes(writer, attrs);
- }
-
- /**
- * Start an element.
- * @param qname
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeStart(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
- writeStart(writer, qname.getNamespaceURI(), qname.getLocalPart(), attrs);
- }
-
- /**
- * End an element.
- * @param writer
- * @throws XMLStreamException
- */
- protected void writeEnd(XMLStreamWriter writer) throws XMLStreamException {
- writer.writeEndElement();
- }
-
- /**
- * Start a document.
- * @param writer
- * @throws XMLStreamException
- */
- protected void writeStartDocument(XMLStreamWriter writer, String uri, String name, XAttr... attrs) throws XMLStreamException {
- writer.writeStartDocument();
- writer.setDefaultNamespace(uri);
- writeStart(writer, uri, name, attrs);
- writer.writeDefaultNamespace(uri);
- }
-
- /**
- * Start a document.
- * @param writer
- * @param qname
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeStartDocument(XMLStreamWriter writer, QName qname, XAttr... attrs) throws XMLStreamException {
- writeStartDocument(writer, qname.getNamespaceURI(), qname.getLocalPart(), attrs);
- }
-
- /**
- * End a document.
- * @param writer
- * @throws XMLStreamException
- */
- protected void writeEndDocument(XMLStreamWriter writer) throws XMLStreamException {
- writer.writeEndDocument();
- }
-
- /**
- * Write attributes to the current element.
- * @param writer
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeAttributes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
- for (XAttr attr : attrs) {
- if (attr != null)
- attr.write(writer);
- }
- }
-
- /**
- * Write attribute prefixes to the current element.
- * @param writer
- * @param attrs
- * @throws XMLStreamException
- */
- protected void writeAttributePrefixes(XMLStreamWriter writer, XAttr... attrs) throws XMLStreamException {
- for (XAttr attr : attrs) {
- if (attr != null)
- attr.writePrefix(writer);
- }
- }
-
- /**
- *
- * @param reader
- * @param elementName
- * @param extensible
- * @param extensionAttributeProcessor
- * @param extensionAttributeProcessor
- * @param extensionFactory
- * @throws ContributionReadException
- * @throws XMLStreamException
- */
- protected void readExtendedAttributes(XMLStreamReader reader,
- Extensible extensible,
- StAXAttributeProcessor extensionAttributeProcessor,
- ExtensionFactory extensionFactory) throws ContributionReadException,
- XMLStreamException {
- QName elementName = reader.getName();
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if (attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if (!elementName.getNamespaceURI().equals(attributeName.getNamespaceURI())) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension)attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- extensible.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
- }
-
- /**
- *
- * @param attributeModel
- * @param writer
- * @param extensibleElement
- * @param extensionAttributeProcessor
- * @throws ContributionWriteException
- * @throws XMLStreamException
- */
- protected void writeExtendedAttributes(XMLStreamWriter writer,
- Extensible extensibleElement,
- StAXAttributeProcessor extensionAttributeProcessor)
- throws ContributionWriteException, XMLStreamException {
- for (Extension extension : extensibleElement.getAttributeExtensions()) {
- if (extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
- }
-
- protected void readExtendedElement(XMLStreamReader reader,
- Extensible extensible,
- StAXArtifactProcessor extensionProcessor) throws ContributionReadException,
- XMLStreamException {
- Object ext = extensionProcessor.read(reader);
- if (extensible != null) {
- extensible.getExtensions().add(ext);
- }
- }
-
- protected void writeExtendedElements(XMLStreamWriter writer,
- Extensible extensible,
- StAXArtifactProcessor extensionProcessor) throws ContributionWriteException,
- XMLStreamException {
- for (Object ext : extensible.getExtensions()) {
- extensionProcessor.write(ext, writer);
- }
- }
-
- /**
- * Represents an XML attribute that needs to be written to a document.
- */
- public static class XAttr {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- private String uri = SCA10_NS;
- private String name;
- private Object value;
-
- public XAttr(String uri, String name, String value) {
- this.uri = uri;
- this.name = name;
- this.value = value;
- }
-
- public XAttr(String name, String value) {
- this(null, name, value);
- }
-
- public XAttr(String uri, String name, List<?> values) {
- this.uri = uri;
- this.name = name;
- this.value = values;
- }
-
- public XAttr(String name, List<?> values) {
- this(null, name, values);
- }
-
- public XAttr(String uri, String name, Boolean value) {
- this.uri = uri;
- this.name = name;
- this.value = value;
- }
-
- public XAttr(String name, Boolean value) {
- this(null, name, value);
- }
-
- public XAttr(String uri, String name, Integer value) {
- this.uri = uri;
- this.name = name;
- this.value = value;
- }
-
- public XAttr(String name, Integer value) {
- this(null, name, value);
- }
-
- public XAttr(String uri, String name, Double value) {
- this.uri = uri;
- this.name = name;
- this.value = value;
- }
-
- public XAttr(String name, Double value) {
- this(null, name, value);
- }
-
- public XAttr(String uri, String name, QName value) {
- this.uri = uri;
- this.name = name;
- this.value = value;
- }
-
- public XAttr(String name, QName value) {
- this(null, name, value);
- }
-
- /**
- * Writes a string from a QName and registers a prefix for its namespace.
- * @param reader
- * @param value
- * @return
- */
- private String writeQNameValue(XMLStreamWriter writer, QName qname) throws XMLStreamException {
- if (qname != null) {
- String prefix = qname.getPrefix();
- String uri = qname.getNamespaceURI();
- prefix = writer.getPrefix(uri);
- if (prefix != null) {
-
- // Use the prefix already bound to the given URI
- if (prefix.length() > 0) {
- return prefix + ":" + qname.getLocalPart();
- } else {
-
- // Empty prefix, just return the local part of the given qname
- return qname.getLocalPart();
- }
-
- } else {
-
- // Find an available prefix and bind it to the given URI
- NamespaceContext nsc = writer.getNamespaceContext();
- for (int i=1; ; i++) {
- prefix = "ns" + i;
- if (nsc.getNamespaceURI(prefix) == null) {
- break;
- }
- }
- // writer.setPrefix(prefix, uri);
- writer.writeNamespace(prefix, uri);
- return prefix + ":" + qname.getLocalPart();
- }
- } else {
- return null;
- }
- }
-
- /**
- * Registers a prefix for the namespace of a QName.
- * @param reader
- * @param value
- * @return
- */
- private void writeQNamePrefix(XMLStreamWriter writer, QName qname) throws XMLStreamException {
- if (qname != null) {
- String prefix = qname.getPrefix();
- String uri = qname.getNamespaceURI();
- prefix = writer.getPrefix(uri);
- if (prefix != null) {
- return;
- } else {
-
- // Find an available prefix and bind it to the given URI
- NamespaceContext nsc = writer.getNamespaceContext();
- for (int i=1; ; i++) {
- prefix = "ns" + i;
- if (nsc.getNamespaceURI(prefix) == null) {
- break;
- }
- }
- // writer.setPrefix(prefix, uri);
- writer.writeNamespace(prefix, uri);
- }
- }
- }
-
- /**
- * Write to document
- * @param writer
- * @throws XMLStreamException
- */
- public void write(XMLStreamWriter writer) throws XMLStreamException {
- String str;
- if (value instanceof QName) {
-
- // Write a QName
- str = writeQNameValue(writer, (QName)value);
-
- } else if (value instanceof List) {
-
- // Write a list of values
- List<?> values = (List<?>)value;
- if (values.isEmpty()) {
- return;
- }
- StringBuffer buffer = new StringBuffer();
- for (Object v: values) {
- if (v == null) {
- // Skip null values
- continue;
- }
-
- if (v instanceof XAttr) {
- // Write an XAttr value
- ((XAttr)v).write(writer);
- continue;
- }
-
- if (buffer.length() != 0) {
- buffer.append(' ');
- }
- if (v instanceof QName) {
- // Write a QName value
- buffer.append(writeQNameValue(writer, (QName)v));
- } else {
- // Write value as a string
- buffer.append(String.valueOf(v));
- }
- }
- str = buffer.toString();
-
- } else {
-
- // Write a string
- if (value == null) {
- return;
- }
- str = String.valueOf(value);
- }
- if (str.length() == 0) {
- return;
- }
-
- // Write the attribute
- if (uri != null && !uri.equals(SCA10_NS)) {
- writer.writeAttribute(uri, name, str);
- } else {
- writer.writeAttribute(name,str);
- }
- }
-
- /**
- * Registers a prefix for the namespace of a QName or list of QNames
- * @param writer
- * @throws XMLStreamException
- */
- public void writePrefix(XMLStreamWriter writer) throws XMLStreamException {
- if (value instanceof QName) {
-
- // Write prefix for a single QName value
- writeQNamePrefix(writer, (QName)value);
-
- } else if (value instanceof List) {
-
- // Write prefixes for a list of values
- for (Object v: (List<?>)value) {
- if (v instanceof QName) {
- // Write prefix for a QName value
- writeQNamePrefix(writer, (QName)v);
-
- } else if (v instanceof XAttr) {
- // Write prefix for an XAttr value
- ((XAttr)v).writePrefix(writer);
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
deleted file mode 100644
index 3c67a8c550..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.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.contribution.processor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The default implementation of an artifact processor extension point.
- *
- * @version $Rev$ $Date$
- */
-abstract class DefaultArtifactProcessorExtensionPoint<P> {
- protected final Map<Object, P> processorsByArtifactType = new HashMap<Object, P>();
- protected final Map<Class<?>, P> processorsByModelType = new HashMap<Class<?>, P>();
-
- /**
- * Constructs a new loader registry.
- */
- DefaultArtifactProcessorExtensionPoint() {
- }
-
- /**
- * Returns the processor associated with the given artifact type.
- *
- * @param artifactType An artifact type
- * @return The processor associated with the given artifact type
- */
- public P getProcessor(Object artifactType) {
- return processorsByArtifactType.get(artifactType);
- }
-
- /**
- * Returns the processor associated with the given model type.
- *
- * @param modelType A model type
- * @return The processor associated with the given model type
- */
- public P getProcessor(Class<?> modelType) {
- Class<?>[] classes = modelType.getInterfaces();
- for (Class<?> c : classes) {
- P processor = processorsByModelType.get(c);
- if (processor != null) {
- return processor;
- }
- }
- return processorsByModelType.get(modelType);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java
deleted file mode 100644
index 3c25424325..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultPackageProcessorExtensionPoint.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a package processor extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultPackageProcessorExtensionPoint implements PackageProcessorExtensionPoint {
-
- private Map<String, PackageProcessor> processors = new HashMap<String, PackageProcessor>();
- private boolean loaded;
-
- public DefaultPackageProcessorExtensionPoint() {
- }
-
- public void addPackageProcessor(PackageProcessor processor) {
- processors.put(processor.getPackageType(), processor);
- }
-
- public void removePackageProcessor(PackageProcessor processor) {
- processors.remove(processor.getPackageType());
- }
-
- public PackageProcessor getPackageProcessor(String contentType) {
- loadProcessors();
- return processors.get(contentType);
- }
-
- private synchronized void loadProcessors() {
- if (loaded)
- return;
-
- // Get the processor service declarations
- Set<ServiceDeclaration> processorDeclarations;
- try {
- processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(PackageProcessor.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration processorDeclaration: processorDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
-
- // Load a URL artifact processor
- String packageType = attributes.get("type");
-
- // Create a processor wrapper and register it
- PackageProcessor processor = new LazyPackageProcessor(packageType, processorDeclaration);
- addPackageProcessor(processor);
- }
-
- loaded = true;
- }
-
- /**
- * A facade for package processors.
- */
- private static class LazyPackageProcessor implements PackageProcessor {
-
- private ServiceDeclaration processorDeclaration;
- private String packageType;
- private PackageProcessor processor;
-
- private LazyPackageProcessor(String packageType, ServiceDeclaration processorDeclaration) {
- this.processorDeclaration = processorDeclaration;
- this.packageType = packageType;
- }
-
- public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
- return getProcessor().getArtifactURL(packageSourceURL, artifact);
- }
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException {
- return getProcessor().getArtifacts(packageSourceURL, inputStream);
- }
-
- public String getPackageType() {
- return packageType;
- }
-
- @SuppressWarnings("unchecked")
- private PackageProcessor getProcessor() {
- if (processor == null) {
- try {
- Class<PackageProcessor> processorClass = (Class<PackageProcessor>)processorDeclaration.loadClass();
- Constructor<PackageProcessor> constructor = processorClass.getConstructor();
- processor = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return processor;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
deleted file mode 100644
index a390c61eec..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * The default implementation of an extension point for StAX artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultStAXArtifactProcessorExtensionPoint extends
- DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor> implements StAXArtifactProcessorExtensionPoint {
-
- private ExtensionPointRegistry extensionPoints;
- private ModelFactoryExtensionPoint modelFactories;
- private MonitorFactory monitorFactory;
- private boolean loaded;
- private StAXArtifactProcessor<Object> extensibleStAXProcessor;
- private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor;
- private Monitor monitor = null;
-
- /**
- * Constructs a new extension point.
- */
- public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null)
- this.monitor = monitorFactory.createMonitor();
- this.extensibleStAXProcessor = new ExtensibleStAXArtifactProcessor(this, inputFactory, outputFactory, this.monitor);
-
- StAXAttributeProcessorExtensionPoint attributeExtensionPoint = extensionPoints.getExtensionPoint(StAXAttributeProcessorExtensionPoint.class);
- this.extensibleStAXAttributeProcessor = new ExtensibleStAXAttributeProcessor(attributeExtensionPoint ,inputFactory, outputFactory, this.monitor);
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public void addArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
- }
- }
-
- public void removeArtifactProcessor(StAXArtifactProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.remove(artifactProcessor.getModelType());
- }
- }
-
- @Override
- public StAXArtifactProcessor getProcessor(Class<?> modelType) {
- loadArtifactProcessors();
- return super.getProcessor(modelType);
- }
-
- @Override
- public StAXArtifactProcessor getProcessor(Object artifactType) {
- loadArtifactProcessors();
- return super.getProcessor(artifactType);
- }
-
- /**
- * Returns a QName object from a QName expressed as {ns}name
- * or ns#name.
- *
- * @param qname
- * @return
- */
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: "+qname);
- }
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- private synchronized void loadArtifactProcessors() {
- if (loaded)
- return;
-
- // Get the processor service declarations
- Set<ServiceDeclaration> processorDeclarations;
- try {
- processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(StAXArtifactProcessor.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", extensibleStAXProcessor, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration : processorDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
-
- // Load a StAX artifact processor
-
- // Get the model QName
- QName artifactType = getQName(attributes.get("qname"));
-
- // Get the model class name
- String modelTypeName = attributes.get("model");
-
- // Get the model factory class name
- String factoryName = attributes.get("factory");
-
- // Create a processor wrapper and register it
- StAXArtifactProcessor processor =
- new LazyStAXArtifactProcessor(artifactType, modelTypeName, factoryName,
- processorDeclaration, extensionPoints, modelFactories,
- extensibleStAXProcessor,extensibleStAXAttributeProcessor, monitor);
- addArtifactProcessor(processor);
- }
-
- loaded = true;
- }
-
- /**
- * A wrapper around an Artifact processor class allowing lazy loading and
- * initialization of artifact processors.
- */
- private static class LazyStAXArtifactProcessor implements StAXArtifactProcessor {
-
- private ExtensionPointRegistry extensionPoints;
- private QName artifactType;
- private String modelTypeName;
- private String factoryName;
- private ServiceDeclaration processorDeclaration;
- private StAXArtifactProcessor processor;
- private Class<?> modelType;
- private StAXArtifactProcessor<Object> extensionProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- LazyStAXArtifactProcessor(QName artifactType,
- String modelTypeName,
- String factoryName,
- ServiceDeclaration processorDeclaration,
- ExtensionPointRegistry extensionPoints,
- ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- StAXAttributeProcessor<Object> extensionAttributeProcessor,
- Monitor monitor) {
-
- this.extensionPoints = extensionPoints;
- this.artifactType = artifactType;
- this.modelTypeName = modelTypeName;
- this.factoryName = factoryName;
- this.processorDeclaration = processorDeclaration;
- this.extensionProcessor = extensionProcessor;
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- return artifactType;
- }
-
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- @SuppressWarnings("unchecked")
- private StAXArtifactProcessor getProcessor() {
- if (processor == null) {
-
- if (processorDeclaration.getClassName()
- .equals("org.apache.tuscany.sca.assembly.xml.DefaultBeanModelProcessor")) {
-
- // Specific initialization for the DefaultBeanModelProcessor
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- ExtensionFactory extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
- try {
- Class<StAXArtifactProcessor> processorClass =
- (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
- Object modelFactory;
- if (factoryName != null) {
- Class<?> factoryClass = (Class<?>)processorDeclaration.loadClass(factoryName);
- modelFactory = modelFactories.getFactory(factoryClass);
- } else {
- modelFactory = null;
- }
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(AssemblyFactory.class,
- ExtensionFactory.class,
- PolicyFactory.class,
- QName.class,
- Class.class,
- Object.class,
- Monitor.class);
- processor =
- constructor.newInstance(assemblyFactory,
- extensionFactory,
- policyFactory,
- artifactType,
- getModelType(),
- modelFactory,
- monitor);
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processor, ie);
- throw ie;
- }
- } else {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Load and instantiate the processor class
- try {
- Class<StAXArtifactProcessor> processorClass =
- (Class<StAXArtifactProcessor>)processorDeclaration.loadClass();
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, monitor);
- } catch (NoSuchMethodException e) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, monitor);
- } catch (NoSuchMethodException e1) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, extensionProcessor, monitor);
- } catch (NoSuchMethodException e2) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, extensionProcessor, extensionAttributeProcessor, monitor);
- } catch (NoSuchMethodException e2a) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, extensionProcessor, monitor);
- } catch (NoSuchMethodException e3) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, StAXAttributeProcessor.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, extensionProcessor, extensionAttributeProcessor, monitor);
- } catch (NoSuchMethodException e3a) {
-
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class);
- processor = constructor.newInstance(modelFactories);
- } catch (NoSuchMethodException e4) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class);
- processor = constructor.newInstance(extensionPoints);
- } catch (NoSuchMethodException e4a) {
- try {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
- processor = constructor.newInstance(modelFactories, extensionProcessor);
- } catch (NoSuchMethodException e5) {
- Constructor<StAXArtifactProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
- processor = constructor.newInstance(extensionPoints, extensionProcessor);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processor, ie);
- throw ie;
- }
- }
- }
- return processor;
- }
-
- public Object read(XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
- return getProcessor().read(inputSource);
- }
-
- @SuppressWarnings("unchecked")
- public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException,
- XMLStreamException {
- getProcessor().write(model, outputSource);
- }
-
- public Class<?> getModelType() {
- if (modelTypeName != null && modelType == null) {
- try {
- modelType = processorDeclaration.loadClass(modelTypeName);
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processorDeclaration, ie);
- throw ie;
- }
- }
- return modelType;
- }
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- getProcessor().resolve(model, resolver);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
deleted file mode 100644
index 3699a09f00..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * The default implementation of an extension point for StAX artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultStAXAttributeProcessorExtensionPoint extends
- DefaultArtifactProcessorExtensionPoint<StAXAttributeProcessor> implements StAXAttributeProcessorExtensionPoint {
-
- private ExtensionPointRegistry extensionPoints;
- private ModelFactoryExtensionPoint modelFactories;
- private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor;
- private boolean loaded;
- private Monitor monitor = null;
-
- /**
- * Constructs a new extension point.
- */
- public DefaultStAXAttributeProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- this.extensibleStAXAttributeProcessor = new ExtensibleStAXAttributeProcessor(this, inputFactory, outputFactory, this.monitor);
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public void addArtifactProcessor(StAXAttributeProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
- }
- }
-
- public void removeArtifactProcessor(StAXAttributeProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.remove(artifactProcessor.getModelType());
- }
- }
-
- @Override
- public StAXAttributeProcessor getProcessor(Class<?> modelType) {
- loadArtifactProcessors();
- return super.getProcessor(modelType);
- }
-
- @Override
- public StAXAttributeProcessor getProcessor(Object artifactType) {
- loadArtifactProcessors();
- return super.getProcessor(artifactType);
- }
-
- /**
- * Returns a QName object from a QName expressed as {ns}name
- * or ns#name.
- *
- * @param qname
- * @return
- */
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: "+qname);
- }
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- private synchronized void loadArtifactProcessors() {
- if (loaded)
- return;
-
- // Get the processor service declarations
- Set<ServiceDeclaration> processorDeclarations;
- try {
- processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(StAXAttributeProcessor.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", extensibleStAXAttributeProcessor, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration : processorDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
-
- // Load a StAX artifact processor
-
- // Get the model QName
- QName artifactType = getQName(attributes.get("qname"));
-
- // Get the model class name
- String modelTypeName = attributes.get("model");
-
- // Get the model factory class name
- String factoryName = attributes.get("factory");
-
- // Create a processor wrapper and register it
- StAXAttributeProcessor processor =
- new LazyStAXAttributeProcessor(artifactType, modelTypeName, factoryName,
- processorDeclaration, extensionPoints, modelFactories,
- extensibleStAXAttributeProcessor, monitor);
- addArtifactProcessor(processor);
- }
-
- loaded = true;
- }
-
- /**
- * A wrapper around an Artifact processor class allowing lazy loading and
- * initialization of artifact processors.
- */
- private static class LazyStAXAttributeProcessor implements StAXAttributeProcessor {
-
- private ExtensionPointRegistry extensionPoints;
- private QName artifactType;
- private String modelTypeName;
- private String factoryName;
- private ServiceDeclaration processorDeclaration;
- private StAXAttributeProcessor processor;
- private Class<?> modelType;
- private StAXAttributeProcessor<Object> extensionProcessor;
- private Monitor monitor;
-
- LazyStAXAttributeProcessor(QName artifactType,
- String modelTypeName,
- String factoryName,
- ServiceDeclaration processorDeclaration,
- ExtensionPointRegistry extensionPoints,
- ModelFactoryExtensionPoint modelFactories,
- StAXAttributeProcessor<Object> extensionProcessor,
- Monitor monitor) {
-
- this.extensionPoints = extensionPoints;
- this.artifactType = artifactType;
- this.modelTypeName = modelTypeName;
- this.factoryName = factoryName;
- this.processorDeclaration = processorDeclaration;
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- return artifactType;
- }
-
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- @SuppressWarnings("unchecked")
- private StAXAttributeProcessor getProcessor() {
- if (processor == null) {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Load and instantiate the processor class
- try {
- Class<StAXAttributeProcessor> processorClass =
- (Class<StAXAttributeProcessor>)processorDeclaration.loadClass();
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, monitor);
- } catch (NoSuchMethodException e) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, monitor);
- } catch (NoSuchMethodException e1) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, extensionProcessor, monitor);
- } catch (NoSuchMethodException e2) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, extensionProcessor, monitor);
- } catch (NoSuchMethodException e3) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class);
- processor = constructor.newInstance(modelFactories);
- } catch (NoSuchMethodException e4) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class);
- processor = constructor.newInstance(extensionPoints);
- } catch (NoSuchMethodException e4a) {
- try {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class);
- processor = constructor.newInstance(modelFactories, extensionProcessor);
- } catch (NoSuchMethodException e5) {
- Constructor<StAXAttributeProcessor> constructor =
- processorClass.getConstructor(ExtensionPointRegistry.class, StAXArtifactProcessor.class);
- processor = constructor.newInstance(extensionPoints, extensionProcessor);
- }
- }
- }
- }
- }
- }
- }
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processor, ie);
- throw ie;
- }
-
- }
- return processor;
- }
-
- public Object read(QName attributeName, XMLStreamReader inputSource) throws ContributionReadException, XMLStreamException {
- return getProcessor().read(attributeName, inputSource);
- }
-
- @SuppressWarnings("unchecked")
- public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
- getProcessor().write(model, outputSource);
- }
-
- public Class<?> getModelType() {
- if (modelTypeName != null && modelType == null) {
- try {
- modelType = processorDeclaration.loadClass(modelTypeName);
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processorDeclaration, ie);
- throw ie;
- }
- }
- return modelType;
- }
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- getProcessor().resolve(model, resolver);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
deleted file mode 100644
index 7725360f6f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.URI;
-import java.net.URL;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-
-/**
- * The default implementation of a URL artifact processor extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultURLArtifactProcessorExtensionPoint
- extends DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor>
- implements URLArtifactProcessorExtensionPoint {
-
- private ExtensionPointRegistry extensionPoints;
- private StAXArtifactProcessor<?> staxProcessor;
- private boolean loaded;
- private Monitor monitor = null;
-
- /**
- * Constructs a new extension point.
- */
- public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- ModelFactoryExtensionPoint modelFactories = this.extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- UtilityExtensionPoint utilities = this.extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- StAXArtifactProcessorExtensionPoint staxProcessors =
- extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, this.monitor);
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public void addArtifactProcessor(URLArtifactProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.put((Object)artifactProcessor.getArtifactType(), artifactProcessor);
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.put(artifactProcessor.getModelType(), artifactProcessor);
- }
- }
-
- public void removeArtifactProcessor(URLArtifactProcessor artifactProcessor) {
- if (artifactProcessor.getArtifactType() != null) {
- processorsByArtifactType.remove((Object)artifactProcessor.getArtifactType());
- }
- if (artifactProcessor.getModelType() != null) {
- processorsByModelType.remove(artifactProcessor.getModelType());
- }
- }
-
- @Override
- public URLArtifactProcessor getProcessor(Class<?> modelType) {
- loadProcessors();
- return super.getProcessor(modelType);
- }
-
- @Override
- public URLArtifactProcessor getProcessor(Object artifactType) {
- loadProcessors();
- return super.getProcessor(artifactType);
- }
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- private synchronized void loadProcessors() {
- if (loaded)
- return;
-
- // Get the processor service declarations
- Set<ServiceDeclaration> processorDeclarations;
- try {
- processorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(URLArtifactProcessor.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", staxProcessor, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration: processorDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
- // Load a URL artifact processor
- String artifactType = attributes.get("type");
- String modelTypeName = attributes.get("model");
-
- // Create a processor wrapper and register it
- URLArtifactProcessor processor = new LazyURLArtifactProcessor(artifactType, modelTypeName,
- processorDeclaration, extensionPoints, staxProcessor, monitor);
- addArtifactProcessor(processor);
- }
-
- loaded = true;
- }
-
- /**
- * A wrapper around an Artifact processor class allowing lazy loading and
- * initialization of artifact processors.
- */
- private static class LazyURLArtifactProcessor implements URLArtifactProcessor {
-
- private ExtensionPointRegistry extensionPoints;
- private String artifactType;
- private String modelTypeName;
- private ServiceDeclaration processorDeclaration;
- private URLArtifactProcessor processor;
- private Class<?> modelType;
- private StAXArtifactProcessor<?> staxProcessor;
- private Monitor monitor;
-
- LazyURLArtifactProcessor(String artifactType,
- String modelTypeName,
- ServiceDeclaration processorDeclaration,
- ExtensionPointRegistry extensionPoints,
- StAXArtifactProcessor<?> staxProcessor,
- Monitor monitor) {
- this.artifactType = artifactType;
- this.modelTypeName = modelTypeName;
- this.processorDeclaration = processorDeclaration;
- this.extensionPoints = extensionPoints;
- this.staxProcessor = staxProcessor;
- this.monitor = monitor;
- }
-
- public String getArtifactType() {
- return artifactType;
- }
-
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- @SuppressWarnings("unchecked")
- private URLArtifactProcessor getProcessor() {
- if (processor == null) {
- try {
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- Class<URLArtifactProcessor> processorClass = (Class<URLArtifactProcessor>)processorDeclaration.loadClass();
- try {
- Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, monitor);
- } catch (NoSuchMethodException e) {
- try {
- Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ModelFactoryExtensionPoint.class, StAXArtifactProcessor.class, Monitor.class);
- processor = constructor.newInstance(modelFactories, staxProcessor, monitor);
- } catch (NoSuchMethodException e2) {
- Constructor<URLArtifactProcessor> constructor = processorClass.getConstructor(ExtensionPointRegistry.class, Monitor.class);
- processor = constructor.newInstance(extensionPoints, monitor);
- }
- }
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processor, ie);
- throw ie;
- }
- }
- return processor;
- }
-
- public Object read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- return getProcessor().read(contributionURL, artifactURI, artifactURL);
- }
-
- public Class<?> getModelType() {
- if (modelTypeName != null && modelType == null) {
- try {
- modelType = processorDeclaration.loadClass(modelTypeName);
- } catch (ClassNotFoundException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", processorDeclaration, ie);
- throw ie;
- }
- }
- return modelType;
- }
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- getProcessor().resolve(model, resolver);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
deleted file mode 100644
index 6fc32d4e70..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidatingXMLInputFactory.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.XMLConstants;
-import javax.xml.stream.EventFilter;
-import javax.xml.stream.StreamFilter;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLReporter;
-import javax.xml.stream.XMLResolver;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.util.XMLEventAllocator;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-/**
- * Default implementation of an XMLInputFactory that creates validating
- * XMLStreamReaders.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultValidatingXMLInputFactory extends ValidatingXMLInputFactory {
- private static final Logger logger = Logger.getLogger(DefaultValidatingXMLInputFactory.class.getName());
- private XMLInputFactory inputFactory;
- private ValidationSchemaExtensionPoint schemas;
- private Monitor monitor;
- private boolean initialized;
- private boolean hasSchemas;
- private Schema aggregatedSchema;
-
- /**
- * Constructs a new XMLInputFactory.
- *
- * @param inputFactory
- * @param schemas
- */
- public DefaultValidatingXMLInputFactory(XMLInputFactory inputFactory, ValidationSchemaExtensionPoint schemas, Monitor monitor) {
- this.inputFactory = inputFactory;
- this.schemas = schemas;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem =
- new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model,
- message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Initialize the registered schemas and create an aggregated schema for
- * validation.
- */
- private void initializeSchemas() {
- if (initialized) {
- return;
- }
- initialized = true;
-
- // Load the XSDs registered in the validation schema extension point
- try {
- List<String> uris = schemas.getSchemas();
- int n = uris.size();
- if (n ==0) {
- return;
- } else {
- hasSchemas = true;
- }
- final Source[] sources = new Source[n];
- for (int i =0; i < n; i++) {
- final String uri = uris.get(i);
- // Allow privileged access to open URL stream. Requires FilePermission in security policy.
- final URL url = new URL( uri );
- InputStream urlStream;
- try {
- urlStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
- public InputStream run() throws IOException {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- return connection.getInputStream();
- }
- });
- } catch (PrivilegedActionException e) {
- error("PrivilegedActionException", url, (IOException)e.getException());
- throw (IOException)e.getException();
- }
- sources[i] = new StreamSource(urlStream, uri);
- }
-
- // Create an aggregated validation schemas from all the XSDs
- final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- // Allow privileged access to check files. Requires FilePermission
- // in security policy.
- try {
- aggregatedSchema = AccessController.doPrivileged(new PrivilegedExceptionAction<Schema>() {
- public Schema run() throws SAXException {
- return schemaFactory.newSchema(sources);
- }
- });
- } catch (PrivilegedActionException e) {
- error("PrivilegedActionException", schemaFactory, (SAXException)e.getException());
- throw (SAXException)e.getException();
- }
-
- } catch (Error e) {
- // FIXME Log this, some old JDKs don't support XMLSchema validation
- logger.log(Level.WARNING, "XML Schema validation is not supported: " + e.getMessage());
- } catch (SAXParseException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", schemas, ie);
- throw ie;
- } catch (Exception e) {
- //FIXME Log this, some old JDKs don't support XMLSchema validation
- logger.log(Level.WARNING, "XML Schema validation is not supported: " + e.getMessage());
- }
- }
-
- @Override
- public XMLEventReader createFilteredReader(XMLEventReader arg0, EventFilter arg1) throws XMLStreamException {
- return inputFactory.createFilteredReader(arg0, arg1);
- }
-
- @Override
- public XMLStreamReader createFilteredReader(XMLStreamReader arg0, StreamFilter arg1) throws XMLStreamException {
- return inputFactory.createFilteredReader(arg0, arg1);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(InputStream arg0, String arg1) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0, arg1);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(InputStream arg0) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(Reader arg0) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(Source arg0) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(String arg0, InputStream arg1) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0, arg1);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(String arg0, Reader arg1) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0, arg1);
- }
-
- @Override
- public XMLEventReader createXMLEventReader(XMLStreamReader arg0) throws XMLStreamException {
- return inputFactory.createXMLEventReader(arg0);
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(InputStream arg0, String arg1) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
- }else {
- return inputFactory.createXMLStreamReader(arg0, arg1);
- }
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(InputStream arg0) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
- } else {
- return inputFactory.createXMLStreamReader(arg0);
- }
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(Reader arg0) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
- } else {
- return inputFactory.createXMLStreamReader(arg0);
- }
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(Source arg0) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0), aggregatedSchema, monitor);
- } else {
- return inputFactory.createXMLStreamReader(arg0);
- }
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(String arg0, InputStream arg1) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
- } else {
- return inputFactory.createXMLStreamReader(arg0, arg1);
- }
- }
-
- @Override
- public XMLStreamReader createXMLStreamReader(String arg0, Reader arg1) throws XMLStreamException {
- initializeSchemas();
- if (hasSchemas) {
- return new ValidatingXMLStreamReader(inputFactory.createXMLStreamReader(arg0, arg1), aggregatedSchema, monitor);
- } else {
- return inputFactory.createXMLStreamReader(arg0, arg1);
- }
- }
-
- @Override
- public XMLEventAllocator getEventAllocator() {
- return inputFactory.getEventAllocator();
- }
-
- @Override
- public Object getProperty(String arg0) throws IllegalArgumentException {
- return inputFactory.getProperty(arg0);
- }
-
- @Override
- public XMLReporter getXMLReporter() {
- return inputFactory.getXMLReporter();
- }
-
- @Override
- public XMLResolver getXMLResolver() {
- return inputFactory.getXMLResolver();
- }
-
- @Override
- public boolean isPropertySupported(String arg0) {
- return inputFactory.isPropertySupported(arg0);
- }
-
- @Override
- public void setEventAllocator(XMLEventAllocator arg0) {
- inputFactory.setEventAllocator(arg0);
- }
-
- @Override
- public void setProperty(String arg0, Object arg1) throws IllegalArgumentException {
- inputFactory.setProperty(arg0, arg1);
- }
-
- @Override
- public void setXMLReporter(XMLReporter arg0) {
- inputFactory.setXMLReporter(arg0);
- }
-
- @Override
- public void setXMLResolver(XMLResolver arg0) {
- inputFactory.setXMLResolver(arg0);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.java
deleted file mode 100644
index 9f4094aa12..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultValidationSchemaExtensionPoint.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.contribution.processor;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of an extension point for XML schemas.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultValidationSchemaExtensionPoint implements ValidationSchemaExtensionPoint {
-
- private List<String> schemas = new ArrayList<String>();
- private boolean loaded;
-
- public void addSchema(String uri) {
- schemas.add(uri);
- }
-
- public void removeSchema(String uri) {
- schemas.remove(uri);
- }
-
- /**
- * Load schema declarations from META-INF/services/
- * org.apache.tuscany.sca.contribution.processor.ValidationSchema files
- */
- private synchronized void loadSchemas() {
- if (loaded)
- return;
-
- // Get the schema declarations
- Set<ServiceDeclaration> schemaDeclarations;
- try {
- schemaDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations("org.apache.tuscany.sca.contribution.processor.ValidationSchema");
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // TODO - temp fix to ensure that the schema tuscany-sca.xsd always comes first
- String tuscanyScaXsd = null;
-
- // Find each schema
- for (ServiceDeclaration schemaDeclaration: schemaDeclarations) {
- URL url = schemaDeclaration.getResource(schemaDeclaration.getClassName());
- if (url == null) {
- throw new IllegalArgumentException(new FileNotFoundException(schemaDeclaration.getClassName()));
- }
-
- if (url.toString().contains("tuscany-sca.xsd")){
- tuscanyScaXsd = url.toString();
- } else {
- schemas.add(url.toString());
- }
- }
-
- if (tuscanyScaXsd != null){
- schemas.add(0, tuscanyScaXsd);
- }
-
- loaded = true;
- }
-
- public List<String> getSchemas() {
- loadSchemas();
- return schemas;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.java
deleted file mode 100644
index 2e24477f35..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensiblePackageProcessor.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.contribution.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.UnsupportedPackageTypeException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implementation of an extensible package processor.
- *
- * Takes a package processor extension point and delegates to the proper package
- * processor from the extension point based on the package's content type.
- *
- * @version $Rev$ $Date$
- */
-public class ExtensiblePackageProcessor implements PackageProcessor {
-
- private PackageProcessorExtensionPoint processors;
- private TypeDescriber packageTypeDescriber;
- private Monitor monitor;
-
- public ExtensiblePackageProcessor(PackageProcessorExtensionPoint processors,
- TypeDescriber packageTypeDescriber,
- Monitor monitor) {
- this.processors = processors;
- this.packageTypeDescriber = packageTypeDescriber;
- this.monitor = monitor;
- }
-
- /**
- * Marshals errors into the monitor
- *
- * @param problems
- * @param message
- * @param model
- */
- protected void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream)
- throws ContributionException, IOException {
- String packageType = this.packageTypeDescriber.getType(packageSourceURL, null);
- if (packageType == null) {
- error("UnsupportedPackageTypeException", packageTypeDescriber, packageSourceURL.toString());
- throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageSourceURL.toString());
- }
-
- PackageProcessor packageProcessor = this.processors.getPackageProcessor(packageType);
- if (packageProcessor == null) {
- error("UnsupportedPackageTypeException", packageTypeDescriber, packageType);
- throw new UnsupportedPackageTypeException("Unsupported contribution package type: " + packageType);
- }
-
- return packageProcessor.getArtifacts(packageSourceURL, inputStream);
- }
-
- public URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException {
- String contentType = this.packageTypeDescriber.getType(packageSourceURL, null);
- PackageProcessor packageProcessor = this.processors.getPackageProcessor(contentType);
- return packageProcessor.getArtifactURL(packageSourceURL, artifact);
- }
-
- public String getPackageType() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
deleted file mode 100644
index cc3eaf9379..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXArtifactProcessor.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.Constants;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.contribution.service.UnrecognizedElementException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implementation of an extensible StAX artifact processor.
- *
- * Takes a StAXArtifactProcessorExtensionPoint and delegates to the proper
- * StAXArtifactProcessor by element QName
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleStAXArtifactProcessor implements StAXArtifactProcessor<Object> {
-
- private static final QName ANY_ELEMENT = new QName(Constants.XMLSCHEMA_NS, "anyElement");
-
- private static final Logger logger = Logger.getLogger(ExtensibleStAXArtifactProcessor.class.getName());
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessorExtensionPoint processors;
- private Monitor monitor;
-
- /**
- * Constructs a new ExtensibleStAXArtifactProcessor.
- * @param processors
- * @param inputFactory
- * @param outputFactory
- */
- public ExtensibleStAXArtifactProcessor(StAXArtifactProcessorExtensionPoint processors,
- XMLInputFactory inputFactory,
- XMLOutputFactory outputFactory,
- Monitor monitor) {
- super();
- this.processors = processors;
- this.inputFactory = inputFactory;
- this.outputFactory = outputFactory;
- if (this.outputFactory != null) {
- this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
- }
- this.monitor = monitor;
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
-
- public Object read(XMLStreamReader source) throws ContributionReadException, XMLStreamException {
-
- // Delegate to the processor associated with the element QName
- int event = source.getEventType();
- if (event == XMLStreamConstants.START_DOCUMENT) {
- source.nextTag();
- }
- QName name = source.getName();
- StAXArtifactProcessor<?> processor = (StAXArtifactProcessor<?>)processors.getProcessor(name);
- if (processor == null) {
- Location location = source.getLocation();
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("Element " + name + " cannot be processed. (" + location + ")");
- }
- warning("ElementCannotBeProcessed", processors, name, location);
-
- StAXArtifactProcessor anyElementProcessor = processors.getProcessor(ANY_ELEMENT);
- if(anyElementProcessor != null) {
- return anyElementProcessor.read(source);
- } else {
- return null;
- }
-
- }
- return processor.read(source);
- }
-
- @SuppressWarnings("unchecked")
- public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
-
- // Delegate to the processor associated with the model type
- if (model != null) {
- StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
- if (processor != null) {
- processor.write(model, outputSource);
- } else {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("No StAX processor is configured to handle " + model.getClass());
- }
- warning("NoStaxProcessor", processors, model.getClass());
- StAXArtifactProcessor anyElementProcessor = processors.getProcessor(ANY_ELEMENT);
- if(anyElementProcessor != null) {
- anyElementProcessor.write(model, outputSource);
- }
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
-
- // Delegate to the processor associated with the model type
- if (model != null) {
- StAXArtifactProcessor processor = processors.getProcessor(model.getClass());
- if (processor != null) {
- processor.resolve(model, resolver);
- }
- }
- }
-
- /**
- * Read a model from an InputStream.
- * @param is The artifact InputStream
- * @param type Model type
- * @return The model
- * @throws ContributionReadException
- */
- public <M> M read(InputStream is, Class<M> type) throws ContributionReadException {
- try {
- XMLStreamReader reader;
- try {
- reader = inputFactory.createXMLStreamReader(is);
- try {
- reader.nextTag();
- QName name = reader.getName();
- Object mo = read(reader);
- if (type.isInstance(mo)) {
- return type.cast(mo);
- } else {
- error("UnrecognizedElementException", reader, name);
- UnrecognizedElementException e = new UnrecognizedElementException(name);
- throw e;
- }
- } catch (ContributionReadException e) {
- Location location = reader.getLocation();
- e.setLine(location.getLineNumber());
- e.setColumn(location.getColumnNumber());
- error("ContributionReadException", reader, e);
- throw e;
- } finally {
- try {
- reader.close();
- } catch (XMLStreamException e) {
- // ignore
- }
- }
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- }
- }
-
- /**
- * Write a model to an OutputStream.
- * @param model
- * @param os
- * @throws ContributionWriteException
- */
- public void write(Object model, OutputStream os) throws ContributionWriteException {
- try {
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(os);
- write(model, writer);
- writer.flush();
- writer.close();
- } catch (XMLStreamException e) {
- ContributionWriteException cw = new ContributionWriteException(e);
- error("ContributionWriteException", outputFactory, cw);
- throw cw;
- }
- }
-
- public QName getArtifactType() {
- return null;
- }
-
- public Class<Object> getModelType() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java
deleted file mode 100644
index f2ee8bc786..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleStAXAttributeProcessor.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.Constants;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implementation of an extensible StAX attribute processor.
- *
- * Takes a StAXAttributeProcessorExtensionPoint and delegates to the proper
- * StAXAttributeProcessor by attribute QName
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleStAXAttributeProcessor
- implements StAXAttributeProcessor<Object> {
-
- private static final Logger logger = Logger.getLogger(ExtensibleStAXAttributeProcessor.class.getName());
-
- private static final QName ANY_ATTRIBUTE = new QName(Constants.XMLSCHEMA_NS, "anyAttribute");
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXAttributeProcessorExtensionPoint processors;
- private Monitor monitor;
-
- /**
- * Constructs a new ExtensibleStAXArtifactProcessor.
- * @param processors
- * @param inputFactory
- * @param outputFactory
- */
- public ExtensibleStAXAttributeProcessor(StAXAttributeProcessorExtensionPoint processors,
- XMLInputFactory inputFactory,
- XMLOutputFactory outputFactory,
- Monitor monitor) {
- super();
- this.processors = processors;
- this.inputFactory = inputFactory;
- this.outputFactory = outputFactory;
- if (this.outputFactory != null) {
- this.outputFactory.setProperty("javax.xml.stream.isRepairingNamespaces", Boolean.TRUE);
- }
- this.monitor = monitor;
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
-
- public Object read(QName attributeName, XMLStreamReader source) throws ContributionReadException, XMLStreamException {
-
- // Delegate to the processor associated with the attribute QName
- int event = source.getEventType();
- if (event == XMLStreamConstants.START_DOCUMENT) {
- source.nextTag();
- }
-
- StAXAttributeProcessor<?> processor = null;
-
- //lookup for registered attribute processors
- processor = (StAXAttributeProcessor<?>)processors.getProcessor(attributeName);
- if (processor == null) {
- Location location = source.getLocation();
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("Attribute " + attributeName + " cannot be processed. (" + location + ")");
- }
- warning("AttributeCannotBeProcessed", processors, attributeName, location);
- } else {
- return processor.read(attributeName, source);
- }
-
-
- //handle extension attributes without processors
- processor = (StAXAttributeProcessor<?>)processors.getProcessor(ANY_ATTRIBUTE);
- if (processor == null) {
- Location location = source.getLocation();
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("Could not find Default Attribute processor !");
- }
- warning("DefaultAttributeProcessorNotAvailable", processors, ANY_ATTRIBUTE, location);
- }
-
- return processor == null ? null : processor.read(attributeName, source);
- }
-
- @SuppressWarnings("unchecked")
- public void write(Object model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
-
- if(model == null) {
- return;
- }
-
- // Delegate to the processor associated with the model type
- StAXAttributeProcessor processor = processors.getProcessor(model.getClass());
- if(processor == null) {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("No StAX processor is configured to handle " + model.getClass());
- }
- warning("NoStaxProcessor", processors, model.getClass());
- } else {
- processor.write(model, outputSource);
- return;
- }
-
- //handle extension attributes without processors
- processor = (StAXAttributeProcessor<?>)processors.getProcessor(ANY_ATTRIBUTE);
- if(processor == null) {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("No Default StAX processor is configured to handle " + model.getClass());
- }
- warning("NoDefaultStaxProcessor", processors, model.getClass());
- } else {
- processor.write(model, outputSource);
- return;
- }
- }
-
-
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
-
- // Delegate to the processor associated with the model type
- if (model != null) {
- StAXAttributeProcessor processor = processors.getProcessor(model.getClass());
- if (processor != null) {
- processor.resolve(model, resolver);
- }
- }
- }
-
- /**
- * Read a model from an InputStream.
- * @param is The artifact InputStream
- * @param type Model type
- * @return The model
- * @throws ContributionReadException
- */
- public <M> M read(InputStream is, Class<M> type) throws ContributionReadException {
- return null;
- }
-
- /**
- * Write a model to an OutputStream.
- * @param model
- * @param os
- * @throws ContributionWriteException
- */
- public void write(Object model, OutputStream os) throws ContributionWriteException {
- try {
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(os);
- write(model, writer);
- writer.flush();
- writer.close();
- } catch (XMLStreamException e) {
- ContributionWriteException cw = new ContributionWriteException(e);
- error("ContributionWriteException", outputFactory, cw);
- throw cw;
- }
- }
-
- public QName getArtifactType() {
- return null;
- }
-
- public Class<Object> getModelType() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.java
deleted file mode 100644
index 8427098035..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ExtensibleURLArtifactProcessor.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.contribution.processor;
-
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.UnrecognizedElementException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implementation of an extensible URL artifact processor.
- *
- * Takes a URLArtifactProcessorExtensionPoint and delegates to the proper URLArtifactProcessor
- * by either fileName or fileExtention
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleURLArtifactProcessor
- implements URLArtifactProcessor<Object> {
-
- private URLArtifactProcessorExtensionPoint processors;
- private Monitor monitor;
-
- /**
- * Constructs a new ExtensibleURLArtifactProcessor.
- *
- * @param processors
- */
- public ExtensibleURLArtifactProcessor(URLArtifactProcessorExtensionPoint processors, Monitor monitor) {
- this.processors = processors;
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- @SuppressWarnings("unchecked")
- public Object read(URL contributionURL, URI sourceURI, URL sourceURL) throws ContributionReadException {
- URLArtifactProcessor<Object> processor = null;
-
- // Delegate to the processor associated with file extension
- String fileName = getFileName(sourceURL);
-
- //try to retrieve a processor for the specific filename
- processor = (URLArtifactProcessor<Object>)processors.getProcessor(fileName);
-
- if (processor == null) {
- //try to find my file type (extension)
- String extension = sourceURL.getPath();
-
- int extensionStart = extension.lastIndexOf('.');
- //handle files without extension (e.g NOTICE)
- if (extensionStart > 0) {
- extension = extension.substring(extensionStart);
- processor = (URLArtifactProcessor<Object>)processors.getProcessor(extension);
- }
- }
-
- if (processor == null) {
- return null;
- }
- return processor.read(contributionURL, sourceURI, sourceURL);
- }
-
- @SuppressWarnings("unchecked")
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
-
- // Delegate to the processor associated with the model type
- if (model != null) {
- URLArtifactProcessor processor = processors.getProcessor(model.getClass());
- if (processor != null) {
- processor.resolve(model, resolver);
- }
- }
- }
-
- public <M> M read(URL contributionURL, URI artifactURI, URL artifactUrl, Class<M> type)
- throws ContributionReadException {
- Object mo = read(contributionURL, artifactURI, artifactUrl);
- if (type.isInstance(mo)) {
- return type.cast(mo);
- } else {
- UnrecognizedElementException e = new UnrecognizedElementException(null);
- e.setResourceURI(artifactURI.toString());
- error("UnrecognizedElementException", processors, artifactURI.toString());
- throw e;
- }
- }
-
- public String getArtifactType() {
- return null;
- }
-
- public Class<Object> getModelType() {
- return null;
- }
-
- /**
- * Returns the file name from a URL.
- * @param url
- * @return
- */
- private static String getFileName(URL url){
- String fileName = url.getPath();
- int pos = fileName.lastIndexOf("/");
-
- return fileName.substring(pos +1);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java
deleted file mode 100644
index f17f31edb1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-
-/**
- * Interface for contribution package processors
- *
- * Package processors understand the format of the contribution and how to get the
- * artifacts in the contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface PackageProcessor {
-
- /**
- * Returns the type of package supported by this package processor.
- *
- * @return the package type
- */
- String getPackageType();
-
- /**
- * Returns a list of artifacts in the contribution.
- *
- * @param packageSourceURL Contribution package location URL
- * @param inputStream Optional content of the package
- * @return List of artifact URIs
- * @throws ContributionException
- * @throws IOException
- */
- List<URI> getArtifacts(URL packageSourceURL, InputStream inputStream) throws ContributionException, IOException;
-
- /**
- * Return the URL for an artifact in the package.
- *
- * This is needed for archives such as jar files that have specific URL schemes
- * for the artifacts they contain.
- *
- * @param packageSourceURL Contribution package location URL
- * @param artifact The relative URI for the artifact
- * @return The artifact URL
- */
- URL getArtifactURL(URL packageSourceURL, URI artifact) throws MalformedURLException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java
deleted file mode 100644
index ed99239b19..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/PackageProcessorExtensionPoint.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.processor;
-
-/**
- * An extension point for package processors
- *
- * @version $Rev$ $Date$
- */
-public interface PackageProcessorExtensionPoint {
-
- /**
- * Register a PackageProcessor using the package type as the key.
- *
- * @param processor The package processor
- */
- void addPackageProcessor(PackageProcessor processor);
-
- /**
- * Unregister a PackageProcessor.
- *
- * @param processor The package processor
- */
- void removePackageProcessor(PackageProcessor processor);
-
- /**
- * Returns the PackageProcessor for the given package type.
- *
- * @param packageType The package type
- * @return The package processor
- */
- PackageProcessor getPackageProcessor(String packageType);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.java
deleted file mode 100644
index fcf9347564..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessor.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.contribution.processor;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-/**
- * An artifact processor that can read models from a StAX XMLStreamReader.
- *
- * @version $Rev$ $Date$
- */
-public interface StAXArtifactProcessor<M> extends ArtifactProcessor<M> {
-
- /**
- * Reads a model from an XMLStreamReader.
- *
- * @param reader The XMLStreamReader
- * @return A model representation of the input.
- */
- M read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
-
- /**
- * Writes a model to an XMLStreamWriter.
- *
- * @param model A model representing the source
- * @param writer The XML stream writer
- * @throws ContributionWriteException
- * @throws XMLStreamException
- */
- void write(M model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException;
-
- /**
- * Returns the type of artifact handled by this artifact processor.
- *
- * @return The type of artifact handled by this artifact processor
- */
- QName getArtifactType();
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.java
deleted file mode 100644
index 9700e2bc60..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXArtifactProcessorExtensionPoint.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.contribution.processor;
-
-/**
- * An extension point for StAX artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public interface StAXArtifactProcessorExtensionPoint extends
- ArtifactProcessorExtensionPoint<StAXArtifactProcessor> {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.java
deleted file mode 100644
index e8edb743a4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessor.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.contribution.processor;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-
-/**
- * An artifact processor that can read attributes from a StAX XMLStreamReader.
- *
- * @version $Rev$ $Date$
- */
-public interface StAXAttributeProcessor<M> extends ArtifactProcessor<M>{
-
- /**
- * Reads a model from an XMLStreamReader.
- *
- * @param reader The XMLStreamReader
- * @return A model representation of the input.
- */
- M read(QName attributeName, XMLStreamReader reader) throws ContributionReadException, XMLStreamException;
-
- /**
- * Writes a model to an XMLStreamWriter.
- *
- * @param model A model representing the source
- * @param writer The XML stream writer
- * @throws ContributionWriteException
- * @throws XMLStreamException
- */
- void write(M model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException;
-
- /**
- * Returns the type of artifact handled by this artifact processor.
- *
- * @return The type of artifact handled by this artifact processor
- */
- QName getArtifactType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.java
deleted file mode 100644
index ebad243c1c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/StAXAttributeProcessorExtensionPoint.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.contribution.processor;
-
-/**
- * An extension point for StAX artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public interface StAXAttributeProcessorExtensionPoint extends
- ArtifactProcessorExtensionPoint<StAXAttributeProcessor> {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyNamespaceContext.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyNamespaceContext.java
deleted file mode 100644
index 2adebb9f33..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyNamespaceContext.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.contribution.processor;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Stack;
-
-import javax.xml.namespace.NamespaceContext;
-
-public class TuscanyNamespaceContext implements NamespaceContext {
-
- private Stack<List<String>[]> context = null;
-
- public TuscanyNamespaceContext(Stack<List<String>[]> context) {
- this.context = context;
- }
-
- public String getNamespaceURI(String prefix) {
- if (prefix == null) {
- throw new IllegalArgumentException();
- }
- return (String)getResult("getNSUri", prefix);
- }
-
- public String getPrefix(String namespaceURI) {
- if (namespaceURI == null) {
- throw new IllegalArgumentException();
- }
- return (String)getResult("getPrefix", namespaceURI);
- }
-
- @SuppressWarnings("unchecked")
- public Iterator<String> getPrefixes(String namespaceURI) {
- if (namespaceURI == null) {
- throw new IllegalArgumentException();
- }
-
- Iterator<String> iterator = (Iterator<String>)getResult("getPrefixes", namespaceURI);
- return iterator;
- }
-
- /*
- * Generic method to Iterate through the Stack and return required result(s)
- */
- private Object getResult(String operation, String arg) {
-
- List<String>[] contextList = null;
- Iterator<String> prefItr = null;
- Iterator<String> uriItr = null;
-
- List<String> list = new ArrayList<String>();
-
- String toCompare = null;
-
- String tempPrefix = null;
- String tempUri = null;
-
- for (int i = context.size() - 1; i >= 0; i--) {
- contextList = context.get(i);
- prefItr = contextList[0].iterator();
- uriItr = contextList[1].iterator();
- while (uriItr.hasNext()) {
- tempPrefix = prefItr.next();
- tempUri = uriItr.next();
- if (operation.equalsIgnoreCase("getNSUri")) {
- toCompare = tempPrefix;
- } else if (operation.equalsIgnoreCase("getPrefix")) {
- toCompare = tempUri;
- } else if (operation.equalsIgnoreCase("getPrefixes")) {
- toCompare = tempUri;
- }
- if (toCompare != null && arg.equalsIgnoreCase(toCompare)) {
- if (operation.equalsIgnoreCase("getNSUri")) {
- return tempUri;
- } else if (operation.equalsIgnoreCase("getPrefix")) {
- return tempPrefix;
- } else if (operation.equalsIgnoreCase("getPrefixes")) {
- list.add(tempPrefix);
- }
-
- }
- }
- }
-
- if (operation.equalsIgnoreCase("getPrefixes")) {
- return Collections.unmodifiableList(list).iterator();
- }
-
- return null;
- }
-
-} //end of Class
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyXMLStreamReader.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyXMLStreamReader.java
deleted file mode 100644
index e1b218d9f4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/TuscanyXMLStreamReader.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.apache.tuscany.sca.contribution.processor;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Stack;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.util.StreamReaderDelegate;
-
-/*
- * Custom implementaion of the XMLStreamReader to keep track of the namespace context for each element
- */
-public class TuscanyXMLStreamReader extends StreamReaderDelegate implements XMLStreamReader {
-
- Stack<List<String>[]> context = new Stack<List<String>[]>();
-
- String characterEncodingScheme;
- List<String>[] contextList;
- List<String> prefixList;
- List<String> uriList;
-
- public TuscanyXMLStreamReader(XMLStreamReader reader) {
- super(reader);
- this.saveCharacterEncodingScheme();
- }
-
- public void pushContext() throws XMLStreamException {
- contextList = new List[2];
- prefixList = new ArrayList<String>();
- uriList = new ArrayList<String>();
- int namespaceCount = this.getNamespaceCount();
- for (int i = 0; i < namespaceCount; i++) {
- prefixList.add(checkString(this.getNamespacePrefix(i)));
- uriList.add(this.getNamespaceURI(i));
- }
- contextList[0] = prefixList;
- contextList[1] = uriList;
- context.push(contextList);
- }
-
- private String checkString(String namespacePrefix) {
- if (namespacePrefix == null) {
- return XMLConstants.DEFAULT_NS_PREFIX;
- } else {
- return namespacePrefix;
- }
- }
-
- public void popContext() throws XMLStreamException {
- context.pop();
- }
-
- public void saveCharacterEncodingScheme() {
- this.characterEncodingScheme = super.getCharacterEncodingScheme();
- }
-
- // A flag to indicate if the next() is called from nextTag()
- private boolean withinNextTagMethod = false;
-
- /*
- * Overriding the next() method to perform PUSH and POP operations
- * for the NamespaceContext for the current element
- */
- @Override
- public int next() throws XMLStreamException {
- // POP the namespaces if the reader leaves the end element
- if (!withinNextTagMethod && this.getEventType() == END_ELEMENT) {
- popContext();
- }
-
- // get the next event
- int nextEvent = super.next();
-
- // PUSH the namespaces onto the stack as the reader enters the start element
- if (!withinNextTagMethod && nextEvent == START_ELEMENT) {
- pushContext();
- }
- return nextEvent;
- }
-
- @Override
- public int nextTag() throws XMLStreamException {
- withinNextTagMethod = true;
- // POP the namespaces out of the stack if the reader leaves the end element
- if (this.getEventType() == END_ELEMENT) {
- popContext();
- }
-
- // REVIEW: what if nextTag() calls next()?
- int event = super.nextTag();
-
- // PUSH the namespaces onto the stack as the reader enters the start element
- if (event == START_ELEMENT) {
- pushContext();
- }
- withinNextTagMethod = false;
- return event;
- }
-
- @Override
- public NamespaceContext getNamespaceContext() {
- return new TuscanyNamespaceContext((Stack<List<String>[]>)context.clone());
- }
-
-
- @Override
- public String getCharacterEncodingScheme() {
- return characterEncodingScheme;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.java
deleted file mode 100644
index 2ecddf5465..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessor.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.contribution.processor;
-
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * An artifact processor that can read models from a URL.
- *
- * @version $Rev$ $Date$
- */
-public interface URLArtifactProcessor<M> extends ArtifactProcessor<M> {
-
- /**
- * Reads a model from a URL.
- *
- * @param contributionURL Contribution location URL
- * @param artifactURI Artifact URI
- * @param artifactURL Artifact location URL
- * @return A model representation of the input.
- */
- M read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException;
-
- /**
- * Returns the type of artifact handled by this artifact processor.
- *
- * @return The type of artifact handled by this artifact processor
- */
- String getArtifactType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.java
deleted file mode 100644
index 7714586951..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/URLArtifactProcessorExtensionPoint.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.contribution.processor;
-
-/**
- * An extension point for URL artifact processors.
- *
- * @version $Rev$ $Date$
- */
-public interface URLArtifactProcessorExtensionPoint extends
- ArtifactProcessorExtensionPoint<URLArtifactProcessor> {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.java
deleted file mode 100644
index da249a09e4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLInputFactory.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.contribution.processor;
-
-import javax.xml.stream.XMLInputFactory;
-
-/**
- * Base marker class for validating XML input factories.
- *
- * @version $Rev$ $Date$
- */
-public abstract class ValidatingXMLInputFactory extends XMLInputFactory {
-
- /**
- * Create a new default validating XML input factory.
- * @return
- */
- public static ValidatingXMLInputFactory newInstance() {
- return new DefaultValidatingXMLInputFactory(
- XMLInputFactory.newInstance(),
- new DefaultValidationSchemaExtensionPoint(),
- null);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
deleted file mode 100644
index 9b4a4938d1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidatingXMLStreamReader.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.util.logging.Logger;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.validation.Schema;
-import javax.xml.validation.ValidatorHandler;
-
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- *
- * A validating XMLStreamReader that reports XMLSchema validation errors.
- *
- * @version $Rev$ $Date$
- */
-class ValidatingXMLStreamReader extends TuscanyXMLStreamReader implements XMLStreamReader {
-
- private static final Logger logger = Logger.getLogger(ValidatingXMLStreamReader.class.getName());
-
- private int level;
- private ValidatorHandler handler;
- private final Monitor monitor;
-
- /**
- * Constructs a new ValidatingXMLStreamReader.
- *
- * @param reader
- * @param schema
- * @throws XMLStreamException
- */
- ValidatingXMLStreamReader(XMLStreamReader reader, Schema schema, Monitor monitor) throws XMLStreamException {
- super(reader);
- this.monitor = monitor;
- if (schema == null) {
- return;
- }
-
- handler = schema.newValidatorHandler();
- handler.setDocumentLocator(new LocatorAdapter());
- try {
- handler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- } catch (SAXException e) {
- XMLStreamException xse = new XMLStreamException(e);
- error("XMLStreamException", handler, xse);
- throw xse;
- }
-
- // These validation errors are just warnings for us as we want to support
- // running from an XML document with XSD validation errors, as long as we can
- // get the metadata we need from the document
- handler.setErrorHandler(new ErrorHandler() {
- private String getMessage(SAXParseException e) {
- return "XMLSchema validation problem in: " + e.getSystemId() + ", line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + "\n" + e.getMessage();
- }
-
- public void error(SAXParseException exception) throws SAXException {
- if (ValidatingXMLStreamReader.this.monitor == null)
- logger.warning(getMessage(exception));
- else
- ValidatingXMLStreamReader.this.error("SchemaError", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
- exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
- }
-
- public void fatalError(SAXParseException exception) throws SAXException {
- if (ValidatingXMLStreamReader.this.monitor == null)
- logger.warning(getMessage(exception));
- else
- ValidatingXMLStreamReader.this.error("SchemaFatalError", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
- exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
- }
-
- public void warning(SAXParseException exception) throws SAXException {
- if (ValidatingXMLStreamReader.this.monitor == null)
- logger.warning(getMessage(exception));
- else
- ValidatingXMLStreamReader.this.warning("SchemaWarning", ValidatingXMLStreamReader.this.getClass(), exception.getSystemId(),
- exception.getLineNumber(), exception.getColumnNumber(), exception.getMessage());
- }
- });
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- @Override
- public int next() throws XMLStreamException {
- if (handler == null) {
- return super.next();
- }
-
- int event = super.next();
- try {
- switch (event) {
- case XMLStreamConstants.START_DOCUMENT:
- level++;
- handler.startDocument();
- break;
- case XMLStreamConstants.START_ELEMENT:
- level++;
- handleStartElement();
- break;
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- handler.processingInstruction(super.getPITarget(), super.getPIData());
- break;
- case XMLStreamConstants.CHARACTERS:
- case XMLStreamConstants.CDATA:
- case XMLStreamConstants.SPACE:
- case XMLStreamConstants.ENTITY_REFERENCE:
- handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
- break;
- case XMLStreamConstants.END_ELEMENT:
- handleEndElement();
- level--;
- break;
- case XMLStreamConstants.END_DOCUMENT:
- handler.endDocument();
- break;
- }
- } catch (SAXException e) {
- XMLStreamException xse = new XMLStreamException(e.getMessage(), e);
- error("XMLStreamException", handler, xse);
- throw xse;
- }
- return event;
- }
-
- @Override
- public int nextTag() throws XMLStreamException {
- if (handler == null) {
- return super.nextTag();
- }
-
- for (;;) {
- int event = super.getEventType();
- try {
- switch (event) {
- case XMLStreamConstants.START_DOCUMENT:
- level++;
- handler.startDocument();
- break;
- case XMLStreamConstants.START_ELEMENT:
- level++;
- handleStartElement();
- pushContext();
- return event;
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- handler.processingInstruction(super.getPITarget(), super.getPIData());
- break;
- case XMLStreamConstants.CHARACTERS:
- case XMLStreamConstants.CDATA:
- case XMLStreamConstants.SPACE:
- case XMLStreamConstants.ENTITY_REFERENCE:
- handler.characters(super.getTextCharacters(), super.getTextStart(), super.getTextLength());
- break;
- case XMLStreamConstants.END_ELEMENT:
- handleEndElement();
- level--;
- popContext();
- return event;
- case XMLStreamConstants.END_DOCUMENT:
- handler.endDocument();
- return event;
- }
- } catch (SAXException e) {
- XMLStreamException xse = new XMLStreamException(e);
- error("XMLStreamException", handler, xse);
- throw xse;
- }
- super.next();
- }
- }
-
- @Override
- public String getElementText() throws XMLStreamException {
- if (handler == null) {
- return super.getElementText();
- }
-
- if (getEventType() != XMLStreamConstants.START_ELEMENT) {
- return super.getElementText();
- }
- StringBuffer text = new StringBuffer();
-
- for (;;) {
- int event = next();
- switch (event) {
- case XMLStreamConstants.END_ELEMENT:
- return text.toString();
-
- case XMLStreamConstants.COMMENT:
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- continue;
-
- case CHARACTERS:
- case CDATA:
- case SPACE:
- case ENTITY_REFERENCE:
- text.append(getText());
- break;
-
- default:
- break;
- }
- }
- }
-
- @Override
- public NamespaceContext getNamespaceContext(){
- return super.getNamespaceContext();
- }
-
- /**
- * Handle a start element event.
- *
- * @throws SAXException
- */
- private void handleStartElement() throws SAXException {
-
- // send startPrefixMapping events immediately before startElement event
- int nsCount = super.getNamespaceCount();
- for (int i = 0; i < nsCount; i++) {
- String prefix = super.getNamespacePrefix(i);
- if (prefix == null) { // true for default namespace
- prefix = "";
- }
- handler.startPrefixMapping(prefix, super.getNamespaceURI(i));
- }
-
- // fire startElement
- QName qname = super.getName();
- String prefix = qname.getPrefix();
- String rawname;
- if (prefix == null || prefix.length() == 0) {
- rawname = qname.getLocalPart();
- } else {
- rawname = prefix + ':' + qname.getLocalPart();
- }
- Attributes attrs = getAttributes();
- handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
- }
-
- /**
- * Handle an endElement event.
- *
- * @throws SAXException
- */
- private void handleEndElement() throws SAXException {
-
- // fire endElement
- QName qname = super.getName();
- handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString());
-
- // send endPrefixMapping events immediately after endElement event
- // we send them in the opposite order to that returned but this is not
- // actually required by SAX
- int nsCount = super.getNamespaceCount();
- for (int i = nsCount - 1; i >= 0; i--) {
- String prefix = super.getNamespacePrefix(i);
- if (prefix == null) { // true for default namespace
- prefix = "";
- }
- handler.endPrefixMapping(prefix);
- }
- }
-
- /**
- * Get the attributes associated with the current START_ELEMENT event.
- *
- * @return the StAX attributes converted to org.xml.sax.Attributes
- */
- private Attributes getAttributes() {
- AttributesImpl attrs = new AttributesImpl();
-
- // add namespace declarations
- for (int i = 0; i < super.getNamespaceCount(); i++) {
- String prefix = super.getNamespacePrefix(i);
- String uri = super.getNamespaceURI(i);
- if (prefix == null) {
- attrs.addAttribute("", "", "xmlns", "CDATA", uri);
- } else {
- attrs.addAttribute("", "", "xmlns:" + prefix, "CDATA", uri);
- }
- }
-
- // Regular attributes
- for (int i = 0; i < super.getAttributeCount(); i++) {
- String uri = super.getAttributeNamespace(i);
- if (uri == null) {
- uri = "";
- }
- String localName = super.getAttributeLocalName(i);
- String prefix = super.getAttributePrefix(i);
- String qname;
- if (prefix == null || prefix.length() == 0) {
- qname = localName;
- } else {
- qname = prefix + ':' + localName;
- }
- String type = super.getAttributeType(i);
- String value = super.getAttributeValue(i);
-
- attrs.addAttribute(uri, localName, qname, type, value);
- }
-
- return attrs;
- }
-
- /**
- * Adapter for mapping Locator information.
- */
- private final class LocatorAdapter implements Locator {
-
- private LocatorAdapter() {
- }
-
- public int getColumnNumber() {
- Location location = getLocation();
- return location == null ? 0 : location.getColumnNumber();
- }
-
- public int getLineNumber() {
- Location location = getLocation();
- return location == null ? 0 : location.getLineNumber();
- }
-
- public String getPublicId() {
- Location location = getLocation();
- return location == null ? "" : location.getPublicId();
- }
-
- public String getSystemId() {
- Location location = getLocation();
- return location == null ? "" : location.getSystemId();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java
deleted file mode 100644
index cc3bb59a5b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/ValidationSchemaExtensionPoint.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.processor;
-
-import java.util.List;
-
-
-/**
- * An extension point for XML schemas used for validation.
- *
- * @version $Rev$ $Date$
- */
-public interface ValidationSchemaExtensionPoint {
-
- /**
- * Add a schema.
- *
- * @param uri the URI of the schema
- */
- void addSchema(String uri);
-
- /**
- * Remove a schema.
- *
- * @param uri the URI of the schema
- */
- void removeSchema(String uri);
-
- /**
- * Returns the list of schemas registered in the extension point.
- * @return the list of schemas
- */
- List<String> getSchemas();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.java
deleted file mode 100644
index f3555ee71e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ClassReference.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.contribution.resolver;
-
-import java.lang.ref.WeakReference;
-
-import org.apache.tuscany.sca.assembly.Base;
-
-/**
- * A weak reference to a class, which should be used to register classes
- * with an ArtifactResolver and resolve these classes later.
- *
- * FIXME The core contribution model should not have dependencies on classes
- * and ClassLoaders. This should move to the Java import support module.
- *
- * @version $Rev$ $Date$
- */
-public class ClassReference implements Base {
-
- private WeakReference<Class<?>> clazz;
- private String className;
-
- /**
- * Constructs a new ClassReference.
- *
- * @param clazz The class reference
- */
- public ClassReference(Class<?> clazz) {
- this.clazz = new WeakReference<Class<?>>(clazz);
- this.className = clazz.getName();
- }
-
- /**
- * Constructs a new ClassReference.
- *
- * @param className The class name
- */
- public ClassReference(String className) {
- this.className = className;
- }
-
- /**
- * Get the referenced class.
- *
- * @return The referenced class
- */
- public Class<?> getJavaClass() {
- if (clazz != null) {
- return clazz.get();
- } else {
- return null;
- }
- }
-
- /**
- * Get the referenced class name.
- *
- * @return The class name
- */
- public String getClassName() {
- return className;
- }
-
- public boolean isUnresolved() {
- return clazz == null;
- }
-
- public void setUnresolved(boolean unresolved) {
- throw new IllegalStateException();
- }
-
- @Override
- public int hashCode() {
- return className.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof ClassReference) {
- return className.equals(((ClassReference)obj).className);
- } else {
- return false;
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.java
deleted file mode 100644
index 13c622adf0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultDelegatingModelResolver.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.contribution.resolver;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Base;
-
-/**
- * A model resolver implementation that delegates to a list of model resolvers.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultDelegatingModelResolver implements ModelResolver {
-
- private List<ModelResolver> resolvers;
-
- public DefaultDelegatingModelResolver(List<ModelResolver> resolvers) {
- this.resolvers = resolvers;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- //TODO optimize and cache results of the resolution later
-
- // Go over all resolvers
- for (ModelResolver resolver: resolvers) {
-
- Object resolved = resolver.resolveModel(modelClass, unresolved);
-
- // Return the resolved model object
- if (resolved instanceof Base) {
- if (!((Base)resolved).isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
-
- // Model object was not resolved
- return unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.java
deleted file mode 100644
index c6facd2b02..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportAllModelResolver.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.contribution.resolver;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-
-/**
- * A model resolver implementation that considers Exports in a list of contributions.
- *
- * @version $Rev: 560435 $ $Date: 2007-07-27 18:26:55 -0700 (Fri, 27 Jul 2007) $
- */
-public class DefaultImportAllModelResolver implements ModelResolver {
-
- private Import import_;
- private List<Contribution> contributions;
-
- public DefaultImportAllModelResolver(Import import_, List<Contribution> contributions) {
- this.import_ = import_;
- this.contributions = contributions;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- //TODO optimize and cache results of the resolution later
-
- // Go over all available contributions
- for (Contribution contribution : contributions) {
-
- // Go over all exports in the contribution
- for (Export export : contribution.getExports()) {
-
- // If the export matches the export, try to resolve the model object
- if (import_.match(export)) {
- Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
-
- // Return the resolved model object
- if (resolved instanceof Base) {
- if (!((Base)resolved).isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- }
-
- // Model object was not resolved
- return unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java
deleted file mode 100644
index 9ae57c41d0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultImportModelResolver.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.contribution.Export;
-
-/**
- * A model resolver implementation that delegates to a list of exports.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultImportModelResolver implements ModelResolver {
-
- private List<Export> exports;
-
- public DefaultImportModelResolver(List<Export> exports) {
- this.exports = exports;
- }
-
- public void addModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public Object removeModel(Object resolved) {
- throw new IllegalStateException();
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- //TODO optimize and cache results of the resolution later
-
- // Go over all exports
- for (Export export: exports) {
-
- Object resolved = export.getModelResolver().resolveModel(modelClass, unresolved);
-
- // Return the resolved model object
- if (resolved instanceof Base) {
- if (!((Base)resolved).isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
-
- // Model object was not resolved
- return unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.java
deleted file mode 100644
index bf175813f3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolver.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.contribution.resolver;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * A default implementation of a model resolver based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultModelResolver implements ModelResolver {
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- public DefaultModelResolver() {
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
- // FIXME: TUSCANY-2499: temporarily give access to the models to get the jms binding
- // use of definitions.xml working while the definitions.xml processing is being refactored
- public Map getModels() {
- return map;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java
deleted file mode 100644
index 61a6d084f2..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/DefaultModelResolverExtensionPoint.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.resolver;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-
-/**
- * The default implementation of a model resolver extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultModelResolverExtensionPoint implements ModelResolverExtensionPoint {
- private final ExtensionPointRegistry registry;
- private final Map<Class<?>, Class<? extends ModelResolver>> resolvers = new HashMap<Class<?>, Class<? extends ModelResolver>>();
- private Map<String, ServiceDeclaration> loadedResolvers;
-
- /**
- * Constructs a new DefaultModelResolverExtensionPoint.
- * @param registry The ExtensionPointRegistry
- */
- public DefaultModelResolverExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- public void addResolver(Class<?> modelType, Class<? extends ModelResolver> resolver) {
- resolvers.put(modelType, resolver);
- }
-
- public void removeResolver(Class<?> modelType) {
- resolvers.remove(modelType);
- }
-
- @SuppressWarnings("unchecked")
- public Class<? extends ModelResolver> getResolver(Class<?> modelType) {
- loadModelResolvers();
-
- Class<?>[] classes = modelType.getInterfaces();
- for (Class<?> c : classes) {
- Class<? extends ModelResolver> resolver = resolvers.get(c);
- if (resolver == null) {
- ServiceDeclaration resolverClass = loadedResolvers.get(c.getName());
- if (resolverClass != null) {
- try {
- return (Class<? extends ModelResolver>)resolverClass.loadClass();
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- }
- }
- } else {
- return resolver;
- }
- }
-
- Class<? extends ModelResolver > resolver = resolvers.get(modelType);
- if (resolver == null) {
- ServiceDeclaration resolverClass = loadedResolvers.get(modelType.getName());
- if (resolverClass != null) {
- try {
- return (Class<? extends ModelResolver>)resolverClass.loadClass();
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- }
- }
- }
- return resolver;
- }
-
- /**
- * Dynamically load model resolvers declared under META-INF/services
- */
- private synchronized void loadModelResolvers() {
- if (loadedResolvers != null)
- return;
- loadedResolvers = new HashMap<String, ServiceDeclaration>();
-
- // Get the model resolver service declarations
- Set<ServiceDeclaration> modelResolverDeclarations;
- try {
- modelResolverDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModelResolver.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load model resolvers
- for (ServiceDeclaration modelResolverDeclaration: modelResolverDeclarations) {
- Map<String, String> attributes = modelResolverDeclaration.getAttributes();
- String model = attributes.get("model");
-
- loadedResolvers.put(model, modelResolverDeclaration);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
deleted file mode 100644
index 04352fd242..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.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.contribution.resolver;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * An implementation of an extensible model resolver which delegates to the
- * proper resolver extension based on the class of the model to resolve.
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleModelResolver implements ModelResolver {
- private ExtensionPointRegistry extensionPoints;
- private final ModelResolverExtensionPoint resolverExtensions;
- private final ModelFactoryExtensionPoint modelFactories;
- private final Contribution contribution;
- private ModelResolver defaultResolver;
- private final Map<Class<?>, ModelResolver> resolversByModelType = new HashMap<Class<?>, ModelResolver>();
- private final Map<Class<?>, ModelResolver> resolversByImplementationClass = new HashMap<Class<?>, ModelResolver>();
- private Map<Object, Object> map = new HashMap<Object, Object>();
- private Object lastUnresolved;
-
- /**
- * Constructs an extensible model resolver
- *
- * @param contribution
- * @param extensionPoints TODO
- * @param resolverExtensions
- * @param modelFactories
- * @param defaultResolver
- */
- @Deprecated
- public ExtensibleModelResolver(Contribution contribution,
- ExtensionPointRegistry extensionPoints,
- ModelResolverExtensionPoint resolverExtensions,
- ModelFactoryExtensionPoint modelFactories, ModelResolver defaultResolver) {
- this.contribution = contribution;
- this.extensionPoints = extensionPoints;
- this.resolverExtensions = resolverExtensions;
- this.modelFactories = modelFactories;
- //FIXME Remove this default resolver, this is currently used to resolve policy declarations
- // but they should be handled by the contribution import/export mechanism instead of this
- // defaultResolver hack.
- this.defaultResolver = defaultResolver;
- }
-
- /**
- * @param contribution
- * @param extensionPoints
- */
- public ExtensibleModelResolver(Contribution contribution, ExtensionPointRegistry extensionPoints) {
- this.contribution = contribution;
- this.extensionPoints = extensionPoints;
- this.resolverExtensions = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- }
-
- /**
- * Returns the proper resolver instance based on the interfaces of the model
- * If one is not available on the registry, instantiate on demand
- *
- * @param modelType
- * @return
- */
- private ModelResolver getModelResolverInstance(Class<?> modelType) {
- // Look up a model resolver instance for the model class or
- // each implemented interface
- Class<?>[] interfaces = modelType.getInterfaces();
- Class<?>[] classes = new Class<?>[interfaces.length + 1];
- classes[0] = modelType;
- if (interfaces.length != 0) {
- System.arraycopy(interfaces, 0, classes, 1, interfaces.length);
- }
- for (Class<?> c : classes) {
-
- // Look up an existing model resolver instance
- ModelResolver resolverInstance = resolversByModelType.get(c);
- if (resolverInstance != null) {
- return resolverInstance;
- }
-
- // We don't have an instance, lookup a model resolver class
- // and instantiate it
- Class<? extends ModelResolver> resolverClass = resolverExtensions.getResolver(c);
- if (resolverClass != null) {
-
- // Construct the model resolver instance and cache it
- resolverInstance = resolversByImplementationClass.get(resolverClass);
- if (resolverInstance != null) {
- resolversByModelType.put(c, resolverInstance);
- return resolverInstance;
- }
- try {
- try {
- Constructor<? extends ModelResolver> constructor =
- resolverClass.getConstructor(new Class[] {Contribution.class,
- ModelFactoryExtensionPoint.class});
- if (constructor != null) {
-
- resolverInstance = constructor.newInstance(contribution, modelFactories);
- resolversByImplementationClass.put(resolverClass, resolverInstance);
- resolversByModelType.put(c, resolverInstance);
- return resolverInstance;
- }
- } catch (NoSuchMethodException e) {
- Constructor<? extends ModelResolver> constructor =
- resolverClass.getConstructor(new Class[] {Contribution.class,
- ExtensionPointRegistry.class});
- if (constructor != null) {
-
- resolverInstance = constructor.newInstance(contribution, extensionPoints);
- resolversByImplementationClass.put(resolverClass, resolverInstance);
- resolversByModelType.put(c, resolverInstance);
- return resolverInstance;
- }
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- }
-
- return null;
- }
-
- public void addModel(Object resolved) {
- ModelResolver resolver = getModelResolverInstance(resolved.getClass());
- if (resolver != null) {
- resolver.addModel(resolved);
- } else {
- map.put(resolved, resolved);
- }
- }
-
- public Object removeModel(Object resolved) {
- ModelResolver resolver = getModelResolverInstance(resolved.getClass());
- if (resolver != null) {
- return resolver.removeModel(resolved);
- } else {
- return map.remove(resolved);
- }
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- // Protect against dependency cycles causing infinite recursion
- // Save the current unresolved object and check later if we are trying
- // to resolve the same object again
- if (unresolved == lastUnresolved) {
- return unresolved;
- }
- lastUnresolved = unresolved;
-
- ModelResolver resolver = getModelResolverInstance(unresolved.getClass());
- if (resolver != null) {
- Object resolved = resolver.resolveModel(modelClass, unresolved);
- if (resolved != null && resolved != unresolved) {
- lastUnresolved = null;
- return modelClass.cast(resolved);
- }
- } else {
- //FIXME Remove this default resolver, this is currently used to resolve policy declarations
- // but they should be handled by the contribution import/export mechanism instead of this
- // defaultResolver hack.
- if (defaultResolver != null) {
- Object resolved = defaultResolver.resolveModel(modelClass, unresolved);
- if (resolved != null && resolved != unresolved) {
- lastUnresolved = null;
- return modelClass.cast(resolved);
- }
- }
-
- Object resolved = map.get(unresolved);
- if (resolved != null) {
- // Return the resolved object
- lastUnresolved = null;
- return modelClass.cast(resolved);
- }
- }
-
- return unresolved;
- }
-
- // FIXME: TUSCANY-2499: temporarily give access to the defaultResolver to get the jms binding
- // use of definitions.xml working while the definitions.xml processing is being refactored
- public ModelResolver getDefaultModelResolver() {
- return defaultResolver;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
deleted file mode 100644
index 2831bebbc4..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolver.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-/**
- * A model resolver, responsible for resolving models in the scope of an
- * SCA contribution.
- *
- * SCA Assemblies reference artifacts of a wide variety of types. These
- * include:
- * <ul>
- * <li> Reference from one SCA composite to another SCA composite
- * <li> Reference to PolicySet files
- * <li> Reference to interface definition files, either WSDL or Java interfaces
- * <li> Reference to XSD files
- * <li> Reference to any of a wide variety of implementation artifact files,
- * including Java classes, BPEL scripts, C++ DLLs and classes, PHP scripts
- * </ul>
- *
- * In the SCA assemblies, these various artifacts are referenced using either
- * QNames or logical URIs. Model resolvers are used to resolve these references
- * and get the in-memory models representing the referenced artifacts.
- *
- * @version $Rev$ $Date$
- */
-public interface ModelResolver {
-
- /**
- * Resolve the model representing an artifact.
- *
- * @param modelClass the type of artifact
- * @param unresolved the unresolved model
- * @return the resolved model
- */
- <T> T resolveModel(Class<T> modelClass, T unresolved);
-
- /**
- * Add a resolved model.
- *
- * @param resolved The model
- */
- void addModel(Object resolved);
-
- /**
- * Remove a resolved model.
- *
- * @param resolved
- * @return The removed model, or null if the model was not removed
- */
- Object removeModel(Object resolved);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java
deleted file mode 100644
index 4a25059792..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ModelResolverExtensionPoint.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-
-/**
- * An extension point for model resolvers
- *
- * @version $Rev$ $Date$
- */
-public interface ModelResolverExtensionPoint {
-
- /**
- * Register a model resolver class using the model type as the key
- *
- * @param modelType The model type
- * @param resolver The model resolver Class
- */
- void addResolver(Class<?> modelType, Class <? extends ModelResolver> resolver);
-
- /**
- * Remove the model resolver class for a specific model type
- *
- * @param modelType The model type
- */
- void removeResolver(Class<?> modelType);
-
- /**
- * Retrieve a model resolver class for a specific model type
- *
- * @param modelType The model artifact type
- * @return The model resolver Class
- */
- Class <? extends ModelResolver> getResolver(Class<?> modelType);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.java
deleted file mode 100644
index 74f0f2d71d..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResolverExtension.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.contribution.resolver;
-
-/**
- * Extension to assembly model implementations to provide a model resolver.
- *
- * @version $Rev$ $Date$
- */
-public interface ResolverExtension {
-
- /**
- * Returns the model resolver for the models representing the artifacts
- * visible in the scope of this contribution.
- *
- * @return The model resolver
- */
- ModelResolver getModelResolver();
-
- /**
- * Sets the model resolver for the models representing the artifacts
- * visible in the scope of this contribution.
- *
- * @param modelResolver The model resolver
- */
- void setModelResolver(ModelResolver modelResolver);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java
deleted file mode 100644
index 2394f4510b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ResourceReference.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.resolver;
-
-import java.net.URL;
-
-/**
- * A resource URL, which should be used to register resources
- * with an ArtifactResolver and resolve these resources later.
- *
- * FIXME Don't use as its deprecated, use Artifact instead.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class ResourceReference {
-
- private URL resourceURL;
- private String resourceName;
-
- /**
- * Constructs a new ResourceReference.
- *
- * @param resourceName Name of resource
- * @param resourceURL The resource URL
- */
- public ResourceReference(String resourceName, URL resourceURL) {
- this.resourceURL = resourceURL;
- this.resourceName = resourceName;
- }
-
- /**
- * Constructs a new ResourceReference.
- *
- * @param resourceName Name of resource
- */
- public ResourceReference(String resourceName) {
- this.resourceName = resourceName;
- }
-
- /**
- * Get the resource URL.
- *
- * @return The resource URL
- */
- public URL getResource() {
- return resourceURL;
- }
-
- /**
- * Get the resource name.
- *
- * @return The resource name
- */
- public String getResourceName() {
- return resourceName;
- }
-
- /**
- * Returns true if the resource reference is unresolved.
- *
- * @return Whether or not the resource has been resolved
- */
- public boolean isUnresolved() {
- return resourceURL == null;
- }
-
- @Override
- public int hashCode() {
- return resourceName.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else {
- if (obj instanceof ResourceReference) {
- return resourceName.equals(((ResourceReference)obj).resourceName);
- } else {
- return false;
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java
deleted file mode 100644
index 2d03381c8a..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScanner.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.scanner;
-
-import java.net.URL;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * Interface for contribution package scanners
- *
- * Contribution scanners understand the format of the contribution and how to get the
- * artifacts in the contribution.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionScanner {
-
- /**
- * Returns the type of package supported by this package scanner.
- *
- * @return the package type
- */
- String getContributionType();
-
- /**
- * Returns a list of artifacts in the contribution.
- *
- * @param contributionURL Contribution URL
- * @return List of artifact URIs
- * @throws ContributionException
- * @throws IOException
- */
- List<String> getArtifacts(URL contributionURL) throws ContributionReadException;
-
- /**
- * Return the URL for an artifact in the contribution.
- *
- * This is needed for archives such as jar files that have specific URL schemes
- * for the artifacts they contain.
- *
- * @param contributionURL Contribution URL
- * @param artifact The relative URI for the artifact
- * @return The artifact URL
- */
- URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java
deleted file mode 100644
index 1ca9def4ea..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/ContributionScannerExtensionPoint.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.scanner;
-
-/**
- * An extension point for contribution scanners
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionScannerExtensionPoint {
-
- /**
- * Add a ContributionScanner using the contribution type as the key.
- *
- * @param scanner The contribution scanner
- */
- void addContributionScanner(ContributionScanner scanner);
-
- /**
- * Remove a ContributionScanner.
- *
- * @param scanner The contribution scanner
- */
- void removeContributionScanner(ContributionScanner scanner);
-
- /**
- * Returns the ContributionScanner for the given contribution type.
- *
- * @param contributionType The contribution type
- * @return The contribution scanner
- */
- ContributionScanner getContributionScanner(String contributionType);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java
deleted file mode 100644
index cca1ae7a30..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/scanner/DefaultContributionScannerExtensionPoint.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.scanner;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a contribution scanner extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultContributionScannerExtensionPoint implements ContributionScannerExtensionPoint {
-
- private Map<String, ContributionScanner> scanners = new HashMap<String, ContributionScanner>();
- private boolean loaded;
-
- public DefaultContributionScannerExtensionPoint() {
- }
-
- public void addContributionScanner(ContributionScanner scanner) {
- scanners.put(scanner.getContributionType(), scanner);
- }
-
- public void removeContributionScanner(ContributionScanner scanner) {
- scanners.remove(scanner.getContributionType());
- }
-
- public ContributionScanner getContributionScanner(String contentType) {
- loadScanners();
- return scanners.get(contentType);
- }
-
- private synchronized void loadScanners() {
- if (loaded)
- return;
-
- // Get the scanner service declarations
- Set<ServiceDeclaration> scannerDeclarations;
- try {
- scannerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionScanner.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- for (ServiceDeclaration scannerDeclaration: scannerDeclarations) {
- Map<String, String> attributes = scannerDeclaration.getAttributes();
-
- // Load a URL artifact scanner
- String contributionType = attributes.get("type");
-
- // Create a scanner wrapper and register it
- ContributionScanner scanner = new LazyContributionScanner(contributionType, scannerDeclaration);
- addContributionScanner(scanner);
- }
-
- loaded = true;
- }
-
- /**
- * A facade for contribution scanners.
- */
- private static class LazyContributionScanner implements ContributionScanner {
-
- private ServiceDeclaration scannerDeclaration;
- private String contributionType;
- private ContributionScanner scanner;
-
- private LazyContributionScanner(String contributionType, ServiceDeclaration scannerDeclaration) {
- this.scannerDeclaration = scannerDeclaration;
- this.contributionType = contributionType;
- }
-
- public URL getArtifactURL(URL contributionSourceURL, String artifact) throws ContributionReadException {
- return getScanner().getArtifactURL(contributionSourceURL, artifact);
- }
-
- public List<String> getArtifacts(URL contributionSourceURL) throws ContributionReadException {
- return getScanner().getArtifacts(contributionSourceURL);
- }
-
- public String getContributionType() {
- return contributionType;
- }
-
- private ContributionScanner getScanner() {
- if (scanner == null) {
- try {
- Class<ContributionScanner> scannerClass = (Class<ContributionScanner>)scannerDeclaration.loadClass();
- Constructor<ContributionScanner> constructor = scannerClass.getConstructor();
- scanner = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return scanner;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.java
deleted file mode 100644
index e183206894..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionException.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.contribution.service;
-
-/**
- * Base class for exceptions raised by contribution services.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionException extends Exception {
-
- private static final long serialVersionUID = 4432880414927652578L;
-
- protected ContributionException() {
- super();
- }
-
- protected ContributionException(String message) {
- super(message);
- }
-
- protected ContributionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ContributionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java
deleted file mode 100644
index 5158eaf85c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service;
-
-import java.util.EventListener;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-
-/**
- * A listener interface used to listen to contribution repository events.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionListener extends EventListener {
-
- /**
- * Notifies the listener that a contribution has been added.
- *
- * @param repository The contribution repository
- * @param contribution The new contribution
- */
- void contributionAdded(ContributionRepository repository, Contribution contribution);
-
- /**
- * Notifies the listener that a contribution has been removed.
- *
- * @param repository The contribution repository
- * @param contribution The removed contribution.
- */
- void contributionRemoved(ContributionRepository repository, Contribution contribution);
-
- /**
- * Notifies the listener that a contribution has been updated.
- *
- * @param repository The contribution repository
- * @param oldContribution The old contribution
- * @param contribution The new contribution
- */
- void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.java
deleted file mode 100644
index ce2b4b13c3..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionListenerExtensionPoint.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.contribution.service;
-
-import java.util.List;
-
-public interface ContributionListenerExtensionPoint {
-
- /**
- * Adds a contribution repository listener extension.
- * @param listener The listener to add
- */
- void addContributionListener(ContributionListener listener);
-
- /**
- * Removes a contribution repository listener extension.
- * @param listener The listener to remove
- */
- void removeContributionListener(ContributionListener listener);
-
- /**
- * Returns the contribution repository listeners.
- * @return
- */
- List<ContributionListener> getContributionListeners();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.java
deleted file mode 100644
index 33399dcc2f..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionReadException.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.contribution.service;
-
-/**
- * Denotes an exception while reading artifacts inside an SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionReadException extends ContributionException {
- public static final int UNDEFINED = -1;
- private static final long serialVersionUID = -7459051598906813461L;
- private String resourceURI;
- private int line = UNDEFINED;
- private int column = UNDEFINED;
-
- public ContributionReadException(String message) {
- super(message);
- }
-
- public ContributionReadException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ContributionReadException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns the location of the resource that was being read.
- *
- * @return the location of the resource that was being read
- */
- public String getResourceURI() {
- return resourceURI;
- }
-
- /**
- * Sets the location of the resource that was being read.
- *
- * @param resourceURI the location of the resource that was being read
- */
- public void setResourceURI(String resourceURI) {
- this.resourceURI = resourceURI;
- }
-
- /**
- * Returns the line inside the resource that was being read.
- * @return the line inside the resource that was being read
- */
- public int getLine() {
- return line;
- }
-
- /**
- * Sets the line inside the resource that was being read.
- * @param line the line inside the resource that was being read
- */
- public void setLine(int line) {
- this.line = line;
- }
-
- /**
- * Returns the column inside the resource that was being read.
- * @return the column inside the resource that was being read
- */
- public int getColumn() {
- return column;
- }
-
- /**
- * Sets the column inside the resource that was being read.
- * @param column the column inside the resource that was being read
- */
- public void setColumn(int column) {
- this.column = column;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.java
deleted file mode 100644
index d7d8216f66..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRepository.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.contribution.service;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-
-/**
- * Contribution repository
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionRepository {
-
- /**
- * Get the URI of the SCA domain
- *
- * @return The domain URI
- */
- URI getDomain();
-
- /**
- * Copies a contribution to the repository.
- *
- * @param contribution A URl pointing to the contribution being copied to
- * the repository
- * @param sourceURL URL of the source. this would be used to calculate the right
- * filename to be stored on the repository when a inputStream is being
- * provided
- * @param contributionStream InputStream with the content of the
- * distribution
- * @return A URL pointing to the content of the contribution in the
- * repository
- * @throws IOException
- */
- URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException;
- /**
- * Copy a contribution from the source URL to the repository
- *
- * @param contribution A URl pointing to the contribution being copied to
- * the repository
- * @param sourceURL URL of the source. this would be used to calculate the right
- * filename to be stored on the repository when a inputStream is being
- * provided
- * @return A URL pointing to the content of the contribution in the
- * repository
- * @throws IOException
- */
- URL store(String contribution, URL sourceURL) throws IOException;
-
- /**
- * Look up the contribution by URI
- *
- * @param contribution The URI of the contribution
- * @return A URL pointing to the content of the contribution in the
- * repository, it will be null if the contribution cannot be found
- * in the repository
- */
- URL find(String contribution);
-
- /**
- * Remove a contribution from the repository
- *
- * @param contribution The URI of the contribution to be removed
- */
- void remove(String contribution);
-
- /**
- * Get list of URIs for all the contributions in the repository
- *
- * @return A list of contribution URIs
- */
- List<String> list();
-
- /**
- * Returns the contributions available in the repository.
- * @return The list of contributions.
- */
- List<Contribution> getContributions();
-
- /**
- * Adds a contribution to the repository.
- * @param contribution The new contribution.
- */
- void addContribution(Contribution contribution);
-
- /**
- * Removes a contribution from the repository.
- * @param contribution The contribution to remove
- */
- void removeContribution(Contribution contribution);
-
- /**
- * Updates a contribution in the repository
- * @param contribution The contribution to update
- */
- void updateContribution(Contribution contribution);
-
- /**
- * Returns the contribution with the given URI.
- * @param uri the URI of the contribution
- * @return The contribution
- */
- Contribution getContribution(String uri);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.java
deleted file mode 100644
index ecb774ac0c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionResolveException.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.contribution.service;
-
-/**
- * Denotes a problem while resolving models inside an SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionResolveException extends ContributionException {
- private static final long serialVersionUID = -7459051598906813461L;
-
- public ContributionResolveException(String message) {
- super(message);
- }
-
- public ContributionResolveException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ContributionResolveException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.java
deleted file mode 100644
index 4bf29a3993..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionRuntimeException.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.contribution.service;
-
-/**
- * Base class for runtime exceptions raised by contribution services.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionRuntimeException extends RuntimeException {
- private static final long serialVersionUID = 7711215366287498896L;
-
- protected ContributionRuntimeException() {
- super();
- }
-
- protected ContributionRuntimeException(String message) {
- super(message);
- }
-
- protected ContributionRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ContributionRuntimeException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
deleted file mode 100644
index dcdb8733b8..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionService.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.service;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * Service interface that manages artifacts contributed to a Tuscany runtime.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionService {
- /**
- * Contribute an artifact to the SCA Domain. The type of the contribution is
- * determined by the Content-Type of the resource or, if that is undefined,
- * by some implementation-specific means (such as mapping an extension in
- * the URL's path).
- *
- * @param contributionURI The URI that is used as the contribution unique ID.
- * @param sourceURL The location of the resource containing the artifact
- * @param storeInRepository Flag that identifies if you want to copy the
- * contribution to the repository
- * @return The contribution model representing the contribution
- * @throws ContributionException if there was a problem with the contribution
- * @throws IOException if there was a problem reading the resource
- */
- Contribution contribute(String contributionURI, URL sourceURL, boolean storeInRepository) throws ContributionException,
- IOException;
-
- /**
- * Contribute an artifact to the SCA Domain. The type of the contribution is
- * determined by the Content-Type of the resource or, if that is undefined,
- * by some implementation-specific means (such as mapping an extension in
- * the URL's path).
- *
- * @param contributionURI The URI that is used as the contribution unique ID.
- * @param sourceURL The location of the resource containing the artifact
- * @param modelResolver The model resolver to use to resolve models in the
- * scope of this contribution
- * @param storeInRepository Flag that identifies if you want to copy the
- * contribution to the repository
- * @return The contribution model representing the contribution
- * @throws ContributionException if there was a problem with the contribution
- * @throws IOException if there was a problem reading the resource
- */
- Contribution contribute(String contributionURI, URL sourceURL, ModelResolver modelResolver, boolean storeInRepository) throws ContributionException,
- IOException;
-
- /**
- * Contribute an artifact to the SCA Domain.
- *
- * @param contributionURI The URI that is used as the contribution unique ID.
- * @param sourceURL The location of the resource containing the artifact.
- * This is used to identify what name should be used when storing
- * the contribution on the repository
- * @param contributionContent A stream containing the resource being
- * contributed; the stream will not be closed but the read
- * position after the call is undefined
- * @return The contribution model representing the contribution
- * @throws ContributionException if there was a problem with the contribution
- * @throws IOException if there was a problem reading the stream
- */
- Contribution contribute(String contributionURI, URL sourceURL, InputStream contributionContent)
- throws ContributionException, IOException;
-
- /**
- * Contribute an artifact to the SCA Domain.
- *
- * @param contributionURI The URI that is used as the contribution unique ID.
- * @param sourceURL The location of the resource containing the artifact.
- * This is used to identify what name should be used when storing
- * the contribution on the repository
- * @param modelResolver The model resolver to use to resolve models in the
- * scope of this contribution
- * @param contributionContent A stream containing the resource being
- * contributed; the stream will not be closed but the read
- * position after the call is undefined
- * @return The contribution model representing the contribution
- * @throws ContributionException if there was a problem with the contribution
- * @throws IOException if there was a problem reading the stream
- */
- Contribution contribute(String contributionURI, URL sourceURL, InputStream contributionContent, ModelResolver modelResolver)
- throws ContributionException, IOException;
-
- /**
- * Get the model for an installed contribution
- *
- * @param contribution The URI of an installed contribution
- * @return The model for the contribution or null if there is no such
- * contribution
- */
- Contribution getContribution(String contribution);
-
- /**
- * Adds or updates a deployment composite using a supplied composite
- * ("composite by value" - a data structure, not an existing resource in the
- * domain) to the contribution identified by a supplied contribution URI.
- * The added or updated deployment composite is given a relative URI that
- * matches the "name" attribute of the composite, with a ".composite"
- * suffix.
- *
- * @param contribution The contribution to where
- * @param composite
- * @throws ContributionException
- */
- void addDeploymentComposite(Contribution contribution, Composite composite) throws ContributionException;
-
- /**
- * Remove a contribution from the SCA domain
- *
- * @param contribution The URI of the contribution
- * @throws DeploymentException
- */
- void remove(String contribution) throws ContributionException;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.java
deleted file mode 100644
index 8bfdedf180..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ContributionWriteException.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.contribution.service;
-
-
-/**
- * Denotes an exception while writing artifacts inside an SCA contribution.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionWriteException extends ContributionException {
- private static final long serialVersionUID = -7459051598906813461L;
- private String resourceURI;
-
- public ContributionWriteException(String message) {
- super(message);
- }
-
- public ContributionWriteException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ContributionWriteException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Returns the location of the resource that was being written.
- *
- * @return the location of the resource that was being written
- */
- public String getResourceURI() {
- return resourceURI;
- }
-
- /**
- * Sets the location of the resource that was being written.
- *
- * @param resourceURI the location of the resource that was being written
- */
- public void setResourceURI(String resourceURI) {
- this.resourceURI = resourceURI;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java
deleted file mode 100644
index 1ab80e344b..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/DefaultContributionListenerExtensionPoint.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a contribution listener extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultContributionListenerExtensionPoint implements ContributionListenerExtensionPoint {
-
- private List<ContributionListener> listeners = new CopyOnWriteArrayList<ContributionListener>();
- private boolean loadedListeners;
- private ModelFactoryExtensionPoint modelFactories;
-
- /**
- * Constructs a new DefaultContributionListenerExtensionPoint.
- *
- */
- public DefaultContributionListenerExtensionPoint(ModelFactoryExtensionPoint modelFactories) {
- this.modelFactories = modelFactories;
- }
-
- /**
- * Constructs a new DefaultContributionListenerExtensionPoint.
- *
- */
- public DefaultContributionListenerExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- }
-
- public void addContributionListener(ContributionListener listener) {
- listeners.add(listener);
- }
-
- public List<ContributionListener> getContributionListeners() {
- loadListeners();
- return listeners;
- }
-
- public void removeContributionListener(ContributionListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Dynamically load listeners declared under META-INF/services
- */
- @SuppressWarnings("unchecked")
- private synchronized void loadListeners() {
- if (loadedListeners)
- return;
-
- // Get the listener service declarations
- Set<ServiceDeclaration> listenerDeclarations;
- try {
- listenerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ContributionListener.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load and instantiate the listeners
- for (ServiceDeclaration listenerDeclaration: listenerDeclarations) {
- ContributionListener listener;
- try {
- Class<ContributionListener> listenerClass = (Class<ContributionListener>)listenerDeclaration.loadClass();
- try {
- Constructor<ContributionListener> constructor = listenerClass.getConstructor(ModelFactoryExtensionPoint.class);
- try {
- listener = constructor.newInstance(modelFactories);
- } catch (InvocationTargetException e) {
- throw new IllegalArgumentException(e);
- }
- } catch (NoSuchMethodException e) {
- listener = listenerClass.newInstance();
- }
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- addContributionListener(listener);
- }
-
- loadedListeners = true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.java
deleted file mode 100644
index fc0dc3aa99..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/ExtensibleContributionListener.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.contribution.service;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-
-public class ExtensibleContributionListener implements ContributionListener {
- private final ContributionListenerExtensionPoint listeners;
-
- /**
- * Default constructor receiving the listener extension point
- *
- * @param listeners
- */
- public ExtensibleContributionListener(ContributionListenerExtensionPoint listeners) {
- this.listeners = listeners;
- }
-
- /**
- * Process "contributionAdded" event to all registered listeners
- */
- public void contributionAdded(ContributionRepository repository, Contribution contribution) {
- for (ContributionListener listener : listeners.getContributionListeners()) {
- try {
- listener.contributionAdded(repository, contribution);
- } catch (Exception e) {
- // ignore, continue to the next listener
- }
- }
- }
-
- /**
- * Process "contributionRemoved" event to all registered listeners
- */
- public void contributionRemoved(ContributionRepository repository, Contribution contribution) {
- for (ContributionListener listener : listeners.getContributionListeners()) {
- try {
- listener.contributionRemoved(repository, contribution);
- } catch (Exception e) {
- // ignore, continue to the next listener
- }
-
- }
- }
-
- /**
- * Process "contributionUpdated" event to all registered listeners
- */
- public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) {
- for (ContributionListener listener : listeners.getContributionListeners()) {
- try {
- listener.contributionUpdated(repository, oldContribution, contribution);
- } catch (Exception e) {
- // ignore, continue to the next listener
- }
-
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java
deleted file mode 100644
index 74f303a5a5..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/TypeDescriber.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.contribution.service;
-
-import java.net.URL;
-
-/**
- * Provide content type for a given resource
- *
- * @version $Rev$ $Date$
- */
-public interface TypeDescriber {
- /**
- * Get the content type for the specified resource
- *
- * @param resourceURL The resource URL
- * @param defaultType The default content type
- * @return The content type
- */
- String getType(URL resourceURL, String defaultType);
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java
deleted file mode 100644
index ff21c894de..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnrecognizedElementException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.service;
-
-import javax.xml.namespace.QName;
-
-/**
- * Exception that indicates an element was encountered that could not be handled.
- *
- * @version $Rev$ $Date$
- */
-public class UnrecognizedElementException extends ContributionReadException {
- private static final long serialVersionUID = 2549543622209829032L;
- private final QName element;
-
- /**
- * Constructor that indicates which element could not be handled.
- * @param element the element that could not be handled
- */
- public UnrecognizedElementException(QName element) {
- super("Unrecognized element: " + element);
- this.element = element;
- }
-
- /**
- * Returns the element that could not be handled.
- * @return the element that could not be handled.
- */
- public QName getElement() {
- return element;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.java
deleted file mode 100644
index 0660d69897..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedContentTypeException.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.contribution.service;
-
-/**
- * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
- * The Content-Type value supplied will be returned as the message text for this exception.
- *
- * FIXME Don't use as it's deprecated and replaced by UnsupportedPackageTypeException.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class UnsupportedContentTypeException extends ContributionException {
- private static final long serialVersionUID = -1831797280021355672L;
-
- /**
- * Constructs a new UnsupportedContentTypeException.
- *
- * @param message
- */
- public UnsupportedContentTypeException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java b/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java
deleted file mode 100644
index 33c847a049..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/service/UnsupportedPackageTypeException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.contribution.service;
-
-/**
- * Exception thrown to indicate that a Content-Type is not supported by this SCA Domain.
- * The Content-Type value supplied will be returned as the message text for this exception.
- *
- * @version $Rev$ $Date$
- */
-public class UnsupportedPackageTypeException extends ContributionException {
- private static final long serialVersionUID = -1831797280021355672L;
-
- /**
- * Constructs a new UnsupportedPackageTypeException.
- *
- * @param message
- */
- public UnsupportedPackageTypeException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
deleted file mode 100644
index bcc346d9f8..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ContributionFactory
+++ /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.contribution.DefaultContributionFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
deleted file mode 100644
index 6b4d2ebdeb..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint
+++ /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.contribution.DefaultModelFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
deleted file mode 100644
index 9e6433ba6c..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ContributionPostProcessorExtensionPoint
+++ /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.contribution.processor.DefaultContributionPostProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
deleted file mode 100644
index 7609eda0d1..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint
+++ /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.contribution.processor.DefaultPackageProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
deleted file mode 100644
index 8ea5fc0a7e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint
+++ /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.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint
deleted file mode 100644
index 607725bcfe..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessorExtensionPoint
+++ /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.contribution.processor.DefaultStAXAttributeProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
deleted file mode 100644
index 9d78ca93d0..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint
+++ /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.contribution.processor.DefaultURLArtifactProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
deleted file mode 100644
index ae6e876df6..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint
+++ /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.contribution.processor.DefaultValidationSchemaExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
deleted file mode 100644
index 4bb65e55e7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint
+++ /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.contribution.resolver.DefaultModelResolverExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
deleted file mode 100644
index 727f8f6ce7..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.scanner.ContributionScannerExtensionPoint
+++ /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.contribution.scanner.DefaultContributionScannerExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
deleted file mode 100644
index 6e61bebf79..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint
+++ /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.contribution.service.DefaultContributionListenerExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/contribution-validation-messages.properties b/branches/sca-java-1.5.1/modules/contribution/src/main/resources/contribution-validation-messages.properties
deleted file mode 100644
index 4f9f85048e..0000000000
--- a/branches/sca-java-1.5.1/modules/contribution/src/main/resources/contribution-validation-messages.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-SchemaError = XMLSchema validation error occured in: {0} ,line = {1}, column = {2}, Message = {3}
-SchemaFatalError = XMLSchema validation fatal error occured in: {0} ,line = {1}, column = {2}, Message = {3}
-SchemaWarning = XMLSchema validation warning occured in: {0} ,line = {1}, column = {2}, Message = {3}
-UnsupportedPackageTypeException = Unsupported contribution package type: {0}
-ElementCannotBeProcessed = Element {0} cannot be processed. ({1})
-AttributeCannotBeProcessed = Attribute {0} cannot be processed. ({1})
-NoStaxProcessor = No StAX processor is configured to handle {0}
-ContributionWriteException = ContributionWriteException occured due to :
-ContributionReadException = ContributionReadException occured due to :
-UnrecognizedElementException = Unrecognized Element : {0}
-IllegalArgumentException = Invalid qname: {0}
-PrivilegedActionException = PrivilegedActionException occured due to :
-AttributeCannotBeProcessed = Attribute {0} cannot be processed. ({1})
-
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/LICENSE b/branches/sca-java-1.5.1/modules/core-databinding/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/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-java-1.5.1/modules/core-databinding/NOTICE b/branches/sca-java-1.5.1/modules/core-databinding/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/pom.xml b/branches/sca-java-1.5.1/modules/core-databinding/pom.xml
deleted file mode 100644
index 2d99ce89be..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/pom.xml
+++ /dev/null
@@ -1,139 +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>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
- <packaging>jar</packaging>
- <name>Apache Tuscany SCA Core/DataBinding Integration</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-jaxb</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-jaxws</artifactId>
- <version>${project.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <scope>runtime</scope>
- <version>3.2.4</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.core.databinding</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.core.databinding*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.java
deleted file mode 100644
index 4e0e58e6a1..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/module/DataBindingModuleActivator.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.core.databinding.module;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
-import org.apache.tuscany.sca.core.databinding.processor.WrapperJavaInterfaceProcessor;
-import org.apache.tuscany.sca.core.databinding.transformers.Array2ArrayTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.CallableReference2XMLStreamReader;
-import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceDataBinding;
-import org.apache.tuscany.sca.core.databinding.transformers.CallableReferenceXMLAdapter;
-import org.apache.tuscany.sca.core.databinding.transformers.Exception2ExceptionTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.OMElementXMLAdapter;
-import org.apache.tuscany.sca.core.databinding.transformers.Output2OutputTransformer;
-import org.apache.tuscany.sca.core.databinding.transformers.XMLStreamReader2CallableReference;
-import org.apache.tuscany.sca.core.databinding.wire.DataBindingRuntimeWireProcessor;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.Group2GroupTransformer;
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSFaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
-import org.apache.tuscany.sca.interfacedef.java.jaxws.WebServiceInterfaceProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
-import org.osoa.sca.CallableReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DataBindingModuleActivator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry registry) {
- DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
-
- XMLAdapterExtensionPoint xmlAdapterExtensionPoint = registry.getExtensionPoint(XMLAdapterExtensionPoint.class);
- xmlAdapterExtensionPoint.addAdapter(CallableReference.class, CallableReferenceXMLAdapter.class);
- xmlAdapterExtensionPoint.addAdapter(OMElement.class, OMElementXMLAdapter.class);
- FaultExceptionMapper faultExceptionMapper = new JAXWSFaultExceptionMapper(dataBindings, xmlAdapterExtensionPoint);
- registry.getExtensionPoint(UtilityExtensionPoint.class).addUtility(faultExceptionMapper);
-
- Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
-
- Input2InputTransformer input2InputTransformer = new Input2InputTransformer();
- input2InputTransformer.setMediator(mediator);
- transformers.addTransformer(input2InputTransformer, true);
-
- Output2OutputTransformer output2OutputTransformer = new Output2OutputTransformer();
- output2OutputTransformer.setMediator(mediator);
- transformers.addTransformer(output2OutputTransformer, true);
-
- Exception2ExceptionTransformer exception2ExceptionTransformer = new Exception2ExceptionTransformer(mediator, faultExceptionMapper);
- transformers.addTransformer(exception2ExceptionTransformer, false);
-
- Array2ArrayTransformer array2ArrayTransformer = new Array2ArrayTransformer();
- array2ArrayTransformer.setMediator(mediator);
- transformers.addTransformer(array2ArrayTransformer, true);
-
- Group2GroupTransformer group2GroupTransformer = new Group2GroupTransformer();
- group2GroupTransformer.setMediator(mediator);
- transformers.addTransformer(group2GroupTransformer, true);
-
- dataBindings.addDataBinding(new CallableReferenceDataBinding());
- transformers.addTransformer(new CallableReference2XMLStreamReader(), true);
- transformers.addTransformer(new XMLStreamReader2CallableReference(), false);
-
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- // Add the WebServiceInterfaceProcessor to mark the interface remotable
- javaFactory.addInterfaceVisitor(new WebServiceInterfaceProcessor());
- // Introspect the data types
- javaFactory.addInterfaceVisitor(new DataBindingJavaInterfaceProcessor(dataBindings));
- javaFactory.addInterfaceVisitor(new JAXWSJavaInterfaceProcessor(dataBindings, faultExceptionMapper, xmlAdapterExtensionPoint));
- javaFactory.addInterfaceVisitor(new WrapperJavaInterfaceProcessor(dataBindings));
-
-
- RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint = registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
- if (wireProcessorExtensionPoint != null) {
- wireProcessorExtensionPoint.addWireProcessor(new DataBindingRuntimeWireProcessor(mediator, dataBindings, faultExceptionMapper));
- }
-
- }
-
- public void stop(ExtensionPointRegistry registry) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
deleted file mode 100644
index 8f35b2b00f..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.databinding.processor;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.annotation.DataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-
-/**
- * The databinding annotation processor for java interfaces
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingJavaInterfaceProcessor implements JavaInterfaceVisitor {
- private DataBindingExtensionPoint dataBindingRegistry;
-
- public DataBindingJavaInterfaceProcessor(DataBindingExtensionPoint dataBindingRegistry) {
- super();
- this.dataBindingRegistry = dataBindingRegistry;
- }
-
- public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
- if (!javaInterface.isRemotable()) {
- return;
- }
- List<Operation> operations = javaInterface.getOperations();
- processInterface(javaInterface, operations);
- }
-
- private void processInterface(JavaInterface javaInterface, List<Operation> operations) {
- Class<?> clazz = javaInterface.getJavaClass();
- DataBinding dataBinding = clazz.getAnnotation(DataBinding.class);
- String dataBindingId = null;
- boolean wrapperStyle = false;
- if (dataBinding != null) {
- dataBindingId = dataBinding.value();
- wrapperStyle = dataBinding.wrapped();
- }
-
- Map<String, Operation> opMap = new HashMap<String, Operation>();
- for (Operation op : javaInterface.getOperations()) {
- opMap.put(op.getName(), op);
- // In the case of @WebMethod, the method name can be different from the operation name
- if (op instanceof JavaOperation) {
- opMap.put(((JavaOperation)op).getJavaMethod().getName(), op);
- }
- if (dataBindingId != null) {
- op.setDataBinding(dataBindingId);
- op.setInputWrapperStyle(wrapperStyle);
- op.setOutputWrapperStyle(wrapperStyle);
- }
- }
- for (Method method : clazz.getMethods()) {
- if (method.getDeclaringClass() == Object.class) {
- continue;
- }
- Operation operation = opMap.get(method.getName());
- if (operation == null) { // @WebMethod exclude=true
- continue;
- }
- DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
- if (methodDataBinding == null) {
- methodDataBinding = dataBinding;
- }
- dataBindingId = null;
- wrapperStyle = false;
- if (dataBinding != null) {
- dataBindingId = dataBinding.value();
- wrapperStyle = dataBinding.wrapped();
- operation.setDataBinding(dataBindingId);
- operation.setInputWrapperStyle(wrapperStyle);
- operation.setOutputWrapperStyle(wrapperStyle);
- }
-
- // FIXME: We need a better way to identify simple java types
- int i = 0;
- for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getInputType().getLogical()) {
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBindingId);
- }
- for (Annotation a : method.getParameterAnnotations()[i]) {
- if (a.annotationType() == org.apache.tuscany.sca.databinding.annotation.DataType.class) {
- String value = ((org.apache.tuscany.sca.databinding.annotation.DataType)a).value();
- d.setDataBinding(value);
- }
- }
- dataBindingRegistry.introspectType(d, operation);
- i++;
- }
- if (operation.getOutputType() != null) {
- DataType<?> d = operation.getOutputType();
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBindingId);
- }
- org.apache.tuscany.sca.databinding.annotation.DataType dt =
- method.getAnnotation(org.apache.tuscany.sca.databinding.annotation.DataType.class);
- if (dt != null) {
- d.setDataBinding(dt.value());
- }
- dataBindingRegistry.introspectType(d, operation);
- }
- /* It's now done in the JAXWS java interface processor
- for (org.apache.tuscany.sca.interfacedef.DataType<?> d : operation.getFaultTypes()) {
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBindingId);
- // TODO: Handle exceptions
- dataBindingRegistry.introspectType(d, operation);
- }
- }
- */
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.java
deleted file mode 100644
index 702da720a0..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/WrapperJavaInterfaceProcessor.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.core.databinding.processor;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-
-/**
- * The databinding annotation processor for java interfaces
- *
- * @version $Rev$ $Date$
- */
-public class WrapperJavaInterfaceProcessor implements JavaInterfaceVisitor {
- private static final String JAXB_DATABINDING = "javax.xml.bind.JAXBElement";
- private DataBindingExtensionPoint dataBindingRegistry;
-
- public WrapperJavaInterfaceProcessor(DataBindingExtensionPoint dataBindingRegistry) {
- super();
- this.dataBindingRegistry = dataBindingRegistry;
- }
-
- public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
- if (!javaInterface.isRemotable()) {
- return;
- }
- for (Operation operation : javaInterface.getOperations()) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- if (inputWrapperInfo == null || outputWrapperInfo == null) {
- continue;
- }
- // JIRA: TUSCANY-842
- String db = inputWrapperInfo.getDataBinding();
- if (db == null || JAXB_DATABINDING.equals(db)) {
- db = assignOperationDataBinding(operation);
- }
-
- // Introspect the wrapper data type
- org.apache.tuscany.sca.databinding.DataBinding dbObj = dataBindingRegistry.getDataBinding(db);
- WrapperHandler handler = dbObj == null ? null : dbObj.getWrapperHandler();
- if (handler != null) {
- inputWrapperInfo.setWrapperType(handler.getWrapperType(operation, true));
- outputWrapperInfo.setWrapperType(handler.getWrapperType(operation, false));
- }
- if (dbObj != null && handler == null) {
- // To avoid JAXB wrapper bean generation
- inputWrapperInfo.setWrapperType(null);
- outputWrapperInfo.setWrapperType(null);
- }
- }
- }
-
- /*
- * Assigns an operation DB if one of the input types, output type, fault types has a non-default DB.
- * However, if two of the input types, output type, fault types have two different non-default DBs
- * ( e.g. SDO and JAXB), then we do nothing to the operation DB.
- *
- * The method logic assumes the JavaBeans DataBinding is the default
- */
- private String assignOperationDataBinding(Operation operation) {
-
- Set<String> dbs = new HashSet<String>();
-
- // Can't use DataType<?> since operation.getInputType() returns: DataType<List<DataType>>
- List<DataType> opDataTypes = new LinkedList<DataType>();
-
- opDataTypes.addAll(operation.getInputType().getLogical());
- opDataTypes.add(operation.getOutputType());
-/*
- for (DataType<DataType> ft : operation.getFaultTypes()) {
- opDataTypes.add(ft.getLogical());
- }
-*/
-
- for (DataType<?> d : opDataTypes) {
- if (d != null) {
- String dataBinding = d.getDataBinding();
- if ("java:array".equals(dataBinding)) {
- dataBinding = ((DataType)d.getLogical()).getDataBinding();
- }
- if (dataBinding != null) {
- dbs.add(dataBinding);
- }
- }
- }
-
- dbs.remove(JavaBeansDataBinding.NAME);
- dbs.remove(SimpleJavaDataBinding.NAME);
-
- if (dbs.size() == 1) {
- String db = dbs.iterator().next();
- operation.getInputWrapper().setDataBinding(db);
- return db;
- } else {
- return operation.getInputWrapper().getDataBinding();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.java
deleted file mode 100644
index 38ca2cd10c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Array2ArrayTransformer.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.core.databinding.transformers;
-
-import java.lang.reflect.Array;
-
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * This is a special transformer to transform the output from one IDL to the
- * other one
- *
- * @version $Rev$ $Date$
- */
-public class Array2ArrayTransformer extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
-
- protected Mediator mediator;
-
- public Array2ArrayTransformer() {
- super();
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- @Override
- public String getSourceDataBinding() {
- return "java:array";
- }
-
- @Override
- public String getTargetDataBinding() {
- return "java:array";
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
- */
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
- */
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 10;
- }
-
- @SuppressWarnings("unchecked")
- public Object transform(Object array, TransformationContext context) {
- try {
- if (array == null) {
- return null;
- }
- DataType<DataType> sourceType = context.getSourceDataType();
- DataType<DataType> targetType = context.getTargetDataType();
- int length = Array.getLength(array);
- Object targetArray = Array.newInstance(targetType.getPhysical().getComponentType(), length);
- for (int i = 0; i < length; i++) {
- Object sourceItem = Array.get(array, i);
- Object targetItem =
- mediator.mediate(sourceItem, sourceType.getLogical(), targetType.getLogical(), context
- .getMetadata());
- Array.set(targetArray, i, targetItem);
- }
- return targetArray;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java
deleted file mode 100644
index 124928db24..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReference2XMLStreamReader.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.databinding.transformers;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.StAXHelper;
-import org.osoa.sca.CallableReference;
-
-public class CallableReference2XMLStreamReader extends BaseTransformer<CallableReference, XMLStreamReader> implements
- PullTransformer<CallableReference, XMLStreamReader> {
-
- @Override
- protected Class<CallableReference> getSourceType() {
- return CallableReference.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- public XMLStreamReader transform(CallableReference source, TransformationContext context) {
- try {
- if (source != null) {
- if (source instanceof CallableReferenceImpl) {
- XMLStreamReader xmlReader = ((CallableReferenceImpl)source).getXMLReader();
- if (xmlReader != null) {
- return xmlReader;
- } else {
- String xmlString = ((CallableReferenceImpl)source).toXMLString();
-
- // remove "<?xml...?>" processing instruction and wrap with a top-level element
- return StAXHelper.createXMLStreamReader("<reference xmlns=\"http://callable\">"
- + xmlString.substring(xmlString.indexOf("?>") + 2)
- + "</reference>");
- }
- } else {
- throw new TransformationException("Unrecognized transformation source object");
- }
- } else {
- return null;
- }
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.java
deleted file mode 100644
index 8733b91cd4..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceDataBinding.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.core.databinding.transformers;
-
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.osoa.sca.CallableReference;
-
-public class CallableReferenceDataBinding extends BaseDataBinding {
-
- public static final String NAME = CallableReference.class.getName();
-
- private CallableReferenceTypeHelper xmlTypeHelper;
-
- public CallableReferenceDataBinding() {
- super(NAME, CallableReference.class);
- this.xmlTypeHelper = new CallableReferenceTypeHelper();
- }
-
- @Override
- public XMLTypeHelper getXMLTypeHelper() {
- return xmlTypeHelper;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java
deleted file mode 100644
index 97629ea7b5..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceTypeHelper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.databinding.transformers;
-
-import java.beans.Introspector;
-import java.util.ArrayList;
-import java.util.List;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class CallableReferenceTypeHelper implements XMLTypeHelper {
- private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
- private static final String ANYTYPE_NAME = "anyType";
- private static final QName ANYTYPE_QNAME = new QName(SCHEMA_NS, ANYTYPE_NAME);
-
- public CallableReferenceTypeHelper() {
- super();
- }
-
- public TypeInfo getTypeInfo(Class javaType, Object logical) {
- QName xmlType = JavaXMLMapper.getXMLType(javaType);
- if (xmlType != null) {
- return new TypeInfo(xmlType, true, null);
- } else if (javaType.isInterface()) {
- return new TypeInfo(ANYTYPE_QNAME, true, null);
- } else {
- if (logical instanceof XMLType) {
- xmlType = ((XMLType)logical).getTypeName();
- }
- if (xmlType == null) {
- xmlType = new QName(Introspector.decapitalize(javaType.getSimpleName()));
- }
- return new TypeInfo(xmlType, false, null);
- }
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf) {
- return new ArrayList<XSDefinition>();
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes) {
- return new ArrayList<XSDefinition>();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.java
deleted file mode 100644
index ff6e444dcd..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/CallableReferenceXMLAdapter.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.core.databinding.transformers;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
-import org.osoa.sca.CallableReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CallableReferenceXMLAdapter extends XmlAdapter<Source, CallableReference> {
- private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- private XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- @Override
- public CallableReference unmarshal(Source v) throws Exception {
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- transformerFactory.newTransformer().transform(v, result);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(sw.toString()));
- XMLStreamReader2CallableReference t2 = new XMLStreamReader2CallableReference();
- return t2.transform(reader, null);
- }
-
- @Override
- public Source marshal(CallableReference v) throws Exception {
- CallableReference2XMLStreamReader t = new CallableReference2XMLStreamReader();
- XMLStreamReader reader = t.transform(v, null);
- XMLStreamReader2String t2 = new XMLStreamReader2String();
- String xml = t2.transform(reader, null);
- return new StreamSource(new StringReader(xml));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.java
deleted file mode 100644
index 6e2e714bdb..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Exception2ExceptionTransformer.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.core.databinding.transformers;
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-
-/**
- * This is a special transformer to transform the exception from one IDL to the
- * other one
- *
- * @version $Rev$ $Date$
- */
-public class Exception2ExceptionTransformer extends BaseTransformer<Throwable, Throwable> implements
- PullTransformer<Throwable, Throwable> {
-
- protected Mediator mediator;
- protected FaultExceptionMapper faultExceptionMapper;
-
- public Exception2ExceptionTransformer(Mediator mediator, FaultExceptionMapper faultExceptionMapper) {
- super();
- this.mediator = mediator;
- this.faultExceptionMapper = faultExceptionMapper;
- }
-
- public Exception2ExceptionTransformer() {
- super();
- }
-
- @Override
- public String getSourceDataBinding() {
- return DataBinding.IDL_FAULT;
- }
-
- @Override
- public String getTargetDataBinding() {
- return DataBinding.IDL_FAULT;
- }
-
- /**
- * @param mediator the mediator to set
- */
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
- */
- @Override
- protected Class<Throwable> getSourceType() {
- return Throwable.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
- */
- @Override
- protected Class<Throwable> getTargetType() {
- return Throwable.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 10000;
- }
-
- @SuppressWarnings("unchecked")
- public Throwable transform(Throwable source, TransformationContext context) {
- DataType<DataType> sourceType = context.getSourceDataType();
-
- DataType<DataType> targetType = context.getTargetDataType();
-
- Object sourceFaultInfo = faultExceptionMapper.getFaultInfo(source, sourceType.getLogical().getPhysical(), context.getSourceOperation());
- Object targetFaultInfo =
- mediator.mediate(sourceFaultInfo, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
-
- Throwable targetException =
- faultExceptionMapper.wrapFaultInfo(targetType, source.getMessage(), targetFaultInfo, source.getCause(), context.getTargetOperation());
-
- // FIXME
- return targetException == null ? source : targetException;
-
- }
-
- public void setFaultExceptionMapper(FaultExceptionMapper faultExceptionMapper) {
- this.faultExceptionMapper = faultExceptionMapper;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
deleted file mode 100644
index f537dc4524..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Input2InputTransformer.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.databinding.transformers;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * This is a special transformer to transform the input from one IDL to the
- * other one
- *
- * @version $Rev$ $Date$
- */
-public class Input2InputTransformer extends BaseTransformer<Object[], Object[]> implements
- PullTransformer<Object[], Object[]> {
- private static final Logger logger = Logger.getLogger(Input2InputTransformer.class.getName());
-
- protected Mediator mediator;
-
- public Input2InputTransformer() {
- super();
- }
-
- @Override
- public String getSourceDataBinding() {
- return DataBinding.IDL_INPUT;
- }
-
- @Override
- public String getTargetDataBinding() {
- return DataBinding.IDL_INPUT;
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
- */
- @Override
- protected Class<Object[]> getSourceType() {
- return Object[].class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
- */
- @Override
- protected Class<Object[]> getTargetType() {
- return Object[].class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 10000;
- }
-
- /**
- * Match the structure of the wrapper element. If it matches, then we can do
- * wrapper to wrapper transformation. Otherwise, we do child to child.
- * @param w1
- * @param w2
- * @return
- */
- private boolean matches(WrapperInfo w1, WrapperInfo w2) {
- if (w1 == null || w2 == null) {
- return false;
- }
- if (!w1.getWrapperElement().equals(w2.getWrapperElement())) {
- return false;
- }
-
- // Compare the child elements
- List<ElementInfo> list1 = w1.getChildElements();
- List<ElementInfo> list2 = w2.getChildElements();
- if (list1.size() != list2.size()) {
- return false;
- }
- // FXIME: [rfeng] At this point, the J2W generates local elments under the namespace
- // of the interface instead of "". We only compare the local parts only to work around
- // the namespace mismatch
- for (int i = 0; i < list1.size(); i++) {
- String n1 = list1.get(i).getQName().getLocalPart();
- String n2 = list2.get(i).getQName().getLocalPart();
- if (!n1.equals(n2)) {
- return false;
- }
- }
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public Object[] transform(Object[] source, TransformationContext context) {
- // Check if the source operation is wrapped
- DataType<List<DataType>> sourceType = context.getSourceDataType();
- Operation sourceOp = context.getSourceOperation();
- boolean sourceWrapped = sourceOp != null && sourceOp.isInputWrapperStyle() && sourceOp.getInputWrapper() != null;
- boolean sourceBare = sourceOp != null && !sourceOp.isInputWrapperStyle() && sourceOp.getInputWrapper() == null;
-
- // Find the wrapper handler for source data
- WrapperHandler sourceWrapperHandler = null;
- String sourceDataBinding = getDataBinding(sourceOp);
- sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
-
- // Check if the target operation is wrapped
- DataType<List<DataType>> targetType = context.getTargetDataType();
- Operation targetOp = (Operation)context.getTargetOperation();
- boolean targetWrapped = targetOp != null && targetOp.isInputWrapperStyle() && targetOp.getInputWrapper() != null;
- boolean targetBare = targetOp != null && !targetOp.isInputWrapperStyle() && targetOp.getInputWrapper() == null;
-
- // Find the wrapper handler for target data
- WrapperHandler targetWrapperHandler = null;
- String targetDataBinding = getDataBinding(targetOp);
- targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
-
- if ((!sourceWrapped && !sourceBare) && targetWrapped) {
- // Unwrapped --> Wrapped
- WrapperInfo wrapper = targetOp.getInputWrapper();
- // ElementInfo wrapperElement = wrapper.getInputWrapperElement();
-
- // Class<?> targetWrapperClass = wrapper != null ? wrapper.getInputWrapperClass() : null;
-
- if (source == null) {
- // Empty child elements
- Object targetWrapper = targetWrapperHandler.create(targetOp, true);
- return new Object[] {targetWrapper};
- }
-
- // If the source can be wrapped, wrapped it first
- if (sourceWrapperHandler != null) {
- WrapperInfo sourceWrapperInfo = sourceOp.getInputWrapper();
- DataType sourceWrapperType = sourceWrapperInfo != null ? sourceWrapperInfo.getWrapperType() : null;
-
- // We only do wrapper to wrapper transformation if the source has a wrapper and both sides
- // match by XML structure
- if (sourceWrapperType != null && matches(sourceOp.getInputWrapper(), targetOp.getInputWrapper())) {
- Class<?> sourceWrapperClass = sourceWrapperType.getPhysical();
-
- // Create the source wrapper
- Object sourceWrapper = sourceWrapperHandler.create(sourceOp, true);
-
- // Populate the source wrapper
- if (sourceWrapper != null) {
- sourceWrapperHandler.setChildren(sourceWrapper,
- source,
- sourceOp,
- true);
-
- // Transform the data from source wrapper to target wrapper
- Object targetWrapper =
- mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical().get(0), context
- .getMetadata());
- return new Object[] {targetWrapper};
- }
- }
- }
- // Fall back to child by child transformation
- Object targetWrapper = targetWrapperHandler.create(targetOp, true);
- List<DataType> argTypes = wrapper.getUnwrappedInputType().getLogical();
- Object[] targetChildren = new Object[source.length];
- for (int i = 0; i < source.length; i++) {
- // ElementInfo argElement = wrapper.getInputChildElements().get(i);
- DataType<XMLType> argType = argTypes.get(i);
- targetChildren[i] =
- mediator.mediate(source[i], sourceType.getLogical().get(i), argType, context.getMetadata());
- }
- targetWrapperHandler.setChildren(targetWrapper,
- targetChildren,
- targetOp,
- true);
- return new Object[] {targetWrapper};
-
- } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
- // Wrapped to Unwrapped
- Object sourceWrapper = source[0];
- Object[] target = null;
-
- // List<ElementInfo> childElements = sourceOp.getWrapper().getInputChildElements();
- if (targetWrapperHandler != null) {
- // ElementInfo wrapperElement = sourceOp.getWrapper().getInputWrapperElement();
- // FIXME: This is a workaround for the wsdless support as it passes in child elements
- // under the wrapper that only matches by position
- if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, true)) {
-
- WrapperInfo targetWrapperInfo = targetOp.getInputWrapper();
- DataType targetWrapperType =
- targetWrapperInfo != null ? targetWrapperInfo.getWrapperType() : null;
- if (targetWrapperType != null && matches(sourceOp.getInputWrapper(), targetOp.getInputWrapper())) {
- Object targetWrapper =
- mediator.mediate(sourceWrapper, sourceType.getLogical().get(0), targetWrapperType, context
- .getMetadata());
- target = targetWrapperHandler.getChildren(targetWrapper, targetOp, true).toArray();
- return target;
- }
- }
- }
- Object[] sourceChildren = sourceWrapperHandler.getChildren(sourceWrapper, sourceOp, true).toArray();
- target = new Object[sourceChildren.length];
- for (int i = 0; i < sourceChildren.length; i++) {
- DataType<XMLType> childType = sourceOp.getInputWrapper().getUnwrappedInputType().getLogical().get(i);
- target[i] =
- mediator.mediate(sourceChildren[i], childType, targetType.getLogical().get(i), context
- .getMetadata());
- }
- return target;
- } else {
- // Assuming wrapper to wrapper conversion can be handled here as well
- Object[] newArgs = new Object[source.length];
- for (int i = 0; i < source.length; i++) {
- Object child =
- mediator.mediate(source[i], sourceType.getLogical().get(i), targetType.getLogical().get(i), context
- .getMetadata());
- newArgs[i] = child;
- }
- return newArgs;
- }
- }
-
- private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
- WrapperHandler wrapperHandler = null;
- if (dataBindingId != null) {
- DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
- wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
- }
- if (wrapperHandler == null && required) {
- throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
- }
- return wrapperHandler;
- }
-
- private String getDataBinding(Operation operation) {
- WrapperInfo wrapper = operation.getInputWrapper();
- if (wrapper != null) {
- return wrapper.getDataBinding();
- } else {
- return null;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/OMElementXMLAdapter.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/OMElementXMLAdapter.java
deleted file mode 100644
index ec67dabc15..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/OMElementXMLAdapter.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.core.databinding.transformers;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.transform.Source;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
-
-/**
- * This special XmlAdapter can be used by JAXB classes to convert from OMElement to Source
- */
-public class OMElementXMLAdapter extends XmlAdapter<Source, OMElement> {
-
- private TransformerFactory transformerFactory = TransformerFactory.newInstance();
- private XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- @Override
- public Source marshal(OMElement v) throws Exception {
- XMLStreamReader reader = v.getXMLStreamReaderWithoutCaching();
- XMLStreamReader2String t2 = new XMLStreamReader2String();
- String xml = t2.transform(reader, null);
- return new StreamSource(new StringReader(xml));
- }
-
- @Override
- public OMElement unmarshal(Source v) throws Exception {
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- transformerFactory.newTransformer().transform(v, result);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(sw.toString()));
- // Build OMElement from XMLStreamReader
- StAXOMBuilder builder = new StAXOMBuilder(reader);
- return builder.getDocumentElement();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.java
deleted file mode 100644
index 348d8345b2..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/Output2OutputTransformer.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.core.databinding.transformers;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * This is a special transformer to transform the output from one IDL to the
- * other one
- *
- * @version $Rev$ $Date$
- */
-public class Output2OutputTransformer extends BaseTransformer<Object, Object> implements
- PullTransformer<Object, Object> {
-
- protected Mediator mediator;
-
- /**
- * @param wrapperHandler
- */
- public Output2OutputTransformer() {
- super();
- }
-
- /**
- * @param mediator the mediator to set
- */
- @Reference
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- @Override
- public String getSourceDataBinding() {
- return DataBinding.IDL_OUTPUT;
- }
-
- @Override
- public String getTargetDataBinding() {
- return DataBinding.IDL_OUTPUT;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
- */
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
- */
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 10;
- }
-
- private String getDataBinding(Operation operation) {
- WrapperInfo wrapper = operation.getOutputWrapper();
- if (wrapper != null) {
- return wrapper.getDataBinding();
- } else {
- return null;
- }
- }
-
- private WrapperHandler getWrapperHandler(String dataBindingId, boolean required) {
- WrapperHandler wrapperHandler = null;
- if (dataBindingId != null) {
- DataBinding dataBinding = mediator.getDataBindings().getDataBinding(dataBindingId);
- wrapperHandler = dataBinding == null ? null : dataBinding.getWrapperHandler();
- }
- if (wrapperHandler == null && required) {
- throw new TransformationException("No wrapper handler is provided for databinding: " + dataBindingId);
- }
- return wrapperHandler;
- }
-
- /**
- * Match the structure of the wrapper element. If it matches, then we can do
- * wrapper to wrapper transformation. Otherwise, we do child to child.
- * @param w1
- * @param w2
- * @return
- */
- private boolean matches(WrapperInfo w1, WrapperInfo w2) {
- if (w1 == null || w2 == null) {
- return false;
- }
- if (!w1.getWrapperElement().equals(w2.getWrapperElement())) {
- return false;
- }
-
- // Compare the child elements
- List<ElementInfo> list1 = w1.getChildElements();
- List<ElementInfo> list2 = w2.getChildElements();
- if (list1.size() != list2.size()) {
- return false;
- }
- // FXIME: [rfeng] At this point, the J2W generates local elments under the namespace
- // of the interface instead of "". We only compare the local parts only to work around
- // the namespace mismatch
- for (int i = 0; i < list1.size(); i++) {
- String n1 = list1.get(i).getQName().getLocalPart();
- String n2 = list2.get(i).getQName().getLocalPart();
- if (!n1.equals(n2)) {
- return false;
- }
- }
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public Object transform(Object response, TransformationContext context) {
- try {
- DataType<DataType> sourceType = context.getSourceDataType();
- Operation sourceOp = context.getSourceOperation();
- boolean sourceWrapped = sourceOp != null && sourceOp.isOutputWrapperStyle() && sourceOp.getOutputWrapper() != null;
- boolean sourceBare = sourceOp != null && !sourceOp.isOutputWrapperStyle() && sourceOp.getOutputWrapper() == null;
-
- WrapperHandler sourceWrapperHandler = null;
- String sourceDataBinding = getDataBinding(sourceOp);
- sourceWrapperHandler = getWrapperHandler(sourceDataBinding, sourceWrapped);
-
- DataType<DataType> targetType = context.getTargetDataType();
- Operation targetOp = (Operation)context.getTargetOperation();
- boolean targetWrapped = targetOp != null && targetOp.isOutputWrapperStyle() && targetOp.getOutputWrapper() != null;
- boolean targetBare = targetOp != null && !targetOp.isOutputWrapperStyle() && targetOp.getOutputWrapper() == null;
-
- WrapperHandler targetWrapperHandler = null;
- String targetDataBinding = getDataBinding(targetOp);
- targetWrapperHandler = getWrapperHandler(targetDataBinding, targetWrapped);
-
- if ((!sourceWrapped &&!sourceBare) && targetWrapped) {
- // Unwrapped --> Wrapped
- WrapperInfo wrapper = targetOp.getOutputWrapper();
- ElementInfo wrapperElement = wrapper.getWrapperElement();
- List<ElementInfo> childElements = wrapper.getChildElements();
- Class<?> targetWrapperClass = wrapper != null ? wrapper.getWrapperClass() : null;
-
- // If the source can be wrapped, wrapped it first
- if (sourceWrapperHandler != null) {
- WrapperInfo sourceWrapperInfo = sourceOp.getOutputWrapper();
- DataType sourceWrapperType =
- sourceWrapperInfo != null ? sourceWrapperInfo.getWrapperType() : null;
-
- if (sourceWrapperType != null && matches(sourceOp.getOutputWrapper(), targetOp.getOutputWrapper())) {
- Class<?> sourceWrapperClass = sourceWrapperType.getPhysical();
-
- Object sourceWrapper = sourceWrapperHandler.create(sourceOp, false);
- if (sourceWrapper != null) {
- if (!childElements.isEmpty()) {
- // Set the return value
- sourceWrapperHandler.setChildren(sourceWrapper,
- new Object[] {response},
- sourceOp,
- false);
- }
- Object targetWrapper =
- mediator.mediate(sourceWrapper, sourceWrapperType, targetType.getLogical(), context
- .getMetadata());
- return targetWrapper;
- }
- }
- }
- Object targetWrapper = targetWrapperHandler.create(targetOp, false);
-
- if (childElements.isEmpty()) {
- // void output
- return targetWrapper;
- }
-
- DataType<XMLType> argType = wrapper.getUnwrappedOutputType();
- Object child = response;
- child = mediator.mediate(response, sourceType.getLogical(), argType, context.getMetadata());
- targetWrapperHandler.setChildren(targetWrapper, new Object[] {child}, targetOp, false);
- return targetWrapper;
- } else if (sourceWrapped && (!targetWrapped && !targetBare)) {
- // Wrapped to Unwrapped
- Object sourceWrapper = response;
- List<ElementInfo> childElements = sourceOp.getOutputWrapper().getChildElements();
- if (childElements.isEmpty()) {
- // The void output
- return null;
- }
- if (targetWrapperHandler != null) {
- ElementInfo wrapperElement = sourceOp.getOutputWrapper().getWrapperElement();
-
- // FIXME: This is a workaround for the wsdless support as it passes in child elements
- // under the wrapper that only matches by position
- if (sourceWrapperHandler.isInstance(sourceWrapper, sourceOp, false)) {
-
- WrapperInfo targetWrapperInfo = targetOp.getOutputWrapper();
- DataType targetWrapperType =
- targetWrapperInfo != null ? targetWrapperInfo.getWrapperType() : null;
-
- if (targetWrapperType != null && matches(sourceOp.getOutputWrapper(), targetOp.getOutputWrapper())) {
- Object targetWrapper =
- mediator.mediate(sourceWrapper, sourceType.getLogical(), targetWrapperType, context
- .getMetadata());
- return targetWrapperHandler.getChildren(targetWrapper, targetOp, false).get(0);
- }
- }
- }
- Object child = sourceWrapperHandler.getChildren(sourceWrapper, sourceOp, false).get(0);
- DataType<?> childType = sourceOp.getOutputWrapper().getUnwrappedOutputType();
- return mediator.mediate(child, childType, targetType.getLogical(), context.getMetadata());
- } else {
- // FIXME: Do we want to handle wrapped to wrapped?
- return mediator.mediate(response, sourceType.getLogical(), targetType.getLogical(), context
- .getMetadata());
- }
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java
deleted file mode 100644
index 841efa9398..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/transformers/XMLStreamReader2CallableReference.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.databinding.transformers;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.lang.reflect.Constructor;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.osoa.sca.CallableReference;
-
-@SuppressWarnings("unchecked")
-public class XMLStreamReader2CallableReference extends BaseTransformer<XMLStreamReader, CallableReference>
- implements PullTransformer<XMLStreamReader, CallableReference> {
-
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- private static final String COMPOSITE = "composite";
- public static final QName COMPOSITE_QNAME = new QName(SCA10_NS, COMPOSITE);
-
- public CallableReference transform(XMLStreamReader source, TransformationContext context) {
- try {
- if (source != null) {
- skipTopLevelElement(source);
- Class refType = context.getTargetDataType().getPhysical();
- Class implType;
- if (refType.isAssignableFrom(CallableReferenceImpl.class)) {
- implType = CallableReferenceImpl.class;
- } else if (refType.isAssignableFrom(ServiceReferenceImpl.class)) {
- implType = ServiceReferenceImpl.class;
- } else {
- throw new TransformationException("Unrecognized transformation target type");
- }
- Constructor constructor = implType.getConstructor(new Class[] {XMLStreamReader.class});
- return (CallableReference)constructor.newInstance(new Object[] {source});
- } else {
- return null;
- }
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- /*
- * Step over top-level element added by CallableReference2XMLStreamReader
- */
- private void skipTopLevelElement(XMLStreamReader source) throws XMLStreamException {
- while (source.hasNext()) {
- int event = source.getEventType();
- if (event == START_ELEMENT) {
- QName name = source.getName();
- if (COMPOSITE_QNAME.equals(name)) {
- return;
- }
- }
- source.next();
- }
- throw new TransformationException("<composite> element not found");
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<CallableReference> getTargetType() {
- return CallableReference.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.java
deleted file mode 100644
index bad2be6679..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataBindingRuntimeWireProcessor.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.core.databinding.wire;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-
-/**
- * This processor is responsible to add an interceptor to invocation chain if
- * the source and target operations have different databinding requirements
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingRuntimeWireProcessor implements RuntimeWireProcessor {
- private Mediator mediator;
- private DataBindingExtensionPoint dataBindings;
- private FaultExceptionMapper faultExceptionMapper;
-
- public DataBindingRuntimeWireProcessor(Mediator mediator,
- DataBindingExtensionPoint dataBindings,
- FaultExceptionMapper faultExceptionMapper) {
- super();
- this.mediator = mediator;
- this.dataBindings = dataBindings;
- this.faultExceptionMapper = faultExceptionMapper;
- }
-
- public boolean isTransformationRequired(DataType source, DataType target) {
- if (source == null || target == null) { // void return type
- return false;
- }
- if (source == target) {
- return false;
- }
-
- // Output type can be null
- if (source == null && target == null) {
- return false;
- } else if (source == null || target == null) {
- return true;
- }
- String sourceDataBinding = source.getDataBinding();
- String targetDataBinding = target.getDataBinding();
- if (sourceDataBinding == targetDataBinding) {
- return false;
- }
- if (sourceDataBinding == null || targetDataBinding == null) {
- // TODO: If any of the databinding is null, then no transformation
- return false;
- }
- return !sourceDataBinding.equals(targetDataBinding);
- }
-
- public boolean isTransformationRequired(Operation source, Operation target) {
- if (source == target) {
- return false;
- }
-
- if (source.isInputWrapperStyle() != target.isInputWrapperStyle()) {
- return true;
- }
-
- if (source.isOutputWrapperStyle() != target.isOutputWrapperStyle()) {
- return true;
- }
-
- // Check output type
- DataType sourceOutputType = source.getOutputType();
- DataType targetOutputType = target.getOutputType();
-
- // Note the target output type is now the source for checking
- // compatibility
- if (isTransformationRequired(targetOutputType, sourceOutputType)) {
- return true;
- }
-
- List<DataType> sourceInputType = source.getInputType().getLogical();
- List<DataType> targetInputType = target.getInputType().getLogical();
-
- int size = sourceInputType.size();
- if (size != targetInputType.size()) {
- // TUSCANY-1682: The wrapper style may have different arguments
- return true;
- }
- for (int i = 0; i < size; i++) {
- if (isTransformationRequired(sourceInputType.get(i), targetInputType.get(i))) {
- return true;
- }
- }
-
- return false;
- }
-
- private boolean isTransformationRequired(InterfaceContract sourceContract,
- Operation sourceOperation,
- InterfaceContract targetContract,
- Operation targetOperation) {
- if (targetContract == null) {
- targetContract = sourceContract;
- }
- if (sourceContract == targetContract) {
- return false;
- }
- return isTransformationRequired(sourceOperation, targetOperation);
- }
-
- public void process(RuntimeWire wire) {
- InterfaceContract sourceContract = wire.getSource().getInterfaceContract();
- InterfaceContract targetContract = wire.getTarget().getInterfaceContract();
- if (targetContract == null) {
- targetContract = sourceContract;
- }
-
- if (!sourceContract.getInterface().isRemotable()) {
- return;
- }
- List<InvocationChain> chains = wire.getInvocationChains();
- for (InvocationChain chain : chains) {
- Operation sourceOperation = chain.getSourceOperation();
- Operation targetOperation = chain.getTargetOperation();
-
- Interceptor interceptor = null;
- if (isTransformationRequired(sourceContract, sourceOperation, targetContract, targetOperation)) {
- // Add the interceptor to the source side because multiple
- // references can be wired to the same service
- interceptor =
- new DataTransformationInterceptor(wire, sourceOperation, targetOperation, mediator);
- } else {
- // assume pass-by-values copies are required if interfaces are remotable and there is no data binding
- // transformation, i.e. a transformation will result in a copy so another pass-by-value copy is unnecessary
- if (!isOnMessage(targetOperation) && isRemotable(chain, sourceOperation, targetOperation)) {
- interceptor =
- new PassByValueInterceptor(mediator, chain, targetOperation);
- }
- }
- if (interceptor != null) {
- String phase =
- (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_INTERFACE
- : Phase.SERVICE_INTERFACE;
- chain.addInterceptor(phase, interceptor);
- }
- }
-
- }
-
- /**
- * FIXME: TUSCANY-2586, temporary work around till the JIRA is fixed to prevent
- * the PassByValueInterceptor being used for services when the binding protocol
- * doesn't need the copies done.
- */
- protected boolean isOnMessage(Operation op) {
- return "onMessage".equals(op.getName());
- }
-
- /**
- * Pass-by-value copies are required if the interfaces are remotable unless the
- * implementation uses the @AllowsPassByReference annotation.
- */
- protected boolean isRemotable(InvocationChain chain, Operation sourceOperation, Operation targetOperation) {
- if (!sourceOperation.getInterface().isRemotable()) {
- return false;
- }
- if (!targetOperation.getInterface().isRemotable()) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.java
deleted file mode 100644
index 79c442450b..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/DataTransformationInterceptor.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.core.databinding.wire;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * An interceptor to transform data across databindings on the wire
- *
- * @version $Rev$ $Date$
- */
-public class DataTransformationInterceptor implements Interceptor, DataExchangeSemantics {
- private Invoker next;
-
- private Operation sourceOperation;
-
- private Operation targetOperation;
- private RuntimeWire wire;
- private Mediator mediator;
-
- public DataTransformationInterceptor(RuntimeWire wire,
- Operation sourceOperation,
- Operation targetOperation,
- Mediator mediator) {
- super();
- this.sourceOperation = sourceOperation;
- this.targetOperation = targetOperation;
- this.mediator = mediator;
- this.wire = wire;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public Message invoke(Message msg) {
- Map<String, Object> metadata = new HashMap<String, Object>();
- metadata.put("wire", wire);
- Object input = mediator.mediateInput(msg.getBody(), sourceOperation, targetOperation, metadata);
- msg.setBody(input);
- Message resultMsg = next.invoke(msg);
- if (sourceOperation.isNonBlocking()) {
- // Not to reset the message body
- return resultMsg;
- }
-
- Object result = resultMsg.getBody();
-
- if (resultMsg.isFault()) {
- Object transformedFault = null;
- if ((result instanceof Exception) && !(result instanceof RuntimeException)) {
- transformedFault = mediator.mediateFault(result, sourceOperation, targetOperation, metadata);
- if (transformedFault != result) {
- resultMsg.setFaultBody(transformedFault);
- }
- }
- //
- // Leave it to another layer to actually throw the Exception which constitutes
- // the message body. We don't throw it here.
- //
- } else {
- assert !(result instanceof Throwable) : "Expected messages that are not throwable " + result;
- Object newResult = mediator.mediateOutput(result, sourceOperation, targetOperation, metadata);
- resultMsg.setBody(newResult);
- }
-
- return resultMsg;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public boolean allowsPassByReference() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java b/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.java
deleted file mode 100644
index 44e5072e61..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/wire/PassByValueInterceptor.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.core.databinding.wire;
-
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Implementation of an interceptor that enforces pass-by-value semantics
- * on operation invocations by copying the operation input and output data.
- *
- * @version $Rev$ $Date$
- */
-public class PassByValueInterceptor implements Interceptor {
-
- private Mediator mediator;
- private Operation operation;
- private Invoker nextInvoker;
- private InvocationChain chain;
-
- /**
- * Constructs a new PassByValueInterceptor.
- * @param dataBindings databinding extension point
- * @param operation the intercepted operation
- */
- public PassByValueInterceptor(Mediator mediator, InvocationChain chain, Operation operation) {
- this.mediator = mediator;
- this.chain = chain;
- this.operation = operation;
- }
-
- public Message invoke(Message msg) {
- if (chain.allowsPassByReference()) {
- return nextInvoker.invoke(msg);
- }
-
- msg.setBody(mediator.copyInput(msg.getBody(), operation));
-
- Message resultMsg = nextInvoker.invoke(msg);
-
- if (!resultMsg.isFault() && operation.getOutputType() != null) {
- resultMsg.setBody(mediator.copyOutput(resultMsg.getBody(), operation));
- }
-
- if (resultMsg.isFault()) {
- resultMsg.setFaultBody(mediator.copyFault(resultMsg.getBody(), operation));
- }
- return resultMsg;
- }
-
- public Invoker getNext() {
- return nextInvoker;
- }
-
- public void setNext(Invoker next) {
- this.nextInvoker = next;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index baba638c9b..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.core.databinding.module.DataBindingModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java
deleted file mode 100644
index b0c39e18ef..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessorTestCase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.databinding.processor;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.annotation.DataBinding;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Remotable;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingJavaInterfaceProcessorTestCase extends TestCase {
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- }
-
- /**
- * @throws InvalidServiceContractException
- */
- public final void testVisitInterface() throws InvalidInterfaceException {
- DataBindingExtensionPoint registry = new DefaultDataBindingExtensionPoint();
- DataBindingJavaInterfaceProcessor processor = new DataBindingJavaInterfaceProcessor(registry);
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
-
- JavaInterface contract = javaFactory.createJavaInterface();
- contract.setJavaClass(MockInterface.class);
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(contract);
- Operation operation = newOperation("call");
- Operation operation1 = newOperation("call1");
- contract.getOperations().add(operation);
- contract.getOperations().add(operation1);
- contract.setRemotable(true);
- processor.visitInterface(contract);
- // Assert.assertEquals("org.w3c.dom.Node", contract.getDataBinding());
- // Assert.assertEquals("org.w3c.dom.Node",
- // contract.getOperations().get("call").getDataBinding());
- // Assert.assertEquals("xml:string",
- // contract.getOperations().get("call1").getDataBinding());
- }
-
- @DataBinding("org.w3c.dom.Node")
- @Remotable
- public static interface MockInterface {
- Node call(Node msg);
-
- @DataBinding("xml:string")
- String call1(String msg);
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.java
deleted file mode 100644
index 7d49fb7112..0000000000
--- a/branches/sca-java-1.5.1/modules/core-databinding/src/test/java/org/apache/tuscany/sca/core/databinding/transformers/IDLTransformerTestCaseFIXME.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.core.databinding.transformers;
-
-//import static org.apache.tuscany.spi.databinding.DataBinding.IDL_INPUT;
-//import static org.apache.tuscany.spi.databinding.DataBinding.IDL_OUTPUT;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-//import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-//import org.apache.tuscany.databinding.impl.DataBindingRegistryImpl;
-//import org.apache.tuscany.databinding.impl.MediatorImpl;
-//import org.apache.tuscany.databinding.impl.TransformationContextImpl;
-//import org.apache.tuscany.databinding.impl.TransformerRegistryImpl;
-//import org.apache.tuscany.databinding.javabeans.DOMNode2JavaBeanTransformer;
-//import org.apache.tuscany.databinding.javabeans.JavaBean2DOMNodeTransformer;
-//import org.apache.tuscany.databinding.xml.DOMDataBinding;
-//import org.apache.tuscany.databinding.xml.Node2String;
-//import org.apache.tuscany.databinding.xml.String2Node;
-//import org.apache.tuscany.interfacedef.DataType;
-//import org.apache.tuscany.interfacedef.Operation;
-//import org.apache.tuscany.interfacedef.impl.DataTypeImpl;
-//import org.apache.tuscany.interfacedef.impl.OperationImpl;
-//import org.apache.tuscany.interfacedef.util.ElementInfo;
-//import org.apache.tuscany.interfacedef.util.TypeInfo;
-//import org.apache.tuscany.interfacedef.util.WrapperInfo;
-//import org.apache.tuscany.interfacedef.util.XMLType;
-//import org.apache.tuscany.spi.databinding.DataBindingRegistry;
-//import org.apache.tuscany.spi.databinding.TransformationContext;
-//import org.apache.tuscany.spi.databinding.extension.DOMHelper;
-//import org.apache.tuscany.spi.databinding.extension.SimpleTypeMapperExtension;
-//import org.w3c.dom.Document;
-//import org.w3c.dom.Element;
-
-public class IDLTransformerTestCaseFIXME extends TestCase {
-// private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<order1"
-// + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
-// + " xmlns:ipo=\"http://www.example.com/IPO\""
-// + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
-// + " orderDate=\"1999-12-01\">"
-// + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
-// + " <name>Helen Zoe</name>"
-// + " <street>47 Eden Street</street>"
-// + " <city>Cambridge</city>"
-// + " <postcode>CB1 1JR</postcode>"
-// + " </shipTo>"
-// + " <billTo xsi:type=\"ipo:USAddress\">"
-// + " <name>Robert Smith</name>"
-// + " <street>8 Oak Avenue</street>"
-// + " <city>Old Town</city>"
-// + " <state>PA</state>"
-// + " <zip>95819</zip>"
-// + " </billTo>"
-// + " <items>"
-// + " <item partNum=\"833-AA\">"
-// + " <productName>Lapis necklace</productName>"
-// + " <quantity>1</quantity>"
-// + " <USPrice>99.95</USPrice>"
-// + " <ipo:comment>Want this for the holidays</ipo:comment>"
-// + " <shipDate>1999-12-05</shipDate>"
-// + " </item>"
-// + " </items>"
-// + "</order1>";
-//
-// private static final String URI_ORDER_XSD = "http://example.com/order.xsd";
-//
-// /**
-// * @see junit.framework.TestCase#setUp()
-// */
-// protected void setUp() throws Exception {
-// super.setUp();
-// }
-//
-// public void testTransform() throws Exception {
-// List<DataType> types0 = new ArrayList<DataType>();
-// DataType<XMLType> wrapperType = new DataTypeImpl<XMLType>(null, Object.class,
-// new XMLType(new QName(URI_ORDER_XSD,
-// "checkOrderStatus"), null));
-// types0.add(wrapperType);
-// DataType<List<DataType>> inputType0 = new DataTypeImpl<List<DataType>>(IDL_INPUT,
-// Object[].class, types0);
-//
-// List<DataType> types1 = new ArrayList<DataType>();
-// DataType<XMLType> customerIdType = new DataTypeImpl<XMLType>(
-// null,
-// Object.class,
-// new XMLType(
-// new QName(URI_ORDER_XSD, "customerId"),
-// null));
-// DataType<XMLType> orderType = new DataTypeImpl<XMLType>(null, Object.class,
-// new XMLType(new QName(URI_ORDER_XSD, "order"), null));
-// DataType<XMLType> flagType = new DataTypeImpl<XMLType>(null, Object.class, new XMLType(new QName(URI_ORDER_XSD,
-// "flag"), null));
-// types1.add(customerIdType);
-// types1.add(orderType);
-// types1.add(flagType);
-//
-// DataType<XMLType> statusType = new DataTypeImpl<XMLType>(null, Object.class,
-// new XMLType(new QName(URI_ORDER_XSD, "status"), null));
-// DataType<XMLType> responseType = new DataTypeImpl<XMLType>(null, Object.class,
-// new XMLType(new QName(URI_ORDER_XSD,
-// "checkOrderStatusResponse"),
-// null));
-//
-// Operation op = new OperationImpl("checkOrderStatus");
-// op.setInputType(inputType0);
-// op.setOutputType(responseType);
-//// op.setDataBinding(DOMDataBinding.NAME);
-////
-//// inputType0.setOperation(op);
-// op.setWrapperStyle(true);
-// ElementInfo inputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatus"), new TypeInfo(null,
-// false,
-// null));
-//// wrapperType.setMetadata(ElementInfo.class.getName(), inputElement);
-//
-// ElementInfo customerId = new ElementInfo(new QName("", "customerId"),
-// SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("string"));
-// ElementInfo order = new ElementInfo(new QName("", "order"), new TypeInfo(new QName(URI_ORDER_XSD), false, null));
-// ElementInfo flag = new ElementInfo(new QName("", "flag"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES.get("int"));
-//
-//// customerIdType.setMetadata(ElementInfo.class.getName(), customerId);
-//// orderType.setMetadata(ElementInfo.class.getName(), order);
-//// flagType.setMetadata(ElementInfo.class.getName(), flag);
-////
-//// customerIdType.setOperation(op);
-//// orderType.setOperation(op);
-//// flagType.setOperation(op);
-//
-// List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
-// inputElements.add(customerId);
-// inputElements.add(order);
-// inputElements.add(flag);
-//
-// ElementInfo statusElement = new ElementInfo(new QName("", "status"), SimpleTypeMapperExtension.XSD_SIMPLE_TYPES
-// .get("string"));
-//
-//// statusType.setMetadata(ElementInfo.class.getName(), statusElement);
-//// statusType.setOperation(op);
-//
-// List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
-// outputElements.add(statusElement);
-//
-// ElementInfo outputElement = new ElementInfo(new QName(URI_ORDER_XSD, "checkOrderStatusResponse"),
-// new TypeInfo(null, false, null));
-//
-//// responseType.setMetadata(ElementInfo.class.getName(), inputElement);
-//// responseType.setOperation(op);
-//
-// WrapperInfo wrapperInfo = new WrapperInfo(DOMDataBinding.NAME, inputElement, outputElement, inputElements,
-// outputElements);
-// op.setWrapper(wrapperInfo);
-//// op.setDataBinding(DOMDataBinding.NAME);
-//
-// MediatorImpl m = new MediatorImpl();
-// TransformerRegistryImpl tr = new TransformerRegistryImpl();
-// tr.registerTransformer(new String2Node());
-// tr.registerTransformer(new Node2String());
-// tr.registerTransformer(new DOMNode2JavaBeanTransformer());
-// tr.registerTransformer(new JavaBean2DOMNodeTransformer());
-// m.setTransformerRegistry(tr);
-// DataBindingRegistry dataBindingRegistry = new DataBindingRegistryImpl();
-// dataBindingRegistry.register(new DOMDataBinding());
-// m.setDataBindingRegistry(dataBindingRegistry);
-//
-// Object[] source = new Object[] {"cust001", IPO_XML, Integer.valueOf(1)};
-// Input2InputTransformer t = new Input2InputTransformer();
-// t.setMediator(m);
-//
-// TransformationContext context = new TransformationContextImpl();
-// context.setSourceOperation(op);
-// List<DataType<Class>> types = new ArrayList<DataType<Class>>();
-// types.add(new DataTypeImpl<Class>(Object.class.getName(), String.class, String.class));
-// types.add(new DataTypeImpl<Class>("java.lang.String", String.class, String.class));
-// types.add(new DataTypeImpl<Class>(Object.class.getName(), int.class, int.class));
-// DataType<List<DataType<Class>>> inputType1 = new DataTypeImpl<List<DataType<Class>>>(IDL_INPUT, Object[].class,
-// types);
-// context.setSourceDataType(inputType1);
-// context.setTargetDataType(op.getInputType());
-// Object[] results = t.transform(source, context);
-// assertEquals(1, results.length);
-// assertTrue(results[0] instanceof Element);
-// Element element = (Element)results[0];
-// assertEquals("http://example.com/order.xsd", element.getNamespaceURI());
-// assertEquals("checkOrderStatus", element.getLocalName());
-//
-// TransformationContext context1 = new TransformationContextImpl();
-// DataType<DataType> sourceType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, op.getOutputType());
-//
-// context1.setSourceDataType(sourceType);
-// DataType<DataType> targetType = new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class,
-// new DataTypeImpl<Class>("java.lang.Object",
-// String.class, String.class));
-// context1.setTargetDataType(targetType);
-//
-// Document factory = DOMHelper.newDocument();
-// Element responseElement = factory
-// .createElementNS("http://example.com/order.wsdl", "p:checkOrderStatusResponse");
-// Element status = factory.createElement("status");
-// responseElement.appendChild(status);
-// status.appendChild(factory.createTextNode("shipped"));
-// Output2OutputTransformer t2 = new Output2OutputTransformer();
-// t2.setMediator(m);
-// Object st = t2.transform(responseElement, context1);
-// assertEquals("shipped", st);
-//
-// }
-//
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/LICENSE b/branches/sca-java-1.5.1/modules/core-spi/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/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-java-1.5.1/modules/core-spi/NOTICE b/branches/sca-java-1.5.1/modules/core-spi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/core-spi/pom.xml b/branches/sca-java-1.5.1/modules/core-spi/pom.xml
deleted file mode 100644
index 0517f74154..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/pom.xml
+++ /dev/null
@@ -1,122 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-core-spi</artifactId>
- <name>Apache Tuscany SCA Core SPI</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api-extension</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.core.spi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/doc/Context Model.emx b/branches/sca-java-1.5.1/modules/core-spi/src/doc/Context Model.emx
deleted file mode 100644
index 0445ea5a6b..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/doc/Context Model.emx
+++ /dev/null
@@ -1,673 +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.
--->
-<!--xtools2_universal_type_manager-->
-<uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:notation="http://www.ibm.com/xtools/1.5.0/Notation" xmlns:uml="http://www.eclipse.org/uml2/1.0.0/UML" xmlns:umlnotation="http://www.ibm.com/xtools/1.5.0/Umlnotation" xmi:id="_al1S8NovEdqRBPR5WyT36A" name="Context Model" appliedProfile="_al1S9NovEdqRBPR5WyT36A _al1S99ovEdqRBPR5WyT36A _al1S-tovEdqRBPR5WyT36A _al1S_dovEdqRBPR5WyT36A _al1TANovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1S8dovEdqRBPR5WyT36A" source="uml2.diagrams" references="_al1S8tovEdqRBPR5WyT36A">
- <contents xmi:type="notation:Diagram" xmi:id="_al1S8tovEdqRBPR5WyT36A" type="Class" name="Main">
- <children xmi:id="_ePDcYdovEdqRBPR5WyT36A" sourceEdges="_Fd3lQdowEdqRBPR5WyT36A _R5Rjwdo1EdqRBPR5WyT36A _pdfmkNo2EdqRBPR5WyT36A" targetEdges="_hmIF4dovEdqRBPR5WyT36A _mu9A4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" element="_ePDcYNovEdqRBPR5WyT36A">
- <children xmi:id="_ePJjANovEdqRBPR5WyT36A" type="ImageCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_ePJjAdovEdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_ePJjAtovEdqRBPR5WyT36A" type="Stereotype" element="_ePDcYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ePJjA9ovEdqRBPR5WyT36A" type="Kind" element="_ePDcYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ePJjBNovEdqRBPR5WyT36A" type="Name" element="_ePDcYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ePJjBdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjBtovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_ePJjB9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_ePJjCdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ePDcYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ePJjCtovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ePDcYtovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ePDcY9ovEdqRBPR5WyT36A" x="6693" y="3545"/>
- </children>
- <children xmi:id="_fs1pANovEdqRBPR5WyT36A" sourceEdges="_hmIF4dovEdqRBPR5WyT36A _pe3jwNovEdqRBPR5WyT36A" targetEdges="_xInjYdovEdqRBPR5WyT36A" element="_fsviYNovEdqRBPR5WyT36A">
- <children xmi:id="_fs1pA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_fsviYNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_fs1pBNovEdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_fs1pBdovEdqRBPR5WyT36A" type="Stereotype" element="_fsviYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_fs1pBtovEdqRBPR5WyT36A" type="Kind" element="_fsviYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_fs1pB9ovEdqRBPR5WyT36A" type="Name" element="_fsviYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_fs1pCNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_fsviYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pCdovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_fs1pCtovEdqRBPR5WyT36A" type="OperationCompartment" element="_fsviYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pC9ovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_fs1pDNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_fsviYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_fs1pDdovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_fs1pAdovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_fs1pAtovEdqRBPR5WyT36A" x="2226" y="8268"/>
- </children>
- <children xmi:id="_ikr_4NovEdqRBPR5WyT36A" sourceEdges="_mu9A4dovEdqRBPR5WyT36A" element="_ikl5QNovEdqRBPR5WyT36A">
- <children xmi:id="_ikr_49ovEdqRBPR5WyT36A" type="ImageCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_ikr_5NovEdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_ikr_5dovEdqRBPR5WyT36A" type="Stereotype" element="_ikl5QNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ikr_5tovEdqRBPR5WyT36A" type="Kind" element="_ikl5QNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ikr_59ovEdqRBPR5WyT36A" type="Name" element="_ikl5QNovEdqRBPR5WyT36A"/>
- <children xmi:id="_ikr_6NovEdqRBPR5WyT36A" type="AttributeCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_6dovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_ikr_6tovEdqRBPR5WyT36A" type="OperationCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_69ovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_ikr_7NovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_ikl5QNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_ikr_7dovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_ikr_4dovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ikr_4tovEdqRBPR5WyT36A" x="9222" y="8268"/>
- </children>
- <children xmi:id="_tZF9odovEdqRBPR5WyT36A" sourceEdges="_xInjYdovEdqRBPR5WyT36A _BkUg0dowEdqRBPR5WyT36A" element="_tZF9oNovEdqRBPR5WyT36A">
- <children xmi:id="_tZF9pNovEdqRBPR5WyT36A" type="ImageCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_tZF9pdovEdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_tZF9ptovEdqRBPR5WyT36A" type="Stereotype" element="_tZF9oNovEdqRBPR5WyT36A"/>
- <children xmi:id="_tZF9p9ovEdqRBPR5WyT36A" type="Kind" element="_tZF9oNovEdqRBPR5WyT36A"/>
- <children xmi:id="_tZF9qNovEdqRBPR5WyT36A" type="Name" element="_tZF9oNovEdqRBPR5WyT36A"/>
- <children xmi:id="_tZF9qdovEdqRBPR5WyT36A" type="AttributeCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9qtovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_tZF9q9ovEdqRBPR5WyT36A" type="OperationCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_tZF9rdovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_tZF9oNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_tZF9rtovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_tZF9otovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_tZF9o9ovEdqRBPR5WyT36A" x="2226" y="12084"/>
- </children>
- <children xmi:id="_z_m-oNovEdqRBPR5WyT36A" sourceEdges="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_3Ic-4NovEdqRBPR5WyT36A _9XeF4tovEdqRBPR5WyT36A _Fd3lQdowEdqRBPR5WyT36A" element="_z_g4ANovEdqRBPR5WyT36A">
- <children xmi:id="_z_m-o9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_z_m-pNovEdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_z_m-pdovEdqRBPR5WyT36A" type="Stereotype" element="_z_g4ANovEdqRBPR5WyT36A"/>
- <children xmi:id="_z_m-ptovEdqRBPR5WyT36A" type="Kind" element="_z_g4ANovEdqRBPR5WyT36A"/>
- <children xmi:id="_z_m-p9ovEdqRBPR5WyT36A" type="Name" element="_z_g4ANovEdqRBPR5WyT36A"/>
- <children xmi:id="_z_m-qNovEdqRBPR5WyT36A" type="AttributeCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-qdovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_z_m-qtovEdqRBPR5WyT36A" type="OperationCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-q9ovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_z_m-rNovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_z_g4ANovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_z_m-rdovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_z_m-odovEdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_z_m-otovEdqRBPR5WyT36A" x="17172" y="6996"/>
- </children>
- <children xmi:id="_1y-ZsNovEdqRBPR5WyT36A" sourceEdges="_3Ic-4NovEdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" targetEdges="_BkUg0dowEdqRBPR5WyT36A" element="_1yyMcNovEdqRBPR5WyT36A">
- <children xmi:id="_1y-Zs9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_1y-ZtNovEdqRBPR5WyT36A" width="1320" height="1320"/>
- </children>
- <children xmi:id="_1y-ZtdovEdqRBPR5WyT36A" type="Stereotype" element="_1yyMcNovEdqRBPR5WyT36A"/>
- <children xmi:id="_1y-ZttovEdqRBPR5WyT36A" type="Name" element="_1yyMcNovEdqRBPR5WyT36A"/>
- <children xmi:id="_1y-Zt9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZuNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_1y-ZudovEdqRBPR5WyT36A" type="OperationCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZutovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_1y-Zu9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_1y-ZvNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_1y-ZvdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_1yyMcNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_1y-ZvtovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_1y-ZsdovEdqRBPR5WyT36A" showStereotype="Label"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_1y-ZstovEdqRBPR5WyT36A" x="13992" y="12084"/>
- </children>
- <children xmi:id="_4WSrANovEdqRBPR5WyT36A" sourceEdges="_9XeF4tovEdqRBPR5WyT36A _9PaR4No2EdqRBPR5WyT36A" element="_4WMkYNovEdqRBPR5WyT36A">
- <children xmi:id="_4WSrA9ovEdqRBPR5WyT36A" type="ImageCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_4WSrBNovEdqRBPR5WyT36A" width="1320" height="1320"/>
- </children>
- <children xmi:id="_4WSrBdovEdqRBPR5WyT36A" type="Stereotype" element="_4WMkYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_4WSrBtovEdqRBPR5WyT36A" type="Name" element="_4WMkYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_4WSrB9ovEdqRBPR5WyT36A" type="AttributeCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_4WSrCdovEdqRBPR5WyT36A" type="OperationCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrCtovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_4WSrC9ovEdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_4WSrDNovEdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_4WSrDdovEdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_4WMkYNovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_4WSrDtovEdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_4WSrAdovEdqRBPR5WyT36A" showStereotype="Label"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_4WSrAtovEdqRBPR5WyT36A" x="19716" y="12084"/>
- </children>
- <children xmi:id="_o2m3oNo0EdqRBPR5WyT36A" targetEdges="_9PaR4No2EdqRBPR5WyT36A _9-BEUNo2EdqRBPR5WyT36A" element="_o2gxANo0EdqRBPR5WyT36A">
- <children xmi:id="_o2m3o9o0EdqRBPR5WyT36A" type="ImageCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_o2m3pNo0EdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_o2m3pdo0EdqRBPR5WyT36A" type="Stereotype" element="_o2gxANo0EdqRBPR5WyT36A"/>
- <children xmi:id="_o2m3pto0EdqRBPR5WyT36A" type="Kind" element="_o2gxANo0EdqRBPR5WyT36A"/>
- <children xmi:id="_o2m3p9o0EdqRBPR5WyT36A" type="Name" element="_o2gxANo0EdqRBPR5WyT36A"/>
- <children xmi:id="_o2m3qNo0EdqRBPR5WyT36A" type="AttributeCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3qdo0EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_o2m3qto0EdqRBPR5WyT36A" type="OperationCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3q9o0EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_o2m3rNo0EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_o2gxANo0EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_o2m3rdo0EdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_o2m3odo0EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_o2m3oto0EdqRBPR5WyT36A" x="23532" y="6996"/>
- </children>
- <children xmi:id="_M0FLkNo1EdqRBPR5WyT36A" targetEdges="_R5Rjwdo1EdqRBPR5WyT36A _V7zlEdo1EdqRBPR5WyT36A" element="_Mz_E8No1EdqRBPR5WyT36A">
- <children xmi:id="_M0FLk9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_M0FLlNo1EdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_M0FLldo1EdqRBPR5WyT36A" type="Stereotype" element="_Mz_E8No1EdqRBPR5WyT36A"/>
- <children xmi:id="_M0FLlto1EdqRBPR5WyT36A" type="Kind" element="_Mz_E8No1EdqRBPR5WyT36A"/>
- <children xmi:id="_M0FLl9o1EdqRBPR5WyT36A" type="Name" element="_Mz_E8No1EdqRBPR5WyT36A"/>
- <children xmi:id="_M0FLmNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLmdo1EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_M0FLmto1EdqRBPR5WyT36A" type="OperationCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLm9o1EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_M0FLnNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_Mz_E8No1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_M0FLndo1EdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_M0FLkdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_M0FLkto1EdqRBPR5WyT36A" x="6678" y="318"/>
- </children>
- <children xmi:id="_TJHbANo1EdqRBPR5WyT36A" sourceEdges="_V7zlEdo1EdqRBPR5WyT36A" targetEdges="_cN4xsdo2EdqRBPR5WyT36A" element="_TI7NwNo1EdqRBPR5WyT36A">
- <children xmi:id="_TJHbA9o1EdqRBPR5WyT36A" type="ImageCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_TJHbBNo1EdqRBPR5WyT36A" width="530" height="530"/>
- </children>
- <children xmi:id="_TJHbBdo1EdqRBPR5WyT36A" type="Stereotype" element="_TI7NwNo1EdqRBPR5WyT36A"/>
- <children xmi:id="_TJHbBto1EdqRBPR5WyT36A" type="Kind" element="_TI7NwNo1EdqRBPR5WyT36A"/>
- <children xmi:id="_TJHbB9o1EdqRBPR5WyT36A" type="Name" element="_TI7NwNo1EdqRBPR5WyT36A"/>
- <children xmi:id="_TJHbCNo1EdqRBPR5WyT36A" type="AttributeCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbCdo1EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_TJHbCto1EdqRBPR5WyT36A" type="OperationCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbC9o1EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_TJHbDNo1EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_TI7NwNo1EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_TJHbDdo1EdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLClassifierStyle" xmi:id="_TJHbAdo1EdqRBPR5WyT36A" showStereotype="Label" useClassifierShape="true"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_TJHbAto1EdqRBPR5WyT36A" x="16854" y="318"/>
- </children>
- <styles xmi:type="umlnotation:UMLDiagramStyle" xmi:id="_al1S89ovEdqRBPR5WyT36A"/>
- <edges xmi:id="_hmIF4dovEdqRBPR5WyT36A" element="_hmIF4NovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
- <children xmi:id="_hmIF5NovEdqRBPR5WyT36A" type="NameLabel" element="_hmIF4NovEdqRBPR5WyT36A">
- <children xmi:id="_hmIF5tovEdqRBPR5WyT36A" type="Stereotype" element="_hmIF4NovEdqRBPR5WyT36A"/>
- <children xmi:id="_hmIF59ovEdqRBPR5WyT36A" type="Name" element="_hmIF4NovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_hmIF5dovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_hmIF4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hmIF49ovEdqRBPR5WyT36A" points="[26, -31, -110, 148]$[140, -148, 4, 31]"/>
- </edges>
- <edges xmi:id="_mu9A4dovEdqRBPR5WyT36A" element="_mu9A4NovEdqRBPR5WyT36A" source="_ikr_4NovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
- <children xmi:id="_mu9A5NovEdqRBPR5WyT36A" type="NameLabel" element="_mu9A4NovEdqRBPR5WyT36A">
- <children xmi:id="_mu9A5tovEdqRBPR5WyT36A" type="Stereotype" element="_mu9A4NovEdqRBPR5WyT36A"/>
- <children xmi:id="_mu9A59ovEdqRBPR5WyT36A" type="Name" element="_mu9A4NovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_mu9A5dovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_mu9A4tovEdqRBPR5WyT36A" routing="Tree" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_mu9A49ovEdqRBPR5WyT36A" points="[-185, -820, 2937, 3916]$[-185, -3042, 2937, 1694]$[-3255, -3042, -133, 1694]$[-3255, -3916, -133, 820]"/>
- </edges>
- <edges xmi:id="_pe3jwNovEdqRBPR5WyT36A" element="_peM1YNovEdqRBPR5WyT36A" source="_fs1pANovEdqRBPR5WyT36A" target="_ePDcYdovEdqRBPR5WyT36A">
- <children xmi:id="_pe3jw9ovEdqRBPR5WyT36A" type="NameLabel" element="_peM1YNovEdqRBPR5WyT36A">
- <children xmi:id="_pe3jxdovEdqRBPR5WyT36A" type="Stereotype" element="_peM1YNovEdqRBPR5WyT36A"/>
- <children xmi:id="_pe3jxtovEdqRBPR5WyT36A" type="Name" element="_peM1YNovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jxNovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_pe3jx9ovEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_peM1YtovEdqRBPR5WyT36A">
- <children xmi:id="_pe3jydovEdqRBPR5WyT36A" type="ToMultiplicity" element="_peM1YtovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jyNovEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_pe3jytovEdqRBPR5WyT36A" type="ToRoleLabel" element="_peM1YtovEdqRBPR5WyT36A">
- <children xmi:id="_pe3jzNovEdqRBPR5WyT36A" type="ToRole" element="_peM1YtovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jy9ovEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_pe3jzdovEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_peM1YdovEdqRBPR5WyT36A">
- <children xmi:id="_pe3jz9ovEdqRBPR5WyT36A" type="FromMultiplicity" element="_peM1YdovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3jztovEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_pe3j0NovEdqRBPR5WyT36A" type="FromRoleLabel" element="_peM1YdovEdqRBPR5WyT36A">
- <children xmi:id="_pe3j0tovEdqRBPR5WyT36A" type="FromRole" element="_peM1YdovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j0dovEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_pe3j09ovEdqRBPR5WyT36A" type="ToQualifierLabel" element="_peM1YtovEdqRBPR5WyT36A">
- <children xmi:id="_pe3j1dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YtovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j1tovEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j1NovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_pe3j19ovEdqRBPR5WyT36A" type="FromQualifierLabel" element="_peM1YdovEdqRBPR5WyT36A">
- <children xmi:id="_pe3j2dovEdqRBPR5WyT36A" type="QualifierCompartment" element="_peM1YdovEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pe3j2tovEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pe3j2NovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pe3jwdovEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pe3jwtovEdqRBPR5WyT36A" points="[-317, -820, -3916, 3916]$[-1931, -4762, -5530, -26]$[2382, -4762, -1217, -26]"/>
- </edges>
- <edges xmi:id="_xInjYdovEdqRBPR5WyT36A" element="_xInjYNovEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_fs1pANovEdqRBPR5WyT36A">
- <children xmi:id="_xInjZNovEdqRBPR5WyT36A" type="NameLabel" element="_xInjYNovEdqRBPR5WyT36A">
- <children xmi:id="_xInjZtovEdqRBPR5WyT36A" type="Stereotype" element="_xInjYNovEdqRBPR5WyT36A"/>
- <children xmi:id="_xInjZ9ovEdqRBPR5WyT36A" type="Name" element="_xInjYNovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_xInjZdovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_xInjYtovEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_xInjY9ovEdqRBPR5WyT36A" points="[-4, -31, 1, 113]$[-4, -115, 1, 29]"/>
- </edges>
- <edges xmi:id="_3Ic-4NovEdqRBPR5WyT36A" element="_3IW4QNovEdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
- <children xmi:id="_3Ic-49ovEdqRBPR5WyT36A" type="NameLabel" element="_3IW4QNovEdqRBPR5WyT36A">
- <children xmi:id="_3Ic-5dovEdqRBPR5WyT36A" type="Stereotype" element="_3IW4QNovEdqRBPR5WyT36A"/>
- <children xmi:id="_3Ic-5tovEdqRBPR5WyT36A" type="Name" element="_3IW4QNovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_3Ic-5NovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_3Ic-4dovEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_3Ic-4tovEdqRBPR5WyT36A" points="[6, -24, -37, 154]$[-22, -170, -65, 8]"/>
- </edges>
- <edges xmi:id="_9XeF4tovEdqRBPR5WyT36A" element="_9XeF4NovEdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
- <children xmi:id="_9XeF5dovEdqRBPR5WyT36A" type="NameLabel" element="_9XeF4NovEdqRBPR5WyT36A">
- <children xmi:id="_9XeF59ovEdqRBPR5WyT36A" type="Stereotype" element="_9XeF4NovEdqRBPR5WyT36A"/>
- <children xmi:id="_9XeF6NovEdqRBPR5WyT36A" type="Name" element="_9XeF4NovEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9XeF5tovEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9XeF49ovEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9XeF5NovEdqRBPR5WyT36A" points="[-23, -23, 162, 151]$[-121, -170, 64, 4]"/>
- </edges>
- <edges xmi:id="_BkUg0dowEdqRBPR5WyT36A" element="_Bj8GUNowEdqRBPR5WyT36A" source="_tZF9odovEdqRBPR5WyT36A" target="_1y-ZsNovEdqRBPR5WyT36A">
- <children xmi:id="_BkancNowEdqRBPR5WyT36A" type="NameLabel" element="_Bj8GUNowEdqRBPR5WyT36A">
- <children xmi:id="_BkanctowEdqRBPR5WyT36A" type="Stereotype" element="_Bj8GUNowEdqRBPR5WyT36A"/>
- <children xmi:id="_Bkanc9owEdqRBPR5WyT36A" type="Name" element="_Bj8GUNowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkancdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_BkandNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
- <children xmi:id="_BkandtowEdqRBPR5WyT36A" type="ToMultiplicity" element="_Bj8GUtowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanddowEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_Bkand9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
- <children xmi:id="_BkanedowEdqRBPR5WyT36A" type="ToRole" element="_Bj8GUtowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkaneNowEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_BkanetowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
- <children xmi:id="_BkanfNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_Bj8GUdowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Bkane9owEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_BkanfdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
- <children xmi:id="_Bkanf9owEdqRBPR5WyT36A" type="FromRole" element="_Bj8GUdowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanftowEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_BkangNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_Bj8GUtowEdqRBPR5WyT36A">
- <children xmi:id="_BkangtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUtowEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkang9owEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkangdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_BkanhNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_Bj8GUdowEdqRBPR5WyT36A">
- <children xmi:id="_BkanhtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_Bj8GUdowEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Bkanh9owEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_BkanhdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_BkUg0towEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_BkUg09owEdqRBPR5WyT36A" points="[83, -24, -490, 123]$[486, -151, -87, -4]"/>
- </edges>
- <edges xmi:id="_Fd3lQdowEdqRBPR5WyT36A" element="_FdlRYNowEdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_z_m-oNovEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lRNowEdqRBPR5WyT36A" type="NameLabel" element="_FdlRYNowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lRtowEdqRBPR5WyT36A" type="Stereotype" element="_FdlRYNowEdqRBPR5WyT36A"/>
- <children xmi:id="_Fd3lR9owEdqRBPR5WyT36A" type="Name" element="_FdlRYNowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lRdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_Fd3lSNowEdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_FdlRYtowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lStowEdqRBPR5WyT36A" type="ToMultiplicity" element="_FdlRYtowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lSdowEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_Fd3lS9owEdqRBPR5WyT36A" type="ToRoleLabel" element="_FdlRYtowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lTdowEdqRBPR5WyT36A" type="ToRole" element="_FdlRYtowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lTNowEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_Fd3lTtowEdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_FdlRYdowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lUNowEdqRBPR5WyT36A" type="FromMultiplicity" element="_FdlRYdowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lT9owEdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_Fd3lUdowEdqRBPR5WyT36A" type="FromRoleLabel" element="_FdlRYdowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lU9owEdqRBPR5WyT36A" type="FromRole" element="_FdlRYdowEdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lUtowEdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_Fd3lVNowEdqRBPR5WyT36A" type="ToQualifierLabel" element="_FdlRYtowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lVtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYtowEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lV9owEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lVdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_Fd3lWNowEdqRBPR5WyT36A" type="FromQualifierLabel" element="_FdlRYdowEdqRBPR5WyT36A">
- <children xmi:id="_Fd3lWtowEdqRBPR5WyT36A" type="QualifierCompartment" element="_FdlRYdowEdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_Fd3lW9owEdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_Fd3lWdowEdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_Fd3lQtowEdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_Fd3lQ9owEdqRBPR5WyT36A" points="[46, -11, -369, -9]$[351, -11, -64, -9]"/>
- </edges>
- <edges xmi:id="_R5Rjwdo1EdqRBPR5WyT36A" element="_R5RjwNo1EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
- <children xmi:id="_R5RjxNo1EdqRBPR5WyT36A" type="NameLabel" element="_R5RjwNo1EdqRBPR5WyT36A">
- <children xmi:id="_R5Rjxto1EdqRBPR5WyT36A" type="Stereotype" element="_R5RjwNo1EdqRBPR5WyT36A"/>
- <children xmi:id="_R5Rjx9o1EdqRBPR5WyT36A" type="Name" element="_R5RjwNo1EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_R5Rjxdo1EdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_R5Rjwto1EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_R5Rjw9o1EdqRBPR5WyT36A" points="[-2, -31, -2, 91]$[-2, -91, -2, 31]"/>
- </edges>
- <edges xmi:id="_V7zlEdo1EdqRBPR5WyT36A" element="_V7zlENo1EdqRBPR5WyT36A" source="_TJHbANo1EdqRBPR5WyT36A" target="_M0FLkNo1EdqRBPR5WyT36A">
- <children xmi:id="_V7zlFNo1EdqRBPR5WyT36A" type="NameLabel" element="_V7zlENo1EdqRBPR5WyT36A">
- <children xmi:id="_V7zlFto1EdqRBPR5WyT36A" type="Stereotype" element="_V7zlENo1EdqRBPR5WyT36A"/>
- <children xmi:id="_V7zlF9o1EdqRBPR5WyT36A" type="Name" element="_V7zlENo1EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_V7zlFdo1EdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_V7zlEto1EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_V7zlE9o1EdqRBPR5WyT36A" points="[-73, 0, 339, 0]$[-457, 0, -45, 0]"/>
- </edges>
- <edges xmi:id="_cN4xsdo2EdqRBPR5WyT36A" targetEdges="_pdfmkNo2EdqRBPR5WyT36A" element="_cNskcNo2EdqRBPR5WyT36A" source="_z_m-oNovEdqRBPR5WyT36A" target="_TJHbANo1EdqRBPR5WyT36A">
- <children xmi:id="_cN4xtNo2EdqRBPR5WyT36A" type="NameLabel" element="_cNskcNo2EdqRBPR5WyT36A">
- <children xmi:id="_cN4xtto2EdqRBPR5WyT36A" type="Stereotype" element="_cNskcNo2EdqRBPR5WyT36A"/>
- <children xmi:id="_cN4xt9o2EdqRBPR5WyT36A" type="Name" element="_cNskcNo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xtdo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_cN4xuNo2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_cNskcto2EdqRBPR5WyT36A">
- <children xmi:id="_cN4xuto2EdqRBPR5WyT36A" type="ToMultiplicity" element="_cNskcto2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xudo2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_cN4xu9o2EdqRBPR5WyT36A" type="ToRoleLabel" element="_cNskcto2EdqRBPR5WyT36A">
- <children xmi:id="_cN4xvdo2EdqRBPR5WyT36A" type="ToRole" element="_cNskcto2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN4xvNo2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_cN_fYNo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_cNskcdo2EdqRBPR5WyT36A">
- <children xmi:id="_cN_fYto2EdqRBPR5WyT36A" type="FromMultiplicity" element="_cNskcdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fYdo2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_cN_fY9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_cNskcdo2EdqRBPR5WyT36A">
- <children xmi:id="_cN_fZdo2EdqRBPR5WyT36A" type="FromRole" element="_cNskcdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZNo2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_cN_fZto2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_cNskcto2EdqRBPR5WyT36A">
- <children xmi:id="_cN_faNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcto2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fado2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fZ9o2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_cN_fato2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_cNskcdo2EdqRBPR5WyT36A">
- <children xmi:id="_cN_fbNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_cNskcdo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_cN_fbdo2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_cN_fa9o2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_cN4xsto2EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_cN4xs9o2EdqRBPR5WyT36A" points="[-2, -29, 1, 91]$[26, -89, 29, 31]"/>
- </edges>
- <edges xmi:id="_pdfmkNo2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A" source="_ePDcYdovEdqRBPR5WyT36A" target="_cN4xsdo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfml9o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmmdo2EdqRBPR5WyT36A" type="ToMultiplicity" element="_pdTZUdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmmNo2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_pdfmmto2EdqRBPR5WyT36A" type="ToRoleLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmnNo2EdqRBPR5WyT36A" type="ToRole" element="_pdTZUdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmm9o2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_pdfmndo2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmn9o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_pdTZUNo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmnto2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_pdfmoNo2EdqRBPR5WyT36A" type="FromRoleLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmoto2EdqRBPR5WyT36A" type="FromRole" element="_pdTZUNo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmodo2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_pdfmo9o2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_pdTZUdo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmpdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUdo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmpto2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmpNo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_pdfmp9o2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_pdTZUNo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmqdo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_pdTZUNo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmqto2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_pdfmqNo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_pdfmq9o2EdqRBPR5WyT36A" element="_pdHMENo2EdqRBPR5WyT36A">
- <children xmi:id="_pdfmrto2EdqRBPR5WyT36A" type="ImageCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
- <layoutConstraint xmi:type="notation:Size" xmi:id="_pdfmr9o2EdqRBPR5WyT36A" width="1320" height="1320"/>
- </children>
- <children xmi:id="_pdfmsNo2EdqRBPR5WyT36A" type="Stereotype" element="_pdHMENo2EdqRBPR5WyT36A"/>
- <children xmi:id="_pdfmsdo2EdqRBPR5WyT36A" type="Name" element="_pdHMENo2EdqRBPR5WyT36A"/>
- <children xmi:id="_pdfmsto2EdqRBPR5WyT36A" type="AttributeCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfms9o2EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_pdfmtNo2EdqRBPR5WyT36A" type="OperationCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmtdo2EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_pdfmtto2EdqRBPR5WyT36A" visible="false" type="SignalCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_pdfmt9o2EdqRBPR5WyT36A"/>
- </children>
- <children xmi:id="_pdfmuNo2EdqRBPR5WyT36A" visible="false" type="StructureCompartment" element="_pdHMENo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLShapeCompartmentStyle" xmi:id="_pdfmudo2EdqRBPR5WyT36A"/>
- </children>
- <styles xmi:type="umlnotation:UMLShapeStyle" xmi:id="_pdfmrNo2EdqRBPR5WyT36A" showStereotype="Label"/>
- <layoutConstraint xmi:type="notation:Bounds" xmi:id="_pdfmrdo2EdqRBPR5WyT36A" y="1323"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_pdfmkdo2EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_pdfmkto2EdqRBPR5WyT36A" points="[46, 3, -366, 94]$[412, -91, 0, 0]"/>
- <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_pdrz0No2EdqRBPR5WyT36A" id="100"/>
- </edges>
- <edges xmi:id="_9PaR4No2EdqRBPR5WyT36A" element="_9PH-ANo2EdqRBPR5WyT36A" source="_4WSrANovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
- <children xmi:id="_9PaR49o2EdqRBPR5WyT36A" type="NameLabel" element="_9PH-ANo2EdqRBPR5WyT36A">
- <children xmi:id="_9PaR5do2EdqRBPR5WyT36A" type="Stereotype" element="_9PH-ANo2EdqRBPR5WyT36A"/>
- <children xmi:id="_9PaR5to2EdqRBPR5WyT36A" type="Name" element="_9PH-ANo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR5No2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_9PaR59o2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
- <children xmi:id="_9PaR6do2EdqRBPR5WyT36A" type="ToMultiplicity" element="_9PH-Ato2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR6No2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_9PaR6to2EdqRBPR5WyT36A" type="ToRoleLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
- <children xmi:id="_9PaR7No2EdqRBPR5WyT36A" type="ToRole" element="_9PH-Ato2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR69o2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_9PaR7do2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
- <children xmi:id="_9PaR79o2EdqRBPR5WyT36A" type="FromMultiplicity" element="_9PH-Ado2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR7to2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_9PaR8No2EdqRBPR5WyT36A" type="FromRoleLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
- <children xmi:id="_9PaR8to2EdqRBPR5WyT36A" type="FromRole" element="_9PH-Ado2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PaR8do2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_9PgYgNo2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_9PH-Ato2EdqRBPR5WyT36A">
- <children xmi:id="_9PgYgto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ato2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYg9o2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYgdo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_9PgYhNo2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_9PH-Ado2EdqRBPR5WyT36A">
- <children xmi:id="_9PgYhto2EdqRBPR5WyT36A" type="QualifierCompartment" element="_9PH-Ado2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9PgYh9o2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9PgYhdo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9PaR4do2EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9PaR4to2EdqRBPR5WyT36A" points="[12, -24, -94, 162]$[80, -155, -26, 31]"/>
- </edges>
- <edges xmi:id="_9-BEUNo2EdqRBPR5WyT36A" element="_99uwcNo2EdqRBPR5WyT36A" source="_1y-ZsNovEdqRBPR5WyT36A" target="_o2m3oNo0EdqRBPR5WyT36A">
- <children xmi:id="_9-BEU9o2EdqRBPR5WyT36A" type="NameLabel" element="_99uwcNo2EdqRBPR5WyT36A">
- <children xmi:id="_9-HK8No2EdqRBPR5WyT36A" type="Stereotype" element="_99uwcNo2EdqRBPR5WyT36A"/>
- <children xmi:id="_9-HK8do2EdqRBPR5WyT36A" type="Name" element="_99uwcNo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-BEVNo2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_9-HK8to2EdqRBPR5WyT36A" type="ToMultiplicityLabel" element="_99uwcto2EdqRBPR5WyT36A">
- <children xmi:id="_9-HK9No2EdqRBPR5WyT36A" type="ToMultiplicity" element="_99uwcto2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK89o2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_9-HK9do2EdqRBPR5WyT36A" type="ToRoleLabel" element="_99uwcto2EdqRBPR5WyT36A">
- <children xmi:id="_9-HK99o2EdqRBPR5WyT36A" type="ToRole" element="_99uwcto2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK9to2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_9-HK-No2EdqRBPR5WyT36A" type="FromMultiplicityLabel" element="_99uwcdo2EdqRBPR5WyT36A">
- <children xmi:id="_9-HK-to2EdqRBPR5WyT36A" type="FromMultiplicity" element="_99uwcdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK-do2EdqRBPR5WyT36A" y="397"/>
- </children>
- <children xmi:id="_9-HK-9o2EdqRBPR5WyT36A" type="FromRoleLabel" element="_99uwcdo2EdqRBPR5WyT36A">
- <children xmi:id="_9-HK_do2EdqRBPR5WyT36A" type="FromRole" element="_99uwcdo2EdqRBPR5WyT36A"/>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_No2EdqRBPR5WyT36A" y="-397"/>
- </children>
- <children xmi:id="_9-HK_to2EdqRBPR5WyT36A" type="ToQualifierLabel" element="_99uwcto2EdqRBPR5WyT36A">
- <children xmi:id="_9-HLANo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcto2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLAdo2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HK_9o2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <children xmi:id="_9-HLAto2EdqRBPR5WyT36A" type="FromQualifierLabel" element="_99uwcdo2EdqRBPR5WyT36A">
- <children xmi:id="_9-HLBNo2EdqRBPR5WyT36A" type="QualifierCompartment" element="_99uwcdo2EdqRBPR5WyT36A">
- <styles xmi:type="umlnotation:UMLListCompartmentStyle" xmi:id="_9-HLBdo2EdqRBPR5WyT36A"/>
- </children>
- <layoutConstraint xmi:type="notation:Location" xmi:id="_9-HLA9o2EdqRBPR5WyT36A" y="-185"/>
- </children>
- <styles xmi:type="umlnotation:UMLConnectorStyle" xmi:id="_9-BEUdo2EdqRBPR5WyT36A" showStereotype="Text"/>
- <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_9-BEUto2EdqRBPR5WyT36A" points="[49, -24, -290, 162]$[404, -163, 65, 23]"/>
- </edges>
- </contents>
- </eAnnotations>
- <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S9NovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1S9dovEdqRBPR5WyT36A" source="attributes">
- <details xmi:id="_al1S9tovEdqRBPR5WyT36A" key="version" value="0"/>
- </eAnnotations>
- <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
- <importedProfile href="pathmap://UML2_PROFILES/Basic.profile.uml2#_6mFRgK86Edih9-GG5afQ0g"/>
- </packageImport>
- <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S99ovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1S-NovEdqRBPR5WyT36A" source="attributes">
- <details xmi:id="_al1S-dovEdqRBPR5WyT36A" key="version" value="0"/>
- </eAnnotations>
- <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
- <importedProfile href="pathmap://UML2_PROFILES/Intermediate.profile.uml2#_Cz7csK87Edih9-GG5afQ0g"/>
- </packageImport>
- <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S-tovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1S-9ovEdqRBPR5WyT36A" source="attributes">
- <details xmi:id="_al1S_NovEdqRBPR5WyT36A" key="version" value="0"/>
- </eAnnotations>
- <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
- <importedProfile href="pathmap://UML2_PROFILES/Complete.profile.uml2#_M7pTkK87Edih9-GG5afQ0g"/>
- </packageImport>
- <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1S_dovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1S_tovEdqRBPR5WyT36A" source="attributes">
- <details xmi:id="_al1S_9ovEdqRBPR5WyT36A" key="version" value="0"/>
- </eAnnotations>
- <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
- <importedProfile href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default"/>
- </packageImport>
- <packageImport xmi:type="uml:ProfileApplication" xmi:id="_al1TANovEdqRBPR5WyT36A">
- <eAnnotations xmi:id="_al1TAdovEdqRBPR5WyT36A" source="attributes">
- <details xmi:id="_al1TAtovEdqRBPR5WyT36A" key="version" value="0"/>
- </eAnnotations>
- <importedPackage xmi:type="uml:Profile" href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
- <importedProfile href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment"/>
- </packageImport>
- <packageImport xmi:id="_al1TA9ovEdqRBPR5WyT36A">
- <importedPackage xmi:type="uml:Model" href="pathmap://UML2_LIBRARIES/UML2PrimitiveTypes.library.uml2#_EfRZoK86EdieaYgxtVWN8Q"/>
- </packageImport>
- <ownedMember xmi:type="uml:Interface" xmi:id="_ePDcYNovEdqRBPR5WyT36A" name="Context">
- <generalization xmi:id="_R5RjwNo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
- <ownedAttribute xmi:id="_FdlRYdowEdqRBPR5WyT36A" name="scopecontext" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_FdlRZNowEdqRBPR5WyT36A" value="1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_FdlRY9owEdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Interface" xmi:id="_fsviYNovEdqRBPR5WyT36A" name="CompositeContext">
- <generalization xmi:id="_hmIF4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
- <ownedAttribute xmi:id="_peM1YdovEdqRBPR5WyT36A" name="context" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A" aggregation="composite">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_peM1ZNovEdqRBPR5WyT36A" value="-1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_peM1Y9ovEdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Interface" xmi:id="_ikl5QNovEdqRBPR5WyT36A" name="AtomicContext">
- <generalization xmi:id="_mu9A4NovEdqRBPR5WyT36A" general="_ePDcYNovEdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_peM1YNovEdqRBPR5WyT36A" memberEnd="_peM1YdovEdqRBPR5WyT36A _peM1YtovEdqRBPR5WyT36A">
- <ownedEnd xmi:id="_peM1YtovEdqRBPR5WyT36A" visibility="private" type="_fsviYNovEdqRBPR5WyT36A" association="_peM1YNovEdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Interface" xmi:id="_tZF9oNovEdqRBPR5WyT36A" name="DeploymentContext">
- <generalization xmi:id="_xInjYNovEdqRBPR5WyT36A" general="_fsviYNovEdqRBPR5WyT36A"/>
- <ownedAttribute xmi:id="_Bj8GUdowEdqRBPR5WyT36A" name="modulescopecontext" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_Bj8GVNowEdqRBPR5WyT36A" value="1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_Bj8GU9owEdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Interface" xmi:id="_z_g4ANovEdqRBPR5WyT36A" name="ScopeContext">
- <ownedAttribute xmi:id="_cNskcdo2EdqRBPR5WyT36A" name="instancewrapper" visibility="private" type="_TI7NwNo1EdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cNskdNo2EdqRBPR5WyT36A" value="1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cNskc9o2EdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Class" xmi:id="_1yyMcNovEdqRBPR5WyT36A" name="ModuleScopeContext" clientDependency="_3IW4QNovEdqRBPR5WyT36A">
- <implementation xmi:id="_3IW4QNovEdqRBPR5WyT36A" client="_1yyMcNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
- <mapping xmi:id="_3IW4QdovEdqRBPR5WyT36A"/>
- </implementation>
- <ownedAttribute xmi:id="_99uwcdo2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_99uwdNo2EdqRBPR5WyT36A" value="1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_99uwc9o2EdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Class" xmi:id="_4WMkYNovEdqRBPR5WyT36A" name="HTTPSessionScopeContext" clientDependency="_9XeF4NovEdqRBPR5WyT36A">
- <implementation xmi:id="_9XeF4NovEdqRBPR5WyT36A" client="_4WMkYNovEdqRBPR5WyT36A" supplier="_z_g4ANovEdqRBPR5WyT36A" realizingClassifier="_z_g4ANovEdqRBPR5WyT36A" contract="_z_g4ANovEdqRBPR5WyT36A">
- <mapping xmi:id="_9XeF4dovEdqRBPR5WyT36A"/>
- </implementation>
- <ownedAttribute xmi:id="_9PH-Ado2EdqRBPR5WyT36A" name="scoperegistry" visibility="private" type="_o2gxANo0EdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A">
- <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_9PH-BNo2EdqRBPR5WyT36A" value="1"/>
- <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_9PH-A9o2EdqRBPR5WyT36A"/>
- </ownedAttribute>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_Bj8GUNowEdqRBPR5WyT36A" memberEnd="_Bj8GUdowEdqRBPR5WyT36A _Bj8GUtowEdqRBPR5WyT36A">
- <ownedEnd xmi:id="_Bj8GUtowEdqRBPR5WyT36A" visibility="private" type="_tZF9oNovEdqRBPR5WyT36A" association="_Bj8GUNowEdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_FdlRYNowEdqRBPR5WyT36A" memberEnd="_FdlRYdowEdqRBPR5WyT36A _FdlRYtowEdqRBPR5WyT36A">
- <ownedEnd xmi:id="_FdlRYtowEdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_FdlRYNowEdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Interface" xmi:id="_o2gxANo0EdqRBPR5WyT36A" name="ScopeRegistry"/>
- <ownedMember xmi:type="uml:Interface" xmi:id="_Mz_E8No1EdqRBPR5WyT36A" name="Lifecycle"/>
- <ownedMember xmi:type="uml:Interface" xmi:id="_TI7NwNo1EdqRBPR5WyT36A" name="InstanceWrapper">
- <generalization xmi:id="_V7zlENo1EdqRBPR5WyT36A" general="_Mz_E8No1EdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_cNskcNo2EdqRBPR5WyT36A" memberEnd="_cNskcdo2EdqRBPR5WyT36A _cNskcto2EdqRBPR5WyT36A">
- <ownedEnd xmi:id="_cNskcto2EdqRBPR5WyT36A" visibility="private" type="_z_g4ANovEdqRBPR5WyT36A" association="_cNskcNo2EdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:AssociationClass" xmi:id="_pdHMENo2EdqRBPR5WyT36A" name="AssociationClass1" memberEnd="_pdTZUNo2EdqRBPR5WyT36A _pdTZUdo2EdqRBPR5WyT36A">
- <ownedEnd xmi:id="_pdTZUNo2EdqRBPR5WyT36A" visibility="private" type="_cNskcNo2EdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
- <ownedEnd xmi:id="_pdTZUdo2EdqRBPR5WyT36A" visibility="private" type="_ePDcYNovEdqRBPR5WyT36A" association="_pdHMENo2EdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_9PH-ANo2EdqRBPR5WyT36A" memberEnd="_9PH-Ado2EdqRBPR5WyT36A _9PH-Ato2EdqRBPR5WyT36A">
- <ownedEnd xmi:id="_9PH-Ato2EdqRBPR5WyT36A" visibility="private" type="_4WMkYNovEdqRBPR5WyT36A" association="_9PH-ANo2EdqRBPR5WyT36A"/>
- </ownedMember>
- <ownedMember xmi:type="uml:Association" xmi:id="_99uwcNo2EdqRBPR5WyT36A" memberEnd="_99uwcdo2EdqRBPR5WyT36A _99uwcto2EdqRBPR5WyT36A">
- <ownedEnd xmi:id="_99uwcto2EdqRBPR5WyT36A" visibility="private" type="_1yyMcNovEdqRBPR5WyT36A" association="_99uwcNo2EdqRBPR5WyT36A"/>
- </ownedMember>
-</uml:Model>
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java
deleted file mode 100644
index ed4b57639c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ComponentContextFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.context;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.ComponentContext;
-
-/**
- * Interface implemented by the provider of the ComponentContext.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentContextFactory {
- /**
- * Create an instance of ComponentContext
- *
- * @param component The runtime component
- * @param requestContextFactory The factory to create RequestContext
- * @return An instance of ComponentContext for the component
- */
- ComponentContext createComponentContext(RuntimeComponent component, RequestContextFactory requestContextFactory);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java
deleted file mode 100644
index e92a8f2844..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/ContextFactoryExtensionPoint.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.context;
-
-/**
- * An extension point for context factories.
- *
- * @version $Rev$ $Date$
- */
-public interface ContextFactoryExtensionPoint {
-
- /**
- * Add a context factory extension.
- *
- * @param factory The factory to add
- */
- void addFactory(Object factory);
-
- /**
- * Remove a context factory extension.
- *
- * @param factory The factory to remove
- */
- void removeFactory(Object factory);
-
- /**
- * Get a factory implementing the given interface.
- * @param factoryInterface the lookup key (factory interface)
- * @return The factory
- */
- <T> T getFactory(Class<T> factoryInterface);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.java
deleted file mode 100644
index 5a0aefe55d..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPoint.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.context;
-
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a model factory extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultContextFactoryExtensionPoint implements ContextFactoryExtensionPoint {
-
- /**
- * The Map of Factories that have been registered.
- */
- private HashMap<Class<?>, Object> factories = new HashMap<Class<?>, Object>();
-
- private ExtensionPointRegistry registry;
-
- public DefaultContextFactoryExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- /**
- * Add a model factory extension.
- *
- * @param factory The factory to add.
- * @throws IllegalArgumentException if factory is null
- */
- public void addFactory(Object factory) throws IllegalArgumentException {
- if (factory == null) {
- throw new IllegalArgumentException("Cannot add null as a factory");
- }
-
- Class<?>[] interfaces = factory.getClass().getInterfaces();
- for (int i = 0; i<interfaces.length; i++) {
- factories.put(interfaces[i], factory);
- }
- }
-
- /**
- * Remove a model factory extension.
- *
- * @param factory The factory to remove
- * @throws IllegalArgumentException if factory is null
- */
- public void removeFactory(Object factory) throws IllegalArgumentException {
- if (factory == null) {
- throw new IllegalArgumentException("Cannot remove null as a factory");
- }
-
- Class<?>[] interfaces = factory.getClass().getInterfaces();
- for (int i = 0; i<interfaces.length; i++) {
- factories.remove(interfaces[i]);
- }
- }
-
- /**
- * Get a factory implementing the given interface.
- *
- * @param factoryInterface The lookup key (factory interface)
- * @return The factory
- */
- public <T> T getFactory(Class<T> factoryInterface) throws IllegalArgumentException {
- if (factoryInterface == null) {
- throw new IllegalArgumentException("Cannot get null as a factory");
- }
-
- Object factory = factories.get(factoryInterface);
- if (factory == null) {
-
- // Dynamically load a factory class declared under META-INF/services
- try {
- Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(factoryInterface);
- if (factoryClass != null) {
-
- // Default empty constructor
- Constructor<?> constructor = factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
-
- // Cache the loaded factory
- addFactory(factory);
- }
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
-
- }
-
- return factoryInterface.cast(factory);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.java
deleted file mode 100644
index 9766e164b8..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/PropertyValueFactory.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.context;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-
-/**
- * Interface implemented by the provider of the property values
- *
- * @version $Rev$ $Date$
- */
-public interface PropertyValueFactory {
-
- /**
- * This method will create an instance of the value for the specified Property.
- *
- * @param property The Property from which to retrieve the property value
- * @param type The type of the property value being retrieved from the Property
- * @param <B> Type type of the property value being looked up
- *
- * @return the value for the Property
- */
- <B> B createPropertyValue(ComponentProperty property, Class<B> type);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.java
deleted file mode 100644
index 546757c766..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/context/RequestContextFactory.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.context;
-
-import org.osoa.sca.RequestContext;
-
-/**
- * Interface implemented by the provider of the RequestContext.
- *
- * @version $Rev$ $Date$
- */
-public interface RequestContextFactory {
- /**
- * @return An instance of RequestContext for the current invocation
- */
- RequestContext createRequestContext();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java
deleted file mode 100644
index 04ac4ee20c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/DefaultEndpointResolverFactoryExtensionPoint.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.endpointresolver;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a provider factory extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultEndpointResolverFactoryExtensionPoint implements EndpointResolverFactoryExtensionPoint {
-
- private ExtensionPointRegistry registry;
- private final Map<Class<?>, EndpointResolverFactory> endpointResolverFactories = new HashMap<Class<?>, EndpointResolverFactory>();
- private boolean loaded;
-
- /**
- * The default constructor. Does nothing.
- *
- */
- public DefaultEndpointResolverFactoryExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- /**
- * Add an endpoint resolver factory.
- *
- * @param endpointResolverFactory The resolver factory
- */
- public void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){
- endpointResolverFactories.put(endpointResolverFactory.getModelType(), endpointResolverFactory);
- }
-
- /**
- * Remove a endpoint resolver factory.
- *
- * @param endpointResolverFactory The endpoint resolver factory
- */
- public void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory){
- endpointResolverFactories.remove(endpointResolverFactory.getModelType());
- }
-
- /**
- * Returns the provider factory associated with the given model type.
- * @param modelType A model type
- * @return The provider factory associated with the given model type
- */
- public EndpointResolverFactory getEndpointResolverFactory(Class<?> modelType) {
- loadProviderFactories();
-
- Class<?>[] classes = modelType.getInterfaces();
- for (Class<?> c : classes) {
- EndpointResolverFactory factory = endpointResolverFactories.get(c);
- if (factory != null) {
- return factory;
- }
- }
- return endpointResolverFactories.get(modelType);
- }
-
-
- /**
- * Load provider factories declared under META-INF/services.
- * @param registry
- */
- private synchronized void loadProviderFactories() {
- if (loaded)
- return;
-
- // Get the provider factory service declarations
- Set<ServiceDeclaration> factoryDeclarations;
- ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
- try {
- factoryDeclarations = serviceDiscovery.getServiceDeclarations(EndpointResolverFactory.class);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- // Get the extension point
- EndpointResolverFactoryExtensionPoint factoryExtensionPoint =
- registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
- List<EndpointResolverFactory> factories = new ArrayList<EndpointResolverFactory>();
-
- for (ServiceDeclaration factoryDeclaration : factoryDeclarations) {
- Map<String, String> attributes = factoryDeclaration.getAttributes();
-
- // Find the model type that identifies this resolver
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- EndpointResolverFactory factory =
- new LazyEndpointResolverFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addEndpointResolverFactory(factory);
- factories.add(factory);
- }
-
- loaded = true;
- }
-
- /**
- * A wrapper around an endpoint provider factory allowing lazy
- * loading and initialization of endpoint providers.
- */
- private class LazyEndpointResolverFactory implements EndpointResolverFactory {
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration providerClass;
- private EndpointResolverFactory factory;
- private Class modelType;
-
- private LazyEndpointResolverFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration providerClass) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.providerClass = providerClass;
- }
-
- @SuppressWarnings("unchecked")
- private EndpointResolverFactory getFactory() {
- if (factory == null) {
- try {
- Class<EndpointResolverFactory> factoryClass = (Class<EndpointResolverFactory>)providerClass.loadClass();
- Constructor<EndpointResolverFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
- return getFactory().createEndpointResolver(endpoint, binding);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
- modelType = providerClass.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.java
deleted file mode 100644
index 79a10f6d84..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolver.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.endpointresolver;
-
-
-/**
- * A reference binding implementation can options implement this
- * interface to tie into the Tuscany SCA runtime
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointResolver {
-
- /**
- * This method will be invoked when the endpoint is
- * activated. It gives the resolver the opportunity
- * to do any set up ready for when it is asked to
- * resolve the endpoint when a message arrives
- */
- void start();
-
- /**
- * This method will be invoked when the endpoint is
- * to be resolved. The resolver will attempt to resolve the
- * endpoint against available services. The resolvers extending
- * this interface will provide environment or binding specific
- * resolution processing
- */
- void resolve();
-
- /**
- * This method will be invoked when the endpont is
- * deactivated. It gives the resolver the opportunity
- * to take and required resolver shutdown actions
- */
- void stop();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.java
deleted file mode 100644
index fdd304a9c7..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactory.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.endpointresolver;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-
-/**
- * A factory for creating the runtime artifacts that resolve endpoints.
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointResolverFactory <M>{
-
- /**
- * Creates a new endpoint resolver for the given component,
- * reference and binding.
- *
- * @param component The runtime component
- * @param reference The reference on the runtime component
- * @param enpoint The endpoint assembly model object
- * @return The endpoint provider
- */
- EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding);
-
- Class<M> getModelType();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java
deleted file mode 100644
index be55981131..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/endpointresolver/EndpointResolverFactoryExtensionPoint.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.endpointresolver;
-
-import java.util.List;
-
-
-/**
- * An extension point for resolver factories. Holds all of the resolver
- * factories from loaded extension points. Allows a resolver factory
- * to be located based on a given model type. Hence the runtime can
- * generate endpoint resolvers from the in memory assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointResolverFactoryExtensionPoint {
-
-
- /**
- * Add an endpoint resolver factory.
- *
- * @param endpointResolverFactory The resolver factory
- */
- void addEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory);
-
- /**
- * Remove a endpoint resolver factory.
- *
- * @param endpointResolverFactory The endpoint resolver factory
- */
- void removeEndpointResolverFactory(EndpointResolverFactory endpointResolverFactory);
-
- /**
- * Returns the endpoint resolver factory associated with the given binding type.
- * @param bindingType A binding type
- * @return The endpoint resolver factory associated with the given binding type
- */
- EndpointResolverFactory getEndpointResolverFactory(Class<?> bindingType);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java
deleted file mode 100644
index 992c1188f7..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.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.event;
-
-/**
- * The base interface for events that are propagated in the runtime
- *
- * @version $Rev$ $Date$
- */
-public interface Event {
-
- /**
- * Returns the source of the event
- */
- Object getSource();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java
deleted file mode 100644
index d17aebd7e8..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.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.event;
-
-/**
- * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event
- *
- * @version $Rev$ $Date$
- */
-public interface EventFilter {
-
- /**
- * Performs the actual evaluation on an event
- * @param event Returns true if the event matches implemented criteria
- * @return Match result
- */
- boolean match(Event event);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java
deleted file mode 100644
index f209eb8936..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.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.event;
-
-/**
- * Publishes events in the runtime by accepting {@link Event} objects and
- * forwarding them to all registered {@link RuntimeEventListener} objects.
- *
- * @version $Rev$ $Date$
- */
-public interface EventPublisher {
-
- /**
- * Publish an event to all registered listeners
- * @param object The event to publish
- */
- void publish(Event object);
-
- /**
- * Registers a listener to receive notifications for the context
- * @param listener The listener to add
- */
- void addListener(RuntimeEventListener listener);
-
- /**
- * Registers a listener to receive notifications for the context
- * @param filter The filter that will be applied before the lister is called
- * @param listener The lister to add
- */
- void addListener(EventFilter filter, RuntimeEventListener listener);
-
-
- /**
- * Removes a previously registered listener
- * @param listener The listener to remove
- */
- void removeListener(RuntimeEventListener listener);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java
deleted file mode 100644
index b34dceee62..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.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.event;
-
-import java.util.EventListener;
-
-/**
- * Listeners observe events fired in the SCA runtime.
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeEventListener extends EventListener {
-
- /**
- * Accepts and event and acts on it
- * @param event The event to act on
- */
- void onEvent(Event event);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java
deleted file mode 100644
index f888908340..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.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.event;
-
-/**
- * An event filter that always returns a true condition
- *
- * @version $Rev$ $Date$
- */
-public class TrueFilter implements EventFilter {
-
- /**
- * Performs the actual evaluation on an event. Always returns true
- * in this case
- * @param event The incoming event which is ignored
- * @return true
- */
- public boolean match(Event event) {
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java
deleted file mode 100644
index 957a15ce8a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/DataExchangeSemantics.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.invocation;
-
-/**
- * An invoker or interceptor can optionally implement this interface to indicate if they can
- * enforce the pass-by-value semantics for an operation on remotable interfaces.
- *
- * @version $Rev$ $Date$
- */
-public interface DataExchangeSemantics {
- /**
- * Indicate if the data can be passed in by reference as they won't be mutated.
- * @return true if pass-by-reference is allowed
- */
- boolean allowsPassByReference();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.java
deleted file mode 100644
index a5f221fc11..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Interceptor.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.invocation;
-
-/**
- * Synchronous mediation associated with a client- or target- side wire.
- *
- * @version $Rev$ $Date$
- */
-public interface Interceptor extends Invoker {
-
- /**
- * Sets the next invoker
- * @param next The next invoker
- */
- void setNext(Invoker next);
-
- /**
- * Returns the next invoker or null
- * @return The next Invoker
- */
- Invoker getNext();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.java
deleted file mode 100644
index 75719bb0cc..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/InvocationChain.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.invocation;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * A wire consists of 1..n invocation chains associated with the operations of its source service contract.
- * <p/>
- * Invocation chains may contain <code>Interceptors</code> that process invocations.
- * <p/>
- * A <code>Message</code> is used to pass data associated with an invocation through the chain.
- *
- * @version $Rev$ $Date$
- */
-public interface InvocationChain {
- /**
- * Returns the target operation for this invocation chain.
- *
- * @return The target operation for this invocation chain
- */
- Operation getTargetOperation();
-
- /**
- * Updates the target operation for this invocation chain.
- *
- * @param operation The new target operation for this invocation chain
- */
- void setTargetOperation(Operation operation);
-
- /**
- * Returns the source operation for this invocation chain.
- *
- * @return The source operation for this invocation chain
- */
- Operation getSourceOperation();
-
- /**
- * Adds an interceptor to the chain. For reference side, it will be added to
- * Phase.REFERENCE. For service side, it will be added to Phase.SERVICE
- *
- * @param interceptor The interceptor to add
- */
- void addInterceptor(Interceptor interceptor);
-
- /**
- * Adds an invoker to the chain
- *
- * @param invoker The invoker to add
- */
- void addInvoker(Invoker invoker);
-
- /**
- * Returns the first invoker in the chain.
- *
- * @return The first invoker in the chain
- */
- Invoker getHeadInvoker();
-
- /**
- * @deprecated This method is not used
- * Returns the last invoker in the chain.
- *
- * @return The last invoker in the chain
- */
- @Deprecated
- Invoker getTailInvoker();
-
- /**
- * @deprecated Please use <code>void addInterceptor(String phase, Interceptor interceptor);</code>
- * Adds an interceptor at the given position in the interceptor stack
- *
- * @param index The position in the interceptor stack to add the interceptor
- * @param interceptor The interceptor to add
- */
- @Deprecated
- void addInterceptor(int index, Interceptor interceptor);
-
- /**
- * Add an interceptor to the given phase
- * @param phase
- * @param interceptor
- */
- void addInterceptor(String phase, Interceptor interceptor);
-
- /**
- * Indicate if the data can be passed in by reference as they won't be mutated.
- * @return true if pass-by-reference is allowed
- */
- boolean allowsPassByReference();
- /**
- * Force the invocation to allow pass-by-reference
- * @param allowsPBR
- */
- void setAllowsPassByReference(boolean allowsPBR);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.java
deleted file mode 100644
index 2748bbed9a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Invoker.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.invocation;
-
-/**
- * Synchronous mediation associated with a client- or target- side wire.
- *
- * @version $Rev$ $Date$
- */
-public interface Invoker {
-
- /**
- * Process a synchronous wire
- *
- * @param msg The request Message for the wire
- * @return The response Message from the wire
- */
- Message invoke(Message msg);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
deleted file mode 100644
index 16cb4132e4..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Message.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.invocation;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-
-/**
- * Represents a request, response, or exception flowing through a wire
- *
- * @version $Rev $Date$
- */
-public interface Message {
-
- /**
- * Returns the body of the message, which will be the payload or parameters associated with the wire
- * @return The body of the message
- */
- <T> T getBody();
-
- /**
- * Sets the body of the message.
- * @param body The body of the message
- */
- <T> void setBody(T body);
-
- /**
- * Get the end point reference of the source reference
- * @return The end point reference of the reference originating the message
- */
- EndpointReference getFrom();
-
- /**
- * Set the end point reference of the reference originating the message
- * @param from The end point reference of the reference originating the message
- */
- void setFrom(EndpointReference from);
-
- /**
- * Get the end point reference of target service
- * @return The end point reference of the service that the message targets
- */
- EndpointReference getTo();
-
- /**
- * Set the end point reference of target service
- * @param to The end point reference of the service that the message targets
- */
- void setTo(EndpointReference to);
-
- /**
- * Returns the id of the message
- * @return The message Id
- */
- Object getMessageID();
-
- /**
- * Sets the id of the message
- * @param messageId The message ID
- */
- void setMessageID(Object messageId);
-
- /**
- * Determines if the message represents a fault/exception
- *
- * @return true If the message body is a fault object, false if the body is a normal payload
- */
- boolean isFault();
-
- /**
- * Set the message body with a fault object. After this method is called, isFault() returns true.
- *
- * @param fault The fault object represents an exception
- */
- <T> void setFaultBody(T fault);
-
- /**
- * Returns the operation that created the message.
- *
- * @return The operation that created the message
- */
- Operation getOperation();
-
- /**
- * Sets the operation that created the message.
- *
- * @param op The operation that created the message
- */
- void setOperation(Operation op);
-
- /**
- * Returns a list of objects that are contained in the message header
- *
- * @return
- */
- List<Object> getHeaders();
-
- /**
- * Returns the binding context in force for this message
- */
- <T> T getBindingContext();
-
- /**
- * Set the binding context that is in force for this message
- * @param bindingContext
- */
- <T> void setBindingContext(T bindingContext);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.java
deleted file mode 100644
index 38c900e36a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/MessageFactory.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.invocation;
-
-
-/**
- * A factory for messages
- *
- * @version $Rev $Date$
- */
-public interface MessageFactory {
-
- /**
- * Creates a new message.
- *
- * @return The new message
- */
- Message createMessage();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java
deleted file mode 100644
index af8ad6e582..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/invocation/Phase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.invocation;
-
-/**
- * Tuscany built-in phases for the invocation chain
- *
- * @version $Rev$ $Date$
- */
-public interface Phase {
- // The first phase for outgoing invocations via a reference
- String REFERENCE = "component.reference";
-
- // data transformation and validation
- String REFERENCE_INTERFACE = "reference.interface";
-
- // reference policy handling
- String REFERENCE_POLICY = "reference.policy";
-
- // reference binding invoker
- String REFERENCE_BINDING = "reference.binding";
-
- String REFERENCE_BINDING_WIREFORMAT = "reference.binding.wireformat";
- String REFERENCE_BINDING_POLICY = "reference.binding.policy";
- String REFERENCE_BINDING_TRANSPORT = "reference.binding.transport";
-
- String SERVICE_BINDING_TRANSPORT = "service.binding.transport";
- String SERVICE_BINDING_OPERATION_SELECTOR = "service.binding.operationselector";
- String SERVICE_BINDING_WIREFORMAT = "service.binding.wireformat";
- String SERVICE_BINDING_POLICY = "service.binding.policy";
-
-
- // The first phase for incoming invocations via a service
- String SERVICE_BINDING = "service.binding";
-
- // service policy handling
- String SERVICE_POLICY = "service.policy";
-
- // data validation and transformation
- String SERVICE_INTERFACE = "service.interface";
-
- // TODO: not sure if we need to have this face
- String SERVICE = "component.service";
-
- // implementation policy handling
- String IMPLEMENTATION_POLICY = "implementation.policy";
-
- // implementation invoker
- String IMPLEMENTATION = "component.implementation";
-
- // String getName();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
deleted file mode 100644
index 3887db4873..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/management/ManagementService.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.management;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Interface for the management service abstraction. The implementation
- * could be based on a variety of technologies including JMX, WSDM,
- * SNMP etc.
- *
- * @version $Revision$ $Date$
- */
-public interface ManagementService {
-
- /**
- * Registers a component for management.
- *
- * @param name Name of the component.
- * @param component Component to be registered.
- */
- void registerComponent(String name, RuntimeComponent component);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
deleted file mode 100644
index 0f6a932c51..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/BindingProviderFactory.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A factory for creating the runtime artifacts that represent bindings.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingProviderFactory<M extends Binding> extends ProviderFactory<M> {
-
- /**
- * Creates a new reference binding provider for the given component and
- * reference.
- *
- * @param component The runtime component
- * @param reference The reference on the runtime component
- * @param binding The binding assembly model object
- * @return The binding provider
- */
- ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- M binding);
-
- /**
- * Creates a new service binding provider for the given component and
- * service.
- *
- * @param component The runtime component
- * @param service The service on the runtime component
- * @param binding The binding assembly model object
- * @return The binding provider
- */
- ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- M binding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
deleted file mode 100644
index df46af121c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultProviderFactoryExtensionPoint.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Default implementation of a provider factory extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultProviderFactoryExtensionPoint implements ProviderFactoryExtensionPoint {
-
- private ExtensionPointRegistry registry;
- private final Map<Class<?>, ProviderFactory> providerFactories = new HashMap<Class<?>, ProviderFactory>();
- private final List<PolicyProviderFactory> policyProviderFactories = new ArrayList<PolicyProviderFactory>();
- private boolean loaded;
-
- /**
- * The default constructor. Does nothing.
- *
- */
- public DefaultProviderFactoryExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- /**
- * Add a provider factory.
- *
- * @param providerFactory The provider factory
- */
- public void addProviderFactory(ProviderFactory providerFactory) {
- if(providerFactory instanceof PolicyProviderFactory) {
- policyProviderFactories.add((PolicyProviderFactory)providerFactory);
- }
- providerFactories.put(providerFactory.getModelType(), providerFactory);
- }
-
- /**
- * Remove a provider factory.
- *
- * @param providerFactory The provider factory
- */
- public void removeProviderFactory(ProviderFactory providerFactory) {
- if(providerFactory instanceof PolicyProviderFactory) {
- policyProviderFactories.remove((PolicyProviderFactory)providerFactory);
- }
- providerFactories.remove(providerFactory.getModelType());
- }
-
- /**
- * Returns the provider factory associated with the given model type.
- * @param modelType A model type
- * @return The provider factory associated with the given model type
- */
- public ProviderFactory getProviderFactory(Class<?> modelType) {
- loadProviderFactories();
-
- Class<?>[] classes = modelType.getInterfaces();
- for (Class<?> c : classes) {
- ProviderFactory factory = providerFactories.get(c);
- if (factory != null) {
- return factory;
- }
- }
- return providerFactories.get(modelType);
- }
-
- public List<PolicyProviderFactory> getPolicyProviderFactories() {
- loadProviderFactories();
- return policyProviderFactories;
- }
-
- /**
- * Load provider factories declared under META-INF/services.
- * @param registry
- */
- private synchronized void loadProviderFactories() {
- if (loaded)
- return;
-
- loadProviderFactories(BindingProviderFactory.class);
- loadProviderFactories(ImplementationProviderFactory.class);
- loadProviderFactories(PolicyProviderFactory.class);
- loadProviderFactories(WireFormatProviderFactory.class);
- loadProviderFactories(OperationSelectorProviderFactory.class);
-
- loaded = true;
- }
-
- /**
- * Load provider factories declared under META-INF/services.
- * @param registry
- * @param factoryClass
- * @return
- */
- private List<ProviderFactory> loadProviderFactories(Class<?> factoryClass) {
-
- // Get the provider factory service declarations
- Set<ServiceDeclaration> factoryDeclarations;
- ServiceDiscovery serviceDiscovery = ServiceDiscovery.getInstance();
- try {
- factoryDeclarations = serviceDiscovery.getServiceDeclarations(factoryClass);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- // Get the target extension point
- ProviderFactoryExtensionPoint factoryExtensionPoint =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- List<ProviderFactory> factories = new ArrayList<ProviderFactory>();
-
- for (ServiceDeclaration factoryDeclaration : factoryDeclarations) {
- Map<String, String> attributes = factoryDeclaration.getAttributes();
-
- // Load an implementation provider factory
- if (factoryClass == ImplementationProviderFactory.class) {
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- ImplementationProviderFactory factory =
- new LazyImplementationProviderFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addProviderFactory(factory);
- factories.add(factory);
-
- } else if (factoryClass == BindingProviderFactory.class) {
-
- // Load a binding provider factory
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- BindingProviderFactory factory =
- new LazyBindingProviderFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addProviderFactory(factory);
- factories.add(factory);
- } else if (factoryClass == PolicyProviderFactory.class) {
- // Load a policy provider factory
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- PolicyProviderFactory factory =
- new LazyPolicyProviderFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addProviderFactory(factory);
- factories.add(factory);
- } else if (factoryClass == WireFormatProviderFactory.class) {
-
- // Load a wire format provider factory
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- WireFormatProviderFactory factory =
- new LazyWireFormatProviderFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addProviderFactory(factory);
- factories.add(factory);
- } else if (factoryClass == OperationSelectorProviderFactory.class) {
-
- // Load a wire format provider factory
- String modelTypeName = attributes.get("model");
-
- // Create a provider factory wrapper and register it
- OperationSelectorProviderFactory factory =
- new LazyOperationSelectorProviderFactory(registry, modelTypeName, factoryDeclaration);
- factoryExtensionPoint.addProviderFactory(factory);
- factories.add(factory);
- }
- }
- return factories;
- }
-
- /**
- * A wrapper around an implementation provider factory allowing lazy
- * loading and initialization of implementation providers.
- */
- private static class LazyBindingProviderFactory implements BindingProviderFactory {
-
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration factoryDeclaration;
- private BindingProviderFactory factory;
- private Class modelType;
-
- private LazyBindingProviderFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration factoryDeclaration) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.factoryDeclaration = factoryDeclaration;
- }
-
- @SuppressWarnings("unchecked")
- private BindingProviderFactory getFactory() {
- if (factory == null) {
- try {
- Class<BindingProviderFactory> factoryClass =
- (Class<BindingProviderFactory>)factoryDeclaration.loadClass();
- Constructor<BindingProviderFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- @SuppressWarnings("unchecked")
- public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return getFactory().createReferenceBindingProvider(component, reference, binding);
- }
-
- @SuppressWarnings("unchecked")
- public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return getFactory().createServiceBindingProvider(component, service, binding);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
- modelType = factoryDeclaration.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
-
- }
-
- /**
- * A wrapper around an implementation provider factory allowing lazy
- * loading and initialization of implementation providers.
- */
- private class LazyImplementationProviderFactory implements ImplementationProviderFactory {
-
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration providerClass;
- private ImplementationProviderFactory factory;
- private Class modelType;
-
- private LazyImplementationProviderFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration providerClass) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.providerClass = providerClass;
- }
-
- @SuppressWarnings("unchecked")
- private ImplementationProviderFactory getFactory() {
- if (factory == null) {
- try {
- Class<ImplementationProviderFactory> factoryClass =
- (Class<ImplementationProviderFactory>)providerClass.loadClass();
- Constructor<ImplementationProviderFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- @SuppressWarnings("unchecked")
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- Implementation Implementation) {
- return getFactory().createImplementationProvider(component, Implementation);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
-
- modelType = providerClass.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
-
- }
-
- /**
- * A wrapper around an policy provider factory allowing lazy
- * loading and initialization of policy providers.
- */
- private class LazyPolicyProviderFactory implements PolicyProviderFactory {
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration providerClass;
- private PolicyProviderFactory factory;
- private Class modelType;
-
- private LazyPolicyProviderFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration providerClass) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.providerClass = providerClass;
- }
-
- @SuppressWarnings("unchecked")
- private PolicyProviderFactory getFactory() {
- if (factory == null) {
- try {
- Class<PolicyProviderFactory> factoryClass = (Class<PolicyProviderFactory>)providerClass.loadClass();
- Constructor<PolicyProviderFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component,
- Implementation implementation) {
- return getFactory().createImplementationPolicyProvider(component, implementation);
- }
-
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return getFactory().createReferencePolicyProvider(component, reference, binding);
- }
-
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return getFactory().createServicePolicyProvider(component, service, binding);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
- modelType = providerClass.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
- }
-
- /**
- * A wrapper around a wire format provider factory allowing lazy
- * loading and initialization of wire format providers.
- */
- private class LazyWireFormatProviderFactory implements WireFormatProviderFactory {
-
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration providerClass;
- private WireFormatProviderFactory factory;
- private Class modelType;
-
- private LazyWireFormatProviderFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration providerClass) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.providerClass = providerClass;
- }
-
- @SuppressWarnings("unchecked")
- private WireFormatProviderFactory getFactory() {
- if (factory == null) {
- try {
- Class<WireFormatProviderFactory> factoryClass =
- (Class<WireFormatProviderFactory>)providerClass.loadClass();
- Constructor<WireFormatProviderFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- @SuppressWarnings("unchecked")
- public WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding){
- return getFactory().createReferenceWireFormatProvider(component, reference, binding);
- }
-
- @SuppressWarnings("unchecked")
- public WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding){
- return getFactory().createServiceWireFormatProvider(component, service, binding);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
-
- modelType = providerClass.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
- }
-
- /**
- * A wrapper around a operation selector provider factory allowing lazy
- * loading and initialization of operation selector providers.
- */
- private class LazyOperationSelectorProviderFactory implements OperationSelectorProviderFactory {
-
- private ExtensionPointRegistry registry;
- private String modelTypeName;
- private ServiceDeclaration providerClass;
- private OperationSelectorProviderFactory factory;
- private Class modelType;
-
- private LazyOperationSelectorProviderFactory(ExtensionPointRegistry registry,
- String modelTypeName,
- ServiceDeclaration providerClass) {
- this.registry = registry;
- this.modelTypeName = modelTypeName;
- this.providerClass = providerClass;
- }
-
- @SuppressWarnings("unchecked")
- private OperationSelectorProviderFactory getFactory() {
- if (factory == null) {
- try {
- Class<OperationSelectorProviderFactory> factoryClass =
- (Class<OperationSelectorProviderFactory>)providerClass.loadClass();
- Constructor<OperationSelectorProviderFactory> constructor =
- factoryClass.getConstructor(ExtensionPointRegistry.class);
- factory = constructor.newInstance(registry);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return factory;
- }
-
- @SuppressWarnings("unchecked")
- public OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding){
- return getFactory().createReferenceOperationSelectorProvider(component, reference, binding);
- }
-
- @SuppressWarnings("unchecked")
- public OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding){
- return getFactory().createServiceOperationSelectorProvider(component, service, binding);
- }
-
- public Class getModelType() {
- if (modelType == null) {
- try {
-
- modelType = providerClass.loadClass(modelTypeName);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return modelType;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.java
deleted file mode 100644
index 76ca061bab..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/DefaultSCADefinitionsProviderExtensionPoint.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.provider;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Concrete Implementation for the SCADefinitionsProviderExtensionPoint
- *
- * @version $Rev$ $Date$
- */
-public class DefaultSCADefinitionsProviderExtensionPoint implements
- SCADefinitionsProviderExtensionPoint {
-
- private ExtensionPointRegistry extensionPointRegistry = null;
-
- private List<SCADefinitionsProvider> scaDefnsProviders = new ArrayList<SCADefinitionsProvider>();
-
- public DefaultSCADefinitionsProviderExtensionPoint(ExtensionPointRegistry extnPtReg) {
- this.extensionPointRegistry = extnPtReg;
- }
-
- public void addSCADefinitionsProvider(SCADefinitionsProvider provider) {
- scaDefnsProviders.add(provider);
- }
-
- public void removeSCADefinitionsProvider(SCADefinitionsProvider provider) {
- scaDefnsProviders.remove(provider);
- }
-
- public List<SCADefinitionsProvider> getSCADefinitionsProviders() {
- if (scaDefnsProviders.isEmpty()) {
- loadProviders();
- }
- return scaDefnsProviders;
- }
-
- private synchronized void loadProviders() {
- // Get the provider service declarations
- Set<ServiceDeclaration> defnProviderDecls;
- SCADefinitionsProvider aProvider = null;
- Class providerClass = null;
- Constructor constructor = null;
-
- try {
- defnProviderDecls =
- ServiceDiscovery.getInstance().getServiceDeclarations(SCADefinitionsProvider.class);
-
- for (ServiceDeclaration aDefnProviderDecl : defnProviderDecls) {
- providerClass = aDefnProviderDecl.loadClass();
-
- try {
- constructor = providerClass.getConstructor();
- aProvider = (SCADefinitionsProvider)constructor.newInstance();
- } catch (NoSuchMethodException e1) {
- constructor = providerClass.getConstructor(ExtensionPointRegistry.class);
- aProvider = (SCADefinitionsProvider)constructor.newInstance(extensionPointRegistry);
- }
-
- scaDefnsProviders.add(aProvider);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.java
deleted file mode 100644
index 015c673d66..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProvider.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.provider;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A component implementation can implement this interface in order to tie
- * into the Tuscany runtime
- *
- * @version $Rev$ $Date$
- */
-public interface ImplementationProvider {
-
- /**
- * This method will be invoked when the component implementation
- * is activated.
- */
- void start();
-
- /**
- * This method will be invoked when the component implementation
- * is deactivated.
- */
- void stop();
-
- /**
- * Create an invoker for the component implementation in the invocation
- * chain. The invoker will be responsible for calling the implementation
- * logic for the given component.
- *
- * @param service The component service
- * @param operation The operation that the interceptor will handle
- * @return An invoker that handles the invocation logic, null should be
- * returned if no invoker is required
- */
- Invoker createInvoker(RuntimeComponentService service, Operation operation);
-
- /**
- * For bindings that invoke one-way callback operations asynchronously,
- * there is no need to perform a thread switch before calling the invoker.
- * This method indicates whether the binding has this capability.
- *
- * @return true if the callback invoker is able to invoke one-way operations
- * asynchronously, false if all invocations are synchronous
- */
- boolean supportsOneWayInvocation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.java
deleted file mode 100644
index 6a37d1e951..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ImplementationProviderFactory.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.provider;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * An interface for factories that create implementation providers.
- *
- * @version $Rev$ $Date$
- */
-public interface ImplementationProviderFactory<M extends Implementation> extends ProviderFactory<M> {
-
- /**
- * Creates a new implementation provider for the given
- * component.
- *
- * @param component The runtime component
- * @param Implementation The implementation type
- * @return The implementation provider
- */
- ImplementationProvider createImplementationProvider(RuntimeComponent component, M Implementation);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProvider.java
deleted file mode 100644
index f385c7dfba..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface OperationSelectorProvider {
- /**
- * Create an interceptor for the operation selector
- * @return An interceptor that realize the policySet
- */
- Interceptor createInterceptor();
-
- /**
- * Get the phase that the interceptor should be added
- * @return The phase that this interceptor belongs to
- */
- String getPhase();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
deleted file mode 100644
index 183b38cb33..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/OperationSelectorProviderFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface OperationSelectorProviderFactory<M extends OperationSelector> extends ProviderFactory<M> {
- /**
- * Create wire format provider for a given reference binding
- * @param component
- * @param reference
- * @param binding
- * @return
- */
- OperationSelectorProvider createReferenceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
-
- /**
- * Create policy provider for a given service binding
- * @param component
- * @param service
- * @param binding
- * @return
- */
- OperationSelectorProvider createServiceOperationSelectorProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java
deleted file mode 100644
index f2b59a7c54..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyImplementor.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * This interface can be optionally implemented by the Binding or Implementation providers to
- * indicate if they implement the policies in the binding/implementation provider.
- *
- * @version $Rev$ $Date$
- */
-public interface PolicyImplementor {
- /**
- * Get a list of policy names that are implemented by this policy implementor
- * @return A list of policy names
- */
- List<QName> getImplementedPolicies();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.java
deleted file mode 100644
index 644283dea1..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProvider.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.provider;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface PolicyProvider {
- /**
- * Create an interceptor for a given operation
- * @param operation
- * @return An interceptor that realize the policySet
- */
- Interceptor createInterceptor(Operation operation);
-
- /**
- * Get the phase that the interceptor should be added
- * @return The phase that this interceptor belongs to
- */
- String getPhase();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.java
deleted file mode 100644
index b60a14d2da..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/PolicyProviderFactory.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.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.policy.Policy;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface PolicyProviderFactory<M extends Policy> extends ProviderFactory<M> {
- /**
- * Create policy provider for a given reference binding
- * @param component
- * @param reference
- * @param binding
- * @return
- */
- PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
-
- /**
- * Create policy provider for a given service binding
- * @param component
- * @param service
- * @param binding
- * @return
- */
- PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
-
- /**
- * Create policy provider for a given component implementation
- * @param component
- * @param implementation
- * @return
- */
- PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.java
deleted file mode 100644
index 2102806881..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactory.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.provider;
-
-/**
- * A factory for runtime providers.
- *
- * @version $Rev$ $Date$
- */
-public interface ProviderFactory<M> {
-
- /**
- * The model type that this factory creates providers for.
- *
- * @return the model type
- */
- Class<M> getModelType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.java
deleted file mode 100644
index d8f9973338..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ProviderFactoryExtensionPoint.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.provider;
-
-import java.util.List;
-
-
-/**
- * An extension point for provider factories. Holds all of the provider
- * factories from loaded extension points. Allows a provider factory
- * to be located based on a given model type. Hence the runtime can
- * generate runtime artifacts from the in memory assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface ProviderFactoryExtensionPoint {
-
-
- /**
- * Add a provider factory.
- *
- * @param providerFactory The provider factory
- */
- void addProviderFactory(ProviderFactory providerFactory);
-
- /**
- * Remove a provider factory.
- *
- * @param providerFactory The provider factory
- */
- void removeProviderFactory(ProviderFactory providerFactory);
-
- /**
- * Returns the provider factory associated with the given model type.
- * @param modelType A model type
- * @return The provider factory associated with the given model type
- */
- ProviderFactory getProviderFactory(Class<?> modelType);
-
- /**
- * Get a list of registered PolicyProviderFactory
- * @return a list of registered PolicyProviderFactory
- */
- List<PolicyProviderFactory> getPolicyProviderFactories();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
deleted file mode 100644
index b3ab1d8b87..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProvider.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-
-/**
- * A reference binding implementation can options implement this
- * interface to tie into the Tuscany SCA runtime
- *
- * @version $Rev$ $Date$
- */
-public interface ReferenceBindingProvider {
-
- /**
- * This method will be invoked when the component reference binding is
- * activated.
- */
- void start();
-
- /**
- * This method will be invoked when the component reference binding is
- * deactivated.
- */
- void stop();
-
- /**
- * Create an invoker for the reference binding in the invocation chain. The
- * invoker is responsible for making the outbound invocation over the
- * binding protocol.
- *
- * @param operation The operation that the interceptor will handle
- * @return An invoker that handles the invocation logic, null should be
- * returned if no invoker is required
- */
- Invoker createInvoker(Operation operation);
-
- /**
- * Get the effective interface contract imposed by the binding. For example,
- * it will be interface contract introspected from the WSDL portType used by
- * the endpoint for a WebService binding.
- *
- * @return The effective interface contract, if null is returned, the
- * interface contract for the component reference will be used
- */
- InterfaceContract getBindingInterfaceContract();
-
- /**
- * For bindings that invoke one-way operations asynchronously, there is no
- * need to perform a thread switch before calling the invoker. This method
- * indicates whether the binding has this capability.
- *
- * @return true if the binding invoker is able to invoke one-way operations
- * asynchronously, false if all invocations are synchronous
- */
- boolean supportsOneWayInvocation();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.java
deleted file mode 100644
index 3ea9d0ac3c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ReferenceBindingProviderRRB.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.provider;
-
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * TODO RRB experiment
- * This is an experiment extension to try out the request response
- * binding function
- *
- * @version $Rev$ $Date$
- */
-public interface ReferenceBindingProviderRRB extends ReferenceBindingProvider {
-
- void configureBindingChain(RuntimeWire runtimeWire);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.java
deleted file mode 100644
index bd0f4d4b75..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProvider.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.provider;
-
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-
-/**
- * Models a provider of SCA Definitions. Typically SCA Definitions providers
- * may either load a definitions.xml file or create the SCA Definitions model
- * programmatically.
- *
- * @version $Rev$ $Date$
- */
-public interface SCADefinitionsProvider {
- SCADefinitions getSCADefinition() throws SCADefinitionsProviderException ;
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.java
deleted file mode 100644
index b05130d6c8..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderException.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.provider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsProviderException extends Exception {
-
- public SCADefinitionsProviderException(Throwable e) {
- super(e);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.java
deleted file mode 100644
index a5d60cc6eb..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/SCADefinitionsProviderExtensionPoint.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.provider;
-
-import java.util.List;
-
-/**
- * An extension point for SCA Definitions Providers. SCA Definition providers, load SCA Definitions
- * items that are being specifically contributed by the module that hosts the provider in question.
- *
- * @version $Rev$ $Date$
- */
-public interface SCADefinitionsProviderExtensionPoint {
-
- void addSCADefinitionsProvider(SCADefinitionsProvider provider);
- void removeSCADefinitionsProvider(SCADefinitionsProvider provider);
- List<SCADefinitionsProvider> getSCADefinitionsProviders();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.java
deleted file mode 100644
index e15234a549..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProvider.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.provider;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * A service binding can optionally implement this interface to tie
- * into the Tuscany SCA runtime
- *
- * @version $Rev$ $Date$
- */
-public interface ServiceBindingProvider {
- /**
- * This method will be invoked when the component service binding is
- * activated.
- */
- void start();
-
- /**
- * This method will be invoked when the component service binding is
- * deactivated.
- */
- void stop();
-
- /**
- * Get the effective interface contract imposed by the binding. For example,
- * it will be interface contract introspected from the WSDL portType used by
- * the endpoint for a WebService binding.
- *
- * @return The effective interface contract, if null is returned, the
- * interface contract for the component service will be used
- */
- InterfaceContract getBindingInterfaceContract();
-
- /**
- * For bindings that invoke one-way callback operations asynchronously,
- * there is no need to perform a thread switch before calling the invoker.
- * This method indicates whether the binding has this capability.
- *
- * @return true if the callback invoker is able to invoke one-way operations
- * asynchronously, false if all invocations are synchronous
- */
- boolean supportsOneWayInvocation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java
deleted file mode 100644
index e23a37360a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/ServiceBindingProviderRRB.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * TODO RRB experiment
- * This is an experiment extension to try out the request response
- * binding function
- *
- * @version $Rev$ $Date$
- */
-public interface ServiceBindingProviderRRB extends ServiceBindingProvider {
-
- void configureBindingChain(RuntimeWire runtimeWire);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProvider.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProvider.java
deleted file mode 100644
index 35526cb251..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.invocation.Interceptor;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface WireFormatProvider {
-
- /**
- * Set up the contract that describes the interface that
- * is providing data to or accepting data from the
- * wire format interceptor. The wire format's job
- * is to translate between this interface contract and the
- * format on the wire. The interface contract may be
- * configured separately for request and response
- * wire formats
- *
- * @return the wire format interface contract
- */
- public InterfaceContract configureWireFormatInterfaceContract(InterfaceContract interfaceContract);
-
- /**
- * Create an interceptor for the wire format
- * @return An interceptor that realize the policySet
- */
- Interceptor createInterceptor();
-
- /**
- * Get the phase that the interceptor should be added
- * @return The phase that this interceptor belongs to
- */
- String getPhase();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java
deleted file mode 100644
index fd748df6ca..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/provider/WireFormatProviderFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.provider;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface WireFormatProviderFactory<M extends WireFormat> extends ProviderFactory<M> {
- /**
- * Create wire format provider for a given reference binding
- * @param component
- * @param reference
- * @param binding
- * @return
- */
- WireFormatProvider createReferenceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding);
-
- /**
- * Create policy provider for a given service binding
- * @param component
- * @param service
- * @param binding
- * @return
- */
- WireFormatProvider createServiceWireFormatProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.java
deleted file mode 100644
index 851afee3c1..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DefaultWireProcessorExtensionPoint.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.runtime;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * The default implementation of a <code>WireProcessorExtensionPoint</code>
- *
- * @version $Rev$ $Date$
- */
-public class DefaultWireProcessorExtensionPoint implements RuntimeWireProcessorExtensionPoint {
-
- /**
- * The list of WireProcessors available to the runtime
- */
- private final List<RuntimeWireProcessor> processors = new ArrayList<RuntimeWireProcessor>();
-
- /**
- * Registers a wire-processor in the runtime
- *
- * @param processor The processor to register
- */
- public void addWireProcessor(RuntimeWireProcessor processor) {
- processors.add(processor);
- }
-
- /**
- * De-registers a wire-processor in the runtime
- *
- * @param processor The processor to de-register
- */
- public void removeWireProcessor(RuntimeWireProcessor processor) {
- processors.remove(processor);
- }
-
- /**
- * Returns a list of registered wire-processors.
- *
- * @return The list of wire processors
- */
- public List<RuntimeWireProcessor> getWireProcessors() {
- return processors;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
deleted file mode 100644
index b6fafa5fb6..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.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.runtime;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * The endpoint reference for a component service or reference
- *
- * @version $Rev$ $Date$
- */
-public interface EndpointReference extends Cloneable {
- /**
- * Get the component for the endpoint
- * @return The component, null of the EPR is for a non-SCA service
- */
- RuntimeComponent getComponent();
-
- /**
- * Get the component service or reference for the endpoint
- * @return The component service or reference, null if the EPR is for a non-SCA service
- */
- Contract getContract();
-
- /**
- * Get the binding for the endpoint
- * @return The binding
- */
- Binding getBinding();
-
- /**
- * Get the interface contract for the endpoint
- * @return The interface contract
- */
- InterfaceContract getInterfaceContract();
-
- /**
- * Update the interface contract for the endpoint
- * @param interfaceContract The updated interface contract
- */
- void setInterfaceContract(InterfaceContract interfaceContract);
-
- /**
- * Get the URI for this endpoint
- * @return The URI of the endpoint
- */
- String getURI();
-
- /**
- * Set the URI for this endpoint
- * @param uri The new URI of the endpoint
- */
- void setURI(String uri);
-
- /**
- * Get the callback endpoint for this endpoint
- * @return The callback endpoint for this endpoint
- */
- EndpointReference getCallbackEndpoint();
-
- /**
- * Set the callback endpoint for this endpoint
- * @param callbackEndpoint The new callback endpoint for this endpoint
- */
- void setCallbackEndpoint(EndpointReference callbackEndpoint);
-
- Object clone() throws CloneNotSupportedException;
-
- void setReferenceParameters(ReferenceParameters parameters);
- ReferenceParameters getReferenceParameters();
-
- void mergeEndpoint(EndpointReference epr);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
deleted file mode 100644
index 0e19538aff..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/ReferenceParameters.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.runtime;
-
-/**
- * Parameters for the EndPointReference
- *
- * @version $Rev$ $Date$
- */
-public interface ReferenceParameters extends Cloneable {
- /**
- * Get the callback ID
- * @return the callbackID
- */
- Object getCallbackID();
-
- /**
- * Set the callback ID
- * @param callbackID the callbackID to set
- */
- void setCallbackID(Object callbackID);
-
- /**
- * Get the conversation ID
- * @return the conversationID
- */
- Object getConversationID();
-
- /**
- * Set the conversation ID
- * @param conversationID the conversationID to set
- */
- void setConversationID(Object conversationID);
-
- /**
- * Get the ID for the non-ServiceReference callback object
- * @return
- */
- Object getCallbackObjectID();
-
- /**
- * Set the ID for the non-ServiceReference callback object
- * @param callbackObjectID
- */
- void setCallbackObjectID(Object callbackObjectID);
-
- EndpointReference getCallbackReference();
-
- void setCallbackReference(EndpointReference callback);
-
- Object clone() throws CloneNotSupportedException;
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.java
deleted file mode 100644
index 30bba78a40..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponent.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.runtime;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-
-/**
- * The runtime component interface. Provides the bridge between the
- * assembly model representation of a component and its runtime
- * realization.
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeComponent extends Component {
- /**
- * Set the implementation-specific configuration for this component
- * @param implementationProvider The object that manages the component implementation
- */
- void setImplementationProvider(ImplementationProvider implementationProvider);
-
- /**
- * Get the implementation-specific configuration for this component
- * @return The implementation provider for this component
- */
- ImplementationProvider getImplementationProvider();
-
- /**
- * Get the associated component context
- * @return
- */
- RuntimeComponentContext getComponentContext();
-
- /**
- * Set the associated component context
- * @param context
- */
- void setComponentContext(RuntimeComponentContext context);
-
- /**
- * Tests if the RuntimeComponent is started
- * @return true if the RuntimeComponent is started otherwise false
- */
- boolean isStarted();
-
- /**
- * Sets the RuntimeComponent started state
- * @param started the state to set
- */
- void setStarted(boolean started);
-
- /**
- * Add a policy provider to the component
- * @param policyProvider
- */
- void addPolicyProvider(PolicyProvider policyProvider);
-
- /**
- * Get a list of policy providers configured for this component
- * @return
- */
- List<PolicyProvider> getPolicyProviders();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.java
deleted file mode 100644
index f61bff9735..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentContext.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.runtime;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-
-import org.apache.tuscany.sca.api.ComponentContextExtension;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.ServiceReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface RuntimeComponentContext extends ComponentContextExtension {
- /**
- * Activate the reference (creating runtime wires)
- * @param reference
- */
- void start(RuntimeComponentReference reference);
-
- /**
- * Deserialize the component reference
- * @param reader
- * @return A component that contains the reference
- * @throws IOException
- */
- RuntimeComponent read(Reader reader) throws IOException;
-
- /**
- * Serialize the component reference
- * @param reference
- * @param writer
- * @throws IOException
- */
- void write(RuntimeComponentReference reference, Writer writer) throws IOException;
-
- /**
- * Get the CallableReference for a given component reference
- * @param <B>
- * @param businessInterface The business interface
- * @param reference The reference to be wired
- * @param binding The binding to be used, if it's null, either binding.sca or the 1st binding
- * will be selected
- * @return A service reference representing the wire
- */
- <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
- RuntimeComponentReference reference,
- Binding binding);
-
- /**
- * Bind the reference to a target component/componentService
- * @param <B>
- * @param businessInterface The business interface
- * @param reference The reference to be wired
- * @param component The target component
- * @param service The target component service
- * @return A service reference representing the wire
- */
- <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
- RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service);
-
- /**
- * Create a CallableReference for the given component service
- * @param <B>
- * @param businessInterface
- * @param component
- * @param service
- * @return
- */
- <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentService service);
-
- /**
- * @param <B>
- * @param businessInterface
- * @param service
- * @return
- */
- <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
deleted file mode 100644
index 44ae7f552a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentReference.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.runtime;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-
-/**
- * The runtime component reference. Provides the bridge between the
- * assembly model representation of a component reference and its runtime
- * realization
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeComponentReference extends ComponentReference {
-
- /**
- * Get a list of runtime wires to the reference
- *
- * @return The list of wires
- */
- List<RuntimeWire> getRuntimeWires();
-
- /**
- * Get the runtime wire for the given binding
- * @param binding The assembly model binding
- * @return The runtime wire
- */
- RuntimeWire getRuntimeWire(Binding binding);
-
- /**
- * Returns the reference binding provider associated with this
- * component reference and the given binding.
- *
- * @param binding The assembly model binding
- * @return The runtime reference binding provider
- */
- ReferenceBindingProvider getBindingProvider(Binding binding);
-
- /**
- * Sets the reference binding provider associated with this
- * component reference and the given binding.
- *
- * @param binding The assembly model binding
- * @param bindingProvider The runtime reference binding provider
- */
- void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider);
-
- /**
- * Returns the endpoint resolver associated with this
- * component reference and the given endpoint.
- *
- * @param endpont The assembly model endpoint
- * @return The enpoint resolver
- */
- EndpointResolver getEndpointResolver(Endpoint endpoint);
-
- /**
- * Sets the endpoint resolver associated with this
- * component reference and the given endpoint.
- *
- * @param binding The assembly model binding
- * @param bindingProvider The runtime reference binding provider
- */
- void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver);
-
- /**
- * Add a policy provider for the given binding to the reference
- * @param binding The assembly model binding
- * @param policyProvider The policy handler
- */
- void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
-
- /**
- * Get a list of policy providers for the given binding
- * @param binding The assembly model binding
- * @return A list of policy providers for the given binding
- */
- List<PolicyProvider> getPolicyProviders(Binding binding);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime Invoker
- */
- Invoker getInvoker(Binding binding, Operation operation);
-
- /**
- * Set the owning component
- * @param component
- */
- void setComponent(RuntimeComponent component);
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
deleted file mode 100644
index 982724d798..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeComponentService.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.runtime;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-
-/**
- * The runtime component service. Provides the bridge between the
- * assembly model representation of a component service and its runtime
- * realization
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeComponentService extends ComponentService {
-
- /**
- * Get a list of runtime wires to the service
- *
- * @return The list of wires
- */
- List<RuntimeWire> getRuntimeWires();
- /**
- * Get the runtime wire for the given binding
- * @param binding The assembly model binding
- * @return The runtime wire
- */
- RuntimeWire getRuntimeWire(Binding binding);
-
- /**
- * Get the callback wires associated with this service
- *
- * @return The list of runtime callback wires
- */
- List<RuntimeWire> getCallbackWires();
-
- /**
- * Returns the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding The assembly model binding
- * @return The runtime service binding provider
- */
- ServiceBindingProvider getBindingProvider(Binding binding);
-
- /**
- * Returns the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding
- * @param interfaceContract
- * @return
- */
- RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract);
-
- /**
- * Sets the service binding provider associated with this
- * component service and the given binding.
- *
- * @param binding The assembly model binding
- * @param bindingProvider The runtime service binding provider
- */
- void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime invoker
- */
- Invoker getInvoker(Binding binding, Operation operation);
-
- /**
- * Get the invoker for the given binding and operation
- * @param binding The assembly model binding
- * @param interfaceContract the client interface contract
- * @param operation The assembly model operation
- * @return The runtime invoker
- */
- Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation);
-
- /**
- * Get the invocation chain for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @return The runtime invocation chain
- */
- InvocationChain getInvocationChain(Binding binding, Operation operation);
-
- /**
- * Get the invocation chain for the given binding and operation
- * @param binding The assembly model binding
- * @param operation The assembly model operation
- * @param interfaceContract the client interface contract
- * @return The runtime invocation chain
- */
- InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation);
-
- /**
- * Add a policy provider for the given binding to the service
- * @param binding The assembly model binding
- * @param policyProvider The policy handler
- */
- void addPolicyProvider(Binding binding, PolicyProvider policyProvider);
-
- /**
- * Get a list of policy providers for the given binding
- * @param binding The assembly model binding
- * @return A list of policy providers for the given binding
- */
- List<PolicyProvider> getPolicyProviders(Binding binding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
deleted file mode 100644
index a2e7152202..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * The runtime wire interface that connects a component reference to a
- * component service (or an external service) over the selected binding
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeWire extends Cloneable {
-
- /**
- * Get the source of the wire
- *
- * @return The end point reference of the source
- */
- EndpointReference getSource();
-
- /**
- * Get the target of the wire
- *
- * @return The end point reference of the target
- */
- EndpointReference getTarget();
-
- /**
- * Rebind the runtime wire with the given target
- * @param target The target endpoint reference
- */
- void setTarget(EndpointReference target);
-
- /**
- * Force the invocation chains to be rebuilt
- */
- void rebuild();
-
- /**
- * Returns the invocation chains for service operations associated with the
- * wire
- *
- * @return the invocation chains for service operations associated with the
- * wire
- */
- List<InvocationChain> getInvocationChains();
-
- /**
- * Lookup the invocation chain by operation
- * @param operation The operation
- * @return The invocation chain for the given operation
- */
- InvocationChain getInvocationChain(Operation operation);
-
- /**
- * Get the invocation chain for the binding-specific handling
- * @return
- */
- InvocationChain getBindingInvocationChain();
-
- /**
- * This invoke method assumes that the binding invocation chain is in force
- * and that there will be an operation selector element there to
- * determine which operation to call
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Message msg) throws InvocationTargetException;
-
- /**
- * Invoke an operation with given arguments
- * @param operation The operation
- * @param args The arguments
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
-
- /**
- * Invoke an operation with a context message
- * @param operation The operation
- * @param msg The message
- * @return The result
- * @throws InvocationTargetException
- */
- Object invoke(Operation operation, Message msg) throws InvocationTargetException;
-
- /**
- * @return a clone of the runtime wire
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.java
deleted file mode 100644
index fbb7aae467..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessor.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.runtime;
-
-/**
- * Implementations are called after wires are decorated with policy and before they are connected.
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeWireProcessor {
-
- /**
- * Process the runtime wire to add interceptors
- *
- * @param wire
- */
- void process(RuntimeWire wire);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
deleted file mode 100644
index 4b2c71b397..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWireProcessorExtensionPoint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.runtime;
-
-import java.util.List;
-
-/**
- * Acts as a delegating <code>WireProcessorExtensionPoint</code>, delegating
- * processing of wires after policies have been applied and source and targets
- * have been connected.
- *
- * @version $Rev$ $Date$
- */
-public interface RuntimeWireProcessorExtensionPoint {
-
- /**
- * Registers a wire-processor in the runtime
- *
- * @param processor The processor to register
- */
- void addWireProcessor(RuntimeWireProcessor processor);
-
- /**
- * De-registers a wire-processor in the runtime
- *
- * @param processor The processor to de-register
- */
- void removeWireProcessor(RuntimeWireProcessor processor);
-
- /**
- * Returns a list of registered wire-processors.
- *
- * @return The list of wire processors
- */
- List<RuntimeWireProcessor> getWireProcessors();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java
deleted file mode 100644
index 7d5cd6c54b..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.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.store;
-
-/**
- * thrown when a record already exists during an insert operation
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateRecordException extends StoreWriteException {
- private static final long serialVersionUID = 3116253222569378447L;
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public DuplicateRecordException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java
deleted file mode 100644
index 9d965a3369..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.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.store;
-
-import java.util.UUID;
-
-/**
- * Implementations receive callback events during a store recovery operation
- *
- * @version $Rev$ $Date$
- */
-public interface RecoveryListener {
-
- /**
- * Signals the start of a recovery
- */
- void onBegin();
-
- /**
- * Received when a record is recovered
- *
- * @param id
- */
- void onRecord(UUID id);
-
- /**
- * Signals the end of recovery
- */
- void onEnd();
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java
deleted file mode 100644
index b15cde066a..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.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.store;
-
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be
- * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an
- * in-memory map.
- *
- * @version $Rev$ $Date$
- */
-public interface Store extends EventPublisher {
-
- /* Used to indicate an the default expiration offset for records for the store */
- long DEFAULT_EXPIRATION_OFFSET = -1;
-
- /* Used to indicate an entry should not expire */
- long NEVER = -2;
-
- /**
- * Adds the given record to the store. Implementations may choose different strategies for writing data such as
- * write-through or write-behind.
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @param object the object representing the data to write
- * @param expiration the time in milliseconds when the entry expires
- * @throws StoreWriteException if an error occurs during the write operation
- */
- void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
-
- /**
- * Updates a given record in the store, overwriting previous information.
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @param object the object representing the data to write
- * @param expiration the time in milliseconds when the entry expires
- * @throws StoreWriteException
- */
- void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException;
-
- /**
- * Returns the deserialized object in the store corresponding to the given id
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @return the deserialized object or null if one is not found
- * @throws StoreReadException
- */
- Object readRecord(RuntimeComponent owner, String id) throws StoreReadException;
-
- /**
- * Removes a record from the store
- *
- * @param owner the instance owner
- * @param id the unique id of the record
- * @throws StoreWriteException
- */
- void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException;
-
- /**
- * Removes all records from the store
- *
- * @throws StoreWriteException
- */
- void removeRecords() throws StoreWriteException;
-
- /**
- * Initiates a recovery operation, for example during restart after a crash
- *
- * @param listener the listener to receive recovery callback events
- * @throws StoreReadException
- */
- void recover(RecoveryListener listener) throws StoreReadException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
deleted file mode 100644
index 24eaddd3e0..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.store;
-
-
-/**
- * Represents a generic exception thrown by a <code>Store</code>
- *
- * @version $Rev$ $Date$
- */
-public class StoreException extends Exception {
- private static final long serialVersionUID = -319152147419962709L;
-
- /**
- * {@inheritDoc}
- */
- public StoreException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java
deleted file mode 100644
index 5c1a3ca79d..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.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.store;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Fired when a store implementation expires a resource
- *
- * @version $Rev$ $Date$
- */
-public class StoreExpirationEvent implements Event {
- private Object source;
- private RuntimeComponent owner;
- private Object instance;
-
- /**
- * Constructor.
- *
- * @param source the source of the event
- * @param owner the owner of the expiring object
- * @param instance the expiring object
- */
- public StoreExpirationEvent(Object source, RuntimeComponent owner, Object instance) {
- assert source != null;
- assert owner != null;
- assert instance != null;
- this.source = source;
- this.owner = owner;
- this.instance = instance;
- }
-
- public Object getSource() {
- return source;
- }
-
- /**
- * Returns the owner of the expiring object.
- *
- * @return the owner of the expiring object.
- */
- public RuntimeComponent getOwner() {
- return owner;
- }
-
- /**
- * Returns the expiring object.
- *
- * @return the expiring object.
- */
- public Object getInstance() {
- return instance;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java
deleted file mode 100644
index 4bc7facf39..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.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.store;
-
-
-/**
- * A generic monitor interface for services to log events
- *
- * @version $Rev$ $Date$
- */
-public interface StoreMonitor {
-
- /**
- * Signals the service has started
- *
- * @param msg
- */
- void start(String msg);
-
- /**
- * Signals the service has been shutdown
- *
- * @param msg
- */
- void stop(String msg);
-
- /**
- * Fired when recovery is started
- */
-
- void beginRecover();
-
- /**
- * Fired when recovery is completed
- */
-
- void endRecover();
-
- /**
- * Fired when a record is processed during recovery
- *
- * @param recordId the id of the record being recovered
- */
-
- void recover(Object recordId);
-
- /**
- * Signals an error event
- *
- * @param e the error
- */
-
- void error(Throwable e);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java
deleted file mode 100644
index c2346bddca..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.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.store;
-
-/**
- * Thrown when an error occurs reading from persistent storage
- *
- * @version $Rev$ $Date$
- */
-public class StoreReadException extends StoreException {
- private static final long serialVersionUID = -8624542082121467271L;
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreReadException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java
deleted file mode 100644
index b37519b31c..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.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.store;
-
-/**
- * Thrown when an error occurs writing to persistent storage
- *
- * @version $Rev$ $Date$
- */
-public class StoreWriteException extends StoreException {
- private static final long serialVersionUID = 5539070473942048555L;
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public StoreWriteException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.java
deleted file mode 100644
index d32af450ff..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/NotificationListener.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.work;
-
-/**
- * A callback interface that can be optionally used for registering
- * interest in status of asynchronously scheduled unit of work.
- *
- * @version $Rev$ $Date$
- */
-public interface NotificationListener<T extends Runnable> {
-
- /**
- * Callback method when the unit of work is accepted.
- *
- * @param work Work that was accepted.
- */
- void workAccepted(T work);
-
- /**
- * Callback method when the unit of work is successfully completed.
- *
- * @param work Work that was successfully completed.
- */
- void workCompleted(T work);
-
- /**
- * Callback when the unit of work is started.
- *
- * @param work Unit of work that was started.
- */
- void workStarted(T work);
-
- /**
- * Callback when the unit of work is rejected.
- *
- * @param work Unit of work that was rejected.
- */
- void workRejected(T work);
-
- /**
- * Callback when the unit of work fails to complete.
- *
- * @param work Unit of work that failed to complete.
- * @param error Error that caused the unit of work to fail.
- */
- void workFailed(T work, Throwable error);
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
deleted file mode 100644
index b1beac78e2..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkScheduler.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.work;
-
-/**
- * Defines the contract for scheduling asynchronous units of work.
- *
- * <p>
- * Units of work can be scheduled with an optional <code>NotificationListener</code>.
- * If a notification listener is specified, the caller will be notified regarding the
- * status of the work. The unit of work can either be completed, rejected or completed
- * with an error. If the work completed with an error, the caller is notified with the
- * error details.
- * </p>
- *
- * @version $Rev$ $Date$
- */
-public interface WorkScheduler {
-
- /**
- * Schedules a unit of work for future execution. The notification listener
- * is used to register interest in callbacks regarding the status of the work.
- *
- * @param work The unit of work that needs to be asynchronously executed.
- * @param listener Notification listener for callbacks.
- */
- <T extends Runnable>void scheduleWork(T work, NotificationListener<T> listener);
-
- /**
- * Schedules a unit of work for future execution. The notification listener
- * is used to register interest in callbacks regarding the status of the work.
- *
- * @param work The unit of work that needs to be asynchronously executed.
- */
- <T extends Runnable>void scheduleWork(T work);
-
- /**
- * Destroys the work scheduler
- */
- void destroy();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java b/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.java
deleted file mode 100644
index 18ec2dfeaa..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/java/org/apache/tuscany/sca/work/WorkSchedulerException.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.work;
-
-
-/**
- * Exception thrown by the work scheduler in case of unexpected exceptions.
- *
- * @version $Rev$ $Date$
- *
- * @version $Rev$ $Date$
- */
-public class WorkSchedulerException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- /**
- * {@inheritDoc}
- */
- public WorkSchedulerException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkSchedulerException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkSchedulerException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public WorkSchedulerException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint
deleted file mode 100644
index ddd91bceac..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.ContextFactoryExtensionPoint
+++ /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.context.DefaultContextFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint
deleted file mode 100644
index 91839e998f..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint
+++ /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.endpointresolver.DefaultEndpointResolverFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
deleted file mode 100644
index e9de1f135f..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint
+++ /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.provider.DefaultProviderFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint b/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint
deleted file mode 100644
index 2f700671ca..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.provider.DefaultSCADefinitionsProviderExtensionPoint
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
deleted file mode 100644
index 95591dca5d..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/main/resources/META-INF/services/org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint
+++ /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.runtime.DefaultWireProcessorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java b/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.java
deleted file mode 100644
index 3a27569a3b..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/context/DefaultContextFactoryExtensionPointTestCase.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.context;
-
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * This test case will test the class
- * org.apache.tuscany.sca.context.DefaultContextFactoryExtensionPoint
- *
- * $Date$ $Rev$
- */
-public class DefaultContextFactoryExtensionPointTestCase {
-
- /**
- * Tests adding/getting/removing a factory with no interfaces
- */
- @Test
- public void testFactoryWithNoInterfaces() {
- Object factory = new FactoryWithNoInterfaces();
- Class<?>[] ifaces = {};
- addGetRemoveFactory(factory, ifaces);
- }
-
- /**
- * Tests adding/getting/removing a factory with one interface
- */
- @Test
- public void testFactoryWithOneInterface() {
- Object factory = new FactoryWithOneInterface();
- Class<?>[] ifaces = { FactoryOneInterface.class };
- addGetRemoveFactory(factory, ifaces);
- }
-
- /**
- * Tests adding/getting/removing a factory with two interfaces
- */
- @Test
- public void testFactoryWithTwoInterfaces() {
- Object factory = new FactoryWithTwoInterfaces();
- Class<?>[] ifaces = { FactoryTwoInterfacesA.class, FactoryTwoInterfacesB.class };
- addGetRemoveFactory(factory, ifaces);
- }
-
- /**
- * Tests having multiple factories registered
- */
- @Test
- public void testMultipleFactories() {
- // Create new factories
- FactoryWithOneInterface factory1 = new FactoryWithOneInterface();
- FactoryWithTwoInterfaces factory2 = new FactoryWithTwoInterfaces();
-
- ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
-
- // Register the factories
- DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
- ctxFactory.addFactory(factory1);
- ctxFactory.addFactory(factory2);
-
- // Re-get each of the factories
- FactoryOneInterface regotFactory1 = ctxFactory.getFactory(FactoryOneInterface.class);
- Assert.assertNotNull(regotFactory1);
- Assert.assertSame(factory1, regotFactory1);
- FactoryTwoInterfacesA regotFactory2A = ctxFactory.getFactory(FactoryTwoInterfacesA.class);
- Assert.assertNotNull(regotFactory2A);
- Assert.assertSame(factory2, regotFactory2A);
- FactoryTwoInterfacesB regotFactory2B = ctxFactory.getFactory(FactoryTwoInterfacesB.class);
- Assert.assertNotNull(regotFactory1);
- Assert.assertSame(factory2, regotFactory2B);
- }
-
- /**
- * Tests passing in null to addFactory()
- */
- @Test
- public void testAddingNullFactory() {
-
- ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
- DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
- try {
- ctxFactory.addFactory(null);
- Assert.fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // As expected
- }
- }
-
- /**
- * Test passing in null to removeFactory()
- */
- @Test
- public void testRemovingNullFactory() {
- ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
- DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
- try {
- ctxFactory.removeFactory(null);
- Assert.fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // As expected
- }
- }
-
- /**
- * Test passing in null to getFactory()
- */
- @Test
- public void testGetNullFactory() {
- ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
- DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
- try {
- ctxFactory.getFactory(null);
- Assert.fail("Should have thrown IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // As expected
- }
- }
-
- /**
- * Utility method for testing adding and removing a factory
- *
- * @param factory The factory class to test
- * @param factoryInterfaces The list of interfaces implemented by the factory
- */
- private void addGetRemoveFactory(Object factory, Class<?>[] factoryInterfaces) {
- ExtensionPointRegistry registry = new DefaultExtensionPointRegistry();
- DefaultContextFactoryExtensionPoint ctxFactory = new DefaultContextFactoryExtensionPoint(registry);
-
- // Make sure factory not already present
- for (Class<?> iface : factoryInterfaces) {
- Assert.assertNull(ctxFactory.getFactory(iface));
- }
-
- // Add the factory
- ctxFactory.addFactory(factory);
-
- // Make sure we can get the factory recently registered factory
- for (Class<?> iface : factoryInterfaces) {
- Object regot = ctxFactory.getFactory(iface);
- Assert.assertNotNull(regot);
- Assert.assertSame(factory, regot);
- }
-
- // Remove the factory
- ctxFactory.removeFactory(factory);
-
- // Make sure factory is no longer registered
- for (Class<?> iface : factoryInterfaces) {
- Assert.assertNull(ctxFactory.getFactory(iface));
- }
- }
-
- /**
- * Simple factory with no interfaces
- */
- private class FactoryWithNoInterfaces {
- }
-
- /**
- * Simple interface for the factory with one interface
- */
- private interface FactoryOneInterface {
- }
-
- /**
- * Simple factory with one interface
- */
- private class FactoryWithOneInterface implements FactoryOneInterface {
- }
-
- /**
- * Simple interface for the factory with two interfaces
- */
- private interface FactoryTwoInterfacesA {
- }
-
- /**
- * Simple interface for the factory with two interfaces
- */
- private interface FactoryTwoInterfacesB {
- }
-
- /**
- * Simple factory with two interfaces
- */
- private class FactoryWithTwoInterfaces implements FactoryTwoInterfacesA, FactoryTwoInterfacesB {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java b/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java
deleted file mode 100644
index 2425133273..0000000000
--- a/branches/sca-java-1.5.1/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.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.event;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test case for TrueFilter
- *
- * @version $Rev$ $Date$
- */
-public class TrueFilterTestCase {
-
- /**
- * Test TrueFilter matching an event
- */
- @Test
- public void testTrueFilterMatch() {
- EventFilter filter = new TrueFilter();
-
- Assert.assertTrue(filter.match(new DummyEvent()));
- }
-
- /**
- * Test TrueFilter matching null
- */
- @Test
- public void testTrueFilterMatchNull() {
- EventFilter filter = new TrueFilter();
-
- Assert.assertTrue(filter.match(null));
- }
-
- /**
- * Dummy Event implementation for testing
- */
- private class DummyEvent implements Event {
-
- /**
- * {@inheritDoc}
- */
- public Object getSource() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/LICENSE b/branches/sca-java-1.5.1/modules/core/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/core/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-java-1.5.1/modules/core/NOTICE b/branches/sca-java-1.5.1/modules/core/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/core/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/core/pom.xml b/branches/sca-java-1.5.1/modules/core/pom.xml
deleted file mode 100644
index 1d0fb54112..0000000000
--- a/branches/sca-java-1.5.1/modules/core/pom.xml
+++ /dev/null
@@ -1,114 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-core</artifactId>
- <name>Apache Tuscany SCA Core Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>cglib</groupId>
- <artifactId>cglib-nodep</artifactId>
- <version>2.2</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.ws</groupId>
- <artifactId>jaxws-api</artifactId>
- <version>2.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.xml.soap</groupId>
- <artifactId>saaj-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.core</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.core*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.java
deleted file mode 100644
index c86c876075..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ActivationException.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.core.assembly;
-
-
-/**
- * Denotes an error starting the runtime
- *
- * @version $Rev$ $Date$
- */
-public class ActivationException extends Exception {
- private static final long serialVersionUID = 8612661660934426123L;
-
- public ActivationException(String message) {
- super(message);
- }
-
- public ActivationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
deleted file mode 100644
index 29dcc20f0b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivator.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.core.context.ComponentContextHelper;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Start/stop a composite
- *
- * @version $Rev$ $Date$
- */
-public interface CompositeActivator {
- /**
- * Activate a composite
- * @param composite
- */
- void activate(Composite composite) throws ActivationException;
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void start(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void activate(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * Activate a component reference
- * @param component
- * @param ref
- */
- void activate(RuntimeComponent component, RuntimeComponentService service);
-
- /**
- * De-activate a component reference
- * @param component
- * @param ref
- */
- void deactivate(RuntimeComponent component, RuntimeComponentReference ref);
-
- /**
- * De-activate a component reference
- * @param component
- * @param ref
- */
- void deactivate(RuntimeComponent component, RuntimeComponentService service);
-
- /**
- * Stop a composite
- * @param composite
- */
- void deactivate(Composite composite) throws ActivationException;
-
- /**
- * Start a component
- * @param component
- */
- void start(Component component) throws ActivationException;
-
- /**
- * Stop a component
- * @param component
- */
- void stop(Component component) throws ActivationException;
-
- /**
- * Start components in a composite
- * @param composite
- */
- void start(Composite composite) throws ActivationException;
-
- /**
- * Stop components in a composite
- * @param composite
- */
- void stop(Composite composite) throws ActivationException;
-
- /**
- * Get the component context helper
- * @return
- */
- ComponentContextHelper getComponentContextHelper();
-
- /**
- * Get the proxy factory
- * @return
- */
- ProxyFactory getProxyFactory();
-
- /**
- * Get the java interface factory
- * @return
- */
- JavaInterfaceFactory getJavaInterfaceFactory();
-
- ConversationManager getConversationManager();
-
- /**
- * Configure the runtime component with component context
- * @param component
- */
- void configureComponentContext(RuntimeComponent component);
-
- /**
- * Resolve a component by URI in the domain
- * @param componentURI
- * @return
- */
- Component resolve(String componentURI);
-
- /**
- * Set the domain composite
- * @param domainComposite
- */
- void setDomainComposite(Composite domainComposite);
-
- /**
- * Get the domain composite
- * @return
- */
- Composite getDomainComposite();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
deleted file mode 100644
index f51931c53b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/CompositeActivatorImpl.java
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.context.ComponentContextHelper;
-import org.apache.tuscany.sca.core.context.ComponentContextImpl;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.ConversationalScopeContainer;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CompositeActivatorImpl implements CompositeActivator {
- private static final Logger logger = Logger.getLogger(CompositeActivatorImpl.class.getName());
-
- private final AssemblyFactory assemblyFactory;
- private final MessageFactory messageFactory;
- private final InterfaceContractMapper interfaceContractMapper;
- private final ScopeRegistry scopeRegistry;
- private final WorkScheduler workScheduler;
- private final RuntimeWireProcessor wireProcessor;
- private final ProviderFactoryExtensionPoint providerFactories;
- private final EndpointResolverFactoryExtensionPoint endpointResolverFactories;
-
- private final RequestContextFactory requestContextFactory;
- private final ProxyFactory proxyFactory;
- private final JavaInterfaceFactory javaInterfaceFactory;
- private final ConversationManager conversationManager;
-
- private final ComponentContextHelper componentContextHelper;
-
- private Composite domainComposite;
-
- /**
- * @param assemblyFactory
- * @param interfaceContractMapper
- * @param workScheduler
- * @param conversationManager TODO
- * @param workContext
- * @param wirePostProcessorRegistry
- */
- public CompositeActivatorImpl(AssemblyFactory assemblyFactory,
- MessageFactory messageFactory,
- JavaInterfaceFactory javaInterfaceFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- ScopeRegistry scopeRegistry,
- WorkScheduler workScheduler,
- RuntimeWireProcessor wireProcessor,
- RequestContextFactory requestContextFactory,
- ProxyFactory proxyFactory,
- ProviderFactoryExtensionPoint providerFactories,
- EndpointResolverFactoryExtensionPoint endpointResolverFactories,
- StAXArtifactProcessorExtensionPoint processors,
- ConversationManager conversationManager) {
- this.assemblyFactory = assemblyFactory;
- this.messageFactory = messageFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- this.scopeRegistry = scopeRegistry;
- this.workScheduler = workScheduler;
- this.wireProcessor = wireProcessor;
- this.providerFactories = providerFactories;
- this.endpointResolverFactories = endpointResolverFactories;
- this.javaInterfaceFactory = javaInterfaceFactory;
- this.requestContextFactory = requestContextFactory;
- this.proxyFactory = proxyFactory;
- this.conversationManager = conversationManager;
- this.componentContextHelper = new ComponentContextHelper(assemblyFactory, javaInterfaceFactory, processors);
- }
-
- /**
- * @see org.apache.tuscany.sca.core.assembly.CompositeActivator#activate(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference)
- */
- public void activate(RuntimeComponent component, RuntimeComponentReference ref) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Activating component reference: " + component.getURI() + "#" + ref.getName());
- }
- resolveTargets(ref);
- for (Binding binding : ref.getBindings()) {
- addReferenceBindingProvider(component, ref, binding);
- }
-
- for (Endpoint endpoint : ref.getEndpoints()){
- // TODO - source component should be set in the builder but the
- // way the builder is written it's difficult to get at it
- endpoint.setSourceComponent(component);
-
- addEndpointResolver(component, ref, endpoint);
- }
- }
-
- public void start(RuntimeComponent component, RuntimeComponentReference ref) {
- synchronized (ref) {
- resolveTargets(ref);
- for (Binding binding : ref.getBindings()) {
- ReferenceBindingProvider provider = ref.getBindingProvider(binding);
- if (provider == null) {
- provider = addReferenceBindingProvider(component, ref, binding);
- }
- if (provider != null) {
- provider.start();
- }
- addReferenceWire(component, ref, binding);
- }
-
- // targets now have an endpoint representation. We can use this to
- // look for unresolved endpoints using dummy wires for late resolution
- for (Endpoint endpoint : ref.getEndpoints()){
- addReferenceEndpointWire(component, ref, endpoint);
- }
- }
- }
-
- public void stop(Component component, ComponentReference reference) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Stopping component reference: " + component.getURI() + "#" + reference.getName());
- }
- RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
- for (Binding binding : reference.getBindings()) {
- ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
- if (bindingProvider != null) {
- bindingProvider.stop();
- }
- }
- }
-
- public void deactivate(RuntimeComponent component, RuntimeComponentReference ref) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Deactivating component reference: " + component.getURI() + "#" + ref.getName());
- }
- removeReferenceWires(ref);
- for (Binding binding : ref.getBindings()) {
- removeReferenceBindingProvider(component, ref, binding);
- }
-
- }
-
- /**
- * @param component
- * @param reference
- * @param binding
- */
- private EndpointResolver addEndpointResolver(RuntimeComponent component,
- RuntimeComponentReference reference,
- Endpoint endpoint){
-
- // only create endpoint resolvers for unresolved endpoints currently
- // this will also prevent a wire from being created later
- if (!endpoint.isUnresolved()){
- return null;
- }
-
- // This souldn't happen as the endpoint resolver extension point is in core-spi but
- // just in case returning null here will mean that no wire is created and calling
- // the reference will fail with NPE
- if (endpointResolverFactories == null){
- return null;
- }
-
- EndpointResolverFactory<Endpoint> resolverFactory =
- (EndpointResolverFactory<Endpoint>)endpointResolverFactories.getEndpointResolverFactory(endpoint.getClass());
-
- if (resolverFactory != null) {
- @SuppressWarnings("unchecked")
- EndpointResolver endpointResolver =
- resolverFactory.createEndpointResolver(endpoint, null);
- if (endpointResolver != null) {
- ((RuntimeComponentReference)reference).setEndpointResolver(endpoint, endpointResolver);
- }
-
- return endpointResolver;
- } else {
- // TODO - for the time being allow the lack of an endpoint provider to be the
- // switch to turn off endpoint processing
- return null;
- //throw new IllegalStateException("Endpoint provider factory not found for class: " + endpoint.getClass().getName());
- }
- }
-
- public void addReferenceBindingProviderForEndpoint(Endpoint endpoint){
- addReferenceBindingProvider((RuntimeComponent)endpoint.getSourceComponent(),
- (RuntimeComponentReference)endpoint.getSourceComponentReference(),
- endpoint.getSourceBinding());
- }
-
- /**
- * @param component
- * @param reference
- * @param binding
- */
- private ReferenceBindingProvider addReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- BindingProviderFactory providerFactory =
- (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
- if (providerFactory != null) {
- @SuppressWarnings("unchecked")
- ReferenceBindingProvider bindingProvider =
- providerFactory.createReferenceBindingProvider((RuntimeComponent)component,
- (RuntimeComponentReference)reference,
- binding);
- if (bindingProvider != null) {
- ((RuntimeComponentReference)reference).setBindingProvider(binding, bindingProvider);
- }
- for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
- PolicyProvider policyProvider = f.createReferencePolicyProvider(component, reference, binding);
- if (policyProvider != null) {
- reference.addPolicyProvider(binding, policyProvider);
- }
- }
-
- return bindingProvider;
- } else {
- throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
- }
- }
-
- /**
- * @param reference
- */
- private void resolveTargets(RuntimeComponentReference reference) {
- // The code that used to be here to resolved unresolved targets is now
- // at the bottom of BaseWireBuilder.connectComponentReferences()
- }
-
- /**
- * Create the runtime wires for a reference endpoint. Currently this method
- * only deals with the late binding case and creates a dummy wire that
- * will use the Endpoint to resolve the target at the point when the
- * wire chains are created.
- *
- * @param component
- * @param reference
- * @param binding
- */
- private void addReferenceEndpointWire(Component component, ComponentReference reference, Endpoint endpoint) {
- // only deal with unresolved endpoints as, to prevent breaking changes, targets that are resolved
- // at build time are still represented as bindings in the binding list
- if (((RuntimeComponentReference)reference).getEndpointResolver(endpoint) == null){
- // no endpoint provider has previously been created so don't create the
- // wire
- return;
- }
-
- // TODO: TUSCANY-2580: avoid NPE if the InterfaceCOntract is null
- Reference ctref = endpoint.getSourceComponentReference().getReference();
- if (ctref != null && ctref.getInterfaceContract() == null) {
- ctref.setInterfaceContract(reference.getInterfaceContract());
- }
-
- RuntimeWire wire = new EndpointWireImpl(endpoint, this);
-
- RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
- runtimeRef.getRuntimeWires().add(wire);
- }
-
-
- /**
- * Create the runtime wires for a reference binding
- *
- * @param component
- * @param reference
- * @param binding
- */
- private void addReferenceWire(Component component, ComponentReference reference, Binding binding) {
- if (!(reference instanceof RuntimeComponentReference)) {
- return;
- }
-
- // create wire if binding has an endpoint
- Component targetComponent = null;
- ComponentService targetComponentService = null;
- Binding targetBinding = null;
-
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding endpoint = (OptimizableBinding)binding;
- targetComponent = endpoint.getTargetComponent();
- targetComponentService = endpoint.getTargetComponentService();
- targetBinding = endpoint.getTargetBinding();
- // FIXME: TUSCANY-2136, For unresolved binding, don't add wire. Is it the right solution?
- if (!reference.isCallback() && binding.getURI() == null && targetComponentService == null) {
- return;
- }
- }
-
- // create a forward wire, either static or dynamic
- addReferenceWire(component, reference, binding, targetComponent, targetComponentService, targetBinding);
-
- /*
- // if static forward wire (not from self-reference), try to create a static callback wire
- if (targetComponentService != null && !reference.getName().startsWith("$self$.")) {
- ComponentReference callbackReference = targetComponentService.getCallbackReference();
- if (callbackReference != null) {
- Binding callbackBinding = null;
- Binding callbackServiceBinding = null;
- // select a service callback binding that can be wired back to this component
- for (Binding refBinding : callbackReference.getBindings()) {
- // first look for a callback binding whose name matches the target binding name
- if (refBinding.getName().equals(targetBinding.getName())) {
- callbackBinding = refBinding;
- break;
- }
- }
- // see if there is a matching reference callback binding
- if (callbackBinding != null) {
- callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
- }
- // if there isn't an end-to-end match, try again based on target binding type
- if (callbackBinding == null || callbackServiceBinding == null) {
- callbackBinding = callbackReference.getBinding(targetBinding.getClass());
- if (callbackBinding != null) {
- callbackServiceBinding = reference.getCallbackService().getBinding(callbackBinding.getClass());
- }
- }
- if (callbackBinding != null && callbackServiceBinding != null) {
- // end-to-end match, so create a static callback wire as well as the static forward wire
-
- addReferenceWire(targetComponent, callbackReference, callbackBinding, component, reference
- .getCallbackService(), callbackServiceBinding);
- } else {
- // no end-to-end match, so do not create a static callback wire
- }
- }
- }
- */
- }
-
- public void addReferenceWireForEndpoint(Endpoint endpoint){
- addReferenceWire(endpoint.getSourceComponent(),
- endpoint.getSourceComponentReference(),
- endpoint.getSourceBinding(),
- endpoint.getTargetComponent(),
- endpoint.getTargetComponentService(),
- endpoint.getTargetBinding());
- }
- /**
- * Create a reference wire for a forward call or a callback
- * @param reference
- * @param service
- * @param serviceBinding
- * @param component
- * @param referenceBinding
- */
- private RuntimeWire addReferenceWire(Component refComponent,
- ComponentReference reference,
- Binding refBinding,
- Component serviceComponent,
- ComponentService service,
- Binding serviceBinding) {
- RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
- InterfaceContract bindingContract = getInterfaceContract(reference, refBinding);
-
- // Use the interface contract of the reference on the component type
- Reference componentTypeRef = reference.getReference();
-
- InterfaceContract sourceContract;
- if (componentTypeRef == null || componentTypeRef.getInterfaceContract() == null) {
- sourceContract = reference.getInterfaceContract();
- } else {
- sourceContract = componentTypeRef.getInterfaceContract();
- }
-
- sourceContract = sourceContract.makeUnidirectional(false);
-
- EndpointReference wireSource =
- new EndpointReferenceImpl((RuntimeComponent)refComponent, reference, refBinding, sourceContract);
- ComponentService callbackService = reference.getCallbackService();
- if (callbackService != null) {
- // select a reference callback binding to pass with invocations on this wire
- Binding callbackBinding = null;
- for (Binding binding : callbackService.getBindings()) {
- // first look for a callback binding whose name matches the reference binding name
- if (refBinding.getName().startsWith(binding.getName())) {
- callbackBinding = binding;
- break;
- }
- }
- // if no callback binding found, try again based on reference binding type
- if (callbackBinding == null) {
- callbackBinding = callbackService.getBinding(refBinding.getClass());
- }
- InterfaceContract callbackContract = callbackService.getInterfaceContract();
- EndpointReference callbackEndpoint =
- new EndpointReferenceImpl((RuntimeComponent)refComponent, callbackService, callbackBinding,
- callbackContract);
- wireSource.setCallbackEndpoint(callbackEndpoint);
- }
-
- EndpointReference wireTarget =
- new EndpointReferenceImpl((RuntimeComponent)serviceComponent, service, serviceBinding, bindingContract);
-
- // TUSCANY-2029 - We should use the URI of the serviceBinding because the target may be a Component in a
- // nested composite.
- if (serviceBinding != null) {
- wireTarget.setURI(serviceBinding.getURI());
- }
-
- RuntimeWire wire =
- new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
- messageFactory, conversationManager);
- runtimeRef.getRuntimeWires().add(wire);
-
- return wire;
- }
-
- private void addImplementationProvider(RuntimeComponent component, Implementation implementation) {
- ImplementationProviderFactory providerFactory =
- (ImplementationProviderFactory)providerFactories.getProviderFactory(implementation.getClass());
- if (providerFactory != null) {
- @SuppressWarnings("unchecked")
- ImplementationProvider implementationProvider =
- providerFactory.createImplementationProvider(component, implementation);
- if (implementationProvider != null) {
- component.setImplementationProvider(implementationProvider);
- }
- } else {
- throw new IllegalStateException("Provider factory not found for class: " + implementation.getClass()
- .getName());
- }
- for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
- PolicyProvider policyProvider = f.createImplementationPolicyProvider(component, implementation);
- if (policyProvider != null) {
- component.addPolicyProvider(policyProvider);
- }
- }
-
- }
-
- private void removeImplementationProvider(RuntimeComponent component) {
- component.setImplementationProvider(null);
- component.getPolicyProviders().clear();
- }
-
- /**
- * @param component
- * @param service
- * @param binding
- */
- private ServiceBindingProvider addServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- BindingProviderFactory providerFactory =
- (BindingProviderFactory)providerFactories.getProviderFactory(binding.getClass());
- if (providerFactory != null) {
- @SuppressWarnings("unchecked")
- ServiceBindingProvider bindingProvider =
- providerFactory.createServiceBindingProvider((RuntimeComponent)component,
- (RuntimeComponentService)service,
- binding);
- if (bindingProvider != null) {
- ((RuntimeComponentService)service).setBindingProvider(binding, bindingProvider);
- }
- for (PolicyProviderFactory f : providerFactories.getPolicyProviderFactories()) {
- PolicyProvider policyProvider = f.createServicePolicyProvider(component, service, binding);
- if (policyProvider != null) {
- service.addPolicyProvider(binding, policyProvider);
- }
- }
- return bindingProvider;
- } else {
- throw new IllegalStateException("Provider factory not found for class: " + binding.getClass().getName());
- }
- }
-
- private void removeServiceBindingProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- service.setBindingProvider(binding, null);
- for (Binding b : service.getBindings()) {
- List<PolicyProvider> pps = service.getPolicyProviders(b);
- if (pps != null) {
- pps.clear();
- }
- }
- }
-
- private void removeReferenceBindingProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- reference.setBindingProvider(binding, null);
- for (Binding b : reference.getBindings()) {
- List<PolicyProvider> pps = reference.getPolicyProviders(b);
- if (pps != null) {
- pps.clear();
- }
- }
- }
-
- public void start(Composite composite) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Starting composite: " + composite.getName());
- }
- for (Component component : composite.getComponents()) {
- start(component);
- }
- }
-
- public void stop(Composite composite) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Stopping composite: " + composite.getName());
- }
- for (final Component component : composite.getComponents()) {
- stop(component);
- }
- }
-
- public void start(Component component) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Starting component: " + component.getURI());
- }
- RuntimeComponent runtimeComponent = ((RuntimeComponent)component);
- if(runtimeComponent.isStarted()) {
- return;
- }
-
- configureComponentContext(runtimeComponent);
-
- for (ComponentReference reference : component.getReferences()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
- }
- RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
- runtimeRef.setComponent(runtimeComponent);
-
- for (Endpoint endpoint : reference.getEndpoints()) {
- final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint);
- if (endpointResolver != null) {
- // Allow endpoint resolvers to do any startup reference manipulation
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- endpointResolver.start();
- return null;
- }
- });
- }
- }
-
- for (Binding binding : reference.getBindings()) {
- final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
- if (bindingProvider != null) {
- // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- bindingProvider.start();
- return null;
- }
- });
- }
- }
- }
-
- for (ComponentService service : component.getServices()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Starting component service: " + component.getURI() + "#" + service.getName());
- }
- RuntimeComponentService runtimeService = (RuntimeComponentService)service;
- for (Binding binding : service.getBindings()) {
- final ServiceBindingProvider bindingProvider = runtimeService.getBindingProvider(binding);
- if (bindingProvider != null) {
- // bindingProvider.start();
- // Allow bindings to add shutdown hooks. Requires RuntimePermission shutdownHooks in policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- bindingProvider.start();
- return null;
- }
- });
- }
- }
- }
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- start((Composite)implementation);
- } else {
- ImplementationProvider implementationProvider = runtimeComponent.getImplementationProvider();
- if (implementationProvider != null) {
- implementationProvider.start();
- }
- }
-
- if (component instanceof ScopedRuntimeComponent) {
- ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
- if (scopedRuntimeComponent.getScopeContainer() != null) {
- scopedRuntimeComponent.getScopeContainer().start();
- }
- }
-
- runtimeComponent.setStarted(true);
- }
-
- /**
- * @param runtimeComponent
- */
- public void configureComponentContext(RuntimeComponent runtimeComponent) {
- RuntimeComponentContext componentContext =
- new ComponentContextImpl(this, assemblyFactory, proxyFactory, interfaceContractMapper,
- requestContextFactory, javaInterfaceFactory, runtimeComponent);
- runtimeComponent.setComponentContext(componentContext);
- }
-
- /**
- * Stop a component
- */
- public void stop(Component component) {
- if (!((RuntimeComponent)component).isStarted()) {
- return;
- }
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Stopping component: " + component.getURI());
- }
- for (ComponentService service : component.getServices()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Stopping component service: " + component.getURI() + "#" + service.getName());
- }
- for (Binding binding : service.getBindings()) {
- final ServiceBindingProvider bindingProvider = ((RuntimeComponentService)service).getBindingProvider(binding);
- if (bindingProvider != null) {
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- bindingProvider.stop();
- return null;
- }
- });
- }
- }
- }
- for (ComponentReference reference : component.getReferences()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Starting component reference: " + component.getURI() + "#" + reference.getName());
- }
- RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)reference);
-
- for (Binding binding : reference.getBindings()) {
- final ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(binding);
- if (bindingProvider != null) {
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- bindingProvider.stop();
- return null;
- }
- });
- }
- }
-
- for (Endpoint endpoint : reference.getEndpoints()) {
- final EndpointResolver endpointResolver = runtimeRef.getEndpointResolver(endpoint);
- if (endpointResolver != null) {
- // Allow endpoint resolvers to do any shutdown reference manipulation
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- endpointResolver.stop();
- return null;
- }
- });
- }
- }
- }
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- stop((Composite)implementation);
- } else {
- final ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
- if (implementationProvider != null) {
- // Allow bindings to read properties. Requires PropertyPermission read in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- implementationProvider.stop();
- return null;
- }
- });
- }
- }
-
- if (component instanceof ScopedRuntimeComponent) {
- ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
- if (runtimeComponent.getScopeContainer() != null &&
- runtimeComponent.getScopeContainer().getLifecycleState() != ScopeContainer.STOPPED) {
- runtimeComponent.getScopeContainer().stop();
- }
- }
-
- ((RuntimeComponent)component).setStarted(false);
- }
-
- /**
- * Get the effective interface contract for a reference binding
- *
- * @param reference
- * @param binding
- * @return
- */
- private InterfaceContract getInterfaceContract(ComponentReference reference, Binding binding) {
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
- if (provider != null) {
- InterfaceContract bindingContract = provider.getBindingInterfaceContract();
- if (bindingContract != null) {
- interfaceContract = bindingContract;
- }
- }
- return interfaceContract.makeUnidirectional(false);
- }
-
- /**
- * Remove the runtime wires for a reference binding
- * @param reference
- */
- private void removeReferenceWires(ComponentReference reference) {
- if (!(reference instanceof RuntimeComponentReference)) {
- return;
- }
- // [rfeng] Comment out the following statements to avoid the on-demand activation
- // RuntimeComponentReference runtimeRef = (RuntimeComponentReference)reference;
- // runtimeRef.getRuntimeWires().clear();
- }
-
- /**
- * Get the effective interface contract for the service binding
- *
- * @param service
- * @param binding
- * @return
- */
- private InterfaceContract getInterfaceContract(ComponentService service, Binding binding) {
- InterfaceContract interfaceContract = service.getInterfaceContract();
-
- ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
- if (provider != null) {
- InterfaceContract bindingContract = provider.getBindingInterfaceContract();
- if (bindingContract != null) {
- interfaceContract = bindingContract;
- }
- }
- return interfaceContract.makeUnidirectional(false);
- }
-
- /**
- * Remove runtime wires for a service binding
- *
- * @param component
- * @param service
- */
- private void removeServiceWires(ComponentService service) {
- if (!(service instanceof RuntimeComponentService)) {
- return;
- }
- RuntimeComponentService runtimeService = (RuntimeComponentService)service;
- runtimeService.getRuntimeWires().clear();
- }
-
- /**
- * Create a service wire for a forward call or a callback
- * @param service
- * @param serviceBinding
- * @param reference
- * @param component
- * @param referenceBinding
- */
- private RuntimeWire addServiceWire(Component serviceComponent, ComponentService service, Binding serviceBinding) {
- if (!(service instanceof RuntimeComponentService)) {
- return null;
- }
- RuntimeComponentService runtimeService = (RuntimeComponentService)service;
-
- // FIXME: [rfeng] We might need a better way to get the impl interface contract
- Service targetService = service.getService();
- if (targetService == null) {
- targetService = service;
- }
- InterfaceContract targetContract = targetService.getInterfaceContract().makeUnidirectional(false);
-
- InterfaceContract sourceContract = getInterfaceContract(service, serviceBinding);
-
- EndpointReference wireSource = new EndpointReferenceImpl(null, null, serviceBinding, sourceContract);
-
- EndpointReference wireTarget =
- new EndpointReferenceImpl((RuntimeComponent)serviceComponent, (RuntimeComponentService)service,
- serviceBinding, targetContract);
-
- RuntimeWire wire =
- new RuntimeWireImpl(wireSource, wireTarget, interfaceContractMapper, workScheduler, wireProcessor,
- messageFactory, conversationManager);
- runtimeService.getRuntimeWires().add(wire);
-
- return wire;
- }
-
- public void activate(RuntimeComponent component, RuntimeComponentService service) {
- if (service.getService() == null) {
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("Skipping component service not defined in the component type: " + component.getURI()
- + "#"
- + service.getName());
- }
- return;
- }
- if (service.getService() instanceof CompositeService) {
- return;
- }
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Activating component service: " + component.getURI() + "#" + service.getName());
- }
-
- for (Binding binding : service.getBindings()) {
- addServiceBindingProvider(component, service, binding);
- addServiceWire(component, service, binding);
- }
- }
-
- public void deactivate(RuntimeComponent component, RuntimeComponentService service) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Deactivating component service: " + component.getURI() + "#" + service.getName());
- }
- removeServiceWires(service);
- for (Binding binding : service.getBindings()) {
- removeServiceBindingProvider(component, service, binding);
- }
- }
-
- private void addScopeContainer(Component component) {
- if (!(component instanceof ScopedRuntimeComponent)) {
- return;
- }
- ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
- ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
- if (scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
- conversationManager.addListener((ConversationalScopeContainer)scopeContainer);
- }
- runtimeComponent.setScopeContainer(scopeContainer);
- }
-
- private void removeScopeContainer(Component component) {
- if (!(component instanceof ScopedRuntimeComponent)) {
- return;
- }
- ScopedRuntimeComponent runtimeComponent = (ScopedRuntimeComponent)component;
- ScopeContainer scopeContainer = runtimeComponent.getScopeContainer();
- if(scopeContainer != null && scopeContainer.getScope() == Scope.CONVERSATION) {
- conversationManager.removeListener((ConversationalScopeContainer) scopeContainer);
- }
- runtimeComponent.setScopeContainer(null);
- }
-
- public void activateComponent(Component component)
- throws ActivationException {
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Activating component: " + component.getURI());
- }
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- activate((Composite) implementation);
- } else if (implementation != null) {
- addImplementationProvider((RuntimeComponent) component,
- implementation);
- addScopeContainer(component);
- }
-
- for (ComponentService service : component.getServices()) {
- activate((RuntimeComponent) component,
- (RuntimeComponentService) service);
- }
-
- for (ComponentReference reference : component.getReferences()) {
- activate((RuntimeComponent) component,
- (RuntimeComponentReference) reference);
- }
- } catch (Exception e) {
- throw new ActivationException(e);
- }
- }
-
- public void deactivateComponent(Component component)
- throws ActivationException {
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Deactivating component: " + component.getURI());
- }
- for (ComponentService service : component.getServices()) {
- deactivate((RuntimeComponent) component,
- (RuntimeComponentService) service);
- }
-
- for (ComponentReference reference : component.getReferences()) {
- deactivate((RuntimeComponent) component,
- (RuntimeComponentReference) reference);
- }
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- deactivate((Composite) implementation);
- } else if (implementation != null) {
- removeImplementationProvider((RuntimeComponent) component);
- removeScopeContainer(component);
- }
- } catch (Exception e) {
- throw new ActivationException(e);
- }
- }
-
- public void activate(Composite composite) throws ActivationException {
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Activating composite: " + composite.getName());
- }
- for (Component component : composite.getComponents()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Activating component: " + component.getURI());
- }
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- activate((Composite)implementation);
- } else if (implementation != null) {
- addImplementationProvider((RuntimeComponent)component, implementation);
- addScopeContainer(component);
- }
-
- for (ComponentService service : component.getServices()) {
- activate((RuntimeComponent)component, (RuntimeComponentService)service);
- }
-
- for (ComponentReference reference : component.getReferences()) {
- activate((RuntimeComponent)component, (RuntimeComponentReference)reference);
- }
- }
- } catch (Exception e) {
- throw new ActivationException(e);
- }
- }
-
- public void deactivate(Composite composite) throws ActivationException {
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Deactivating composite: " + composite.getName());
- }
- for (Component component : composite.getComponents()) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Deactivating component: " + component.getURI());
- }
- for (ComponentService service : component.getServices()) {
- deactivate((RuntimeComponent)component, (RuntimeComponentService)service);
- }
-
- for (ComponentReference reference : component.getReferences()) {
- deactivate((RuntimeComponent)component, (RuntimeComponentReference)reference);
- }
-
- Implementation implementation = component.getImplementation();
- if (implementation instanceof Composite) {
- deactivate((Composite)implementation);
- } else if (implementation != null) {
- removeImplementationProvider((RuntimeComponent)component);
- removeScopeContainer(component);
- }
- }
- } catch (Exception e) {
- throw new ActivationException(e);
- }
- }
-
- /**
- * @return the referenceHelper
- */
- public ComponentContextHelper getComponentContextHelper() {
- return componentContextHelper;
- }
-
- /**
- * @return the proxyFactory
- */
- public ProxyFactory getProxyFactory() {
- return proxyFactory;
- }
-
- /**
- * @return the domainComposite
- */
- public Composite getDomainComposite() {
- return domainComposite;
- }
-
- /**
- * @param domainComposite the domainComposite to set
- */
- public void setDomainComposite(Composite domainComposite) {
- this.domainComposite = domainComposite;
- }
-
- public Component resolve(String componentURI) {
- for (Composite composite : domainComposite.getIncludes()) {
- Component component = resolve(composite, componentURI);
- if (component != null) {
- return component;
- }
- }
- return null;
- }
-
- public Component resolve(Composite composite, String componentURI) {
- for (Component component : composite.getComponents()) {
- String uri = component.getURI();
- if (uri.equals(componentURI)) {
- return component;
- }
- if (componentURI.startsWith(uri)) {
- Implementation implementation = component.getImplementation();
- if (!(implementation instanceof Composite)) {
- return null;
- }
- return resolve((Composite)implementation, componentURI);
- }
- }
- return null;
- }
-
- /**
- * @return the javaInterfaceFactory
- */
- public JavaInterfaceFactory getJavaInterfaceFactory() {
- return javaInterfaceFactory;
- }
-
- /**
- * @return the conversationManager
- */
- public ConversationManager getConversationManager() {
- return conversationManager;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
deleted file mode 100644
index 78096b20ab..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointReferenceImpl implements EndpointReference {
- private RuntimeComponent component;
- private Contract contract;
- private Binding binding;
- private InterfaceContract interfaceContract;
- private String uri;
- private EndpointReference callbackEndpoint;
- private ReferenceParameters parameters = new ReferenceParametersImpl();
-
- /**
- * @param component
- * @param contract
- * @param binding
- * @param interfaceContract
- */
- public EndpointReferenceImpl(RuntimeComponent component,
- Contract contract,
- Binding binding,
- InterfaceContract interfaceContract) {
- super();
- this.component = component;
- this.contract = contract;
- this.binding = binding;
- this.interfaceContract = interfaceContract;
- this.uri = (component != null ? component.getURI() : "") + '/' +
- (contract != null ? contract.getName() : "");
- }
-
- /**
- * @param uri
- */
- public EndpointReferenceImpl(String uri) {
- super();
- this.uri = uri;
- }
-
- public Binding getBinding() {
- return binding;
- }
-
- public void setBinding(Binding binding) {
- this.binding = binding;
- }
-
- public RuntimeComponent getComponent() {
- return component;
- }
-
- public void setComponent(RuntimeComponent component) {
- this.component = component;
- }
-
- public Contract getContract() {
- return contract;
- }
-
- public void setContract(Contract contract) {
- this.contract = contract;
- }
-
- public InterfaceContract getInterfaceContract() {
- return interfaceContract;
- }
-
- public void setInterfaceContract(InterfaceContract interfaceContract) {
- this.interfaceContract = interfaceContract;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public EndpointReference getCallbackEndpoint() {
- return callbackEndpoint;
- }
-
- public void setCallbackEndpoint(EndpointReference callbackEndpoint) {
- this.callbackEndpoint = callbackEndpoint;
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((uri == null) ? 0 : uri.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final EndpointReferenceImpl other = (EndpointReferenceImpl)obj;
- if (uri == null) {
- if (other.uri != null) {
- return false;
- }
- } else if (!uri.equals(other.uri)) {
- return false;
- }
- return true;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- EndpointReferenceImpl copy = (EndpointReferenceImpl)super.clone();
- /* [nash] no need to copy callback endpoint
- if (callbackEndpoint != null) {
- copy.callbackEndpoint = (EndpointReference)callbackEndpoint.clone();
- }
- */
- if (parameters != null) {
- copy.parameters = (ReferenceParameters)parameters.clone();
- }
- return copy;
- }
-
- /**
- * @return the parameters
- */
- public ReferenceParameters getReferenceParameters() {
- return parameters;
- }
-
- /**
- * @param parameters the parameters to set
- */
- public void setReferenceParameters(ReferenceParameters parameters) {
- this.parameters = parameters;
- }
-
- public void mergeEndpoint(EndpointReference epr) {
- this.component = epr.getComponent();
- this.contract = epr.getContract();
- this.binding = epr.getBinding();
- this.interfaceContract = epr.getInterfaceContract();
- this.uri = epr.getURI();
- this.callbackEndpoint = epr.getCallbackEndpoint();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java
deleted file mode 100644
index 4f463b105d..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointWireImpl.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceUnavailableException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EndpointWireImpl implements RuntimeWire {
-
- private Endpoint endpoint;
- private CompositeActivatorImpl compositeActivator;
-
- private EndpointResolver endpointResolver;
- private EndpointReference source;
- private RuntimeWire wire;
- private InvocationChain binidngInvocationChain;
-
- /**
- * @param endpoint
- */
- public EndpointWireImpl(Endpoint endpoint, CompositeActivator compositeActivator) {
- super();
- this.endpoint = endpoint;
- // TODO - improve the SPI to get rid of this cast
- this.compositeActivator = (CompositeActivatorImpl)compositeActivator;
-
- // store source configuration as we have most of this now. We don't though know what the
- // target is yet.
- Reference componentTypeRef = endpoint.getSourceComponentReference().getReference();
- InterfaceContract sourceContract =
- componentTypeRef == null ? endpoint.getSourceComponentReference().getInterfaceContract() : componentTypeRef.getInterfaceContract();
- sourceContract = sourceContract.makeUnidirectional(false);
-
- source = new EndpointReferenceImpl((RuntimeComponent)endpoint.getSourceComponent(),
- endpoint.getSourceComponentReference(),
- null,
- sourceContract);
-
- RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)endpoint.getSourceComponentReference());
- endpointResolver = runtimeRef.getEndpointResolver(endpoint);
-
- }
-
- public synchronized List<InvocationChain> getInvocationChains() {
- // where late binding happens. Find the endpoint provider and
- // ask it to do the endpoint resolution.
- if (endpoint.isUnresolved()){
-
- // this method should locate a viable target service and complete the
- // endpoint configuration
- endpointResolver.resolve();
-
- if (endpoint.isUnresolved()){
- throw new ServiceUnavailableException("Unable to resolve service for component: " +
- endpoint.getSourceComponent().getName() +
- " reference: " +
- endpoint.getSourceComponentReference().getName() +
- " target: " +
- endpoint.getTargetName());
- }
- }
-
- if (wire == null){
- RuntimeComponentReference runtimeRef = ((RuntimeComponentReference)endpoint.getSourceComponentReference());
-
- // add the resolved binding into the reference
- runtimeRef.getBindings().add(endpoint.getSourceBinding());
-
- // add a binding provider into the reference for the resolved binding
- compositeActivator.addReferenceBindingProviderForEndpoint(endpoint);
-
- // extract the binding provider that has been created
- ReferenceBindingProvider bindingProvider = runtimeRef.getBindingProvider(endpoint.getSourceBinding());
-
- // start the binding provider
- bindingProvider.start();
-
- // create the wire
- compositeActivator.addReferenceWireForEndpoint(endpoint);
-
- // extract the wire that has been created
- wire = runtimeRef.getRuntimeWire(endpoint.getSourceBinding());
- }
-
- return wire.getInvocationChains();
- }
-
- public InvocationChain getInvocationChain(Operation operation) {
- if (wire ==null){
- return null;
- } else {
- return wire.getInvocationChain(operation);
- }
- }
-
- public Object invoke(Message msg) throws InvocationTargetException {
- // not called as the endpoint wire only appears on the reference side
- return null;
- }
-
- public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
- // not called as the endpoint wire only appears on the reference side
- return null;
- }
-
- public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
- // not called as the endpoint wire only appears on the reference side
- return null;
- }
-
-
- public EndpointReference getSource() {
- return source;
- }
-
- public EndpointReference getTarget() {
- return null;
- }
-
- public void setTarget(EndpointReference target) {
- }
-
- public void rebuild() {
- }
-
- public synchronized InvocationChain getBindingInvocationChain() {
- if (binidngInvocationChain == null) {
- if (source instanceof RuntimeComponentReference) {
- binidngInvocationChain = new InvocationChainImpl(null, null, true);
- } else {
- binidngInvocationChain = new InvocationChainImpl(null, null, false);
- }
- }
- return binidngInvocationChain;
- }
-
- // TODO: TUSCANY-2580: give RuntimeComponentReferenceImpl a way to get at the endpoint
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- EndpointWireImpl copy = (EndpointWireImpl)super.clone();
- return copy;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
deleted file mode 100644
index c82543c4ca..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParameterProcessor.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-
-/**
- * Artifact processor for reference parameters.
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceParameterProcessor implements StAXArtifactProcessor<ReferenceParameters> {
- private static final QName REFERENCE_PARAMETERS =
- new QName("http://tuscany.apache.org/xmlns/sca/1.0", "referenceParameters", "tuscany");
-
- /**
- * Constructs a new processor.
- *
- * @param modelFactories
- */
- public ReferenceParameterProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#getArtifactType()
- */
- public QName getArtifactType() {
- return REFERENCE_PARAMETERS;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#read(javax.xml.stream.XMLStreamReader)
- */
- public ReferenceParameters read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- ReferenceParameters parameters = new ReferenceParametersImpl();
- parameters.setConversationID(reader.getAttributeValue(null, "conversationID"));
- parameters.setCallbackID(reader.getAttributeValue(null, "callbackID"));
- return parameters;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor#write(java.lang.Object, javax.xml.stream.XMLStreamWriter)
- */
- public void write(ReferenceParameters model, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- writer.writeStartElement(REFERENCE_PARAMETERS.getPrefix(),
- REFERENCE_PARAMETERS.getLocalPart(),
- REFERENCE_PARAMETERS.getNamespaceURI());
- writer.writeNamespace(REFERENCE_PARAMETERS.getPrefix(), REFERENCE_PARAMETERS.getNamespaceURI());
- if (model.getConversationID() != null) {
- writer.writeAttribute("conversationID", model.getConversationID().toString());
- }
- if (model.getCallbackID() != null) {
- writer.writeAttribute("callbackID", model.getCallbackID().toString());
- }
- writer.writeEndElement();
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#getModelType()
- */
- public Class<ReferenceParameters> getModelType() {
- return ReferenceParameters.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.contribution.processor.ArtifactProcessor#resolve(java.lang.Object, org.apache.tuscany.sca.contribution.resolver.ModelResolver)
- */
- public void resolve(ReferenceParameters model, ModelResolver resolver) throws ContributionResolveException {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java
deleted file mode 100644
index 14a5f565fc..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/ReferenceParametersImpl.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferenceParametersImpl implements ReferenceParameters {
- private Object callbackID;
- private Object conversationID;
- private EndpointReference callbackReference;
- private Object callbackObjectID;
-
- /**
- * @return the callbackID
- */
- public Object getCallbackID() {
- return callbackID;
- }
- /**
- * @param callbackID the callbackID to set
- */
- public void setCallbackID(Object callbackID) {
- this.callbackID = callbackID;
- }
- /**
- * @return the conversationID
- */
- public Object getConversationID() {
- return conversationID;
- }
- /**
- * @param conversationID the conversationID to set
- */
- public void setConversationID(Object conversationID) {
- this.conversationID = conversationID;
- }
-
- /**
- * @see org.apache.tuscany.sca.runtime.ReferenceParameters#getCallbackReference()
- */
- public EndpointReference getCallbackReference() {
- return callbackReference;
- }
- /**
- * @see org.apache.tuscany.sca.runtime.ReferenceParameters#setCallback(java.lang.Object)
- */
- public void setCallbackReference(EndpointReference callback) {
- this.callbackReference = callback;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- /**
- * @return the callbackObjectID
- */
- public Object getCallbackObjectID() {
- return callbackObjectID;
- }
- /**
- * @param callbackObjectID the callbackObjectID to set
- */
- public void setCallbackObjectID(Object callbackObjectID) {
- this.callbackObjectID = callbackObjectID;
- }
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((callbackID == null) ? 0 : callbackID.hashCode());
- result = prime * result + ((callbackObjectID == null) ? 0 : callbackObjectID.hashCode());
- result = prime * result + ((callbackReference == null) ? 0 : callbackReference.hashCode());
- result = prime * result + ((conversationID == null) ? 0 : conversationID.hashCode());
- return result;
- }
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof ReferenceParametersImpl))
- return false;
- final ReferenceParametersImpl other = (ReferenceParametersImpl)obj;
- if (callbackID == null) {
- if (other.callbackID != null)
- return false;
- } else if (!callbackID.equals(other.callbackID))
- return false;
- if (callbackObjectID == null) {
- if (other.callbackObjectID != null)
- return false;
- } else if (!callbackObjectID.equals(other.callbackObjectID))
- return false;
- if (callbackReference == null) {
- if (other.callbackReference != null)
- return false;
- } else if (!callbackReference.equals(other.callbackReference))
- return false;
- if (conversationID == null) {
- if (other.conversationID != null)
- return false;
- } else if (!conversationID.equals(other.conversationID))
- return false;
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
deleted file mode 100644
index b174dea6ce..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeAssemblyFactory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-
-/**
- * The runtime version of assembly factory
- * @version $Rev$ $Date$
- */
-public class RuntimeAssemblyFactory extends DefaultAssemblyFactory implements AssemblyFactory {
-
- public RuntimeAssemblyFactory() {
- super();
- }
-
- @Override
- public Component createComponent() {
- return new RuntimeComponentImpl();
- }
-
- @Override
- public ComponentReference createComponentReference() {
- return new RuntimeComponentReferenceImpl();
- }
-
- @Override
- public ComponentService createComponentService() {
- return new RuntimeComponentServiceImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.java
deleted file mode 100644
index 32ac611e54..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentImpl.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.core.assembly;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.impl.ComponentImpl;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ResolverExtension;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RuntimeComponentImpl extends ComponentImpl implements RuntimeComponent,
- ScopedRuntimeComponent, ResolverExtension {
- protected RuntimeComponentContext componentContext;
- protected ImplementationProvider implementationProvider;
- protected List<PolicyProvider> policyProviders = new ArrayList<PolicyProvider>();
- protected ScopeContainer scopeContainer;
- protected boolean started;
- protected ModelResolver modelResolver;
-
- /**
- */
- public RuntimeComponentImpl() {
- super();
- }
-
- public ImplementationProvider getImplementationProvider() {
- return implementationProvider;
- }
-
- public void setImplementationProvider(ImplementationProvider provider) {
- this.implementationProvider = provider;
- }
-
- public ScopeContainer getScopeContainer() {
- return scopeContainer;
- }
-
- public void setScopeContainer(ScopeContainer scopeContainer) {
- this.scopeContainer = scopeContainer;
- }
-
- public boolean isStarted() {
- return started;
- }
-
- public void setStarted(boolean started) {
- this.started = started;
- }
-
- /**
- * @return the componentContext
- */
- public RuntimeComponentContext getComponentContext() {
- return componentContext;
- }
-
- /**
- * @param componentContext the componentContext to set
- */
- public void setComponentContext(RuntimeComponentContext componentContext) {
- this.componentContext = componentContext;
- }
-
- public void addPolicyProvider(PolicyProvider policyProvider) {
- policyProviders.add(policyProvider);
- }
-
- public List<PolicyProvider> getPolicyProviders() {
- return policyProviders;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
- @Override
- public String toString() {
- return getName();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.java
deleted file mode 100644
index b386495a08..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentReferenceImpl.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.core.assembly;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Implementation of a Component Reference.
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeComponentReferenceImpl extends ComponentReferenceImpl implements RuntimeComponentReference {
- private ArrayList<RuntimeWire> wires;
- private HashMap<Binding, ReferenceBindingProvider> bindingProviders =
- new HashMap<Binding, ReferenceBindingProvider>();
- private HashMap<Endpoint, EndpointResolver> endpointResolvers =
- new HashMap<Endpoint, EndpointResolver>();
- private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
-
- private RuntimeComponent component;
-
- public RuntimeComponentReferenceImpl() {
- super();
- }
-
- public synchronized List<RuntimeWire> getRuntimeWires() {
- if (wires == null) {
- wires = new ArrayList<RuntimeWire>();
- component.getComponentContext().start(this);
- }
- return wires;
- }
-
- public RuntimeWire getRuntimeWire(Binding binding) {
- for (RuntimeWire wire : getRuntimeWires()) {
- if (wire.getSource().getBinding() == binding) {
- return wire;
- }
- }
-
- // TODO: TUSCANY-2580: before returning null see if a candidate binding matches
- for (RuntimeWire wire : getRuntimeWires()) {
- if (wire instanceof EndpointWireImpl) {
- Endpoint endpoint = ((EndpointWireImpl)wire).getEndpoint();
- for (Binding b : endpoint.getCandidateBindings()) {
- if (b == binding) {
- return wire;
- }
- }
- }
- }
- return null;
- }
-
- public ReferenceBindingProvider getBindingProvider(Binding binding) {
- return bindingProviders.get(binding);
- }
-
- public void setBindingProvider(Binding binding, ReferenceBindingProvider bindingProvider) {
- bindingProviders.put(binding, bindingProvider);
- }
-
- public EndpointResolver getEndpointResolver(Endpoint endpoint){
- return endpointResolvers.get(endpoint);
- }
-
- public void setEndpointResolver(Endpoint endpoint, EndpointResolver endpointResolver){
- endpointResolvers.put(endpoint, endpointResolver);
- }
-
- public Invoker getInvoker(Binding binding, Operation operation) {
- RuntimeWire wire = getRuntimeWire(binding);
- if (wire == null) {
- return null;
- }
- InvocationChain chain = wire.getInvocationChain(operation);
- return chain == null ? null : chain.getHeadInvoker();
- }
-
- /**
- * @return the component
- */
- public RuntimeComponent getComponent() {
- return component;
- }
-
- /**
- * @param component the component to set
- */
- public void setComponent(RuntimeComponent component) {
- this.component = component;
- }
-
- /**
- * @see org.apache.tuscany.sca.assembly.impl.ComponentReferenceImpl#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- RuntimeComponentReferenceImpl ref = (RuntimeComponentReferenceImpl)super.clone();
- ref.wires = null;
- ref.bindingProviders = new HashMap<Binding, ReferenceBindingProvider>();
- ref.policyProviders = new HashMap<Binding, List<PolicyProvider>>();
- return ref;
- }
-
- public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
- List<PolicyProvider> providers = policyProviders.get(binding);
- if (providers == null) {
- providers = new ArrayList<PolicyProvider>();
- policyProviders.put(binding, providers);
- }
- providers.add(policyProvider);
- }
-
- public List<PolicyProvider> getPolicyProviders(Binding binding) {
- return policyProviders.get(binding);
- }
-
- @Override
- public String toString() {
- return getName();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
deleted file mode 100644
index af5230a163..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeComponentServiceImpl.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Implementation of a Component Service.
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeComponentServiceImpl extends ComponentServiceImpl implements RuntimeComponentService {
- private ArrayList<RuntimeWire> wires = new ArrayList<RuntimeWire>();
- private ArrayList<RuntimeWire> callbackWires = new ArrayList<RuntimeWire>();
- private HashMap<Binding, ServiceBindingProvider> bindingProviders = new HashMap<Binding, ServiceBindingProvider>();
- private HashMap<Binding, List<PolicyProvider>> policyProviders = new HashMap<Binding, List<PolicyProvider>>();
-
- public RuntimeComponentServiceImpl() {
- super();
- }
-
- public List<RuntimeWire> getRuntimeWires() {
- return wires;
- }
-
- public RuntimeWire getRuntimeWire(Binding binding) {
- for (RuntimeWire wire : wires) {
- if (wire.getTarget().getBinding() == binding) {
- return wire;
- }
- }
- return null;
- }
-
- public RuntimeWire getRuntimeWire(Binding binding, InterfaceContract interfaceContract) {
- RuntimeWire wire = getRuntimeWire(binding);
- if (wire == null) {
- return null;
- }
- if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
- try {
- // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
- wire = (RuntimeWire)wire.clone();
- wire.getSource().setInterfaceContract(interfaceContract);
- wire.rebuild();
- } catch (CloneNotSupportedException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- return wire;
- }
-
- public List<RuntimeWire> getCallbackWires() {
- return callbackWires;
- }
-
- public ServiceBindingProvider getBindingProvider(Binding binding) {
- return bindingProviders.get(binding);
- }
-
- public void setBindingProvider(Binding binding, ServiceBindingProvider bindingProvider) {
- bindingProviders.put(binding, bindingProvider);
- }
-
- public Invoker getInvoker(Binding binding, Operation operation) {
- return getInvoker(binding, null, operation);
- }
-
- public Invoker getInvoker(Binding binding, InterfaceContract interfaceContract, Operation operation) {
- InvocationChain chain = getInvocationChain(binding, interfaceContract, operation);
- if (chain != null) {
- return chain.getHeadInvoker();
- } else {
- return null;
- }
- }
-
- public InvocationChain getInvocationChain(Binding binding, InterfaceContract interfaceContract, Operation operation) {
- RuntimeWire wire = getRuntimeWire(binding);
- if (wire == null) {
- return null;
- }
- if (interfaceContract != null && interfaceContract != wire.getSource().getInterfaceContract()) {
- try {
- // FIXME: [rfeng] We could avoid clone() using a better comparison of the two interface contracts
- wire = (RuntimeWire)wire.clone();
- wire.getSource().setInterfaceContract(interfaceContract);
- wire.rebuild();
- } catch (CloneNotSupportedException e) {
- throw new ServiceRuntimeException(e);
- }
- }
- return wire.getInvocationChain(operation);
- }
-
- public InvocationChain getInvocationChain(Binding binding, Operation operation) {
- return getInvocationChain(binding, null, operation);
- }
-
- /**
- * @see org.apache.tuscany.sca.assembly.impl.ComponentServiceImpl#clone()
- */
- @SuppressWarnings("unchecked")
- @Override
- public Object clone() throws CloneNotSupportedException {
- RuntimeComponentServiceImpl clone = (RuntimeComponentServiceImpl)super.clone();
- clone.bindingProviders = (HashMap<Binding, ServiceBindingProvider>)bindingProviders.clone();
- clone.wires = (ArrayList<RuntimeWire>)wires.clone();
- clone.callbackWires = (ArrayList<RuntimeWire>)callbackWires.clone();
- clone.policyProviders = (HashMap<Binding, List<PolicyProvider>>)policyProviders.clone();
- return clone;
- }
-
- public void addPolicyProvider(Binding binding, PolicyProvider policyProvider) {
- List<PolicyProvider> providers = policyProviders.get(binding);
- if (providers == null) {
- providers = new ArrayList<PolicyProvider>();
- policyProviders.put(binding, providers);
- }
- providers.add(policyProvider);
- }
-
- public List<PolicyProvider> getPolicyProviders(Binding binding) {
- return policyProviders.get(binding);
- }
-
- @Override
- public String toString() {
- return getName();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
deleted file mode 100644
index ad38906e9d..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.assembly;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
-import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
-import org.apache.tuscany.sca.core.invocation.RuntimeWireInvoker;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ReferenceBindingProviderRRB;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProviderRRB;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RuntimeWireImpl implements RuntimeWire {
- private EndpointReference wireSource;
- private EndpointReference wireTarget;
-
- private transient RuntimeWireProcessor wireProcessor;
- private transient InterfaceContractMapper interfaceContractMapper;
- private transient WorkScheduler workScheduler;
- private transient MessageFactory messageFactory;
- private transient ConversationManager conversationManager;
- private transient RuntimeWireInvoker invoker;
-
- // the following is a very simple cache that avoids re-cloning a wire
- // when consecutive callbacks to the same endpoint are made
- private EndpointReference lastCallback;
- private RuntimeWire cachedWire;
- private boolean wireReserved;
- private RuntimeWireImpl clonedFrom;
-
- private List<InvocationChain> chains;
- private InvocationChain bindingInvocationChain;
-
- /**
- * @param source
- * @param target
- * @param interfaceContractMapper
- * @param workScheduler
- * @param wireProcessor
- * @param messageFactory
- * @param conversationManager
- */
- public RuntimeWireImpl(EndpointReference source,
- EndpointReference target,
- InterfaceContractMapper interfaceContractMapper,
- WorkScheduler workScheduler,
- RuntimeWireProcessor wireProcessor,
- MessageFactory messageFactory,
- ConversationManager conversationManager) {
- super();
- this.wireSource = source;
- this.wireTarget = target;
- this.interfaceContractMapper = interfaceContractMapper;
- this.workScheduler = workScheduler;
- this.wireProcessor = wireProcessor;
- this.messageFactory = messageFactory;
- this.conversationManager = conversationManager;
- this.invoker = new RuntimeWireInvoker(this.messageFactory, this.conversationManager, this);
- }
-
- public synchronized List<InvocationChain> getInvocationChains() {
- if (chains == null) {
- initInvocationChains();
- }
- return chains;
- }
-
- public synchronized InvocationChain getBindingInvocationChain() {
- if (bindingInvocationChain == null) {
- Contract source = wireSource.getContract();
- if (source instanceof RuntimeComponentReference) {
- bindingInvocationChain = new InvocationChainImpl(null, null, true);
- initReferenceBindingInvocationChains();
- } else {
- bindingInvocationChain = new InvocationChainImpl(null, null, false);
- initServiceBindingInvocationChains();
- }
- }
- return bindingInvocationChain;
- }
-
- public InvocationChain getInvocationChain(Operation operation) {
- for (InvocationChain chain : getInvocationChains()) {
- Operation op = null;
- if (wireSource.getContract() != null) {
- // Reference chain
- op = chain.getSourceOperation();
- } else {
- // Service chain
- op = chain.getTargetOperation();
- }
- if (interfaceContractMapper.isCompatible(operation, op, op.getInterface().isRemotable())) {
- return chain;
- }
- }
- return null;
- }
-
- public Object invoke(Message msg) throws InvocationTargetException {
- return getBindingInvocationChain().getHeadInvoker().invoke(msg);
- }
-
- public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
- Message msg = messageFactory.createMessage();
- msg.setBody(args);
- return invoker.invoke(operation, msg);
- }
-
- public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
- return invoker.invoke(operation, msg);
- }
-
- /**
- * Initialize the invocation chains
- */
- private void initInvocationChains() {
- chains = new ArrayList<InvocationChain>();
- InterfaceContract sourceContract = wireSource.getInterfaceContract();
- InterfaceContract targetContract = wireTarget.getInterfaceContract();
-
- Contract source = wireSource.getContract();
- if (source instanceof RuntimeComponentReference) {
- // It's the reference wire
- RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
- Binding refBinding = wireSource.getBinding();
- for (Operation operation : sourceContract.getInterface().getOperations()) {
- Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
- if (targetOperation == null) {
- throw new ServiceRuntimeException("No matching operation for " + operation.getName()
- + " is found in reference "
- + wireSource.getComponent().getURI()
- + "#"
- + reference.getName());
- }
- InvocationChain chain = new InvocationChainImpl(operation, targetOperation, true);
- if (operation.isNonBlocking()) {
- addNonBlockingInterceptor(reference, refBinding, chain);
- }
- addReferenceBindingInterceptor(reference, refBinding, chain, operation);
- chains.add(chain);
- }
-
- } else {
- // It's the service wire
- RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
- RuntimeComponent serviceComponent = wireTarget.getComponent();
- Binding serviceBinding = wireTarget.getBinding();
- for (Operation operation : sourceContract.getInterface().getOperations()) {
- Operation targetOperation = interfaceContractMapper.map(targetContract.getInterface(), operation);
- if (targetOperation == null) {
- throw new ServiceRuntimeException("No matching operation for " + operation.getName()
- + " is found in service "
- + serviceComponent.getURI()
- + "#"
- + service.getName());
- }
- InvocationChain chain = new InvocationChainImpl(operation, targetOperation, false);
- if (operation.isNonBlocking()) {
- addNonBlockingInterceptor(service, serviceBinding, chain);
- }
- addServiceBindingInterceptor(service, serviceBinding, chain, operation);
- addImplementationInterceptor(serviceComponent, service, chain, targetOperation);
- chains.add(chain);
- }
-
- }
- wireProcessor.process(this);
- }
-
- private void initReferenceBindingInvocationChains() {
- RuntimeComponentReference reference = (RuntimeComponentReference)wireSource.getContract();
- Binding referenceBinding = wireSource.getBinding();
-
- // add the binding interceptors to the reference binding wire
- ReferenceBindingProvider provider = reference.getBindingProvider(referenceBinding);
- if ((provider != null) &&
- (provider instanceof ReferenceBindingProviderRRB)){
- ((ReferenceBindingProviderRRB)provider).configureBindingChain(this);
- }
-
- // add the policy interceptors to the service binding wire
- // find out which policies are active
- List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(referenceBinding);
- if (pps != null) {
- for (PolicyProvider p : pps) {
- if (p.getPhase().equals(Phase.REFERENCE_BINDING_POLICY)) {
- Interceptor interceptor = p.createInterceptor(null);
- if (interceptor != null) {
- bindingInvocationChain.addInterceptor(Phase.REFERENCE_BINDING_POLICY, interceptor);
- }
- }
- }
- }
- }
-
- private void initServiceBindingInvocationChains() {
- RuntimeComponentService service = (RuntimeComponentService)wireTarget.getContract();
- Binding serviceBinding = wireTarget.getBinding();
-
- // add the binding interceptors to the service binding wire
- ServiceBindingProvider provider = service.getBindingProvider(serviceBinding);
- if ((provider != null) &&
- (provider instanceof ServiceBindingProviderRRB)){
- ((ServiceBindingProviderRRB)provider).configureBindingChain(this);
- }
-
- // add the policy interceptors to the service binding wire
- List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(serviceBinding);
- if (pps != null) {
- for (PolicyProvider p : pps) {
- if (p.getPhase().equals(Phase.SERVICE_BINDING_POLICY)) {
- Interceptor interceptor = p.createInterceptor(null);
- if (interceptor != null) {
- bindingInvocationChain.addInterceptor(Phase.SERVICE_BINDING_POLICY, interceptor);
- }
- }
- }
- }
-
- // TODO - add something on the end of the wire to invoke the
- // invocation chain. Need to split out the runtime
- // wire invoker into conversation, callback interceptors etc
- bindingInvocationChain.addInvoker(invoker);
-
- }
-
- public EndpointReference getSource() {
- return wireSource;
- }
-
- public EndpointReference getTarget() {
- return wireTarget;
- }
-
- public void setTarget(EndpointReference target) {
- if (this.wireTarget != target) {
- rebuild();
- }
- this.wireTarget = target;
- }
-
- public void rebuild() {
- this.chains = null;
- }
-
- /**
- * Add the interceptor for a reference binding
- *
- * @param reference
- * @param binding
- * @param chain
- * @param operation
- */
- private void addReferenceBindingInterceptor(ComponentReference reference,
- Binding binding,
- InvocationChain chain,
- Operation operation) {
- ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
- if (provider != null) {
- Invoker invoker = provider.createInvoker(operation);
- if (invoker != null) {
- chain.addInvoker(invoker);
- }
- }
- List<PolicyProvider> pps = ((RuntimeComponentReference)reference).getPolicyProviders(binding);
- if (pps != null) {
- for (PolicyProvider p : pps) {
- Interceptor interceptor = p.createInterceptor(operation);
- if (interceptor != null) {
- chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
- }
- }
- }
- }
-
- /**
- * Add the interceptor for a binding
- *
- * @param reference
- * @param binding
- * @param chain
- * @param operation
- */
- private void addServiceBindingInterceptor(ComponentService service,
- Binding binding,
- InvocationChain chain,
- Operation operation) {
- List<PolicyProvider> pps = ((RuntimeComponentService)service).getPolicyProviders(binding);
- if (pps != null) {
- for (PolicyProvider p : pps) {
- Interceptor interceptor = p.createInterceptor(operation);
- if (interceptor != null) {
- chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
- }
- }
- }
- }
-
- /**
- * Add a non-blocking interceptor if the reference binding needs it
- *
- * @param reference
- * @param binding
- * @param chain
- */
- private void addNonBlockingInterceptor(ComponentReference reference, Binding binding, InvocationChain chain) {
- ReferenceBindingProvider provider = ((RuntimeComponentReference)reference).getBindingProvider(binding);
- if (provider != null) {
- boolean supportsOneWayInvocation = provider.supportsOneWayInvocation();
- if (!supportsOneWayInvocation) {
- chain.addInterceptor(Phase.REFERENCE, new NonBlockingInterceptor(workScheduler));
- }
- }
- }
-
- /**
- * Add a non-blocking interceptor if the service binding needs it
- *
- * @param service
- * @param binding
- * @param chain
- */
- private void addNonBlockingInterceptor(ComponentService service, Binding binding, InvocationChain chain) {
- ServiceBindingProvider provider = ((RuntimeComponentService)service).getBindingProvider(binding);
- if (provider != null) {
- if (!provider.supportsOneWayInvocation()) {
- chain.addInterceptor(Phase.SERVICE, new NonBlockingInterceptor(workScheduler));
- }
- }
- }
-
- /**
- * Add the interceptor for a component implementation
- *
- * @param component
- * @param service
- * @param chain
- * @param operation
- */
- private void addImplementationInterceptor(Component component,
- ComponentService service,
- InvocationChain chain,
- Operation operation) {
- ImplementationProvider provider = ((RuntimeComponent)component).getImplementationProvider();
- if (provider != null) {
- Invoker invoker = null;
- invoker = provider.createInvoker((RuntimeComponentService)service, operation);
- chain.addInvoker(invoker);
- }
- List<PolicyProvider> pps = ((RuntimeComponent)component).getPolicyProviders();
- if (pps != null) {
- for (PolicyProvider p : pps) {
- Interceptor interceptor = p.createInterceptor(operation);
- if (interceptor != null) {
- chain.addInterceptor(p.getPhase(), p.createInterceptor(operation));
- }
- }
- }
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public Object clone() throws CloneNotSupportedException {
- RuntimeWireImpl copy = (RuntimeWireImpl)super.clone();
- copy.wireSource = (EndpointReference)wireSource.clone();
- copy.wireTarget = (EndpointReference)wireTarget.clone();
- copy.invoker = new RuntimeWireInvoker(copy.messageFactory, copy.conversationManager, copy);
- copy.cachedWire = null; // TUSCANY-2630
- return copy;
- }
-
- /**
- * @return the conversationManager
- */
- public ConversationManager getConversationManager() {
- return conversationManager;
- }
-
- public synchronized RuntimeWire lookupCache(EndpointReference callback) {
- if (lastCallback != null && callback.getURI().equals(lastCallback.getURI()) && !wireReserved) {
- wireReserved = true;
- return cachedWire;
- } else {
- return null;
- }
- }
-
- public synchronized void addToCache(EndpointReference callback, RuntimeWire clonedWire) {
- ((RuntimeWireImpl)clonedWire).setClonedFrom(this);
- lastCallback = callback;
- cachedWire = clonedWire;
- wireReserved = true;
- }
-
- public synchronized void releaseClonedWire(RuntimeWire wire) {
- if (cachedWire == wire) {
- wireReserved = false;
- }
- }
-
- public synchronized void releaseWire() {
- clonedFrom.releaseClonedWire(this);
- }
-
- private void setClonedFrom(RuntimeWireImpl wire) {
- clonedFrom = wire;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
deleted file mode 100644
index fc6d7abf6a..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/CallableReferenceImpl.java
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.context;
-
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.UUID;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.BindingBuilderExtension;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.EndpointWireImpl;
-import org.apache.tuscany.sca.core.assembly.ReferenceParametersImpl;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.conversation.ConversationState;
-import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.Conversation;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Base class for implementations of service and callback references.
- *
- * @version $Rev$ $Date$
- * @param <B> the type of the business interface
- */
-public class CallableReferenceImpl<B> implements CallableReference<B>, Externalizable {
- static final long serialVersionUID = -521548304761848325L;
- protected transient CompositeActivator compositeActivator;
- protected transient ProxyFactory proxyFactory;
- protected transient Class<B> businessInterface;
- protected transient Object proxy;
-
- // if the wire targets a conversational service this holds the conversation state
- protected transient ConversationManager conversationManager;
- protected transient ExtendedConversation conversation;
- protected transient Object conversationID;
- protected Object callbackID; // The callbackID should be serializable
-
- protected transient RuntimeComponent component;
- protected transient RuntimeComponentReference reference;
- protected transient Binding binding;
-
- protected String scdl;
-
- private transient RuntimeComponentReference clonedRef;
- private transient ReferenceParameters refParams;
- private transient XMLStreamReader xmlReader;
-
- private transient RuntimeWire endpointWire;
-
- /*
- * Public constructor for Externalizable serialization/deserialization
- */
- public CallableReferenceImpl() {
- super();
- }
-
- /*
- * Public constructor for use by XMLStreamReader2CallableReference
- */
- public CallableReferenceImpl(XMLStreamReader xmlReader) throws Exception {
- this.xmlReader = xmlReader;
- resolve();
- }
-
- protected CallableReferenceImpl(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding,
- ProxyFactory proxyFactory,
- CompositeActivator compositeActivator) {
- this.proxyFactory = proxyFactory;
- this.businessInterface = businessInterface;
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- // FIXME: The SCA Specification is not clear how we should handle multiplicity
- // for CallableReference
- if (this.binding == null) {
- this.binding = this.reference.getBinding(SCABinding.class);
- if (this.binding == null) {
-
- // TODO: TUSCANY-2580: if the refernece doesn't have a binding yet then instead of NPE use a candidate one if its avaialable
- if (reference.getBindings() != null && reference.getBindings().size() > 0) {
- this.binding = this.reference.getBindings().get(0);
- } else {
- this.binding = this.reference.getEndpoints().get(0).getCandidateBindings().get(0);
- if (this.reference.getEndpoints().get(0).getInterfaceContract() == null) {
- this.reference.getEndpoints().get(0).setInterfaceContract(reference.getInterfaceContract());
- }
- }
- }
- }
-
- // FIXME: Should we normalize the componentName/serviceName URI into an absolute SCA URI in the SCA binding?
- // sca:component1/component11/component112/service1?
- this.compositeActivator = compositeActivator;
- this.conversationManager = this.compositeActivator.getConversationManager();
- initCallbackID();
- }
-
- public CallableReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
- this.proxyFactory = proxyFactory;
- this.businessInterface = businessInterface;
- bind(wire);
- }
-
- public RuntimeWire getRuntimeWire() {
- try {
- resolve();
- if (endpointWire != null){
- return endpointWire;
- } else if (reference != null) {
- return reference.getRuntimeWire(binding);
- } else {
- return null;
- }
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- protected void bind(RuntimeWire wire) {
- if (wire != null) {
-
- if (wire instanceof EndpointWireImpl){
- endpointWire = wire;
- }
- this.component = wire.getSource().getComponent();
- this.reference = (RuntimeComponentReference)wire.getSource().getContract();
- this.binding = wire.getSource().getBinding();
- this.compositeActivator = ((ComponentContextImpl)component.getComponentContext()).getCompositeActivator();
- this.conversationManager = this.compositeActivator.getConversationManager();
- initCallbackID();
- }
- }
-
- protected void initCallbackID() {
- if (reference.getInterfaceContract() != null) {
- if (reference.getInterfaceContract().getCallbackInterface() != null) {
- this.callbackID = createCallbackID();
- }
- }
- }
-
- public B getProxy() throws ObjectCreationException {
- try {
- if (proxy == null) {
- proxy = createProxy();
- }
- return businessInterface.cast(proxy);
- } catch (Exception e) {
- throw new ObjectCreationException(e);
- }
- }
-
- public void setProxy(Object proxy) {
- this.proxy = proxy;
- }
-
- protected Object createProxy() throws Exception {
- return proxyFactory.createProxy(this);
- }
-
- public B getService() {
- try {
- resolve();
- return getProxy();
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public Class<B> getBusinessInterface() {
- try {
- resolve();
- return businessInterface;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public boolean isConversational() {
- try {
- resolve();
- return reference == null ? false : reference.getInterfaceContract().getInterface().isConversational();
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public Conversation getConversation() {
- try {
- // resolve from XML just in case this CallableReference is the result of
- // passing a CallableReference as a parameter
- resolve();
-
- if (conversation == null || conversation.getState() == ConversationState.ENDED) {
- conversation = null;
- }
- return conversation;
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public Object getCallbackID() {
- try {
- resolve();
- return callbackID;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
- */
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- final boolean hasSCDL = in.readBoolean();
- if (hasSCDL) {
- this.scdl = in.readUTF();
- } else {
- this.scdl = null;
- }
- }
-
- /**
- * @throws IOException
- */
- private synchronized void resolve() throws Exception {
- if ((scdl != null || xmlReader != null) && component == null && reference == null) {
- ComponentContextHelper componentContextHelper = ComponentContextHelper.getCurrentComponentContextHelper();
- if (componentContextHelper != null) {
- this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
- this.conversationManager = this.compositeActivator.getConversationManager();
- Component c;
- if (xmlReader != null) {
- c = componentContextHelper.fromXML(xmlReader);
- xmlReader = null; // OK to GC this now
- } else {
- c = componentContextHelper.fromXML(scdl);
- scdl = null; // OK to GC this now
- }
- this.component = (RuntimeComponent)c;
- compositeActivator.configureComponentContext(this.component);
- this.reference = (RuntimeComponentReference)c.getReferences().get(0);
- this.reference.setComponent(this.component);
- clonedRef = reference;
- ReferenceParameters parameters = null;
- for (Object ext : reference.getExtensions()) {
- if (ext instanceof ReferenceParameters) {
- parameters = (ReferenceParameters)ext;
- break;
- }
- }
- if (parameters != null) {
- refParams = parameters;
- this.callbackID = parameters.getCallbackID();
- attachConversation(parameters.getConversationID());
- }
-
- for (Binding binding : reference.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- // Resolve the Component
- final String bindingURI = binding.getURI();
- final Component targetComponent = resolveComponentURI(bindingURI);
-
- // Find the Service
- ComponentService targetService = resolveServiceURI(bindingURI, targetComponent);
-
- // if the target service is a promoted service then find the
- // service it promotes
- if ((targetService != null) && (targetService.getService() instanceof CompositeService)) {
- CompositeService compositeService = (CompositeService) targetService.getService();
- // Find the promoted component service
- ComponentService promotedComponentService = getPromotedComponentService(compositeService);
- if (promotedComponentService != null && !promotedComponentService.isUnresolved()) {
- targetService = promotedComponentService;
- }
- }
-
- OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
- optimizableBinding.setTargetComponent(targetComponent);
- optimizableBinding.setTargetComponentService(targetService);
- if (targetService != null) {
- for (Binding serviceBinding : targetService.getBindings()) {
- if (serviceBinding.getClass() == binding.getClass()) {
- optimizableBinding.setTargetBinding(serviceBinding);
- break;
- }
- }
- }
- }
- }
- // FIXME: The SCA Specification is not clear how we should handle multiplicity
- // for CallableReference
- if (binding == null) {
- binding = reference.getBinding(SCABinding.class);
- if (binding == null) {
- binding = reference.getBindings().get(0);
- }
- }
- Interface i = reference.getInterfaceContract().getInterface();
- if (i instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)i;
- if (javaInterface.isUnresolved()) {
- // Allow privileged access to get ClassLoader. Requires RuntimePermission in
- // security policy.
- ClassLoader classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- javaInterface.setJavaClass(classLoader.loadClass(javaInterface.getName()));
- compositeActivator.getJavaInterfaceFactory().createJavaInterface(javaInterface,
- javaInterface.getJavaClass());
- //FIXME: If the interface needs XSDs to be loaded (e.g., for static SDO),
- // this needs to be done here. We usually search for XSDs in the current
- // contribution at resolve time. Is it possible to locate the current
- // contribution at runtime?
- }
- this.businessInterface = (Class<B>)javaInterface.getJavaClass();
- }
- if (binding instanceof BindingBuilderExtension) {
- ((BindingBuilderExtension)binding).getBuilder().build(component, reference, binding, null);
- }
- this.proxyFactory = compositeActivator.getProxyFactory();
- }
- } else {
- this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
- if (this.compositeActivator != null) {
- this.proxyFactory = this.compositeActivator.getProxyFactory();
- }
- }
- }
-
- /**
- * Follow a service promotion chain down to the inner most (non composite)
- * component service.
- *
- * @param topCompositeService
- * @return
- */
- private ComponentService getPromotedComponentService(CompositeService compositeService) {
- ComponentService componentService = compositeService.getPromotedService();
- if (componentService != null) {
- Service service = componentService.getService();
- if (componentService.getName() != null && service instanceof CompositeService) {
-
- // Continue to follow the service promotion chain
- return getPromotedComponentService((CompositeService)service);
-
- } else {
-
- // Found a non-composite service
- return componentService;
- }
- } else {
-
- // No promoted service
- return null;
- }
- }
-
- /**
- * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
- */
- public void writeExternal(ObjectOutput out) throws IOException {
- try {
- final String xml = toXMLString();
- if (xml == null) {
- out.writeBoolean(false);
- } else {
- out.writeBoolean(true);
- out.writeUTF(xml);
- }
- } catch (Exception e) {
- // e.printStackTrace();
- throw new IOException(e.toString());
- }
- }
-
- public String toXMLString() throws IOException {
- if (reference != null) {
- if (clonedRef == null) {
- try {
- clonedRef = (RuntimeComponentReference)reference.clone();
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- }
- if (refParams == null) {
- refParams = new ReferenceParametersImpl();
-
- // remove any existing reference parameters from the clone
- Object toRemove = null;
- for (Object extension : clonedRef.getExtensions()){
- if (extension instanceof ReferenceParameters){
- toRemove = extension;
- }
- }
-
- if (toRemove != null){
- clonedRef.getExtensions().remove(toRemove);
- }
-
- // add the new reference parameter object
- clonedRef.getExtensions().add(refParams);
- }
- refParams.setCallbackID(callbackID);
- if (conversation != null){
- refParams.setConversationID(conversation.getConversationID());
- }
- return ((CompositeActivatorImpl)compositeActivator).getComponentContextHelper()
- .toXML(component, clonedRef);
- } else {
- return scdl;
- }
- }
-
- /**
- * Create a callback id
- *
- * @return the callback id
- */
- private String createCallbackID() {
- return UUID.randomUUID().toString();
- }
-
- public void attachCallbackID(Object callbackID) {
- this.callbackID = callbackID;
- }
-
- public void attachConversationID(Object conversationID) {
- this.conversationID = conversationID;
- }
-
- public void attachConversation(ExtendedConversation conversation) {
- this.conversation = conversation;
- }
-
- public void attachConversation(Object conversationID) {
- if (conversationID != null) {
- ExtendedConversation conversation = conversationManager.getConversation(conversationID);
- if (conversation == null){
- conversation = conversationManager.startConversation(conversationID);
- }
- this.conversation = conversation;
- } else {
- this.conversation = null;
- }
- }
-
- protected ReferenceParameters getReferenceParameters() {
- ReferenceParameters parameters = new ReferenceParametersImpl();
- parameters.setCallbackID(callbackID);
- if (getConversation() != null) {
- parameters.setConversationID(conversation.getConversationID());
- }
- return parameters;
- }
-
- public EndpointReference getEndpointReference() {
- try {
- resolve();
-
- // Use the interface contract of the reference on the component type
- Reference componentTypeRef = reference.getReference();
- InterfaceContract sourceContract =
- componentTypeRef == null ? reference.getInterfaceContract() : componentTypeRef.getInterfaceContract();
- sourceContract = sourceContract.makeUnidirectional(false);
- EndpointReference epr = new EndpointReferenceImpl(component, reference, binding, sourceContract);
- ReferenceParameters parameters = getReferenceParameters();
- epr.setReferenceParameters(parameters);
- return epr;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public XMLStreamReader getXMLReader() {
- return xmlReader;
- }
-
- /**
- * Resolves the specified URI to a Component using the compositeActivator.
- * There are two cases that we need to handle:
- * <ul>
- * <li>URI containing just Composite name(s) (i.e. no Service name specified)
- * <li>URI containing Composite name(s) and a Service Name
- * </ul>
- *
- * @param componentURI The URI of the Component to resolve
- * @return The Component for the specified URI or null if not founds
- */
- protected Component resolveComponentURI(String componentURI) {
- // If the URI has come from a binding, it may well start with a '/'. We will need
- // to remove this so we can match it to the composite names.
- if (componentURI.startsWith("/")) {
- componentURI = componentURI.substring(1);
- }
-
- // First assume that we are dealing with a Component URI without a Service Name
- Component component = compositeActivator.resolve(componentURI);
- if (component != null) {
- return component;
- }
-
- // Perhaps we have a ComponentURI that has a ServiceName on the end of it
- final int index = componentURI.lastIndexOf('/');
- if (index > -1) {
- componentURI = componentURI.substring(0, index);
- return compositeActivator.resolve(componentURI);
- }
-
- // We could not resolve the Component URI
- return null;
- }
-
- /**
- * Examines the Services on the specified Component and returns the Service that matches the
- * specified Binding URI.
- *
- * @param bindingURI The Binding URI to resolve on the Component
- * @param targetComponent The Component containing the Services
- * @return The Service with the specified serviceName or null if no such Service found.
- */
- protected ComponentService resolveServiceURI(String bindingURI, Component targetComponent) {
-
- ComponentService targetService = null;
-
- if (targetComponent != null) {
- if (bindingURI.startsWith("/")) {
- bindingURI = bindingURI.substring(1);
- }
-
- final String componentURI = targetComponent.getURI();
- final String serviceName;
- if (componentURI.equals(bindingURI)) {
- // No service specified
- serviceName = "";
- } else {
- // Get the Service name from the Binding URI
- serviceName = bindingURI.substring(componentURI.length() + 1);
- }
-
- if ("".equals(serviceName)) {
- targetService = ComponentContextHelper.getSingleService(targetComponent);
- } else {
- for (ComponentService service : targetComponent.getServices()) {
- if (service.getName().equals(serviceName)) {
- targetService = service;
- break;
- }
- }
- }
- }
-
- return targetService;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
deleted file mode 100644
index 78b0887482..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextHelper.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.context;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ComponentContextHelper {
-
- private final AssemblyFactory assemblyFactory;
- private final JavaInterfaceFactory javaInterfaceFactory;
- private final StAXArtifactProcessorExtensionPoint staxProcessors;
-
- /**
- * @param assemblyFactory The factory to create assembly models
- * @param processors The extension point for StAX artifact processors
- */
- public ComponentContextHelper(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaInterfaceFactory,
- StAXArtifactProcessorExtensionPoint processors) {
- this.assemblyFactory = assemblyFactory;
- this.javaInterfaceFactory = javaInterfaceFactory;
- this.staxProcessors = processors;
- }
-
- /**
- * Create a self-reference for a component service
- * @param component
- * @param service
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public ComponentReference createSelfReference(Component component,
- ComponentService service,
- Class<?> businessInterface) throws CloneNotSupportedException,
- InvalidInterfaceException {
- ComponentReference componentReference = assemblyFactory.createComponentReference();
- componentReference.setName("$self$." + service.getName());
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- componentReference.getBindings().add(optimizableBinding);
- } else {
- componentReference.getBindings().add(binding);
- }
- }
-
- componentReference.setCallback(service.getCallback());
- componentReference.getTargets().add(service);
- componentReference.getPolicySets().addAll(service.getPolicySets());
- componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
-
- InterfaceContract interfaceContract = service.getInterfaceContract();
- Service componentTypeService = service.getService();
- if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
- interfaceContract = componentTypeService.getInterfaceContract();
- }
- interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
- componentReference.setInterfaceContract(interfaceContract);
- componentReference.setMultiplicity(Multiplicity.ONE_ONE);
- // component.getReferences().add(componentReference);
- return componentReference;
- }
-
- /**
- * @param interfaceContract
- * @param businessInterface
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
- throws CloneNotSupportedException, InvalidInterfaceException {
- Interface interfaze = interfaceContract.getInterface();
- boolean compatible = false;
- if (interfaze instanceof JavaInterface) {
- Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
- if (businessInterface.isAssignableFrom(cls)) {
- compatible = true;
- }
- }
- if (!compatible) {
- // The interface is not assignable from the interface contract
- interfaceContract = (InterfaceContract)interfaceContract.clone();
- interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
- }
-
- return interfaceContract;
- }
-
- /**
- * Bind a component reference to a component service
- * @param <B>
- * @param businessInterface
- * @param reference
- * @param service
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public RuntimeComponentReference bindComponentReference(Class<?> businessInterface,
- RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service)
- throws CloneNotSupportedException, InvalidInterfaceException {
- RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- Reference componentTypeReference = reference.getReference();
- if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
- interfaceContract = componentTypeReference.getInterfaceContract();
- }
- InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
- if (refInterfaceContract != interfaceContract) {
- ref = (RuntimeComponentReference)reference.clone();
- ref.setInterfaceContract(interfaceContract);
- }
- ref.setComponent(component);
- ref.getTargets().add(service);
- ref.getBindings().clear();
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- ref.getBindings().add(optimizableBinding);
- } else {
- ref.getBindings().add(binding);
- }
- }
- return ref;
- }
-
- public void write(Component component, ComponentReference reference, Writer writer) throws IOException {
- write(component, reference, null, writer);
- }
-
- public void write(Component component, ComponentReference reference, ComponentService service, Writer writer) throws IOException {
- try {
- StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
- Composite composite = assemblyFactory.createComposite();
- composite.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "default"));
- Component comp = assemblyFactory.createComponent();
- comp.setName("default");
- comp.setURI(component.getURI());
- composite.getComponents().add(comp);
- if (reference != null) {
- comp.getReferences().add(reference);
- }
- if (service != null) {
- comp.getServices().add(service);
- }
-
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- XMLStreamWriter streamWriter = outputFactory.createXMLStreamWriter(writer);
- processor.write(composite, streamWriter);
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public String toXML(Component component, ComponentReference reference) throws IOException {
- StringWriter writer = new StringWriter();
- write(component, reference, writer);
- return writer.toString();
- }
-
- public String toXML(Component component, ComponentService service) throws IOException {
- StringWriter writer = new StringWriter();
- write(component, null, service, writer);
- return writer.toString();
- }
-
- public RuntimeComponent read(Reader reader) throws IOException {
- try {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader streamReader = inputFactory.createXMLStreamReader(reader);
- return read(streamReader);
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public RuntimeComponent read(XMLStreamReader streamReader) throws IOException {
- try {
- StAXArtifactProcessor<Composite> processor = staxProcessors.getProcessor(Composite.class);
- Composite composite = processor.read(streamReader);
- RuntimeComponent component = (RuntimeComponent)composite.getComponents().get(0);
- return component;
- } catch (Exception e) {
- throw new IOException(e.getMessage());
- }
- }
-
- public Component fromXML(String xml) throws IOException {
- return read(new StringReader(xml));
- }
-
- public Component fromXML(XMLStreamReader streamReader) throws IOException {
- return read(streamReader);
- }
-
- public static RuntimeComponent getCurrentComponent() {
- Message message = ThreadMessageContext.getMessageContext();
- if (message != null) {
- EndpointReference to = message.getTo();
- if (to == null) {
- return null;
- }
- RuntimeComponent component = message.getTo().getComponent();
- return component;
- }
- return null;
- }
-
- public static CompositeActivator getCurrentCompositeActivator() {
- RuntimeComponent component = getCurrentComponent();
- if (component != null) {
- ComponentContextImpl context = (ComponentContextImpl)component.getComponentContext();
- return context.getCompositeActivator();
- }
- return null;
- }
-
- public static ComponentContextHelper getCurrentComponentContextHelper() {
- CompositeActivator activator = getCurrentCompositeActivator();
- if (activator != null) {
- return activator.getComponentContextHelper();
- }
- return null;
- }
-
- /**
- * @param component
- */
- public static ComponentService getSingleService(Component component) {
- ComponentService targetService;
- List<ComponentService> services = component.getServices();
- List<ComponentService> regularServices = new ArrayList<ComponentService>();
- for (ComponentService service : services) {
- if (service.isCallback()) {
- continue;
- }
- String name = service.getName();
- if (!name.startsWith("$") || name.startsWith("$dynamic$")) {
- regularServices.add(service);
- }
- }
- if (regularServices.size() == 0) {
- throw new ServiceRuntimeException("No service is declared on component " + component.getURI());
- }
- if (regularServices.size() != 1) {
- throw new ServiceRuntimeException("More than one service is declared on component " + component.getURI()
- + ". Service name is required to get the service.");
- }
- targetService = regularServices.get(0);
- return targetService;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
deleted file mode 100644
index 2bcf13f679..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ComponentContextImpl.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.context;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Collection;
-import java.util.ArrayList;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Implementation of ComponentContext that delegates to a ComponentContextProvider.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentContextImpl implements RuntimeComponentContext {
- private final RuntimeComponent component;
-
- private final CompositeActivator compositeActivator;
- private final RequestContextFactory requestContextFactory;
- private final ProxyFactory proxyFactory;
- private final AssemblyFactory assemblyFactory;
- private final JavaInterfaceFactory javaInterfaceFactory;
-
- /**
- * This is a reference to the PropertyValueFactory that is provided by the Implementation
- * that can be used to get the value from a Property Object.
- *
- * @see #setPropertyValueFactory(PropertyValueFactory)
- * @see #getProperty(Class, String)
- */
- private PropertyValueFactory propertyFactory;
-
- public ComponentContextImpl(CompositeActivator compositeActivator,
- AssemblyFactory assemblyFactory,
- ProxyFactory proxyFactory,
- InterfaceContractMapper interfaceContractMapper,
- RequestContextFactory requestContextFactory,
- JavaInterfaceFactory javaInterfaceFactory,
- RuntimeComponent component) {
- super();
- this.compositeActivator = compositeActivator;
- this.assemblyFactory = assemblyFactory;
- this.proxyFactory = proxyFactory;
- this.requestContextFactory = requestContextFactory;
- this.javaInterfaceFactory = javaInterfaceFactory;
- this.component = component;
- }
-
- public String getURI() {
- return component.getURI();
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- return (R)proxyFactory.cast(target);
- }
-
- public <B> B getService(Class<B> businessInterface, String referenceName) {
- ServiceReference<B> serviceRef = getServiceReference(businessInterface, referenceName);
- return serviceRef.getService();
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
- try {
- for (ComponentReference ref : component.getReferences()) {
- if (referenceName.equals(ref.getName())) {
- /* ******************** Contribution for issue TUSCANY-2281 ******************** */
- Multiplicity multiplicity = ref.getMultiplicity();
- if( multiplicity == Multiplicity.ZERO_N || multiplicity == Multiplicity.ONE_N)
- {
- throw new IllegalArgumentException("Reference " + referenceName + " has multiplicity " + multiplicity);
- }
- /* ******************** Contribution for issue TUSCANY-2281 ******************** */
-
- return getServiceReference(businessInterface, (RuntimeComponentReference)ref, null);
- }
- }
- throw new ServiceRuntimeException("Reference not found: " + referenceName);
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e.getMessage(), e);
- }
- }
-
- /**
- * The Implementation is responsible for calling this method to set the
- * PropertyValueFactory that is used to get the Property Value from
- * a Tuscany Property object.
- *
- * @param factory The PropertyValueFactory to use
- *
- * @see #getProperty(Class, String)
- */
- public void setPropertyValueFactory(PropertyValueFactory factory) {
- propertyFactory = factory;
- }
-
- /**
- * Gets the value for the specified property with the specified type.
- *
- * @param type The type of the property value we are getting
- * @param propertyName The name of the property we are getting
- * @param B The class of the property value we are getting
- *
- * @throws ServiceRuntimeException If a Property for the specified propertyName
- * is not found
- *
- * @see #setPropertyValueFactory(PropertyValueFactory)
- */
- public <B> B getProperty(Class<B> type, String propertyName) {
- for (ComponentProperty p : component.getProperties()) {
- if (propertyName.equals(p.getName())) {
- return propertyFactory.createPropertyValue(p, type);
- }
- }
- throw new ServiceRuntimeException("Property not found: " + propertyName);
- }
-
- public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface) {
- ComponentService service = ComponentContextHelper.getSingleService(component);
- try {
- return createSelfReference(businessInterface, service);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e.getMessage(), e);
- }
- }
-
- public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName) {
- try {
- for (ComponentService service : component.getServices()) {
- if (serviceName.equals(service.getName())) {
- return createSelfReference(businessInterface, service);
- }
- }
- throw new ServiceRuntimeException("Service not found: " + serviceName);
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e.getMessage(), e);
- }
- }
-
- /**
- * @param <B>
- * @param businessInterface
- * @param service
- * @return
- */
- public <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, ComponentService service) {
- try {
- RuntimeComponentReference ref =
- (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
- ref.setComponent(component);
- return getServiceReference(businessInterface, ref, null);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public RequestContext getRequestContext() {
- if (requestContextFactory != null) {
- return requestContextFactory.createRequestContext();
- } else {
- return new RequestContextImpl(proxyFactory);
- }
- }
-
- /**
- * @param businessInterface
- * @param reference
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, RuntimeComponentReference reference, Binding binding) {
- try {
- RuntimeComponentReference ref = (RuntimeComponentReference)reference;
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- Reference componentTypeReference = reference.getReference();
- if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
- interfaceContract = componentTypeReference.getInterfaceContract();
- }
- InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
- if (refInterfaceContract != interfaceContract) {
- ref = (RuntimeComponentReference)reference.clone();
- if (interfaceContract != null) {
- ref.setInterfaceContract(interfaceContract);
- } else {
- ref.setInterfaceContract(refInterfaceContract);
- }
- }
- ref.setComponent(component);
- return new ServiceReferenceImpl<B>(businessInterface, component, ref, binding, proxyFactory, compositeActivator);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Bind a component reference to a component service
- * @param <B>
- * @param businessInterface
- * @param reference
- * @param service
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface,
- RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service) {
- try {
- RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- Reference componentTypeReference = reference.getReference();
- if (componentTypeReference != null && componentTypeReference.getInterfaceContract() != null) {
- interfaceContract = componentTypeReference.getInterfaceContract();
- }
- InterfaceContract refInterfaceContract = getInterfaceContract(interfaceContract, businessInterface);
- if (refInterfaceContract != interfaceContract) {
- ref = (RuntimeComponentReference)reference.clone();
- ref.setInterfaceContract(interfaceContract);
- }
- ref.getTargets().add(service);
- ref.getBindings().clear();
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- ref.getBindings().add(optimizableBinding);
- } else {
- ref.getBindings().add(binding);
- }
- }
- return new ServiceReferenceImpl<B>(businessInterface, component, ref, proxyFactory, compositeActivator);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public <B> CallableReference<B> getCallableReference(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentService service) {
- try {
- if (businessInterface == null) {
- InterfaceContract contract = service.getInterfaceContract();
- businessInterface = (Class<B>)((JavaInterface)contract.getInterface()).getJavaClass();
- }
- RuntimeComponentReference ref =
- (RuntimeComponentReference)createSelfReference(component, service, businessInterface);
- ref.setComponent(component);
- return new CallableReferenceImpl<B>(businessInterface, component, ref, null, proxyFactory,
- compositeActivator);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Create a self-reference for a component service
- * @param component
- * @param service
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- private ComponentReference createSelfReference(Component component,
- ComponentService service,
- Class<?> businessInterface) throws CloneNotSupportedException,
- InvalidInterfaceException {
- ComponentReference componentReference = assemblyFactory.createComponentReference();
- componentReference.setName("$self$." + service.getName());
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- componentReference.getBindings().add(optimizableBinding);
- } else {
- componentReference.getBindings().add(binding);
- }
- }
-
- componentReference.setCallback(service.getCallback());
- componentReference.getTargets().add(service);
- componentReference.getPolicySets().addAll(service.getPolicySets());
- componentReference.getRequiredIntents().addAll(service.getRequiredIntents());
-
- InterfaceContract interfaceContract = service.getInterfaceContract();
- Service componentTypeService = service.getService();
- if (componentTypeService != null && componentTypeService.getInterfaceContract() != null) {
- interfaceContract = componentTypeService.getInterfaceContract();
- }
- interfaceContract = getInterfaceContract(interfaceContract, businessInterface);
- componentReference.setInterfaceContract(interfaceContract);
- componentReference.setMultiplicity(Multiplicity.ONE_ONE);
- // component.getReferences().add(componentReference);
- return componentReference;
- }
-
- /**
- * @param interfaceContract
- * @param businessInterface
- * @return
- * @throws CloneNotSupportedException
- * @throws InvalidInterfaceException
- */
- private InterfaceContract getInterfaceContract(InterfaceContract interfaceContract, Class<?> businessInterface)
- throws CloneNotSupportedException, InvalidInterfaceException {
- boolean compatible = false;
- if (interfaceContract != null && interfaceContract.getInterface() != null) {
- Interface interfaze = interfaceContract.getInterface();
- if (interfaze instanceof JavaInterface) {
- Class<?> cls = ((JavaInterface)interfaze).getJavaClass();
- if (businessInterface.isAssignableFrom(cls)) {
- compatible = true;
- }
- }
- }
-
- if (!compatible) {
- // The interface is not assignable from the interface contract
- interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(businessInterface);
- interfaceContract.setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- interfaceContract.setCallbackInterface(javaInterfaceFactory.createJavaInterface(callInterface
- .getCallbackClass()));
- }
- }
-
- return interfaceContract;
- }
-
- /**
- * @return the compositeActivator
- */
- public CompositeActivator getCompositeActivator() {
- return compositeActivator;
- }
-
- /**
- * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#start(org.apache.tuscany.sca.runtime.RuntimeComponentReference)
- */
- public void start(RuntimeComponentReference reference) {
- compositeActivator.start(component, reference);
- }
-
- /**
- * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#read(java.io.Reader)
- */
- public RuntimeComponent read(Reader reader) throws IOException {
- RuntimeComponent component = compositeActivator.getComponentContextHelper().read(reader);
- compositeActivator.configureComponentContext(component);
- return component;
- }
-
- /**
- * @see org.apache.tuscany.sca.runtime.RuntimeComponentContext#write(org.apache.tuscany.sca.runtime.RuntimeComponentReference, java.io.Writer)
- */
- public void write(RuntimeComponentReference reference, Writer writer) throws IOException {
- compositeActivator.getComponentContextHelper().write(component, reference, writer);
- }
-
- /* ******************** Contribution for issue TUSCANY-2281 ******************** */
-
- /**
- * @see ComponentContext#getServices(Class<B>, String)
- */
- public <B> Collection<B> getServices(Class<B> businessInterface, String referenceName) {
- ArrayList<B> services = new ArrayList<B>();
- Collection<ServiceReference<B>> serviceRefs = getServiceReferences(businessInterface, referenceName);
- for (ServiceReference<B> serviceRef : serviceRefs) {
- services.add(serviceRef.getService());
- }
- return services;
- }
-
- /**
- * @see ComponentContext#getServiceReferences(Class<B>, String)
- */
- public <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName) {
- try {
- for (ComponentReference ref : component.getReferences()) {
- if (referenceName.equals(ref.getName())) {
- ArrayList<ServiceReference<B>> serviceRefs = new ArrayList<ServiceReference<B>>();
- for(Binding binding : ref.getBindings())
- {
- serviceRefs.add( getServiceReference(businessInterface, (RuntimeComponentReference) ref, binding) );
- }
- return serviceRefs;
- }
- }
- throw new ServiceRuntimeException("Reference not found: " + referenceName);
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e.getMessage(), e);
- }
- }
- /* ******************** Contribution for issue TUSCANY-2281 ******************** */
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java
deleted file mode 100644
index c5b68389b2..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/DefaultComponentContextFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.context;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.context.ComponentContextFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.ComponentContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DefaultComponentContextFactory implements ComponentContextFactory {
- private final CompositeActivator compositeActivator;
- private final RequestContextFactory requestContextFactory;
- private final ProxyFactory proxyFactory;
- private final AssemblyFactory assemblyFactory;
- private final JavaInterfaceFactory javaInterfaceFactory;
- private final InterfaceContractMapper interfaceContractMapper;
-
- public DefaultComponentContextFactory(CompositeActivator compositeActivator,
- AssemblyFactory assemblyFactory,
- ProxyFactory proxyFactory,
- InterfaceContractMapper interfaceContractMapper,
- RequestContextFactory requestContextFactory,
- JavaInterfaceFactory javaInterfaceFactory) {
- super();
- this.compositeActivator = compositeActivator;
- this.assemblyFactory = assemblyFactory;
- this.proxyFactory = proxyFactory;
- this.requestContextFactory = requestContextFactory;
- this.javaInterfaceFactory = javaInterfaceFactory;
- this.interfaceContractMapper = interfaceContractMapper;
- }
-
- /**
- * @see org.apache.tuscany.sca.context.ComponentContextFactory#createComponentContext(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.context.RequestContextFactory)
- */
- public ComponentContext createComponentContext(RuntimeComponent component,
- RequestContextFactory requestContextFactory) {
- if (requestContextFactory == null) {
- requestContextFactory = this.requestContextFactory;
- }
- return new ComponentContextImpl(compositeActivator, assemblyFactory, proxyFactory, interfaceContractMapper,
- requestContextFactory, javaInterfaceFactory, component);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java
deleted file mode 100644
index b577180291..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/InstanceWrapper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.context;
-
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetInitializationException;
-
-
-/**
- * Provides lifecycle management for an implementation instance associated with
- * a component for use by the component's associated {@link org.apache.tuscany.sca.core.scope.ScopeContainer}
- *
- * @version $Rev$ $Date$
- */
-public interface InstanceWrapper<T> {
-
- /**
- * @return
- */
- T getInstance();
-
- /**
- * @throws TargetInitializationException
- */
- void start() throws TargetInitializationException;
-
- /**
- * @throws TargetDestructionException
- */
- void stop() throws TargetDestructionException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
deleted file mode 100644
index ed6c3df8fa..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/RequestContextImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.context;
-
-import java.util.List;
-
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.core.invocation.CallbackReferenceImpl;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.RequestContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestContextImpl implements RequestContext {
-
- private ProxyFactory proxyFactory;
-
- public RequestContextImpl(ProxyFactory proxyFactory) {
- this.proxyFactory = proxyFactory;
- }
-
- public Subject getSecuritySubject() {
- Subject subject = null;
-
- for (Object header : ThreadMessageContext.getMessageContext().getHeaders()){
- if (header instanceof Subject){
- subject = (Subject)header;
- break;
- }
- }
- return subject;
- }
-
- public String getServiceName() {
- return ThreadMessageContext.getMessageContext().getTo().getContract().getName();
- }
-
- @SuppressWarnings("unchecked")
- public <B> CallableReference<B> getServiceReference() {
- Message msgContext = ThreadMessageContext.getMessageContext();
- // FIXME: [rfeng] Is this the service reference matching the caller side?
- EndpointReference to = msgContext.getTo();
- RuntimeComponentService service = (RuntimeComponentService) to.getContract();
- RuntimeComponent component = (RuntimeComponent) to.getComponent();
-
- CallableReference<B> callableReference = component.getComponentContext().getCallableReference(null, component, service);
- ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
- ((CallableReferenceImpl<B>) callableReference).attachCallbackID(parameters.getCallbackID());
- ((CallableReferenceImpl<B>) callableReference).attachConversation(parameters.getConversationID());
- return callableReference;
- }
-
- @SuppressWarnings("unchecked")
- public <CB> CB getCallback() {
- CallableReference<CB> cb = getCallbackReference();
- if (cb == null) {
- return null;
- }
- return cb.getService();
- }
-
- @SuppressWarnings("unchecked")
- public <CB> CallableReference<CB> getCallbackReference() {
- Message msgContext = ThreadMessageContext.getMessageContext();
- EndpointReference to = msgContext.getTo();
- RuntimeComponentService service = (RuntimeComponentService) to.getContract();
- RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
- if (callbackReference == null) {
- return null;
- }
- JavaInterface javaInterface = (JavaInterface) callbackReference.getInterfaceContract().getInterface();
- Class<CB> javaClass = (Class<CB>)javaInterface.getJavaClass();
- List<RuntimeWire> wires = callbackReference.getRuntimeWires();
- CallbackReferenceImpl ref = CallbackReferenceImpl.newInstance(javaClass, proxyFactory, wires);
- if (ref != null) {
- //ref.resolveTarget();
- ReferenceParameters parameters = msgContext.getFrom().getReferenceParameters();
- ref.attachCallbackID(parameters.getCallbackID());
- if (ref.getConversation() != null) {
- ref.attachConversationID(parameters.getConversationID());
- }
- }
- return ref;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
deleted file mode 100644
index 1d178421cf..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/context/ServiceReferenceImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.context;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.conversation.ConversationState;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- * Default implementation of a ServiceReference.
- *
- * @version $Rev$ $Date$
- * @param <B> the type of the business interface
- */
-public class ServiceReferenceImpl<B> extends CallableReferenceImpl<B> implements ServiceReference<B> {
- private static final long serialVersionUID = 6763709434194361540L;
-
- protected transient Object callback;
-
- /*
- * Public constructor for Externalizable serialization/deserialization
- */
- public ServiceReferenceImpl() {
- super();
- }
-
- /*
- * Public constructor for use by XMLStreamReader2CallableReference
- */
- public ServiceReferenceImpl(XMLStreamReader xmlReader) throws Exception {
- super(xmlReader);
- }
-
- /**
- * @param businessInterface
- * @param wire
- * @param proxyFactory
- */
- public ServiceReferenceImpl(Class<B> businessInterface, RuntimeWire wire, ProxyFactory proxyFactory) {
- super(businessInterface, wire, proxyFactory);
- }
-
- public ServiceReferenceImpl(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- ProxyFactory proxyFactory,
- CompositeActivator compositeActivator) {
- super(businessInterface, component, reference, null, proxyFactory, compositeActivator);
- }
-
- public ServiceReferenceImpl(Class<B> businessInterface,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding,
- ProxyFactory proxyFactory,
- CompositeActivator compositeActivator) {
- super(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
- }
-
- public Object getConversationID() {
- return conversationID;
- }
-
- public void setConversationID(Object conversationID) throws IllegalStateException {
- if (conversation == null || conversation.getState() != ConversationState.ENDED) {
- this.conversationID = conversationID;
- this.conversation = null;
- } else {
- throw new IllegalStateException("Trying to set the conversationId on a service reference but the state of the conversation "
- + conversation.getConversationID()
- + " is "
- + conversation.getState());
- }
- }
-
- public void setCallbackID(Object callbackID) {
- this.callbackID = callbackID;
- }
-
- public Object getCallback() {
- return callback;
- }
-
- public void setCallback(Object callback) {
- if (callback != null && !(callback instanceof CallableReference)) {
- //FIXME: need to check if callback object supports the callback interface
- // returned by reference.getInterfaceContract().getCallbackInterface()
- }
- this.callback = callback;
- }
-
- @Override
- protected ReferenceParameters getReferenceParameters() {
- ReferenceParameters parameters = super.getReferenceParameters();
- if (callback != null) {
- if (callback instanceof ServiceReference) {
- EndpointReference callbackRef = ((CallableReferenceImpl)callback).getEndpointReference();
- parameters.setCallbackReference(callbackRef);
- } else {
- EndpointReference callbackRef = getRuntimeWire().getSource().getCallbackEndpoint();
- parameters.setCallbackReference(callbackRef);
- parameters.setCallbackObjectID(callback);
- }
- }
- return parameters;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.java
deleted file mode 100644
index efa362a929..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationListener.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.core.conversation;
-
-/**
- * Listener for the events of a conversation
- *
- * @version $Rev$ $Date$
- */
-public interface ConversationListener {
- /**
- * The conversation is started
- */
- void conversationStarted(ExtendedConversation conversation);
- /**
- * The conversation is ended
- */
- void conversationEnded(ExtendedConversation conversation);
- /**
- * The conversation is expired
- */
- void conversationExpired(ExtendedConversation conversation);
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java
deleted file mode 100644
index f928f91a02..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.conversation;
-
-/**
- * The manager of conversations
- *
- * @version $Rev$ $Date$
- */
-public interface ConversationManager {
- /**
- * @param conversationID
- * @return
- */
- ExtendedConversation startConversation(Object conversationID);
-
- /**
- * @param conversationID
- */
- void endConversation(Object conversationID);
-
- /**
- * @param conversationID
- * @return
- */
- ExtendedConversation getConversation(Object conversationID);
-
- /**
- * @param conversationID
- */
- void expireConversation(Object conversationID);
-
- /**
- * Add a listener to this conversation
- * @param listener
- */
- void addListener(ConversationListener listener);
-
- /**
- * Remove a listener from this conversation
- * @param listener
- */
- void removeListener(ConversationListener listener);
-
- /**
- * @return the default max age for a conversation
- */
- long getMaxAge();
-
- /**
- * @return the default max idle time for a conversation
- */
- long getMaxIdleTime();
-
- void destroy();
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java
deleted file mode 100644
index 3bea79b076..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationManagerImpl.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.conversation;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationManagerImpl implements ConversationManager {
-
- private List<ConversationListener> listeners = Collections.synchronizedList(new ArrayList<ConversationListener>());
- private Map<Object, ExtendedConversation> conversations = new ConcurrentHashMap<Object, ExtendedConversation>();
-
- /**
- * the default max age. this is set to 1 hour
- */
- private static final long DEFAULT_MAX_AGE = 60 * 60 * 1000; ;
-
- /**
- * the default max idle time. this is set to 1 hour
- */
- private static final long DEFAULT_MAX_IDLE_TIME = 60 * 60 * 1000;
-
- /**
- * the globally used max age
- */
- private final long maxAge;
-
- /**
- * the globally used max idle time
- */
- private final long maxIdleTime;
-
- /**
- * the reaper thread
- */
- private final ScheduledExecutorService scheduler;
-
- /**
- * constructor
- */
- public ConversationManagerImpl() {
- long mit = DEFAULT_MAX_IDLE_TIME;
- long ma = DEFAULT_MAX_AGE;
-
- scheduler = Executors.newSingleThreadScheduledExecutor();
-
- // Allow privileged access to read system property. Requires PropertyPermission in security
- // policy.
- String aProperty = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxIdleTime");
- }
- });
- if (aProperty != null) {
- try {
- mit = (new Long(aProperty) * 1000);
- } catch (NumberFormatException nfe) {
- // Ignore
- }
- }
-
- // Allow privileged access to read system property. Requires PropertyPermission in security
- // policy.
- aProperty = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty("org.apache.tuscany.sca.core.scope.ConversationalScopeContainer.MaxAge");
- }
- });
- if (aProperty != null) {
- try {
- ma = (new Long(aProperty) * 1000);
- } catch (NumberFormatException nfe) {
- // Ignore
- }
- }
-
- maxAge = ma;
- maxIdleTime = mit;
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationManager#addListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
- */
- public void addListener(ConversationListener listener) {
- listeners.add(listener);
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationManager#endConversation(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
- */
- public void endConversation(Object conversationID) {
- ExtendedConversation conv = getConversation(conversationID);
- if (conv != null) {
- conv.setState(ConversationState.ENDED);
- for (ConversationListener listener : listeners) {
- listener.conversationEnded(conv);
- }
- conv.setConversationID(null);
- conversations.remove(conversationID);
- } else {
- throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
- }
- }
-
- public void expireConversation(Object conversationID) {
- ExtendedConversation conv = getConversation(conversationID);
- if (conv != null) {
- for (ConversationListener listener : listeners) {
- listener.conversationExpired(conv);
- }
- conversations.remove(conversationID);
- } else {
- throw new IllegalStateException("Conversation " + conversationID + " doesn't exist.");
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationManager#getConversation(java.lang.Object)
- */
- public ExtendedConversation getConversation(Object conversationID) {
- // ConcurrentHashMap cannot take null key
- return conversationID == null ? null : conversations.get(conversationID);
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationManager#removeListener(org.apache.tuscany.sca.core.conversation.ConversationListener)
- */
- public void removeListener(ConversationListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * starts the reaper thread
- */
- public void scheduleConversation(ExtendedConversationImpl aConversation, long time)
- {
- this.scheduler.schedule(aConversation, time, TimeUnit.MILLISECONDS);
- }
-
- /**
- * stops the reaper thread
- */
- public synchronized void stopReaper() {
-
- // Prevent the scheduler from submitting any additional reapers,
- // initiate an orderly shutdown if a reaper task is in progress.
- this.scheduler.shutdown();
- }
-
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationManager#startConversation(java.lang.Object)
- */
- public ExtendedConversation startConversation(Object conversationID) {
-
- if (conversationID == null) {
- conversationID = UUID.randomUUID().toString();
- }
- ExtendedConversation conversation = getConversation(conversationID);
- if (conversation != null && conversation.getState() != ConversationState.ENDED) {
- throw new IllegalStateException(conversation + " already exists.");
- }
-
- conversation = new ExtendedConversationImpl(
- this, conversationID, ConversationState.STARTED);
- conversations.put(conversationID, conversation);
- for (ConversationListener listener : listeners) {
- listener.conversationStarted(conversation);
- }
- return conversation;
- }
-
- /**
- * return the default max idle time
- * @param impProvider the implementation Provider to extract any ConversationAttribute details
- */
- public long getMaxIdleTime() {
- return maxIdleTime;
- }
-
- /**
- * returns the default max age
- * @param impProvider the implementation Provider to extract any ConversationAttribute details
- */
- public long getMaxAge(){
- return maxAge;
- }
-
- public void destroy() {
- // REVIEW: A more graceful way?
- scheduler.shutdownNow();
- this.listeners.clear();
- this.conversations.clear();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.java
deleted file mode 100644
index 692d6861ba..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ConversationState.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.core.conversation;
-
-/**
- * The states of a conversation
- *
- * @version $Rev$ $Date$
- */
-public enum ConversationState {
- STARTED, ENDED, EXPIRED
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.java
deleted file mode 100644
index 03c18c26b8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversation.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.core.conversation;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.Conversation;
-
-/**
- * An extended interface over org.osoa.Conversation
- *
- * @version $Rev$ $Date$
- */
-public interface ExtendedConversation extends Conversation {
- /**
- * Get the state of a conversation
- * @return The state
- */
- ConversationState getState();
-
- /**
- * @param state the state to set
- */
- void setState(ConversationState state);
-
- /**
- * @param conversationID the conversationID to set
- */
- void setConversationID(Object conversationID);
-
-
- /**
- * will check whether this conversation has expired and update state if it has
- * @return true if it has expired
- */
- boolean isExpired();
-
- /**
- * updates the last time this conversation was referenced
- */
- void updateLastReferencedTime();
-
- void initializeConversationAttributes(RuntimeComponent targetComponent);
-
-
- /**
- * @return true if the conversational attributes have been initialized
- */
- boolean conversationalAttributesInitialized();
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
deleted file mode 100644
index 0bf66b2817..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/conversation/ExtendedConversationImpl.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.conversation;
-
-import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class ExtendedConversationImpl implements ExtendedConversation, Runnable {
-
- private final ConversationManagerImpl manager;
- private volatile Object conversationID;
- private ConversationState state;
-
- /**
- * syncs access to the state
- */
- private final Object stateSync = new Object();
-
- /**
- * the maximum time a conversation can exist
- */
- private long expirationTime = 0;
-
- /**
- * the maximum time this conversation can be idle
- */
- private long maxIdleTime = 0;
-
- /**
- * the maximum age of this conversation
- */
- private long maxAge = 0;
-
- /**
- * the time that this object was created
- */
- private long creationTime;
-
- /**
- * the time that this object was last referenced
- */
- private long lastReferencedTime;
-
- /**
- * boolean to ensure expiry only occurs once
- */
- private boolean expired = false;
-
- /**
- * boolean to indicate if the conversation attributes have
- * been set. In the case where a remote binding is used
- * within a composite the JDKInvocationHandler can create the
- * conversation but the conversationAttributes are not available
- * until the conversation is retrieved by the RuntimeWireInvoker
- */
- private boolean conversationAttributesInitialized = false;
-
- /**
- * Constructor
- * @param manager the conversation manager
- * @param conversationID the conversation id associated with this conversation
- * @param state the initial state of this conversation
- * @param aMaxAge the maximum age of the conversation
- * @param aMaxIdleTime the maximum idle time
- */
- public ExtendedConversationImpl(ConversationManagerImpl manager,
- Object conversationID, ConversationState state) {
- super();
-
- this.creationTime = System.currentTimeMillis();
- this.lastReferencedTime = creationTime;
- this.manager = manager;
- this.conversationID = conversationID;
- this.state = state;
- }
-
- /**
- * will check whether this conversation has expired and update state if it has
- * @return true if it has expired
- */
- public boolean isExpired() {
- long currentTime;
- synchronized (stateSync) {
-
- // if the attributes haven't been initialized then
- // this conversation object can't expire
- if (conversationAttributesInitialized == false) {
- return false;
- }
-
- // check state first
- if (state == ConversationState.EXPIRED) {
- return true;
- }
-
- // check whether the time is finished
- currentTime = System.currentTimeMillis();
- if (((this.lastReferencedTime + this.maxIdleTime) <= currentTime)
- || (this.expirationTime <= currentTime)) {
- setState(ConversationState.EXPIRED);
- return true;
- }
- }
- scheduleNextExpiryTime(currentTime);
- return false;
- }
-
- /**
- * schedule next expiry time
- */
- public void scheduleNextExpiryTime(long currentTime) {
- if ((lastReferencedTime + maxIdleTime) < expirationTime){
- manager.scheduleConversation(this, (lastReferencedTime + maxIdleTime) - currentTime);
- } else {
- manager.scheduleConversation(this, expirationTime - currentTime);
- }
- }
- /**
- * updates the last time this conversation was referenced
- */
- public void updateLastReferencedTime() {
- this.lastReferencedTime = System.currentTimeMillis();
- if (conversationAttributesInitialized == true){
- scheduleNextExpiryTime(lastReferencedTime);
- }
- }
-
- public ConversationState getState() {
- synchronized (stateSync){
- return state;
- }
- }
-
- public void end() {
- manager.endConversation(conversationID);
- }
-
- public Object getConversationID() {
- return conversationID;
- }
-
- /**
- * @param state the state to set
- */
- public void setState(ConversationState state) {
- synchronized (stateSync){
- this.state = state;
- }
- }
-
- /**
- * @param conversationID the conversationID to set
- */
- public void setConversationID(Object conversationID) {
- synchronized (stateSync){
- if (state != ConversationState.ENDED) {
- throw new IllegalStateException("The state of conversation " + conversationID + " " + state);
- }
- }
- this.conversationID = conversationID;
- }
-
- /**
- * @param maxAge the maximum age of this conversation
- */
- public void initializeConversationAttributes(RuntimeComponent targetComponent){
- if (targetComponent != null){
- this.maxAge = getMaxIdleTime(targetComponent.getImplementationProvider());
- this.maxIdleTime = getMaxAge(targetComponent.getImplementationProvider());
- this.expirationTime = creationTime + maxAge;
- this.conversationAttributesInitialized = true;
- }
- }
-
- /**
- * @return true if the conversational attributes have been initialized
- */
- public boolean conversationalAttributesInitialized(){
- return this.conversationAttributesInitialized;
- }
-
- /**
- * return the max idle time
- * @param impProvider the implementation Provider to extract any ConversationAttribute details
- */
- private long getMaxIdleTime(ImplementationProvider impProvider) {
- // Check to see if the maxIdleTime has been specified using @ConversationAttributes.
- // Implementation annotated attributes are honoured first.
- if ((impProvider != null) &&
- (impProvider instanceof ScopedImplementationProvider)) {
- ScopedImplementationProvider aScopedImpl =
- (ScopedImplementationProvider) impProvider;
-
- long maxIdleTime = aScopedImpl.getMaxIdleTime();
- if (maxIdleTime > 0) {
- return maxIdleTime;
- }
- }
- return manager.getMaxIdleTime();
- }
-
- /**
- * returns the max age
- * @param impProvider the implementation Provider to extract any ConversationAttribute details
- */
- private long getMaxAge(ImplementationProvider impProvider){
-
- // Check to see if the maxAge has been specified using @ConversationAttributes.
- // Implementation annotated attributes are honoured first.
- if ((impProvider != null) &&
- (impProvider instanceof ScopedImplementationProvider)) {
- ScopedImplementationProvider aScopedImpl =
- (ScopedImplementationProvider) impProvider;
-
- long maxAge = aScopedImpl.getMaxAge();
- if (maxAge > 0) {
- return maxAge;
- }
- }
- return manager.getMaxAge();
- }
-
- /**
- * called when expiring
- */
- public void run() {
- synchronized (stateSync){
- if (!expired){
- if (isExpired()) {
- expired = true;
- try {
- manager.expireConversation(getConversationID());
- } catch (IllegalStateException ise) {
- // ignore this.. this can occur if another thread has subsequently ended
- // the conversation
- }
- }
- }
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
deleted file mode 100644
index 517e5579a4..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/BaseEventPublisher.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.event.EventFilter;
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.event.TrueFilter;
-
-/**
- * Base implementation of an <code>EventPublisher</code>
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseEventPublisher implements EventPublisher {
- protected static final EventFilter TRUE_FILTER = new TrueFilter();
- protected Map<EventFilter, List<RuntimeEventListener>> listeners;
-
- public void addListener(RuntimeEventListener listener) {
- addListener(TRUE_FILTER, listener);
- }
-
- public void removeListener(RuntimeEventListener listener) {
- assert listener != null : "Listener cannot be null";
- synchronized (getListeners()) {
- for (List<RuntimeEventListener> currentList : getListeners().values()) {
- for (RuntimeEventListener current : currentList) {
- if (current == listener) {
- currentList.remove(current);
- return;
- }
- }
- }
- }
- }
-
- public void addListener(EventFilter filter, RuntimeEventListener listener) {
- assert listener != null : "Listener cannot be null";
- synchronized (getListeners()) {
- List<RuntimeEventListener> list = getListeners().get(filter);
- if (list == null) {
- list = new CopyOnWriteArrayList<RuntimeEventListener>();
- listeners.put(filter, list);
- }
- list.add(listener);
- }
- }
-
- public void publish(Event event) {
- assert event != null : "Event object was null";
- for (Map.Entry<EventFilter, List<RuntimeEventListener>> entry : getListeners().entrySet()) {
- if (entry.getKey().match(event)) {
- for (RuntimeEventListener listener : entry.getValue()) {
- listener.onEvent(event);
- }
- }
- }
- }
-
- protected Map<EventFilter, List<RuntimeEventListener>> getListeners() {
- if (listeners == null) {
- listeners = new ConcurrentHashMap<EventFilter, List<RuntimeEventListener>>();
- }
- return listeners;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
deleted file mode 100644
index 45eab7da1b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStart.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a component starts
- *
- * @version $Rev$ $Date$
- */
-public class ComponentStart implements Event {
-
- private Object source;
- private URI uri;
-
- /**
- * Creates a component start event
- *
- * @param source the source of the event
- * @param componentURI the URI of the component being started
- */
- public ComponentStart(Object source, URI componentURI) {
- this.source = source;
- this.uri = componentURI;
- }
-
- public URI getComponentURI() {
- return uri;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
deleted file mode 100644
index 4dc79c3844..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ComponentStop.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import java.net.URI;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a component stops
- *
- * @version $Rev$ $Date$
- */
-public class ComponentStop implements Event {
-
- private Object source;
- private URI uri;
-
- /**
- * Creates a component stop event
- *
- * @param source the source of the event
- * @param componentUri the composite component associated the component being stopped
- */
- public ComponentStop(Object source, URI componentUri) {
- this.source = source;
- this.uri = componentUri;
- }
-
- public URI getComponentURI() {
- return uri;
- }
-
- public Object getSource() {
- return source;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
deleted file mode 100644
index d3106c7052..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationEnd.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-
-/**
- * Propagated when a conversation is expired
- *
- * @version $Rev$ $Date$
- */
-public class ConversationEnd implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the conversation being ended
- */
- public ConversationEnd(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getConversationID() {
- return id;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
deleted file mode 100644
index 123400fbdd..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/ConversationStart.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-/**
- * Propagated when a conversation has started
- *
- * @version $Rev$ $Date$
- */
-public class ConversationStart implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the conversation being started
- */
- public ConversationStart(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getConversationID() {
- return id;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
deleted file mode 100644
index 68cb5c2966..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionEnd.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-
-/**
- * Propagated when an HTTP-based session is expired
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionEnd implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the HTTP session being ended
- */
- public HttpSessionEnd(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getSessionID() {
- return id;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
deleted file mode 100644
index 38a4fb10d6..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/HttpSessionStart.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-
-/**
- * Propagated when an HTTP-based session has started
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionStart implements Event {
-
- private Object source;
- private Object id;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- * @param id the id of the HTTP session being started
- */
- public HttpSessionStart(Object source, Object id) {
- this.source = source;
- this.id = id;
- }
-
- public Object getSource() {
- return source;
- }
-
- public Object getSessionID() {
- return id;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.java
deleted file mode 100644
index d7e797bbb9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestEnd.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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a request completes or is ended
- *
- * @version $Rev$ $Date$
- */
-public class RequestEnd implements Event {
-
- private Object source;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- */
- public RequestEnd(Object source) {
- this.source = source;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.java
deleted file mode 100644
index 7530156b11..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/event/RequestStart.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.core.event;
-
-import org.apache.tuscany.sca.event.Event;
-
-/**
- * Propagated when a request is started in the runtime
- *
- * @version $Rev$ $Date$
- */
-public class RequestStart implements Event {
-
- private Object source;
-
- /**
- * Creates a new event
- *
- * @param source the source of the event
- */
- public RequestStart(Object source) {
- this.source = source;
- }
-
- public Object getSource() {
- return source;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java
deleted file mode 100644
index d35b27fd24..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectCreationException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.factory;
-
-
-/**
- * Denotes an error creating a new object instance
- *
- * @version $Rev$ $Date$
- */
-public class ObjectCreationException extends RuntimeException {
- private static final long serialVersionUID = -6423113430265944499L;
-
- public ObjectCreationException() {
- super();
- }
-
- public ObjectCreationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ObjectCreationException(String message) {
- super(message);
- }
-
- public ObjectCreationException(Throwable cause) {
- super(cause);
- }
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.java
deleted file mode 100644
index 3f64d2405b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/factory/ObjectFactory.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.core.factory;
-
-/**
- * Implementations create new instances of a particular type
- *
- * @version $Rev$ $Date$
- */
-public interface ObjectFactory<T> {
-
- /**
- * Return a instance of the type that this factory creates.
- *
- * @return a instance from this factory
- */
- T getInstance() throws ObjectCreationException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.java
deleted file mode 100644
index 588c43b8b1..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallableReferenceObjectFactory.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.core.invocation;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.CallableReference;
-
-/**
- * Uses a wire to return a CallableReference
- *
- * @version $Rev$ $Date$
- */
-public class CallableReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
- private Class<?> businessInterface;
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- /**
- * Constructor.
- *
- * To support the @Reference protected CallableReference<MyService> ref;
- *
- * @param businessInterface the interface to inject
- * @param component the component defining the reference to be injected
- * @param reference the reference to be injected
- * @param binding the binding for the reference
- */
- public CallableReferenceObjectFactory(Class<?> businessInterface,
- RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- this.businessInterface = businessInterface;
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- public CallableReference<?> getInstance() throws ObjectCreationException {
- return component.getComponentContext().getServiceReference(businessInterface, reference, binding);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
deleted file mode 100644
index d19aa237cd..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackInterfaceInterceptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.osoa.sca.NoRegisteredCallbackException;
-
-/**
- * An interceptor applied to the forward direction of a wire that ensures the callback target implements the required
- * service contract. This is required as callback targets may be set dynamically by service implementations.
- *
- * @version $Rev$ $Date$
- */
-public class CallbackInterfaceInterceptor implements Interceptor {
- private Invoker next;
-
- public CallbackInterfaceInterceptor() {
- }
-
- public Message invoke(Message msg) {
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
- if (parameters.getCallbackObjectID() != null || parameters.getCallbackReference() != msg.getFrom()
- .getCallbackEndpoint()) {
- return next.invoke(msg);
- } else {
- throw new NoRegisteredCallbackException("Callback target does not implement the callback interface");
- }
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Invoker getNext() {
- return next;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java
deleted file mode 100644
index 97c69c33cb..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceImpl.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.OptimizableBinding;
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.RuntimeComponentReferenceImpl;
-import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ComponentContextHelper;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Returns proxy instance for a wire callback
- *
- * @version $Rev: 576055 $ $Date: 2007-09-16 08:11:45 +0100 (Sun, 16 Sep 2007) $
- */
-public class CallbackReferenceImpl<B> extends CallableReferenceImpl<B> {
- private RuntimeWire wire;
- private List<RuntimeWire> wires;
- private EndpointReference resolvedEndpoint;
- private Object convID;
-
- public static CallbackReferenceImpl newInstance(Class interfaze,
- ProxyFactory proxyFactory,
- List<RuntimeWire> wires) {
- if (getCallbackEndpoint(ThreadMessageContext.getMessageContext()) != null) {
- return new CallbackReferenceImpl(interfaze, proxyFactory, wires);
- } else {
- return null;
- }
- }
-
- /**
- * Public constructor for Externalizable serialization/deserialization.
- */
- public CallbackReferenceImpl() {
- super();
- }
-
- private CallbackReferenceImpl(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
- super(interfaze, null, proxyFactory);
- this.wires = wires;
- init();
- }
-
- public void init() {
- Message msgContext = ThreadMessageContext.getMessageContext();
- wire = selectCallbackWire(msgContext);
- if (wire == null) {
- //FIXME: need better exception
- throw new RuntimeException("No callback binding found for " + msgContext.getTo().getURI());
- }
- resolvedEndpoint = getCallbackEndpoint(msgContext);
- convID = msgContext.getFrom().getReferenceParameters().getConversationID();
- callbackID = msgContext.getFrom().getReferenceParameters().getCallbackID();
- }
-
- @Override
- protected Object createProxy() throws Exception {
- return proxyFactory.createCallbackProxy(this);
- }
-
- protected RuntimeWire getCallbackWire() {
- if (resolvedEndpoint == null) {
- return null;
- } else {
- return cloneAndBind(wire);
- }
- }
-
- protected Object getConvID() {
- return convID;
- }
-
- protected EndpointReference getResolvedEndpoint() {
- return resolvedEndpoint;
- }
-
- private RuntimeWire selectCallbackWire(Message msgContext) {
- // look for callback binding with same name as service binding
- EndpointReference to = msgContext.getTo();
- if (to == null) {
- //FIXME: need better exception
- throw new RuntimeException("Destination for forward call is not available");
- }
- for (RuntimeWire wire : wires) {
- if (wire.getSource().getBinding().getName().equals(to.getBinding().getName())) {
- return wire;
- }
- }
-
- // if no match, look for callback binding with same type as service binding
- for (RuntimeWire wire : wires) {
- if (wire.getSource().getBinding().getClass() == to.getBinding().getClass()) {
- return wire;
- }
- }
-
- // no suitable callback wire was found
- return null;
- }
-
- /**
- * @param msgContext
- */
- private static EndpointReference getCallbackEndpoint(Message msgContext) {
- EndpointReference from = msgContext.getFrom();
- if (from == null) {
- return null;
- }
- return from.getReferenceParameters().getCallbackReference();
- }
-
- private RuntimeWire cloneAndBind(RuntimeWire wire) {
- RuntimeWire boundWire = null;
- if (resolvedEndpoint != null) {
- boundWire = ((RuntimeWireImpl)wire).lookupCache(resolvedEndpoint);
- if (boundWire != null) {
- return boundWire;
- }
- try {
- Contract contract = resolvedEndpoint.getContract();
- RuntimeComponentReference ref = null;
- if (contract == null) {
- boundWire = (RuntimeWire)wire.clone();
-
- } else if (contract instanceof RuntimeComponentReference) {
- ref = (RuntimeComponentReference)contract;
- boundWire = ref.getRuntimeWire(resolvedEndpoint.getBinding());
-
- } else { // contract instanceof RuntimeComponentService
- ref = bind((RuntimeComponentReference)wire.getSource().getContract(),
- resolvedEndpoint.getComponent(),
- (RuntimeComponentService)contract);
- boundWire = ref.getRuntimeWires().get(0);
- }
- configureWire(boundWire);
- ((RuntimeWireImpl)wire).addToCache(resolvedEndpoint, boundWire);
- } catch (CloneNotSupportedException e) {
- // will not happen
- }
- }
- return boundWire;
- }
-
- private static RuntimeComponentReference bind(RuntimeComponentReference reference,
- RuntimeComponent component,
- RuntimeComponentService service) throws CloneNotSupportedException {
- RuntimeComponentReference ref = (RuntimeComponentReference)reference.clone();
- ref.getTargets().add(service);
- ref.getBindings().clear();
- for (Binding binding : service.getBindings()) {
- if (binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)((OptimizableBinding)binding).clone();
- optimizableBinding.setTargetBinding(binding);
- optimizableBinding.setTargetComponent(component);
- optimizableBinding.setTargetComponentService(service);
- ref.getBindings().add(optimizableBinding);
- } else {
- ref.getBindings().add(binding);
- }
- }
- return ref;
- }
-
- private void configureWire(RuntimeWire wire) {
- // need to set the endpoint on the binding also so that when the chains are created next
- // the sca binding can decide whether to provide local or remote invokers.
- // TODO - there is a problem here though in that I'm setting a target on a
- // binding that may possibly be trying to point at two things in the multi threaded
- // case. Need to confirm the general model here and how the clone and bind part
- // is intended to work
- Binding binding = wire.getSource().getBinding();
- binding.setURI(resolvedEndpoint.getURI());
-
- // also need to set the target contract as it varies for the sca binding depending on
- // whether it is local or remote
- RuntimeComponentReference ref = (RuntimeComponentReference)wire.getSource().getContract();
- wire.getTarget().setInterfaceContract(ref.getBindingProvider(binding).getBindingInterfaceContract());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
- this.callbackID = in.readObject();
- this.convID = in.readObject();
-
- this.compositeActivator = ComponentContextHelper.getCurrentCompositeActivator();
-
- // Get the target Component and Service from the URI
- final String uri = in.readUTF();
- final Component targetComponent = super.resolveComponentURI(uri);
- final ComponentService targetService = super.resolveServiceURI(uri, targetComponent);
- final InterfaceContract targetServiceIfaceContract = targetService.getInterfaceContract();
-
- // Re-create the resolved Endpoint
- this.resolvedEndpoint = new EndpointReferenceImpl(
- (RuntimeComponent) targetComponent, targetService, null,
- targetServiceIfaceContract);
-
- // Copy the Java Interface from the Service
- final JavaInterface ji = (JavaInterface) targetServiceIfaceContract.getInterface();
- this.businessInterface = (Class<B>) ji.getJavaClass();
-
- // We need to re-create the callback wire. We need to do this on a clone of the Service
- // wire since we need to change some details on it.
- // FIXME: Is this the best way to do this?
- final RuntimeWire cbWire = ((RuntimeComponentService) targetService).getRuntimeWires().get(0);
- try {
- this.wire = (RuntimeWireImpl) cbWire.clone();
- } catch (CloneNotSupportedException e) {
- throw new IOException(e.toString());
- }
-
- // Setup the reference on the cloned wire
- final RuntimeComponentReference ref = new RuntimeComponentReferenceImpl();
- ref.setComponent((RuntimeComponent) targetComponent);
- ref.setInterfaceContract(targetServiceIfaceContract);
- ((EndpointReferenceImpl) this.wire.getSource()).setContract(ref);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
- out.writeObject(this.callbackID);
- out.writeObject(this.convID);
- out.writeUTF(this.resolvedEndpoint.getURI());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
deleted file mode 100644
index b5b40811ad..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackReferenceObjectFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-
-/**
- * Uses a wire to return a CallableReference
- *
- * @version $Rev: 574648 $ $Date: 2007-09-11 18:45:36 +0100 (Tue, 11 Sep 2007) $
- */
-public class CallbackReferenceObjectFactory implements ObjectFactory<CallableReference<?>> {
- private Class<?> businessInterface;
- private ProxyFactory proxyFactory;
- private List<RuntimeWire> wires;
-
- public CallbackReferenceObjectFactory(Class<?> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
- this.businessInterface = interfaze;
- this.proxyFactory = proxyFactory;
- this.wires = wires;
- }
-
- public CallableReference<?> getInstance() throws ObjectCreationException {
- return CallbackReferenceImpl.newInstance(businessInterface, proxyFactory, wires);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
deleted file mode 100644
index 2b37c30451..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Returns proxy instance for a wire callback
- *
- * @version $Rev$ $Date$
- */
-public class CallbackWireObjectFactory<B> implements ObjectFactory<B> {
- private Class<B> businessInterface;
- private ProxyFactory proxyFactory;
- private List<RuntimeWire> wires;
-
- public CallbackWireObjectFactory(Class<B> interfaze, ProxyFactory proxyFactory, List<RuntimeWire> wires) {
- this.businessInterface = interfaze;
- this.proxyFactory = proxyFactory;
- this.wires = wires;
- }
-
- public B getInstance() throws ObjectCreationException {
- return proxyFactory.createCallbackProxy(businessInterface, wires);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java
deleted file mode 100644
index 0b3c043340..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CglibProxyFactory.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.Factory;
-import net.sf.cglib.proxy.MethodInterceptor;
-import net.sf.cglib.proxy.MethodProxy;
-
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- * The implementation of a wire service that uses cglib dynamic proxies
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("unused")
-public class CglibProxyFactory implements ProxyFactory {
- private MessageFactory messageFactory;
-
- public CglibProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
- this.messageFactory = messageFactory;
-
- }
-
- public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
- ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
- return createProxy(serviceReference);
- }
-
- private class CglibClassLoader extends ClassLoader {
- private ClassLoader appLoader;
- private ClassLoader bundleLoader;
-
- @Override
- public Class<?> loadClass(String className)
- throws ClassNotFoundException {
- try {
- return appLoader.loadClass(className);
- } catch (ClassNotFoundException ex ) {
- return bundleLoader.loadClass(className);
- }
- }
-
- CglibClassLoader(ClassLoader app, ClassLoader bundle) {
- this.appLoader = app;
- this.bundleLoader = bundle;
- }
- }
- /**
- * create the proxy with cglib. use the same JDKInvocationHandler as
- * JDKProxyService.
- */
- public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
- Enhancer enhancer = new Enhancer();
- Class<T> interfaze = callableReference.getBusinessInterface();
- ClassLoader cl = new CglibClassLoader(interfaze.getClassLoader(), getClass().getClassLoader());
- enhancer.setClassLoader(cl);
- enhancer.setSuperclass(interfaze);
- enhancer.setCallback(new CglibMethodInterceptor<T>(callableReference));
- Object proxy = enhancer.create();
- ((CallableReferenceImpl)callableReference).setProxy(proxy);
- return interfaze.cast(proxy);
- }
-
- /**
- * create the callback proxy with cglib. use the same
- * JDKCallbackInvocationHandler as JDKProxyService.
- */
- public <T> T createCallbackProxy(Class<T> interfaze, final List<RuntimeWire> wires) throws ProxyCreationException {
- CallbackReferenceImpl<T> callbackReference = CallbackReferenceImpl.newInstance(interfaze, this, wires);
- return callbackReference != null ? createCallbackProxy(callbackReference) : null;
- }
-
- /**
- * create the callback proxy with cglib. use the same
- * JDKCallbackInvocationHandler as JDKProxyService.
- */
- public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
- Enhancer enhancer = new Enhancer();
- Class<T> interfaze = callbackReference.getBusinessInterface();
- enhancer.setSuperclass(interfaze);
- enhancer.setCallback(new CglibMethodInterceptor<T>(callbackReference));
- Object proxy = enhancer.create();
- callbackReference.setProxy(proxy);
- return interfaze.cast(proxy);
- }
-
- @SuppressWarnings("unchecked")
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- if (isProxyClass(target.getClass())) {
- Factory factory = (Factory)target;
- Callback[] callbacks = factory.getCallbacks();
- if (callbacks.length != 1 || !(callbacks[0] instanceof CglibMethodInterceptor)) {
- throw new IllegalArgumentException("The object is not a known proxy.");
- }
- CglibMethodInterceptor interceptor = (CglibMethodInterceptor)callbacks[0];
- return (R)interceptor.invocationHandler.getCallableReference();
- } else {
- throw new IllegalArgumentException("The object is not a known proxy.");
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
- */
- public boolean isProxyClass(Class<?> clazz) {
- return Factory.class.isAssignableFrom(clazz);
- }
-
- private class CglibMethodInterceptor<T> implements MethodInterceptor {
- private JDKInvocationHandler invocationHandler;
-
- public CglibMethodInterceptor(CallableReference<T> callableReference) {
- invocationHandler = new JDKInvocationHandler(messageFactory, callableReference);
- }
-
- public CglibMethodInterceptor(CallbackReferenceImpl<T> callbackReference) {
- invocationHandler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
- }
-
- /*
- public CglibMethodInterceptor(Class<T> interfaze, RuntimeWire wire) {
- ServiceReference<T> serviceRef = new ServiceReferenceImpl<T>(interfaze, wire, CglibProxyFactory.this);
- invocationHandler = new JDKInvocationHandler(messageFactory, serviceRef);
- }
-
- public CglibMethodInterceptor(Class<T> interfaze, List<RuntimeWire> wires) {
- CallbackReferenceImpl ref = new CallbackReferenceImpl(interfaze, CglibProxyFactory.this, wires);
- invocationHandler = new JDKCallbackInvocationHandler(messageFactory, ref);
- }
- */
-
- /**
- * @see net.sf.cglib.proxy.MethodInterceptor#intercept(java.lang.Object, java.lang.reflect.Method, java.lang.Object[], net.sf.cglib.proxy.MethodProxy)
- */
- public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable {
- Object result = invocationHandler.invoke(proxy, method, args);
- return result;
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.java
deleted file mode 100644
index 9acb4be6f8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/DefaultProxyFactoryExtensionPoint.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.core.invocation;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-
-/**
- * Default implementation of a ProxyFactoryExtensionPoint.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultProxyFactoryExtensionPoint implements ProxyFactoryExtensionPoint {
- private InterfaceContractMapper interfaceContractMapper;
- private MessageFactory messageFactory;
-
- private ProxyFactory interfaceFactory;
- private ProxyFactory classFactory;
-
- public DefaultProxyFactoryExtensionPoint(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.messageFactory = modelFactories.getFactory(MessageFactory.class);
-
- interfaceFactory = new JDKProxyFactory(messageFactory, interfaceContractMapper);
- }
-
- public DefaultProxyFactoryExtensionPoint(MessageFactory messageFactory, InterfaceContractMapper mapper) {
- this.interfaceContractMapper = mapper;
- this.messageFactory = messageFactory;
- interfaceFactory = new JDKProxyFactory(messageFactory, mapper);
- }
-
- public ProxyFactory getClassProxyFactory() {
- return classFactory;
- }
-
- public ProxyFactory getInterfaceProxyFactory() {
- return interfaceFactory;
- }
-
- public void setClassProxyFactory(ProxyFactory factory) {
- this.classFactory = factory;
-
- }
-
- public void setInterfaceProxyFactory(ProxyFactory factory) {
- this.interfaceFactory = factory;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java
deleted file mode 100644
index fcb48259b9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleProxyFactory.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-
-/**
- * An extensible proxy factory.
- *
- * @version $Rev: $ $Date: $
- */
-public class ExtensibleProxyFactory implements ProxyFactory {
-
- private ProxyFactoryExtensionPoint proxyFactories;
-
- public ExtensibleProxyFactory(ProxyFactoryExtensionPoint proxyFactories) {
- this.proxyFactories = proxyFactories;
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#cast(java.lang.Object)
- */
- @SuppressWarnings("unchecked")
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- if (interfaceFactory.isProxyClass(target.getClass())) {
- return (R)interfaceFactory.cast(target);
- } else if (classFactory != null && classFactory.isProxyClass(target.getClass())) {
- return (R)classFactory.cast(target);
- } else {
- throw new IllegalArgumentException("The target is not a callable proxy");
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createCallbackProxy(java.lang.Class,
- * java.util.List)
- */
- public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- if (interfaze.isInterface()) {
- return interfaceFactory.createCallbackProxy(interfaze, wires);
- } else {
- return classFactory.createCallbackProxy(interfaze, wires);
- }
- }
-
- public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- if (callableReference.getBusinessInterface().isInterface()) {
- return interfaceFactory.createProxy(callableReference);
- } else {
- return classFactory.createProxy(callableReference);
- }
- }
-
- public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- if (callbackReference.getBusinessInterface().isInterface()) {
- return interfaceFactory.createCallbackProxy(callbackReference);
- } else {
- return classFactory.createCallbackProxy(callbackReference);
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#createProxy(java.lang.Class,
- * org.apache.tuscany.sca.runtime.RuntimeWire)
- */
- public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- if (interfaze.isInterface()) {
- return interfaceFactory.createProxy(interfaze, wire);
- } else {
- return classFactory.createProxy(interfaze, wire);
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
- */
- public boolean isProxyClass(Class<?> clazz) {
- ProxyFactory interfaceFactory = proxyFactories.getInterfaceProxyFactory();
- ProxyFactory classFactory = proxyFactories.getClassProxyFactory();
- return interfaceFactory.isProxyClass(clazz) || (classFactory != null && classFactory.isProxyClass(clazz));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.java
deleted file mode 100644
index 934f2f7aa0..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ExtensibleWireProcessor.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.core.invocation;
-
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
-
-/**
- * The default implementation of an extensible <code>WireProcessor</code>
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleWireProcessor implements RuntimeWireProcessor {
-
- private RuntimeWireProcessorExtensionPoint processors;
-
- public ExtensibleWireProcessor(RuntimeWireProcessorExtensionPoint processors) {
- this.processors = processors;
- }
-
- public void process(RuntimeWire wire) {
- for (RuntimeWireProcessor processor : processors.getWireProcessors()) {
- processor.process(wire);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
deleted file mode 100644
index c559a42bdc..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/InvocationChainImpl.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Phase;
-
-/**
- * Default implementation of an invocation chain
- *
- * @version $Rev$ $Date$
- */
-public class InvocationChainImpl implements InvocationChain {
- private Operation sourceOperation;
- private Operation targetOperation;
- private List<Node> nodes = new ArrayList<Node>();
-
- // FIXME: Not a good practice to use static reference
- private static final PhaseManager phaseManager = new PhaseManager();
- private boolean forReference;
- private boolean allowsPassByReference;
-
- public InvocationChainImpl(Operation sourceOperation, Operation targetOperation, boolean forReference) {
- // TODO - binding invocation chain doesn't provide operations
- //assert sourceOperation != null;
- //assert targetOperation != null;
- this.targetOperation = targetOperation;
- this.sourceOperation = sourceOperation;
- this.forReference = forReference;
- }
-
- public Operation getTargetOperation() {
- return targetOperation;
- }
-
- public void setTargetOperation(Operation operation) {
- this.targetOperation = operation;
- }
-
- public void addInterceptor(Interceptor interceptor) {
- String phase = forReference ? Phase.REFERENCE : Phase.SERVICE;
- addInterceptor(phase, interceptor);
- }
-
- public void addInvoker(Invoker invoker) {
- String phase = forReference ? Phase.REFERENCE_BINDING : Phase.IMPLEMENTATION;
- addInvoker(phase, invoker);
- }
-
- public Invoker getHeadInvoker() {
- return nodes.isEmpty() ? null : nodes.get(0).getInvoker();
- }
-
- public Invoker getTailInvoker() {
- return nodes.isEmpty() ? null : nodes.get(nodes.size() - 1).getInvoker();
- }
-
- /**
- * @return the sourceOperation
- */
- public Operation getSourceOperation() {
- return sourceOperation;
- }
-
- /**
- * @param sourceOperation the sourceOperation to set
- */
- public void setSourceOperation(Operation sourceOperation) {
- this.sourceOperation = sourceOperation;
- }
-
- public void addInterceptor(int index, Interceptor interceptor) {
- addInterceptor(interceptor);
- }
-
- public void addInterceptor(String phase, Interceptor interceptor) {
- addInvoker(phase, interceptor);
- }
-
- private void addInvoker(String phase, Invoker invoker) {
- int index = phaseManager.getAllPhases().indexOf(phase);
- if (index == -1) {
- throw new IllegalArgumentException("Invalid phase name: " + phase);
- }
- Node node = new Node(index, invoker);
- ListIterator<Node> li = nodes.listIterator();
- Node before = null, after = null;
- boolean found = false;
- while (li.hasNext()) {
- before = after;
- after = li.next();
- if (after.getPhaseIndex() > index) {
- // Move back
- li.previous();
- li.add(node);
- found = true;
- break;
- }
- }
- if (!found) {
- // Add to the end
- nodes.add(node);
- before = after;
- after = null;
- }
-
- // Relink the interceptors
- if (before != null) {
- if (before.getInvoker() instanceof Interceptor) {
- ((Interceptor)before.getInvoker()).setNext(invoker);
- }
- }
- if (after != null) {
- if (invoker instanceof Interceptor) {
- ((Interceptor)invoker).setNext(after.getInvoker());
- }
- }
-
- }
-
- public boolean allowsPassByReference() {
- if (allowsPassByReference) {
- // No need to check the invokers
- return true;
- }
- // Check if any of the invokers allows pass-by-reference
- boolean allowsPBR = false;
- for (Node i : nodes) {
- if (i.getInvoker() instanceof DataExchangeSemantics) {
- if (((DataExchangeSemantics)i.getInvoker()).allowsPassByReference()) {
- allowsPBR = true;
- break;
- }
- }
- }
- return allowsPBR;
- }
-
- public void setAllowsPassByReference(boolean allowsPBR) {
- this.allowsPassByReference = allowsPBR;
- }
-
- private static class Node {
- private int phaseIndex;
- private Invoker invoker;
-
- public Node(int phaseIndex, Invoker invoker) {
- super();
- this.phaseIndex = phaseIndex;
- this.invoker = invoker;
- }
-
- public int getPhaseIndex() {
- return phaseIndex;
- }
-
- public Invoker getInvoker() {
- return invoker;
- }
-
- @Override
- public String toString() {
- return "(" + phaseIndex + ")" + invoker;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
deleted file mode 100644
index cade0499d3..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.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.core.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.conversation.ConversationState;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.NoRegisteredCallbackException;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Responsible for dispatching to a callback through a wire. <p/> TODO cache
- * target invoker
- *
- * @version $Rev$ $Date$
- */
-public class JDKCallbackInvocationHandler extends JDKInvocationHandler {
- private static final long serialVersionUID = -3350283555825935609L;
-
- public JDKCallbackInvocationHandler(MessageFactory messageFactory, CallbackReferenceImpl ref) {
- super(messageFactory, ref);
- this.fixedWire = false;
- }
-
- @Override
- @SuppressWarnings( {"unchecked"})
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (Object.class == method.getDeclaringClass()) {
- return invokeObjectMethod(method, args);
- }
-
- // obtain a dedicated wire to be used for this callback invocation
- RuntimeWire wire = ((CallbackReferenceImpl)callableReference).getCallbackWire();
- if (wire == null) {
- //FIXME: need better exception
- throw new ServiceRuntimeException("No callback wire found");
- }
-
- // set the conversational state based on the interface that
- // is specified for the reference that this wire belongs to
- initConversational(wire);
-
- // set the conversation id into the conversation object. This is
- // a special case for callbacks as, unless otherwise set manually,
- // the callback should use the same conversation id as was received
- // on the incoming call to this component
- if (conversational) {
-
- if (conversation == null || conversation.getState() == ConversationState.ENDED) {
- conversation = null;
- }
- Object convID = conversation == null ? null : conversation.getConversationID();
-
- // create a conversation id if one doesn't exist
- // already, i.e. the conversation is just starting
- if (convID == null) {
- convID = ((CallbackReferenceImpl)callableReference).getConvID();
- if (convID != null) {
- conversation = ((RuntimeWireImpl)wire).getConversationManager().getConversation(convID);
- if (callableReference != null) {
- ((CallableReferenceImpl)callableReference).attachConversation(conversation);
- }
- }
- }
- }
-
- setEndpoint(((CallbackReferenceImpl)callableReference).getResolvedEndpoint());
-
- InvocationChain chain = getInvocationChain(method, wire);
- if (chain == null) {
- throw new IllegalArgumentException("No matching operation is found: " + method);
- }
-
- try {
- return invoke(chain, args, wire, wire.getSource());
- } catch (InvocationTargetException e) {
- Throwable t = e.getCause();
- if (t instanceof NoRegisteredCallbackException) {
- throw t;
- }
- throw e;
- } finally {
- // allow the cloned wire to be reused by subsequent callbacks
- ((RuntimeWireImpl)wire).releaseWire();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
deleted file mode 100644
index bb9595bf9c..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
+++ /dev/null
@@ -1,610 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.ws.Holder;
-
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.RuntimeWireImpl;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ComponentContextImpl;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.conversation.ConversationState;
-import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ConversationEndedException;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JDKInvocationHandler implements InvocationHandler, Serializable {
- private static final long serialVersionUID = -3366410500152201371L;
-
- protected boolean conversational;
- protected ExtendedConversation conversation;
- protected MessageFactory messageFactory;
- protected EndpointReference source;
- protected EndpointReference target;
- protected RuntimeWire wire;
- protected CallableReference<?> callableReference;
- protected Class<?> businessInterface;
-
- protected boolean fixedWire = true;
-
- protected transient Map<Method, InvocationChain> chains = new HashMap<Method, InvocationChain>();
-
- public JDKInvocationHandler(MessageFactory messageFactory, Class<?> businessInterface, RuntimeWire wire) {
- this.messageFactory = messageFactory;
- this.wire = wire;
- this.businessInterface = businessInterface;
- init(this.wire);
- }
-
- public JDKInvocationHandler(MessageFactory messageFactory, CallableReference<?> callableReference) {
- this.messageFactory = messageFactory;
- this.callableReference = callableReference;
- if (callableReference != null) {
- this.businessInterface = callableReference.getBusinessInterface();
- this.conversation = (ExtendedConversation)callableReference.getConversation();
- this.wire = ((CallableReferenceImpl<?>)callableReference).getRuntimeWire();
-
- /* ==========================================================================*/
- // TUSCANY-3140 - in some cases we have noticed that the runtime engine for a
- // component implementation uses a different classloader compared
- // to the classloader used in the first instance to introspect the
- // component type and create the component model. If the business
- // interface of the callable reference is different from the
- // interface of the reference then set the reference interface to the
- // business interface
- if (wire != null){
- Interface iface = wire.getSource().getInterfaceContract().getInterface();
- if (iface instanceof JavaInterface) {
- JavaInterface javaIFace = (JavaInterface)iface;
- // only reset the interface if the classes have the same name but the
- // class object is different
- if ((javaIFace.getJavaClass().getName().equals(this.businessInterface.getName())) &&
- (javaIFace.getJavaClass() != this.businessInterface)) {
- try {
- RuntimeComponent wireSourceComponent = wire.getSource().getComponent();
- CompositeActivator compositeActivator = ((ComponentContextImpl)wireSourceComponent.getComponentContext()).getCompositeActivator();
- if (compositeActivator != null && compositeActivator.getJavaInterfaceFactory() != null) {
- //reconstruct java interface using interface loaded by implementation class loader
- iface.getOperations().clear();
- compositeActivator.getJavaInterfaceFactory().createJavaInterface((JavaInterface) iface, this.businessInterface);
- }
- } catch (InvalidInterfaceException e) {
- e.printStackTrace();
- }
- }
- }
- }
- /* ==========================================================================*/
-
- if (wire != null) {
- init(wire);
- }
- }
- }
-
- protected void init(RuntimeWire wire) {
- if (wire != null) {
- try {
- // Clone the endpoint reference so that reference parameters can be changed
- source = (EndpointReference)wire.getSource().clone();
- } catch (CloneNotSupportedException e) {
- throw new ServiceRuntimeException(e);
- }
- initConversational(wire);
- }
- }
-
- protected void initConversational(RuntimeWire wire) {
- InterfaceContract contract = wire.getSource().getInterfaceContract();
- this.conversational = contract.getInterface().isConversational();
- }
-
- protected Object getCallbackID() {
- if (callableReference != null) {
- return callableReference.getCallbackID();
- } else {
- return null;
- }
- }
-
- protected Object getConversationID() {
- if (callableReference != null && callableReference instanceof ServiceReference) {
- return ((ServiceReference)callableReference).getConversationID();
- } else {
- return null;
- }
- }
-
- protected Object getCallbackObject() {
- if (callableReference != null && callableReference instanceof ServiceReference) {
- return ((ServiceReference)callableReference).getCallback();
- } else {
- return null;
- }
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
- if (Object.class == method.getDeclaringClass()) {
- return invokeObjectMethod(method, args);
- }
- if (wire == null) {
- throw new ServiceRuntimeException("No runtime wire is available");
- }
- InvocationChain chain = getInvocationChain(method, wire);
- if (chain == null) {
- throw new IllegalArgumentException("No matching operation is found: " + method);
- }
-
- Object result = invoke(chain, args, wire, source);
-
- Operation operation = chain.getSourceOperation();
- if (operation != null && operation.getInterface().isRemotable()) {
- List<DataType> inputTypes = operation.getInputType().getLogical();
- // Returned Holder data <T> are placed back in Holder<T>.
- for (int i = 0, size = inputTypes.size(); i < size; i++) {
- if (operation.getParameterModes().get(i) != ParameterMode.IN) {
- // Pop results and place in holder (demote).
- Holder holder = (Holder)args[i];
- holder.value = result;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Handle the methods on the Object.class
- * @param method
- * @param args
- */
- protected Object invokeObjectMethod(Method method, Object[] args) throws Throwable {
- String name = method.getName();
- if ("toString".equals(name)) {
- return "[Proxy - " + toString() + "]";
- } else if ("equals".equals(name)) {
- Object obj = args[0];
- if (obj == null) {
- return false;
- }
- if (!Proxy.isProxyClass(obj.getClass())) {
- return false;
- }
- return equals(Proxy.getInvocationHandler(obj));
- } else if ("hashCode".equals(name)) {
- return hashCode();
- } else {
- return method.invoke(this);
- }
- }
-
- /**
- * Determines if the given operation matches the given method
- *
- * @return true if the operation matches, false if does not
- */
- // FIXME: Should it be in the InterfaceContractMapper?
- @SuppressWarnings("unchecked")
- private static boolean match(Operation operation, Method method) {
- if (operation instanceof JavaOperation) {
- JavaOperation javaOp = (JavaOperation)operation;
- Method m = javaOp.getJavaMethod();
- if (!method.getName().equals(m.getName())) {
- return false;
- }
- if (method.equals(m)) {
- return true;
- }
- } else {
- if (!method.getName().equals(operation.getName())) {
- return false;
- }
- }
-
- // For remotable interface, operation is not overloaded.
- if (operation.getInterface().isRemotable()) {
- return true;
- }
-
- Class<?>[] params = method.getParameterTypes();
-
- DataType<List<DataType>> inputType = null;
- if (operation.isInputWrapperStyle()) {
- inputType = operation.getInputWrapper().getUnwrappedInputType();
- } else {
- inputType = operation.getInputType();
- }
- List<DataType> types = inputType.getLogical();
- boolean matched = true;
- if (types.size() == params.length && method.getName().equals(operation.getName())) {
- for (int i = 0; i < params.length; i++) {
- Class<?> clazz = params[i];
- Class<?> type = types.get(i).getPhysical();
- // Object.class.isAssignableFrom(int.class) returns false
- if (type != Object.class && (!type.isAssignableFrom(clazz))) {
- matched = false;
- }
- }
- } else {
- matched = false;
- }
- return matched;
-
- }
-
- protected synchronized InvocationChain getInvocationChain(Method method, RuntimeWire wire) {
- if (fixedWire && chains.containsKey(method)) {
- return chains.get(method);
- }
- InvocationChain found = null;
- for (InvocationChain chain : wire.getInvocationChains()) {
- Operation operation = chain.getSourceOperation();
- if (operation.isDynamic()) {
- operation.setName(method.getName());
- found = chain;
- break;
- } else if (match(operation, method)) {
- found = chain;
- break;
- }
- }
- if (fixedWire) {
- chains.put(method, found);
- }
- return found;
- }
-
- protected void setEndpoint(EndpointReference endpoint) {
- this.target = endpoint;
- }
-
- protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire, EndpointReference source)
- throws Throwable {
- Message msg = messageFactory.createMessage();
- msg.setFrom(source);
- if (target != null) {
- msg.setTo(target);
- } else {
- msg.setTo(wire.getTarget());
- }
- Invoker headInvoker = chain.getHeadInvoker();
- Operation operation = chain.getTargetOperation();
-
- msg.setOperation(operation);
-
- // Holder pattern. Items stored in a Holder<T> are promoted to T.
- // After the invoke, the returned data <T> are placed back in Holder<T>.
- if (operation != null && operation.getInterface().isRemotable()) {
- args = promoteHolderArgs(chain.getSourceOperation(), args);
- }
- msg.setBody(args);
-
- Message msgContext = ThreadMessageContext.getMessageContext();
- Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
-
- conversationPreinvoke(msg, wire);
- handleCallback(msg, wire, currentConversationID);
- ThreadMessageContext.setMessageContext(msg);
- boolean abnormalEndConversation = false;
- try {
- // dispatch the wire down the chain and get the response
- Message resp = headInvoker.invoke(msg);
- Object body = resp.getBody();
- if (resp.isFault()) {
- // mark the conversation as ended if the exception is not a business exception
- if (currentConversationID != null) {
- try {
- boolean businessException = false;
-
- for (DataType dataType : operation.getFaultTypes()) {
- if (dataType.getPhysical() == ((Throwable)body).getClass()) {
- businessException = true;
- break;
- }
- }
-
- if (businessException == false) {
- abnormalEndConversation = true;
- }
- } catch (Exception ex) {
- // TODO - sure what the best course of action is here. We have
- // a system exception in the middle of a business exception
- }
- }
- throw (Throwable)body;
- }
- return body;
- } finally {
- conversationPostInvoke(msg, wire, abnormalEndConversation);
- ThreadMessageContext.setMessageContext(msgContext);
- }
- }
-
- /**
- * @param msg
- * @param wire
- * @param interfaze
- * @throws TargetResolutionException
- */
- private void handleCallback(Message msg, RuntimeWire wire, Object currentConversationID)
- throws TargetResolutionException {
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
- parameters.setCallbackID(getCallbackID());
- if (msg.getFrom() == null || msg.getFrom().getCallbackEndpoint() == null) {
- return;
- }
-
- parameters.setCallbackReference(msg.getFrom().getCallbackEndpoint());
-
- // If we are passing out a callback target
- // register the calling component instance against this
- // new conversation id so that stateful callbacks will be
- // able to find it
- Object callbackObject = getCallbackObject();
- if (conversational && callbackObject == null) {
- // the component instance is already registered
- // so add another registration
- ScopeContainer<Object> scopeContainer = getConversationalScopeContainer(wire);
-
- if (scopeContainer != null && currentConversationID != null) {
- scopeContainer.addWrapperReference(currentConversationID, conversation.getConversationID());
- }
- }
-
- Interface interfaze = msg.getFrom().getCallbackEndpoint().getInterfaceContract().getInterface();
- if (callbackObject != null) {
- if (callbackObject instanceof ServiceReference) {
- EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
- parameters.setCallbackReference(callbackRef);
- } else {
- if (interfaze != null) {
- if (!interfaze.isConversational()) {
- throw new IllegalArgumentException(
- "Callback object for stateless callback is not a ServiceReference");
- } else {
- if (!(callbackObject instanceof Serializable)) {
- throw new IllegalArgumentException(
- "Callback object for stateful callback is not Serializable");
- }
- ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
- if (scopeContainer != null) {
- InstanceWrapper wrapper = new CallbackObjectWrapper(callbackObject);
- scopeContainer.registerWrapper(wrapper, conversation.getConversationID());
- }
- parameters.setCallbackObjectID(callbackObject);
- }
- }
- }
- }
- }
-
- /**
- * Pre-invoke for the conversation handling
- * @param msg
- * @throws TargetResolutionException
- */
- private void conversationPreinvoke(Message msg, RuntimeWire wire) {
- if (!conversational) {
- // Not conversational or the conversation has been started
- return;
- }
-
- ConversationManager conversationManager = ((RuntimeWireImpl)wire).getConversationManager();
-
- if (conversation == null || conversation.getState() == ConversationState.ENDED) {
-
- conversation = conversationManager.startConversation(getConversationID());
-
- // if this is a local wire then set up the conversation timeouts here based on the
- // parameters from the component
- if (wire.getTarget().getComponent() != null) {
- conversation.initializeConversationAttributes(wire.getTarget().getComponent());
- }
-
- // connect the conversation to the CallableReference so it can be retrieve in the future
- if (callableReference != null) {
- ((CallableReferenceImpl)callableReference).attachConversation(conversation);
- }
- } else if (conversation.isExpired()) {
- throw new ConversationEndedException("Conversation " + conversation.getConversationID() + " has expired.");
- }
-
- // if this is a local wire then schedule conversation timeouts based on the timeout
- // parameters from the service implementation. If this isn't a local wire then
- // the RuntimeWireInvoker will take care of this
- if (wire.getTarget().getComponent() != null) {
- conversation.updateLastReferencedTime();
- }
-
- msg.getFrom().getReferenceParameters().setConversationID(conversation.getConversationID());
-
- }
-
- /**
- * Post-invoke for the conversation handling
- * @param wire
- * @param operation
- * @throws TargetDestructionException
- */
- @SuppressWarnings("unchecked")
- private void conversationPostInvoke(Message msg, RuntimeWire wire, boolean abnormalEndConversation)
- throws TargetDestructionException {
- Operation operation = msg.getOperation();
- ConversationSequence sequence = operation.getConversationSequence();
- // We check that conversation has not already ended as there is only one
- // conversation manager in the runtime and so, in the case of remote bindings,
- // the conversation will already have been stopped when we get back to the client
- if ((sequence == ConversationSequence.CONVERSATION_END || abnormalEndConversation) && (conversation.getState() != ConversationState.ENDED)) {
-
- // remove conversation id from scope container
- ScopeContainer scopeContainer = getConversationalScopeContainer(wire);
-
- if (scopeContainer != null) {
- scopeContainer.remove(conversation.getConversationID());
- }
-
- conversation.end();
- }
- }
-
- private ScopeContainer<Object> getConversationalScopeContainer(RuntimeWire wire) {
- ScopeContainer<Object> scopeContainer = null;
-
- RuntimeComponent runtimeComponent = wire.getSource().getComponent();
-
- if (runtimeComponent instanceof ScopedRuntimeComponent) {
- ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)runtimeComponent;
- ScopeContainer<Object> tmpScopeContainer = scopedRuntimeComponent.getScopeContainer();
-
- if ((tmpScopeContainer != null) && (tmpScopeContainer.getScope() == Scope.CONVERSATION)) {
- scopeContainer = tmpScopeContainer;
- }
- }
-
- return scopeContainer;
- }
-
- /**
- * Creates a new conversation id
- *
- * @return the conversation id
- */
- private Object createConversationID() {
- if (getConversationID() != null) {
- return getConversationID();
- } else {
- return UUID.randomUUID().toString();
- }
- }
-
- /**
- * @return the callableReference
- */
- public CallableReference<?> getCallableReference() {
- return callableReference;
- }
-
- /**
- * @param callableReference the callableReference to set
- */
- public void setCallableReference(CallableReference<?> callableReference) {
- this.callableReference = callableReference;
- }
-
- /**
- * Minimal wrapper for a callback object contained in a ServiceReference
- */
- private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
-
- private T instance;
-
- private CallbackObjectWrapper(T instance) {
- this.instance = instance;
- }
-
- public T getInstance() {
- return instance;
- }
-
- public void start() {
- // do nothing
- }
-
- public void stop() {
- // do nothing
- }
-
- }
-
- /**
- * Creates a copy of arguments. Holder<T> values are promoted to T.
- * Note. It is essential that arg Holders not be destroyed here.
- * PromotedArgs should not destroy holders. They are used on response return.
- * @param args containing Holders and other objects.
- * @return Object []
- */
- protected static Object[] promoteHolderArgs(Operation operation, Object[] args) {
- if (args == null)
- return args;
-
- Object[] promotedArgs = new Object[args.length];
- List<ParameterMode> modes = operation.getParameterModes();
- for (int i = 0; i < args.length; i++) {
- Object argument = args[i];
- if (argument != null) {
- if (modes.get(i) != ParameterMode.IN) {
- promotedArgs[i] = ((Holder)argument).value;
- } else {
- promotedArgs[i] = args[i];
- }
-
- }
- }
- return promotedArgs;
- }
-
- /**
- * Given an Object, tells if it is a Holder by comparing to "javax.xml.ws.Holder"
- * @param testClass
- * @return boolean stating whether Object is a Holder type.
- */
- protected static boolean isHolder(Object object) {
- return Holder.class.isInstance(object);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.java
deleted file mode 100644
index a2cbd1365b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKProxyFactory.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.core.invocation;
-
-import java.lang.reflect.InvocationHandler;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List;
-import java.util.HashMap;
-
-import org.apache.tuscany.sca.core.invocation.SCAProxy;
-import org.apache.tuscany.sca.core.context.CallableReferenceImpl;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- * the default implementation of a wire service that uses JDK dynamic proxies
- *
- * @version $Rev$ $Date$
- */
-public class JDKProxyFactory implements ProxyFactory {
- protected InterfaceContractMapper contractMapper;
- private MessageFactory messageFactory;
-
- public JDKProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper) {
- this.contractMapper = mapper;
- this.messageFactory = messageFactory;
- }
-
- /**
- * The original createProxy method assumes that the proxy doesn't want to
- * share conversation state so sets the conversation object to null
- */
- public <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException {
- ServiceReference<T> serviceReference = new ServiceReferenceImpl(interfaze, wire, this);
- return createProxy(serviceReference);
- }
-
- public <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException {
- assert callableReference != null;
- final Class<T> interfaze = callableReference.getBusinessInterface();
- InvocationHandler handler = new JDKInvocationHandler(messageFactory, callableReference);
- // Allow privileged access to class loader. Requires RuntimePermission in security policy.
- ClassLoader cl = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return interfaze.getClassLoader();
- }
- });
- Object proxy = SCAProxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
- ((CallableReferenceImpl)callableReference).setProxy(proxy);
- return interfaze.cast(proxy);
- }
-
- public <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException {
- CallbackReferenceImpl<T> callbackReference = CallbackReferenceImpl.newInstance(interfaze, this, wires);
- return callbackReference != null ? createCallbackProxy(callbackReference) : null;
- }
-
- public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException {
- assert callbackReference != null;
- Class<T> interfaze = callbackReference.getBusinessInterface();
- InvocationHandler handler = new JDKCallbackInvocationHandler(messageFactory, callbackReference);
- ClassLoader cl = interfaze.getClassLoader();
- Object proxy = SCAProxy.newProxyInstance(cl, new Class[] {interfaze}, handler);
- callbackReference.setProxy(proxy);
- return interfaze.cast(proxy);
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- InvocationHandler handler = SCAProxy.getInvocationHandler(target);
- if (handler instanceof JDKInvocationHandler) {
- return (R)((JDKInvocationHandler)handler).getCallableReference();
- } else {
- throw new IllegalArgumentException("The object is not a known proxy.");
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.invocation.ProxyFactory#isProxyClass(java.lang.Class)
- */
- public boolean isProxyClass(Class<?> clazz) {
- return SCAProxy.isProxyClass(clazz);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.java
deleted file mode 100644
index 6e182a6a14..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageFactoryImpl.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.core.invocation;
-
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-
-/**
- * Implementation of MessageFactory.
- *
- * @version $Rev$ $Date$
- */
-public class MessageFactoryImpl implements MessageFactory {
-
- public Message createMessage() {
- return new MessageImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
deleted file mode 100644
index ca2bf051c8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/MessageImpl.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-
-/**
- * The default implementation of a message flowed through a wire during an invocation
- *
- * @version $Rev $Date$
- */
-public class MessageImpl implements Message {
- private Object bindingContext;
- private List<Object> headers = new ArrayList<Object>();
- private Object body;
- private Object messageID;
- private boolean isFault;
- private Operation operation;
-
- private EndpointReference from;
- private EndpointReference to;
-
- public MessageImpl() {
- this.from = new EndpointReferenceImpl("/");
- this.to = new EndpointReferenceImpl("/");
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getBody() {
- return (T)body;
- }
-
- public <T> void setBody(T body) {
- this.isFault = false;
- this.body = body;
- }
-
- public Object getMessageID() {
- return messageID;
- }
-
- public void setMessageID(Object messageId) {
- this.messageID = messageId;
- }
-
- public boolean isFault() {
- return isFault;
- }
-
- public void setFaultBody(Object fault) {
- this.isFault = true;
- this.body = fault;
- }
-
- public EndpointReference getFrom() {
- return from;
- }
-
- public void setFrom(EndpointReference from) {
- this.from = from;
- }
-
- public EndpointReference getTo() {
- return to;
- }
-
- public void setTo(EndpointReference to) {
- this.to = to;
- }
-
- public Operation getOperation() {
- return operation;
- }
-
- public void setOperation(Operation op) {
- this.operation = op;
- }
-
- public List<Object> getHeaders() {
- return headers;
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getBindingContext() {
- return (T)bindingContext;
- }
-
- public <T> void setBindingContext(T bindingContext) {
- this.bindingContext = bindingContext;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.java
deleted file mode 100644
index 733544d387..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NoMethodForOperationException.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.core.invocation;
-
-
-/**
- * Thrown when an {@link org.apache.tuscany.sca.core.factory.model.Operation} cannot be mapped to a method on an interface
- * @version $Rev$ $Date$
- */
-public class NoMethodForOperationException extends ProxyCreationException {
- private static final long serialVersionUID = 5116536602309483679L;
-
- public NoMethodForOperationException() {
- }
-
- public NoMethodForOperationException(String message) {
- super(message);
- }
-
- public NoMethodForOperationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NoMethodForOperationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
deleted file mode 100644
index d6911281c8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/NonBlockingInterceptor.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Adds non-blocking behavior to an invocation chain
- *
- * @version $Rev$ $Date$
- */
-public class NonBlockingInterceptor implements Interceptor {
-
- private static final Message RESPONSE = new ImmutableMessage();
-
- /**
- * The JDK logger that will be used to log messages.
- */
- private static final Logger LOGGER = Logger.getLogger(NonBlockingInterceptor.class.getName());
-
- private WorkScheduler workScheduler;
- private Invoker next;
-
- public NonBlockingInterceptor(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- }
-
- public NonBlockingInterceptor(WorkScheduler workScheduler, Interceptor next) {
- this.workScheduler = workScheduler;
- this.next = next;
- }
-
- /**
- * Sets desired workScheduler to NonBlockingInterceptor. This is a useful function for the extension framework
- * to set desired workmanager on the InvocationChain, other than default workmanager which is set per Tuscany runtime.
- * Using this function, extension framework can set desired workmanager on InvocationChain during post wire processing.
- * @param workScheduler workScheduler which contains workmanager
- */
- public void setWorkScheduler(WorkScheduler workScheduler){
- this.workScheduler = workScheduler;
- }
-
- public Message invoke(final Message msg) {
- // Schedule the invocation of the next interceptor in a new Work instance
- try {
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- Message context = ThreadMessageContext.setMessageContext(msg);
- try {
- Message response = null;
-
- Throwable ex = null;
- try {
- response = next.invoke(msg);
- } catch (Throwable t) {
- ex = t;
- }
-
- // Tuscany-2225 - Did the @OneWay method complete successfully?
- // (i.e. no exceptions)
- if (response != null && response.isFault()) {
- // The @OneWay method threw an Exception. Lets log it and
- // then pass it on to the WorkScheduler so it can notify any
- // listeners
- ex = (Throwable)response.getBody();
- }
- if (ex != null) {
- LOGGER.log(Level.SEVERE, "Exception from @OneWay invocation", ex);
- throw new ServiceRuntimeException("Exception from @OneWay invocation", ex);
- }
- } finally {
- ThreadMessageContext.setMessageContext(context);
- }
- }
- });
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return RESPONSE;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- /**
- * A dummy message passed back on an invocation
- */
- private static class ImmutableMessage implements Message {
-
- @SuppressWarnings("unchecked")
- public Object getBody() {
- return null;
- }
-
- public void setBody(Object body) {
- if (body != null) {
- throw new UnsupportedOperationException();
- }
- }
-
- public void setCallbackWires(LinkedList<RuntimeWire> wires) {
-
- }
-
- public Object getMessageID() {
- return null;
- }
-
- public void setMessageID(Object messageId) {
- throw new UnsupportedOperationException();
- }
-
- public boolean isFault() {
- return false;
- }
-
- public void setFaultBody(Object fault) {
- throw new UnsupportedOperationException();
- }
-
- public EndpointReference getFrom() {
- return null;
- }
-
- public EndpointReference getTo() {
- return null;
- }
-
- public void setFrom(EndpointReference from) {
- throw new UnsupportedOperationException();
- }
-
- public void setTo(EndpointReference to) {
- throw new UnsupportedOperationException();
- }
-
- public Operation getOperation() {
- return null;
- }
-
- public void setOperation(Operation op) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
- */
- public EndpointReference getReplyTo() {
- return null;
- }
-
- public Map<String, Object> getQoSContext() {
- return null;
- }
-
- public List<Object> getHeaders() {
- return null;
- }
-
- public <T> T getBindingContext() {
- return null;
- }
-
- public <T> void setBindingContext(T bindingContext) {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
deleted file mode 100644
index a3c8429c7b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseManager.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION;
-import static org.apache.tuscany.sca.invocation.Phase.IMPLEMENTATION_POLICY;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_POLICY;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_TRANSPORT;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_BINDING_WIREFORMAT;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_INTERFACE;
-import static org.apache.tuscany.sca.invocation.Phase.REFERENCE_POLICY;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_BINDING;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_BINDING_OPERATION_SELECTOR;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_BINDING_POLICY;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_BINDING_TRANSPORT;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_BINDING_WIREFORMAT;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_INTERFACE;
-import static org.apache.tuscany.sca.invocation.Phase.SERVICE_POLICY;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PhaseManager {
- private static final Logger log = Logger.getLogger(PhaseManager.class.getName());
-
- public static final String STAGE_REFERENCE = "reference";
- public static final String STAGE_REFERENCE_BINDING = "reference.binding";
- public static final String STAGE_SERVICE_BINDING = "service.binding";
- public static final String STAGE_SERVICE = "service";
- public static final String STAGE_IMPLEMENTATION = "implementation";
-
- private static final String[] SYSTEM_REFERENCE_PHASES =
- {REFERENCE, REFERENCE_INTERFACE, REFERENCE_POLICY, REFERENCE_BINDING};
-
- private static final String[] SYSTEM_REFERENCE_BINDING_PHASES =
- {REFERENCE_BINDING_WIREFORMAT, REFERENCE_BINDING_POLICY, REFERENCE_BINDING_TRANSPORT};
-
- private static final String[] SYSTEM_SERVICE_BINDING_PHASES =
- {SERVICE_BINDING_TRANSPORT, SERVICE_BINDING_OPERATION_SELECTOR, SERVICE_BINDING_WIREFORMAT, SERVICE_BINDING_POLICY};
-
- private static final String[] SYSTEM_SERVICE_PHASES =
- {SERVICE_BINDING, SERVICE_POLICY, SERVICE_INTERFACE, SERVICE};
-
- private static final String[] SYSTEM_IMPLEMENTATION_PHASES = {IMPLEMENTATION_POLICY, IMPLEMENTATION};
-
- private String pattern = Phase.class.getName();
- private Map<String, Stage> stages;
- private List<String> phases;
-
- public class Stage {
- private String name;
- private PhaseSorter<String> sorter = new PhaseSorter<String>();
- private Set<String> firstSet = new HashSet<String>();
- private Set<String> lastSet = new HashSet<String>();
- private List<String> phases = new ArrayList<String>();
-
- public Stage(String name) {
- super();
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public PhaseSorter<String> getSorter() {
- return sorter;
- }
-
- public Set<String> getFirstSet() {
- return firstSet;
- }
-
- public Set<String> getLastSet() {
- return lastSet;
- }
-
- public List<String> getPhases() {
- return phases;
- }
-
- @Override
- public String toString() {
- return name + phases;
- }
- }
-
- // For unit test purpose
- PhaseManager(String pattern) {
- super();
- this.pattern = pattern;
- }
-
- public PhaseManager() {
- }
-
- private List<String> getPhases(String stage) {
- Stage s = getStages().get(stage);
- return s == null ? null : s.getPhases();
- }
-
- public List<String> getReferencePhases() {
- return getPhases(STAGE_REFERENCE);
- }
-
- public List<String> getServicePhases() {
- return getPhases(STAGE_SERVICE);
- }
-
- public List<String> getReferenceBindingPhases() {
- return getPhases(STAGE_REFERENCE_BINDING);
- }
-
- public List<String> getServiceBindingPhases() {
- return getPhases(STAGE_SERVICE_BINDING);
- }
-
- public List<String> getImplementationPhases() {
- return getPhases(STAGE_IMPLEMENTATION);
- }
-
- public synchronized List<String> getAllPhases() {
- if (phases == null) {
- phases = new ArrayList<String>();
- phases.addAll(getReferencePhases());
- phases.addAll(getReferenceBindingPhases());
- phases.addAll(getServiceBindingPhases());
- phases.addAll(getServicePhases());
- phases.addAll(getImplementationPhases());
- }
- return phases;
- }
-
- public synchronized Map<String, Stage> getStages() {
- if (stages != null) {
- return stages;
- }
- init();
-
- Set<ServiceDeclaration> services;
- try {
- services = ServiceDiscovery.getInstance().getServiceDeclarations(pattern);
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
-
- for (ServiceDeclaration d : services) {
- if (log.isLoggable(Level.FINE)) {
- log.fine(d.getLocation() + ": " + d.getAttributes());
- }
- String name = d.getAttributes().get("name");
- if (name == null) {
- throw new ServiceRuntimeException("Required attribute 'name' is missing.");
- }
- String stageName = d.getAttributes().get("stage");
- if (stageName == null) {
- throw new ServiceRuntimeException("Required attribute 'stage' is missing.");
- }
- Stage stage = stages.get(stageName);
- if (stage == null) {
- throw new ServiceRuntimeException("Invalid stage: " + stage);
- }
- PhaseSorter<String> graph = stage.getSorter();
- Set<String> firstSet = stage.getFirstSet(), lastSet = stage.getLastSet();
-
- String before = d.getAttributes().get("before");
- String after = d.getAttributes().get("after");
- if (before != null) {
- StringTokenizer tokenizer = new StringTokenizer(before);
- while (tokenizer.hasMoreTokens()) {
- String p = tokenizer.nextToken();
- if (!"*".equals(p)) {
- graph.addEdge(name, p);
- } else {
- firstSet.add(name);
- }
- }
- }
- if (after != null) {
- StringTokenizer tokenizer = new StringTokenizer(after);
- while (tokenizer.hasMoreTokens()) {
- String p = tokenizer.nextToken();
- if (!"*".equals(p)) {
- graph.addEdge(p, name);
- } else {
- lastSet.add(name);
- }
- }
- }
- graph.addVertext(name);
- if(firstSet.size()>1) {
- log.warning("More than one phases are declared to be first: "+firstSet);
- }
- for (String s : firstSet) {
- for (String v : new HashSet<String>(graph.getVertices().keySet())) {
- if (!firstSet.contains(v)) {
- graph.addEdge(s, v);
- }
- }
- }
- if(lastSet.size()>1) {
- log.warning("More than one phases are declared to be the last: "+lastSet);
- }
- for (String s : lastSet) {
- for (String v : new HashSet<String>(graph.getVertices().keySet())) {
- if (!lastSet.contains(v)) {
- graph.addEdge(v, s);
- }
- }
- }
-
- }
-
- for (Stage s : stages.values()) {
- List<String> phases = s.getSorter().topologicalSort(false);
- s.getPhases().clear();
- s.getPhases().addAll(phases);
- }
- if (log.isLoggable(Level.FINE)) {
- log.fine("Stages: " + stages);
- }
- return stages;
- }
-
- private void init() {
- stages = new HashMap<String, Stage>();
-
- Stage referenceStage = new Stage(STAGE_REFERENCE);
- for (int i = 1; i < SYSTEM_REFERENCE_PHASES.length; i++) {
- referenceStage.getSorter().addEdge(SYSTEM_REFERENCE_PHASES[i - 1], SYSTEM_REFERENCE_PHASES[i]);
- }
- referenceStage.getLastSet().add(REFERENCE_BINDING);
- stages.put(referenceStage.getName(), referenceStage);
-
- Stage referenceBindingStage = new Stage(STAGE_REFERENCE_BINDING);
- for (int i = 1; i < SYSTEM_REFERENCE_BINDING_PHASES.length; i++) {
- referenceBindingStage.getSorter().addEdge(SYSTEM_REFERENCE_BINDING_PHASES[i - 1], SYSTEM_REFERENCE_BINDING_PHASES[i]);
- }
- stages.put(referenceBindingStage.getName(), referenceBindingStage);
-
- Stage serviceBindingStage = new Stage(STAGE_SERVICE_BINDING);
- for (int i = 1; i < SYSTEM_SERVICE_BINDING_PHASES.length; i++) {
- serviceBindingStage.getSorter().addEdge(SYSTEM_SERVICE_BINDING_PHASES[i - 1], SYSTEM_SERVICE_BINDING_PHASES[i]);
- }
- stages.put(serviceBindingStage.getName(), serviceBindingStage);
-
-
- Stage serviceStage = new Stage(STAGE_SERVICE);
- for (int i = 1; i < SYSTEM_SERVICE_PHASES.length; i++) {
- serviceStage.getSorter().addEdge(SYSTEM_SERVICE_PHASES[i - 1], SYSTEM_SERVICE_PHASES[i]);
- }
- stages.put(serviceStage.getName(), serviceStage);
-
- Stage implementationStage = new Stage(STAGE_IMPLEMENTATION);
- for (int i = 1; i < SYSTEM_IMPLEMENTATION_PHASES.length; i++) {
- implementationStage.getSorter().addEdge(SYSTEM_IMPLEMENTATION_PHASES[i - 1],
- SYSTEM_IMPLEMENTATION_PHASES[i]);
- }
- implementationStage.getLastSet().add(IMPLEMENTATION);
- stages.put(implementationStage.getName(), implementationStage);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
deleted file mode 100644
index fc4bea3d9f..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/PhaseSorter.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Directed, weighted graph
- *
- * @param <V> The type of vertex object
- * @param <E> The type of edge object
- *
- * @version $Rev$ $Date$
- */
-public class PhaseSorter<V> implements Cloneable {
- private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
-
- /**
- * Vertex of a graph
- */
- public final class Vertex {
- private V value;
-
- // TODO: Do we want to support multiple edges for a vertex pair? If so,
- // we should use a List instead of Map
- private Map<Vertex, Edge> outEdges = new HashMap<Vertex, Edge>();
- private Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
-
- private Vertex(V value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "(" + value + ")";
- }
-
- public V getValue() {
- return value;
- }
-
- public Map<Vertex, Edge> getOutEdges() {
- return outEdges;
- }
-
- public Map<Vertex, Edge> getInEdges() {
- return inEdges;
- }
-
- }
-
- /**
- * An Edge connects two vertices in one direction
- */
- public final class Edge {
- private Vertex sourceVertex;
-
- private Vertex targetVertex;
-
- public Edge(Vertex source, Vertex target) {
- this.sourceVertex = source;
- this.targetVertex = target;
- }
-
- @Override
- public String toString() {
- return sourceVertex + "->" + targetVertex;
- }
-
- public Vertex getTargetVertex() {
- return targetVertex;
- }
-
- public void setTargetVertex(Vertex vertex) {
- this.targetVertex = vertex;
- }
-
- public Vertex getSourceVertex() {
- return sourceVertex;
- }
-
- public void setSourceVertex(Vertex sourceVertex) {
- this.sourceVertex = sourceVertex;
- }
- }
-
- public void addEdge(V source, V target) {
- Vertex s = getVertex(source);
- if (s == null) {
- s = new Vertex(source);
- vertices.put(source, s);
- }
- Vertex t = getVertex(target);
- if (t == null) {
- t = new Vertex(target);
- vertices.put(target, t);
- }
- Edge edge = new Edge(s, t);
- s.outEdges.put(t, edge);
- t.inEdges.put(s, edge);
- }
-
- public void addVertext(V source) {
- Vertex s = getVertex(source);
- if (s == null) {
- s = new Vertex(source);
- vertices.put(source, s);
- }
- }
-
- public Vertex getVertex(V source) {
- Vertex s = vertices.get(source);
- return s;
- }
-
- public boolean removeEdge(V source, V target) {
- Vertex s = getVertex(source);
- if (s == null) {
- return false;
- }
-
- Vertex t = getVertex(target);
- if (t == null) {
- return false;
- }
-
- return s.outEdges.remove(t) != null && t.inEdges.remove(s) != null;
-
- }
-
- public void removeEdge(Edge edge) {
- edge.sourceVertex.outEdges.remove(edge.targetVertex);
- edge.targetVertex.inEdges.remove(edge.sourceVertex);
- }
-
- public void removeVertex(Vertex vertex) {
- vertices.remove(vertex.getValue());
- for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
- removeEdge(e);
- }
- for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
- removeEdge(e);
- }
- }
-
- public Edge getEdge(Vertex source, Vertex target) {
- return source.outEdges.get(target);
- }
-
- public Edge getEdge(V source, V target) {
- Vertex sv = getVertex(source);
- if (sv == null) {
- return null;
- }
- Vertex tv = getVertex(target);
- if (tv == null) {
- return null;
- }
- return getEdge(getVertex(source), getVertex(target));
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (Vertex v : vertices.values()) {
- sb.append(v.outEdges.values()).append("\n");
- }
- return sb.toString();
- }
-
- public Map<V, Vertex> getVertices() {
- return vertices;
- }
-
- public void addGraph(PhaseSorter<V> otherGraph) {
- for (Vertex v : otherGraph.vertices.values()) {
- for (Edge e : v.outEdges.values()) {
- addEdge(e.sourceVertex.value, e.targetVertex.value);
- }
- }
- }
-
- private Vertex getFirst() {
- for (Vertex v : vertices.values()) {
- if (v.inEdges.isEmpty()) {
- return v;
- }
- }
- if (!vertices.isEmpty()) {
- throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
- } else {
- return null;
- }
- }
-
- public List<V> topologicalSort(boolean readOnly) {
- PhaseSorter<V> graph = (!readOnly) ? this : (PhaseSorter<V>)clone();
- List<V> list = new ArrayList<V>();
- while (true) {
- Vertex v = graph.getFirst();
- if (v == null) {
- break;
- }
- list.add(v.getValue());
- graph.removeVertex(v);
- }
-
- return list;
- }
-
- @Override
- public Object clone() {
- PhaseSorter<V> copy = new PhaseSorter<V>();
- copy.addGraph(this);
- return copy;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java
deleted file mode 100644
index 0b36b178f3..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyCreationException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-
-
-/**
- * Denotes an error creating a proxy
- *
- * @version $Rev$ $Date$
- */
-public class ProxyCreationException extends ObjectCreationException {
- private static final long serialVersionUID = 8002454344828513781L;
-
- public ProxyCreationException() {
- super();
- }
-
- public ProxyCreationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ProxyCreationException(String message) {
- super(message);
- }
-
- public ProxyCreationException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java
deleted file mode 100644
index cb836e42c1..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactory.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-
-/**
- * Creates proxies that implement Java interfaces and invocation handlers for fronting wires
- *
- * @version $Rev$ $Date$
- */
-
-public interface ProxyFactory {
-
- /**
- * Creates a Java proxy for the given wire
- *
- * @param interfaze the interface the proxy implements
- * @param wire the wire to proxy
- * @return the proxy
- * @throws ProxyCreationException
- */
- <T> T createProxy(Class<T> interfaze, RuntimeWire wire) throws ProxyCreationException;
-
- /**
- * Creates a Java proxy for the given CallableReference
- *
- * @param callableReference The CallableReference
- * @return the proxy
- * @throws ProxyCreationException
- */
- <T> T createProxy(CallableReference<T> callableReference) throws ProxyCreationException;
-
- /**
- * Creates a Java proxy for the service contract callback
- *
- * @param interfaze the interface the proxy should implement
- * @return the proxy
- * @throws ProxyCreationException
- */
- <T> T createCallbackProxy(Class<T> interfaze, List<RuntimeWire> wires) throws ProxyCreationException;
-
- /**
- * Creates a Java proxy for the given callback reference
- *
- * @param callableReference The CallableReference
- * @return the proxy
- * @throws ProxyCreationException
- */
- <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference) throws ProxyCreationException;
-
- /**
- * Cast a proxy to a CallableReference.
- *
- * @param target a proxy generated by this implementation
- * @return a CallableReference (or subclass) equivalent to this proxy
- * @throws IllegalArgumentException if the object supplied is not a proxy
- */
- <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
-
- /**
- * Test if a given class is a generated proxy class by this factory
- * @param clazz A java class or interface
- * @return true if the class is a generated proxy class by this factory
- */
- boolean isProxyClass(Class<?> clazz);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java
deleted file mode 100644
index 875a252798..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ProxyFactoryExtensionPoint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-
-/**
- * The extension point to plug in proxy factories
- * @version $Rev$ $Date$
- */
-public interface ProxyFactoryExtensionPoint {
-
- /**
- * Get the proxy factory for java interfaces
- * @return
- */
- ProxyFactory getInterfaceProxyFactory();
-
- /**
- * Get the proxy factory for java classes
- * @return
- */
- ProxyFactory getClassProxyFactory();
-
- /**
- * Set the proxy factory for java interfaces
- * @param factory
- */
- void setInterfaceProxyFactory(ProxyFactory factory);
-
- /**
- * Set the proxy factory for java classes
- * @param factory
- */
- void setClassProxyFactory(ProxyFactory factory);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
deleted file mode 100644
index 906628ee32..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.conversation.ConversationState;
-import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ConversationEndedException;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RuntimeWireInvoker implements Invoker{
- protected ConversationManager conversationManager;
- protected boolean conversational;
- protected ExtendedConversation conversation;
- protected MessageFactory messageFactory;
- protected Object conversationID;
- protected Object callbackID;
- protected Object callbackObject;
- protected RuntimeWire wire;
-
- public RuntimeWireInvoker(MessageFactory messageFactory, ConversationManager conversationManager, RuntimeWire wire) {
- this.messageFactory = messageFactory;
- this.wire = wire;
- this.conversationManager = conversationManager;
- init(wire);
- }
-
- protected void init(RuntimeWire wire) {
- if (wire != null) {
- ReferenceParameters parameters = wire.getSource().getReferenceParameters();
- this.callbackID = parameters.getCallbackID();
- this.callbackObject = parameters.getCallbackReference();
- this.conversationID = parameters.getConversationID();
- InterfaceContract contract = wire.getSource().getInterfaceContract();
- this.conversational = contract.getInterface().isConversational();
- }
- }
-
- /*
- * TODO - Introduced to allow the RuntimeWireInvoker to sit on the end of the
- * service binding chain. Runtime wire invoke needs splitting up into
- * separate conversation, callback interceptors etc.
- */
- public Message invoke(Message msg) {
-
- try {
- Object response = invoke(msg.getOperation(),msg);
- // Hack to put the response back in a message.
- // shouldn't take it out of the response message in the first place
- msg.setBody(response);
- } catch (InvocationTargetException e) {
-// throw new ServiceRuntimeException(e);
- }
-
- return msg;
- }
-
- public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
- return invoke(wire, operation, msg);
- }
-
- public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
- RuntimeWire runtimeWire = wire == null ? this.wire : wire;
- InvocationChain chain = runtimeWire.getInvocationChain(operation);
- return invoke(chain, msg, runtimeWire);
- }
-
- protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
- EndpointReference from = msg.getFrom();
- EndpointReference epFrom = wire.getSource();
- if (from != null) {
- from.mergeEndpoint(epFrom);
- } else {
- msg.setFrom(epFrom);
- }
- msg.setTo(wire.getTarget());
-
- Invoker headInvoker = chain.getHeadInvoker();
- Operation operation = chain.getTargetOperation();
- msg.setOperation(operation);
-
- Message msgContext = ThreadMessageContext.getMessageContext();
- Object currentConversationID = msgContext.getFrom().getReferenceParameters().getConversationID();
-
- ThreadMessageContext.setMessageContext(msg);
- try {
- conversationPreinvoke(msg);
- // handleCallback(msg, currentConversationID);
- // dispatch the wire down the chain and get the response
- Message resp = headInvoker.invoke(msg);
- Object body = resp.getBody();
- if (resp.isFault()) {
- throw new InvocationTargetException((Throwable)body);
- }
- return body;
- } catch (InvocationTargetException e) {
- throw e;
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- } finally {
- try {
- conversationPostInvoke(msg);
- } catch (TargetDestructionException e) {
- throw new ServiceRuntimeException(e);
- } finally {
- ThreadMessageContext.setMessageContext(msgContext);
- }
- }
- }
-
- /**
- * @param msgContext
- */
- protected EndpointReference getCallbackEndpoint(Message msgContext) {
- EndpointReference from = msgContext.getFrom();
- return from == null ? null : from.getReferenceParameters().getCallbackReference();
- }
-
- /**
- * Pre-invoke for the conversation handling
- * @param msg
- * @throws TargetResolutionException
- */
- private void conversationPreinvoke(Message msg) {
- if (conversational) {
- ReferenceParameters parameters = msg.getFrom().getReferenceParameters();
- // in some cases the ConversationID that should be used comes in with the
- // message, e.g. when ws binding is in use.
- Object convID = parameters.getConversationID();
- if (convID != null) {
- conversationID = convID;
- }
- conversation = conversationManager.getConversation(conversationID);
-
- if (conversation == null || conversation.getState() == ConversationState.ENDED) {
- conversation = conversationManager.startConversation(conversationID);
- conversation.initializeConversationAttributes(wire.getTarget().getComponent());
- } else if (conversation.conversationalAttributesInitialized() == false) {
- conversation.initializeConversationAttributes(wire.getTarget().getComponent());
- } else if (conversation.isExpired()){
- throw new ConversationEndedException("Conversation has expired.");
- }
-
- conversation.updateLastReferencedTime();
-
- parameters.setConversationID(conversation.getConversationID());
- }
- }
-
- /**
- * Post-invoke for the conversation handling
- * @param wire
- * @param operation
- * @throws TargetDestructionException
- */
- @SuppressWarnings("unchecked")
- private void conversationPostInvoke(Message msg) throws TargetDestructionException {
- if (conversational) {
- Operation operation = msg.getOperation();
- ConversationSequence sequence = operation.getConversationSequence();
- if (sequence == ConversationSequence.CONVERSATION_END) {
- // in some cases the ConversationID that should be used comes in with the
- // message, e.g. when ws binding is in use.
- Object convID = msg.getFrom().getReferenceParameters().getConversationID();
- if (convID != null) {
- conversationID = convID;
- }
- conversation = conversationManager.getConversation(conversationID);
-
- // remove conversation id from scope container
- ScopeContainer scopeContainer = getConversationalScopeContainer(msg);
-
- if (scopeContainer != null) {
- scopeContainer.remove(conversation.getConversationID());
- }
-
- conversation.end();
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private ScopeContainer getConversationalScopeContainer(Message msg) {
- ScopeContainer scopeContainer = null;
-
- RuntimeComponent component = msg.getTo().getComponent();
-
- if (component instanceof ScopedRuntimeComponent) {
- ScopedRuntimeComponent scopedRuntimeComponent = (ScopedRuntimeComponent)component;
- ScopeContainer container = scopedRuntimeComponent.getScopeContainer();
-
- if ((container != null) && (container.getScope() == Scope.CONVERSATION)) {
- scopeContainer = container;
- }
- }
-
- return scopeContainer;
- }
-
-
- /**
- * Minimal wrapper for a callback object contained in a ServiceReference
- */
- private static class CallbackObjectWrapper<T> implements InstanceWrapper<T> {
-
- private T instance;
-
- private CallbackObjectWrapper(T instance) {
- this.instance = instance;
- }
-
- public T getInstance() {
- return instance;
- }
-
- public void start() {
- // do nothing
- }
-
- public void stop() {
- // do nothing
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.java
deleted file mode 100644
index 1112d02b7e..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/SCAProxy.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.core.invocation;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Proxy;
-import java.lang.reflect.Constructor;
-import java.util.WeakHashMap;
-
-public class SCAProxy extends Proxy
-{
- protected SCAProxy (InvocationHandler handler) {
- super(handler);
- }
-
- // This is a cache containing the proxy class constructor for each business interface.
- // This improves performance compared to calling Proxy.newProxyInstance()
- // every time that a proxy is needed.
- private static WeakHashMap cache = new WeakHashMap<Class, Object>();
-
- public static Object newProxyInstance(ClassLoader classloader, Class aclass[], InvocationHandler invocationhandler)
- throws IllegalArgumentException
- {
- try {
- if(invocationhandler == null)
- throw new NullPointerException();
- // Lookup cached constructor. aclass[0] is the reference's business interface.
- Constructor proxyCTOR;
- synchronized(cache) {
- proxyCTOR = (Constructor) cache.get(aclass[0]);
- }
- if(proxyCTOR == null) {
- Class proxyClass = getProxyClass(classloader, aclass);
- proxyCTOR = proxyClass.getConstructor(constructorParams);
- synchronized(cache){
- cache.put(aclass[0],proxyCTOR);
- }
- }
- return proxyCTOR.newInstance(new Object[] { invocationhandler });
- }
- catch(NoSuchMethodException e) {
- throw new InternalError(e.toString());
- }
- catch(IllegalAccessException e) {
- throw new InternalError(e.toString());
- }
- catch (InstantiationException e) {
- throw new InternalError(e.toString());
- }
- catch (InvocationTargetException e) {
- throw new InternalError(e.toString());
- }
- }
-
- private static final Class constructorParams[] = { InvocationHandler.class };
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.java
deleted file mode 100644
index 2c4d657882..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/TargetInvocationException.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.core.invocation;
-
-/**
- * Raised when an error is encountered during a target invocation
- *
- * @version $Rev$ $Date$
- */
-public class TargetInvocationException extends Exception {
-
- private static final long serialVersionUID = -6553427708442761743L;
-
- public TargetInvocationException() {
- super();
- }
-
- public TargetInvocationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetInvocationException(String message) {
- super(message);
- }
-
- public TargetInvocationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.java
deleted file mode 100644
index 504bd9b036..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/ThreadMessageContext.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.core.invocation;
-
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Class for tunnelling a WorkContext through the invocation of a user class.
- *
- * @version $Rev$ $Date$
- */
-public final class ThreadMessageContext {
-
- private static final ThreadLocal<Message> CONTEXT = new ThreadLocal<Message>() {
- @Override
- protected synchronized Message initialValue() {
- Message msg = new MessageImpl();
- msg.setFrom(new EndpointReferenceImpl("/"));
- return msg;
- }
- };
-
- private ThreadMessageContext() {
- }
-
- /**
- * Set the WorkContext for the current thread.
- * The current work context is returned and must be restored after the invocation is complete.
- * Typical usage would be:
- * <pre>
- * WorkContext old = PojoWorkContextTunnel.setThreadWorkContext(newContext);
- * try {
- * ... invoke user code ...
- * } finally {
- * PojoWorkContextTunnel.setThreadWorkContext(old);
- * }
- * </pre>
- * @param context
- * @return the current work context for the thread; this must be restored after the invocation is made
- */
- public static Message setMessageContext(Message context) {
- Message old = CONTEXT.get();
- CONTEXT.set(context);
- return old;
- }
-
- /**
- * Returns the WorkContext for the current thread.
- *
- * @return the WorkContext for the current thread
- */
- public static Message getMessageContext() {
- return CONTEXT.get();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java
deleted file mode 100644
index 246f9c45d6..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/WireObjectFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.invocation;
-
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Uses a wire to return an object instance
- *
- * @version $Rev$ $Date$
- */
-public class WireObjectFactory<T> implements ObjectFactory<T> {
- private Class<T> interfaze;
- private RuntimeWire wire;
- private ProxyFactory proxyService;
-
- /**
- * Constructor.
- *
- * @param interfaze the interface to inject on the client
- * @param wire the backing wire
- * @param proxyService the wire service to create the proxy
- * @throws NoMethodForOperationException
- */
- public WireObjectFactory(Class<T> interfaze, RuntimeWire wire, ProxyFactory proxyService) {
- this.interfaze = interfaze;
- this.wire = wire;
- this.proxyService = proxyService;
- }
-
- public T getInstance() throws ObjectCreationException {
- return new ServiceReferenceImpl<T>(interfaze, wire, proxyService).getProxy();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
deleted file mode 100644
index 1168d1d0dd..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainer.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.scope;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Implements functionality common to scope contexts.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractScopeContainer<KEY> implements ScopeContainer<KEY> {
- protected Map<KEY, InstanceWrapper<?>> wrappers = new ConcurrentHashMap<KEY, InstanceWrapper<?>>();
- protected final Scope scope;
-
- protected RuntimeComponent component;
- protected volatile int lifecycleState = UNINITIALIZED;
-
-
- public AbstractScopeContainer(Scope scope, RuntimeComponent component) {
- this.scope = scope;
- this.component = component;
- }
-
- protected void checkInit() {
- if (getLifecycleState() != RUNNING) {
- throw new IllegalStateException("Scope container not running [" + getLifecycleState() + "]");
- }
- }
-
- /**
- * Creates a new physical instance of a component, wrapped in an
- * InstanceWrapper.
- *
- * @param component the component whose instance should be created
- * @return a wrapped instance that has been injected but not yet started
- * @throws TargetResolutionException if there was a problem creating the
- * instance
- */
- protected InstanceWrapper createInstanceWrapper() throws TargetResolutionException {
- ImplementationProvider implementationProvider = component.getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- return ((ScopedImplementationProvider)implementationProvider).createInstanceWrapper();
- }
- return null;
- }
-
- public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
- return getWrapper(contextId); // TODO: what is this method supposed to do diff than getWrapper?
- }
-
- public Scope getScope() {
- return scope;
- }
-
- public InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
- return wrappers.get(contextId);
- }
-
- public void addWrapperReference(KEY existingContextId, KEY newContextId)
- throws TargetResolutionException {
- // do nothing here. the conversational scope container implements this
- }
-
- public void registerWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetResolutionException {
- // do nothing here. the conversational scope container implements this
- }
-
- public void onEvent(Event event) {
- }
-
- protected boolean isEagerInit() {
- ImplementationProvider implementationProvider = ((RuntimeComponent)component).getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- return ((ScopedImplementationProvider)implementationProvider).isEagerInit();
- }
- return false;
- }
-
- public void returnWrapper(InstanceWrapper wrapper, KEY contextId) throws TargetDestructionException {
- }
-
- /**
- * Default implementation of remove which does nothing
- *
- * @param contextId the identifier of the context to remove.
- */
- public void remove(KEY contextId)
- throws TargetDestructionException {
- }
-
- public synchronized void start() {
- int lifecycleState = getLifecycleState();
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- setLifecycleState(RUNNING);
- }
-
- public void startContext(KEY contextId) {
- if(isEagerInit()) {
- try {
- getWrapper(contextId);
- } catch (TargetResolutionException e) {
- //
- }
- }
- }
-
- public synchronized void stop() {
- int lifecycleState = getLifecycleState();
- if (lifecycleState != RUNNING) {
- throw new IllegalStateException("Scope in wrong state [" + lifecycleState + "]");
- }
- setLifecycleState(STOPPED);
- }
-
- public void stopContext(KEY contextId) {
- wrappers.remove(contextId);
- }
-
- @Override
- public String toString() {
- String s;
- switch (lifecycleState) {
- case ScopeContainer.CONFIG_ERROR:
- s = "CONFIG_ERROR";
- break;
- case ScopeContainer.ERROR:
- s = "ERROR";
- break;
- case ScopeContainer.INITIALIZING:
- s = "INITIALIZING";
- break;
- case ScopeContainer.INITIALIZED:
- s = "INITIALIZED";
- break;
- case ScopeContainer.RUNNING:
- s = "RUNNING";
- break;
- case ScopeContainer.STOPPING:
- s = "STOPPING";
- break;
- case ScopeContainer.STOPPED:
- s = "STOPPED";
- break;
- case ScopeContainer.UNINITIALIZED:
- s = "UNINITIALIZED";
- break;
- default:
- s = "UNKNOWN";
- break;
- }
- return "In state [" + s + ']';
- }
-
- public RuntimeComponent getComponent() {
- return component;
- }
-
- public void setComponent(RuntimeComponent component) {
- this.component = component;
- }
-
- public int getLifecycleState() {
- return lifecycleState;
- }
-
- /**
- * Set the current state of the Lifecycle.
- *
- * @param lifecycleState the new state
- */
- protected void setLifecycleState(int lifecycleState) {
- this.lifecycleState = lifecycleState;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
deleted file mode 100644
index 7a1965198a..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainer.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.scope;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed by composite
- *
- * @version $Rev$ $Date$
- */
-public class CompositeScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
- private InstanceWrapper<?> wrapper;
-
- public CompositeScopeContainer(RuntimeComponent component) {
- super(Scope.COMPOSITE, component);
- }
-
- @Override
- public synchronized void stop() {
- super.stop();
- if (wrapper != null) {
- try {
- wrapper.stop();
- } catch (TargetDestructionException e) {
- throw new IllegalStateException(e);
- }
- }
- wrapper = null;
- }
-
- @Override
- public synchronized InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException {
- if (wrapper == null) {
- wrapper = createInstanceWrapper();
- try {
- wrapper.start();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e) {
- try {
- wrapper.stop();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e2) {
- }
- wrapper = null;
- throw new TargetInitializationException(e);
- }
- }
- return wrapper;
- }
-
- @Override
- public InstanceWrapper getAssociatedWrapper(KEY contextId) throws TargetResolutionException {
- if (wrapper == null) {
- throw new TargetNotFoundException(component.getURI());
- }
- return wrapper;
- }
-
- @Override
- public synchronized void start() {
- super.start();
- if (isEagerInit()) {
- try {
- getWrapper(null);
- } catch (TargetResolutionException e) {
- throw new IllegalStateException(e);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.java
deleted file mode 100644
index 786988613b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/CompositeScopeContainerFactory.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CompositeScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new CompositeScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.COMPOSITE;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
deleted file mode 100644
index 3ae1ca51c5..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainer.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.scope;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.conversation.ConversationListener;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.conversation.ExtendedConversation;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.Store;
-
-/**
- * A scope context which manages atomic component instances keyed on ConversationID
- *
- * @version $Rev$ $Date$
- */
-public class ConversationalScopeContainer extends AbstractScopeContainer<Object> implements ConversationListener {
- private ConversationManager conversationManager;
- private Map<Object, InstanceLifeCycleWrapper> instanceLifecycleCollection =
- new ConcurrentHashMap<Object, InstanceLifeCycleWrapper>();
-
- public ConversationalScopeContainer(Store aStore, RuntimeComponent component) {
- super(Scope.CONVERSATION, component);
-
- // Note: aStore is here to preserve the original factory interface. It is not currently used in this
- // implementation since we do not support instance persistence.
-
- // Check System properties to see if timeout values have been specified. All timeout values
- // will be specified in seconds.
- //
-
- }
-
-
- protected InstanceWrapper getInstanceWrapper(boolean create, Object contextId) throws TargetResolutionException {
-
- // we might get a null context if the target service has
- // conversational scope but only its callback interface
- // is conversational. In this case we need to invent a
- // conversation Id here to store the service against
- // and populate the thread context
- if (contextId == null) {
- contextId = UUID.randomUUID().toString();
- Message msgContext = ThreadMessageContext.getMessageContext();
-
- if (msgContext != null) {
- msgContext.getFrom().getReferenceParameters().setConversationID(contextId);
- }
- }
-
- InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
-
- if (anInstanceWrapper == null && !create)
- return null;
-
- if (anInstanceWrapper == null) {
- anInstanceWrapper = new InstanceLifeCycleWrapper(contextId);
- this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
- }
-
- return anInstanceWrapper.getInstanceWrapper(contextId);
-
- }
-
- @Override
- public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
- return getInstanceWrapper(true, contextId);
- }
-
- /**
- * This method allows a new context id to be registered alongside an existing one. This happens in
- * one case, when a conversation includes a stateful callback. The client component instance
- * must be registered against all outgoing conversation ids so that the component instance
- * can be found when the callback arrives
- *
- * @param existingContextId the context id against which the component is already registered
- * @param context this should be a conversation object so that the conversation can b stored
- * and reset when the component instance is removed
- */
- @Override
- public void addWrapperReference(Object existingContextId, Object contextId) throws TargetResolutionException {
-
-
- // get the instance wrapper via the existing id
- InstanceLifeCycleWrapper existingInstanceWrapper = this.instanceLifecycleCollection.get(existingContextId);
- InstanceLifeCycleWrapper newInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
-
- // only add the extra reference once
- if (newInstanceWrapper == null) {
- // add the id to the list of ids that the wrapper holds. Used for reference
- // counting and conversation resetting on destruction.
- existingInstanceWrapper.addCallbackConversation(contextId);
-
- // add the reference to the collection
- this.instanceLifecycleCollection.put(contextId, existingInstanceWrapper);
- }
- }
-
- @Override
- public void registerWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
- // if a wrapper for a different instance is already registered for this contextId, remove it
- InstanceLifeCycleWrapper anInstanceWrapper = this.instanceLifecycleCollection.get(contextId);
- if (anInstanceWrapper != null) {
- if (anInstanceWrapper.getInstanceWrapper(contextId).getInstance() != wrapper.getInstance()) {
- remove(contextId);
- } else {
- return;
- }
- }
-
- anInstanceWrapper = new InstanceLifeCycleWrapper(wrapper, contextId);
- this.instanceLifecycleCollection.put(contextId, anInstanceWrapper);
- }
-
- // The remove is invoked when a conversation is explicitly ended. This can occur by using the @EndsConversation or API.
- // In this case the instance is immediately removed. A new conversation will be started on the next operation
- // associated with this conversationId's service reference.
- //
- @Override
- public void remove(Object contextId) throws TargetDestructionException {
- if (contextId != null) {
- if (this.instanceLifecycleCollection.containsKey(contextId)) {
- InstanceLifeCycleWrapper anInstanceLifeCycleWrapper = this.instanceLifecycleCollection.get(contextId);
- this.instanceLifecycleCollection.remove(contextId);
- anInstanceLifeCycleWrapper.removeInstanceWrapper(contextId);
- }
- }
- }
-
- /*
- * This is an inner class that keeps track of the lifecycle of a conversation scoped
- * implementation instance.
- *
- */
-
- private class InstanceLifeCycleWrapper {
- private Object clientConversationId;
- private List<Object> callbackConversations = new ArrayList<Object>();
-
- private InstanceLifeCycleWrapper(Object contextId) throws TargetResolutionException {
- this.clientConversationId = contextId;
- this.createInstance(contextId);
- }
-
- private InstanceLifeCycleWrapper(InstanceWrapper wrapper, Object contextId) throws TargetResolutionException {
- this.clientConversationId = contextId;
- wrappers.put(contextId, wrapper);
- }
-
-
- // Associates a callback conversation with this instance. Each time the scope container
- // is asked to remove an object given a ontextId an associated conversation object will
- // have its conversationId reset to null. When the list of ids is empty the component instance
- // will be removed from the scope container
- private void addCallbackConversation(Object conversationID) {
- InstanceWrapper ctx = getInstanceWrapper(clientConversationId);
- callbackConversations.add(conversationID);
- wrappers.put(conversationID, ctx);
- }
-
- //
- // Return the backing implementation instance
- //
- private InstanceWrapper getInstanceWrapper(Object contextId) {
- InstanceWrapper ctx = wrappers.get(contextId);
- return ctx;
- }
-
- private void removeInstanceWrapper(Object contextId) throws TargetDestructionException {
- InstanceWrapper ctx = getInstanceWrapper(contextId);
- wrappers.remove(contextId);
-
- // find out if we are dealing with the original client conversation id
- // and reset accordingly
- if ( ( clientConversationId != null ) && ( clientConversationId.equals(contextId)) ) {
- clientConversationId = null;
- } else {
- // reset the conversationId in the conversation object if present
- // so that and ending callback causes the conversation in the originating
- // service reference in the client to be reset
- callbackConversations.remove(contextId);
- }
-
- // stop the component if this removes the last reference
- if (clientConversationId == null && callbackConversations.isEmpty()) {
- ctx.stop();
- }
- }
-
- private void createInstance(Object contextId) throws TargetResolutionException {
- InstanceWrapper instanceWrapper = createInstanceWrapper();
- instanceWrapper.start();
- wrappers.put(contextId, instanceWrapper);
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationEnded(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
- */
- public void conversationEnded(ExtendedConversation conversation) {
- try {
- remove(conversation.getConversationID());
- } catch (Exception ex) {
-
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationExpired(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
- */
- public void conversationExpired(ExtendedConversation conversation) {
-
- Object conversationId = conversation.getConversationID();
- InstanceLifeCycleWrapper ilcw = instanceLifecycleCollection.get(conversationId);
- if (ilcw != null) {
- // cycle through all the references to this instance and
- // remove them from the underlying wrappers collection and
- // from the lifecycle wrappers collection
-
- for (Object conversationID : ilcw.callbackConversations) {
- try{
- ilcw.removeInstanceWrapper(conversationID);
- remove(conversationID);
- } catch(TargetDestructionException tde) {
- System.out.println("Could not remove conversation id " + conversationID);
- }
- }
-
-
- if (ilcw.clientConversationId != null) {
- try{
- ilcw.removeInstanceWrapper(ilcw.clientConversationId);
- remove(ilcw.clientConversationId);
- } catch(TargetDestructionException tde) {
- System.out.println("Could not remove conversation id " + ilcw.clientConversationId);
- }
- }
-
- }
-
- }
-
- /**
- * @see org.apache.tuscany.sca.core.conversation.ConversationListener#conversationStarted(org.apache.tuscany.sca.core.conversation.ExtendedConversation)
- */
- public void conversationStarted(ExtendedConversation conversation) {
- startContext(conversation.getConversationID());
- }
-
- /**
- * @return the conversationManager
- */
- public ConversationManager getConversationManager() {
- return conversationManager;
- }
-
- /**
- * @param conversationManager the conversationManager to set
- */
- public void setConversationManager(ConversationManager conversationManager) {
- this.conversationManager = conversationManager;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.java
deleted file mode 100644
index a6663aba09..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ConversationalScopeContainerFactory.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.Store;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationalScopeContainerFactory implements ScopeContainerFactory {
- private Store store;
-
- public ConversationalScopeContainerFactory(Store store) {
- super();
- this.store = store;
- }
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new ConversationalScopeContainer(store, component);
- }
-
- public Scope getScope() {
- return Scope.CONVERSATION;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.java
deleted file mode 100644
index 5ae8b94647..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainer.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.core.scope;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.event.HttpSessionEnd;
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed on HTTP
- * session
- *
- * @version $Rev$ $Date$
- */
-public class HttpSessionScopeContainer extends AbstractScopeContainer<Object> {
-
- public HttpSessionScopeContainer(RuntimeComponent component) {
- super(Scope.SESSION, component);
- }
-
- @Override
- public void onEvent(Event event) {
- checkInit();
- if (event instanceof HttpSessionEnd) {
- //FIXME key is not used
- //Object key = ((HttpSessionEnd)event).getSessionID();
- // FIXME: Remove the session id
- }
- }
-
- @Override
- public synchronized void start() {
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- lifecycleState = RUNNING;
- }
-
- @Override
- public synchronized void stop() {
- lifecycleState = STOPPED;
- }
-
- protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
-// Object key = workContext.getIdentifier(Scope.SESSION);
- // FIXME: Need to fix this
- Object key ="http-session-id";
- assert key != null : "HTTP session key not bound in work context";
- InstanceWrapper ctx = wrappers.get(key);
- if (ctx == null && !create) {
- return null;
- }
- if (ctx == null) {
- ctx = super.createInstanceWrapper();
- ctx.start();
- wrappers.put(key, ctx);
- }
- return ctx;
- }
-
- @Override
- public InstanceWrapper getWrapper(Object contextId) throws TargetResolutionException {
- return getInstanceWrapper(true);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.java
deleted file mode 100644
index 49f89661b1..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/HttpSessionScopeContainerFactory.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class HttpSessionScopeContainerFactory implements ScopeContainerFactory {
-
- public HttpSessionScopeContainerFactory() {
- super();
- }
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new HttpSessionScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.SESSION;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
deleted file mode 100644
index 8fdfcc63c9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.scope;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.event.RequestEnd;
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages atomic component instances keyed on the current
- * request context
- *
- * @version $Rev$ $Date$
- */
-public class RequestScopeContainer extends AbstractScopeContainer<Thread> {
- private final Map<Thread, InstanceWrapper> contexts;
-
- public RequestScopeContainer(RuntimeComponent component) {
- super(Scope.REQUEST, component);
- contexts = new ConcurrentHashMap<Thread, InstanceWrapper>();
- }
-
- @Override
- public void onEvent(Event event) {
- checkInit();
- if (event instanceof RequestEnd) {
- // shutdownInstances(Thread.currentThread());
- }
- }
-
- @Override
- public synchronized void start() {
- if (lifecycleState != UNINITIALIZED && lifecycleState != STOPPED) {
- throw new IllegalStateException("Scope must be in UNINITIALIZED or STOPPED state [" + lifecycleState + "]");
- }
- lifecycleState = RUNNING;
- }
-
- @Override
- public synchronized void stop() {
- contexts.clear();
- // synchronized (destroyQueues) {
- // destroyQueues.clear();
- // }
- for (InstanceWrapper ctx : wrappers.values()) {
- try {
- ctx.stop();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e2) {
- }
- }
- lifecycleState = STOPPED;
- }
-
- protected InstanceWrapper getInstanceWrapper(boolean create) throws TargetResolutionException {
- InstanceWrapper ctx = wrappers.get(Thread.currentThread());
- if (ctx == null && !create) {
- return null;
- }
- if (ctx == null) {
- ctx = super.createInstanceWrapper();
- try {
- ctx.start();
- wrappers.put(Thread.currentThread(), ctx);
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e) {
- try {
- ctx.stop();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e2) {
- }
- throw new TargetInitializationException(e);
- }
- }
- return ctx;
- }
-
- @Override
- public InstanceWrapper getWrapper(Thread contextId) throws TargetResolutionException {
- return getInstanceWrapper(true);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.java
deleted file mode 100644
index 1cfb6b06a4..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/RequestScopeContainerFactory.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new RequestScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.REQUEST;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.java
deleted file mode 100644
index 0a20d793f7..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/Scope.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.core.scope;
-
-/**
- * The default implementation scopes supported by assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class Scope {
- public static final Scope STATELESS = new Scope("STATELESS");
- public static final Scope REQUEST = new Scope("REQUEST");
- public static final Scope SESSION = new Scope("SESSION");
- public static final Scope CONVERSATION = new Scope("CONVERSATION");
- public static final Scope COMPOSITE = new Scope("COMPOSITE");
- public static final Scope SYSTEM = new Scope("SYSTEM");
- public static final Scope UNDEFINED = new Scope("UNDEFINED");
-
- private String scope;
-
- public Scope(String scope) {
- this.scope = scope.toUpperCase().intern();
- }
-
- public String getScope() {
- return scope;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final Scope scope1 = (Scope) o;
- return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
- }
-
- @Override
- public int hashCode() {
- return scope != null ? scope.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return scope;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
deleted file mode 100644
index 6b2980b989..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainer.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.scope;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * Manages the lifecycle and visibility of instances associated with a an {@link RuntimeComponent}.
- *
- * @version $Rev$ $Date$
- * @param <KEY> the type of IDs that this container uses to identify its contexts.
- * For example, for COMPOSITE scope this could be the URI of the composite component,
- * or for HTTP Session scope it might be the HTTP session ID.
- */
-public interface ScopeContainer<KEY> extends RuntimeEventListener {
-
- /**
- * Returns the Scope that this container supports.
- *
- * @return the Scope that this container supports
- */
- Scope getScope();
-
- /**
- * Start a new context with the supplied ID.
- *
- * @param contextId an ID that uniquely identifies the context.
- */
- void startContext(KEY contextId);
-
- /**
- * Stop the context with the supplied ID.
- *
- * @param contextId an ID that uniquely identifies the context.
- */
- void stopContext(KEY contextId);
-
- /**
- * Returns an instance wrapper associated with the current scope context, creating one if necessary
- * @param contextId the id for the scope context
- *
- * @return the wrapper for the target instance
- * @throws TargetResolutionException if there was a problem instantiating the target instance
- */
- InstanceWrapper getWrapper(KEY contextId) throws TargetResolutionException;
-
- /**
- * Allows a component to be registered against more than one context id. This is required in the
- * case of stateful callbacks where we want to identify the originating client component instance
- * as the callback target but we don't want to reuse the clients original conversation id
- *
- * @param existingContextId an id that identifies an existing component instance
- * @param newContextId a new id against which this component will also be registered
- * @throws TargetResolutionException
- */
- void addWrapperReference(KEY existingContextId, KEY newContextId)
- throws TargetResolutionException;
-
- /**
- * Register an existing instance against a context id. This is needed
- * for a stateful callback where the service reference for the forward call
- * contains a callback object that is not a service reference.
- *
- * @param wrapper the instance wrapper for the instance to be registered
- * @param contextId the id for the scope context
- * @throws TargetResolutionException
- */
- void registerWrapper(InstanceWrapper wrapper, KEY contextId)
- throws TargetResolutionException;
-
- /**
- * Returns an implementation instance associated with the current scope context.
- * If no instance is found, a {@link TargetNotFoundException} is thrown.
- * @param contextId the id for the scope context
- *
- * @return the wrapper for the target instance
- * @throws TargetResolutionException if there was a problem instantiating the target instance
- */
- InstanceWrapper getAssociatedWrapper(KEY contextId)
- throws TargetResolutionException;
-
- /**
- * Return a wrapper after use (for example, after invoking the instance).
- * @param wrapper the wrapper for the target instance being returned
- * @param contextId the id for the scope context
- *
- * @throws TargetDestructionException if there was a problem returning the target instance
- */
- void returnWrapper(InstanceWrapper wrapper, KEY contextId)
- throws TargetDestructionException;
-
- /**
- * Removes an identified component implementation instance associated with the current
- * context from persistent storage
- *
- * @param contextId the identifier of the context to remove.
- */
- void remove(KEY contextId)
- throws TargetDestructionException;
-
- /* A configuration error state */
- int CONFIG_ERROR = -1;
- /* Has not been initialized */
- int UNINITIALIZED = 0;
- /* In the process of being configured and initialized */
- int INITIALIZING = 1;
- /* Instantiated and configured */
- int INITIALIZED = 2;
- /* Configured and initialized */
- int RUNNING = 4;
- /* In the process of being shutdown */
- int STOPPING = 5;
- /* Has been shutdown and removed from the composite */
- int STOPPED = 6;
- /* In an error state */
- int ERROR = 7;
-
- /**
- * Returns the lifecycle state
- *
- * @see #UNINITIALIZED
- * @see #INITIALIZING
- * @see #INITIALIZED
- * @see #RUNNING
- * @see #STOPPING
- * @see #STOPPED
- */
- int getLifecycleState();
-
- /**
- * Starts the Lifecycle.
- */
- void start();
-
- /**
- * Stops the Lifecycle.
- */
- void stop();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
deleted file mode 100644
index b19c14b3e0..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeContainerFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Factory to create ScopeContainer for components
- *
- * @version $Rev$ $Date$
- */
-public interface ScopeContainerFactory {
- ScopeContainer createScopeContainer(RuntimeComponent component);
- Scope getScope();
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.java
deleted file mode 100644
index 842ed4c547..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistry.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * Manages {@link ScopeContainer}s in the runtime
- *
- * @version $Rev$ $Date$
- */
-public interface ScopeRegistry {
-
- /**
- * Returns the scope container for the given scope or null if one not found
- *
- * @param scope the scope
- * @return the scope container for the given scope or null if one not found
- */
- ScopeContainer getScopeContainer(RuntimeComponent component);
-
- /**
- * @param factory
- */
- void register(ScopeContainerFactory factory);
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.java
deleted file mode 100644
index 75261e11a8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopeRegistryImpl.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.core.scope;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * The default implementation of a scope registry
- *
- * @version $Rev$ $Date$
- */
-public class ScopeRegistryImpl implements ScopeRegistry {
- private final Map<Scope, ScopeContainerFactory> scopeCache = new ConcurrentHashMap<Scope, ScopeContainerFactory>();
-
- public void register(ScopeContainerFactory factory) {
- scopeCache.put(factory.getScope(), factory);
- }
-
- public ScopeContainer getScopeContainer(RuntimeComponent runtimeComponent) {
- if (!(runtimeComponent instanceof ScopedRuntimeComponent)) {
- return null;
- }
- ScopedRuntimeComponent component = (ScopedRuntimeComponent)runtimeComponent;
- if (component.getScopeContainer() != null) {
- return component.getScopeContainer();
- }
- ImplementationProvider implementationProvider = component.getImplementationProvider();
- if (implementationProvider instanceof ScopedImplementationProvider) {
- ScopedImplementationProvider provider = (ScopedImplementationProvider)implementationProvider;
- Scope scope = provider.getScope();
- if (scope == null) {
- scope = Scope.STATELESS;
- }
- ScopeContainerFactory factory = scopeCache.get(scope);
- ScopeContainer container = factory.createScopeContainer(component);
- component.setScopeContainer(container);
- return container;
- }
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
deleted file mode 100644
index 85a6626cdd..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedImplementationProvider.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.scope;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-
-/**
- * A component implementation can implement this interface to provide scope
- * management for the components
- *
- * @version $Rev$ $Date$
- */
-public interface ScopedImplementationProvider extends ImplementationProvider {
- /**
- * Get the scope for the component implementation
- *
- * @return The scope for the component implementation, if null is returned,
- * STATELESS will be used
- */
- Scope getScope();
-
- /**
- * Indicate if the component needs to be eagerly initialized
- *
- * @return true if the component is marked to be eagerly initialized, false
- * otherwise
- */
- boolean isEagerInit();
-
- /**
- * @return the maxAge
- */
- long getMaxAge();
-
- /**
- * @return the maxIdleTime
- */
- long getMaxIdleTime();
-
- /**
- * Create a wrapper for the component instance for the scope management
- *
- * @return A wrapper for the component instance
- */
- InstanceWrapper createInstanceWrapper();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.java
deleted file mode 100644
index c27b112f8a..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/ScopedRuntimeComponent.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Scoped runtime component
- *
- * @version $Rev$ $Date$
- */
-public interface ScopedRuntimeComponent extends RuntimeComponent {
- /**
- * Set the associated scope container
- * @param scopeContainer
- */
- void setScopeContainer(ScopeContainer scopeContainer);
- /**
- * Get the assoicated scope container
- * @return
- */
- ScopeContainer getScopeContainer();
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.java
deleted file mode 100644
index 24125b154c..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainer.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.core.scope;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A scope context which manages stateless atomic component instances in a non-pooled fashion.
- *
- * @version $Rev$ $Date$
- */
-public class StatelessScopeContainer<KEY> extends AbstractScopeContainer<KEY> {
-
- public StatelessScopeContainer(RuntimeComponent component) {
- super(Scope.STATELESS, component);
- }
-
- @Override
- public InstanceWrapper getWrapper(KEY contextId)
- throws TargetResolutionException {
- InstanceWrapper ctx = createInstanceWrapper();
- try {
- ctx.start();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e) {
- try {
- ctx.stop();
- } catch (ThreadDeath td) {
- throw td;
- } catch (Throwable e2) {
- }
- throw new TargetInitializationException(e);
- }
- return ctx;
- }
-
- @Override
- public InstanceWrapper getAssociatedWrapper(KEY contextId)
- throws TargetResolutionException {
- return getWrapper(contextId);
- }
-
- @Override
- public void returnWrapper(InstanceWrapper wrapper, KEY contextId)
- throws TargetDestructionException {
- wrapper.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.java
deleted file mode 100644
index 0471b2c52e..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/StatelessScopeContainerFactory.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.core.scope;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class StatelessScopeContainerFactory implements ScopeContainerFactory {
-
- public ScopeContainer createScopeContainer(RuntimeComponent component) {
- return new StatelessScopeContainer(component);
- }
-
- public Scope getScope() {
- return Scope.STATELESS;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.java
deleted file mode 100644
index 0f83dad97d..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetDestructionException.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.core.scope;
-
-/**
- * Denotes an error destroying a target
- *
- * @version $Rev$ $Date$
- */
-public class TargetDestructionException extends TargetResolutionException {
- private static final long serialVersionUID = -6126684147851674709L;
-
- public TargetDestructionException() {
- super();
- }
-
- public TargetDestructionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetDestructionException(String message) {
- super(message);
- }
-
- public TargetDestructionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.java
deleted file mode 100644
index 15959c0608..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetInitializationException.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.core.scope;
-
-/**
- * Denotes an error initializing a target
- *
- * @version $Rev$ $Date$
- */
-public class TargetInitializationException extends TargetResolutionException {
- private static final long serialVersionUID = -6228778208649752698L;
-
- public TargetInitializationException() {
- super();
- }
-
- public TargetInitializationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetInitializationException(String message) {
- super(message);
- }
-
- public TargetInitializationException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.java
deleted file mode 100644
index bb46a2499b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetNotFoundException.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.core.scope;
-
-/**
- * Thrown when a target of an operation cannot be found
- *
- * @version $Rev$ $Date$
- */
-public class TargetNotFoundException extends TargetResolutionException {
- private static final long serialVersionUID = 5541830480658471186L;
-
- public TargetNotFoundException() {
- super();
- }
-
- public TargetNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetNotFoundException(String message) {
- super(message);
- }
-
- public TargetNotFoundException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.java
deleted file mode 100644
index ea8d0e876c..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/scope/TargetResolutionException.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.core.scope;
-
-/**
- * Denotes an error retrieving a target instance
- *
- * @version $Rev$ $Date$
- */
-public class TargetResolutionException extends Exception {
- private static final long serialVersionUID = 2912513650522019405L;
-
- public TargetResolutionException() {
- super();
- }
-
- public TargetResolutionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TargetResolutionException(String message) {
- super(message);
- }
-
- public TargetResolutionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
deleted file mode 100644
index 5b838116c5..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/store/MemoryStore.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.store;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.tuscany.sca.core.event.BaseEventPublisher;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.DuplicateRecordException;
-import org.apache.tuscany.sca.store.RecoveryListener;
-import org.apache.tuscany.sca.store.Store;
-import org.apache.tuscany.sca.store.StoreExpirationEvent;
-import org.apache.tuscany.sca.store.StoreMonitor;
-import org.apache.tuscany.sca.store.StoreWriteException;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implements a non-durable, non-transactional store using a simple in-memory map
- *
- * @version $Rev$ $Date$
- */
-@Service(Store.class)
-@EagerInit
-public class MemoryStore extends BaseEventPublisher implements Store {
- private Map<RuntimeComponent, Map<String, Record>> store;
- // TODO integrate with a core threading scheme
- private ScheduledExecutorService scheduler;
- private long reaperInterval = 300000;
- private StoreMonitor monitor;
- private long defaultExpirationOffset = 600000; // 10 minutes
-
- public MemoryStore(StoreMonitor monitor) {
- this.monitor = monitor;
- this.store = new ConcurrentHashMap<RuntimeComponent, Map<String, Record>>();
- this.scheduler = Executors.newSingleThreadScheduledExecutor();
- }
-
- /**
- * Returns the maximum default expiration offset for records in the store
- *
- * @return the maximum default expiration offset for records in the store
- */
- public long getDefaultExpirationOffset() {
- return defaultExpirationOffset;
- }
-
- /**
- * Sets the maximum default expiration offset for records in the store
- */
- @Property
- public void setDefaultExpirationOffset(long defaultExpirationOffset) {
- this.defaultExpirationOffset = defaultExpirationOffset;
- }
-
- /**
- * Sets the interval for expired entry scanning to be performed
- */
- @Property
- public void setReaperInterval(long reaperInterval) {
- this.reaperInterval = reaperInterval;
- }
-
- public long getReaperInterval() {
- return reaperInterval;
- }
-
- @Init
- public void init() {
- scheduler.scheduleWithFixedDelay(new Reaper(), reaperInterval, reaperInterval, TimeUnit.MILLISECONDS);
- monitor.start("In-memory store started");
- }
-
- @Destroy
- public void destroy() {
- scheduler.shutdown();
- monitor.stop("In-memory store stopped");
- }
-
- public void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- map = new ConcurrentHashMap<String, Record>();
- store.put(owner, map);
- }
- if (map.containsKey(id)) {
- throw new DuplicateRecordException("Duplicate record: " + owner.getURI() +" : " + id);
- }
- map.put(id, new Record(object, expiration));
- }
-
- public void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
- }
- Record record = map.get(id);
- if (record == null) {
- throw new StoreWriteException("Record not found: " + owner.getURI() +" : " + id);
- }
- record.data = object;
- }
-
- public Object readRecord(RuntimeComponent owner, String id) {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- return null;
- }
- Record record = map.get(id);
- if (record != null) {
- return record.data;
- }
- return null;
- }
-
- public void removeRecords() {
- store.clear();
- }
-
- public void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException {
- Map<String, Record> map = store.get(owner);
- if (map == null) {
- throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
- }
- if (map.remove(id) == null) {
- throw new StoreWriteException("Owner not found: " + owner.getURI() +" : " + id);
- }
- }
-
- public void recover(RecoveryListener listener) {
- throw new UnsupportedOperationException();
- }
-
- private class Record {
- private Object data;
- private long expiration = NEVER;
-
- public Record(Object data, long expiration) {
- this.data = data;
- this.expiration = expiration;
- }
-
- public Object getData() {
- return data;
- }
-
- public long getExpiration() {
- return expiration;
- }
- }
-
- private class Reaper implements Runnable {
-
- public void run() {
- long now = System.currentTimeMillis();
- for (Map.Entry<RuntimeComponent, Map<String, Record>> entries : store.entrySet()) {
- for (Map.Entry<String, Record> entry : entries.getValue().entrySet()) {
- final long expiration = entry.getValue().expiration;
- if (expiration != NEVER && now >= expiration) {
- RuntimeComponent owner = entries.getKey();
- Object instance = entry.getValue().getData();
- // notify listeners of the expiration
- StoreExpirationEvent event = new StoreExpirationEvent(this, owner, instance);
- publish(event);
- entries.getValue().remove(entry.getKey());
- }
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/DefaultWorkScheduler.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/DefaultWorkScheduler.java
deleted file mode 100644
index 55b0acded9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/DefaultWorkScheduler.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.work.NotificationListener;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.apache.tuscany.sca.work.WorkSchedulerException;
-
-/**
- * A work scheduler implementation based on a JSR 237 work manager.
- * <p/>
- * <p/>
- * This needs a JSR 237 work manager implementation available for scheduling work. Instances can be configured with a
- * work manager implementation that is injected in. It is the responsibility of the runtime environment to make a work
- * manager implementation available. For example, if the managed environment supports work manager the runtime can use
- * the appropriate lookup mechanism to inject the work manager implementation. </p>
- *
- * @version $Rev$ $Date$
- */
-public class DefaultWorkScheduler implements WorkScheduler {
-
- /**
- * Underlying JSR-237 work manager
- */
- private ThreadPoolWorkManager jsr237WorkManager;
-
- /**
- * Initializes the JSR 237 work manager.
- *
- * @param jsr237WorkManager JSR 237 work manager.
- */
- public DefaultWorkScheduler() {
- }
-
- private synchronized ThreadPoolWorkManager getWorkManager() {
- if (jsr237WorkManager != null) {
- return jsr237WorkManager;
- }
-// try {
-// InitialContext ctx = new InitialContext();
-// jsr237WorkManager = (ThreadPoolWorkManager)ctx.lookup("java:comp/env/wm/TuscanyWorkManager");
-// } catch (Throwable e) {
-// // ignore
-// }
- if (jsr237WorkManager == null) {
- jsr237WorkManager = new ThreadPoolWorkManager(0);
- }
- return jsr237WorkManager;
- }
-
- /**
- * Schedules a unit of work for future execution. The notification listener is used to register interest in
- * callbacks regarding the status of the work.
- *
- * @param work The unit of work that needs to be asynchronously executed.
- */
- public <T extends Runnable> void scheduleWork(T work) {
- scheduleWork(work, null);
- }
-
- /**
- * Schedules a unit of work for future execution. The notification listener is used to register interest in
- * callbacks regarding the status of the work.
- *
- * @param work The unit of work that needs to be asynchronously executed.
- * @param listener Notification listener for callbacks.
- */
- public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
-
- if (work == null) {
- throw new IllegalArgumentException("Work cannot be null");
- }
-
- Work<T> jsr237Work = new Work<T>(work);
- try {
- if (listener == null) {
- getWorkManager().schedule(jsr237Work);
- } else {
- Jsr237WorkListener<T> jsr237WorkListener = new Jsr237WorkListener<T>(listener, work);
- getWorkManager().schedule(jsr237Work, jsr237WorkListener);
- }
- } catch (IllegalArgumentException ex) {
- if (listener != null) {
- listener.workRejected(work);
- } else {
- throw new WorkSchedulerException(ex);
- }
- } catch (Exception ex) {
- throw new WorkSchedulerException(ex);
- }
-
- }
-
- public void destroy() {
- if (jsr237WorkManager instanceof ThreadPoolWorkManager) {
- // Allow privileged access to modify threads. Requires RuntimePermission in security
- // policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- ((ThreadPoolWorkManager)jsr237WorkManager).destroy();
- return null;
- }
- });
- }
- }
-
- /*
- * WorkListener for keeping track of work status callbacks.
- *
- */
- private class Jsr237WorkListener<T extends Runnable> implements WorkListener {
-
- // Notification listener
- private NotificationListener<T> listener;
-
- // Work
- private T work;
-
- /*
- * Initializes the notification listener.
- */
- public Jsr237WorkListener(NotificationListener<T> listener, T work) {
- this.listener = listener;
- this.work = work;
- }
-
- /*
- * Callback when the work is accepted.
- */
- public void workAccepted(WorkEvent workEvent) {
- T work = getWork();
- listener.workAccepted(work);
- }
-
- /*
- * Callback when the work is rejected.
- */
- public void workRejected(WorkEvent workEvent) {
- T work = getWork();
- listener.workRejected(work);
- }
-
- /*
- * Callback when the work is started.
- */
- public void workStarted(WorkEvent workEvent) {
- T work = getWork();
- listener.workStarted(work);
- }
-
- /*
- * Callback when the work is completed.
- */
- public void workCompleted(WorkEvent workEvent) {
- T work = getWork();
- Exception exception = workEvent.getException();
- if (exception != null) {
- listener.workFailed(work, exception);
- } else {
- listener.workCompleted(work);
- }
- }
-
- /*
- * Gets the underlying work from the work event.
- */
- private T getWork() {
- return work;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.java
deleted file mode 100644
index 91d00a58d9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManager.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.core.work;
-
-import java.rmi.server.UID;
-import java.util.Collection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.RejectedExecutionException;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.tuscany.sca.work.WorkSchedulerException;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * A thread-pool based implementation for the JSR-237 work manager.
- * <p/>
- * <p/>
- * This implementation supports only local work.
- * <p/>
- * TODO Elaborate the implementation. </p>
- *
- * @version $Rev$ $Date$
- */
-public class ThreadPoolWorkManager {
-
- // Map of work items currently handled by the work manager
- private Map<WorkItem, WorkListener> workItems = new ConcurrentHashMap<WorkItem, WorkListener>();
-
- // Thread-pool
- private ExecutorService executor;
-
- /**
- * Initializes the thread-pool.
- *
- * @param threadPoolSize Thread-pool size. If the size <1, then a cached pool is created
- */
- public ThreadPoolWorkManager(int threadPoolSize) {
- ThreadFactory factory = new ThreadFactory() {
- public Thread newThread(Runnable r) {
- Thread thread = new Thread(r);
- thread.setDaemon(true);
- return thread;
- }
- };
- if (threadPoolSize <= 1) {
-
- // Creates a new Executor, use a custom ThreadFactory that
- // creates daemon threads.
- executor = Executors.newCachedThreadPool(factory);
- } else {
- executor = Executors.newFixedThreadPool(threadPoolSize);
- }
- }
-
- /**
- * Schedules a unit of work asynchronously.
- *
- * @param work Work that needs to be scheduled.
- * @return Work Work item representing the asynchronous work
- */
- public WorkItem schedule(Work work) throws IllegalArgumentException {
- return schedule(work, null);
- }
-
- /**
- * Schedules a unit of work asynchronously.
- *
- * @param work Work that needs to be scheduled.
- * @param workListener Work listener for callbacks.
- * @return Work Work item representing the asynchronous work
- */
- public WorkItem schedule(Work work, WorkListener workListener) throws IllegalArgumentException {
-
- WorkItem workItem = new WorkItem(new UID().toString(), work);
- if (workListener != null) {
- workItems.put(workItem, workListener);
- }
- workAccepted(workItem, work);
- if (scheduleWork(work, workItem)) {
- return workItem;
- } else {
- workItem.setStatus(WorkEvent.WORK_REJECTED);
- if (workListener != null) {
- workListener.workRejected(new WorkEvent(workItem));
- }
- throw new IllegalArgumentException("Unable to schedule work");
- }
- }
-
- /**
- * Wait for all the specified units of work to finish.
- *
- * @param works Units of the work that need to finish.
- * @param timeout Timeout for waiting for the units of work to finish.
- */
- public boolean waitForAll(Collection works, long timeout) {
- throw new UnsupportedOperationException("waitForAll not supported");
- }
-
- /**
- * Wait for any of the specified units of work to finish.
- *
- * @param works Units of the work that need to finish.
- * @param timeout Timeout for waiting for the units of work to finish.
- */
- public Collection waitForAny(Collection works, long timeout) {
- throw new UnsupportedOperationException("waitForAny not supported");
- }
-
- /**
- * Method provided for subclasses to indicate a work acceptance.
- *
- * @param workItem Work item representing the work that was accepted.
- * @param work Work that was accepted.
- */
- private void workAccepted(final WorkItem workItem, final Work work) {
- WorkListener listener = workItems.get(workItem);
- if (listener != null) {
- workItem.setStatus(WorkEvent.WORK_ACCEPTED);
- WorkEvent event = new WorkEvent(workItem);
- listener.workAccepted(event);
- }
- }
-
- /*
- * Method to indicate a work start.
- */
- private void workStarted(final WorkItem workItem, final Work work) {
- WorkListener listener = workItems.get(workItem);
- if (listener != null) {
- workItem.setStatus(WorkEvent.WORK_STARTED);
- WorkEvent event = new WorkEvent(workItem);
- listener.workStarted(event);
- }
- }
-
- /*
- * Method to indicate a work completion.
- */
- private void workCompleted(final WorkItem workItem, final Work work) {
- workCompleted(workItem, work, null);
- }
-
- /*
- * Method to indicate a work completion.
- */
- private void workCompleted(final WorkItem workItem, final Work work, final WorkSchedulerException exception) {
- WorkListener listener = workItems.get(workItem);
- if (listener != null) {
- workItem.setStatus(WorkEvent.WORK_COMPLETED);
- workItem.setResult(work);
- workItem.setException(exception);
- WorkEvent event = new WorkEvent(workItem);
- listener.workCompleted(event);
- workItems.remove(workItem);
- }
- }
-
- /*
- * Schedules the work using the ThreadPool.
- */
- private boolean scheduleWork(final Work work, final WorkItem workItem) {
- try {
- executor.execute(new DecoratingWork(workItem, work));
- return true;
- } catch (RejectedExecutionException ex) {
- return false;
- }
- }
-
- /*
- * Class that decorates the original worker so that it can get callbacks when work is done.
- */
- private final class DecoratingWork implements Runnable {
-
- // Work item for this work.
- private WorkItem workItem;
-
- // The original work.
- private Work decoratedWork;
-
- /*
- * Initializes the work item and underlying work.
- */
- private DecoratingWork(final WorkItem workItem, final Work decoratedWork) {
- this.workItem = workItem;
- this.decoratedWork = decoratedWork;
- }
-
- /*
- * Overrides the run method.
- */
- public void run() {
- workStarted(workItem, decoratedWork);
- try {
- decoratedWork.run();
- workCompleted(workItem, decoratedWork);
- } catch (Throwable th) {
- workCompleted(workItem, decoratedWork, new WorkSchedulerException(th.getMessage(), th));
- }
- }
-
- }
-
- @Destroy
- public void destroy() {
- executor.shutdown();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Work.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Work.java
deleted file mode 100644
index c521c60f79..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/Work.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.work;
-
-/**
- * JCA work wrapper.
- *
- * @version $Rev$ $Date$
- */
-public class Work<T extends Runnable> {
-
- // Work that is being executed.
- private T work;
-
- /*
- * Initializes the work instance.
- */
- public Work(T work) {
- this.work = work;
- }
-
- /*
- * Returns the completed work.
- */
- public T getWork() {
- return work;
- }
-
- /*
- * Release the work.
- */
- public void release() {
- }
-
- /*
- * Work attributes are not daemon.
- */
- public boolean isDaemon() {
- return false;
- }
-
- /*
- * Runs the work.
- */
- public void run() {
- work.run();
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEvent.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEvent.java
deleted file mode 100644
index 8e9a3b4c53..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkEvent.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.core.work;
-
-import org.apache.tuscany.sca.work.WorkSchedulerException;
-
-
-
-/**
- * Default immutable implementation of the <code>WorkEvent</code> class.
- *
- * @version $Rev$ $Date$
- */
-class WorkEvent {
-
- public static final int WORK_ACCEPTED = 1;
- public static final int WORK_REJECTED = 2;
- public static final int WORK_STARTED = 3;
- public static final int WORK_COMPLETED = 4;
-
- // Work item for this event
- private WorkItem workItem;
-
- // Exception if something has gone wrong
- private WorkSchedulerException exception;
-
- /**
- * Instantiates the event.
- *
- * @param workItem Work item for this event.
- */
- public WorkEvent(final WorkItem workItem) {
- this.workItem = workItem;
- this.exception = workItem.getException();
- }
-
- /**
- * Returns the work type based on whether the work was accepted, started,
- * rejected or completed.
- *
- * @return Work type.
- */
- public int getType() {
- return workItem.getStatus();
- }
-
- /**
- * Returns the work item associated with this work type.
- *
- * @return Work item.
- */
- public WorkItem getWorkItem() {
- return workItem;
- }
-
- /**
- * Returns the exception if the work completed with an exception.
- *
- * @return Work exception.
- */
- public WorkSchedulerException getException() {
- return exception;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItem.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItem.java
deleted file mode 100644
index 8320c7364f..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkItem.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import org.apache.tuscany.sca.work.WorkSchedulerException;
-
-/**
- * An identity based immutable implementation of the <code>WorkItem</code>
- * interface.
- *
- * @version $Rev$ $Date$
- */
-class WorkItem {
-
- // Id scoped for the VM
- private String id;
-
- // Status
- private int status = -1;
-
- // Result
- private Work result;
-
- // Original work
- private Work originalWork;
-
- // Exception
- private WorkSchedulerException exception;
-
- /**
- * Instantiates an id for this item.
- *
- * @param id of this work event.
- */
- protected WorkItem(final String id, final Work orginalWork) {
- this.id = id;
- this.originalWork = orginalWork;
- }
-
- /**
- * Returns the id.
- *
- * @return Id of this item.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Returns the original work.
- *
- * @return Original work.
- */
- public Work getOriginalWork() {
- return originalWork;
- }
-
- /**
- * Returns the work result if the work completed.
- *
- * @return Work.
- * @throws WorkException If the work completed with an exception.
- */
- public Work getResult() {
- return result;
- }
-
- /**
- * Sets the result.
- *
- * @param result Result.
- */
- protected void setResult(final Work result) {
- this.result = result;
- }
-
- /**
- * Returns the exception if work completed with an exception.
- *
- * @return Work exception.
- */
- protected WorkSchedulerException getException() {
- return exception;
- }
-
- /**
- * Sets the exception.
- *
- * @param exception Exception.
- */
- protected void setException(final WorkSchedulerException exception) {
- this.exception = exception;
- }
-
- /**
- * Returns the work type based on whether the work was accepted, started,
- * rejected or completed.
- *
- * @return Work status.
- */
- public int getStatus() {
- return status;
- }
-
- /**
- * Sets the status.
- *
- * @param status Status.
- */
- protected void setStatus(final int status) {
- this.status = status;
- }
-
- /**
- * @see Object#hashCode()
- */
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- /**
- * Indicates whether some other object is "equal to" this one.
- *
- * @param obj Object to be compared.
- * @return true if this object is the same as the obj argument; false
- * otherwise..
- */
- @Override
- public boolean equals(final Object obj) {
- return (obj != null) && (obj.getClass() == WorkItem.class) && ((WorkItem) obj).id.equals(id);
- }
-
- /**
- * Compares this object with the specified object for order. Returns a
- * negative integer, zero, or a positive integer as this object is less
- * than, equal to, or greater than the specified object.
- *
- * @param o Object to be compared.
- * @return A negative integer, zero, or a positive integer as this object
- * is less than, equal to, or greater than the specified object.
- * @throws ClassCastException needs better documentation.
- */
- public int compareTo(final Object o) {
- if (o.getClass() != WorkItem.class) {
- throw new ClassCastException(o.getClass().getName());
- } else {
- return ((WorkItem) o).getId().compareTo(getId());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkListener.java b/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkListener.java
deleted file mode 100644
index 19bfaaa560..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/java/org/apache/tuscany/sca/core/work/WorkListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core.work;
-
-public interface WorkListener {
-
- static long IMMEDIATE = 0;
- static long INDEFINITE = java.lang.Long.MAX_VALUE;
-
- void workAccepted(WorkEvent event);
- void workCompleted(WorkEvent event);
- void workRejected(WorkEvent event);
- void workStarted(WorkEvent event);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 5f54178483..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.core.assembly.ReferenceParameterProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#referenceParameters,model=org.apache.tuscany.sca.runtime.ReferenceParameters
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager b/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
deleted file mode 100644
index 898054509b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.conversation.ConversationManager
+++ /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.core.conversation.ConversationManagerImpl
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint
deleted file mode 100644
index af281d8f4d..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint
+++ /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.core.invocation.DefaultProxyFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory b/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory
deleted file mode 100644
index bcbd5b0abf..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.invocation.MessageFactory
+++ /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.core.invocation.MessageFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler b/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
deleted file mode 100644
index 93d93491a8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/main/resources/META-INF/services/org.apache.tuscany.sca.work.WorkScheduler
+++ /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.core.work.DefaultWorkScheduler
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java
deleted file mode 100644
index 7b44736d4b..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistryTestCase.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-import junit.framework.TestCase;
-
-public class DefaultExtensionPointRegistryTestCase extends TestCase {
- private ExtensionPointRegistry registry;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- registry = new DefaultExtensionPointRegistry();
- }
-
- public void testRegistry() {
- MyRegistry service = new MyREgistryImpl();
- registry.addExtensionPoint(service);
- assertSame(service, registry.getExtensionPoint(MyRegistry.class));
- registry.removeExtensionPoint(service);
- assertNull(registry.getExtensionPoint(MyRegistry.class));
- }
-
- public static interface MyRegistry {
- void doSomething();
- }
-
- private static class MyREgistryImpl implements MyRegistry {
-
- public void doSomething() {
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
deleted file mode 100644
index 2bc78c3d35..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/BaseEventPublisherTestCase.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.event.Event;
-import org.apache.tuscany.sca.event.EventFilter;
-import org.apache.tuscany.sca.event.EventPublisher;
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.event.TrueFilter;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BaseEventPublisherTestCase extends TestCase {
- EventPublisher publisher;
-
- public void testFireListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.same(event));
- EasyMock.expectLastCall();
- EasyMock.replay(listener);
- publisher.addListener(listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testRemoveListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- EasyMock.replay(listener);
- publisher.addListener(listener);
- publisher.removeListener(listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testFalseFilterListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- EasyMock.replay(listener);
- publisher.addListener(new FalseFilter(), listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- public void testTrueFilterListener() {
- Event event = new TestEvent();
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.same(event));
- EasyMock.expectLastCall();
- EasyMock.replay(listener);
- publisher.addListener(new TrueFilter(), listener);
- publisher.publish(event);
- EasyMock.verify(listener);
- }
-
- @Override
- protected void setUp() throws Exception {
- publisher = new BaseEventPublisher() {
- };
- }
-
- private class TestEvent implements Event {
- public Object getSource() {
- return null;
- }
- }
-
- private class FalseFilter implements EventFilter {
-
- public boolean match(Event event) {
- return false;
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
deleted file mode 100644
index 48dcf8df07..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/event/EventTestCase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.event;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EventTestCase extends TestCase {
- private URI uri = URI.create("foo");
-
- public void testCompositeStart() {
- ComponentStart event = new ComponentStart(this, uri);
- assertEquals(uri, event.getComponentURI());
- }
-
- public void testCompositeStop() {
- ComponentStop event = new ComponentStop(this, uri);
- assertEquals(uri, event.getComponentURI());
- }
-
- public void testHttpSessionStart() {
- Object id = new Object();
- HttpSessionStart event = new HttpSessionStart(this, id);
- assertEquals(this, event.getSource());
- assertEquals(id, event.getSessionID());
- }
-
- public void testHttpSessionEnd() {
- Object id = new Object();
- HttpSessionEnd event = new HttpSessionEnd(this, id);
- assertEquals(this, event.getSource());
- assertEquals(id, event.getSessionID());
- }
-
- public void testRequestStart() {
- RequestStart event = new RequestStart(this);
- assertEquals(this, event.getSource());
- }
-
- public void testReequestEnd() {
- RequestEnd event = new RequestEnd(this);
- assertEquals(this, event.getSource());
- }
-
-
- @Override
- protected void setUp() throws Exception {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.java
deleted file mode 100644
index 99d5ec7bc9..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseManagerTestCase.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.core.invocation;
-
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PhaseManagerTestCase {
-
- @Test
- public void testDiscovery() {
- PhaseManager pm = new PhaseManager("org.apache.tuscany.sca.invocation.PhaseTest");
- List<String> phases = pm.getAllPhases();
- System.out.println(phases.size());
- System.out.println(phases);
- // Assert.assertEquals(15, phases.size());
- Assert.assertEquals("reference.first", phases.get(0));
-
- int rt = phases.indexOf("reference.transaction");
- Assert.assertTrue(rt > phases.indexOf("reference.interface"));
-
- int st = phases.indexOf("service.transaction");
- Assert.assertTrue(st > phases.indexOf("service.binding"));
-
- int it = phases.indexOf("implementation.transaction");
- Assert.assertTrue(it < phases.indexOf("implementation.policy"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.java
deleted file mode 100644
index 61164fa2de..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/invocation/PhaseSorterTestCase.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.core.invocation;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class PhaseSorterTestCase extends TestCase {
- private PhaseSorter<String> graph;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- graph = new PhaseSorter<String>();
- }
-
- public void testSort() {
- graph.addEdge("a", "b");
- graph.addEdge("a", "c");
- graph.addEdge("c", "d");
- graph.addEdge("b", "c");
- List<String> order = graph.topologicalSort(true);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(!graph.getVertices().isEmpty());
-
- graph.addEdge("d", "a");
- try {
- order = graph.topologicalSort(true);
- assertTrue("Should have failed", false);
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- graph.removeEdge("d", "a");
- order = graph.topologicalSort(false);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(graph.getVertices().isEmpty());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java
deleted file mode 100644
index 64114f7fb2..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/scope/AbstractScopeContainerTestCase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.scope;
-
-import java.net.URI;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.easymock.EasyMock;
-import org.easymock.IMocksControl;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class AbstractScopeContainerTestCase<T, KEY> extends TestCase {
- protected IMocksControl control;
- protected ScopeContainer<KEY> scopeContainer;
- protected URI groupId;
- protected KEY contextId;
- protected RuntimeComponent component;
- protected ScopedImplementation implementation;
- protected InstanceWrapper<T> wrapper;
-
- @SuppressWarnings("unchecked")
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- control = EasyMock.createStrictControl();
- component = control.createMock(RuntimeComponent.class);
- wrapper = control.createMock(InstanceWrapper.class);
- implementation = control.createMock(ScopedImplementation.class);
- EasyMock.expect(component.getImplementation()).andReturn(implementation).anyTimes();
- }
-
- protected void preRegisterComponent() throws Exception {
- scopeContainer.start();
- EasyMock.expect(implementation.isEagerInit()).andStubReturn(false);
- }
-
- protected void expectCreateWrapper() throws Exception {
- EasyMock.expect(implementation.createInstanceWrapper()).andReturn(wrapper);
- wrapper.start();
- }
-
- protected static interface ScopedImplementation extends ScopedImplementationProvider, Implementation {
-
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
deleted file mode 100644
index d46d77b4b8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/store/MemoryStoreTestCase.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.store;
-
-import java.util.UUID;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.event.RuntimeEventListener;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.store.DuplicateRecordException;
-import org.apache.tuscany.sca.store.Store;
-import org.apache.tuscany.sca.store.StoreExpirationEvent;
-import org.apache.tuscany.sca.store.StoreMonitor;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MemoryStoreTestCase extends TestCase {
- private StoreMonitor monitor;
-
- public void testEviction() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, 1);
- Thread.sleep(200);
- assertNull(store.readRecord(component, id));
- store.destroy();
- }
-
- public void testNotifyOnEviction() throws Exception {
- final CountDownLatch latch = new CountDownLatch(1);
- RuntimeEventListener listener = EasyMock.createMock(RuntimeEventListener.class);
- listener.onEvent(EasyMock.isA(StoreExpirationEvent.class));
- EasyMock.expectLastCall().andStubAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
- latch.countDown();
- return null;
- }
- });
- EasyMock.replay(listener);
- MemoryStore store = new MemoryStore(monitor);
- store.addListener(listener);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, 1);
- if (!latch.await(1000, TimeUnit.MILLISECONDS)) {
- // failed to notify listener
- fail();
- }
- EasyMock.verify(listener);
- }
-
- public void testNoEviction() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- Thread.sleep(100);
- assertNotNull(store.readRecord(component, id));
- store.destroy();
- }
-
- public void testInsertRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- store.destroy();
- }
-
- public void testInsertAlreadyExists() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createMock(RuntimeComponent.class);
- EasyMock.expect(component.getURI()).andReturn("component");
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- store.insertRecord(component, id, value, Store.NEVER);
- try {
- store.insertRecord(component, id, value, Store.NEVER);
- fail();
- } catch (DuplicateRecordException e) {
- //expected
- }
- store.destroy();
- }
-
- public void testUpdateRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
- Object newValue = new Object();
-
- store.insertRecord(component, id, value, Store.NEVER);
- store.updateRecord(component, id, newValue, 1L);
- assertEquals(newValue, store.readRecord(component, id));
- store.destroy();
- }
-
- public void testDeleteRecord() throws Exception {
- MemoryStore store = new MemoryStore(monitor);
- store.setReaperInterval(10);
- store.init();
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.replay(component);
- String id = UUID.randomUUID().toString();
- Object value = new Object();
-
- store.insertRecord(component, id, value, Store.NEVER);
- store.removeRecord(component, id);
- assertNull(store.readRecord(component, id));
- store.destroy();
- }
-
- @Override
- protected void setUp() throws Exception {
- monitor = EasyMock.createNiceMock(StoreMonitor.class);
- EasyMock.replay(monitor);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.java
deleted file mode 100644
index 1aba9656d8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/CallbackInterfaceInterceptorTestCase.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.core.wire;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.assembly.EndpointReferenceImpl;
-import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
-import org.apache.tuscany.sca.core.invocation.MessageFactoryImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Message;
-import org.easymock.EasyMock;
-import org.osoa.sca.NoRegisteredCallbackException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CallbackInterfaceInterceptorTestCase extends TestCase {
-
- public void testHasCallbackObject() {
- CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
- Interceptor next = EasyMock.createMock(Interceptor.class);
- EasyMock.expect(next.invoke(EasyMock.isA(Message.class))).andReturn(null);
- EasyMock.replay(next);
- interceptor.setNext(next);
- Message msg = new MessageFactoryImpl().createMessage();
- msg.setFrom(new EndpointReferenceImpl("uri"));
- msg.getFrom().getReferenceParameters().setCallbackObjectID("ABC");
- interceptor.invoke(msg);
- EasyMock.verify(next);
- }
-
- public void testNoCallbackObject() {
- CallbackInterfaceInterceptor interceptor = new CallbackInterfaceInterceptor();
- Message msg = new MessageFactoryImpl().createMessage();
- msg.setFrom(new EndpointReferenceImpl("uri"));
- msg.getFrom().getReferenceParameters().setCallbackObjectID(null);
- try {
- interceptor.invoke(msg);
- fail();
- } catch (NoRegisteredCallbackException e) {
- // expected
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.java
deleted file mode 100644
index 1ad0927d16..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/InvocationChainImplTestCase.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.core.wire;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.invocation.InvocationChainImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.invocation.Phase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InvocationChainImplTestCase extends TestCase {
-
- public void testInsertAtEnd() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, true);
- Interceptor inter2 = new MockInterceptor();
- Interceptor inter1 = new MockInterceptor();
- chain.addInterceptor(inter1);
- chain.addInterceptor(inter2);
- Interceptor head = (Interceptor)chain.getHeadInvoker();
- assertEquals(inter1, head);
- assertEquals(inter2, head.getNext());
- assertEquals(inter2, chain.getTailInvoker());
-
- }
-
- public void testAddByPhase() throws Exception {
- Operation op = newOperation("foo");
- InvocationChain chain = new InvocationChainImpl(op, op, false);
- Interceptor inter1 = new MockInterceptor();
- Interceptor inter2 = new MockInterceptor();
- Interceptor inter3 = new MockInterceptor();
- Interceptor inter4 = new MockInterceptor();
- chain.addInterceptor(inter3); // SERVICE
- chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, inter4);
- chain.addInterceptor(Phase.SERVICE_POLICY, inter2);
- chain.addInterceptor(Phase.SERVICE_BINDING, inter1);
- Interceptor head = (Interceptor)chain.getHeadInvoker();
- assertEquals(inter1, head);
- assertEquals(inter2, inter1.getNext());
- assertEquals(inter3, inter2.getNext());
- assertEquals(inter4, inter3.getNext());
- assertEquals(inter4, chain.getTailInvoker());
- }
-
- private class MockInterceptor implements Interceptor {
-
- private Invoker next;
-
- public Message invoke(Message msg) {
- return null;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.java
deleted file mode 100644
index b8150d4edc..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/wire/NonBlockingInterceptorTestCase.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.core.wire;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.getCurrentArguments;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.invocation.NonBlockingInterceptor;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.easymock.EasyMock;
-import org.easymock.IAnswer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NonBlockingInterceptorTestCase extends TestCase {
-
- public void testInvoke() throws Exception {
- WorkScheduler scheduler = createMock(WorkScheduler.class);
- scheduler.scheduleWork(isA(Runnable.class));
- expectLastCall().andStubAnswer(new IAnswer<Object>() {
- public Object answer() throws Throwable {
- Runnable runnable = (Runnable) getCurrentArguments()[0];
- runnable.run();
- return null;
- }
- });
- replay(scheduler);
- Message context = createMock(Message.class);
- //String convID = "convID";
- //TODO port to the new way of dealing with conversation IDs later
- //EasyMock.expect(context.getConversationID()).andReturn(convID);
- EasyMock.replay(context);
- ThreadMessageContext.setMessageContext(context);
- Message msg = createMock(Message.class);
- //TODO port to the new way of dealing with conversation IDs later
- //msg.setConversationID(convID);
- Interceptor next = EasyMock.createMock(Interceptor.class);
- EasyMock.expect(next.invoke(EasyMock.eq(msg))).andReturn(msg);
- EasyMock.expect(msg.isFault()).andReturn(false);
- EasyMock.replay(next);
- EasyMock.replay(msg);
- Interceptor interceptor = new NonBlockingInterceptor(scheduler, next);
- interceptor.invoke(msg);
- verify(context);
- verify(next);
- verify(msg);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java
deleted file mode 100644
index c69a1908e8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/FailingWork.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-
-/**
- * Simple Work item that will throw an exception
- *
- * @version $Rev$ $Date$
- */
-public class FailingWork extends Work {
-
- public FailingWork() {
- super(null);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isDaemon() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public void release() {
- }
-
- /**
- * Throws an IllegalArgumentException
- */
- public void run() {
- System.out.println("Starting " + this + " and throwing an Exception");
- throw new IllegalArgumentException("Sample exception from " + this);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.java
deleted file mode 100644
index 91b45dfbcb..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyFailingRunnable.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.core.work;
-
-/**
- * Simple Runnable that throws an IllegalArgumentException
- *
- * @version $Rev$ $Date$
- */
-public class JSR237MyFailingRunnable extends JSR237MyRunnable {
-
- /**
- * Constructor
- */
- public JSR237MyFailingRunnable() {
- super(-1);
- }
-
- /**
- * Sleeps for a period of time defined by sleepTime
- */
- @Override
- public void run() {
- System.out.println("Starting " + this + " and throwing an Exception");
- throw new IllegalArgumentException("Sample exception from " + this);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.java
deleted file mode 100644
index a7617f7a70..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnable.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.core.work;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Simple Runnable that is used for testing Jsr237WorkScheduler
- *
- * @version $Rev$ $Date$
- */
-public class JSR237MyRunnable implements Runnable {
-
- /**
- * Count of workAccepted() method calls
- */
- private AtomicInteger runCompletedCount = new AtomicInteger();
-
- /**
- * The amount of time to sleep in the Run loop
- */
- private final long sleepTime;
-
- /**
- * Constructor
- *
- * @param sleepTime The amount of time to sleep (in milliseconds) in the run() method
- */
- public JSR237MyRunnable(long sleepTime) {
- this.sleepTime = sleepTime;
- }
-
- /**
- * Sleeps for a period of time defined by sleepTime
- */
- public void run() {
- System.out.println("Starting " + this);
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("Done " + this);
- runCompletedCount.incrementAndGet();
- }
-
- /**
- * Returns the number of completed calls to run()
- *
- * @return The number of completed calls to run()
- */
- public int getRunCompletedCount() {
- return runCompletedCount.get();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java
deleted file mode 100644
index 75840efef4..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/JSR237MyRunnerListener.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.tuscany.sca.work.NotificationListener;
-
-/**
- * Simple NotificationListener that is used for testing Jsr237WorkScheduler
- *
- * @version $Rev$ $Date$
- */
-public class JSR237MyRunnerListener implements NotificationListener<JSR237MyRunnable> {
-
- /**
- * Count of workAccepted() method calls
- */
- private AtomicInteger workAcceptedCallCount = new AtomicInteger();
-
- /**
- * Count of workStarted() method calls
- */
- private AtomicInteger workStartedCallCount = new AtomicInteger();
-
- /**
- * Count of workCompleted() method calls
- */
- private AtomicInteger workCompletedCallCount = new AtomicInteger();
-
- /**
- * Count of workFailed() method calls
- */
- private AtomicInteger workFailedCallCount = new AtomicInteger();
-
- /**
- * Count of workRejected() method calls
- */
- private AtomicInteger workRejectedCallCount = new AtomicInteger();
-
- /**
- * List of all exceptions thrown by Work items
- */
- private List<Throwable> workExceptions = Collections.synchronizedList(new ArrayList<Throwable>());
-
- /**
- * {@inheritDoc}
- */
- public void workAccepted(JSR237MyRunnable work) {
- workAcceptedCallCount.incrementAndGet();
- }
-
- /**
- * {@inheritDoc}
- */
- public void workCompleted(JSR237MyRunnable work) {
- workCompletedCallCount.incrementAndGet();
- }
-
- /**
- * {@inheritDoc}
- */
- public void workFailed(JSR237MyRunnable work, Throwable error) {
- workExceptions.add(error);
- workFailedCallCount.incrementAndGet();
- }
-
- /**
- * {@inheritDoc}
- */
- public void workRejected(JSR237MyRunnable work) {
- workRejectedCallCount.incrementAndGet();
- }
-
- /**
- * {@inheritDoc}
- */
- public void workStarted(JSR237MyRunnable work) {
- workStartedCallCount.incrementAndGet();
- }
-
- /**
- * Returns the number of calls to workAccepted()
- *
- * @return The number of calls to workAccepted()
- */
- public int getWorkAcceptedCallCount() {
- return workAcceptedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workStarted()
- *
- * @return The number of calls to workStarted()
- */
- public int getWorkStartedCallCount() {
- return workStartedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workCompleted()
- *
- * @return The number of calls to workCompleted()
- */
- public int getWorkCompletedCallCount() {
- return workCompletedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workFailed()
- *
- * @return The number of calls to workFailed()
- */
- public int getWorkFailedCallCount() {
- return workFailedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workRejected()
- *
- * @return The number of calls to workRejected()
- */
- public int getWorkRejectedCallCount() {
- return workRejectedCallCount.get();
- }
-
- /**
- * Returns a List of all exceptions that are thrown by the Work items
- *
- * @return A List of all exceptions that are thrown by the Work items
- */
- public List<Throwable> getWorkExceptions() {
- return Collections.unmodifiableList(workExceptions);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java
deleted file mode 100644
index 185394d7e8..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/Jsr237WorkSchedulerTestCase.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test case for Jsr237WorkScheduler
- *
- * @version $Rev$ $Date$
- */
-public class Jsr237WorkSchedulerTestCase {
-
- /**
- * Wait up to 20 seconds for the Work units to complete
- */
- private static final long WAIT_TIMEOUT = 20000;
-
- /**
- * This is the shared instance of the ThreadPoolWorkManager used by the tests
- */
- private static DefaultWorkScheduler workSchedular = null;
-
- /**
- * Setup the Jsr237WorkScheduler
- */
- @BeforeClass
- public static void setup() {
- workSchedular = new DefaultWorkScheduler();
- }
-
- /**
- * Make sure that the Jsr237WorkScheduler is stopped after running the tests
- */
- @AfterClass
- public static void destroy() {
- if (workSchedular != null) {
- workSchedular.destroy();
- }
- }
-
- /**
- * Tests running a single fast job on the Jsr237WorkScheduler
- */
- @Test
- public void testSingleFastJob() {
- // Create the work and register it
- JSR237MyRunnable fast = new JSR237MyRunnable(10);
- JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
- workSchedular.scheduleWork(fast, listener);
-
- // Wait for the 1 job to complete
- waitForWorkToComplete(listener, 1);
-
- // Test that the job completed successfully.
- Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(1, listener.getWorkStartedCallCount());
- Assert.assertEquals(1, listener.getWorkCompletedCallCount());
- Assert.assertEquals(0, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a single job that fails on the Jsr237WorkScheduler
- */
- @Test
- public void testSingleFailingJob() {
- // Create the work and register it
- JSR237MyFailingRunnable fail = new JSR237MyFailingRunnable();
- JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
- workSchedular.scheduleWork(fail, listener);
-
- // Wait for the 1 job to complete
- waitForWorkToComplete(listener, 1);
-
- // Test that the job completed successfully.
- Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(1, listener.getWorkStartedCallCount());
- Assert.assertEquals(0, listener.getWorkCompletedCallCount());
- Assert.assertEquals(1, listener.getWorkFailedCallCount());
- Assert.assertEquals(1, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a mixture of fast and slow jobs on the Jsr237WorkScheduler
- */
- @Test
- public void testMultipleJobs() {
- // Create the work and register it
- JSR237MyRunnable fast1 = new JSR237MyRunnable(50);
- JSR237MyRunnable fast2 = new JSR237MyRunnable(100);
- JSR237MyRunnable fast3 = new JSR237MyRunnable(200);
- JSR237MyRunnable slow1= new JSR237MyRunnable(2000);
- JSR237MyRunnable slow2 = new JSR237MyRunnable(2000);
- JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
- workSchedular.scheduleWork(fast1, listener);
- workSchedular.scheduleWork(fast2, listener);
- workSchedular.scheduleWork(fast3, listener);
- workSchedular.scheduleWork(slow1, listener);
- workSchedular.scheduleWork(slow2, listener);
-
- // Wait for the 5 jobs to complete
- waitForWorkToComplete(listener, 5);
-
- // Test that the job completed successfully.
- Assert.assertEquals(5, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(5, listener.getWorkStartedCallCount());
- Assert.assertEquals(5, listener.getWorkCompletedCallCount());
- Assert.assertEquals(0, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a mixture of fast and slow jobs some of which fail on the
- * Jsr237WorkScheduler
- */
- @Test
- public void testMultipleJobsSomeFail() {
- // Create the work and register it
- JSR237MyRunnable fast1 = new JSR237MyRunnable(50);
- JSR237MyRunnable fast2 = new JSR237MyRunnable(100);
- JSR237MyRunnable fast3 = new JSR237MyRunnable(200);
- JSR237MyRunnable slow1= new JSR237MyRunnable(2000);
- JSR237MyRunnable slow2 = new JSR237MyRunnable(2000);
- JSR237MyFailingRunnable fail1 = new JSR237MyFailingRunnable();
- JSR237MyFailingRunnable fail2 = new JSR237MyFailingRunnable();
- JSR237MyRunnerListener listener = new JSR237MyRunnerListener();
- workSchedular.scheduleWork(fast1, listener);
- workSchedular.scheduleWork(fast2, listener);
- workSchedular.scheduleWork(fail1, listener);
- workSchedular.scheduleWork(fast3, listener);
- workSchedular.scheduleWork(slow1, listener);
- workSchedular.scheduleWork(fail2, listener);
- workSchedular.scheduleWork(slow2, listener);
-
- // Wait for the 7 jobs to complete
- waitForWorkToComplete(listener, 7);
-
- // Test that the job completed successfully.
- Assert.assertEquals(7, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(7, listener.getWorkStartedCallCount());
- Assert.assertEquals(5, listener.getWorkCompletedCallCount());
- Assert.assertEquals(2, listener.getWorkFailedCallCount());
- Assert.assertEquals(2, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a single job that has no listener
- */
- @Test
- public void testSingleFastJobWithNoListener() {
- // Create the work and register it
- JSR237MyRunnable fast = new JSR237MyRunnable(10);
- workSchedular.scheduleWork(fast);
-
- // Wait for the job to complete
- long startTime = System.currentTimeMillis();
- while (true) {
- int completedCount = fast.getRunCompletedCount();
- if (completedCount == 1) {
- break;
- }
-
- if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
- Assert.fail("Only " + completedCount + " work items completed before timeout");
- return;
- }
-
- // Lets wait for the job to complete
- try {
- Thread.sleep(25);
- } catch (InterruptedException ex) {
- Assert.fail("Unexpected exception: " + ex);
- }
- }
- }
-
- /**
- * Tests scheduling a null as the work item
- */
- @Test
- public void testNullWork() {
- try {
- workSchedular.scheduleWork(null);
- Assert.fail("Should have thrown IllegalArgumentException ");
- } catch (IllegalArgumentException ex) {
- // As expected
- Assert.assertTrue(ex.toString().indexOf("null") != -1);
- }
- }
-
- /**
- * Waits for the specified number of jobs to complete or the timeout to fire.
- *
- * @param listener The listener to use to track Work unit completion
- * @param completedWorkItemsToWaitFor The number of Work items to complete
- */
- private void waitForWorkToComplete(JSR237MyRunnerListener listener, int completedWorkItemsToWaitFor) {
- long startTime = System.currentTimeMillis();
- while (true) {
- int completedCount = listener.getWorkCompletedCallCount() + listener.getWorkFailedCallCount();
- if (completedCount == completedWorkItemsToWaitFor) {
- return;
- }
-
- if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
- Assert.fail("Only " + completedCount + " work items completed before timeout");
- return;
- }
-
- // Lets wait for more jobs to complete
- try {
- Thread.sleep(25);
- } catch (InterruptedException ex) {
- Assert.fail("Unexpected exception: " + ex);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java
deleted file mode 100644
index 58a1b87c48..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TestWorkListener.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.tuscany.sca.work.WorkSchedulerException;
-import org.junit.Assert;
-
-/**
- * A simple WorkListener that tracks invocations to it.
- *
- * @version $Rev$ $Date$
- */
-public class TestWorkListener implements WorkListener {
-
- /**
- * Count of workAccepted() method calls
- */
- private AtomicInteger workAcceptedCallCount = new AtomicInteger();
-
- /**
- * Count of workStarted() method calls
- */
- private AtomicInteger workStartedCallCount = new AtomicInteger();
-
- /**
- * Count of workCompleted() method calls
- */
- private AtomicInteger workCompletedCallCount = new AtomicInteger();
-
- /**
- * Count of workRejected() method calls
- */
- private AtomicInteger workRejectedCallCount = new AtomicInteger();
-
- /**
- * List of all exceptions thrown by Work items
- */
- private List<WorkSchedulerException> workExceptions = Collections.synchronizedList(new ArrayList<WorkSchedulerException>());
-
- /**
- * {@inheritDoc}
- */
- public void workAccepted(WorkEvent work) {
- workAcceptedCallCount.incrementAndGet();
-
- // Validate the WorkEvent
- Assert.assertNotNull(work.getWorkItem());
- Assert.assertEquals(WorkEvent.WORK_ACCEPTED, work.getType());
- }
-
- /**
- * {@inheritDoc}
- */
- public void workStarted(WorkEvent work) {
- workStartedCallCount.incrementAndGet();
-
- // Validate the WorkEvent
- Assert.assertNotNull(work.getWorkItem());
- Assert.assertEquals(WorkEvent.WORK_STARTED, work.getType());
- }
-
- /**
- * {@inheritDoc}
- */
- public void workCompleted(WorkEvent work) {
- if (work.getException() != null) {
- workExceptions.add(work.getException());
- }
-
- // Validate the WorkEvent
- Assert.assertNotNull(work.getWorkItem());
- Assert.assertEquals(WorkEvent.WORK_COMPLETED, work.getType());
-
- workCompletedCallCount.incrementAndGet();
- }
-
- /**
- * {@inheritDoc}
- */
- public void workRejected(WorkEvent work) {
- workRejectedCallCount.incrementAndGet();
-
- // Validate the WorkEvent
- Assert.assertNotNull(work.getWorkItem());
- Assert.assertEquals(WorkEvent.WORK_REJECTED, work.getType());
- }
-
- /**
- * Returns the number of calls to workAccepted()
- *
- * @return The number of calls to workAccepted()
- */
- public int getWorkAcceptedCallCount() {
- return workAcceptedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workStarted()
- *
- * @return The number of calls to workStarted()
- */
- public int getWorkStartedCallCount() {
- return workStartedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workCompleted()
- *
- * @return The number of calls to workCompleted()
- */
- public int getWorkCompletedCallCount() {
- return workCompletedCallCount.get();
- }
-
- /**
- * Returns the number of calls to workRejected()
- *
- * @return The number of calls to workRejected()
- */
- public int getWorkRejectedCallCount() {
- return workRejectedCallCount.get();
- }
-
- /**
- * Returns a List of all exceptions that are thrown by the Work items
- *
- * @return A List of all exceptions that are thrown by the Work items
- */
- public List<WorkSchedulerException> getWorkExceptions() {
- return Collections.unmodifiableList(workExceptions);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java
deleted file mode 100644
index 9e5b8d035e..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/ThreadPoolWorkManagerTestCase.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.core.work;
-
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * This test case will test the ThreadPoolWorkManager
- *
- * @version $Rev$ $Date$
- */
-public class ThreadPoolWorkManagerTestCase {
-
- /**
- * Wait up to 20 seconds for the Work units to complete
- */
- private static final long WAIT_TIMEOUT = 20000;
-
- /**
- * This is the shared instance of the ThreadPoolWorkManager used by the tests
- */
- private static ThreadPoolWorkManager workManager = null;
-
- /**
- * Setup the ThreadPoolWorkManager
- */
- @BeforeClass
- public static void setup() {
- workManager = new ThreadPoolWorkManager(10);
- }
-
- /**
- * Make sure that the ThreadPoolWorkManager is stopped after running the tests
- */
- @AfterClass
- public static void destroy() {
- if (workManager != null) {
- workManager.destroy();
- }
- }
-
- /**
- * Tests running a single fast job on the ThreadPoolWorkManager
- */
- @Test
- public void testSingleFastJob() {
- // Create the work and register it
- TimeDelayWork fast = new TimeDelayWork(10);
- TestWorkListener listener = new TestWorkListener();
- workManager.schedule(fast, listener);
-
- // Wait for the 1 job to complete
- waitForWorkToComplete(listener, 1);
-
- // Test that the job completed successfully.
- Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(1, listener.getWorkStartedCallCount());
- Assert.assertEquals(1, listener.getWorkCompletedCallCount());
- Assert.assertEquals(0, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a single job that fails on the ThreadPoolWorkManager
- */
- @Test
- public void testSingleFailingJob() {
- // Create the work and register it
- FailingWork fail = new FailingWork();
- TestWorkListener listener = new TestWorkListener();
- workManager.schedule(fail, listener);
-
- // Wait for the 1 job to complete
- waitForWorkToComplete(listener, 1);
-
- // Test that the job completed successfully.
- Assert.assertEquals(1, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(1, listener.getWorkStartedCallCount());
- Assert.assertEquals(1, listener.getWorkCompletedCallCount());
- Assert.assertEquals(1, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a mixture of fast and slow jobs on the ThreadPoolWorkManager
- */
- @Test
- public void testMultipleJobs() {
- // Create the work and register it
- TimeDelayWork fast1 = new TimeDelayWork(50);
- TimeDelayWork fast2 = new TimeDelayWork(100);
- TimeDelayWork fast3 = new TimeDelayWork(200);
- TimeDelayWork slow1= new TimeDelayWork(2000);
- TimeDelayWork slow2 = new TimeDelayWork(2000);
- TestWorkListener listener = new TestWorkListener();
- workManager.schedule(fast1, listener);
- workManager.schedule(fast2, listener);
- workManager.schedule(fast3, listener);
- workManager.schedule(slow1, listener);
- workManager.schedule(slow2, listener);
-
- // Wait for the 5 jobs to complete
- waitForWorkToComplete(listener, 5);
-
- // Test that the job completed successfully.
- Assert.assertEquals(5, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(5, listener.getWorkStartedCallCount());
- Assert.assertEquals(5, listener.getWorkCompletedCallCount());
- Assert.assertEquals(0, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests running a mixture of fast and slow jobs some of which fail on the
- * ThreadPoolWorkManager
- */
- @Test
- public void testMultipleJobsSomeFail() {
- // Create the work and register it
- TimeDelayWork fast1 = new TimeDelayWork(50);
- TimeDelayWork fast2 = new TimeDelayWork(100);
- TimeDelayWork fast3 = new TimeDelayWork(200);
- TimeDelayWork slow1= new TimeDelayWork(2000);
- TimeDelayWork slow2 = new TimeDelayWork(2000);
- FailingWork fail1 = new FailingWork();
- FailingWork fail2 = new FailingWork();
- TestWorkListener listener = new TestWorkListener();
- workManager.schedule(fast1, listener);
- workManager.schedule(fast2, listener);
- workManager.schedule(fail1, listener);
- workManager.schedule(fast3, listener);
- workManager.schedule(slow1, listener);
- workManager.schedule(fail2, listener);
- workManager.schedule(slow2, listener);
-
- // Wait for the 7 jobs to complete
- waitForWorkToComplete(listener, 7);
-
- // Test that the job completed successfully.
- Assert.assertEquals(7, listener.getWorkAcceptedCallCount());
- Assert.assertEquals(0, listener.getWorkRejectedCallCount());
- Assert.assertEquals(7, listener.getWorkStartedCallCount());
- Assert.assertEquals(7, listener.getWorkCompletedCallCount());
- Assert.assertEquals(2, listener.getWorkExceptions().size());
- }
-
- /**
- * Tests creating a ThreadPoolWorkManager with invalid pool sizes of -10 to 0
- * inclusive
- */
- @Test
- public void testThreadPoolWorkManagerLessThan1Size() {
- for (int i = 0; i >= -10; i--) {
- new ThreadPoolWorkManager(i);
- }
- }
-
- /**
- * Tests running a single job that has no listener
- */
- @Test
- public void testSingleFastJobWithNoListener() {
- // Create the work and register it
- TimeDelayWork fast = new TimeDelayWork(10);
- workManager.schedule(fast);
-
- // Wait for the job to complete
- long startTime = System.currentTimeMillis();
- while (true) {
- int completedCount = fast.getRunCompletedCount();
- if (completedCount == 1) {
- break;
- }
-
- if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
- Assert.fail("Only " + completedCount + " work items completed before timeout");
- return;
- }
-
- // Lets wait for the job to complete
- try {
- Thread.sleep(25);
- } catch (InterruptedException ex) {
- Assert.fail("Unexpected exception: " + ex);
- }
- }
-
- // Make sure we have got one completed run
- Assert.assertEquals(1, fast.getRunCompletedCount());
- }
-
- /**
- * Waits for the specified number of jobs to complete or the timeout to fire.
- *
- * @param listener The listener to use to track Work unit completion
- * @param completedWorkItemsToWaitFor The number of Work items to complete
- */
- private void waitForWorkToComplete(TestWorkListener listener, int completedWorkItemsToWaitFor) {
- long startTime = System.currentTimeMillis();
- while (true) {
- int completedCount = listener.getWorkCompletedCallCount();
- if (completedCount == completedWorkItemsToWaitFor) {
- return;
- }
-
- if (System.currentTimeMillis() - startTime > WAIT_TIMEOUT) {
- Assert.fail("Only " + completedCount + " work items completed before timeout");
- return;
- }
-
- // Lets wait for more jobs to complete
- try {
- Thread.sleep(25);
- } catch (InterruptedException ex) {
- Assert.fail("Unexpected exception: " + ex);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.java
deleted file mode 100644
index 6c10057046..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/core/work/TimeDelayWork.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.core.work;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * Simple Work item that will sleep in the run() method for the specified
- * period of time
- *
- * @version $Rev$ $Date$
- */
-public class TimeDelayWork extends Work {
-
- /**
- * Count of completed run() method calls
- */
- private AtomicInteger runCompletedCount = new AtomicInteger();
-
- /**
- * The amount of time to sleep in the Run loop
- */
- private final long sleepTime;
-
- /**
- * Constructor
- *
- * @param sleepTime The amount of time to sleep (in milliseconds) in the run() method
- */
- public TimeDelayWork(long sleepTime) {
- super(null);
- this.sleepTime = sleepTime;
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean isDaemon() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- public void release() {
- }
-
- /**
- * Sleeps for a period of time defined by sleepTime
- */
- public void run() {
- System.out.println("Starting " + this);
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- System.out.println("Done " + this);
- runCompletedCount.incrementAndGet();
- }
-
- /**
- * Returns the number of completed calls to run()
- *
- * @return The number of completed calls to run()
- */
- public int getRunCompletedCount() {
- return runCompletedCount.get();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java b/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.java
deleted file mode 100644
index 341d889b7d..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/java/org/apache/tuscany/sca/scope/ScopeTestCase.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.scope;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.scope.Scope;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ScopeTestCase extends TestCase {
-
- public void testEquals() throws Exception {
- Scope scope = new Scope("COMPOSITE");
- assertTrue(scope.equals(Scope.COMPOSITE));
- }
-
- public void testEqualsNew() throws Exception {
- Scope foo = new Scope("foo");
- Scope foo2 = new Scope("FOO");
- assertTrue(foo.equals(foo2));
- }
-
- public void testNotEquals() throws Exception {
- Scope foo = new Scope("BAR");
- Scope foo2 = new Scope("FOO");
- assertFalse(foo.equals(foo2));
- }
-
- public void testNotEqualsDifferent() throws Exception {
- Scope foo = new Scope("FOO");
- assertFalse(foo.equals(new Bar("FOO")));
- }
-
- public class Bar {
- String scope;
-
- public Bar(String scope) {
- this.scope = scope;
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest b/branches/sca-java-1.5.1/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
deleted file mode 100644
index ad23df3761..0000000000
--- a/branches/sca-java-1.5.1/modules/core/src/test/resources/META-INF/services/org.apache.tuscany.sca.invocation.PhaseTest
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-name=implementation.last, stage=implementation, after=*
-name=reference.first, stage=reference, before=*
-name=reference.transaction, stage=reference, after=reference.interface
-name=reference.binding.header, stage=reference.binding, after=reference.binding.transport
-name=service.binding.header, stage=service.binding, after=service.binding.transport
-name=service.transaction, stage=service, after=service.binding, before=component.service
-name=implementation.transaction, stage=implementation, before=implementation.policy
diff --git a/branches/sca-java-1.5.1/modules/data-api/LICENSE b/branches/sca-java-1.5.1/modules/data-api/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/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-java-1.5.1/modules/data-api/NOTICE b/branches/sca-java-1.5.1/modules/data-api/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/data-api/pom.xml b/branches/sca-java-1.5.1/modules/data-api/pom.xml
deleted file mode 100644
index f92af70d24..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/pom.xml
+++ /dev/null
@@ -1,58 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-data-api</artifactId>
- <name>Apache Tuscany SCA Data API</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.data.api</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.data*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java
deleted file mode 100644
index f559d5d914..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Collection.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.collection;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Collection <K, D> {
-
- /**
- * Get the whole collection.
- *
- * @return the whole collection.
- */
- Entry<K, D>[] getAll();
-
- /**
- * Returns a collection resulting from a query.
- *
- * @return the collection.
- */
- Entry<K, D>[] query(String queryString);
-
- /**
- * Creates a new item.
- *
- * @param key
- * @param item
- * @return
- */
- K post(K key, D item);
-
- /**
- * Retrieves an item.
- *
- * @param key
- * @return
- */
- D get(K key) throws NotFoundException;
-
- /**
- * Updates an item.
- *
- * @param key
- * @param item
- * @return
- */
- void put(K key, D item) throws NotFoundException;
-
- /**
- * Delete an item.
- *
- * @param key
- */
- void delete(K key) throws NotFoundException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java
deleted file mode 100644
index 5903fd95a4..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Entry.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.collection;
-
-
-/**
- * Represents a key/data pair in a data collection.
- *
- * @version $Rev$ $Date$
- */
-public class Entry <K, D> {
-
- private K key;
- private D data;
-
- /**
- * Constructs a new entry.
- */
- public Entry() {
- }
-
- /**
- * Constructs a new entry.
- * @param key the entry key
- * @param data the entry data
- */
- public Entry(K key, D data) {
- this.key = key;
- this.data = data;
- }
-
- /**
- * Returns the entry key.
- * @return the key
- */
- public K getKey() {
- return key;
- }
-
- /**
- * Sets the entry key.
- * @param key the key
- */
- public void setKey(K key) {
- this.key = key;
- }
-
- /**
- * Returns the entry data.
- * @return the entry data
- */
- public D getData() {
- return data;
- }
-
- /**
- * Sets the entry data
- * @param data the entry data
- */
- public void setData(D data) {
- this.data = data;
- }
-
- //FIXME Temporary methods to make JAXB register the Item
- // class when the Entry class is registered in a JAXB context
- public void setDummy(Item item) {}
- public Item getDummy() { return null; }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java
deleted file mode 100644
index 37042c0895..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/Item.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.data.collection;
-
-import java.util.Date;
-
-
-/**
- * Represents a data item.
- *
- * @version $Rev$ $Date$
- */
-public class Item {
-
- private String title;
- private String contents;
- private String link;
- private String related;
- private String alternate;
- private Date date;
-
- /**
- * Constructs a new item.
- */
- public Item() {
- }
-
- /**
- * Constructs a new item.
- * @param title the item title
- * @param contents the item contents
- * @param link the item link to a web resource
- * @param related the item link to a related web resource
- * @param date the item date
- */
- public Item(String title, String contents, String link, String related, Date date) {
- this.title = title;
- this.contents = contents;
- this.link = link;
- this.related = related;
- this.date = date;
- }
-
- /**
- * Returns the item title.
- * @return the item title
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * Sets the item title.
- * @param title the item title
- */
- public void setTitle(String title) {
- this.title = title;
- }
-
- /**
- * Returns the item contents
- * @return the item contents
- */
- public String getContents() {
- return contents;
- }
-
- /**
- * Sets the item contents
- * @param contents the item contents
- */
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- /**
- * Returns the item link to a web resource
- * @return the item link to a web resource
- */
- public String getLink() {
- return link;
- }
-
- /**
- * Sets the item link to a web resource
- * @param link the item link to a web resource
- */
- public void setLink(String link) {
- this.link = link;
- }
-
- /**
- * Returns the item link to a related web resource
- * @return the item link to a related web resource
- */
- public String getRelated() {
- return related;
- }
-
- /**
- * Sets the item link to a related web resource.
- *
- * @param related the item link to a related web resource
- */
- public void setRelated(String related) {
- this.related = related;
- }
-
- /**
- * Returns the item link to an alternate web resource
- * @return the item link to an alternate web resource
- */
- public String getAlternate() {
- return alternate;
- }
-
- /**
- * Sets the item link to an alternate web resource.
- *
- * @param alternate the item link to an alternate web resource
- */
- public void setAlternate(String alternate) {
- this.alternate = alternate;
- }
-
- /**
- * Returns the item date
- * @return the item date
- */
- public Date getDate() {
- return date;
- }
-
- /**
- * Sets the item date
- * @param date the item date
- */
- public void setDate(Date date) {
- this.date = date;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.java
deleted file mode 100644
index c30bbc771a..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/ItemCollection.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.data.collection;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface ItemCollection extends Collection<String, Item> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.java
deleted file mode 100644
index 69512058b7..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/LocalItemCollection.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.data.collection;
-
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-public interface LocalItemCollection extends Collection<String, Item> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.java
deleted file mode 100644
index 7f13db5228..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/data/collection/NotFoundException.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.data.collection;
-
-/**
- * Indicates that an item could not be found in a collection.
- *
- * @version $Rev$ $Date$
- */
-public class NotFoundException extends Exception {
- private static final long serialVersionUID = 6792367409396084646L;
-
- public NotFoundException() {
- }
-
- public NotFoundException(String message) {
- super(message);
- }
-
- public NotFoundException(Throwable cause) {
- super(cause);
- }
-
- public NotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.java
deleted file mode 100644
index c2332ae2c9..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Collection.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.implementation.data.collection;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-@Deprecated
-public interface Collection <K, D> extends org.apache.tuscany.sca.data.collection.Collection<K, D> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.java
deleted file mode 100644
index a0d232a201..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Entry.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.implementation.data.collection;
-
-
-/**
- * Represents a key/data pair in a data collection.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class Entry <K, D> extends org.apache.tuscany.sca.data.collection.Entry<K, D> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.java
deleted file mode 100644
index 77d8173521..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/Item.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.implementation.data.collection;
-
-
-
-/**
- * Represents a data item.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class Item extends org.apache.tuscany.sca.data.collection.Item {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.java
deleted file mode 100644
index 757152725d..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/ItemCollection.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.implementation.data.collection;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-@Deprecated
-public interface ItemCollection extends Collection<String, Item> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.java
deleted file mode 100644
index 047ab8829e..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/LocalItemCollection.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.implementation.data.collection;
-
-
-/**
- * Provides access to a collection of data items.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public interface LocalItemCollection extends Collection<String, Item> {
-}
diff --git a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java b/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.java
deleted file mode 100644
index ed71471d9e..0000000000
--- a/branches/sca-java-1.5.1/modules/data-api/src/main/java/org/apache/tuscany/sca/implementation/data/collection/NotFoundException.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.implementation.data.collection;
-
-/**
- * Indicates that an item could not be found in a collection.
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public class NotFoundException extends org.apache.tuscany.sca.data.collection.NotFoundException {
- private static final long serialVersionUID = 2812975065056330240L;
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/LICENSE b/branches/sca-java-1.5.1/modules/databinding-axiom/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/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-java-1.5.1/modules/databinding-axiom/NOTICE b/branches/sca-java-1.5.1/modules/databinding-axiom/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/pom.xml b/branches/sca-java-1.5.1/modules/databinding-axiom/pom.xml
deleted file mode 100644
index cc97112f9c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/pom.xml
+++ /dev/null
@@ -1,122 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-axiom</artifactId>
- <name>Apache Tuscany SCA Data Binding for Axiom</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0-2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.axiom</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.axiom*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.java
deleted file mode 100644
index 142229f4f6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomDataBinding.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.databinding.axiom;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * DataBinding for AXIOM
- *
- * @version $Rev$ $Date$
- */
-public class AxiomDataBinding extends BaseDataBinding {
-
- public static final String NAME = OMElement.class.getName();
-
- public AxiomDataBinding() {
- super(NAME, OMElement.class);
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseDataBinding#getWrapperHandler()
- */
- @Override
- public WrapperHandler getWrapperHandler() {
- return new OMElementWrapperHandler();
- }
-
- @Override
- public Object copy(Object source, DataType dataType, Operation operation) {
- if ( OMElement.class.isAssignableFrom(source.getClass()) ) {
- try {
- OMElement sourceElement = (OMElement)source;
- return sourceElement.cloneOMElement();
- } catch ( Exception e ) {
- throw new IllegalArgumentException(e);
- }
- }
- return super.copy(source, dataType, operation);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.java
deleted file mode 100644
index cd820ab4b4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/AxiomHelper.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.databinding.axiom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Helper for AXIOM
- *
- * @version $Rev$ $Date$
- */
-public class AxiomHelper {
- private static final String DEFAULT_PREFIX = "_ns_";
-
- private AxiomHelper() {
- }
-
- /**
- * See http://issues.apache.org/jira/browse/WSCOMMONS-240
- * @param om
- */
- public static void completeAndClose(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- }
- OMElement document = builder.getDocumentElement();
- if (document != null) {
- document.build();
- }
- }
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).close();
- }
- }
-
- /**
- * This method will close the builder immediately. Any subsequent Axiom objects won't
- * be built or accessible.
- */
- public static void closeImmediately(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- ((StAXBuilder)builder).close();
- }
- // builder.close();
- }
- }
-
- /**
- * @param context
- * @param element
- */
- public static void adjustElementName(TransformationContext context, OMElement element) {
- if (context != null) {
- DataType dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (!(logical instanceof XMLType)) {
- return;
- }
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
- // FIXME:: Throw exception or switch to the new Element?
- OMFactory factory = OMAbstractFactory.getOMFactory();
- QName name = xmlType.getElementName();
- OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
- element.setNamespace(namespace);
- element.setLocalName(name.getLocalPart());
- }
- }
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(localName, ns);
-
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element, OMDataSource dataSource) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(dataSource, localName, ns);
-
- }
-
- /**
- * @param factory
- * @param name
- * @return
- */
- public static OMNamespace createOMNamespace(OMFactory factory, QName name) {
- String namespaceURI = name.getNamespaceURI();
- String prefix = name.getPrefix();
-
- OMNamespace ns = null;
-
- // Qualified Element: we need an OMNamespace
- if (prefix.length() == 0) {
- // The prefix does not appear to be specified, let's create one
- prefix = DEFAULT_PREFIX;
- }
- ns = factory.createOMNamespace(namespaceURI, prefix);
-
- return ns;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.java
deleted file mode 100644
index 429a6dbe5d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Exception2OMElement.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.databinding.axiom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.javabeans.Java2XMLMapperException;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Exception2OMElement extends JavaBean2XMLTransformer<OMElement> {
-
- public static final String GETCAUSE = "getCause";
- public static final String GETLOCALIZEDMESSAGE = "getLocalizedMessage";
- public static final String GETSTACKTRACE = "getStackTrace";
- public static final String GETCLASS = "getClass";
-
- private OMFactory factory;
-
- public Exception2OMElement() {
- super();
- factory = OMAbstractFactory.getOMFactory();
- }
-
- @Override
- public OMElement transform(Object source, TransformationContext context) {
- OMElement element = super.transform(source, context);
- AxiomHelper.adjustElementName(context, element);
- return element;
- }
-
- @Override
- protected boolean isMappedGetter(String methodName) {
- if (GETCAUSE.equals(methodName)
- || GETLOCALIZEDMESSAGE.equals(methodName)
- || GETSTACKTRACE.equals(methodName)
- || GETCLASS.equals(methodName)) {
- return false;
- } else {
- return true;
- }
- }
-
- @Override
- public void appendChild(OMElement parentElement, OMElement childElement) throws Java2XMLMapperException {
- parentElement.addChild(childElement);
- }
-
- @Override
- public OMElement createElement(QName qName) throws Java2XMLMapperException {
- return factory.createOMElement(qName);
- }
-
- @Override
- public void appendText(OMElement parentElement, String textData) throws Java2XMLMapperException {
- if (textData == null) {
- OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
- OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
- parentElement.addAttribute(nil);
- } else {
- factory.createOMText(parentElement, textData);
- }
- }
-
- @Override
- public Class getTargetType() {
- return OMElement.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.java
deleted file mode 100644
index e23d89327c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Externalizable2OMElement.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.databinding.axiom;
-
-import java.io.ByteArrayOutputStream;
-import java.io.Externalizable;
-import java.io.ObjectOutputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Externalizable2OMElement extends BaseTransformer<Externalizable, OMElement> implements
- PullTransformer<Externalizable, OMElement> {
-
- @Override
- protected Class<Externalizable> getSourceType() {
- return Externalizable.class;
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- public OMElement transform(Externalizable source, TransformationContext context) {
- OMElement element = null;
-
- try {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(bos);
- out.writeObject(source);
- out.close();
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMNamespace ns = AxiomHelper.createOMNamespace(factory, new QName("http://callable"));
- element = factory.createOMElement("reference",ns);
- element.setText(Base64Binary.encode(bos.toByteArray()));
- return element;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java
deleted file mode 100644
index 3dc73c89cb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Exception.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.OMText;
-import org.apache.tuscany.sca.databinding.javabeans.XML2JavaBeanTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.XML2JavaMapperException;
-
-/**
- * Transformer to convert data from an OMElement to a Java Exception
- *
- * @version $Rev$ $Date$
- */
-public class OMElement2Exception extends XML2JavaBeanTransformer<OMElement> {
-
- @Override
- public OMElement getRootElement(OMElement element) throws XML2JavaMapperException {
- return element;
- }
-
- @Override
- public Iterator<OMElement> getChildElements(OMElement parent) throws XML2JavaMapperException {
- return parent.getChildElements();
- }
-
- @Override
- public String getElementName(OMElement element) throws XML2JavaMapperException {
- return element.getLocalName();
- }
-
- @Override
- public String getText(OMElement element) throws XML2JavaMapperException {
- return element.getText();
- }
-
- @Override
- public boolean isTextElement(OMElement element) throws XML2JavaMapperException {
- return false;
- }
-
- @Override
- public boolean isTextOnly(OMElement element) throws XML2JavaMapperException {
- OMNode firstChild = element.getFirstOMChild();
- return firstChild instanceof OMText && firstChild.getNextOMSibling() == null;
- }
-
- @Override
- public OMElement getFirstChildWithName(OMElement element, QName name) throws XML2JavaMapperException {
- return element.getFirstChildWithName(name);
- }
-
- @Override
- public Class getSourceType() {
- return OMElement.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java
deleted file mode 100644
index ef7359fbcd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Externalizable.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import java.io.ByteArrayInputStream;
-import java.io.Externalizable;
-import java.io.ObjectInputStream;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter.Base64Binary;
-
-/**
- * Transformer to convert data from an OMElement to XML String
- *
- * @version $Rev$ $Date$
- */
-public class OMElement2Externalizable extends BaseTransformer<OMElement, Externalizable> implements PullTransformer<OMElement, Externalizable> {
- // private XmlOptions options;
-
- public Externalizable transform(OMElement source, TransformationContext context) {
- try {
- String value = source.getText();
- ByteArrayInputStream bis = new ByteArrayInputStream(Base64Binary.decode(value));
- ObjectInputStream ois = new ObjectInputStream(bis);
- Object obj = ois.readObject();
- ois.close();
- Externalizable aReference = (Externalizable) obj;
- return aReference;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<OMElement> getSourceType() {
- return OMElement.class;
- }
-
- @Override
- protected Class<Externalizable> getTargetType() {
- return Externalizable.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
deleted file mode 100644
index ea40e61746..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2Object.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
-
-/**
- * Transformer to convert data from a simple java Object to OMElement.
- *
- * @version $Rev$ $Date$
- */
-public class OMElement2Object extends SimpleType2JavaTransformer<OMElement> {
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer#close(java.lang.Object)
- */
- @Override
- protected void close(OMElement source) {
- if (source != null) {
- AxiomHelper.completeAndClose(source);
- }
- }
-
- @Override
- protected String getText(OMElement source) {
- return source.getText();
- }
-
- @Override
- public Class getSourceType() {
- return OMElement.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
deleted file mode 100644
index b2c004324c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2String.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import java.io.StringWriter;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transformer to convert data from an OMElement to XML String
- *
- * @version $Rev$ $Date$
- */
-public class OMElement2String extends BaseTransformer<OMElement, String> implements PullTransformer<OMElement, String> {
- // private XmlOptions options;
-
- public String transform(OMElement source, TransformationContext context) {
- try {
- StringWriter writer = new StringWriter();
- source.serialize(writer);
- return writer.toString();
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<OMElement> getSourceType() {
- return OMElement.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.java
deleted file mode 100644
index 01e7003b20..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElement2XMLStreamReader.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.databinding.axiom;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OMElement2XMLStreamReader extends BaseTransformer<OMElement, XMLStreamReader> implements
- PullTransformer<OMElement, XMLStreamReader> {
- // private XmlOptions options;
-
- public static final QName QNAME_NIL = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil");
-
- public XMLStreamReader transform(OMElement source, TransformationContext context) {
- if (source == null) {
- return null;
- } else {
- if ("true".equals(source.getAttributeValue(QNAME_NIL))) {
- return null;
- } else {
- return source.getXMLStreamReader();
- }
- }
- }
-
- @Override
- protected Class<OMElement> getSourceType() {
- return OMElement.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
deleted file mode 100644
index be8d1a2ead..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/OMElementWrapperHandler.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.axiom;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * OMElement wrapper handler implementation
- *
- * @version $Rev$ $Date$
- */
-public class OMElementWrapperHandler implements WrapperHandler<OMElement> {
-
- private OMFactory factory;
-
- public OMElementWrapperHandler() {
- super();
- this.factory = OMAbstractFactory.getOMFactory();
- }
-
- public OMElement create(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- OMElement wrapper = AxiomHelper.createOMElement(factory, element.getQName());
- return wrapper;
- }
-
- public void setChildren(OMElement wrapper, Object[] childObjects, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- for (int i = 0; i < childElements.size(); i++) {
- setChild(wrapper, i, childElements.get(i), childObjects[i]);
- }
-
- }
-
- public void setChild(OMElement wrapper, int i, ElementInfo childElement, Object value) {
- if (childElement.isMany()) {
- Object[] elements = (Object[])value;
- if (value != null) {
- for (Object e : elements) {
- addChild(wrapper, childElement, (OMElement)e);
- }
- }
- } else {
- OMElement element = (OMElement)value;
- addChild(wrapper, childElement, element);
- }
- }
-
- private void addChild(OMElement wrapper, ElementInfo childElement, OMElement element) {
- if (element == null) {
- OMElement e = wrapper.getOMFactory().createOMElement(childElement.getQName(), wrapper);
- attachXSINil(e);
- return;
- }
- QName elementName = childElement.getQName();
- // Make it a bit tolerating of element QName
- if (!elementName.equals(element.getQName())) {
- OMNamespace namespace = factory.createOMNamespace(elementName.getNamespaceURI(), elementName.getPrefix());
- element.setNamespace(namespace);
- element.setLocalName(childElement.getQName().getLocalPart());
- }
- wrapper.addChild(element);
- }
-
- public List getChildren(OMElement wrapper, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- List<Object> elements = new ArrayList<Object>();
- int i = 0;
- for (ElementInfo e : childElements) {
- elements.add(getChild(wrapper, e, i));
- i++;
- }
- return elements;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- DataType<XMLType> wrapperType =
- new DataTypeImpl<XMLType>(AxiomDataBinding.NAME, OMElement.class, new XMLType(element));
- return wrapperType;
- }
-
- public boolean isInstance(Object wrapperObj, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- OMElement wrapper = (OMElement)wrapperObj;
- if (!element.getQName().equals(wrapper.getQName())) {
- return false;
- }
- return true;
- /*
- Set<QName> names = new HashSet<QName>();
- for (ElementInfo e : childElements) {
- names.add(e.getQName());
- }
- for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
- OMElement child = (OMElement)i.next();
- if (!names.contains(child.getQName())) {
- return false;
- }
- }
- return true;
- */
- }
-
- private static final QName XSI_TYPE_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "type", "xsi");
-
- private List<List<OMElement>> getElements(OMElement wrapper) {
- List<List<OMElement>> elements = new ArrayList<List<OMElement>>();
- List<OMElement> current = new ArrayList<OMElement>();
- elements.add(current);
- boolean first = true;
- QName last = null;
-
- for (Iterator i = wrapper.getChildElements(); i.hasNext();) {
- OMElement element = (OMElement)i.next();
- if (first || element.getQName().equals(last)) {
- current.add(element);
- last = element.getQName();
- } else {
- current = new ArrayList<OMElement>();
- elements.add(current);
- current.add(element);
- last = element.getQName();
- }
- first = false;
- }
- return elements;
- }
-
- public Object getChild(OMElement wrapper, ElementInfo childElement, int index) {
- Iterator children = wrapper.getChildrenWithName(childElement.getQName());
- if (!children.hasNext()) {
- // No name match, try by index
- List<List<OMElement>> list = getElements(wrapper);
- List<OMElement> elements = list.get(index);
- if (!childElement.isMany()) {
- return elements.isEmpty() ? null : attachXSIType(childElement, elements.get(0));
- } else {
- Object[] array = elements.toArray();
- for (Object item : array) {
- attachXSIType(childElement, (OMElement)item);
- }
- return array;
- }
- }
- if (!childElement.isMany()) {
- if (children.hasNext()) {
- OMElement child = (OMElement)children.next();
- attachXSIType(childElement, child);
- return child;
- } else {
- return null;
- }
- } else {
- List<OMElement> elements = new ArrayList<OMElement>();
- for (; children.hasNext();) {
- OMElement child = (OMElement)children.next();
- attachXSIType(childElement, child);
- elements.add(child);
- }
- return elements.toArray();
- }
- }
-
- /**
- * Create xis:type if required
- * @param childElement
- * @param element
- * @return
- */
- private OMElement attachXSIType(ElementInfo childElement, OMElement element) {
- TypeInfo type = childElement.getType();
- if (type != null && type.getQName() != null) {
- OMAttribute attr = element.getAttribute(XSI_TYPE_QNAME);
- if (attr == null) {
- String typeNS = type.getQName().getNamespaceURI();
- if (XMLConstants.W3C_XML_SCHEMA_NS_URI.equals(typeNS)) {
- return element;
- }
- OMNamespace ns = element.getOMFactory().createOMNamespace(typeNS, "_typens_");
- element.declareNamespace(ns);
- OMNamespace xsiNS =
- element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(),
- XSI_TYPE_QNAME.getPrefix());
- element.declareNamespace(xsiNS);
- attr =
- element.getOMFactory().createOMAttribute("type",
- xsiNS,
- "_typens_:" + type.getQName().getLocalPart());
- element.addAttribute(attr);
- }
- }
- return element;
- }
-
- private void attachXSINil(OMElement element) {
- OMNamespace xsiNS =
- element.getOMFactory().createOMNamespace(XSI_TYPE_QNAME.getNamespaceURI(), XSI_TYPE_QNAME.getPrefix());
- element.declareNamespace(xsiNS);
- OMAttribute attr = element.getOMFactory().createOMAttribute("nil", xsiNS, "true");
- element.addAttribute(attr);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.java
deleted file mode 100644
index 88d6b462c1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/Object2OMElement.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.databinding.axiom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
-
-/**
- * Transformer to convert data from an simple OMElement to Java Object
- *
- * @version $Rev$ $Date$
- */
-public class Object2OMElement extends Java2SimpleTypeTransformer<OMElement> {
-
- private OMFactory factory;
-
- public Object2OMElement() {
- super();
- factory = OMAbstractFactory.getOMFactory();
- }
-
- @Override
- protected OMElement createElement(QName element, String text, TransformationContext context) {
- OMElement omElement = AxiomHelper.createOMElement(factory, element);
- if (text == null) {
- OMNamespace xsi = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
- OMAttribute nil = factory.createOMAttribute("nil", xsi, "true");
- omElement.addAttribute(nil);
- } else {
- factory.createOMText(omElement, text);
- }
- return omElement;
- }
-
- @Override
- public Class getTargetType() {
- return OMElement.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
deleted file mode 100644
index 9eccd52d74..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/String2OMElement.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import java.io.ByteArrayInputStream;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class String2OMElement extends BaseTransformer<String, OMElement> implements
- PullTransformer<String, OMElement> {
-
- @SuppressWarnings("unchecked")
- public OMElement transform(String source, TransformationContext context) {
- try {
- StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(source.getBytes()));
- OMElement element = builder.getDocumentElement();
- AxiomHelper.adjustElementName(context, element);
- return element;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
deleted file mode 100644
index 761185c297..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/java/org/apache/tuscany/sca/databinding/axiom/XMLStreamReader2OMElement.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2OMElement extends BaseTransformer<XMLStreamReader, OMElement> implements
- PullTransformer<XMLStreamReader, OMElement> {
-
- public XMLStreamReader2OMElement() {
- super();
- }
-
- public OMElement transform(XMLStreamReader source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- StAXOMBuilder builder = new StAXOMBuilder(source);
- OMElement element = builder.getDocumentElement();
- AxiomHelper.adjustElementName(context, element);
- return element;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index 183270f9b4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /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.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.axiom.AxiomDataBinding;name=org.apache.axiom.om.OMElement
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index a1f18f9638..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /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.
-
-# Implementation classes for the transformers
-# org.apache.tuscany.sca.databinding.axiom.CallableReference2OMElement;source=org.osoa.sca.CallableReference,target=org.apache.axiom.om.OMElement,weight=10
-# org.apache.tuscany.sca.databinding.axiom.OMElement2CallableReference;source=org.apache.axiom.om.OMElement,target=org.osoa.sca.CallableReference,weight=10
-org.apache.tuscany.sca.databinding.axiom.Externalizable2OMElement;source=java.io.Externalizable,target=org.apache.axiom.om.OMElement,weight=10
-org.apache.tuscany.sca.databinding.axiom.OMElement2Externalizable;source=org.apache.axiom.om.OMElement,target=java.io.Externalizable,weight=10
-org.apache.tuscany.sca.databinding.axiom.Exception2OMElement;source=java:exception,target=org.apache.axiom.om.OMElement,weight=10
-org.apache.tuscany.sca.databinding.axiom.OMElement2Exception;source=org.apache.axiom.om.OMElement,target=java:exception,weight=10
-# org.apache.tuscany.sca.databinding.axiom.Object2OMElement;source=java:simpleType,target=org.apache.axiom.om.OMElement,weight=80000
-# org.apache.tuscany.sca.databinding.axiom.OMElement2Object;source=org.apache.axiom.om.OMElement,target=java:simpleType,weight=80000
-org.apache.tuscany.sca.databinding.axiom.OMElement2String;source=org.apache.axiom.om.OMElement,target=java.lang.String,weight=80
-org.apache.tuscany.sca.databinding.axiom.OMElement2XMLStreamReader;source=org.apache.axiom.om.OMElement,target=javax.xml.stream.XMLStreamReader,weight=60
-org.apache.tuscany.sca.databinding.axiom.String2OMElement;source=java.lang.String,target=org.apache.axiom.om.OMElement,weight=80
-org.apache.tuscany.sca.databinding.axiom.XMLStreamReader2OMElement;source=javax.xml.stream.XMLStreamReader,target=org.apache.axiom.om.OMElement,weight=60
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java b/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
deleted file mode 100644
index 7453cb787a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/java/org/apache/tuscany/sca/databinding/axiom/OMElementTestCase.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.axiom;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OMElementTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- public final void testStringTransform() {
- String2OMElement t1 = new String2OMElement();
- OMElement element = t1.transform(IPO_XML, null);
- OMElement2String t2 = new OMElement2String();
- String xml = t2.transform(element, null);
- Assert.assertNotNull(xml);
- Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
- }
-
- public final void testStringTransform2() {
- String str =
- "<p0:firstName xmlns:xml=\"http://www.w3.org/XML/1998/namespace\" " + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- + "xmlns:p0=\"http://helloworld\">Robert</p0:firstName>";
- String2OMElement t1 = new String2OMElement();
- OMElement element = t1.transform(str, null);
- OMElement2String t2 = new OMElement2String();
- String xml = t2.transform(element, null);
- Assert.assertNotNull(xml);
- Assert.assertNotNull(xml.indexOf("<ipo:comment>") != -1);
- }
-
- public final void testStAXTransform() {
- String2OMElement t1 = new String2OMElement();
- OMElement element = t1.transform(IPO_XML, null);
-
- OMElement2XMLStreamReader t2 = new OMElement2XMLStreamReader();
- XMLStreamReader reader = t2.transform(element, null);
-
- XMLStreamReader2OMElement t3 = new XMLStreamReader2OMElement();
- OMElement element2 = t3.transform(reader, null);
-
- Assert.assertEquals(element2.getQName(), element.getQName());
- Assert.assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), element2.getQName());
- }
-
- public final void testCopy() {
- String2OMElement t1 = new String2OMElement();
- OMElement element = t1.transform(IPO_XML, null);
- OMElement copy = (OMElement)new AxiomDataBinding().copy(element, null, null);
- assertNotSame(element, copy);
- assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getQName());
- }
-
- private static final QName XSI_NIL = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
-
- public final void testNil() {
- Object2OMElement t1 = new Object2OMElement();
- TransformationContext context = new TransformationContextImpl();
- DataType<XMLType> dataType =
- new DataTypeImpl<XMLType>(int.class, new XMLType(new QName("http://ns1", "nilElement"),
- SimpleTypeMapperImpl.XSD_INT));
- context.setTargetDataType(dataType);
- OMElement element = t1.transform(null, context);
- OMAttribute attribute = element.getAttribute(XSI_NIL);
- Assert.assertNotNull(attribute);
- Assert.assertEquals("true", attribute.getAttributeValue());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xml b/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xml
deleted file mode 100644
index df901d183d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<ipo:purchaseOrder
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ipo="http://www.example.com/IPO"
- xsi:schemaLocation="http://www.example.com/IPO ipo.xsd"
- orderDate="1999-12-01">
-
- <shipTo exportCode="1" xsi:type="ipo:UKAddress">
- <name>Helen Zoe</name>
- <street>47 Eden Street</street>
- <city>Cambridge</city>
- <postcode>CB1 1JR</postcode>
- </shipTo>
-
- <billTo xsi:type="ipo:USAddress">
- <name>Robert Smith</name>
- <street>8 Oak Avenue</street>
- <city>Old Town</city>
- <state>PA</state>
- <zip>95819</zip>
- </billTo>
-
- <items>
- <item partNum="833-AA">
- <productName>Lapis necklace</productName>
- <quantity>1</quantity>
- <USPrice>99.95</USPrice>
- <ipo:comment>Want this for the holidays</ipo:comment>
- <shipDate>1999-12-05</shipDate>
- </item>
- </items>
-</ipo:purchaseOrder>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xsd
deleted file mode 100755
index af1e73172d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,137 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/order.wsdl b/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/order.wsdl
deleted file mode 100644
index a5ead60382..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-axiom/src/test/resources/order.wsdl
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
- xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
- <element name="checkOrderStatus">
- <complexType>
- <sequence>
- <element name="customerId" type="string" />
- <element name="order" type="ipo:PurchaseOrderType" />
- <element name="flag" type="int" />
- </sequence>
- </complexType>
- </element>
- <element name="checkOrderStatusResponse">
- <complexType>
- <sequence>
- <element name="status" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="note" type="string" />
- </schema>
- </types>
-
- <message name="CheckOrderStatusInput1">
- <part name="body" element="xsd1:checkOrderStatus" />
- </message>
-
- <message name="CheckOrderStatusOutput1">
- <part name="body" element="xsd1:checkOrderStatusResponse" />
- </message>
-
- <message name="CheckOrderStatusInput2">
- <part name="p1" element="xsd1:checkOrderStatus" />
- <part name="p2" element="xsd1:note" />
- </message>
-
- <message name="CheckOrderStatusOutput2">
- <part name="p1" element="xsd1:checkOrderStatusResponse" />
- </message>
-
- <portType name="OrderPortType">
- <operation name="checkOrderStatus">
- <input message="tns:CheckOrderStatusInput1" />
- <output message="tns:CheckOrderStatusOutput1" />
- </operation>
- <operation name="checkOrderStatus2">
- <input message="tns:CheckOrderStatusInput2" />
- <output message="tns:CheckOrderStatusOutput2" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/LICENSE b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/databinding-fastinfoset/NOTICE b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/NOTICE
deleted file mode 100644
index d83ebbe236..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/NOTICE
+++ /dev/null
@@ -1,14 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2006 The Apache Software Foundation
-
-Apache Tuscany is an effort undergoing incubation at The Apache Software
-Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
-required of all newly accepted projects until a further review indicates that
-the infrastructure, communications, and decision making process have stabilized
-in a manner consistent with other successful ASF projects. While incubation
-status is not necessarily a reflection of the completeness or stability of the
-code, it does indicate that the project has yet to be fully endorsed by the ASF.
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/pom.xml b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/pom.xml
deleted file mode 100644
index 0a95be2097..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/pom.xml
+++ /dev/null
@@ -1,87 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-fastinfoset</artifactId>
- <name>Apache Tuscany SCA Data Binding for FastInfoset</name>
- <description>Tuscany FastInfoset Data Binding</description>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.fastinfoset</groupId>
- <artifactId>FastInfoset</artifactId>
- <version>1.2.2</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.1</version>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>java.net</id>
- <name>java.net Maven 1.x Repository</name>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.fastinfoset</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.fastinfoset*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java
deleted file mode 100644
index 2e0aa629f3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2Node.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.fastinfoset;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import com.sun.xml.fastinfoset.dom.DOMDocumentParser;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FastInfoset2Node extends BaseTransformer<InputStream, Node> implements
- PullTransformer<InputStream, Node> {
-
- @Override
- protected Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- public Node transform(InputStream source, TransformationContext context) {
- try {
- DOMDocumentParser parser = new DOMDocumentParser();
- Document doc = DOMHelper.newDocument();
- parser.parse(doc, source);
- return doc.getDocumentElement();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getSourceDataBinding() {
- return "xml:fastinfoset:java.io.InputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.java
deleted file mode 100644
index 77f6b77636..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2SAX.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.databinding.fastinfoset;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-
-import com.sun.xml.fastinfoset.sax.SAXDocumentParser;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FastInfoset2SAX extends BaseTransformer<InputStream, ContentHandler> implements
- PushTransformer<InputStream, ContentHandler> {
-
- @Override
- protected Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(InputStream source, ContentHandler target, TransformationContext context) {
- try {
- SAXDocumentParser parser = new SAXDocumentParser();
- parser.setContentHandler(target);
- parser.parse(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getSourceDataBinding() {
- return "xml:fastinfoset:java.io.InputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.java
deleted file mode 100644
index 73d549f4f8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfoset2XMLStreamReader.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.databinding.fastinfoset;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-import com.sun.xml.fastinfoset.stax.StAXDocumentParser;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FastInfoset2XMLStreamReader extends BaseTransformer<InputStream, XMLStreamReader> implements
- PullTransformer<InputStream, XMLStreamReader> {
-
- @Override
- protected Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- public XMLStreamReader transform(InputStream source, TransformationContext context) {
- try {
- StAXDocumentParser parser = new StAXDocumentParser(source);
- return parser;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getSourceDataBinding() {
- return "xml:fastinfoset:java.io.InputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.java
deleted file mode 100644
index 1c12a5dcad..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/Node2FastInfoset.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.databinding.fastinfoset;
-
-import java.io.OutputStream;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-import com.sun.xml.fastinfoset.dom.DOMDocumentSerializer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class Node2FastInfoset extends BaseTransformer<Node, OutputStream> implements
- PushTransformer<Node, OutputStream> {
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<OutputStream> getTargetType() {
- return OutputStream.class;
- }
-
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(Node source, OutputStream target, TransformationContext context) {
- try {
- DOMDocumentSerializer serializer = new DOMDocumentSerializer();
- serializer.setOutputStream(target);
- serializer.serialize(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getTargetDataBinding() {
- return "xml:fastinfoset:java.io.OutputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java
deleted file mode 100644
index b0d56b3bb6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLInputStream2FastInfoset.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.fastinfoset;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-import com.sun.xml.fastinfoset.sax.SAXDocumentSerializer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLInputStream2FastInfoset extends BaseTransformer<InputStream, OutputStream> implements
- PushTransformer<InputStream, OutputStream> {
-
- @Override
- protected Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- protected Class<OutputStream> getTargetType() {
- return OutputStream.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(InputStream source, OutputStream target, TransformationContext context) {
- try {
-
- // Create Fast Infoset SAX serializer
- SAXDocumentSerializer saxDocumentSerializer = new SAXDocumentSerializer();
- // Set the output stream
- saxDocumentSerializer.setOutputStream(target);
-
- // Instantiate JAXP SAX parser factory
- SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
- /* Set parser to be namespace aware
- * Very important to do otherwise invalid FI documents will be
- * created by the SAXDocumentSerializer
- */
- saxParserFactory.setNamespaceAware(true);
- // Instantiate the JAXP SAX parser
- SAXParser saxParser = saxParserFactory.newSAXParser();
- // Set the lexical handler
- saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", saxDocumentSerializer);
- // Parse the XML document and convert to a fast infoset document
- saxParser.parse(source, saxDocumentSerializer);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getTargetDataBinding() {
- return "xml:fastinfoset:java.io.OutputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java
deleted file mode 100644
index d18206600c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/java/org/apache/tuscany/sca/databinding/fastinfoset/XMLStreamReader2FastInfoset.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.fastinfoset;
-
-import java.io.OutputStream;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
-
-import com.sun.xml.fastinfoset.stax.StAXDocumentSerializer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2FastInfoset extends BaseTransformer<XMLStreamReader, OutputStream> implements
- PushTransformer<XMLStreamReader, OutputStream> {
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<OutputStream> getTargetType() {
- return OutputStream.class;
- }
-
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(XMLStreamReader source, OutputStream target, TransformationContext context) {
- try {
- StAXDocumentSerializer serializer = new StAXDocumentSerializer(target);
- XMLStreamSerializer streamSerializer = new XMLStreamSerializer();
- streamSerializer.serialize(source, serializer);
- serializer.flush();
- source.close();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getTargetDataBinding() {
- return "xml:fastinfoset:java.io.OutputStream";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index ea47ee7191..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2Node;source=xml:fastinfoset:java.io.InputStream,target=org.w3c.dom.Node,weight=100
-org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2XMLStreamReader;source=xml:fastinfoset:java.io.InputStream,target=javax.xml.stream.XMLStreamReader,weight=80
-
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
deleted file mode 100644
index 1610b4f54d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.fastinfoset.FastInfoset2SAX;source=xml:fastinfoset:java.io.InputStream,target=org.xml.sax.ContentHandler ,weight=80
-org.apache.tuscany.sca.databinding.fastinfoset.Node2FastInfoset;source=org.w3c.dom.Node,target=xml:fastinfoset:java.io.OutputStream,weight=100
-org.apache.tuscany.sca.databinding.fastinfoset.XMLInputStream2FastInfoset;source=java.io.InputStream,target=xml:fastinfoset:java.io.OutputStream,weight=120
-org.apache.tuscany.sca.databinding.fastinfoset.XMLStreamReader2FastInfoset;source=javax.xml.stream.XMLStreamReader,target=xml:fastinfoset:java.io.OutputStream,weight=70
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java
deleted file mode 100644
index bb8adf39be..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/java/org/apache/tuscany/sca/databinding/fastinfoset/FastInfosetTransformerTestCase.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.fastinfoset;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.xml.InputStream2Node;
-import org.apache.tuscany.sca.databinding.xml.Node2OutputStream;
-import org.apache.tuscany.sca.databinding.xml.Node2String;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class FastInfosetTransformerTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- public void testXML2FastInfoset() throws Exception {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
- XMLStreamReader2FastInfoset t1 = new XMLStreamReader2FastInfoset();
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
-
- t1.transform(reader, bos, null);
- // System.out.println(bos.toString());
-
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- FastInfoset2Node t2 = new FastInfoset2Node();
- Node node = t2.transform(bis, null);
- String xml = new Node2String().transform(node, null);
-
- // System.out.println(xml);
-
- }
-
- public void testPerf() throws Exception {
- byte[] str = IPO_XML.getBytes();
- ByteArrayInputStream bis = new ByteArrayInputStream(str);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLInputStream2FastInfoset t = new XMLInputStream2FastInfoset();
- t.transform(bis, bos, null);
- byte[] fast = bos.toByteArray();
- System.out.println(str.length + ".vs." + fast.length);
-
- long d1 = 0L;
- long d2 = 0L;
- for (int i = 0; i < 100; i++) {
- InputStream2Node t1 = new InputStream2Node();
- FastInfoset2Node t2 = new FastInfoset2Node();
- InputStream is1 = new ByteArrayInputStream(str);
- InputStream is2 = new ByteArrayInputStream(fast);
- long s1 = System.currentTimeMillis();
- Node n1 = t1.transform(is1, null);
- long s2 = System.currentTimeMillis();
- Node n2 = t2.transform(is2, null);
- long s3 = System.currentTimeMillis();
- d1 += s2 - s1; // from plain xml
- d2 += s3 - s2; // from fastinfoset
- Node2OutputStream t3 = new Node2OutputStream();
- Node2FastInfoset t4 = new Node2FastInfoset();
- ByteArrayOutputStream os1 = new ByteArrayOutputStream();
- ByteArrayOutputStream os2 = new ByteArrayOutputStream();
- long s4 = System.currentTimeMillis();
- t3.transform(n1, os1, null);
- long s5 = System.currentTimeMillis();
- t4.transform(n2, os2, null);
- long s6 = System.currentTimeMillis();
- d1 += s5 - s4; // to plain xml
- d2 += s6 - s5; // to fastinfoset
- }
- System.out.println("POX " + d1 + ".vs. FIS " + d2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/resources/ipo.xsd
deleted file mode 100644
index 5a493e1746..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-fastinfoset/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/LICENSE b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/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-java-1.5.1/modules/databinding-jaxb-axiom/NOTICE b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/pom.xml b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/pom.xml
deleted file mode 100644
index 099adb2c40..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/pom.xml
+++ /dev/null
@@ -1,189 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-jaxb-axiom</artifactId>
- <name>Apache Tuscany SCA Data Binding for JAXB-AXIOM</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-jaxb</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>java.net</id>
- <name>java.net Maven 1.x Repository</name>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>java.net2</id>
- <name>java.net Maven 2.x Repository</name>
- <url>http://download.java.net/maven/2</url>
- </pluginRepository>
- </pluginRepositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <type>jar</type>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/jaxb-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.5</version>
- <executions>
- <execution>
- <id>generate-jaxb</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <generatePackage>com.example.ipo.jaxb</generatePackage>
- <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
- <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
- <schemaIncludes>
- <include>ipo.xsd</include>
- </schemaIncludes>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.jaxb.axiom</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.jaxb.axiom*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/AxiomHelper.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/AxiomHelper.java
deleted file mode 100644
index 93277e77bf..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/AxiomHelper.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb.axiom;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Helper for AXIOM
- *
- * @version $Rev$ $Date$
- */
-public class AxiomHelper {
- private static final String DEFAULT_PREFIX = "_ns_";
-
- private AxiomHelper() {
- }
-
- /**
- * See http://issues.apache.org/jira/browse/WSCOMMONS-240
- * @param om
- */
- public static void completeAndClose(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- }
- OMElement document = builder.getDocumentElement();
- if (document != null) {
- document.build();
- }
- }
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).close();
- }
- }
-
- /**
- * This method will close the builder immediately. Any subsequent Axiom objects won't
- * be built or accessible.
- */
- public static void closeImmediately(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- ((StAXBuilder)builder).close();
- }
- // builder.close();
- }
- }
-
- /**
- * @param context
- * @param element
- */
- public static void adjustElementName(TransformationContext context, OMElement element) {
- if (context != null) {
- DataType<?> dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (!(logical instanceof XMLType)) {
- return;
- }
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
- // FIXME:: Throw exception or switch to the new Element?
- OMFactory factory = OMAbstractFactory.getOMFactory();
- QName name = xmlType.getElementName();
- OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
- element.setNamespace(namespace);
- element.setLocalName(name.getLocalPart());
- }
- }
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(localName, ns);
-
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element, OMDataSource dataSource) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(dataSource, localName, ns);
-
- }
-
- /**
- * @param factory
- * @param name
- * @return
- */
- public static OMNamespace createOMNamespace(OMFactory factory, QName name) {
- String namespaceURI = name.getNamespaceURI();
- String prefix = name.getPrefix();
-
- OMNamespace ns = null;
- // Qualified Element: we need an OMNamespace
- if (prefix.length() == 0) {
- // The prefix does not appear to be specified, let's create one
- prefix = DEFAULT_PREFIX;
- }
- ns = factory.createOMNamespace(namespaceURI, prefix);
- return ns;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXB2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXB2OMElement.java
deleted file mode 100644
index c4726ad8fa..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXB2OMElement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb.axiom;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-
-/**
- * JAXB Object --> AXIOM OMElement transformer
- *
- * @version $Rev$ $Date$
- */
-public class JAXB2OMElement extends BaseTransformer<Object, OMElement> implements PullTransformer<Object, OMElement> {
- private OMFactory factory = OMAbstractFactory.getOMFactory();
-
- @Override
- public String getSourceDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
- @SuppressWarnings("unchecked")
- public OMElement transform(Object source, TransformationContext context) throws TransformationException {
- JAXBContext jaxbContext;
- try {
- jaxbContext = JAXBContextHelper.createJAXBContext(context, true);
- } catch (JAXBException e) {
- throw new TransformationException(e);
- }
- Object element = JAXBContextHelper.createJAXBElement(jaxbContext, context.getTargetDataType(), source);
- QName name = jaxbContext.createJAXBIntrospector().getElementName(element);
- JAXBDataSource dataSource = new JAXBDataSource(element, jaxbContext);
- OMElement omElement = AxiomHelper.createOMElement(factory, name, dataSource);
- return omElement;
- }
-
- @Override
- public Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- public Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- @Override
- public int getWeight() {
- return 3000;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBCustomBuilder.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBCustomBuilder.java
deleted file mode 100644
index 4876396495..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBCustomBuilder.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.databinding.jaxb.axiom;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMContainer;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.impl.builder.CustomBuilder;
-
-/**
- * JAXBCustomBuilder creates an OMSourcedElement backed by a JAXBDataSource
- * for the specified namespace and localPart.
- */
-public class JAXBCustomBuilder implements CustomBuilder {
- private Class<?> type;
- private JAXBContext jaxbContext;
- private Unmarshaller unmarshaller;
-
- /**
- * Create a JAXBCustomBuilder
- * @param context JAXBDSContext
- */
- public JAXBCustomBuilder(JAXBContext context, Class<?> type, Unmarshaller unmarshaller) {
- super();
- this.type = type;
- this.jaxbContext = context;
- this.unmarshaller = unmarshaller;
- }
-
- public OMElement create(String namespace,
- String localPart,
- OMContainer parent,
- XMLStreamReader reader,
- OMFactory factory) throws OMException {
-
- // There are some situations where we want to use normal
- // unmarshalling, so return null
- if (!shouldUnmarshal(namespace, localPart)) {
- return null;
- }
- try {
- // Create an OMSourcedElement backed by an unmarshalled JAXB object
- OMNamespace ns = factory.createOMNamespace(namespace, reader.getPrefix());
-
- Object jaxb = unmarshaller.unmarshal(reader, type);
-
- OMDataSource ds = new JAXBDataSource(jaxb, jaxbContext);
- OMElement omse = factory.createOMElement(ds, localPart, ns);
-
- parent.addChild(omse);
- return omse;
- } catch (JAXBException e) {
- throw new OMException(e);
- }
- }
-
- /**
- * The namespace identifier for the SOAP 1.1 envelope.
- */
- public static final String URI_NS_SOAP_1_1_ENVELOPE = "http://schemas.xmlsoap.org/soap/envelope/";
- /**
- * The namespace identifier for the SOAP 1.2 envelope.
- */
- public static final String URI_NS_SOAP_1_2_ENVELOPE = "http://www.w3.org/2003/05/soap-envelope";
-
- /**
- * @param namespace
- * @param localPart
- * @return true if this ns and local part is acceptable for unmarshalling
- */
- private boolean shouldUnmarshal(String namespace, String localPart) {
-
- // Don't unmarshall SOAPFaults or anything else in the SOAP
- // namespace.
- // Don't unmarshall elements that are unqualified
- if (localPart == null || namespace == null
- || namespace.length() == 0
- || URI_NS_SOAP_1_1_ENVELOPE.equals(namespace)
- || URI_NS_SOAP_1_2_ENVELOPE.equals(namespace)) {
- return false;
- }
-
- // Don't unmarshal if this looks like encrypted data
- if (localPart.equals("EncryptedData")) {
- return false;
- }
-
- return true;
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBDataSource.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBDataSource.java
deleted file mode 100644
index 27c46cdb21..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/JAXBDataSource.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb.axiom;
-
-import java.io.OutputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.om.OMDataSourceExt;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.ds.OMDataSourceExtBase;
-import org.apache.axiom.om.impl.MTOMXMLStreamWriter;
-import org.apache.axiom.om.util.StAXUtils;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXBDataSource extends OMDataSourceExtBase {
- private JAXBContext context;
- private Object element;
-
- public JAXBDataSource(Object element, JAXBContext context) {
- this.element = element;
- this.context = context;
- }
-
- private Marshaller getMarshaller() throws JAXBException {
- return JAXBContextHelper.getMarshaller(context);
- }
-
- private void releaseMarshaller(Marshaller marshaller) {
- JAXBContextHelper.releaseJAXBMarshaller(context, marshaller);
- }
-
- public XMLStreamReader getReader() throws XMLStreamException {
- // FIXME: [rfeng] This is a quick and dirty implementation
- // We could use the fastinfoset to optimize the roundtrip
- StringWriter writer = new StringWriter();
- serialize(writer, new OMOutputFormat());
- StringReader reader = new StringReader(writer.toString());
- return StAXUtils.createXMLStreamReader(reader);
- }
-
- /**
- * If the writer is backed by an OutputStream, then return the OutputStream
- * @param writer
- * @return OutputStream or null
- */
- private static OutputStream getOutputStream(XMLStreamWriter writer) throws XMLStreamException {
- if (writer.getClass() == MTOMXMLStreamWriter.class) {
- return ((MTOMXMLStreamWriter)writer).getOutputStream();
- }
-
- try {
- Method method = writer.getClass().getMethod("getOutputStream");
- return (OutputStream)method.invoke(writer);
-
- } catch (NoSuchMethodException e) {
- return null;
- } catch (Exception e) {
- return null;
- }
- }
-
- public void serialize(final XMLStreamWriter xmlWriter) throws XMLStreamException {
- try {
- // marshaller.setProperty(Marshaller.JAXB_ENCODING, format.getCharSetEncoding());
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- Marshaller marshaller = null;
- try {
- marshaller = getMarshaller();
- // Marshalling directly to the output stream is faster than marshalling through the
- // XMLStreamWriter. Take advantage of this optimization if there is an output stream.
- OutputStream os = getOutputStream(xmlWriter);
- if (os != null) {
- marshaller.marshal(element, os);
- } else {
- marshaller.marshal(element, xmlWriter);
- }
- } finally {
- releaseMarshaller(marshaller);
- }
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw new XMLStreamException(e.getException());
- }
- }
-
- public void serialize(final OutputStream output, OMOutputFormat format) throws XMLStreamException {
- try {
- // marshaller.setProperty(Marshaller.JAXB_ENCODING, format.getCharSetEncoding());
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- Marshaller marshaller = null;
- try {
- marshaller = getMarshaller();
- marshaller.marshal(element, output);
- } finally {
- releaseMarshaller(marshaller);
- }
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw new XMLStreamException(e.getException());
- }
- }
-
- public void serialize(final Writer writer, OMOutputFormat format) throws XMLStreamException {
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- Marshaller marshaller = null;
- try {
- marshaller = getMarshaller();
- marshaller.marshal(element, writer);
- } finally {
- releaseMarshaller(marshaller);
- }
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw new XMLStreamException(e.getException());
- }
- }
-
- public Object getObject() {
- return element;
- }
-
- public void close() {
- }
-
- public OMDataSourceExt copy() {
- return new JAXBDataSource(element, context);
- }
-
- public byte[] getXMLBytes(final String encoding) throws UnsupportedEncodingException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<byte[]>() {
- public byte[] run() throws JAXBException, XMLStreamException, UnsupportedEncodingException {
- Marshaller marshaller = null;
- try {
- StringWriter sw = new StringWriter();
- marshaller = getMarshaller();
- marshaller.marshal(element, sw);
- return sw.toString().getBytes(encoding);
- } finally {
- releaseMarshaller(marshaller);
- }
- }
- });
- } catch (PrivilegedActionException e) {
- Throwable t = e.getCause();
- if (t instanceof UnsupportedEncodingException) {
- throw (UnsupportedEncodingException)t;
- } else {
- throw new RuntimeException(t);
- }
- }
- }
-
- public boolean isDestructiveRead() {
- return false;
- }
-
- public boolean isDestructiveWrite() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java
deleted file mode 100644
index 848f6d1a85..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/java/org/apache/tuscany/sca/databinding/jaxb/axiom/OMElement2JAXB.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb.axiom;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OMElement2JAXB extends BaseTransformer<OMElement, Object> implements PullTransformer<OMElement, Object> {
-
- @Override
- public String getSourceDataBinding() {
- return org.apache.axiom.om.OMElement.class.getName();
- }
-
- public Object transform(final OMElement source, final TransformationContext context) throws TransformationException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws JAXBException, XMLStreamException {
- Unmarshaller unmarshaller = null;
- XMLStreamReader reader = null;
- Object result = null;
-
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
- try {
- Class<?> type = JAXBContextHelper.getJavaType(context.getTargetDataType());
- unmarshaller = JAXBContextHelper.getUnmarshaller(jaxbContext);
- reader = source.getXMLStreamReaderWithoutCaching();
- result = unmarshaller.unmarshal(reader, type);
- } finally {
- if (reader != null) {
- reader.close();
- }
- JAXBContextHelper.releaseJAXBUnmarshaller(jaxbContext, unmarshaller);
- }
- return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
- }
- });
- } catch (PrivilegedActionException e) {
- throw new TransformationException(e.getException());
- }
- }
-
- @Override
- public Class<OMElement> getSourceType() {
- return OMElement.class;
- }
-
- @Override
- public Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 3000;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index b48e629927..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement;source=javax.xml.bind.JAXBElement,target=org.apache.axiom.om.OMElement,weight=3000
-org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement;source=java:simpleType,target=org.apache.axiom.om.OMElement,weight=3000
-org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement;source=java:complexType,target=org.apache.axiom.om.OMElement,weight=3000
-
-org.apache.tuscany.sca.databinding.jaxb.axiom.OMElement2JAXB;source=org.apache.axiom.om.OMElement,target=javax.xml.bind.JAXBElement,weight=3000,public=false
-org.apache.tuscany.sca.databinding.jaxb.axiom.OMElement2JAXB;source=org.apache.axiom.om.OMElement,target=java:complexType,weight=90000,public=false
-org.apache.tuscany.sca.databinding.jaxb.axiom.OMElement2JAXB;source=org.apache.axiom.om.OMElement,target=java:simpleType,weight=90000,public=false
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/JAXB2OMTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/JAXB2OMTestCase.java
deleted file mode 100644
index 543a76594f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/JAXB2OMTestCase.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.databinding.jaxb.axiom;
-
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-import org.apache.tuscany.sca.databinding.jaxb.axiom.JAXB2OMElement;
-import org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.junit.Test;
-import org.w3c.dom.Node;
-
-import com.example.ipo.jaxb.ObjectFactory;
-import com.example.ipo.jaxb.PurchaseOrderType;
-import com.example.ipo.jaxb.USAddress;
-import com.example.ipo.jaxb.USState;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JAXB2OMTestCase {
- @Test
- public void testTransformElement() throws Exception {
- JAXBElement<PurchaseOrderType> po = createPO();
- DataType<?> sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, XMLType.UNKNOWN);
- DataType<?> targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(po.getName(), null));
- TransformationContext tContext = new TransformationContextImpl();
- tContext.setSourceDataType(sourceDataType);
- tContext.setTargetDataType(targetDataType);
-
- // Force the JAXBContext to be cached
- JAXBContextHelper.createJAXBContext(tContext, true);
-
- long start = System.currentTimeMillis();
- JAXB2OMElement t1 = new JAXB2OMElement();
- OMElement om = t1.transform(po, tContext);
- long duration1 = System.currentTimeMillis() - start;
- StringWriter sw = new StringWriter();
- // serializeAndConsume() will trigger the JAXBDataSource.serialize(Writer, OMOutputFormat)
- om.serializeAndConsume(sw);
- System.out.println(sw.toString());
-
- start = System.currentTimeMillis();
- Node node = new JAXB2Node().transform(po, tContext);
- XMLStreamReader reader = new Node2XMLStreamReader().transform(node, null);
- om = new StAXOMBuilder(reader).getDocumentElement();
- sw = new StringWriter();
- om.serializeAndConsume(sw);
- long duration2 = System.currentTimeMillis() - start;
- System.out.println(sw.toString());
- System.out.println(duration1 + " vs. " + duration2);
- }
-
- @Test
- public void testTransformType() throws Exception {
- JAXBElement<PurchaseOrderType> po = createPO();
- DataType<?> sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, XMLType.UNKNOWN);
- DataType<?> targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(po.getName(), null));
- TransformationContext tContext = new TransformationContextImpl();
- tContext.setSourceDataType(sourceDataType);
- tContext.setTargetDataType(targetDataType);
- OMElement om = new JAXB2OMElement().transform(po.getValue(), tContext);
- StringWriter sw = new StringWriter();
- om.serializeAndConsume(sw);
- System.out.println(sw.toString());
- }
-
- private JAXBElement<PurchaseOrderType> createPO() {
- ObjectFactory factory = new ObjectFactory();
- PurchaseOrderType type = factory.createPurchaseOrderType();
- JAXBElement<PurchaseOrderType> po = factory.createPurchaseOrder(type);
- type.setItems(factory.createItems());
- type.setComment("123");
- USAddress address = factory.createUSAddress();
- address.setCity("San Jose");
- address.setStreet("ABC St.");
- address.setState(USState.CA);
- type.setShipTo(address);
- return po;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/OMElement2JAXBTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/OMElement2JAXBTestCase.java
deleted file mode 100644
index 3c00307941..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/java/org/apache/tuscany/databinding/jaxb/axiom/OMElement2JAXBTestCase.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.databinding.jaxb.axiom;
-
-import java.io.ByteArrayInputStream;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.databinding.jaxb.axiom.OMElement2JAXB;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.junit.Test;
-
-import com.example.ipo.jaxb.PurchaseOrderType;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OMElement2JAXBTestCase {
- private static final String XML =
- "<ns0:root xmlns:ns0=\"http://ns0\" xmlns:ns2=\"http://www.example.com/IPO\">" + "<ns1:next xmlns:ns1=\"http://ns1\">"
- + "<ns2:purchaseOrder>"
- + "<shipTo xsi:type=\"ns2:USAddress\" "
- + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
- + "<street>ABC St.</street><city>San Jose</city><state>CA</state></shipTo>"
- + "<ns2:comment>123</ns2:comment><items/>"
- + "</ns2:purchaseOrder>"
- + "</ns1:next>"
- + "</ns0:root>";
-
- @Test
- public void testTransform() throws Exception {
- DataType<?> sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, XMLType.UNKNOWN);
- QName qname = new QName("http://www.example.com/IPO", "purchaseOrder");
- DataType<?> targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(qname, null));
- TransformationContext tContext = new TransformationContextImpl();
- tContext.setSourceDataType(sourceDataType);
- tContext.setTargetDataType(targetDataType);
-
- StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(XML.getBytes("UTF-8")));
- OMElement root = builder.getDocumentElement();
- OMElement next = (OMElement)root.getChildElements().next();
- OMElement po = (OMElement)next.getChildElements().next();
- Object jaxb = new OMElement2JAXB().transform(po, tContext);
- Assert.assertTrue(jaxb instanceof PurchaseOrderType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/resources/ipo.xsd
deleted file mode 100644
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb-axiom/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/LICENSE b/branches/sca-java-1.5.1/modules/databinding-jaxb/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/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-java-1.5.1/modules/databinding-jaxb/NOTICE b/branches/sca-java-1.5.1/modules/databinding-jaxb/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml b/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml
deleted file mode 100644
index 7d539a531b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/pom.xml
+++ /dev/null
@@ -1,183 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-jaxb</artifactId>
- <name>Apache Tuscany SCA Data Binding for JAXB</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>2.1.7</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jvnet.jaxb.reflection</groupId>
- <artifactId>jaxb2-reflection</artifactId>
- <version>2.1.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>java.net</id>
- <name>java.net Maven 1.x Repository</name>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>java.net2</id>
- <name>java.net Maven 2.x Repository</name>
- <url>http://download.java.net/maven/2</url>
- </pluginRepository>
- </pluginRepositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <type>jar</type>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/jaxb-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.jvnet.jaxb2.maven2</groupId>
- <artifactId>maven-jaxb2-plugin</artifactId>
- <version>0.5</version>
- <executions>
- <execution>
- <id>generate-jaxb</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <generatePackage>com.example.ipo.jaxb</generatePackage>
- <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory>
- <schemaDirectory>${basedir}/src/test/resources</schemaDirectory>
- <schemaIncludes>
- <include>ipo.xsd</include>
- </schemaIncludes>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.jaxb</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.jaxb*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
-
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/AnyTypeXmlAdapter.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/AnyTypeXmlAdapter.java
deleted file mode 100644
index 57922e1c89..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/AnyTypeXmlAdapter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-/**
- * This special XmlAdapter can be used by JAXB classes to annotate the references to java interfaces
- */
-public class AnyTypeXmlAdapter extends XmlAdapter<Object, Object> {
-
- @Override
- public Object marshal(Object v) throws Exception {
- return v;
- }
-
- @Override
- public Object unmarshal(Object v) throws Exception {
- return v;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DOMElementXmlAdapter.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DOMElementXmlAdapter.java
deleted file mode 100644
index 91cb39b0f2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DOMElementXmlAdapter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.w3c.dom.Element;
-
-/**
- * A generic XmlAdapter for JAXB to marshal/unmarshal between the java objects and DOM elements
- */
-public class DOMElementXmlAdapter extends XmlAdapter<Element, Object> {
- private Mediator mediator;
- private DataType dataType;
- private DataType domType;
-
- public DOMElementXmlAdapter(Mediator mediator, DataType dataType) {
- this.mediator = mediator;
- this.dataType = dataType;
- this.domType = new DataTypeImpl(DOMDataBinding.NAME, Element.class, dataType.getLogical());
- }
-
- @Override
- public Element marshal(Object value) throws Exception {
- return (Element) mediator.mediate(value, dataType, domType, null);
- }
-
- @Override
- public Object unmarshal(Element element) throws Exception {
- return mediator.mediate(element, domType, dataType, null);
- }
-
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DataConverter.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DataConverter.java
deleted file mode 100644
index 003b4fb992..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DataConverter.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.awt.Image;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.activation.DataHandler;
-import javax.imageio.ImageIO;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Provides utilities to convert an object into a different kind of Object. For example, convert a
- * String[] into a List<String>
- */
-public class DataConverter {
-
- /**
- * This method should return true if the convert method will succeed.
- * <p/>
- * Note that any changes to isConvertable() must also be accompanied by similar changes to
- * convert()
- *
- * @param obj source object or class
- * @param dest destination class
- * @return boolean true if convert(..) can convert obj to the destination class
- */
- public static boolean isConvertable(Object obj, Class dest) {
- Class src = null;
-
- if (obj != null) {
- if (obj instanceof Class) {
- src = (Class)obj;
- } else {
- src = obj.getClass();
- }
- }
-
- if (dest == null) {
- return false;
- }
-
- if (src == null) {
- return true;
- }
-
- // If we're directly assignable, we're good.
- if (dest.isAssignableFrom(src)) {
- return true;
- }
-
- // If it's a wrapping conversion, we're good.
- if (getWrapperClass(src) == dest) {
- return true;
- }
- if (getWrapperClass(dest) == src) {
- return true;
- }
-
- // If it's List -> Array or vice versa, we're good.
- if ((Collection.class.isAssignableFrom(src) || src.isArray()) && (Collection.class.isAssignableFrom(dest) || dest
- .isArray())) {
-
- // TODO this should consider the component types instead of returning true.
- return true;
- }
-
- // Allow mapping of HashMaps to Hashtables
- if (src == HashMap.class && dest == Hashtable.class)
- return true;
-
- // Allow mapping of Calendar to Date
- if (Calendar.class.isAssignableFrom(src) && dest == Date.class) {
- return true;
- }
-
- if (src.isPrimitive()) {
- return isConvertable(getWrapperClass(src), dest);
- }
-
- if (InputStream.class.isAssignableFrom(src) && dest == byte[].class) {
- return true;
- }
-
- if (Source.class.isAssignableFrom(src) && dest == byte[].class) {
- return true;
- }
-
- if (DataHandler.class.isAssignableFrom(src) && isConvertable(byte[].class, dest)) {
- return true;
- }
-
- if (DataHandler.class.isAssignableFrom(src) && dest == Image.class) {
- return true;
- }
-
- if (DataHandler.class.isAssignableFrom(src) && dest == Source.class) {
- return true;
- }
-
- if (byte[].class.isAssignableFrom(src) && dest == String.class) {
- return true;
- }
-
- // If it's a MIME type mapping and we want a DataHandler,
- // then we're good.
- // REVIEW Do we want to support this
- /*
- if (dest.getName().equals("javax.activation.DataHandler")) {
- String name = src.getName();
- if (src == String.class
- || src == java.awt.Image.class
- || name.equals("javax.mail.internet.MimeMultipart")
- || name.equals("javax.xml.transform.Source"))
- return true;
- }
- */
-
- return false;
- }
-
- /**
- * Utility function to convert an Object to some desired Class.
- * <p/>
- * Normally this is used for T[] to List<T> processing. Other conversions are also done (i.e.
- * HashMap <->Hashtable, etc.)
- * <p/>
- * Use the isConvertable() method to determine if conversion is possible. Note that any changes
- * to convert() must also be accompanied by similar changes to isConvertable()
- *
- * @param arg the array to convert
- * @param destClass the actual class we want
- * @return object of destClass if conversion possible, otherwise returns arg
- */
- public static Object convert(Object arg, Class<?> destClass) {
- if (destClass == null) {
- return arg;
- }
-
- if (arg != null && destClass.isAssignableFrom(arg.getClass())) {
- return arg;
- }
-
- // Convert between Calendar and Date
- if (arg instanceof Calendar && destClass == Date.class) {
- return ((Calendar)arg).getTime();
- }
-
- // Convert between HashMap and Hashtable
- if (arg instanceof HashMap && destClass == Hashtable.class) {
- return new Hashtable((HashMap)arg);
- }
-
- if (arg instanceof InputStream && destClass == byte[].class) {
-
- try {
- InputStream is = (InputStream)arg;
- return getBytesFromStream(is);
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- if (arg instanceof Source && destClass == byte[].class) {
- try {
- if (arg instanceof StreamSource) {
- InputStream is = ((StreamSource)arg).getInputStream();
- if (is != null) {
- return getBytesFromStream(is);
- }
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- Result result = new StreamResult(out);
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.transform((Source)arg, result);
- byte[] bytes = out.toByteArray();
- return bytes;
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- if (arg instanceof DataHandler) {
- try {
- InputStream is = ((DataHandler)arg).getInputStream();
- if (destClass == Image.class) {
- return ImageIO.read(is);
- } else if (destClass == Source.class) {
- return new StreamSource(is);
- }
- byte[] bytes = getBytesFromStream(is);
- return convert(bytes, destClass);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- if (arg instanceof byte[] && destClass == String.class) {
- return new String((byte[])arg);
- }
-
- // If the destination is an array and the source
- // is a suitable component, return an array with
- // the single item.
- /* REVIEW do we need to support atomic to array conversion ?
- if (arg != null &&
- destClass.isArray() &&
- !destClass.getComponentType().equals(Object.class) &&
- destClass.getComponentType().isAssignableFrom(arg.getClass())) {
- Object array =
- Array.newInstance(destClass.getComponentType(), 1);
- Array.set(array, 0, arg);
- return array;
- }
- */
-
- // Return if no conversion is available
- if (!(arg instanceof Collection || (arg != null && arg.getClass().isArray()))) {
- return arg;
- }
-
- if (arg == null) {
- return null;
- }
-
- // The arg may be an array or List
- Object destValue = null;
- int length = 0;
- if (arg.getClass().isArray()) {
- length = Array.getLength(arg);
- } else {
- length = ((Collection)arg).size();
- }
-
- try {
- if (destClass.isArray()) {
- if (destClass.getComponentType().isPrimitive()) {
-
- Object array = Array.newInstance(destClass.getComponentType(), length);
- // Assign array elements
- if (arg.getClass().isArray()) {
- for (int i = 0; i < length; i++) {
- Array.set(array, i, Array.get(arg, i));
- }
- } else {
- int idx = 0;
- for (Iterator i = ((Collection)arg).iterator(); i.hasNext();) {
- Array.set(array, idx++, i.next());
- }
- }
- destValue = array;
-
- } else {
- Object[] array;
- try {
- array = (Object[])Array.newInstance(destClass.getComponentType(), length);
- } catch (Exception e) {
- return arg;
- }
-
- // Use convert to assign array elements.
- if (arg.getClass().isArray()) {
- for (int i = 0; i < length; i++) {
- array[i] = convert(Array.get(arg, i), destClass.getComponentType());
- }
- } else {
- int idx = 0;
- for (Iterator i = ((Collection)arg).iterator(); i.hasNext();) {
- array[idx++] = convert(i.next(), destClass.getComponentType());
- }
- }
- destValue = array;
- }
- } else if (Collection.class.isAssignableFrom(destClass)) {
- Collection newList = null;
- try {
- // if we are trying to create an interface, build something
- // that implements the interface
- if (destClass == Collection.class || destClass == List.class) {
- newList = new ArrayList();
- } else if (destClass == Set.class) {
- newList = new HashSet();
- } else {
- newList = (Collection)destClass.newInstance();
- }
- } catch (Exception e) {
- // No FFDC code needed
- // Couldn't build one for some reason... so forget it.
- return arg;
- }
-
- if (arg.getClass().isArray()) {
- for (int j = 0; j < length; j++) {
- newList.add(Array.get(arg, j));
- }
- } else {
- for (Iterator j = ((Collection)arg).iterator(); j.hasNext();) {
- newList.add(j.next());
- }
- }
- destValue = newList;
- } else {
- destValue = arg;
- }
- } catch (Throwable t) {
- throw new ServiceRuntimeException(t);
- }
-
- return destValue;
- }
-
- private static byte[] getBytesFromStream(InputStream is) throws IOException {
- // TODO This code assumes that available is the length of the stream.
- byte[] bytes = new byte[is.available()];
- is.read(bytes);
- return bytes;
- }
-
- public static Class getWrapperClass(Class primitive) {
- if (primitive == int.class) {
- return java.lang.Integer.class;
- } else if (primitive == short.class) {
- return java.lang.Short.class;
- } else if (primitive == boolean.class) {
- return java.lang.Boolean.class;
- } else if (primitive == byte.class) {
- return java.lang.Byte.class;
- } else if (primitive == long.class) {
- return java.lang.Long.class;
- } else if (primitive == double.class) {
- return java.lang.Double.class;
- } else if (primitive == float.class) {
- return java.lang.Float.class;
- } else if (primitive == char.class) {
- return java.lang.Character.class;
- }
-
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DefaultXMLAdapterExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DefaultXMLAdapterExtensionPoint.java
deleted file mode 100644
index 062da48206..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/DefaultXMLAdapterExtensionPoint.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DefaultXMLAdapterExtensionPoint implements XMLAdapterExtensionPoint {
- private Map<Class<?>, Class<? extends XmlAdapter>> adapters =
- new ConcurrentHashMap<Class<?>, Class<? extends XmlAdapter>>();
-
- public void addAdapter(Class<?> boundType, Class<? extends XmlAdapter> adapter) {
- adapters.put(boundType, adapter);
- }
-
- public Class<? extends XmlAdapter> getAdapter(Class<?> boundType) {
- Class<? extends XmlAdapter> cls = adapters.get(boundType);
- if (cls != null) {
- return cls;
- }
- for (Map.Entry<Class<?>, Class<? extends XmlAdapter>> e : adapters.entrySet()) {
- if (e.getKey().isAssignableFrom(boundType)) {
- return e.getValue();
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- public Class<? extends XmlAdapter> removeAdapter(Class<?> boundType) {
- return adapters.remove(boundType);
- }
-
- public Map<Class<?>, Class<? extends XmlAdapter>> getAdapters() {
- return adapters;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java
deleted file mode 100644
index 3e262c7d12..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2Node.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXB2Node extends BaseTransformer<Object, Node> implements PullTransformer<Object, Node> {
-
- public Node transform(Object source, TransformationContext tContext) {
-// if (source == null) {
-// return null;
-// }
- try {
- JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
- Marshaller marshaller = context.createMarshaller();
- // FIXME: The default Marshaller doesn't support
- // marshaller.getNode()
- Document document = DOMHelper.newDocument();
- Object jaxbElement = JAXBContextHelper.createJAXBElement(context, tContext.getSourceDataType(), source);
- marshaller.marshal(jaxbElement, document);
- return DOMHelper.adjustElementName(tContext, document.getDocumentElement());
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JAXBDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java
deleted file mode 100644
index eee5c77285..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2SAX.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JAXB2SAX extends BaseTransformer<Object, ContentHandler> implements
- PushTransformer<Object, ContentHandler> {
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object, java.lang.Object, org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(Object source, ContentHandler target, TransformationContext tContext) {
- try {
- JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
- Marshaller marshaller = context.createMarshaller();
- Object jaxbElement = JAXBContextHelper.createJAXBElement(context, tContext.getSourceDataType(), source);
- marshaller.marshal(jaxbElement, target);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 20;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JAXBDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.java
deleted file mode 100644
index 29951a5e16..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2String.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.databinding.jaxb;
-
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXB2String extends BaseTransformer<Object, String> implements PullTransformer<Object, String> {
-
- public String transform(Object source, TransformationContext tContext) {
- try {
- JAXBContext context = JAXBContextHelper.createJAXBContext(tContext, true);
- Marshaller marshaller = context.createMarshaller();
- StringWriter writer = new StringWriter();
- StreamResult result = new StreamResult(writer);
- Object jaxbElement = JAXBContextHelper.createJAXBElement(context, tContext.getSourceDataType(), source);
- marshaller.marshal(jaxbElement, result);
- return writer.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
- @Override
- public String getTargetDataBinding() {
- return XMLStringDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
deleted file mode 100644
index c685f5cc19..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
+++ /dev/null
@@ -1,563 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.awt.Image;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.ref.SoftReference;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.activation.DataHandler;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.transform.Source;
-
-import org.apache.tuscany.sca.databinding.util.LRUCache;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JAXBContextCache {
- private static final int CACHE_SIZE = 128;
-
- private static HashMap<String, Class<?>> loadClassMap = new HashMap<String, Class<?>>();
-
- static {
- loadClassMap.put("byte", byte.class);
- loadClassMap.put("int", int.class);
- loadClassMap.put("short", short.class);
- loadClassMap.put("long", long.class);
- loadClassMap.put("float", float.class);
- loadClassMap.put("double", double.class);
- loadClassMap.put("boolean", boolean.class);
- loadClassMap.put("char", char.class);
- loadClassMap.put("void", void.class);
- }
-
- protected static Class<?>[] JAXB_BUILTIN_CLASSES =
- {byte[].class, boolean.class, byte.class, char.class, double.class, float.class, int.class, long.class,
- short.class, void.class, java.awt.Image.class, java.io.File.class, java.lang.Boolean.class,
- java.lang.Byte.class, java.lang.Character.class, java.lang.Class.class, java.lang.Double.class,
- java.lang.Float.class, java.lang.Integer.class, java.lang.Long.class, java.lang.Object.class,
- java.lang.Short.class, java.lang.String.class, java.lang.Void.class, java.math.BigDecimal.class,
- java.math.BigInteger.class, java.net.URI.class, java.net.URL.class, java.util.Calendar.class,
- java.util.Date.class, java.util.GregorianCalendar.class, java.util.UUID.class,
- javax.activation.DataHandler.class, javax.xml.bind.JAXBElement.class, javax.xml.datatype.Duration.class,
- javax.xml.datatype.XMLGregorianCalendar.class, javax.xml.namespace.QName.class,
- javax.xml.transform.Source.class};
-
- protected static final Set<Class<?>> BUILTIN_CLASSES_SET = new HashSet<Class<?>>(Arrays.asList(JAXB_BUILTIN_CLASSES));
-
- /*
- protected static Class<?>[] COMMON_ARRAY_CLASSES =
- new Class[] {char[].class, short[].class, int[].class, long[].class, float[].class, double[].class,
- String[].class
- };
-
- protected static final Set<Class<?>> COMMON_CLASSES_SET = new HashSet<Class<?>>(Arrays.asList(COMMON_ARRAY_CLASSES));
- */
-
- protected LRUCache<Object, JAXBContext> cache;
- protected Pool<JAXBContext, Marshaller> mpool;
- protected Pool<JAXBContext, Unmarshaller> upool;
-
- // protected JAXBContext commonContext;
- protected JAXBContext defaultContext;
-
- public JAXBContextCache() {
- this(CACHE_SIZE, CACHE_SIZE, CACHE_SIZE);
- }
-
- public JAXBContextCache(int contextSize, int marshallerSize, int unmarshallerSize) {
- cache = new LRUCache<Object, JAXBContext>(contextSize);
- mpool = new Pool<JAXBContext, Marshaller>();
- upool = new Pool<JAXBContext, Unmarshaller>();
- defaultContext = getDefaultJAXBContext();
- }
-
- private static JAXBContext newJAXBContext(final Class<?>... classesToBeBound) throws JAXBException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() {
- public JAXBContext run() throws JAXBException {
- return JAXBContext.newInstance(classesToBeBound);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (JAXBException)e.getException();
- }
- }
-
- private static JAXBContext newJAXBContext(final String contextPath, final ClassLoader classLoader)
- throws JAXBException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() {
- public JAXBContext run() throws JAXBException {
- return JAXBContext.newInstance(contextPath, classLoader);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (JAXBException)e.getException();
- }
- }
-
- public static JAXBContext getDefaultJAXBContext() {
- try {
- return newJAXBContext();
- } catch (JAXBException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- /**
- * @param name of primitive type
- * @return primitive Class or null
- */
- public static Class<?> getPrimitiveClass(String text) {
- return loadClassMap.get(text);
- }
-
- /**
- * Return the class for this name
- *
- * @return Class
- */
- private static Class<?> forName(final String className, final boolean initialize, final ClassLoader classloader)
- throws ClassNotFoundException {
- // NOTE: This method must remain private because it uses AccessController
- Class<?> cl = null;
- try {
- cl = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
- public Class<?> run() throws ClassNotFoundException {
- // Class.forName does not support primitives
- Class<?> cls = getPrimitiveClass(className);
- if (cls == null) {
- cls = Class.forName(className, initialize, classloader);
- }
- return cls;
- }
- });
- } catch (PrivilegedActionException e) {
- throw (ClassNotFoundException)e.getException();
- }
-
- return cl;
- }
-
- public Marshaller getMarshaller(JAXBContext context) throws JAXBException {
- Marshaller marshaller = mpool.get(context);
- if (marshaller == null) {
- marshaller = context.createMarshaller();
- }
- marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
- return marshaller;
- }
-
- public void releaseJAXBMarshaller(JAXBContext context, Marshaller marshaller) {
- if (marshaller != null) {
- marshaller.setAttachmentMarshaller(null);
- mpool.put(context, marshaller);
- // No point unsetting marshaller's JAXB_FRAGMENT property, since we'll just reset it when
- // doing the next get.
- }
- }
-
- public Unmarshaller getUnmarshaller(JAXBContext context) throws JAXBException {
- Unmarshaller unmarshaller = upool.get(context);
- if (unmarshaller == null) {
- unmarshaller = context.createUnmarshaller();
- }
- return unmarshaller;
- }
-
- public void releaseJAXBUnmarshaller(JAXBContext context, Unmarshaller unmarshaller) {
- if (unmarshaller != null) {
- unmarshaller.setAttachmentUnmarshaller(null);
- upool.put(context, unmarshaller);
- }
- }
-
- public LRUCache<Object, JAXBContext> getCache() {
- return cache;
- }
-
- public JAXBContext getJAXBContext(Class<?> cls) throws JAXBException {
- if (BUILTIN_CLASSES_SET.contains(cls)) {
- return defaultContext;
- }
- return getJAXBContext(new Class<?>[] {cls});
- }
-
- public JAXBContext getJAXBContext(Class<?>[] classes) throws JAXBException {
- Set<Class<?>> classSet = new HashSet<Class<?>>(Arrays.asList(classes));
- return getJAXBContext(classSet);
- }
-
- public JAXBContext getJAXBContext(Set<Class<?>> classes) throws JAXBException {
- // Remove the JAXB built-in types to maximize the cache hit
- Set<Class<?>> classSet = new HashSet<Class<?>>(classes);
- classSet.removeAll(BUILTIN_CLASSES_SET);
-
- // FIXME: [rfeng] Remove java classes that are mapped to the same XSD type to avoid
- // conflicts
- if (classSet.contains(Date[].class)) {
- classSet.remove(Calendar[].class);
- }
-
- if (classSet.contains(URI[].class)) {
- classSet.remove(UUID[].class);
- }
-
- if (classSet.contains(Source[].class)) {
- classSet.remove(Image[].class);
- classSet.remove(DataHandler[].class);
- }
-
- classSet = getJAXBClasses(classSet);
-
- if(classSet.isEmpty()) {
- return defaultContext;
- }
-
- synchronized (cache) {
- JAXBContext context = cache.get(classSet);
- if (context != null) {
- return context;
- }
- context = newJAXBContext(classSet.toArray(new Class<?>[classSet.size()]));
- cache.put(classSet, context);
- return context;
- }
- }
-
- public void clear() {
- synchronized (cache) {
- cache.clear();
- }
- /*
- synchronized (upool) {
- upool.clear();
- }
- synchronized (upool) {
- upool.clear();
- }
- */
- }
-
- //
- // This inner class is copied in its entirety from the Axis2 utility class,
- // org.apache.axis2.jaxws.message.databinding.JAXBUtils. We could look into extending but it's such a basic data structure
- // without other dependencies so we might be better off copying it and avoiding a new
- // Axis2 dependency here.
- //
-
- /**
- * Pool a list of items for a specific key
- *
- * @param <K> Key
- * @param <V> Pooled object
- */
- private static class Pool<K,V> {
- private SoftReference<Map<K,List<V>>> softMap =
- new SoftReference<Map<K,List<V>>>(
- new ConcurrentHashMap<K, List<V>>());
-
- // The maps are freed up when a LOAD FACTOR is hit
- private static final int MAX_LIST_FACTOR = 50;
- private static final int MAX_LOAD_FACTOR = 32; // Maximum number of JAXBContext to store
-
- /**
- * @param key
- * @return removed item from pool or null.
- */
- public V get(K key) {
- List<V> values = getValues(key);
- synchronized (values) {
- if (values.size()>0) {
- V v = values.remove(values.size()-1);
- return v;
-
- }
- }
- return null;
- }
-
- /**
- * Add item back to pool
- * @param key
- * @param value
- */
- public void put(K key, V value) {
- adjustSize();
- List<V> values = getValues(key);
- synchronized (values) {
- if (values.size() < MAX_LIST_FACTOR) {
- values.add(value);
- }
- }
- }
-
- /**
- * Get or create a list of the values for the key
- * @param key
- * @return list of values.
- */
- private List<V> getValues(K key) {
- Map<K,List<V>> map = softMap.get();
- List<V> values = null;
- if (map != null) {
- values = map.get(key);
- if(values !=null) {
- return values;
- }
- }
- synchronized (this) {
- if (map != null) {
- values = map.get(key);
- }
- if (values == null) {
- if (map == null) {
- map = new ConcurrentHashMap<K, List<V>>();
- softMap =
- new SoftReference<Map<K,List<V>>>(map);
- }
- values = new ArrayList<V>();
- map.put(key, values);
-
- }
- return values;
- }
- }
-
- /**
- * AdjustSize
- * When the number of keys exceeds the maximum load, half
- * of the entries are deleted.
- *
- * The assumption is that the JAXBContexts, UnMarshallers, Marshallers, etc. require
- * a large footprint.
- */
- private void adjustSize() {
- Map<K,List<V>> map = softMap.get();
- if (map != null && map.size() > MAX_LOAD_FACTOR) {
- // Remove every other Entry in the map.
- Iterator it = map.entrySet().iterator();
- boolean removeIt = false;
- while (it.hasNext()) {
- it.next();
- if (removeIt) {
- it.remove();
- }
- removeIt = !removeIt;
- }
- }
- }
- }
-
- /**
- * Find the JAXB classes (looking into packages) to be bound
- * @param classes A collection of classes
- * @return A set of classes that include the ObjectFactory and indexed JAXB classes
- * @throws JAXBException
- */
- private static Set<Class<?>> getJAXBClasses(Collection<Class<?>> classes) throws JAXBException {
- Set<Class<?>> classSet = new HashSet<Class<?>>();
- // Index the packages
- Map<Package, ClassLoader> pkgs = getPackages(classes);
- Set<Package> nonJAXBPackages = new HashSet<Package>();
- for (Map.Entry<Package, ClassLoader> p : pkgs.entrySet()) {
- Package pkg = p.getKey();
- if (pkg == null) {
- continue;
- }
- Set<Class<?>> set = getJAXBClasses(pkg.getName(), p.getValue());
- if (set.isEmpty()) {
- // No JAXB package
- nonJAXBPackages.add(pkg);
- } else {
- // Add JAXB ObjectFactory and indexed classes
- classSet.addAll(set);
- }
- }
- // Adding classes that are not part of JAXB packages
- for (Class<?> cls : classes) {
-
- Package pkg = getPackage(cls);
- if (pkg == null || nonJAXBPackages.contains(pkg)) {
- classSet.add(cls);
- } else {
- // TUSCANY-3162: Test if a class is generated by JAXB
- // There might be the case that non-JAXB classes are in the same package as the JAXB classes
- if (!cls.isAnnotationPresent(XmlType.class)
- && !cls.isAnnotationPresent(XmlEnum.class)
- && !cls.isAnnotationPresent(XmlSeeAlso.class)
- && !cls.isAnnotationPresent(XmlRootElement.class)
- && !cls.isAnnotationPresent(XmlTransient.class)) {
- classSet.add(cls);
- }
- }
- }
- return classSet;
- }
-
- /**
- * Get the package for a class, taking array into account
- * @param cls
- * @return
- */
- private static Package getPackage(Class<?> cls) {
- Class<?> type = cls;
- while (type.isArray()) {
- type = type.getComponentType();
- }
- return type.getPackage();
- }
-
- /**
- * Get a map of packages
- * @param classes
- * @return
- */
- private static Map<Package, ClassLoader> getPackages(Collection<Class<?>> classes) {
- Map<Package, ClassLoader> pkgs = new HashMap<Package, ClassLoader>();
- for (Class<?> cls : classes) {
- Package pkg = getPackage(cls);
- if (pkg != null) {
- pkgs.put(pkg, getClassLoader(cls));
- }
- }
- return pkgs;
- }
-
- private static ClassLoader getClassLoader(final Class<?> cls) {
- return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run(){ //throws ClassNotFoundException{
- return cls.getClassLoader();
- }
- });
- }
-
- /**
- * Find ObjectFactory and indexed JAXB classes for the package
- * @param pkg
- * @param classLoader
- * @return
- * @throws JAXBException
- */
- private static Set<Class<?>> getJAXBClasses(String pkg, ClassLoader classLoader) throws JAXBException {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- List<Class<?>> indexedClasses;
-
- // look for ObjectFactory and load it
- final Class<?> o;
- try {
- o = forName(pkg + ".ObjectFactory", false, classLoader);
- classes.add(o);
- } catch (ClassNotFoundException e) {
- // not necessarily an error
- }
-
- // look for jaxb.index and load the list of classes
- try {
- indexedClasses = loadIndexedClasses(pkg, classLoader);
- } catch (IOException e) {
- throw new JAXBException(e);
- }
- if (indexedClasses != null) {
- classes.addAll(indexedClasses);
- }
-
- return classes;
- }
-
- /**
- * Look for jaxb.index file in the specified package and load it's contents
- *
- * @param pkg package name to search in
- * @param classLoader ClassLoader to search in
- * @return a List of Class objects to load, null if there weren't any
- * @throws IOException if there is an error reading the index file
- * @throws JAXBException if there are any errors in the index file
- */
- private static List<Class<?>> loadIndexedClasses(String pkg, ClassLoader classLoader) throws IOException,
- JAXBException {
- if (classLoader == null) {
- return null;
- }
- final String resource = pkg.replace('.', '/') + "/jaxb.index";
- final InputStream resourceAsStream = classLoader.getResourceAsStream(resource);
-
- if (resourceAsStream == null) {
- return null;
- }
-
- BufferedReader in = new BufferedReader(new InputStreamReader(resourceAsStream, "UTF-8"));
- try {
- List<Class<?>> classes = new ArrayList<Class<?>>();
- String className = in.readLine();
- while (className != null) {
- className = className.trim();
- if (className.startsWith("#") || (className.length() == 0)) {
- className = in.readLine();
- continue;
- }
-
- try {
- classes.add(forName(pkg + '.' + className, false, classLoader));
- } catch (ClassNotFoundException e) {
- throw new JAXBException(e);
- }
-
- className = in.readLine();
- }
- return classes;
- } finally {
- in.close();
- }
- }
-
-}
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
deleted file mode 100644
index 95aa6d1402..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextHelper.java
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.JAXBIntrospector;
-import javax.xml.bind.Marshaller;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSchema;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.util.LRUCache;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-// FIXME: [rfeng] We probably should turn this into a pluggable system service
-public class JAXBContextHelper {
- // public static final String JAXB_CLASSES = "jaxb.classes";
-
- // public static final String JAXB_CONTEXT_PATH = "jaxb.contextPath";
-
- private static final JAXBContextCache cache = new JAXBContextCache();
-
- private JAXBContextHelper() {
- }
-
- /**
- * Create a JAXBContext for a given class
- * @param cls
- * @return
- * @throws JAXBException
- */
- public static JAXBContext createJAXBContext(Class<?> cls) throws JAXBException {
- return cache.getJAXBContext(cls);
- }
-
- public static JAXBContext createJAXBContext(TransformationContext tContext, boolean source) throws JAXBException {
- if (tContext == null)
- throw new TransformationException("JAXB context is not set for the transformation.");
-
- // TODO: [rfeng] Need to figure out what's the best grantularity to create the JAXBContext
- // per interface, operation or parameter
- Operation op = source ? tContext.getSourceOperation() : tContext.getTargetOperation();
- if (op != null) {
- synchronized (op) {
- JAXBContext context = op.getInputType().getMetaData(JAXBContext.class);
- if (context == null) {
- context = createJAXBContext(getDataTypes(op, true));
- op.getInputType().setMetaData(JAXBContext.class, context);
- }
- return context;
- }
- }
-
- // For property transformation, the operation can be null
- DataType<?> dataType = source ? tContext.getSourceDataType() : tContext.getTargetDataType();
- return createJAXBContext(dataType);
-
- }
-
- private static Class<?>[] getSeeAlso(Class<?> interfaze) {
- if (interfaze == null) {
- return null;
- }
- XmlSeeAlso seeAlso = interfaze.getAnnotation(XmlSeeAlso.class);
- if (seeAlso == null) {
- return null;
- } else {
- return seeAlso.value();
- }
- }
-
- public static JAXBContext createJAXBContext(DataType dataType) throws JAXBException {
- return createJAXBContext(findClasses(dataType));
- }
-
- public static Unmarshaller getUnmarshaller(JAXBContext context) throws JAXBException {
- return cache.getUnmarshaller(context);
- }
-
- public static void releaseJAXBUnmarshaller(JAXBContext context, Unmarshaller unmarshaller) {
- cache.releaseJAXBUnmarshaller(context, unmarshaller);
- }
-
- public static Marshaller getMarshaller(JAXBContext context) throws JAXBException {
- return cache.getMarshaller(context);
- }
-
- public static void releaseJAXBMarshaller(JAXBContext context, Marshaller marshaller) {
- cache.releaseJAXBMarshaller(context, marshaller);
- }
-
- @SuppressWarnings("unchecked")
- public static Object createJAXBElement(JAXBContext context, DataType dataType, Object value) {
- Class<?> type = dataType == null ? value.getClass() : dataType.getPhysical();
- QName name = JAXBDataBinding.ROOT_ELEMENT;
- if (context != null) {
- Object logical = dataType == null ? null : dataType.getLogical();
- if (logical instanceof XMLType) {
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement()) {
- name = xmlType.getElementName();
- } else {
- /**
- * Set the declared type to Object.class so that xsi:type
- * will be produced
- */
- type = Object.class;
- }
- } else {
- type = Object.class;
- }
- }
-
- JAXBIntrospector introspector = context.createJAXBIntrospector();
- Object element = null;
- if (value != null && introspector.isElement(value)) {
- // NOTE: [rfeng] We cannot wrap an element in a JAXBElement
- element = value;
- }
- if (element == null) {
- element = new JAXBElement(name, Object.class, value);
- }
- return element;
- }
-
- @SuppressWarnings("unchecked")
- public static Object createReturnValue(JAXBContext context, DataType dataType, Object value) {
- Class<?> cls = getJavaType(dataType);
- if (cls == JAXBElement.class) {
- return createJAXBElement(context, dataType, value);
- } else {
- if (value instanceof JAXBElement) {
- return ((JAXBElement)value).getValue();
- } else {
- return value;
- }
- }
- }
-
- /**
- * Create a JAXContext for an array of classes
- * @param classes
- * @return
- * @throws JAXBException
- */
- public static JAXBContext createJAXBContext(Class<?>[] classes) throws JAXBException {
- return cache.getJAXBContext(classes);
- }
-
- public static JAXBContext createJAXBContext(Set<Class<?>> classes) throws JAXBException {
- return cache.getJAXBContext(classes);
- }
-
- /**
- * Create a JAXBContext for a given java interface
- * @param intf
- * @return
- * @throws JAXBException
- */
- public static JAXBContext createJAXBContext(Interface intf, boolean useWrapper) throws JAXBException {
- synchronized (cache) {
- LRUCache<Object, JAXBContext> map = cache.getCache();
- Integer key = new Integer(System.identityHashCode(intf));
- JAXBContext context = map.get(key);
- if (context != null) {
- return context;
- }
- List<DataType> dataTypes = getDataTypes(intf, useWrapper);
- context = createJAXBContext(dataTypes);
- map.put(key, context);
- return context;
- }
- }
-
- public static JAXBContext createJAXBContext(List<DataType> dataTypes) throws JAXBException {
- JAXBContext context;
- Set<Class<?>> classes = new HashSet<Class<?>>();
- Set<Type> visited = new HashSet<Type>();
- for (DataType d : dataTypes) {
- findClasses(d, classes, visited);
- }
-
- context = createJAXBContext(classes);
- return context;
- }
-
- private static Set<Class<?>> findClasses(DataType d) {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- Set<Type> visited = new HashSet<Type>();
- findClasses(d, classes, visited);
- return classes;
- }
-
- private static void findClasses(DataType d, Set<Class<?>> classes, Set<Type> visited) {
- if (d == null) {
- return;
- }
- String db = d.getDataBinding();
- if (JAXBDataBinding.NAME.equals(db) || (db != null && db.startsWith("java:")) || db == null) {
- if (!d.getPhysical().isInterface() && !JAXBElement.class.isAssignableFrom(d.getPhysical())) {
- classes.add(d.getPhysical());
- }
- }
- if (d.getPhysical() != d.getGenericType()) {
- findClasses(d.getGenericType(), classes, visited);
- }
- }
-
- /**
- * Find referenced classes in the generic type
- * @param type
- * @param classSet
- * @param visited
- */
- private static void findClasses(Type type, Set<Class<?>> classSet, Set<Type> visited) {
- if (visited.contains(type) || type == null) {
- return;
- }
- visited.add(type);
- if (type instanceof Class) {
- Class<?> cls = (Class<?>)type;
- if (!cls.isInterface()) {
- classSet.add(cls);
- }
- return;
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- findClasses(pType.getRawType(), classSet, visited);
- for (Type t : pType.getActualTypeArguments()) {
- findClasses(t, classSet, visited);
- }
- } else if (type instanceof TypeVariable) {
- TypeVariable<?> tv = (TypeVariable<?>)type;
- for (Type t : tv.getBounds()) {
- findClasses(t, classSet, visited);
- }
- } else if (type instanceof GenericArrayType) {
- GenericArrayType gType = (GenericArrayType)type;
- findClasses(gType, classSet, visited);
- } else if (type instanceof WildcardType) {
- WildcardType wType = (WildcardType)type;
- for (Type t : wType.getLowerBounds()) {
- findClasses(t, classSet, visited);
- }
- for (Type t : wType.getUpperBounds()) {
- findClasses(t, classSet, visited);
- }
- }
- }
-
- public static JAXBContext createJAXBContext(Interface intf) throws JAXBException {
- return createJAXBContext(intf, true);
- }
-
- /**
- * @param intf
- * @param useWrapper Use wrapper classes?
- * @return
- */
- private static List<DataType> getDataTypes(Interface intf, boolean useWrapper) {
- List<DataType> dataTypes = new ArrayList<DataType>();
- for (Operation op : intf.getOperations()) {
- getDataTypes(dataTypes, op, useWrapper);
- }
- return dataTypes;
- }
-
- private static List<DataType> getDataTypes(Operation op, boolean useWrapper) {
- List<DataType> dataTypes = new ArrayList<DataType>();
- getDataTypes(dataTypes, op, useWrapper);
- // Adding classes referenced by @XmlSeeAlso in the java interface
- Interface interface1 = op.getInterface();
- if (interface1 instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)interface1;
- Class<?>[] seeAlso = getSeeAlso(javaInterface.getJavaClass());
- if (seeAlso != null) {
- for (Class<?> cls : seeAlso) {
- dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN));
- }
- }
- seeAlso = getSeeAlso(javaInterface.getCallbackClass());
- if (seeAlso != null) {
- for (Class<?> cls : seeAlso) {
- dataTypes.add(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, cls, XMLType.UNKNOWN));
- }
- }
- }
- return dataTypes;
- }
-
- private static void getDataTypes(List<DataType> dataTypes, Operation op, boolean useWrapper) {
- WrapperInfo inputWrapperInfo = op.getInputWrapper();
- WrapperInfo outputWrapperInfo = op.getOutputWrapper();
-
- if (useWrapper && (inputWrapperInfo != null)) {
- DataType dt1 = inputWrapperInfo.getWrapperType();
- if (dt1 != null) {
- dataTypes.add(dt1);
- }
- }
- if (useWrapper && (outputWrapperInfo != null)) {
- DataType dt2 = outputWrapperInfo.getWrapperType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- }
- // FIXME: [rfeng] We may need to find the referenced classes in the child types
- // else
- {
- for (DataType dt1 : op.getInputType().getLogical()) {
- dataTypes.add(dt1);
- }
- DataType dt2 = op.getOutputType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- }
- for (DataType<DataType> dt3 : op.getFaultTypes()) {
- DataType dt4 = dt3.getLogical();
- if (dt4 != null) {
- dataTypes.add(dt4);
- }
- }
- }
-
- public static Class<?> getJavaType(DataType<?> dataType) {
- if (dataType == null) {
- return null;
- }
- Class type = dataType.getPhysical();
- if (JAXBElement.class.isAssignableFrom(type)) {
- Type generic = dataType.getGenericType();
- type = Object.class;
- }
- if (type == Object.class && dataType.getLogical() instanceof XMLType) {
- XMLType xType = (XMLType)dataType.getLogical();
- Class javaType = SimpleTypeMapperImpl.getJavaType(xType.getTypeName());
- if (javaType != null) {
- type = javaType;
- }
- }
- return type;
- }
-
- public static XMLType getXmlTypeName(Class<?> javaType) {
- if (javaType.isInterface()) {
- // JAXB doesn't support interfaces
- return null;
- }
- String namespace = null;
- String name = null;
- Package pkg = javaType.getPackage();
- if (pkg != null) {
- XmlSchema schema = pkg.getAnnotation(XmlSchema.class);
- if (schema != null) {
- namespace = schema.namespace();
- }
- }
-
- QName elementQName = null;
- QName typeQName = null;
- XmlRootElement rootElement = javaType.getAnnotation(XmlRootElement.class);
- if (rootElement != null) {
- String elementName = rootElement.name();
- String elementNamespace = rootElement.namespace();
- if (elementNamespace.equals("##default")) {
- elementNamespace = namespace;
- }
- if (elementName.equals("##default")) {
- elementName = jaxbDecapitalize(javaType.getSimpleName());
- }
- elementQName = new QName(elementNamespace, elementName);
- }
- XmlType type = javaType.getAnnotation(XmlType.class);
- if (type != null) {
- String typeNamespace = type.namespace();
- String typeName = type.name();
-
- if (typeNamespace.equals("##default")) {
- // namespace is from the package
- typeNamespace = namespace;
- }
-
- if (typeName.equals("##default")) {
- typeName = jaxbDecapitalize(javaType.getSimpleName());
- }
- typeQName = new QName(typeNamespace, typeName);
- } else {
- XmlEnum xmlEnum = javaType.getAnnotation(XmlEnum.class);
- // POJO can have the @XmlSchema on the package-info too
- if (xmlEnum != null || namespace != null) {
- name = jaxbDecapitalize(javaType.getSimpleName());
- typeQName = new QName(namespace, name);
- }
- }
- if (elementQName == null && typeQName == null) {
- return null;
- }
- return new XMLType(elementQName, typeQName);
- }
-
- /**
- * The JAXB RI doesn't implement the decapitalization algorithm in the
- * JAXB spec. See Sun bug 6505643 for details. This means that instead
- * of calling java.beans.Introspector.decapitalize() as the JAXB spec says,
- * Tuscany needs to mimic the incorrect JAXB RI algorithm.
- */
- public static String jaxbDecapitalize(String name) {
- // find first lower case char in name
- int lower = name.length();
- for (int i = 0; i < name.length(); i++) {
- if (Character.isLowerCase(name.charAt(i))) {
- lower = i;
- break;
- }
- }
-
- int decap;
- if (name.length() == 0) {
- decap = 0; // empty string: nothing to do
- } else if (lower == 0) {
- decap = 0; // first char is lower case: nothing to do
- } else if (lower == 1) {
- decap = 1; // one upper followed by lower: decapitalize 1 char
- } else if (lower < name.length()) {
- decap = lower - 1; // n uppers followed by at least one lower: decapitalize n-1 chars
- } else {
- decap = name.length(); // all upper case: decapitalize all chars
- }
-
- return name.substring(0, decap).toLowerCase() + name.substring(decap);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java
deleted file mode 100644
index 38efd288cb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBinding.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-
-/**
- * JAXB DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class JAXBDataBinding extends BaseDataBinding {
- public static final String NAME = JAXBElement.class.getName();
-
- public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/jaxb/1.0";
- public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
-
- private JAXBWrapperHandler wrapperHandler;
- private JAXBTypeHelper xmlTypeHelper;
-
- public JAXBDataBinding() {
- super(NAME, JAXBElement.class);
- this.wrapperHandler = new JAXBWrapperHandler();
- this.xmlTypeHelper = new JAXBTypeHelper();
- }
-
- @Override
- public boolean introspect(DataType dataType, Operation operation) {
- Class javaType = dataType.getPhysical();
- if (JAXBElement.class.isAssignableFrom(javaType)) {
- Type type = javaType.getGenericSuperclass();
- if (type instanceof ParameterizedType) {
- ParameterizedType parameterizedType = ((ParameterizedType)type);
- Type rawType = parameterizedType.getRawType();
- if (rawType == JAXBElement.class) {
- Type actualType = parameterizedType.getActualTypeArguments()[0];
- if (actualType instanceof Class) {
- XMLType xmlType = JAXBContextHelper.getXmlTypeName((Class)actualType);
- dataType.setLogical(xmlType);
- dataType.setDataBinding(NAME);
- return true;
- }
- }
- }
- if (dataType.getLogical() == null) {
- dataType.setLogical(XMLType.UNKNOWN);
- }
- dataType.setDataBinding(NAME);
- return true;
- }
-
- XMLType xmlType = JAXBContextHelper.getXmlTypeName(javaType);
- if (xmlType == null) {
- return false;
- }
- dataType.setLogical(xmlType);
- dataType.setDataBinding(NAME);
- return true;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object copy(Object arg, DataType dataType, Operation operation) {
- try {
- boolean isElement = false;
- if (dataType == null) {
- Class cls = arg.getClass();
- if (arg instanceof JAXBElement) {
- isElement = true;
- cls = ((JAXBElement)arg).getDeclaredType();
- }
- dataType = new DataTypeImpl<XMLType>(NAME, cls, XMLType.UNKNOWN);
- }
- JAXBContext context = JAXBContextHelper.createJAXBContext(dataType);
- arg = JAXBContextHelper.createJAXBElement(context, dataType, arg);
- Document doc = DOMHelper.newDocument();
- context.createMarshaller().marshal(arg, doc);
- Object value = context.createUnmarshaller().unmarshal(doc, dataType.getPhysical());
- if (isElement && value instanceof JAXBElement) {
- return value;
- }
- return JAXBContextHelper.createReturnValue(context, dataType, value);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public WrapperHandler getWrapperHandler() {
- return wrapperHandler;
- }
-
- @Override
- public XMLTypeHelper getXMLTypeHelper() {
- // return new JAXBTypeHelper();
- return xmlTypeHelper;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBPropertyDescriptor.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBPropertyDescriptor.java
deleted file mode 100644
index 8805d72627..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBPropertyDescriptor.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.beans.IndexedPropertyDescriptor;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.Collection;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * A PropertyDescriptor provides acesss to a bean property. Values can be queried/changed using the
- * read and writer methods of the PropertyDescriptor.
- * <p/>
- * A PropertyDescriptorPlus object wraps a PropertyDescriptor and supplies enhanced set/get methods
- * that match JAXB semantis.
- * <p/>
- * For example, the set(..) method is smart enough to add lists, arrays and atomic values on JAXB
- * beans.
- * <p/>
- * The PropertyDescriptorPlus object also stores the xmlName of the property.
- *
- * @See XMLRootElementUtil.createPropertyDescriptorMap , which creates the PropertyDescriptorPlus
- * objects
- */
-public class JAXBPropertyDescriptor implements Comparable<JAXBPropertyDescriptor> {
- PropertyDescriptor descriptor;
- QName xmlName = null;
- int index;
-
- /**
- * Package protected constructor. Only created by XMLRootElementUtil.createPropertyDescriptorMap
- * @param descriptor
- * @param index TODO
- * @param propertyName
- *
- * @see XMLRootElementUtil.createPropertyDescriptorMap
- */
- JAXBPropertyDescriptor(PropertyDescriptor descriptor, QName xmlName, int index) {
- super();
- this.descriptor = descriptor;
- this.xmlName = xmlName;
- }
-
- /**
- * Package protected constructor. Only created by XMLRootElementUtil.createPropertyDescriptorMap
- * @param descriptor
- * @param index TODO
- * @param propertyName
- *
- * @see XMLRootElementUtil.createPropertyDescriptorMap
- */
- JAXBPropertyDescriptor(PropertyDescriptor descriptor, String xmlName, int index) {
- super();
- this.descriptor = descriptor;
- this.xmlName = new QName("", xmlName);
- }
-
- public int compareTo(JAXBPropertyDescriptor o) {
- return index - o.index;
- }
-
- /** @return xmlname */
- public String getXmlName() {
- return xmlName.getLocalPart();
- }
-
- public QName getXmlQName() {
- return xmlName;
- }
-
- /** @return property type */
- public Class<?> getPropertyType() {
- return descriptor.getPropertyType();
- }
-
- /** @return property name */
- public String getPropertyName() {
- return descriptor.getName();
- }
-
- /**
- * Get the object
- *
- * @param targetBean
- * @return Object for this property or null
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- */
- public Object get(Object targetBean) throws InvocationTargetException, IllegalAccessException {
- Method method = descriptor.getReadMethod();
- if (method == null && descriptor.getPropertyType() == Boolean.class) {
- String propertyName = descriptor.getName();
- if (propertyName != null) {
- String methodName = "is";
- methodName =
- methodName + ((propertyName.length() > 0) ? propertyName.substring(0, 1).toUpperCase() : "");
- methodName = methodName + ((propertyName.length() > 1) ? propertyName.substring(1) : "");
- try {
- method = targetBean.getClass().getMethod(methodName);
- } catch (NoSuchMethodException e) {
- }
- }
- }
- if (method == null) {
- throw new ServiceRuntimeException("No getter is found");
- }
- Object ret = method.invoke(targetBean);
- if (method.getReturnType() == JAXBElement.class) {
- ret = ((JAXBElement<?>)ret).getValue();
- }
- return ret;
- }
-
- /**
- * Set the object
- *
- * @param targetBean
- * @param propValue
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws JAXBWrapperException
- */
- public void set(Object targetBean, Object propValue) throws InvocationTargetException, IllegalAccessException,
- JAXBWrapperException {
-
- Method writeMethod = null;
- try {
- // No set occurs if the value is null
- if (propValue == null) {
- return;
- }
-
- // There are 3 different types of setters that can occur.
- // 1) Normal Attomic Setter : setFoo(type)
- // 2) Indexed Array Setter : setFoo(type[])
- // 3) No Setter case if the property is a List<T>.
-
- writeMethod = descriptor.getWriteMethod();
- if (descriptor instanceof IndexedPropertyDescriptor) {
- // Set for indexed T[]
- setIndexedArray(targetBean, propValue, writeMethod);
- } else if (writeMethod == null) {
- // Set for List<T>
- setList(targetBean, propValue);
- } else if (descriptor.getPropertyType() == JAXBElement.class) {
- if (propValue != null) {
- Class<?> clazz = propValue.getClass();
- JAXBElement<?> element = new JAXBElement(xmlName, clazz, propValue);
- setAtomic(targetBean, element, writeMethod);
- }
- } else {
- // Normal case
- setAtomic(targetBean, propValue, writeMethod);
- }
- } catch (RuntimeException e) {
- throw e;
- }
- }
-
- /**
- * Set the property value onto targetBean using the writeMethod
- *
- * @param targetBean
- * @param propValue
- * @param writeMethod (set(T))
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws JAXBWrapperException
- */
- private void setAtomic(Object targetBean, Object propValue, Method writeMethod) throws InvocationTargetException,
- IllegalAccessException, JAXBWrapperException {
- // JAXB provides setters for atomic value.
-
- if (propValue != null) {
- // Normal case
- Object[] SINGLE_PARAM = new Object[1];
- SINGLE_PARAM[0] = propValue;
- writeMethod.invoke(targetBean, SINGLE_PARAM);
- } else {
- Class<?>[] paramTypes = writeMethod.getParameterTypes();
-
- if (paramTypes != null && paramTypes.length == 1) {
- Class<?> paramType = paramTypes[0];
- if (paramType.isPrimitive() && propValue == null) {
- //Ignoring null value for primitive type, this could potentially be the way of a customer indicating to set
- //default values defined in JAXBObject/xmlSchema.
- return;
- }
- }
- }
-
- }
-
- /**
- * Set the property value using the indexed array setter
- *
- * @param targetBean
- * @param propValue
- * @param writeMethod set(T[])
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws JAXBWrapperException
- */
- private void setIndexedArray(Object targetBean, Object propValue, Method writeMethod)
- throws InvocationTargetException, IllegalAccessException, JAXBWrapperException {
-
- Class<?> paramType = writeMethod.getParameterTypes()[0];
- Object value = asArray(propValue, paramType);
- // JAXB provides setters for atomic value.
- Object[] SINGLE_PARAM = new Object[1];
- SINGLE_PARAM[0] = value;
-
- writeMethod.invoke(targetBean, SINGLE_PARAM);
- }
-
- /**
- * Set the property value for the collection case.
- *
- * @param targetBean
- * @param propValue
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- * @throws JAXBWrapperException
- */
- private void setList(Object targetBean, Object propValue) throws InvocationTargetException, IllegalAccessException,
- JAXBWrapperException {
- // For the List<T> case, there is no setter.
- // You are supposed to use the getter to obtain access to the collection and then add the collection
-
- Collection value = asCollection(propValue, descriptor.getPropertyType());
- Collection collection = (Collection)get(targetBean);
-
- // Now add our our object to the collection
- collection.clear();
- if (propValue != null) {
- collection.addAll(value);
- }
- }
-
- /**
- * @param propValue
- * @param destType
- * @return propValue as a Collection
- */
- private static Collection asCollection(Object propValue, Class<?> destType) {
- // TODO Missing function
- // Convert the object into an equivalent object that is a collection
- if (DataConverter.isConvertable(propValue, destType)) {
- return (Collection)DataConverter.convert(propValue, destType);
- } else {
- String objectClass = (propValue == null) ? "null" : propValue.getClass().getName();
- throw new ServiceRuntimeException("Cannot convert " + objectClass);
- }
- }
-
- /**
- * @param propValue
- * @param destType T[]
- * @return array of component type
- */
- private static Object asArray(Object propValue, Class<?> destType) {
- if (DataConverter.isConvertable(propValue, destType)) {
- return DataConverter.convert(propValue, destType);
- } else {
- String objectClass = (propValue == null) ? "null" : propValue.getClass().getName();
- throw new ServiceRuntimeException("Cannot convert " + objectClass);
-
- }
- }
-
- @Override
- public String toString() {
- String value = "PropertyDescriptorPlus[";
- value += " name=" + this.getPropertyName();
- value += " type=" + this.getPropertyType().getName();
- value += " propertyDecriptor=" + this.descriptor;
- return value + "]";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java
deleted file mode 100644
index a60a882801..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTypeHelper.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Result;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.resolver.URIResolver;
-import org.osoa.sca.ServiceRuntimeException;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-
-public class JAXBTypeHelper implements XMLTypeHelper {
- private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
- private static final String ANYTYPE_NAME = "anyType";
- private static final QName ANYTYPE_QNAME = new QName(SCHEMA_NS, ANYTYPE_NAME);
-
- // private List<Class<?>> types = new ArrayList<Class<?>>();
-
- public JAXBTypeHelper() {
- super();
- }
-
- public TypeInfo getTypeInfo(Class javaType, Object logical) {
- QName xmlType = JavaXMLMapper.getXMLType(javaType);
- if (xmlType != null) {
- return new TypeInfo(xmlType, true, null);
- } else if (javaType.isInterface()) {
- return new TypeInfo(ANYTYPE_QNAME, true, null);
- } else {
- // types.add(javaType);
- if (logical instanceof XMLType) {
- xmlType = ((XMLType)logical).getTypeName();
- }
- if (xmlType == null) {
- xmlType = new QName(JAXBContextHelper.jaxbDecapitalize(javaType.getSimpleName()));
- }
- return new TypeInfo(xmlType, false, null);
- }
- }
-
- /*
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver) {
- List<XSDefinition> definitions = new ArrayList<XSDefinition>();
- generateJAXBSchemas(definitions, factory);
- return definitions;
- }
- */
-
- public static Map<String, String> generateSchema(JAXBContext context) throws IOException {
- StringResolverImpl resolver = new StringResolverImpl();
- context.generateSchema(resolver);
- Map<String, String> xsds = new HashMap<String, String>();
- for (Map.Entry<String, StreamResult> xsd : resolver.getResults().entrySet()) {
- xsds.put(xsd.getKey(), xsd.getValue().getWriter().toString());
- }
- return xsds;
- }
-
- private static class XSDResolver implements URIResolver {
- private Map<String, String> xsds;
-
- public XSDResolver(Map<String, String> xsds) {
- super();
- this.xsds = xsds;
- }
-
- public InputSource resolveEntity(java.lang.String namespace,
- java.lang.String schemaLocation,
- java.lang.String baseUri) {
- String xsd = xsds.get(schemaLocation);
- if (xsd == null) {
- return null;
- }
- return new InputSource(new StringReader(xsd));
- }
-
- }
-
- /*
- private void generateJAXBSchemas1(List<XSDefinition> definitions, XSDFactory factory) {
- if (types.size() > 0) {
- try {
- XmlSchemaCollection collection = new XmlSchemaCollection();
- Class[] typesArray = new Class[types.size()];
- typesArray = types.toArray(typesArray);
- JAXBContext context = JAXBContextHelper.createJAXBContext(typesArray);
- Map<String, String> results = generateSchema(context);
- collection.setSchemaResolver(new XSDResolver(results));
-
- for (Map.Entry<String, String> entry : results.entrySet()) {
- XSDefinition definition = factory.createXSDefinition();
- int index = entry.getKey().lastIndexOf('#');
- String ns = entry.getKey().substring(0, index);
- String file = entry.getKey().substring(index + 1);
- definition.setUnresolved(true);
- definition.setNamespace(ns);
- definition.setSchema(collection.read(new StringReader(entry.getValue()), null));
- definition.setSchemaCollection(collection);
- definition.setUnresolved(false);
- definitions.add(definition);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- */
-
- private static class DOMResolverImpl extends SchemaOutputResolver {
- private Map<String, DOMResult> results = new HashMap<String, DOMResult>();
-
- @Override
- public Result createOutput(String ns, String file) throws IOException {
- DOMResult result = new DOMResult();
- // TUSCANY-2498: Set the system id to "" so that the xsd:import doesn't produce
- // an illegal schemaLocation attr
- result.setSystemId("");
- results.put(ns, result);
- return result;
- }
-
- public Map<String, DOMResult> getResults() {
- return results;
- }
- }
-
- /*
- private void generateJAXBSchemas(List<XSDefinition> definitions, XSDFactory factory) {
- if (types.size() > 0) {
- try {
- Class<?>[] typesArray = new Class<?>[types.size()];
- typesArray = types.toArray(typesArray);
- JAXBContext context = JAXBContext.newInstance(typesArray);
- generateSchemas(definitions, factory, context);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- */
-
- private void generateSchemas(List<XSDefinition> definitions, XSDFactory factory, JAXBContext context)
- throws IOException {
- DOMResolverImpl resolver = new DOMResolverImpl();
- context.generateSchema(resolver);
- Map<String, DOMResult> results = resolver.getResults();
- for (Map.Entry<String, DOMResult> entry : results.entrySet()) {
- XSDefinition definition = factory.createXSDefinition();
- definition.setUnresolved(true);
- definition.setDocument((Document)entry.getValue().getNode());
- definition.setNamespace(entry.getKey());
- URI location = null;
- try {
- location = new URI(entry.getValue().getSystemId());
- } catch (URISyntaxException e) {
- // ignore: use null value
- }
- definition.setLocation(location);
- definitions.add(definition);
- }
- }
-
- private static class StringResolverImpl extends SchemaOutputResolver {
- private Map<String, StreamResult> results = new HashMap<String, StreamResult>();
-
- @Override
- public Result createOutput(String ns, String file) throws IOException {
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- String sysId = ns + '#' + file;
- result.setSystemId(sysId);
- results.put(sysId, result);
- return result;
- }
-
- public Map<String, StreamResult> getResults() {
- return results;
- }
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf) {
- try {
- JAXBContext context = JAXBContextHelper.createJAXBContext(intf, false);
- List<XSDefinition> definitions = new ArrayList<XSDefinition>();
- generateSchemas(definitions, factory, context);
- return definitions;
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes) {
- try {
-
- JAXBContext context = JAXBContextHelper.createJAXBContext(dataTypes);
- List<XSDefinition> definitions = new ArrayList<XSDefinition>();
- generateSchemas(definitions, factory, context);
- return definitions;
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperException.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperException.java
deleted file mode 100644
index f83c7f09d9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperException.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.databinding.jaxb;
-
-import org.osoa.sca.ServiceRuntimeException;
-
-public class JAXBWrapperException extends ServiceRuntimeException {
- private static final long serialVersionUID = 1L;
-
- /**
- *
- */
- public JAXBWrapperException() {
- super();
-
- }
-
- /**
- * @param message
- * @param cause
- */
- public JAXBWrapperException(String message, Throwable cause) {
- super(message, cause);
-
- }
-
- /** @param message */
- public JAXBWrapperException(String message) {
- super(message);
-
- }
-
- /** @param cause */
- public JAXBWrapperException(Throwable cause) {
- super(cause);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java
deleted file mode 100644
index 9cb781a3e1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandler.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-
-/**
- * JAXB WrapperHandler implementation
- *
- * @version $Rev$ $Date$
- */
-public class JAXBWrapperHandler implements WrapperHandler<Object> {
- private JAXBWrapperHelper helper = new JAXBWrapperHelper();
-
- public Object create(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
- final Class<?> wrapperClass = input ? inputWrapperInfo.getWrapperClass() : outputWrapperInfo.getWrapperClass();
- try {
- if (wrapperClass == null) {
- return null;
- }
- return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- return wrapperClass.newInstance();
- }
- });
- } catch (PrivilegedActionException e) {
- throw new TransformationException(e);
- }
- }
-
- public void setChildren(Object wrapper, Object[] childObjects, Operation operation, boolean input) {
- List<ElementInfo> childElements =
- input ? operation.getInputWrapper().getChildElements() : operation.getOutputWrapper().getChildElements();
- List<String> childNames = new ArrayList<String>();
- Map<String, Object> values = new HashMap<String, Object>();
- for (int i = 0; i < childElements.size(); i++) {
- ElementInfo e = childElements.get(i);
- String name = e.getQName().getLocalPart();
- childNames.add(name);
- values.put(name, childObjects[i]);
- }
- // Get the property descriptor map
- Map<String, JAXBPropertyDescriptor> pdMap = null;
- try {
- pdMap = XMLRootElementUtil.createPropertyDescriptorMap(wrapper.getClass());
- } catch (Throwable t) {
- throw new JAXBWrapperException(t);
- }
- helper.wrap(wrapper, childNames, values, pdMap);
- }
-
- public void setChild(Object wrapper, int i, ElementInfo childElement, Object value) {
- Object wrapperValue = wrapper;
- Class<?> wrapperClass = wrapperValue.getClass();
-
- // FIXME: We probably should use the jaxb-reflection to handle the properties
- try {
- String prop = childElement.getQName().getLocalPart();
- boolean collection = (value instanceof Collection);
- Method getter = null;
- for (Method m : wrapperClass.getMethods()) {
- Class<?>[] paramTypes = m.getParameterTypes();
- if (paramTypes.length == 1 && m.getName().equals("set" + capitalize(prop))) {
- m.invoke(wrapperValue, new Object[] {value});
- return;
- }
- if (collection && paramTypes.length == 0 && m.getName().equals("get" + capitalize(prop))) {
- getter = m;
- }
- }
- if (getter != null && Collection.class.isAssignableFrom(getter.getReturnType())) {
- ((Collection)getter.invoke(wrapperValue)).addAll((Collection)value);
- }
-
- } catch (Throwable e) {
- throw new TransformationException(e);
- }
- }
-
- private static String capitalize(String name) {
- char first = Character.toUpperCase(name.charAt(0));
- return first + name.substring(1);
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getChildren(java.lang.Object, Operation, boolean)
- */
- public List getChildren(Object wrapper, Operation operation, boolean input) {
- List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements():
- operation.getOutputWrapper().getChildElements();
-
- List<String> childNames = new ArrayList<String>();
- for (ElementInfo e : childElements) {
- childNames.add(e.getQName().getLocalPart());
- }
- return Arrays.asList(helper.unwrap(wrapper, childNames));
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- DataType dt = input ? inputWrapperInfo.getWrapperType() : outputWrapperInfo.getWrapperType();
- return dt;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#isInstance(java.lang.Object, Operation, boolean)
- */
- public boolean isInstance(Object wrapper, Operation operation, boolean input) {
- Class<?> wrapperClass =
- input ? operation.getInputWrapper().getWrapperClass() : operation.getOutputWrapper().getWrapperClass();
- return wrapperClass == null ? false : wrapperClass.isInstance(wrapper);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHelper.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHelper.java
deleted file mode 100644
index 5f90aa4d7a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHelper.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.databinding.jaxb;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The JAXBWrapper tool is used to create a JAXB Object from a series of child objects (wrap) or get
- * the child objects from a JAXB Object (unwrap)
- */
-public class JAXBWrapperHelper {
-
- /**
- * unwrap Returns the list of child objects of the jaxb object
- *
- * @param jaxbObject that represents the type
- * @param childNames list of xml child names as String
- * @param pdMap PropertyDescriptor map for this jaxbObject
- * @return list of Objects in the same order as the element names.
- */
- public Object[] unwrap(Object jaxbObject, List<String> childNames, Map<String, JAXBPropertyDescriptor> pdMap)
- throws JAXBWrapperException {
-
- // Get the object that will have the property descriptors (i.e. the object representing the complexType)
- Object jaxbComplexTypeObj = jaxbObject;
-
- // Get the PropertyDescriptorPlus map.
- // The method makes sure that each child name has a matching jaxb property
- // checkPropertyDescriptorMap(jaxbComplexTypeObj.getClass(), childNames, pdMap);
-
- // Get the corresponsing objects from the jaxb bean
- ArrayList<Object> objList = new ArrayList<Object>();
- int index = 0;
- for (String childName : childNames) {
- JAXBPropertyDescriptor propInfo = getPropertyDescriptor(pdMap, childName, index);
-
- Object object = null;
- try {
- object = propInfo.get(jaxbComplexTypeObj);
- } catch (Throwable e) {
- throw new JAXBWrapperException(e);
- }
-
- objList.add(object);
- index++;
- }
- Object[] jaxbObjects = objList.toArray();
- objList = null;
- return jaxbObjects;
-
- }
-
- private JAXBPropertyDescriptor getPropertyDescriptor(Map<String, JAXBPropertyDescriptor> pdMap,
- String childName,
- int index) {
- JAXBPropertyDescriptor propInfo = pdMap.get(childName);
- if (propInfo == null) {
- // FIXME: [rfeng] Sometimes the child element names don't match. Get chilld by location?
- List<JAXBPropertyDescriptor> props = new ArrayList<JAXBPropertyDescriptor>(pdMap.values());
- // Sort the properties by index. We might need to take propOrder into consideration
- Collections.sort(props);
- propInfo = props.get(index);
- }
- return propInfo;
- }
-
- /**
- * wrap Creates a jaxb object that is initialized with the child objects.
- * <p/>
- * Note that the jaxbClass must be the class the represents the complexType. (It should never be
- * JAXBElement)
- *
- * @param jaxbClass
- * @param childNames list of xml child names as String
- * @param childObjects, component type objects
- * @param pdMap PropertyDescriptor map for this jaxbObject
- */
- public Object wrap(Class<?> jaxbClass,
- List<String> childNames,
- Map<String, Object> childObjects,
- Map<String, JAXBPropertyDescriptor> pdMap) throws JAXBWrapperException {
-
- // Just like unWrap, get the property info map
- // checkPropertyDescriptorMap(jaxbClass, childNames, pdMap);
-
- // The jaxb object always has a default constructor. Create the object
- Object jaxbObject = null;
- try {
- jaxbObject = jaxbClass.newInstance();
- } catch (Throwable t) {
- throw new JAXBWrapperException(t);
- }
-
- wrap(jaxbObject, childNames, childObjects, pdMap);
-
- // Return the jaxb object
- return jaxbObject;
- }
-
- public void wrap(Object jaxbObject,
- List<String> childNames,
- Map<String, Object> childObjects,
- Map<String, JAXBPropertyDescriptor> pdMap) {
- // Now set each object onto the jaxb object
- int index = 0;
- for (String childName : childNames) {
- JAXBPropertyDescriptor propInfo = getPropertyDescriptor(pdMap, childName, index);
- Object value = childObjects.get(childName);
- try {
- propInfo.set(jaxbObject, value);
- } catch (Throwable t) {
- throw new JAXBWrapperException(t);
- }
- index++;
- }
- }
-
- public Object[] unwrap(Object jaxbObject, List<String> childNames) throws JAXBWrapperException {
- // Get the property descriptor map for this JAXBClass
- Class<?> jaxbClass = jaxbObject.getClass();
- Map<String, JAXBPropertyDescriptor> pdMap = null;
- try {
- pdMap = XMLRootElementUtil.createPropertyDescriptorMap(jaxbClass);
- } catch (Throwable t) {
- throw new JAXBWrapperException(t);
- }
-
- // Delegate
- return unwrap(jaxbObject, childNames, pdMap);
- }
-
- public Object wrap(Class<?> jaxbClass, List<String> childNames, Map<String, Object> childObjects)
- throws JAXBWrapperException {
- // Get the property descriptor map
- Map<String, JAXBPropertyDescriptor> pdMap = null;
- try {
- pdMap = XMLRootElementUtil.createPropertyDescriptorMap(jaxbClass);
- } catch (Throwable t) {
- throw new JAXBWrapperException(t);
- }
-
- // Delegate
- return wrap(jaxbClass, childNames, childObjects, pdMap);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
deleted file mode 100644
index e375a9b85e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Node2JAXB.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Node2JAXB extends BaseTransformer<Node, Object> implements PullTransformer<Node, Object> {
-
- public Node2JAXB() {
- super();
- }
-
- public Object transform(Node source, TransformationContext context) {
- if (source == null)
- return null;
- try {
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
- return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.java
deleted file mode 100644
index 840edfd234..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/Reader2JAXB.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.databinding.jaxb;
-
-import java.io.Reader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Reader2JAXB extends BaseTransformer<Reader, Object> implements
- PullTransformer<Reader, Object> {
-
- public Object transform(final Reader source, final TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- StreamSource streamSource = new StreamSource(source);
- Object result = unmarshaller.unmarshal(streamSource, JAXBContextHelper.getJavaType(context.getTargetDataType()));
- return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Reader> getSourceType() {
- return Reader.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.java
deleted file mode 100644
index 5559690de8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/String2JAXB.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.databinding.jaxb;
-
-import java.io.StringReader;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class String2JAXB extends BaseTransformer<String, Object> implements
- PullTransformer<String, Object> {
-
- public Object transform(final String source, final TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- StreamSource streamSource = new StreamSource(new StringReader(source));
- Object result = unmarshaller.unmarshal(streamSource, JAXBContextHelper.getJavaType(context.getTargetDataType()));
- return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- @Override
- public String getSourceDataBinding() {
- return XMLStringDataBinding.NAME;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLAdapterExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLAdapterExtensionPoint.java
deleted file mode 100644
index 5fa98b5ed1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLAdapterExtensionPoint.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.util.Map;
-
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface XMLAdapterExtensionPoint {
- /**
- * @param boundType
- * @param adapter
- */
- void addAdapter(Class<?> boundType, Class<? extends XmlAdapter> adapter);
-
- /**
- * @param boundType
- * @return
- */
- Class<? extends XmlAdapter> getAdapter(Class<?> boundType);
-
- /**
- * @param boundType
- * @return
- */
- Class<? extends XmlAdapter> removeAdapter(Class<?> boundType);
-
- /**
- * @return
- */
- Map<Class<?>, Class<? extends XmlAdapter>> getAdapters();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLRootElementUtil.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLRootElementUtil.java
deleted file mode 100644
index d177d53eda..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLRootElementUtil.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.WeakHashMap;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementRef;
-import javax.xml.bind.annotation.XmlEnumValue;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSchema;
-import javax.xml.namespace.QName;
-
-/**
- *
- */
-public class XMLRootElementUtil {
-
- /**
- * TUSCANY-3167
- * Cache for property descriptors
- */
- private static Map<Class<?>, Map<String, JAXBPropertyDescriptor>> PROPERTY_MAP =
- new WeakHashMap<Class<?>, Map<String, JAXBPropertyDescriptor>>();
-
- /** Constructor is intentionally private. This class only provides static utility methods */
- private XMLRootElementUtil() {
-
- }
-
- /**
- * @param clazz
- * @return namespace of root element qname or null if this is not object does not represent a
- * root element
- */
- public static QName getXmlRootElementQNameFromObject(Object obj) {
-
- // A JAXBElement stores its name
- if (obj instanceof JAXBElement) {
- return ((JAXBElement<?>)obj).getName();
- }
-
- Class<?> clazz = (obj instanceof java.lang.Class) ? (Class<?>)obj : obj.getClass();
- return getXmlRootElementQName(clazz);
- }
-
- /**
- * @param clazz
- * @return namespace of root element qname or null if this is not object does not represent a
- * root element
- */
- public static QName getXmlRootElementQName(Class<?> clazz) {
-
- // See if the object represents a root element
- XmlRootElement root = (XmlRootElement)getAnnotation(clazz, XmlRootElement.class);
- if (root == null) {
- return null;
- }
-
- String name = root.name();
- String namespace = root.namespace();
-
- // The name may need to be defaulted
- if (name == null || name.length() == 0 || name.equals("##default")) {
- name = getSimpleName(clazz.getCanonicalName());
- }
-
- // The namespace may need to be defaulted
- if (namespace == null || namespace.length() == 0 || namespace.equals("##default")) {
- Package pkg = clazz.getPackage();
- XmlSchema schema = (XmlSchema)getAnnotation(pkg, XmlSchema.class);
- if (schema != null) {
- namespace = schema.namespace();
- } else {
- namespace = "";
- }
- }
-
- return new QName(namespace, name);
- }
-
- /**
- * @param clazz
- * @return namespace of root element qname or null if this is not object does not represent a root element
- */
- public static String getEnumValue(Enum<?> myEnum) {
- Field f;
- String value;
- try {
- f = myEnum.getClass().getField(myEnum.name());
-
- f.setAccessible(true);
-
- XmlEnumValue xev = (XmlEnumValue)getAnnotation(f, XmlEnumValue.class);
- if (xev == null) {
- value = f.getName();
- } else {
- value = xev.value();
- }
- } catch (SecurityException e) {
- value = null;
- } catch (NoSuchFieldException e) {
- value = null;
- }
-
- return value;
- }
-
- /**
- * utility method to get the last token in a "."-delimited package+classname string
- *
- * @return
- */
- private static String getSimpleName(String in) {
- if (in == null || in.length() == 0) {
- return in;
- }
- String out = null;
- StringTokenizer tokenizer = new StringTokenizer(in, ".");
- if (tokenizer.countTokens() == 0)
- out = in;
- else {
- while (tokenizer.hasMoreTokens()) {
- out = tokenizer.nextToken();
- }
- }
- return out;
- }
-
- /**
- * The JAXBClass has a set of bean properties each represented by a PropertyDescriptor Each of
- * the fields of the class has an associated xml name. The method returns a map where the key is
- * the xml name and value is the PropertyDescriptor
- *
- * @param jaxbClass
- * @return map
- */
- public synchronized static Map<String, JAXBPropertyDescriptor> createPropertyDescriptorMap(Class<?> jaxbClass)
- throws NoSuchFieldException, IntrospectionException {
-
- Map<String, JAXBPropertyDescriptor> map = PROPERTY_MAP.get(jaxbClass);
- if (map != null) {
- return map;
- }
-
- map = new HashMap<String, JAXBPropertyDescriptor>();
- PropertyDescriptor[] pds = Introspector.getBeanInfo(jaxbClass).getPropertyDescriptors();
-
- // Unfortunately the element names are stored on the fields.
- // Get all of the fields in the class and super classes
-
- List<Field> fields = getFields(jaxbClass);
-
- // Now match up the fields with the property descriptors...Sigh why didn't JAXB put the @XMLElement annotations on the
- // property methods!
- for (PropertyDescriptor pd : pds) {
-
- // Skip over the class property..it is never represented as an xml element
- if (pd.getName().equals("class")) {
- continue;
- }
-
- // For the current property, find a matching field...so that we can get the xml name
- boolean found = false;
-
- int index = 0;
- for (Field field : fields) {
- String fieldName = field.getName();
-
- // Use the name of the field and property to find the match
- if (fieldName.equalsIgnoreCase(pd.getDisplayName()) || fieldName.equalsIgnoreCase(pd.getName())) {
- // Get the xmlElement name for this field
- QName xmlName = getXmlElementRefOrElementQName(field.getDeclaringClass(), field);
- found = true;
- map.put(xmlName.getLocalPart(), new JAXBPropertyDescriptor(pd, xmlName, index));
- index++;
- break;
- }
-
- // Unfortunately, sometimes the field name is preceeded by an underscore
- if (fieldName.startsWith("_")) {
- fieldName = fieldName.substring(1);
- if (fieldName.equalsIgnoreCase(pd.getDisplayName()) || fieldName.equalsIgnoreCase(pd.getName())) {
- // Get the xmlElement name for this field
- QName xmlName = getXmlElementRefOrElementQName(field.getDeclaringClass(), field);
- found = true;
-
- map.put(xmlName.getLocalPart(), new JAXBPropertyDescriptor(pd, xmlName, index));
- index++;
- break;
- }
- }
- }
-
- // We didn't find a field. Default the xmlname to the property name
- if (!found) {
- String xmlName = pd.getName();
-
- map.put(xmlName, new JAXBPropertyDescriptor(pd, xmlName, index));
- index++;
- }
- }
- PROPERTY_MAP.put(jaxbClass, map);
- return map;
- }
-
- /**
- * Gets all of the fields in this class and the super classes
- *
- * @param beanClass
- * @return
- */
- static private List<Field> getFields(final Class<?> beanClass) {
- // This class must remain private due to Java 2 Security concerns
- List<Field> fields = AccessController.doPrivileged(new PrivilegedAction<List<Field>>() {
- public List<Field> run() {
- List<Field> fields = new ArrayList<Field>();
- Class<?> cls = beanClass;
- while (cls != null) {
- Field[] fieldArray = cls.getDeclaredFields();
- for (Field field : fieldArray) {
- fields.add(field);
- }
- cls = cls.getSuperclass();
- }
- return fields;
- }
- });
-
- return fields;
- }
-
- /**
- * Get the name of the field by looking at the XmlElement annotation.
- *
- * @param jaxbClass
- * @param fieldName
- * @return
- * @throws NoSuchFieldException
- */
- private static QName getXmlElementRefOrElementQName(Class<?> jaxbClass, Field field) throws NoSuchFieldException {
- XmlElementRef xmlElementRef = (XmlElementRef)getAnnotation(field, XmlElementRef.class);
- if (xmlElementRef != null) {
- return new QName(xmlElementRef.namespace(), xmlElementRef.name());
- }
- XmlElement xmlElement = (XmlElement)getAnnotation(field, XmlElement.class);
-
- // If XmlElement does not exist, default to using the field name
- if (xmlElement == null || xmlElement.name().equals("##default")) {
- return new QName("", field.getName());
- }
- return new QName(xmlElement.namespace(), xmlElement.name());
- }
-
- /**
- * Get an annotation. This is wrappered to avoid a Java2Security violation.
- * @param cls Class that contains annotation
- * @param annotation Class of requrested Annotation
- * @return annotation or null
- */
- private static <T extends Annotation> T getAnnotation(final AnnotatedElement element, final Class<T> annotation) {
- return AccessController.doPrivileged(new PrivilegedAction<T>() {
- public T run() {
- return element.getAnnotation(annotation);
- }
- });
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.java
deleted file mode 100644
index af3fa3fb66..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/XMLStreamReader2JAXB.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.databinding.jaxb;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2JAXB extends BaseTransformer<XMLStreamReader, Object> implements
- PullTransformer<XMLStreamReader, Object> {
-
- public XMLStreamReader2JAXB() {
- super();
- }
-
- public Object transform(XMLStreamReader source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, false);
- Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
- // FIXME: [rfeng] If the java type is Object.class, the unmarshalled result will be
- // a DOM Node
- Object result = unmarshaller.unmarshal(source, JAXBContextHelper.getJavaType(context.getTargetDataType()));
- source.close();
- return JAXBContextHelper.createReturnValue(jaxbContext, context.getTargetDataType(), result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JAXBDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index 3f2978ad25..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;name=javax.xml.bind.JAXBElement
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index 4e062e4c22..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /dev/null
@@ -1,32 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=javax.xml.bind.JAXBElement,target=org.w3c.dom.Node,weight=500
-org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=javax.xml.bind.JAXBElement,weight=500
-org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;source=java.io.Reader,target=javax.xml.bind.JAXBElement,weight=510
-org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=javax.xml.bind.JAXBElement,weight=490
-
-org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=java:complexType,target=org.w3c.dom.Node,weight=90000
-org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=java:complexType,weight=90000
-
-org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;source=org.w3c.dom.Node,target=java:simpleType,weight=90000
-org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;source=java:simpleType,target=org.w3c.dom.Node,weight=90000
-
-org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=java:complexType,weight=90000
-org.apache.tuscany.sca.databinding.jaxb.XMLStreamReader2JAXB;source=javax.xml.stream.XMLStreamReader,target=java:simpleType,weight=90000
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint
deleted file mode 100644
index d1f6d9f1e3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.databinding.jaxb.DefaultXMLAdapterExtensionPoint \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/com/example/stock/StockQuoteOffer.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/com/example/stock/StockQuoteOffer.java
deleted file mode 100644
index 5c5c892f33..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/com/example/stock/StockQuoteOffer.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 com.example.stock;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-/**
- * <p>Java class for anonymous complex type.
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"input"})
-@XmlRootElement(name = "stockQuoteOffer")
-public class StockQuoteOffer {
-
- protected String input;
-
- public String getInput() {
- return this.input;
- }
-
- public void setInput(String input) {
- this.input = input;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
deleted file mode 100644
index 602bc66569..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/BeanXMLStreamReaderImpl.java
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.xml.SimpleXmlNodeImpl;
-import org.apache.tuscany.sca.databinding.xml.XmlNode;
-import org.apache.tuscany.sca.databinding.xml.XmlTreeStreamReaderImpl;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.jvnet.jaxb.reflection.model.annotation.RuntimeInlineAnnotationReader;
-import org.jvnet.jaxb.reflection.model.core.Ref;
-import org.jvnet.jaxb.reflection.model.impl.RuntimeModelBuilder;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimeClassInfo;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimePropertyInfo;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet;
-import org.jvnet.jaxb.reflection.runtime.IllegalAnnotationsException;
-import org.jvnet.jaxb.reflection.runtime.JAXBContextImpl;
-
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
- private static final Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
- public int compare(Accessor o1, Accessor o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
- private static final String XSI_PREFIX = "xsi";
- private static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
-
- private static XmlNode getXSIType(QName realType) {
- QName xsiType = new QName(XSI_NS, "type", XSI_PREFIX);
- String prefix = realType.getPrefix();
- String typeName = realType.getLocalPart();
- if (prefix != null && !prefix.equals("")) {
- typeName = prefix + ":" + realType.getLocalPart();
- }
- return new SimpleXmlNodeImpl(xsiType, XmlNode.Type.ATTRIBUTE);
- }
-
- /**
- * Represent a Map.Entry XML node
- * @version $Rev$ $Date$
- */
- public static class MapEntryXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
- private Map.Entry entry;
-
- public MapEntryXmlNodeImpl(Entry entry) {
- super(new QName("", "entry"), entry);
- this.entry = entry;
- }
-
- @Override
- public Iterator<XmlNode> children() {
- List<XmlNode> nodes = new ArrayList<XmlNode>();
- XmlNode key = new BeanXmlNodeImpl(new QName("", "key"), entry.getKey());
- XmlNode value = new BeanXmlNodeImpl(new QName("", "value"), entry.getValue());
- nodes.add(key);
- nodes.add(value);
- return nodes.iterator();
- }
- }
-
- public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
- private static final Object[] NULL = null;
- private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
-
- public BeanXmlNodeImpl(Object bean) {
- super(getName(bean == null ? null : bean.getClass()), bean);
- }
-
- public BeanXmlNodeImpl(QName name, Object bean) {
- super(name, bean);
- }
-
- private static boolean isSimpleType(Class<?> javaType) {
- return SimpleTypeMapperImpl.getXMLType(javaType) != null;
- }
-
- private static String getStringValue(Object o) {
- if (o == null) {
- return null;
- }
- TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
- if (info != null) {
- return MAPPER.toXMLLiteral(info.getQName(), o, null);
- } else {
- return String.valueOf(o);
- }
- }
-
- @Override
- public Iterator<XmlNode> children() {
- if (name == null) {
- return null;
- }
- if (value == null) {
- return super.children();
- }
- if (isSimpleType(value.getClass())) {
- XmlNode textNode = new BeanXmlNodeImpl(null, value);
- return Arrays.asList(textNode).iterator();
- }
- if (Map.class.isAssignableFrom(value.getClass())) {
- List<XmlNode> entries = new ArrayList<XmlNode>();
- Map map = (Map)value;
- if (map != null) {
- for (Object e : map.entrySet()) {
- Map.Entry entry = (Map.Entry)e;
- entries.add(new MapEntryXmlNodeImpl(entry));
- }
- }
- return entries.iterator();
- }
- try {
- Map<String, Accessor> accessorMap = getAccessors(value);
- List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
- Collections.sort(accessorList, COMPARATOR);
-
- List<XmlNode> props = new ArrayList<XmlNode>();
- for (Accessor accessor : accessorList) {
- Class<?> pType = accessor.getType();
-
- QName pName = new QName(name.getNamespaceURI(), accessor.getName());
- Object pValue = accessor.getValue();
- if (pType.isArray()) {
- if (pValue != null) {
- int i1 = Array.getLength(pValue);
- for (int j = 0; j < i1; j++) {
- Object o = Array.get(pValue, j);
- props.add(new BeanXmlNodeImpl(pName, o));
- }
- } else {
- // TODO: How to handle null?
- }
- } else if (Collection.class.isAssignableFrom(pType)) {
- Collection objList = (Collection)pValue;
- if (objList != null && objList.size() > 0) {
- for (Iterator j = objList.iterator(); j.hasNext();) {
- Object o = j.next();
- props.add(new BeanXmlNodeImpl(pName, o));
- }
-
- } else {
- // How to handle null
- }
- } else {
- props.add(new BeanXmlNodeImpl(pName, pValue));
- }
- }
- return props.iterator();
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public QName getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return getStringValue(value);
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static QName getName(Class<?> cls) {
- if (cls == null) {
- return null;
- }
-
- String packageName = getPackageName(cls);
-
- if ("".equals(packageName)) {
- return new QName("", cls.getSimpleName());
- }
- StringBuffer ns = new StringBuffer("http://");
- String[] names = packageName.split("\\.");
- for (int i = names.length - 1; i >= 0; i--) {
- ns.append(names[i]);
- if (i != 0) {
- ns.append('.');
- }
- }
- ns.append('/');
- return new QName(ns.toString(), cls.getSimpleName());
- }
- }
-
- public BeanXMLStreamReaderImpl(QName name, Object bean) {
- super(getXmlNode(name, bean));
- }
-
- private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
- BeanXmlNodeImpl root = null;
- if (name != null) {
- root = new BeanXmlNodeImpl(name, bean);
- } else {
- root = new BeanXmlNodeImpl(bean);
- }
- return root;
- }
-
- public static interface Accessor {
- String getName();
-
- Class<?> getType();
-
- Object getValue() throws Exception;
-
- void setValue(Object value) throws Exception;
- }
-
- private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
- IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
- RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
- JAXBContextImpl context =
- new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
- RuntimeModelBuilder builder =
- new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
- builder.setErrorHandler(errorListener);
- for (Class c : classes)
- builder.getTypeInfo(new Ref<Type, Class>(c));
-
- RuntimeTypeInfoSet r = builder.link();
- errorListener.check();
- return r;
- }
-
- private static class JAXBAccessor implements Accessor {
- private Object target;
- private RuntimePropertyInfo prop;
-
- public JAXBAccessor(Object target, RuntimePropertyInfo field) {
- super();
- this.target = target;
- this.prop = field;
- }
-
- public String getName() {
- return prop.getName();
- }
-
- public Object getValue() throws Exception {
- return prop.getAccessor().get(target);
- }
-
- public void setValue(Object value) throws Exception {
- prop.getAccessor().set(target, value);
- }
-
- public Class<?> getType() {
- Type type = prop.getRawType();
- if (type instanceof Class) {
- return (Class<?>)type;
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- type = pType.getRawType();
- if (type instanceof Class) {
- return (Class<?>)type;
- }
- }
- return Object.class;
- }
-
- }
-
- private static Map<String, Accessor> getAccessors(Object target) throws Exception {
- if (target == null) {
- return Collections.emptyMap();
- }
- Map<String, Accessor> map = new HashMap<String, Accessor>();
- Class<?> type = target.getClass();
- RuntimeTypeInfoSet set = create(type);
- RuntimeClassInfo clsInfo = (RuntimeClassInfo)set.getTypeInfo(type);
- for (RuntimePropertyInfo f : clsInfo.getProperties()) {
- map.put(f.getName(), new JAXBAccessor(target, f));
- }
- return map;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java
deleted file mode 100644
index e2151e23a1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXB2XMLStreamReader.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXB2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
- PullTransformer<Object, XMLStreamReader> {
-
- public JAXB2XMLStreamReader() {
- super();
- }
-
- public XMLStreamReader transform(Object source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- QName name = null;
- Object bean = null;
- if (source instanceof JAXBElement) {
- bean = ((JAXBElement)source).getValue();
- name = ((JAXBElement)source).getName();
- } else {
- JAXBContext jaxbContext = JAXBContextHelper.createJAXBContext(context, true);
- Object element = JAXBContextHelper.createJAXBElement(jaxbContext, context.getSourceDataType(), source);
- name = jaxbContext.createJAXBIntrospector().getElementName(element);
- bean = source;
- }
- BeanXMLStreamReaderImpl reader = new BeanXMLStreamReaderImpl(name, bean);
- return reader;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JAXBDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCacheTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCacheTestCase.java
deleted file mode 100644
index 761414e92b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCacheTestCase.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextCache;
-import org.apache.tuscany.sca.databinding.util.LRUCache;
-import org.junit.Test;
-
-import com.example.ipo.jaxb.Address;
-import com.example.ipo.jaxb.PurchaseOrderType;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JAXBContextCacheTestCase {
- @Test
- public void testCache() throws JAXBException {
- JAXBContextCache cache = new JAXBContextCache();
- JAXBContext context1 = cache.getJAXBContext(String.class);
- JAXBContext context2 = cache.getJAXBContext(int.class);
- JAXBContext context3 = cache.getJAXBContext(String[].class);
- JAXBContext context4 = cache.getJAXBContext(Source.class);
- Assert.assertSame(context1, context2);
- Assert.assertNotSame(context2, context3);
- Assert.assertSame(context1, context4);
-
- QName name = new QName("http://example.com/ns1", "e1");
- JAXBElement<String> element = new JAXBElement<String>(name, String.class, "123");
- StringWriter sw = new StringWriter();
- context4.createMarshaller().marshal(element, sw);
- StreamSource source = new StreamSource(new StringReader(sw.toString()), null);
- context4.createUnmarshaller().unmarshal(source, String.class);
-
- JAXBContext context5 = cache.getJAXBContext(Address.class);
- JAXBContext context6 = cache.getJAXBContext(PurchaseOrderType.class);
- Assert.assertSame(context5, context6);
- }
-
- @Test
- public void testLRUCache() {
- LRUCache<String, String> cache = new LRUCache<String, String>(3);
- cache.put("1", "A");
- Assert.assertEquals(1, cache.size());
- cache.put("2", "B");
- Assert.assertEquals(2, cache.size());
- cache.put("3", "C");
- Assert.assertEquals(3, cache.size());
- cache.put("4", "D");
- Assert.assertEquals(3, cache.size());
- String data = cache.get("1");
- Assert.assertNull(data);
- data = cache.get("2");
- Assert.assertEquals("B", data);
- cache.put("5", "E");
- data = cache.get("2");
- Assert.assertEquals("B", data);
- }
-
- @Test
- public void testPerf() throws JAXBException {
- JAXBContextCache cache = new JAXBContextCache();
-
- // Test JAXBContext for simple java classes
- long start = System.currentTimeMillis();
- for (int i = 0; i < 100; i++) {
- JAXBContext context = JAXBContext.newInstance(String.class);
- }
- long end = System.currentTimeMillis();
- long d1 = end - start;
- start = System.currentTimeMillis();
- for (int i = 0; i < 100; i++) {
- JAXBContext context = cache.getJAXBContext(String.class);
- }
- end = System.currentTimeMillis();
- long d2 = end - start;
- System.out.println(d1 + "ms vs. " + d2 + "ms");
-
- // Test JAXBContext for generated JAXB classes
- start = System.currentTimeMillis();
- for (int i = 0; i < 20; i++) {
- JAXBContext context = JAXBContext.newInstance(PurchaseOrderType.class);
- }
- end = System.currentTimeMillis();
- d1 = end - start;
- start = System.currentTimeMillis();
- for (int i = 0; i < 20; i++) {
- JAXBContext context = cache.getJAXBContext(PurchaseOrderType.class);
- }
- end = System.currentTimeMillis();
- d2 = end - start;
- System.out.println(d1 + "ms vs. " + d2 + "ms");
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java
deleted file mode 100644
index 5452175c54..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBDataBindingTestCase.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.ipo.jaxb.ObjectFactory;
-import com.example.ipo.jaxb.PurchaseOrderType;
-import com.example.ipo.jaxb.USAddress;
-import com.example.ipo.jaxb.USState;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXBDataBindingTestCase extends TestCase {
- private JAXBDataBinding binding;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- binding = new JAXBDataBinding();
- }
-
- /**
- * Test method for
- * {@link org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding#introspect(java.lang.Class, Operation)}.
- */
- public final void testIntrospect() {
- DataType dataType = new DataTypeImpl<Class>(JAXBElement.class, null);
- Operation op = null;
- boolean yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertTrue(dataType.getDataBinding().equals(binding.getName()));
- assertTrue(dataType.getPhysical() == JAXBElement.class && dataType.getLogical() == XMLType.UNKNOWN);
- dataType = new DataTypeImpl<Class>(MockJAXBElement.class, null);
- yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertEquals(MockJAXBElement.class, dataType.getPhysical());
- assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
- .getTypeName());
- dataType = new DataTypeImpl<Class>(USAddress.class, null);
- yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertEquals(USAddress.class, dataType.getPhysical());
- assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
- .getTypeName());
- dataType = new DataTypeImpl<Class>(USState.class, null);
- yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertTrue(dataType.getDataBinding().equals(binding.getName()));
- assertEquals(USState.class, dataType.getPhysical());
- assertEquals(new QName("http://www.example.com/IPO", "USState"), ((XMLType)dataType.getLogical()).getTypeName());
-
- }
-
- private static class MockJAXBElement extends JAXBElement<PurchaseOrderType> {
-
- private static final long serialVersionUID = -2767569071002707973L;
-
- /**
- * @param elementName
- * @param type
- * @param value
- */
- public MockJAXBElement(QName elementName, Class<PurchaseOrderType> type, PurchaseOrderType value) {
- super(elementName, type, value);
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public void testCopy() {
- ObjectFactory factory = new ObjectFactory();
- PurchaseOrderType poType = factory.createPurchaseOrderType();
- JAXBElement<PurchaseOrderType> po = factory.createPurchaseOrder(poType);
- JAXBElement<PurchaseOrderType> copy = (JAXBElement<PurchaseOrderType>)binding.copy(po, null, null);
- assertEquals(new QName("http://www.example.com/IPO", "purchaseOrder"), copy.getName());
- }
-
- @SuppressWarnings("unchecked")
- public void testCopyNonElement() {
- ObjectFactory factory = new ObjectFactory();
- PurchaseOrderType poType = factory.createPurchaseOrderType();
- poType.setComment("Comment");
- PurchaseOrderType copy = (PurchaseOrderType)binding.copy(poType, null, null);
- assertTrue(copy instanceof PurchaseOrderType);
- assertEquals("Comment", (copy).getComment());
- }
-
- @SuppressWarnings("unchecked")
- public void testCopyNonRoot() {
- ObjectFactory factory = new ObjectFactory();
- USAddress address = factory.createUSAddress();
- address.setCity("San Jose");
- USAddress copy = (USAddress)binding.copy(address, null, null);
- assertTrue(copy instanceof USAddress);
- assertEquals("San Jose", (copy).getCity());
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java
deleted file mode 100644
index 500422c9c7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBReflectionTestCase.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.jvnet.jaxb.reflection.model.annotation.RuntimeInlineAnnotationReader;
-import org.jvnet.jaxb.reflection.model.core.Ref;
-import org.jvnet.jaxb.reflection.model.impl.RuntimeModelBuilder;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimeClassInfo;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimePropertyInfo;
-import org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet;
-import org.jvnet.jaxb.reflection.runtime.IllegalAnnotationsException;
-import org.jvnet.jaxb.reflection.runtime.JAXBContextImpl;
-
-import com.example.ipo.jaxb.ObjectFactory;
-import com.example.ipo.jaxb.PurchaseOrderType;
-import com.example.ipo.jaxb.USAddress;
-import com.example.ipo.jaxb.USState;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JAXBReflectionTestCase extends TestCase {
-
- public void testGenerateSchema() throws Exception {
- JAXBContext context = JAXBContext.newInstance("com.example.ipo.jaxb");
- Map<String, String> schemas = JAXBTypeHelper.generateSchema(context);
- System.out.println(schemas);
- }
-
- /**
- * This is a workaround for the NPE bug in jaxb-reflection
- * @param classes
- * @return
- * @throws Exception
- */
- @SuppressWarnings("unchecked")
- private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
- IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
- RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
- JAXBContextImpl context =
- new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
- RuntimeModelBuilder builder =
- new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
- builder.setErrorHandler(errorListener);
- for (Class c : classes)
- builder.getTypeInfo(new Ref<Type, Class>(c));
-
- RuntimeTypeInfoSet r = builder.link();
- errorListener.check();
- return r;
- }
-
- public void testReflection() throws Exception {
- org.jvnet.jaxb.reflection.model.runtime.RuntimeTypeInfoSet model = create(PurchaseOrderType.class);
- RuntimeClassInfo type = (RuntimeClassInfo)model.getTypeInfo(PurchaseOrderType.class);
- Assert.assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), type.getTypeName());
- type = (RuntimeClassInfo)model.getTypeInfo(USAddress.class);
- Assert.assertEquals(new QName("http://www.example.com/IPO", "USAddress"), type.getTypeName());
- RuntimePropertyInfo prop = type.getProperty("state");
- Assert.assertNotNull(prop);
- USAddress address = new ObjectFactory().createUSAddress();
- prop.getAccessor().set(address, USState.CA);
- Assert.assertEquals(USState.CA, address.getState());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java
deleted file mode 100644
index 53779a1af6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBTestCase.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.jaxb.JAXB2Node;
-import org.apache.tuscany.sca.databinding.jaxb.Node2JAXB;
-import org.apache.tuscany.sca.databinding.jaxb.Reader2JAXB;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Node;
-
-import com.example.ipo.jaxb.ObjectFactory;
-import com.example.ipo.jaxb.PurchaseOrderType;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXBTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testTransform() throws Exception {
- Reader2JAXB t0 = new Reader2JAXB();
-
- DataType targetDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
-
- TransformationContext tContext = createMock(TransformationContext.class);
- expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
- expect(tContext.getTargetOperation()).andReturn(null).anyTimes();
- replay(tContext);
-
- Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
-
- DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
-
- TransformationContext tContext1 = createMock(TransformationContext.class);
- expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
- expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
- expect(tContext1.getSourceOperation()).andReturn(null).anyTimes();
- expect(tContext1.getTargetOperation()).andReturn(null).anyTimes();
- replay(tContext1);
-
- JAXB2Node t1 = new JAXB2Node();
- Node node = t1.transform(object1, tContext1);
-
- Assert.assertNotNull(node);
-
- Node2JAXB t2 = new Node2JAXB();
- Object object2 = t2.transform(node, tContext);
- Assert.assertNotNull(object2);
-
- }
-
- public void testTransform2() throws Exception {
- Reader2JAXB t0 = new Reader2JAXB();
-
- QName root = new QName("http://www.example.com/IPO", "purchaseOrder");
- DataType targetDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
- // targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
-
- TransformationContext tContext = createMock(TransformationContext.class);
- expect(tContext.getTargetDataType()).andReturn(targetDataType).anyTimes();
- expect(tContext.getTargetOperation()).andReturn(null).anyTimes();
- replay(tContext);
-
- Object object1 = t0.transform(new StringReader(IPO_XML), tContext);
-
- DataType sourceDataType = new DataTypeImpl<XMLType>(PurchaseOrderType.class, new XMLType(root, null));
- // sourceDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH, contextPath);
-
- TransformationContext tContext1 = createMock(TransformationContext.class);
- expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
- expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
- expect(tContext1.getSourceOperation()).andReturn(null).anyTimes();
- expect(tContext1.getTargetOperation()).andReturn(null).anyTimes();
- replay(tContext1);
-
- JAXB2Node t1 = new JAXB2Node();
- Node node = t1.transform(object1, tContext1);
-
- Assert.assertNotNull(node);
-
- Node2JAXB t2 = new Node2JAXB();
- Object object2 = t2.transform(node, tContext);
- Assert.assertNotNull(object2);
-
- }
-
- public void testTransform3() throws Exception {
-
- DataType sourceDataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
-
- TransformationContext tContext1 = createMock(TransformationContext.class);
- expect(tContext1.getSourceDataType()).andReturn(sourceDataType).anyTimes();
- expect(tContext1.getTargetDataType()).andReturn(null).anyTimes();
- expect(tContext1.getSourceOperation()).andReturn(null).anyTimes();
- expect(tContext1.getTargetOperation()).andReturn(null).anyTimes();
- replay(tContext1);
-
- JAXB2Node t1 = new JAXB2Node();
- PurchaseOrderType po = new ObjectFactory().createPurchaseOrderType();
- Node node = t1.transform(po, tContext1);
-
- Assert.assertNotNull(node);
-
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java
deleted file mode 100644
index 501f5b21b7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/JAXBWrapperHandlerTestCase.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBWrapperHandler;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.stock.StockQuoteOffer;
-
-/**
- * Test case for JAXBExceptionHandler
- *
- * @version $Rev$ $Date$
- */
-public class JAXBWrapperHandlerTestCase extends TestCase {
- private static final QName ELEMENT = new QName("http://www.example.com/stock", "stockQuoteOffer");
- private static final QName INPUT = new QName("", "input");
- private JAXBWrapperHandler handler;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- this.handler = new JAXBWrapperHandler();
- }
-
- public void testCreate() {
- ElementInfo element = new ElementInfo(ELEMENT, null);
- Operation op = new OperationImpl();
- WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, element, null);
- wrapperInfo.setWrapperType(new DataTypeImpl<XMLType>(JAXBDataBinding.NAME, StockQuoteOffer.class,
- XMLType.UNKNOWN));
- op.setInputWrapper(wrapperInfo);
- Object offer = handler.create(op, true);
- Assert.assertTrue(offer instanceof StockQuoteOffer);
- }
-
- public void testSetChild() {
- StockQuoteOffer wrapper = new StockQuoteOffer();
- handler.setChild(wrapper, 0, new ElementInfo(INPUT, null), "IBM");
- Assert.assertEquals("IBM", wrapper.getInput());
- }
-
- public void testGetChildren() {
- StockQuoteOffer wrapper = new StockQuoteOffer();
- wrapper.setInput("IBM");
- List<ElementInfo> elements = new ArrayList<ElementInfo>();
- elements.add(new ElementInfo(INPUT, null));
- WrapperInfo wrapperInfo = new WrapperInfo(JAXBDataBinding.NAME, null, elements);
- Operation op = new OperationImpl();
- op.setInputWrapper(wrapperInfo);
- List children = handler.getChildren(wrapper, op, true);
- assertNotNull(children);
- assertEquals(1, children.size());
- assertEquals("IBM", children.get(0));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyBean.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyBean.java
deleted file mode 100644
index 9bdfb108fe..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyBean.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.databinding.jaxb;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class MyBean {
- private int age;
- private String name;
- private float[] rates = new float[] {1.0f, 2.0f};
- private List<String> notes = new ArrayList<String>();
- private Map<String, Integer> map = new HashMap<String, Integer>();
- private Object service;
- private Object otherService;
- private boolean good;
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<String> getNotes() {
- return notes;
- }
-
- public void setNotes(List<String> notes) {
- this.notes = notes;
- }
-
- public float[] getRates() {
- return rates;
- }
-
- public void setRates(float[] rates) {
- this.rates = rates;
- }
-
- public Map<String, Integer> getMap() {
- return map;
- }
-
- public void setMap(Map<String, Integer> map) {
- this.map = map;
- }
-
- public Object getService() {
- return service;
- }
-
- public void setService(Object service) {
- this.service = service;
- }
-
- public Object getOtherService() {
- return otherService;
- }
-
- public void setOtherService(Object otherService) {
- this.otherService = otherService;
- }
-
- public boolean isGood() {
- return good;
- }
-
- public void setGood(boolean good) {
- this.good = good;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + (good ? 1231 : 1237);
- result = prime * result + ((map == null) ? 0 : map.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((notes == null) ? 0 : notes.hashCode());
- result = prime * result + ((otherService == null) ? 0 : otherService.hashCode());
- result = prime * result + Arrays.hashCode(rates);
- result = prime * result + ((service == null) ? 0 : service.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MyBean other = (MyBean)obj;
- if (age != other.age)
- return false;
- if (good != other.good)
- return false;
- if (map == null) {
- if (other.map != null)
- return false;
- } else if (!map.equals(other.map))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (notes == null) {
- if (other.notes != null)
- return false;
- } else if (!notes.equals(other.notes))
- return false;
- if (otherService == null) {
- if (other.otherService != null)
- return false;
- } else if (!otherService.equals(other.otherService))
- return false;
- if (!Arrays.equals(rates, other.rates))
- return false;
- if (service == null) {
- if (other.service != null)
- return false;
- } else if (!service.equals(other.service))
- return false;
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterface.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterface.java
deleted file mode 100644
index b8e9ee7f7d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterface.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.databinding.jaxb;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface MyInterface {
- void setId(String id);
-
- String getId();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterfaceImpl.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterfaceImpl.java
deleted file mode 100644
index 5c511e6ccb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyInterfaceImpl.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.databinding.jaxb;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MyInterfaceImpl implements MyInterface {
- private String id;
-
- /**
- * @see org.apache.tuscany.databinding.jaxb.MyInterface#getId()
- */
- public String getId() {
- return id;
- }
-
- /**
- * @see org.apache.tuscany.databinding.jaxb.MyInterface#setId(java.lang.String)
- */
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MyInterfaceImpl other = (MyInterfaceImpl)obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyJaxbBean.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyJaxbBean.java
deleted file mode 100644
index 3c3992524a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MyJaxbBean.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.adapters.XmlAdapter;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-
-import org.w3c.dom.Element;
-
-/**
- *
- */
-@XmlRootElement(name = "myBean", namespace = "http://ns1")
-public class MyJaxbBean {
- public MyBean myBean;
-
- @XmlJavaTypeAdapter(AnyTypeXmlAdapter.class)
- public MyInterface myInterface;
-
- @XmlElement(type = MyInterfaceImpl.class)
- public MyInterface myInterface1;
-
- @XmlJavaTypeAdapter(MyInterfaceAdapter.class)
- public MyInterface myInterface2;
-
- public Object myObject;
-
- @XmlAnyElement
- public Element anyElement;
-
- public static class MyInterfaceAdapter extends XmlAdapter<MyInterfaceImpl, MyInterface> {
-
- @Override
- public MyInterfaceImpl marshal(MyInterface v) throws Exception {
- return (MyInterfaceImpl) v;
- }
-
- @Override
- public MyInterface unmarshal(MyInterfaceImpl v) throws Exception {
- return (MyInterface) v;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MySubBean.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MySubBean.java
deleted file mode 100644
index 62dfa6f73c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/MySubBean.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.databinding.jaxb;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MySubBean extends MyBean {
- private String addtional;
-
- public String getAddtional() {
- return addtional;
- }
-
- public void setAddtional(String addtional) {
- this.addtional = addtional;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java
deleted file mode 100644
index fdfa87ff43..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/java/org/apache/tuscany/sca/databinding/jaxb/POJOTestCase.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.jaxb;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.transform.stream.StreamSource;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-
-import com.sun.xml.bind.v2.model.annotation.RuntimeInlineAnnotationReader;
-import com.sun.xml.bind.v2.model.core.Ref;
-import com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder;
-import com.sun.xml.bind.v2.model.runtime.RuntimeClassInfo;
-import com.sun.xml.bind.v2.model.runtime.RuntimePropertyInfo;
-import com.sun.xml.bind.v2.model.runtime.RuntimeTypeInfoSet;
-import com.sun.xml.bind.v2.runtime.IllegalAnnotationsException;
-import com.sun.xml.bind.v2.runtime.JAXBContextImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class POJOTestCase extends TestCase {
- public void testAdapter() throws Exception {
- JAXBContext context = JAXBContext.newInstance(MyJaxbBean.class, MyInterfaceImpl.class);
- StringWriter writer = new StringWriter();
- MyJaxbBean bean = new MyJaxbBean();
- bean.myBean = new MySubBean();
- bean.myBean.setName("Ray");
- bean.myInterface = new MyInterfaceImpl();
- bean.myInterface.setId("001");
- bean.myObject = new MyBean();
- ((MyBean) bean.myObject).setName("Y");
- context.createMarshaller().marshal(bean, writer);
- System.out.println(writer.toString());
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof MyJaxbBean);
- Map<String, String> schemas = JAXBTypeHelper.generateSchema(context);
- System.out.println(schemas);
- }
-
- public void testPOJO() throws Exception {
- JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
- StringWriter writer = new StringWriter();
- MyBean bean = new MyBean();
- bean.setName("Test");
- bean.setAge(20);
- bean.getNotes().add("1");
- bean.getNotes().add("2");
- bean.getMap().put("1", 1);
- MyInterface service = new MyInterfaceImpl();
- service.setId("ID001");
- bean.setService(service);
- bean.setOtherService(service);
- JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, bean);
- context.createMarshaller().marshal(element, writer);
- // System.out.println(writer.toString());
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof MyBean);
- MyBean newBean = (MyBean)e2.getValue();
- assertEquals(bean, newBean);
- }
-
- public void testPOJOArray() throws Exception {
- JAXBContext context = JAXBContext.newInstance(MyBean[].class, MySubBean.class);
- StringWriter writer = new StringWriter();
- MySubBean bean = new MySubBean();
- bean.setAddtional("SUB");
- bean.setName("Test");
- bean.setAge(20);
- bean.getNotes().add("1");
- bean.getNotes().add("2");
- bean.getMap().put("1", 1);
-
- JAXBElement<Object> element =
- new JAXBElement<Object>(new QName("http://ns1", "beans"), Object.class, new MyBean[] {bean});
- context.createMarshaller().marshal(element, writer);
- System.out.println(writer.toString());
-
- Object result =
- context.createUnmarshaller().unmarshal(new StreamSource(new StringReader(writer.toString())),
- MyBean[].class);
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof MyBean[]);
- MyBean newBean = ((MyBean[])e2.getValue())[0];
- assertTrue(newBean instanceof MySubBean);
- }
-
- public void testXMLStreamReader() throws Exception {
- JAXBContext context = JAXBContext.newInstance(MyBean.class, MyInterfaceImpl.class);
-
- MyBean bean = new MyBean();
- bean.setName("Test");
- bean.setAge(20);
- bean.getNotes().add("1");
- bean.getNotes().add("2");
- bean.getMap().put("1", 1);
- MyInterface service = new MyInterfaceImpl();
- service.setId("ID001");
- bean.setService(service);
- bean.setOtherService(service);
- QName name = new QName("http://ns1", "bean");
- JAXBElement<Object> element = new JAXBElement<Object>(name, Object.class, bean);
- TransformationContext tContext = new TransformationContextImpl();
- XMLStreamReader reader = new JAXB2XMLStreamReader().transform(element, tContext);
-
-// XMLStreamReader2String t2 = new XMLStreamReader2String();
-// String xml = t2.transform(reader, null);
- // System.out.println(xml);
- Object result = context.createUnmarshaller().unmarshal(reader, MyBean.class);
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof MyBean);
- MyBean newBean = (MyBean)e2.getValue();
- // FIXME :To be implemented
- // assertEquals(bean, newBean);
- }
-
- public void testString() throws Exception {
- JAXBContext context = JAXBContext.newInstance(String.class);
- StringWriter writer = new StringWriter();
- JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC");
- context.createMarshaller().marshal(element, writer);
- // System.out.println(writer.toString());
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertEquals("ABC", e2.getValue());
- }
-
- public void testNull() throws Exception {
- JAXBContext context = JAXBContext.newInstance(String.class);
- StringWriter writer = new StringWriter();
- JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, null);
- element.setNil(true);
- context.createMarshaller().marshal(element, writer);
- // System.out.println(writer.toString());
- StreamSource source = new StreamSource(new StringReader(writer.toString()));
- Object result = context.createUnmarshaller().unmarshal(source, String.class);
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertNull(e2.getValue());
- }
-
- public void testArray() throws Exception {
- JAXBContext context = JAXBContext.newInstance(String[].class);
- StringWriter writer = new StringWriter();
- JAXBElement<Object> element =
- new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, new String[] {"ABC", "123"});
- context.createMarshaller().marshal(element, writer);
- // System.out.println(writer.toString());
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof String[]);
- }
-
- public void testByteArray() throws Exception {
- JAXBContext context = JAXBContext.newInstance(byte[].class);
- StringWriter writer = new StringWriter();
- JAXBElement<Object> element =
- new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, "ABC".getBytes());
- context.createMarshaller().marshal(element, writer);
- String xml = writer.toString();
- assertTrue(xml.contains("QUJD"));
- assertTrue(xml.contains("base64Binary"));
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(xml));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof byte[]);
- }
-
- public void testPrimitive() throws Exception {
- JAXBContext context = JAXBContext.newInstance(int.class);
- StringWriter writer = new StringWriter();
- JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, 1);
- context.createMarshaller().marshal(element, writer);
- // System.out.println(writer.toString());
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertEquals(1, e2.getValue());
- }
-
- /*
- public void testException() throws Exception {
- JAXBContext context = JAXBContext.newInstance(IllegalArgumentException.class);
- StringWriter writer = new StringWriter();
- Exception e = new IllegalArgumentException("123");
- JAXBElement<Object> element = new JAXBElement<Object>(new QName("http://ns1", "bean"), Object.class, e);
- context.createMarshaller().marshal(element, writer);
- System.out.println(writer.toString());
-
- Object result = context.createUnmarshaller().unmarshal(new StringReader(writer.toString()));
- assertTrue(result instanceof JAXBElement);
- JAXBElement e2 = (JAXBElement)result;
- assertTrue(e2.getValue() instanceof Exception);
- }
- */
-
- private static RuntimeTypeInfoSet create(Class... classes) throws Exception {
- IllegalAnnotationsException.Builder errorListener = new IllegalAnnotationsException.Builder();
- RuntimeInlineAnnotationReader reader = new RuntimeInlineAnnotationReader();
- JAXBContextImpl context =
- new JAXBContextImpl(classes, null, Collections.<Class, Class> emptyMap(), null, false, reader, false, false);
- RuntimeModelBuilder builder =
- new RuntimeModelBuilder(context, reader, Collections.<Class, Class> emptyMap(), null);
- builder.setErrorHandler(errorListener);
- for (Class c : classes)
- builder.getTypeInfo(new Ref<Type, Class>(c));
-
- RuntimeTypeInfoSet r = builder.link();
- errorListener.check();
- return r;
- }
-
- public void testReflection() throws Exception {
- MyBean bean = new MyBean();
- RuntimeTypeInfoSet model = create(MyBean.class);
- RuntimeClassInfo clsInfo = (RuntimeClassInfo)model.getTypeInfo(MyBean.class);
- for (RuntimePropertyInfo p : clsInfo.getProperties()) {
- // System.out.print(p.getName());
- // System.out.println(" " + p.isCollection());
- if (p.getName().equals("notes")) {
- Collection c = (Collection)p.getAccessor().get(bean);
- c.add("123");
- }
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/resources/ipo.xsd
deleted file mode 100755
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/LICENSE b/branches/sca-java-1.5.1/modules/databinding-json/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/databinding-json/NOTICE b/branches/sca-java-1.5.1/modules/databinding-json/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/pom.xml b/branches/sca-java-1.5.1/modules/databinding-json/pom.xml
deleted file mode 100644
index 06703fe39b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/pom.xml
+++ /dev/null
@@ -1,136 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-json</artifactId>
- <name>Apache Tuscany SCA Data Binding for JSON</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>com.metaparadigm</groupId>
- <artifactId>json-rpc</artifactId>
- <version>1.0</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.jettison</groupId>
- <artifactId>jettison</artifactId>
- <version>1.0.1</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.json</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.json*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
deleted file mode 100644
index b1813c9eab..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2JavaBean.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-import com.metaparadigm.jsonrpc.JSONSerializer;
-import com.metaparadigm.jsonrpc.SerializerState;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSON2JavaBean implements PullTransformer<Object, Object> {
- private JSONSerializer serializer;
-
- public JSON2JavaBean() {
- super();
- serializer = new JSONSerializer();
- try {
- serializer.registerDefaultSerializers();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- serializer.setMarshallClassHints(true);
- serializer.setMarshallNullAttributes(true);
- }
-
- public Object transform(Object source, TransformationContext context) {
- if (source == null) {
- return null;
- }
-
- try {
- SerializerState state = new SerializerState();
- return serializer.unmarshall(state, context.getTargetDataType().getPhysical(), source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
-
- }
-
- public String getSourceDataBinding() {
- return JSONDataBinding.NAME;
- }
-
- public String getTargetDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- public int getWeight() {
- return 5000;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.java
deleted file mode 100644
index 4e08384f09..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2String.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.databinding.json;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSON2String extends BaseTransformer<Object, String> implements
- PullTransformer<Object, String> {
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- public String transform(Object source, TransformationContext context) {
- try {
- return source.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 500;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JSONDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java
deleted file mode 100644
index b70f772696..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSON2XMLStreamReader.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
-import org.codehaus.jettison.json.JSONObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSON2XMLStreamReader extends BaseTransformer<Object, XMLStreamReader> implements
- PullTransformer<Object, XMLStreamReader> {
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- public XMLStreamReader transform(Object source, TransformationContext context) {
- try {
- JSONObject json = JSONHelper.toJettison(source);
- return new BadgerFishXMLStreamReader(json);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 500;
- }
- @Override
- public String getSourceDataBinding() {
- return JSONDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.java
deleted file mode 100644
index 28cadc6666..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONDataBinding.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.databinding.json;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.codehaus.jettison.json.JSONObject;
-
-/**
- * JAXB DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class JSONDataBinding extends BaseDataBinding {
- public static final String NAME = "JSON";
-
- public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/json/1.0";
- public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
-
- public JSONDataBinding() {
- super(NAME, org.json.JSONObject.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- assert type != null;
- Class cls = type.getPhysical();
- if (JSONObject.class.isAssignableFrom(cls) || org.json.JSONObject.class.isAssignableFrom(cls)) {
- type.setDataBinding(getName());
- if (type.getLogical() == null) {
- type.setLogical(XMLType.UNKNOWN);
- }
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object copy(Object arg, DataType dataType, Operation operation) {
- if (arg == null) {
- return null;
- }
- try {
- Class type = arg != null ? arg.getClass() : null;
- return JSONHelper.toJSON(arg.toString(), type);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.java
deleted file mode 100644
index fb29710506..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JSONHelper.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.databinding.json;
-
-import java.text.ParseException;
-
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JSONHelper {
- private JSONHelper() {
-
- }
-
- /**
- * Convert to Jettison JSONObject
- * @param source
- * @return
- */
- public static JSONObject toJettison(Object source) {
- JSONObject json = null;
- if (source instanceof JSONObject) {
- json = (JSONObject)source;
- } else if (source instanceof org.json.JSONObject) {
- try {
- json = new JSONObject(((org.json.JSONObject)source).toString());
- } catch (JSONException e) {
- throw new IllegalArgumentException(e);
- }
- }
- return json;
- }
-
- /**
- * Convert to org.json.JSONObject
- * @param source
- * @return
- */
- public static org.json.JSONObject toJSONOrg(Object source) {
- org.json.JSONObject json = null;
- if (source instanceof JSONObject) {
- try {
- json = new org.json.JSONObject(((JSONObject)source).toString());
- } catch (ParseException e) {
- throw new IllegalArgumentException(e);
- }
- } else if (source instanceof org.json.JSONObject) {
- json = (org.json.JSONObject)source;
- }
- return json;
- }
-
- public static <T> T toJSON(String json, Class<T> type) {
- if (type == JSONObject.class) {
- try {
- return type.cast(new JSONObject(json));
- } catch (JSONException e) {
- throw new IllegalArgumentException(e);
- }
- } else {
- if (type == null) {
- type = (Class<T>)org.json.JSONObject.class;
- }
- try {
- return type.cast(new org.json.JSONObject(json));
- } catch (ParseException e) {
- throw new IllegalArgumentException(e);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.java
deleted file mode 100644
index a928deef22..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSON.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.databinding.json;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-import com.metaparadigm.jsonrpc.JSONSerializer;
-import com.metaparadigm.jsonrpc.SerializerState;
-
-public class JavaBean2JSON extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
- private JSONSerializer serializer;
-
- public JavaBean2JSON() {
- serializer = new JSONSerializer();
- try {
- serializer.registerDefaultSerializers();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- serializer.setMarshallClassHints(true);
- serializer.setMarshallNullAttributes(true);
- }
-
- @Override
- public String getSourceDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JSONDataBinding.NAME;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- public Object toJSON(Object source) throws Exception {
- if (source == null) {
- return org.json.JSONObject.NULL;
- }
-
- SerializerState state = new SerializerState();
- return serializer.marshall(state, source);
- }
-
- public Object transform(Object source, TransformationContext context) {
- try {
- return toJSON(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java
deleted file mode 100644
index de023157bc..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONObject.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.codehaus.jettison.json.JSONArray;
-import org.codehaus.jettison.json.JSONObject;
-
-public class JavaBean2JSONObject extends BaseTransformer<Object, Object> implements PullTransformer<Object, Object> {
- private static final Comparator<PropertyDescriptor> COMPARATOR = new Comparator<PropertyDescriptor>() {
- public int compare(PropertyDescriptor o1, PropertyDescriptor o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
- private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
- private static final Object[] NULL = null;
-
- private static String getStringValue(Object o) {
- if (o == null) {
- return null;
- }
- TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
- if (info != null) {
- return MAPPER.toXMLLiteral(info.getQName(), o, null);
- } else {
- return String.valueOf(o);
- }
- }
-
- private static boolean isSimpleType(Class<?> javaType) {
- return SimpleTypeMapperImpl.getXMLType(javaType) != null;
- }
-
- public JavaBean2JSONObject() {
- }
-
- @Override
- public String getSourceDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JSONDataBinding.NAME;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- public Object toJSON(Object source) throws Exception {
- if (source == null) {
- return JSONObject.NULL;
- }
- Class<?> type = source.getClass();
- if (isSimpleType(type)) {
- return source;
- } else if (type.isArray()) {
- JSONArray array = new JSONArray();
- int i1 = Array.getLength(source);
- for (int j = 0; j < i1; j++) {
- Object o = Array.get(source, j);
- array.put(toJSON(o));
- }
- return array;
- } else if (Collection.class.isAssignableFrom(type)) {
- Collection c = (Collection)source;
- JSONArray array = new JSONArray();
- for (Object element : c) {
- array.put(toJSON(element));
- }
- return array;
- }
- JSONObject json = new JSONObject();
- BeanInfo beanInfo = Introspector.getBeanInfo(type);
- PropertyDescriptor[] propDescs = beanInfo.getPropertyDescriptors();
- Collections.sort(Arrays.asList(propDescs), COMPARATOR);
-
- for (int i = 0; i < propDescs.length; i++) {
- PropertyDescriptor propDesc = propDescs[i];
- Class<?> pType = propDesc.getPropertyType();
- if ("class".equals(propDesc.getName())) {
- continue;
- }
- Object pValue = propDesc.getReadMethod().invoke(source, NULL);
- json.put(propDesc.getName(), toJSON(pValue));
- }
- return json;
-
- }
-
- public Object transform(Object source, TransformationContext context) {
- try {
- return toJSON(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java
deleted file mode 100644
index ff5968bccd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/String2JSON.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * @version $Rev$ $Date$
- */
-public class String2JSON extends BaseTransformer<String, Object> implements PullTransformer<String, Object> {
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- public Object transform(String source, TransformationContext context) {
- try {
- Class type = null;
- if (context != null && context.getTargetDataType() != null) {
- type = context.getTargetDataType().getPhysical();
- }
- return JSONHelper.toJSON(source, type);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 500;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JSONDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.java
deleted file mode 100644
index aa75afc9d4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/XMLStreamReader2JSON.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.databinding.json;
-
-import java.io.StringWriter;
-
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
-import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamWriter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2JSON extends BaseTransformer<XMLStreamReader, Object> implements
- PullTransformer<XMLStreamReader, Object> {
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- public Object transform(XMLStreamReader source, TransformationContext context) {
- try {
- StringWriter writer = new StringWriter();
- XMLStreamWriter jsonWriter = new BadgerFishXMLStreamWriter(writer);
- XMLStreamSerializer serializer = new XMLStreamSerializer();
- serializer.serialize(source, jsonWriter);
- source.close();
- Class type = null;
- if (context != null && context.getTargetDataType() != null) {
- type = context.getTargetDataType().getPhysical();
- }
- return JSONHelper.toJSON(writer.toString(), type);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 500;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JSONDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.java
deleted file mode 100644
index 1072b70029..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSON2OMElement.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.databinding.json.axiom;
-
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.Transformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.json.JSONDataBinding;
-import org.apache.tuscany.sca.databinding.json.JSONHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.codehaus.jettison.json.JSONObject;
-import org.osoa.sca.annotations.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-@Service(Transformer.class)
-public class JSON2OMElement extends BaseTransformer<Object, OMElement> implements PullTransformer<Object, OMElement> {
-
- private OMFactory factory = OMAbstractFactory.getOMFactory();
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- public OMElement transform(Object source, TransformationContext context) {
- try {
- JSONObject json = JSONHelper.toJettison(source);
- if (json == null) {
- return null;
- }
- String ns = JSONDataBinding.ROOT_ELEMENT.getNamespaceURI();
- String name = JSONDataBinding.ROOT_ELEMENT.getLocalPart();
- if (context != null) {
- DataType<?> dataType = context.getTargetDataType();
- Object logical = dataType.getLogical();
- if (logical instanceof XMLType) {
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement()) {
- ns = xmlType.getElementName().getNamespaceURI();
- name = xmlType.getElementName().getLocalPart();
- }
- }
- }
- JSONBadgerfishDataSource ds = new JSONBadgerfishDataSource(json);
- OMNamespace namespace = factory.createOMNamespace(ns, "");
- return factory.createOMElement(ds, name, namespace);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public int getWeight() {
- return 500;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JSONDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java
deleted file mode 100644
index adc38772be..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONBadgerfishDataSource.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json.axiom;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader;
-import org.codehaus.jettison.json.JSONException;
-import org.codehaus.jettison.json.JSONObject;
-
-/**
- * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
- * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
- * This uses the "Badgerfish" JSON convention.
- *
- * @version $Rev$ $Date$
- */
-
-public class JSONBadgerfishDataSource extends JSONDataSource {
-
- public JSONBadgerfishDataSource(JSONObject json) {
- super(json);
- }
-
- /**
- * Gives the StAX reader using the "Badgerfish" formatted input JSON String.
- *
- * @return The XMLStreamReader according to the JSON String.
- * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
- */
- @Override
- public javax.xml.stream.XMLStreamReader getReader() throws XMLStreamException {
- try {
- return new BadgerFishXMLStreamReader(json);
- } catch (JSONException e) {
- throw new XMLStreamException(e);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java b/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java
deleted file mode 100644
index 5b0312056e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/java/org/apache/tuscany/sca/databinding/json/axiom/JSONDataSource.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json.axiom;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMOutputFormat;
-import org.codehaus.jettison.json.JSONObject;
-import org.codehaus.jettison.json.JSONTokener;
-import org.codehaus.jettison.mapped.MappedXMLInputFactory;
-
-/**
- * JSONDataSource keeps the JSON String inside and consumes it when needed. This is to be kept in the
- * OMSourcedElementImpl and can be used either to expand the tree or get the JSON String directly without expanding.
- * This uses the "Mapped" JSON convention.
- *
- * @version $Rev$ $Date$
- */
-
-public class JSONDataSource implements OMDataSource {
- protected JSONObject json;
-
- public JSONDataSource(JSONObject json) {
- this.json = json;
- }
-
- /**
- * Writes JSON into the output stream. As this should write JSON, it directly gets the JSON string and writes it
- * without expanding the tree.
- *
- * @param outputStream the stream to be written into
- * @param omOutputFormat format of the message, this is ignored.
- * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message in to the output
- * stream.
- */
- public void serialize(OutputStream outputStream, OMOutputFormat omOutputFormat)
- throws javax.xml.stream.XMLStreamException {
- try {
- String encoding = omOutputFormat == null ? "UTF-8" : omOutputFormat.getCharSetEncoding();
- outputStream.write(getJSONString().getBytes(encoding));
- } catch (IOException e) {
- throw new OMException();
- }
- }
-
- /**
- * Writes JSON through the writer. As this should write JSON, it directly gets the JSON string and writes it without
- * expanding the tree.
- *
- * @param writer Writer to be written into
- * @param omOutputFormat format of the message, this is ignored.
- * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the writer.
- */
- public void serialize(Writer writer, OMOutputFormat omOutputFormat) throws javax.xml.stream.XMLStreamException {
- try {
- writer.write(getJSONString());
- } catch (IOException e) {
- throw new OMException();
- }
- }
-
- /**
- * Writes XML through the XMLStreamWriter. As the input data source is JSON, this method needs to get a StAX reader
- * from that JSON String. Therefore this uses the getReader() method to get the StAX reader writes the events into
- * the XMLStreamWriter.
- *
- * @param xmlStreamWriter StAX writer to be written into
- * @throws javax.xml.stream.XMLStreamException if there is an error while writing the message through the StAX
- * writer.
- */
- public void serialize(javax.xml.stream.XMLStreamWriter xmlStreamWriter) throws javax.xml.stream.XMLStreamException {
- XMLStreamReader reader = getReader();
- xmlStreamWriter.writeStartDocument();
- while (reader.hasNext()) {
- int x = reader.next();
- switch (x) {
- case XMLStreamConstants.START_ELEMENT:
- xmlStreamWriter.writeStartElement(reader.getPrefix(), reader.getLocalName(), reader
- .getNamespaceURI());
- int namespaceCount = reader.getNamespaceCount();
- for (int i = namespaceCount - 1; i >= 0; i--) {
- xmlStreamWriter.writeNamespace(reader.getNamespacePrefix(i), reader.getNamespaceURI(i));
- }
- int attributeCount = reader.getAttributeCount();
- for (int i = 0; i < attributeCount; i++) {
- xmlStreamWriter.writeAttribute(reader.getAttributePrefix(i),
- reader.getAttributeNamespace(i),
- reader.getAttributeLocalName(i),
- reader.getAttributeValue(i));
- }
- break;
- case XMLStreamConstants.START_DOCUMENT:
- break;
- case XMLStreamConstants.CHARACTERS:
- xmlStreamWriter.writeCharacters(reader.getText());
- break;
- case XMLStreamConstants.CDATA:
- xmlStreamWriter.writeCData(reader.getText());
- break;
- case XMLStreamConstants.END_ELEMENT:
- xmlStreamWriter.writeEndElement();
- break;
- case XMLStreamConstants.END_DOCUMENT:
- xmlStreamWriter.writeEndDocument();
- break;
- case XMLStreamConstants.SPACE:
- break;
- case XMLStreamConstants.COMMENT:
- xmlStreamWriter.writeComment(reader.getText());
- break;
- case XMLStreamConstants.DTD:
- xmlStreamWriter.writeDTD(reader.getText());
- break;
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- xmlStreamWriter.writeProcessingInstruction(reader.getPITarget(), reader.getPIData());
- break;
- case XMLStreamConstants.ENTITY_REFERENCE:
- xmlStreamWriter.writeEntityRef(reader.getLocalName());
- break;
- default:
- throw new OMException();
- }
- }
- xmlStreamWriter.writeEndDocument();
- }
-
- /**
- * Gives the StAX reader using the "Mapped" formatted input JSON String.
- *
- * @return The XMLStreamReader according to the JSON String.
- * @throws javax.xml.stream.XMLStreamException if there is an error while making the StAX reader.
- */
-
- public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException {
-
- Map<String, String> nsMap = new HashMap<String, String>();
- nsMap.put("", "");
-
- // input factory for "Mapped" convention
- MappedXMLInputFactory inputFactory = new MappedXMLInputFactory(nsMap);
- String jsonString = this.getJSONString();
- return inputFactory.createXMLStreamReader(new JSONTokener(jsonString));
- }
-
- // returns the json string by consuming the JSON input stream.
- protected String getJSONString() {
- return json.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index 400507296f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.json.JSONDataBinding;name=JSON
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index b122533f6e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /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.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.json.JSON2XMLStreamReader;source=JSON,target=javax.xml.stream.XMLStreamReader,weight=5000
-org.apache.tuscany.sca.databinding.json.XMLStreamReader2JSON;source=javax.xml.stream.XMLStreamReader,target=JSON,weight=5000,public=false
-org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:complexType,target=JSON,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:simpleType,target=JSON,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement;source=JSON,target=org.apache.axiom.om.OMElement,weight=500
-org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=java:array,target=JSON,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=commonj.sdo.DataObject,target=JSON,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JavaBean2JSON;source=javax.xml.bind.JAXBElement,target=JSON,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:complexType,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:simpleType,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=commonj.sdo.DataObject,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=javax.xml.bind.JAXBElement,weight=80000,public=false
-org.apache.tuscany.sca.databinding.json.JSON2JavaBean;source=JSON,target=java:array,weight=80000,public=false
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.java
deleted file mode 100644
index 3c7f151ed7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JSONTransformerTestCase.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.databinding.json;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.databinding.json.axiom.JSON2OMElement;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamSerializer;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.json.JSONObject;
-
-public class JSONTransformerTestCase extends TestCase {
- private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- private static final String JSON_STR = "{\"xsl:root\":{\"@xmlns\":{\"xsl\":\"http://foo.com\"},\"data\":{\"$\":\"my json string\"}}}";
-
- public void testXML2JSON() throws Exception {
- XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
- XMLStreamReader2JSON t1 = new XMLStreamReader2JSON();
- JSONObject json = (JSONObject) t1.transform(reader, null);
- Assert.assertNotNull(json);
-
- // Cannot round-trip as we hit a bug in Jettison: http://jira.codehaus.org/browse/JETTISON-37
- /*
- JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
- XMLStreamReader reader2 = t2.transform(json, null);
- StringWriter sw = new StringWriter();
- XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
- new XMLStreamSerializer().serialize(reader2, streamWriter);
- streamWriter.flush();
- System.out.println(sw.toString());
- */
-
- }
-
- public void testJSON2XML() throws Exception {
- JSON2XMLStreamReader t2 = new JSON2XMLStreamReader();
- XMLStreamReader reader2 = t2.transform(new JSONObject(JSON_STR), null);
- StringWriter sw = new StringWriter();
- XMLStreamWriter streamWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(sw);
- new XMLStreamSerializer().serialize(reader2, streamWriter);
- streamWriter.flush();
- Assert.assertTrue(sw.toString()
- .contains("<xsl:root xmlns:xsl=\"http://foo.com\"><data>my json string</data></xsl:root>"));
- }
-
- public void testJSON2OMElement() throws Exception {
- JSON2OMElement t1 = new JSON2OMElement();
- TransformationContext context = new TransformationContextImpl();
- DataType dt = new DataTypeImpl(Object.class, new XMLType(new QName("http://foo.com", "root"), null));
- context.setTargetDataType(dt);
- OMElement element = t1.transform(new JSONObject(JSON_STR), context);
- StringWriter writer = new StringWriter();
- element.serialize(writer);
- // System.out.println(writer.toString());
- }
-
- public void testString2JSON() throws Exception {
- String json = "{\"name\":\"John\",\"age\":25}";
- String2JSON t1 = new String2JSON();
- JSONObject jsonObject = (JSONObject) t1.transform(json, null);
- assertEquals(jsonObject.getString("name"), "John");
- assertEquals(jsonObject.getInt("age"), 25);
- JSON2String t2 = new JSON2String();
- String str = t2.transform(jsonObject, null);
- assertTrue(str.contains("\"name\":\"John\""));
- assertTrue(str.contains("\"age\":25"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java
deleted file mode 100644
index 3b36f5be74..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/JavaBean2JSONTestCase.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.json;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.json.JSONObject;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaBean2JSONTestCase {
-
- public static class MyBean {
- private String name;
- private int age;
- private boolean vip;
- private String friends[];
- private List<String> books;
- private YourBean you;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public boolean isVip() {
- return vip;
- }
-
- public void setVip(boolean vip) {
- this.vip = vip;
- }
-
- public String[] getFriends() {
- return friends;
- }
-
- public void setFriends(String[] friends) {
- this.friends = friends;
- }
-
- public List<String> getBooks() {
- return books;
- }
-
- public void setBooks(List<String> books) {
- this.books = books;
- }
-
- public YourBean getYou() {
- return you;
- }
-
- public void setYou(YourBean you) {
- this.you = you;
- }
-
- }
-
- public static class YourBean {
- private int id;
- private String name;
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
- }
-
- @Test
- public void testBean2JSON() throws Exception {
- MyBean me = new MyBean();
- me.setAge(30);
- me.setBooks(new ArrayList<String>());
- me.setFriends(new String[] {"John", "Mike"});
- me.setVip(true);
- me.setName("Me");
- YourBean you = new YourBean();
- you.setId(123);
- you.setName(null);
- me.setYou(you);
- JavaBean2JSON t1 = new JavaBean2JSON();
- Object result = t1.transform(me, null);
- System.out.println(result);
- JSON2JavaBean t2 = new JSON2JavaBean();
- TransformationContext context = new TransformationContextImpl();
- context.setTargetDataType(new DataTypeImpl(MyBean.class, null));
- Object v = t2.transform(new JSONObject(result.toString()), context);
- Assert.assertTrue(v instanceof MyBean);
- // String json =
- // "{\"age\":30,\"books\":[],\"friends\":[\"John\",\"Mike\"],\"name\":\"Me\",\"vip\":true,\"you\":{\"id\":123,\"name\":null}}";
- // Assert.assertEquals(json, result.toString());
- }
-
- @Test
- public void testString2JSON() throws Exception {
- JavaBean2JSONObject t1 = new JavaBean2JSONObject();
- Object result = t1.transform("ABC", null);
- System.out.println(result);
- JSON2JavaBean t2 = new JSON2JavaBean();
- TransformationContext context = new TransformationContextImpl();
- context.setTargetDataType(new DataTypeImpl(String.class, null));
- Object v = t2.transform(result, context);
- Assert.assertTrue(v instanceof String);
- Assert.assertEquals("ABC", v);
- }
-
- @Test
- public void testStringArray2JSON() throws Exception {
- JavaBean2JSON t1 = new JavaBean2JSON();
- Object result = t1.transform(new String[] {"ABC", "DF"}, null);
- System.out.println(result);
- JSON2JavaBean t2 = new JSON2JavaBean();
- TransformationContext context = new TransformationContextImpl();
- context.setTargetDataType(new DataTypeImpl(String[].class, null));
- Object v = t2.transform(result, context);
- Assert.assertTrue(v instanceof String[]);
- String[] strs = (String[])v;
- Assert.assertEquals("ABC", strs[0]);
- Assert.assertEquals("DF", strs[1]);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java
deleted file mode 100644
index 60b293c1d4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyBean.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.json;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class MyBean {
- private int age;
- private String name;
- private float[] rates = new float[] {1.0f, 2.0f};
- private List<String> notes = new ArrayList<String>();
- private Map<String, Integer> map = new HashMap<String, Integer>();
- private Object service;
- private Object otherService;
- private boolean good;
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public List<String> getNotes() {
- return notes;
- }
-
- public void setNotes(List<String> notes) {
- this.notes = notes;
- }
-
- public float[] getRates() {
- return rates;
- }
-
- public void setRates(float[] rates) {
- this.rates = rates;
- }
-
- public Map<String, Integer> getMap() {
- return map;
- }
-
- public void setMap(Map<String, Integer> map) {
- this.map = map;
- }
-
- public Object getService() {
- return service;
- }
-
- public void setService(Object service) {
- this.service = service;
- }
-
- public Object getOtherService() {
- return otherService;
- }
-
- public void setOtherService(Object otherService) {
- this.otherService = otherService;
- }
-
- public boolean isGood() {
- return good;
- }
-
- public void setGood(boolean good) {
- this.good = good;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + age;
- result = prime * result + (good ? 1231 : 1237);
- result = prime * result + ((map == null) ? 0 : map.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((notes == null) ? 0 : notes.hashCode());
- result = prime * result + ((otherService == null) ? 0 : otherService.hashCode());
- result = prime * result + Arrays.hashCode(rates);
- result = prime * result + ((service == null) ? 0 : service.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MyBean other = (MyBean)obj;
- if (age != other.age)
- return false;
- if (good != other.good)
- return false;
- if (map == null) {
- if (other.map != null)
- return false;
- } else if (!map.equals(other.map))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (notes == null) {
- if (other.notes != null)
- return false;
- } else if (!notes.equals(other.notes))
- return false;
- if (otherService == null) {
- if (other.otherService != null)
- return false;
- } else if (!otherService.equals(other.otherService))
- return false;
- if (!Arrays.equals(rates, other.rates))
- return false;
- if (service == null) {
- if (other.service != null)
- return false;
- } else if (!service.equals(other.service))
- return false;
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.java
deleted file mode 100644
index d32e0763c7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterface.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.databinding.json;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface MyInterface {
- void setId(String id);
-
- String getId();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.java
deleted file mode 100644
index 3a2b95a4e2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/MyInterfaceImpl.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.databinding.json;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MyInterfaceImpl implements MyInterface {
- private String id;
-
- /**
- * @see org.apache.tuscany.databinding.jaxb.MyInterface#getId()
- */
- public String getId() {
- return id;
- }
-
- /**
- * @see org.apache.tuscany.databinding.jaxb.MyInterface#setId(java.lang.String)
- */
- public void setId(String id) {
- this.id = id;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MyInterfaceImpl other = (MyInterfaceImpl)obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java b/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java
deleted file mode 100644
index 84995baadf..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/java/org/apache/tuscany/sca/databinding/json/POJOTestCase.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.json;
-
-import java.lang.reflect.Array;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-
-public class POJOTestCase extends TestCase {
- public void testPOJO() throws Exception {
- MyBean bean = new MyBean();
- bean.setName("Test");
- bean.setAge(20);
- bean.getNotes().add("1");
- bean.getNotes().add("2");
- bean.getMap().put("1", 1);
- MyInterface service = new MyInterfaceImpl();
- service.setId("ID001");
- bean.setService(service);
- bean.setOtherService(service);
-
- roundTrip(bean);
- }
-
- private <T> void roundTrip(T bean) {
- JavaBean2JSON t1 = new JavaBean2JSON();
-
- Object json = t1.transform(bean, null);
- System.out.println(json);
- JSON2JavaBean t2 = new JSON2JavaBean();
-
- TransformationContext context = new TransformationContextImpl();
- context.setTargetDataType(new DataTypeImpl(bean == null ? Object.class : bean.getClass(), null));
- Object newBean = t2.transform(json, context);
-
- if (newBean != null && newBean.getClass().isArray()) {
- int len = Array.getLength(newBean);
- assertEquals(Array.getLength(bean), len);
- for (int i = 0; i < len; i++) {
- assertEquals(Array.get(bean, i), Array.get(newBean, i));
- }
- return;
- }
- assertEquals(bean, newBean);
- }
-
- public void testString() throws Exception {
- roundTrip("ABC");
- }
-
- public void testNull() throws Exception {
- roundTrip(null);
- }
-
- public void testArray() throws Exception {
- roundTrip(new String[] {"123", "ABC"});
- }
-
- public void testByteArray() throws Exception {
- roundTrip("ABC".getBytes());
- }
-
- public void testPrimitive() throws Exception {
- roundTrip(123);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-json/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-json/src/test/resources/ipo.xsd
deleted file mode 100644
index 5a493e1746..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-json/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/LICENSE b/branches/sca-java-1.5.1/modules/databinding-saxon/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/databinding-saxon/NOTICE b/branches/sca-java-1.5.1/modules/databinding-saxon/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/pom.xml b/branches/sca-java-1.5.1/modules/databinding-saxon/pom.xml
deleted file mode 100644
index 947e62af6e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/pom.xml
+++ /dev/null
@@ -1,137 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-saxon</artifactId>
- <name>Apache Tuscany SCA Data Binding for Saxon</name>
-
- <repositories>
- <repository>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>rfeng</id>
- <name>Tuscany Maven 2.0 Repository</name>
- <url>http://svn.apache.org/repos/asf/incubator/tuscany/maven</url>
- <layout>default</layout>
- </repository>
- </repositories>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <!--dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>9.0.0.2</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-api</artifactId>
- <version>9.0.0.2</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>9.0.0.2</version>
- </dependency-->
-
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>8.7</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>8.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-lib</artifactId>
- <version>1.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-impl</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.saxon</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.saxon*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.java
deleted file mode 100644
index 25f8ee886f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/DataObject2NodeInfoTransformer.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.databinding.saxon;
-
-import javax.xml.transform.dom.DOMResult;
-
-import net.sf.saxon.om.NodeInfo;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-/**
- * Transforms SDO DataObject-s to NodeInfo objects needed by Saxon parser.
- *
- * For root element when Serializing the DataObject the name of its
- * implemented interface is used with its first letter made lowercase.
- * Also any namespaces that are defined are deleted, because otherwise
- * the SaxonB parser does not work
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2NodeInfoTransformer extends BaseTransformer<DataObject, NodeInfo> implements
- PullTransformer<DataObject, NodeInfo> {
-
- private Node2NodeInfoTransformer node2NodeInfoTransformer;
-
- public DataObject2NodeInfoTransformer(Node2NodeInfoTransformer node2NodeInfoTransformer) {
- this.node2NodeInfoTransformer = node2NodeInfoTransformer;
- }
-
- public DataObject2NodeInfoTransformer() {
- this.node2NodeInfoTransformer = new Node2NodeInfoTransformer();
- }
-
- public NodeInfo transform(DataObject source, TransformationContext context) {
- // FIXME: Need to create the HelperContext from the transformation context
- // FIXME: This is a big hack to create a document using the class name
- XMLHelper helper = XMLHelper.INSTANCE;
- String name = null;
- if (source.getClass().getInterfaces().length > 0) {
- name = source.getClass().getInterfaces()[0].getSimpleName();
- } else {
- name = source.getClass().getName();
- }
-
- if (name.length() > 0) {
- name = Character.toLowerCase(name.charAt(0)) + name.substring(1, name.length());
- }
-
- try {
- DOMResult domResult = new DOMResult(DOMHelper.newDocument());
- XMLDocument xmlDoc = helper.createDocument(source, null, name);
- helper.save(xmlDoc, domResult, null);
- return node2NodeInfoTransformer.transform(domResult.getNode(), context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
-
- }
-
- @Override
- protected Class<DataObject> getSourceType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<NodeInfo> getTargetType() {
- return NodeInfo.class;
- }
-
- @Override
- public int getWeight() {
- return 30 + node2NodeInfoTransformer.getWeight();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
deleted file mode 100644
index 7122217b8b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/ItemList2ObjectTransformer.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-import java.lang.reflect.Array;
-
-import net.sf.saxon.om.Item;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.saxon.collection.ItemList;
-
-/**
- * Transforms each object contained in the ItemList object.
- *
- * If the object type is the same as the target type, it is not transformed.
- *
- * If the object is a NodeInfo, it's transformed to a DataObject.
- *
- * If the object is a Value, it's transformed to a Java object.
- *
- * If the target type is not an array, the first transformed object is returned.
- *
- * If the first transformed object type is not a target type, then a
- * TransformException is thrown
- *
- * If the target type is an array, a array of this type is created containing
- * all transformed objects and it is returned
- *
- * If any transformed object is not a target type, then a TransformException is
- * thrown
- *
- * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
- */
-public class ItemList2ObjectTransformer extends BaseTransformer<ItemList, Object> implements
- PullTransformer<ItemList, Object> {
-
- private NodeInfo2DataObjectTransformer nodeInfo2DataObjectTransformer = new NodeInfo2DataObjectTransformer();
-
- public ItemList2ObjectTransformer() {
- }
-
- @Override
- protected Class<ItemList> getSourceType() {
- return ItemList.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 30 + nodeInfo2DataObjectTransformer.getWeight();
- }
-
- public Object transform(ItemList source, TransformationContext context) {
-
- if (source.size() == 0) {
- return null;
- }
-
- Class<?> targetType = context.getTargetDataType().getPhysical();
-
- if (targetType.isArray()) {
- int i = 0;
- Class<?> componentClass = targetType.getComponentType();
- Object[] result = (Object[])Array.newInstance(componentClass, source.size());
-
- try {
-
- if (componentClass.isAssignableFrom(NodeInfo.class) || componentClass.isAssignableFrom(Value.class)) {
-
- for (Item item : source) {
- result[i++] = item;
- }
-
- } else {
-
- for (Item item : source) {
-
- if (item instanceof NodeInfo) {
- result[i] = nodeInfo2DataObjectTransformer.transform((NodeInfo)item, context);
-
- } else if (item instanceof Value) {
- result[i] = Value.convert(item);
-
- } else {
- result[i] = item;
- }
-
- i++;
-
- }
-
- }
-
- } catch (ArrayStoreException ex) {
- throw new TransformationException(ex);
-
- } catch (XPathException ex) {
- throw new TransformationException(ex);
- }
-
- return result;
-
- } else {
- Item item = source.iterator().next();
-
- if (item.getClass().isAssignableFrom(targetType)) {
- return item;
-
- } else if (item instanceof NodeInfo) {
- return nodeInfo2DataObjectTransformer.transform((NodeInfo)item, context);
-
- } else {
-
- try {
- return Value.convert(item);
-
- } catch (XPathException e) {
- throw new TransformationException(e);
- }
-
- }
-
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.java
deleted file mode 100644
index fabadd34ea..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Node2NodeInfoTransformer.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.databinding.saxon;
-
-import javax.xml.transform.dom.DOMSource;
-
-import net.sf.saxon.Configuration;
-import net.sf.saxon.event.Builder;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.trans.XPathException;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Node;
-
-/**
- * Transforms DOM Node-s to NodeInfo objects needed by Saxon parser.
- *
- * Any namespaces that are defined are deleted, because otherwise
- * the SaxonB parser does not work
- *
- * @version $Rev$ $Date$
- */
-public class Node2NodeInfoTransformer extends BaseTransformer<Node, NodeInfo> implements
- PullTransformer<Node, NodeInfo> {
-
- public NodeInfo transform(Node source, TransformationContext context) {
- Configuration configuration = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
- if (configuration == null) {
- configuration = new Configuration();
- }
-
- NodeInfo docInfo = null;
- try {
- source = DOMHelper.promote(source);
- docInfo = Builder.build(new DOMSource(source), null, configuration);
- } catch (XPathException e) {
- throw new TransformationException(e);
- }
- return docInfo;
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<NodeInfo> getTargetType() {
- return NodeInfo.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.java
deleted file mode 100644
index a5093f8cdf..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2DataObjectTransformer.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.databinding.saxon;
-
-import java.io.IOException;
-
-import javax.xml.transform.dom.DOMSource;
-
-import net.sf.saxon.om.NodeInfo;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Document;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.XMLHelper;
-
-/**
- * Transforms NodeInfo objects to SDO DataObjects.
- *
- * Before constructing the data object, resulting XML is populated
- * with correct namespaces (which are taken from the logical target data type)
- * These namespaces are crucial for constructing the right instance of
- * the DataObject (i.e. if there is a SDO factory, an instance from this factory will
- * be used, not the generic any data object)
- *
- * @version $Rev$ $Date$
- */
-public class NodeInfo2DataObjectTransformer extends BaseTransformer<NodeInfo, DataObject> implements
- PullTransformer<NodeInfo, DataObject> {
-
- private NodeInfo2NodeTransformer nodeInfo2NodeTransformer;
-
- public NodeInfo2DataObjectTransformer(NodeInfo2NodeTransformer nodeInfo2NodeTransformer) {
- this.nodeInfo2NodeTransformer = nodeInfo2NodeTransformer;
- }
-
- public NodeInfo2DataObjectTransformer() {
- this.nodeInfo2NodeTransformer = new NodeInfo2NodeTransformer();
- }
-
- @Override
- protected Class<NodeInfo> getSourceType() {
- return NodeInfo.class;
- }
-
- @Override
- protected Class<DataObject> getTargetType() {
- return DataObject.class;
- }
-
- @Override
- public int getWeight() {
- return 30 + nodeInfo2NodeTransformer.getWeight();
- }
-
- public DataObject transform(NodeInfo source, TransformationContext context) {
- Document doc = (Document)nodeInfo2NodeTransformer.transform(source, context);
-
- return produceResult(doc);
- }
-
- private DataObject produceResult(Document doc) {
- try {
- // FIXME: [rfeng] We should use the HelperContext from the context
- DataObject resultingObject =
- XMLHelper.INSTANCE.load(new DOMSource(doc), doc.getDocumentURI(), null).getRootObject();
- return resultingObject;
- } catch (IOException e) {
- throw new TransformationException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2JavaArrayTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2JavaArrayTransformer.java
deleted file mode 100644
index 36ebac3aea..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2JavaArrayTransformer.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-import java.lang.reflect.Array;
-
-import net.sf.saxon.om.Item;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.saxon.collection.ItemList;
-
-import commonj.sdo.DataObject;
-
-/**
- * Transforms a NodeInfo object to a DataObject and return it in an array.
- *
- * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
- */
-public class NodeInfo2JavaArrayTransformer extends
- BaseTransformer<NodeInfo, Object[]> implements
- PullTransformer<NodeInfo, Object[]> {
-
- private NodeInfo2DataObjectTransformer nodeInfo2DataObjectTransformer = new NodeInfo2DataObjectTransformer();
-
- public NodeInfo2JavaArrayTransformer() {}
-
- @Override
- protected Class<NodeInfo> getSourceType() {
- return NodeInfo.class;
- }
-
- @Override
- protected Class<Object[]> getTargetType() {
- return Object[].class;
- }
-
- @Override
- public int getWeight() {
- return 30 + nodeInfo2DataObjectTransformer.getWeight();
- }
-
- public Object[] transform(NodeInfo source, TransformationContext context) {
- Object object = nodeInfo2DataObjectTransformer.transform(source, context);
-
- Class<?> componentClass = context.getTargetDataType().getPhysical().getComponentType();
- Object[] result = (Object[]) Array.newInstance(componentClass, 1);
-
- result[0] = object;
-
- return result;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.java
deleted file mode 100644
index 1e5b816662..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/NodeInfo2NodeTransformer.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.databinding.saxon;
-
-import java.util.Properties;
-
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.dom.DOMResult;
-
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.query.QueryResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transforms NodeInfo objects to SDO DataObjects.
- *
- * @version $Rev$ $Date$
- */
-public class NodeInfo2NodeTransformer extends BaseTransformer<NodeInfo, Node> implements
- PullTransformer<NodeInfo, Node> {
-
- public Node transform(NodeInfo source, TransformationContext context) {
- DOMResult destination = new DOMResult();
- try {
- Properties props = new Properties();
- props.setProperty(OutputKeys.METHOD, "xml");
- props.setProperty(OutputKeys.INDENT, "yes");
- QueryResult.serialize(source, destination, props, source.getConfiguration());
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- return destination.getNode();
- }
-
- @Override
- protected Class<NodeInfo> getSourceType() {
- return NodeInfo.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java
deleted file mode 100644
index 616bcca6c5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Object2ValueTransformer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-import net.sf.saxon.value.FloatValue;
-import net.sf.saxon.value.ObjectValue;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-/**
- * Transforms generic java objects to Value objects needed by Saxon parser.
- *
- * @version $Rev$ $Date$
- */
-public class Object2ValueTransformer extends BaseTransformer<Object, Value> implements PullTransformer<Object, Value> {
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<Value> getTargetType() {
- return Value.class;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- @Override
- public int getWeight() {
- return 10000;
- }
-
- public Value transform(Object source, TransformationContext context) {
- // WORKAROUND for ClassCastException in ObjectValue.toJavaObject(float)
- if (source instanceof Float) {
- return new FloatValue(((Float)source).floatValue());
- }
- return new ObjectValue(source);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.java
deleted file mode 100644
index ecb20b24b5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonDataBindingHelper.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.databinding.saxon;
-
-import net.sf.saxon.Configuration;
-
-/**
- * Provides helper functionality for Saxon data bindings
- * @version $Rev$ $Date$
- */
-public class SaxonDataBindingHelper {
- /**
- * This variable is meaningful only in the context of XQoery expression
- * execution. It is used by the DataObject2NodeInfoTransformer and
- * Node2NodeInfoTransformer to create the correct NodeInfo objects
- * in the Output2Output transformations.
- * For Input2Input transformations it is meaningless:
- * - if it is null - it is ignored by the transformers as they create new
- * configuration objects
- * - if it is not null - it is reused
- * However the XQueryInvoker transforms all NodeInfo-s to NodeInfo-s with
- * its current configuration, so there is no effect for Input2Input transformations
- */
- public static Configuration CURR_EXECUTING_CONFIG = null;
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java
deleted file mode 100644
index ccf842710d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonNodeDataBinding.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-
-import net.sf.saxon.om.NodeInfo;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * Represents data binding for parameters of type NodeInfo.
- *
- * The NodeInfo type is the type accepted by the Saxon XQuery processor for
- * all XML - based content (i.e. not strings and simple types)
- *
- * @version $Rev$ $Date$
- */
-public class SaxonNodeDataBinding extends BaseDataBinding {
-
- public static final String NAME = NodeInfo.class.getName();
- public static final String[] ALIASES = new String[] {"saxon_node"};
-
- public SaxonNodeDataBinding() {
- super(NAME, NodeInfo.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (super.introspect(type, operation)) {
- // type.setLogical(XMLType.UNKNOWN);
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java
deleted file mode 100644
index 2f51cf86ec..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SaxonValueDataBinding.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * Represents data binding for parameters of type Value.
- *
- * The Value type is the type accepted by the Saxon XQuery processor for
- * all simple types and strings
- *
- * @version $Rev$ $Date$
- */
-public class SaxonValueDataBinding extends BaseDataBinding {
- public static final String NAME = Value.class.getName();
- public static final String[] ALIASES = new String[] {"saxon_value"};
-
- public SaxonValueDataBinding() {
- super(NAME, Value.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (super.introspect(type, operation)) {
- // type.setLogical(XMLType.UNKNOWN);
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java
deleted file mode 100644
index 67d89a6e0b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/SimpleType2ValueTransformer.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-import java.math.BigDecimal;
-
-import net.sf.saxon.value.DecimalValue;
-import net.sf.saxon.value.DoubleValue;
-import net.sf.saxon.value.FloatValue;
-import net.sf.saxon.value.IntegerValue;
-import net.sf.saxon.value.ObjectValue;
-import net.sf.saxon.value.StringValue;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-
-/**
- * Transforms simple types and strings to Value objects needed by Saxon parser
- * @version $Rev$ $Date$
- */
-public class SimpleType2ValueTransformer extends BaseTransformer<Object, Value> implements
- PullTransformer<Object, Value> {
-
- @Override
- public String getSourceDataBinding() {
- return SimpleJavaDataBinding.NAME;
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<Value> getTargetType() {
- return Value.class;
- }
-
- @Override
- public int getWeight() {
- return 10000;
- }
-
- public Value transform(Object source, TransformationContext context) {
- Value result = null;
- if (source instanceof Integer) {
- result = new IntegerValue((Integer)source);
- } else if (source instanceof Long) {
- result = new IntegerValue((Long)source);
- } else if (source instanceof Short) {
- result = new IntegerValue((Short)source);
- } else if (source instanceof Byte) {
- result = new IntegerValue((Byte)source);
- } else if (source instanceof Double) {
- result = new DoubleValue((Double)source);
- } else if (source instanceof Float) {
- result = new FloatValue((Float)source);
- } else if (source instanceof BigDecimal) {
- result = new DecimalValue((BigDecimal)source);
- } else if (source instanceof String) {
- result = new StringValue(((String)source));
- } else {
- result = new ObjectValue(source);
- }
-
- return result;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.java
deleted file mode 100644
index 16d5f524bb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2JavaArray.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.databinding.saxon;
-
-import java.lang.reflect.Array;
-
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transforms a Value object to a Java Object and return it in an array.
- *
- * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
- */
-public class Value2JavaArray extends BaseTransformer<Value, Object[]> implements PullTransformer<Value, Object[]> {
-
- public Value2JavaArray() {
- }
-
- @Override
- protected Class<Value> getSourceType() {
- return Value.class;
- }
-
- @Override
- protected Class<Object[]> getTargetType() {
- return Object[].class;
- }
-
- @Override
- public int getWeight() {
- return super.getWeight() + 100;
- }
-
- public Object[] transform(Value source, TransformationContext context) {
-
- try {
- Object object = Value.convert(Value.asItem(source));
-
- Class<?> componentClass = context.getTargetDataType().getPhysical().getComponentType();
- Object[] result = (Object[])Array.newInstance(componentClass, 1);
-
- result[0] = object;
-
- return result;
-
- } catch (XPathException e) {
- throw new TransformationException(e.getMessage());
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.java
deleted file mode 100644
index 7589f6789b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2ObjectTransformer.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.databinding.saxon;
-
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-
-/**
- * Transforms Value objects to generic java objects
- * @version $Rev$ $Date$
- */
-public class Value2ObjectTransformer extends BaseTransformer<Value, Object> implements PullTransformer<Value, Object> {
-
- public Object transform(Value source, TransformationContext context) {
- Object object;
- try {
- object = Value.convert(Value.asItem(source));
- } catch (XPathException e) {
- throw new TransformationException(e);
- }
- return object;
- }
-
- @Override
- protected Class<Value> getSourceType() {
- return Value.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- @Override
- public int getWeight() {
- return 10000;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java
deleted file mode 100644
index 5da4effcfd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/Value2SimpleTypeTransformer.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.saxon;
-
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-
-/**
- * Transforms Value objects to simple types
- * @version $Rev$ $Date$
- */
-public class Value2SimpleTypeTransformer extends BaseTransformer<Value, Object> implements
- PullTransformer<Value, Object> {
- public Object transform(Value source, TransformationContext context) {
- Object object;
- try {
- object = Value.convert(Value.asItem(source));
- } catch (XPathException e) {
- throw new TransformationException(e);
- }
- return object;
- }
-
- @Override
- public String getTargetDataBinding() {
- return SimpleJavaDataBinding.NAME;
- }
-
- @Override
- protected Class<Value> getSourceType() {
- return Value.class;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 10000;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/collection/ItemList.java b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/collection/ItemList.java
deleted file mode 100644
index 065121520b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/java/org/apache/tuscany/sca/databinding/saxon/collection/ItemList.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.saxon.collection;
-
-import java.util.ArrayList;
-
-import net.sf.saxon.om.Item;
-
-/**
- * Stores a list of Item objects.
- *
- * Used by the implementation.xquery to store a collection of results
- * generated by the xquery execution.
- *
- * @version $Rev: 659284 $ $Date: 2008-05-22 14:26:18 -0800 (Thu, 22 May 2008) $
- */
-public class ItemList extends ArrayList<Item> {}
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index e15021b972..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /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.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.saxon.SaxonNodeDataBinding;name=net.sf.saxon.om.NodeInfo
-org.apache.tuscany.sca.databinding.saxon.SaxonValueDataBinding;name=net.sf.saxon.value.Value
diff --git a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index 4d927ce53d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-saxon/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /dev/null
@@ -1,34 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.saxon.Node2NodeInfoTransformer;source=org.w3c.dom.Node,target=net.sf.saxon.om.NodeInfo,weight=2000
-org.apache.tuscany.sca.databinding.saxon.NodeInfo2NodeTransformer;source=net.sf.saxon.om.NodeInfo,target=org.w3c.dom.Node,weight=2000
-org.apache.tuscany.sca.databinding.saxon.Object2ValueTransformer;source=java:complexType,target=net.sf.saxon.value.Value,weight=80000
-org.apache.tuscany.sca.databinding.saxon.Value2ObjectTransformer;source=net.sf.saxon.value.Value,target=java:complexType,weight=80000
-org.apache.tuscany.sca.databinding.saxon.SimpleType2ValueTransformer;source=java:simpleType,target=net.sf.saxon.value.Value,weight=80000
-org.apache.tuscany.sca.databinding.saxon.Value2SimpleTypeTransformer;source=net.sf.saxon.value.Value,target=java:simpleType,weight=80000
-org.apache.tuscany.sca.databinding.saxon.NodeInfo2DataObjectTransformer;source=net.sf.saxon.om.NodeInfo,target=commonj.sdo.DataObject,weight=1000
-org.apache.tuscany.sca.databinding.saxon.DataObject2NodeInfoTransformer;source=commonj.sdo.DataObject,target=net.sf.saxon.om.NodeInfo,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=net.sf.saxon.om.NodeInfo,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=net.sf.saxon.value.Value,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=commonj.sdo.DataObject,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=java:complex,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=java:simple,weight=1000
-org.apache.tuscany.sca.databinding.saxon.ItemList2ObjectTransformer;source=org.apache.tuscany.sca.databinding.saxon.collection.ItemList,target=java:array,weight=1000
-org.apache.tuscany.sca.databinding.saxon.NodeInfo2JavaArrayTransformer;source=net.sf.saxon.om.NodeInfo,target=java:array,weight=1000
-org.apache.tuscany.sca.databinding.saxon.Value2JavaArrayTransformer;source=net.sf.saxon.value.Value,target=java:array,weight=1000
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/LICENSE b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/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-java-1.5.1/modules/databinding-sdo-axiom/NOTICE b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/pom.xml b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/pom.xml
deleted file mode 100644
index fb0b93bf1e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/pom.xml
+++ /dev/null
@@ -1,167 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-sdo-axiom</artifactId>
- <name>Apache Tuscany SCA Data Binding for SDO/AXIOM</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-sdo</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/sdo-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-plugin</artifactId>
- <version>1.1.1</version>
- <executions>
- <execution>
- <id>generate-po-sdo</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
- <javaPackage>com.example.ipo.sdo</javaPackage>
- <noNotification>true</noNotification>
- <noContainer>true</noContainer>
- <noUnsettable>true</noUnsettable>
- </configuration>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- <execution>
- <id>generate-stock-sdo</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
- <javaPackage>com.example.stock.sdo</javaPackage>
- <prefix>Stock</prefix>
- <noNotification>true</noNotification>
- <noContainer>true</noContainer>
- <noUnsettable>true</noUnsettable>
- </configuration>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.sdo.axiom</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.sdo*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.java
deleted file mode 100644
index 02f43000b4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/AxiomHelper.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.databinding.sdo2om;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.builder.StAXBuilder;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Helper for AXIOM
- *
- * @version $Rev$ $Date$
- */
-public class AxiomHelper {
- private static final String DEFAULT_PREFIX = "_ns_";
-
- private AxiomHelper() {
- }
-
- /**
- * See http://issues.apache.org/jira/browse/WSCOMMONS-240
- * @param om
- */
- public static void completeAndClose(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- }
- OMElement document = builder.getDocumentElement();
- if (document != null) {
- document.build();
- }
- }
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).close();
- }
- }
-
- /**
- * This method will close the builder immediately. Any subsequent Axiom objects won't
- * be built or accessible.
- */
- public static void closeImmediately(OMElement om) {
- // Get the builder associated with the om element
- OMXMLParserWrapper builder = om.getBuilder();
- if (builder != null) {
- if (builder instanceof StAXBuilder) {
- ((StAXBuilder)builder).releaseParserOnClose(true);
- ((StAXBuilder)builder).close();
- }
- // builder.close();
- }
- }
-
- /**
- * @param context
- * @param element
- */
- public static void adjustElementName(TransformationContext context, OMElement element) {
- if (context != null) {
- DataType dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (!(logical instanceof XMLType)) {
- return;
- }
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement() && !xmlType.getElementName().equals(element.getQName())) {
- // FIXME:: Throw exception or switch to the new Element?
- OMFactory factory = OMAbstractFactory.getOMFactory();
- QName name = xmlType.getElementName();
- OMNamespace namespace = factory.createOMNamespace(name.getNamespaceURI(), name.getPrefix());
- element.setNamespace(namespace);
- element.setLocalName(name.getLocalPart());
- }
- }
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(localName, ns);
-
- }
-
- public static OMElement createOMElement(OMFactory factory, QName element, OMDataSource dataSource) {
- String localName = element.getLocalPart();
- OMNamespace ns = createOMNamespace(factory, element);
-
- return factory.createOMElement(dataSource, localName, ns);
-
- }
-
- /**
- * @param factory
- * @param name
- * @return
- */
- public static OMNamespace createOMNamespace(OMFactory factory, QName name) {
- String namespaceURI = name.getNamespaceURI();
- String prefix = name.getPrefix();
-
- OMNamespace ns = null;
- if (namespaceURI.length() != 0) {
- // Qualified Element: we need an OMNamespace
- if (prefix.length() == 0) {
- // The prefix does not appear to be specified, let's create one
- prefix = DEFAULT_PREFIX;
- }
- ns = factory.createOMNamespace(namespaceURI, prefix);
- }
- return ns;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.java
deleted file mode 100644
index aa7f99724d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElement.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.databinding.sdo2om;
-
-import static org.apache.tuscany.sca.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-/**
- * SDO DataObject --> AXIOM OMElement transformer
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2OMElement extends BaseTransformer<DataObject, OMElement> implements
- PullTransformer<DataObject, OMElement> {
-
- public OMElement transform(DataObject source, TransformationContext context) {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- QName name = ROOT_ELEMENT;
- if (context != null) {
- DataType dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (logical instanceof XMLType) {
- XMLType xmlType = (XMLType)logical;
- if (xmlType.isElement()) {
- name = xmlType.getElementName();
- }
- }
- }
-
- XMLDocument document = helperContext.getXMLHelper().createDocument(source,
- name.getNamespaceURI(),
- name.getLocalPart());
- SDODataSource dataSource = new SDODataSource(document, helperContext);
- OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
- return element;
- }
-
- @Override
- protected Class<DataObject> getSourceType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java
deleted file mode 100644
index dc3c2610a4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/SDODataSource.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo2om;
-
-import static org.apache.tuscany.sca.databinding.sdo.SDODataBinding.ROOT_ELEMENT;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.om.OMDataSource;
-import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.impl.serialize.StreamingOMSerializer;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SDODataSource implements OMDataSource {
- private HelperContext helperContext;
- private XMLDocument sourceDocument;
-
- public SDODataSource(XMLDocument source, HelperContext helperContext) {
- this.sourceDocument = source;
- this.helperContext = helperContext;
- }
-
- public SDODataSource(DataObject obj, HelperContext helperContext) {
- this.helperContext = helperContext;
- this.sourceDocument =
- helperContext.getXMLHelper().createDocument(obj,
- ROOT_ELEMENT.getNamespaceURI(),
- ROOT_ELEMENT.getLocalPart());
- }
-
- public XMLStreamReader getReader() throws XMLStreamException {
- XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
- return streamHelper.createXMLStreamReader(sourceDocument);
- }
-
- public void serialize(XMLStreamWriter xmlWriter) throws XMLStreamException {
- StreamingOMSerializer serializer = new StreamingOMSerializer();
- serializer.serialize(getReader(), xmlWriter);
- }
-
- public void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException {
- try {
- helperContext.getXMLHelper().save(sourceDocument, output, null);
- } catch (Exception e) {
- throw new XMLStreamException(e);
- }
- }
-
- public void serialize(Writer writer, OMOutputFormat format) throws XMLStreamException {
- try {
- helperContext.getXMLHelper().save(sourceDocument, writer, null);
- } catch (IOException e) {
- throw new XMLStreamException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java
deleted file mode 100644
index a55a9f37cb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo2om;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.sdo.SDOContextHelper;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-/**
- * SDO XMLDocument --> AXIOM OMElement transformer
- * @version $Rev$ $Date$
- */
-public class XMLDocument2OMElement extends BaseTransformer<XMLDocument, OMElement> implements
- PullTransformer<XMLDocument, OMElement> {
-
- public OMElement transform(XMLDocument source, TransformationContext context) {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- SDODataSource dataSource = new SDODataSource(source, helperContext);
- OMFactory factory = OMAbstractFactory.getOMFactory();
- QName name = new QName(source.getRootElementURI(), source.getRootElementName());
- OMElement element = AxiomHelper.createOMElement(factory, name, dataSource);
- return element;
- }
-
- @Override
- protected Class<XMLDocument> getSourceType() {
- return XMLDocument.class;
- }
-
- @Override
- protected Class<OMElement> getTargetType() {
- return OMElement.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index c870ec2406..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /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.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.sdo2om.DataObject2OMElement;source=commonj.sdo.DataObject,target=org.apache.axiom.om.OMElement,weight=3000
-org.apache.tuscany.sca.databinding.sdo2om.XMLDocument2OMElement;source=commonj.sdo.helper.XMLDocument,target=org.apache.axiom.om.OMElement,weight=3000
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java
deleted file mode 100644
index 57dd056526..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/DataObject2OMElementTestCase.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo2om;
-
-import java.io.StringWriter;
-
-import javax.xml.stream.XMLStreamException;
-
-import junit.framework.Assert;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import commonj.sdo.DataObject;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2OMElementTestCase extends SDOTransformerTestCaseBase {
-
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
- }
-
- public final void testTransform() throws XMLStreamException {
- OMElement element = new DataObject2OMElement().transform(dataObject, context);
- Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
- Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
- // TODO: See https://issues.apache.org/jira/browse/WSCOMMONS-226
- // element.getBuilder().setCache(false);
- StringWriter writer = new StringWriter();
- element.serialize(writer);
- }
-
- public final void testTransformWrapper() throws XMLStreamException {
- OMElement element = new DataObject2OMElement().transform(dataObject, context);
- Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
- Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
-
- OMNamespace ns = OMAbstractFactory.getOMFactory().createOMNamespace("http://ns1", "ns1");
- element.setNamespace(ns);
- element.setLocalName("dummy");
- // TODO: See https://issues.apache.org/jira/browse/WSCOMMONS-226
- // element.getBuilder().setCache(true);
- StringWriter writer = new StringWriter();
- element.serializeAndConsume(writer);
- // System.out.println(writer);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.java
deleted file mode 100644
index f69ef598b8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/SDOTransformerTestCaseBase.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.databinding.sdo2om;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import com.example.ipo.sdo.SdoFactory;
-import com.example.ipo.sdo.USAddress;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.impl.HelperProvider;
-
-/**
- * The base class for SDO-related test cases
- *
- * @version $Rev$ $Date$
- */
-public abstract class SDOTransformerTestCaseBase extends TestCase {
- protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
-
- protected HelperContext helperContext;
- protected String binding = DataObject.class.getName();
- protected TransformationContext context;
- protected TransformationContext reversedContext;
- protected DataObject dataObject;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- helperContext = HelperProvider.getDefaultContext();
- SdoFactory.INSTANCE.register(helperContext);
-
- context = new TransformationContextImpl();
- context.setSourceDataType(getSourceDataType());
- context.setTargetDataType(getTargetDataType());
-
- reversedContext = new TransformationContextImpl();
- reversedContext.setSourceDataType(getTargetDataType());
- reversedContext.setTargetDataType(getSourceDataType());
-
- PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
- USAddress address = SdoFactory.INSTANCE.createUSAddress();
- address.setCity("San Jose");
- address.setStreet("123 ABC St");
- address.setState("CA");
- address.setStreet("95131");
- po.setBillTo(address);
- dataObject = (DataObject) po;
- }
-
- protected abstract DataType<?> getSourceDataType();
-
- protected abstract DataType<?> getTargetDataType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.java
deleted file mode 100644
index 5015a1b697..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/java/org/apache/tuscany/sca/databinding/sdo2om/XMLDocument2OMElementTestCase.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.databinding.sdo2om;
-
-import java.io.StringWriter;
-
-import javax.xml.stream.XMLStreamException;
-
-import junit.framework.Assert;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import commonj.sdo.helper.XMLDocument;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XMLDocument2OMElementTestCase extends SDOTransformerTestCaseBase {
-
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<XMLType>(OMElement.class.getName(), OMElement.class, new XMLType(ORDER_QNAME, null));
- }
-
- public final void testTransform() throws XMLStreamException {
- XMLDocument document =
- helperContext.getXMLHelper().createDocument(dataObject,
- ORDER_QNAME.getNamespaceURI(),
- ORDER_QNAME.getLocalPart());
- OMElement element = new XMLDocument2OMElement().transform(document, context);
- Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespace().getNamespaceURI());
- Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
- StringWriter writer = new StringWriter();
- element.serialize(writer);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd
deleted file mode 100644
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/stock.xsd b/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/stock.xsd
deleted file mode 100644
index a0a6717371..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo-axiom/src/test/resources/stock.xsd
+++ /dev/null
@@ -1,33 +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.
--->
-<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
- <!-- Faults -->
- <element name="InvalidSymbolFault">
- <complexType>
- <sequence>
- <element name="message" minOccurs="1" type="string" />
- <element name="symbol" minOccurs="1" type="string" />
- </sequence>
- </complexType>
- </element>
-
- <element name="MarketClosedFault" type="string" />
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/LICENSE b/branches/sca-java-1.5.1/modules/databinding-sdo/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/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-java-1.5.1/modules/databinding-sdo/NOTICE b/branches/sca-java-1.5.1/modules/databinding-sdo/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/pom.xml b/branches/sca-java-1.5.1/modules/databinding-sdo/pom.xml
deleted file mode 100644
index 18a4b97cd9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/pom.xml
+++ /dev/null
@@ -1,144 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-sdo</artifactId>
- <name>Apache Tuscany SCA Data Binding for SDO</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <!-- FIXME: We might want to create a separate module to host the processor -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-lib</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-impl</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/sdo-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-plugin</artifactId>
- <version>1.1.1</version>
- <executions>
- <execution>
- <id>generate-po-sdo</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <schemaFile>${basedir}/src/test/resources/ipo.xsd</schemaFile>
- <javaPackage>com.example.ipo.sdo</javaPackage>
- <noNotification>true</noNotification>
- <noContainer>true</noContainer>
- <noUnsettable>true</noUnsettable>
- </configuration>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- <execution>
- <id>generate-stock-sdo</id>
- <phase>generate-test-sources</phase>
- <configuration>
- <schemaFile>${basedir}/src/test/resources/stock.xsd</schemaFile>
- <javaPackage>com.example.stock.sdo</javaPackage>
- <prefix>Stock</prefix>
- <noNotification>true</noNotification>
- <noContainer>true</noContainer>
- <noUnsettable>true</noUnsettable>
- </configuration>
- <goals>
- <goal>generate</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.sdo</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.sdo*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java
deleted file mode 100644
index 503e54e530..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2Node.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.namespace.QName;
-import javax.xml.transform.dom.DOMResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class DataObject2Node extends BaseTransformer<DataObject, Node> implements
- PullTransformer<DataObject, Node> {
-
- public Node transform(DataObject source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- XMLHelper xmlHelper = helperContext.getXMLHelper();
- QName elementName = SDOContextHelper.getElement(context);
- Document doc = DOMHelper.newDocument();
- DOMResult result = new DOMResult(doc);
- XMLDocument xmlDoc = xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
- xmlHelper.save(xmlDoc, result, null);
- return doc.getDocumentElement();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<DataObject> getSourceType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java
deleted file mode 100644
index 8ce8eae587..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2String.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLHelper;
-
-public class DataObject2String extends BaseTransformer<DataObject, String> implements
- PullTransformer<DataObject, String> {
-
- public String transform(DataObject source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- XMLHelper xmlHelper = helperContext.getXMLHelper();
- QName elementName = SDOContextHelper.getElement(context);
- return xmlHelper.save(source, elementName.getNamespaceURI(), elementName.getLocalPart());
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<DataObject> getSourceType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.java
deleted file mode 100644
index 116ac4c553..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReader.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.databinding.sdo;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class DataObject2XMLStreamReader extends BaseTransformer<DataObject, XMLStreamReader> implements
- PullTransformer<DataObject, XMLStreamReader> {
-
- public XMLStreamReader transform(final DataObject source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
- final QName elementName = SDOContextHelper.getElement(context);
- final XMLHelper xmlHelper = helperContext.getXMLHelper();
- // Allow privileged access to read properties. REquires java.util.PropertyPermission
- // XML.load.form.lax read in security policy.
- XMLDocument document = AccessController.doPrivileged(new PrivilegedAction<XMLDocument>() {
- public XMLDocument run() {
- return xmlHelper.createDocument(source, elementName.getNamespaceURI(), elementName.getLocalPart());
- }
- });
-
- return streamHelper.createXMLStreamReader(document);
- } catch (XMLStreamException e) {
- // TODO: Add context to the exception
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<DataObject> getSourceType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java
deleted file mode 100644
index 30a3e1c3a9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDO.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.impl.BaseImpl;
-
-import commonj.sdo.helper.HelperContext;
-
-/**
- * The model object for import.sdo
- *
- * @version $Rev$ $Date$
- */
-public class ImportSDO extends BaseImpl {
- public static final QName IMPORT_SDO =
- new QName("http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0", "import.sdo");
-
- private HelperContext helperContext;
- private String factoryClassName;
- private String schemaLocation;
-
- public ImportSDO(HelperContext helperContext) {
- super();
- this.helperContext = helperContext;
- setUnresolved(true);
- }
-
- public HelperContext getHelperContext() {
- return helperContext;
- }
-
- /**
- * @return the factoryClassName
- */
- public String getFactoryClassName() {
- return factoryClassName;
- }
-
- /**
- * @param factoryClassName the factoryClassName to set
- */
- public void setFactoryClassName(String factoryClassName) {
- this.factoryClassName = factoryClassName;
- }
-
- /**
- * @return the schemaLocation
- */
- public String getSchemaLocation() {
- return schemaLocation;
- }
-
- /**
- * @param schemaLocation the schemaLocation to set
- */
- public void setSchemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java
deleted file mode 100644
index e0844117f2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessor.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static org.apache.tuscany.sca.databinding.sdo.ImportSDO.IMPORT_SDO;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLConnection;
-
-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.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * Loader that handles &lt;import.sdo&gt; elements.
- *
- * @version $Rev$ $Date$
- * @deprecated
- */
-@Deprecated
-public class ImportSDOProcessor implements StAXArtifactProcessor<ImportSDO> {
-
- private ContributionFactory contributionFactory;
- private Monitor monitor;
-
- public ImportSDOProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public QName getXMLType() {
- return IMPORT_SDO;
- }
-
- public ImportSDO read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert IMPORT_SDO.equals(reader.getName());
-
- // FIXME: How do we associate the application HelperContext with the one
- // imported by the composite
- ImportSDO importSDO = new ImportSDO(SDOContextHelper.getDefaultHelperContext());
- String factoryName = reader.getAttributeValue(null, "factory");
- if (factoryName != null) {
- importSDO.setFactoryClassName(factoryName);
- }
- String location = reader.getAttributeValue(null, "location");
- if (location != null) {
- importSDO.setSchemaLocation(location);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && ImportSDO.IMPORT_SDO.equals(reader.getName())) {
- break;
- }
- }
- return importSDO;
- }
-
- private void importFactory(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
- String factoryName = importSDO.getFactoryClassName();
- if (factoryName != null) {
- ClassReference reference = new ClassReference(factoryName);
- ClassReference resolved = resolver.resolveModel(ClassReference.class, reference);
- if (resolved != null && !resolved.isUnresolved()) {
- try {
- Class<?> factoryClass = resolved.getJavaClass();
- register(factoryClass, importSDO.getHelperContext());
- importSDO.setUnresolved(false);
- } catch (Exception e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- error("FailToResolveClass", resolver, factoryName);
- //ContributionResolveException loaderException =
- //new ContributionResolveException("Fail to resolve class: " + factoryName);
- //throw loaderException;
- }
- }
- }
-
- private static void register(Class factoryClass, HelperContext helperContext) throws Exception {
- Field field = factoryClass.getField("INSTANCE");
- Object factory = field.get(null);
- Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
- method.invoke(factory, new Object[] {helperContext});
-
- // HelperContext defaultContext = HelperProvider.getDefaultContext();
- // method.invoke(factory, new Object[] {defaultContext});
- }
-
- private void importWSDL(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
- String location = importSDO.getSchemaLocation();
- if (location != null) {
- try {
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(location);
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() != null) {
- String wsdlURL = artifact.getLocation();
- URLConnection connection = new URL(wsdlURL).openConnection();
- connection.setUseCaches(false);
- InputStream xsdInputStream = connection.getInputStream();
- try {
- XSDHelper xsdHelper = importSDO.getHelperContext().getXSDHelper();
- xsdHelper.define(xsdInputStream, wsdlURL);
- } finally {
- xsdInputStream.close();
- }
- importSDO.setUnresolved(false);
- } else {
- error("FailToResolveLocation", resolver, location);
- //ContributionResolveException loaderException = new ContributionResolveException("Fail to resolve location: " + location);
- //throw loaderException;
- }
- } catch (IOException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- }
- }
-
- public QName getArtifactType() {
- return ImportSDO.IMPORT_SDO;
- }
-
- public void write(ImportSDO model, XMLStreamWriter outputSource) throws ContributionWriteException {
- // Not implemented as <import.sdo> is deprecated
- }
-
- public Class<ImportSDO> getModelType() {
- return ImportSDO.class;
- }
-
- public void resolve(ImportSDO importSDO, ModelResolver resolver) throws ContributionResolveException {
- importFactory(importSDO, resolver);
- importWSDL(importSDO, resolver);
- if (!importSDO.isUnresolved()) {
- resolver.addModel(importSDO);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java
deleted file mode 100644
index 4a05492dd8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/Node2DataObject.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class Node2DataObject extends BaseTransformer<Node, DataObject> implements PullTransformer<Node, DataObject> {
-
- public DataObject transform(Node source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, false);
- XMLHelper xmlHelper = helperContext.getXMLHelper();
- Document doc = DOMHelper.promote(source);
- DOMSource domSource = new DOMSource(doc);
- XMLDocument xmlDoc = xmlHelper.load(domSource, doc.getDocumentURI(), null);
- return xmlDoc.getRootObject();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<DataObject> getTargetType() {
- return DataObject.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java
deleted file mode 100644
index ada0c94a8d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelper.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.util.DataTypeHelper;
-import org.apache.tuscany.sca.databinding.util.LRUCache;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.impl.HelperProvider;
-
-/**
- * Helper class to get TypeHelper from the context
- *
- * @version $Rev$ $Date$
- */
-public final class SDOContextHelper {
- private static final LRUCache<Object, HelperContext> cache = new LRUCache<Object, HelperContext>(1024);
-
- private SDOContextHelper() {
- }
-
- public static HelperContext getHelperContext(TransformationContext context, boolean source) {
- if (context == null) {
- return getDefaultHelperContext();
- }
-
- HelperContext helperContext = null;
- Operation op = source ? context.getSourceOperation() : context.getTargetOperation();
- if (op == null) {
- DataType<?> dt = source ? context.getSourceDataType() : context.getTargetDataType();
-
- helperContext = dt.getMetaData(HelperContext.class);
- if (helperContext != null) {
- return helperContext;
- }
- helperContext = SDOUtil.createHelperContext();
- boolean found = register(helperContext, dt);
- if (!found) {
- helperContext = getDefaultHelperContext();
- }
- dt.setMetaData(HelperContext.class, helperContext);
- return helperContext;
- } else {
- return getHelperContext(op);
- }
-
- }
-
- public static HelperContext getHelperContext(Operation op) {
- if (op == null) {
- return getDefaultHelperContext();
- }
-
- HelperContext helperContext = op.getInputType().getMetaData(HelperContext.class);
-
- if (helperContext != null) {
- return helperContext;
- }
-
- // Use the default HelperContext until a type is registered later on
- helperContext = getDefaultHelperContext();
-
- /*
- List<DataType> dataTypes = DataTypeHelper.getDataTypes(op, false);
- boolean found = false;
- for (DataType d : dataTypes) {
- if (register(helperContext, d)) {
- found = true;
- }
- }
- if (!found) {
- helperContext = getDefaultHelperContext();
- }
- */
- op.getInputType().setMetaData(HelperContext.class, helperContext);
- return helperContext;
- }
-
- /**
- * @param helperContext
- * @param dataType
- * @return
- */
- private static boolean register(HelperContext helperContext, DataType dataType) {
- if (dataType == null) {
- return false;
- }
- Set<Class<?>> classes = DataTypeHelper.findClasses(dataType);
- boolean found = false;
- for (Class<?> cls : classes) {
- found = register(helperContext, dataType.getPhysical()) || found;
- }
- return found;
- }
-
- /**
- * FIXME: [rfeng] This is a hack to get the factory out a SDO class
- * @param helperContext
- * @param javaType
- */
-
- public static boolean register(HelperContext helperContext, Class javaType) {
- if (javaType == null || DataObject.class == javaType) {
- return false;
- }
- try {
- Type type = helperContext.getTypeHelper().getType(javaType);
- return register(helperContext, type);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- public static boolean register(HelperContext helperContext, Type type) {
- if (type != null && (!type.isDataType())) {
- try {
- Method method = type.getClass().getMethod("getEPackage");
- Object factory = method.invoke(type, new Object[] {});
- method = factory.getClass().getMethod("register", HelperContext.class);
- method.invoke(factory, new Object[] {helperContext});
- return true;
- } catch (Exception e) {
- e.printStackTrace();
- return false;
- }
- } else {
- return false;
- }
- }
-
- public static HelperContext getDefaultHelperContext() {
- // SDOUtil.createHelperContext();
- return HelperProvider.getDefaultContext();
- }
-
- public static QName getElement(TransformationContext context) {
- if (context == null) {
- return SDODataBinding.ROOT_ELEMENT;
- }
- DataType<?> dataType = context.getTargetDataType();
- Object logical = dataType.getLogical();
- QName elementName = null;
- if (logical instanceof XMLType) {
- XMLType xmlType = (XMLType)logical;
- QName element = xmlType.getElementName();
- if (element != null) {
- elementName = element;
- }
- }
- if (elementName == null) {
- // Try source type
- dataType = context.getSourceDataType();
- logical = dataType.getLogical();
- if (logical instanceof XMLType) {
- XMLType xmlType = (XMLType)logical;
- QName element = xmlType.getElementName();
- if (element != null) {
- elementName = element;
- }
- }
- }
- if (elementName != null) {
- return elementName;
- } else {
- return SDODataBinding.ROOT_ELEMENT;
- }
- }
-
- public static String generateSchema(HelperContext context, Class<?>[] classes) {
- TypeHelper typeHelper = context.getTypeHelper();
- List<Type> types = new ArrayList<Type>();
- for (Class<?> cls : classes) {
- Type type = typeHelper.getType(cls);
- if (type != null) {
- types.add(type);
- }
- }
- return generateSchema(context, types);
- }
-
- public static String generateSchema(HelperContext context, List<Type> types) {
- // FIXME: SDO throws IllegalArgumentException for types generated from existing XSDs
- return context.getXSDHelper().generate(types);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.java
deleted file mode 100644
index 39e9ffc161..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDODataBinding.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.databinding.sdo;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Type;
-import commonj.sdo.helper.CopyHelper;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-/**
- * SDO Databinding
- *
- * @version $Rev$ $Date$
- */
-public class SDODataBinding extends BaseDataBinding {
- public static final String NAME = DataObject.class.getName();
-
- public static final String ROOT_NAMESPACE = "commonj.sdo";
- public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "dataObject");
-
- private WrapperHandler<Object> wrapperHandler;
- private XMLTypeHelper xmlTypeHelper;
-
- public SDODataBinding() {
- super(NAME, DataObject.class);
- wrapperHandler = new SDOWrapperHandler();
- xmlTypeHelper = new SDOTypeHelper();
- }
-
- @Override
- public boolean introspect(DataType dataType, final Operation operation) {
- final Class javaType = dataType.getPhysical();
- // Allow privileged access to read system properties. Requires PropertyPermission
- // java.specification.version read in security policy.
- final HelperContext context = AccessController.doPrivileged(new PrivilegedAction<HelperContext>() {
- public HelperContext run() {
- return SDOContextHelper.getHelperContext(operation);
- }
- });
-
- final Type type = context.getTypeHelper().getType(javaType);
- if (type == null) {
- // FIXME: Need a better to test dynamic SDO
- if (DataObject.class.isAssignableFrom(javaType)) {
- // Dynamic SDO
- dataType.setDataBinding(getName());
- if (dataType.getLogical() == null) {
- dataType.setLogical(XMLType.UNKNOWN);
- }
- return true;
- }
- return false;
- }
- if (type.isDataType()) {
- // FIXME: Ignore simple types?
- return false;
- }
-
- // Found a SDO type, replace the default context with a private one
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- if (context == SDOContextHelper.getDefaultHelperContext()) {
- HelperContext newContext = SDOUtil.createHelperContext();
- SDOContextHelper.register(newContext, type);
- if (operation != null) {
- operation.getInputType().setMetaData(HelperContext.class, newContext);
- }
- } else {
- SDOContextHelper.register(context, type);
- }
- return null;
- }
- });
-
- String namespace = type.getURI();
- String name = context.getXSDHelper().getLocalName(type);
- QName xmlType = new QName(namespace, name);
- dataType.setDataBinding(getName());
- QName elementName = null;
- Object logical = dataType.getLogical();
- if (logical instanceof XMLType) {
- elementName = ((XMLType)logical).getElementName();
- }
- dataType.setLogical(new XMLType(elementName, xmlType));
-
- return true;
- }
-
- @Override
- public WrapperHandler getWrapperHandler() {
- return wrapperHandler;
- }
-
- @Override
- public XMLTypeHelper getXMLTypeHelper() {
- // return new SDOTypeHelper();
- return xmlTypeHelper;
- }
-
- @Override
- public Object copy(Object arg, DataType dataType, Operation operation) {
- HelperContext context = SDOContextHelper.getHelperContext(operation);
- CopyHelper copyHelper = context.getCopyHelper();
- if (arg instanceof XMLDocument) {
- XMLDocument document = (XMLDocument)arg;
- DataObject dataObject = copyHelper.copy(document.getRootObject());
- return context.getXMLHelper().createDocument(dataObject,
- document.getRootElementURI(),
- document.getRootElementName());
- } else if (arg instanceof DataObject) {
- return context.getCopyHelper().copy((DataObject)arg);
- } else {
- return super.copy(arg, dataType, operation);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.java
deleted file mode 100644
index c83ec53b01..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOSimpleTypeMapper.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.databinding.sdo;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.TypeHelper;
-
-/**
- * SDO Java/XML mapping for simple XSD types
- *
- * @version $Rev$ $Date$
- */
-public class SDOSimpleTypeMapper implements SimpleTypeMapper {
- public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
-
- public SDOSimpleTypeMapper() {
- super();
- }
-
- public Object toJavaObject(QName typeName, String value, TransformationContext context) {
- Type type = null;
- if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
- type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
- } else {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, false);
- TypeHelper typeHelper = helperContext.getTypeHelper();
- type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
- }
- return SDOUtil.createFromString(type, value);
- }
-
- public String toXMLLiteral(QName typeName, Object obj, TransformationContext context) {
- Type type = null;
- if (URI_2001_SCHEMA_XSD.equals(typeName.getNamespaceURI())) {
- type = SDOUtil.getXSDSDOType(typeName.getLocalPart());
- } else {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- TypeHelper typeHelper = helperContext.getTypeHelper();
- type = typeHelper.getType(typeName.getNamespaceURI(), typeName.getLocalPart());
- }
- return SDOUtil.convertToString(type, obj);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
deleted file mode 100644
index 93c71cce6c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypeHelper.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import java.beans.Introspector;
-import java.io.StringReader;
-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.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.osoa.sca.ServiceRuntimeException;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSParser;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-public class SDOTypeHelper implements XMLTypeHelper {
- private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
-
- private TypeHelper typeHelper;
- private XSDHelper xsdHelper;
- // private Map<String, List<Type>> xsdTypesMap = new HashMap<String, List<Type>>();
- // private Map<String, List<Type>> typesMap = new HashMap<String, List<Type>>();
-
- public SDOTypeHelper() {
- super();
- typeHelper = SDOContextHelper.getDefaultHelperContext().getTypeHelper();
- xsdHelper = SDOContextHelper.getDefaultHelperContext().getXSDHelper();
- }
-
- public TypeInfo getTypeInfo(Class javaType, Object logical) {
- QName xmlType = JavaXMLMapper.getXMLType(javaType);
- if (xmlType != null) {
- return new TypeInfo(xmlType, true, null);
- } else {
- // introspect(javaType, xsdTypesMap, typesMap);
- if (logical instanceof XMLType) {
- xmlType = ((XMLType)logical).getTypeName();
- }
- if (xmlType == null) {
- xmlType =
- new QName(JavaXMLMapper.getNamespace(javaType), Introspector.decapitalize(javaType.getSimpleName()));
- }
- return new TypeInfo(xmlType, false, null);
- }
- }
-
- private void introspect(Class javaType, Map<String, List<Type>> xsdTypesMap, Map<String, List<Type>> typesMap) {
- Type type = typeHelper.getType(javaType);
- if (type == null) {
- return;
- }
- if (xsdHelper.isXSD(type)) {
- addToMap(xsdTypesMap, type);
- } else {
- addToMap(typesMap, type);
- }
- }
-
- private void addToMap(Map<String, List<Type>> map, Type type) {
- List<Type> types = map.get(type.getURI());
- if (types == null) {
- types = new ArrayList<Type>();
- map.put(type.getURI(), types);
- }
- if (!types.contains(type)) {
- types.add(type);
- }
- }
-
- /*
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver) {
- List<XSDefinition> definitions = new ArrayList<XSDefinition>();
- generateSDOSchemas(definitions, factory, typesMap);
- addResolvedXSDs(definitions, factory, resolver, xsdTypesMap);
- return definitions;
- }
- */
-
- private void generateSDOSchemas(List<XSDefinition> definitions, XSDFactory factory, Map<String, List<Type>> map) {
- for (Map.Entry<String, List<Type>> entry : map.entrySet()) {
- List<Type> types = entry.getValue();
- String ns = entry.getKey();
- generateSchema(definitions, factory, types, ns);
- }
- }
-
- private void generateSchema(List<XSDefinition> definitions, XSDFactory factory, List<Type> types, String ns) {
- String schema = xsdHelper.generate(types);
- DOMImplementationRegistry registry = null;
- try {
- registry = DOMImplementationRegistry.newInstance();
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- DOMImplementation impl = registry.getDOMImplementation("XML 3.0");
- DOMImplementationLS ls = (DOMImplementationLS)impl.getFeature("LS", "3.0");
- LSParser parser = ls.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, SCHEMA_NS);
- LSInput input = ls.createLSInput();
- input.setCharacterStream(new StringReader(schema));
- Document document = parser.parse(input);
- XSDefinition definition = factory.createXSDefinition();
- definition.setUnresolved(true);
- definition.setDocument(document);
- definition.setNamespace(ns);
- definitions.add(definition);
- }
-
- private void addResolvedXSDs(List<XSDefinition> definitions,
- XSDFactory factory,
- ModelResolver resolver,
- Map<String, List<Type>> map) {
- for (Map.Entry<String, List<Type>> entry : map.entrySet()) {
- XSDefinition definition = factory.createXSDefinition();
- definition.setUnresolved(true);
- definition.setNamespace(entry.getKey());
- //FIXME: set location URI
- XSDefinition resolved = resolver.resolveModel(XSDefinition.class, definition);
- if (resolved.getSchema() == null) {
- //FIXME: create a checked exception and propagate it back up to the activator
- throw new RuntimeException("No XSD found for namespace " + entry.getKey());
- }
- // make sure all the required types are defined in the resolved schema
- for (Type type : entry.getValue()) {
- String name = xsdHelper.getLocalName(type);
- QName typeName = null;
- if (name.endsWith("_._type")) {
- // FIXME: Anonymous tyype
- name = name.substring(0, name.length() - "_._type".length());
- typeName = new QName(type.getURI(), name);
- if (resolved.getXmlSchemaElement(typeName) == null) {
- //FIXME: create a checked exception and propagate it back up to the activator
- throw new RuntimeException("No XSD found for " + typeName.toString());
- }
- } else {
- typeName = new QName(type.getURI(), name);
- if (resolved.getXmlSchemaType(typeName) == null) {
- //FIXME: create a checked exception and propagate it back up to the activator
- throw new RuntimeException("No XSD found for " + typeName.toString());
- }
- }
-
- }
- definitions.add(resolved);
- }
- }
-
- private static List<DataType> getDataTypes(Interface intf) {
- List<DataType> dataTypes = new ArrayList<DataType>();
- for (Operation op : intf.getOperations()) {
- WrapperInfo inputWrapperInfo = op.getInputWrapper();
- WrapperInfo outputWrapperInfo = op.getOutputWrapper();
- if (inputWrapperInfo != null && outputWrapperInfo != null) {
- DataType dt1 = inputWrapperInfo.getWrapperType();
- if (dt1 != null) {
- dataTypes.add(dt1);
- }
- DataType dt2 = outputWrapperInfo.getWrapperType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- } else {
- for (DataType dt1 : op.getInputType().getLogical()) {
- dataTypes.add(dt1);
- }
- DataType dt2 = op.getOutputType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- for (DataType<DataType> dt3 : op.getFaultTypes()) {
- DataType dt4 = dt3.getLogical();
- if (dt4 != null) {
- dataTypes.add(dt4);
- }
- }
- }
- }
- return dataTypes;
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf) {
- return getSchemaDefinitions(factory, resolver, getDataTypes(intf));
- }
-
- public List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes) {
- Map<String, List<Type>> xsdTypesMap = new HashMap<String, List<Type>>();
- Map<String, List<Type>> typesMap = new HashMap<String, List<Type>>();
- for (DataType d : dataTypes) {
- if (SDODataBinding.NAME.equals(d.getDataBinding())) {
- introspect(d.getPhysical(), xsdTypesMap, typesMap);
- }
- }
- List<XSDefinition> definitions = new ArrayList<XSDefinition>();
- generateSDOSchemas(definitions, factory, typesMap);
- addResolvedXSDs(definitions, factory, resolver, xsdTypesMap);
- return definitions;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.java
deleted file mode 100644
index 73c9711c2a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOTypes.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.databinding.sdo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import commonj.sdo.Type;
-
-/**
- * The model object for sdo.types
- *
- * @version $Rev: 537464 $ $Date: 2007-05-12 08:37:14 -0700 (Sat, 12 May 2007) $
- *
- * This extends the META-INF/sca-contribution.xml to register SDO types from static factory classes or WSDL/XSD files
- *
- * &lt;contribution xmlns=&quot;http://www.osoa.org/xmlns/sca/1.0&quot;<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;xmlns:tuscany=&quot;http://tuscany.apache.org/xmlns/sca/1.0&quot;&gt;<br>
- * &nbsp;&nbsp;&nbsp;&nbsp;&lt;tuscany:sdo.types namespace=&quot;http://helloworld&quot; location=&quot;wsdl/helloworld.wsdl&quot;/&gt;<br>
- * &lt;/contribution&gt;
- *
- */
-public class SDOTypes {
- public static final QName SDO_TYPES = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "sdo.types");
-
- private String factory;
- private String schemaLocation;
- private String namespace;
-
- private List<Type> types = new ArrayList<Type>();
-
- private boolean unresolved;
-
- public SDOTypes() {
- super();
- setUnresolved(true);
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- /**
- * @return the factoryClassName
- */
- public String getFactory() {
- return factory;
- }
-
- /**
- * @param factoryClassName the factoryClassName to set
- */
- public void setFactory(String factoryClassName) {
- this.factory = factoryClassName;
- }
-
- /**
- * @return the schemaLocation
- */
- public String getSchemaLocation() {
- return schemaLocation;
- }
-
- /**
- * @param schemaLocation the schemaLocation to set
- */
- public void setSchemaLocation(String schemaLocation) {
- this.schemaLocation = schemaLocation;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setNamespace(String namespace) {
- this.namespace = namespace;
- }
-
- public List<Type> getTypes() {
- return types;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java
deleted file mode 100644
index 167be60640..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandler.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.Sequence;
-import commonj.sdo.Type;
-import commonj.sdo.helper.DataFactory;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * SDO Wrapper Handler
- *
- * @version $Rev$ $Date$
- */
-public class SDOWrapperHandler implements WrapperHandler<Object> {
-
- public Object create(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
- Type sdoType = getSDOType(helperContext, element);
- if (sdoType != null) {
- DataFactory dataFactory = helperContext.getDataFactory();
- return dataFactory.create(sdoType);
- }
- return null;
- }
-
- public void setChildren(Object wrapper, Object[] childObjects, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- for (int i = 0; i < childElements.size(); i++) {
- setChild(wrapper, i, childElements.get(i), childObjects[i]);
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#setChild(java.lang.Object, int, ElementInfo,
- * java.lang.Object)
- */
- public void setChild(Object wrapper, int i, ElementInfo childElement, Object value) {
- DataObject wrapperDO =
- (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
- String name = childElement.getQName().getLocalPart();
- if (childElement.isMany()) {
- // FIXME: If we look up by name, we need to make sure the WrapperInfo has the correct element names
- wrapperDO.getList(i).addAll((Collection)value);
- } else {
- wrapperDO.set(i, value);
- }
- }
-
- @SuppressWarnings("unchecked")
- public List getChildren(Object wrapper, Operation operation, boolean input) {
- DataObject wrapperDO =
- (wrapper instanceof XMLDocument) ? ((XMLDocument)wrapper).getRootObject() : (DataObject)wrapper;
- List<Property> properties = wrapperDO.getInstanceProperties();
- List<Object> elements = new ArrayList<Object>();
- Type type = wrapperDO.getType();
- if (type.isSequenced()) {
- // Add values in the sequence
- Sequence sequence = wrapperDO.getSequence();
- for (int i = 0; i < sequence.size(); i++) {
- // Skip mixed text
- if (sequence.getProperty(i) != null) {
- elements.add(sequence.getValue(i));
- }
- }
- } else {
- for (Property p : properties) {
- Object child = wrapperDO.get(p);
- if (p.isMany()) {
- for (Object c : (Collection<?>)child) {
- elements.add(c);
- }
- } else {
- elements.add(child);
- }
- }
- }
- return elements;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
- Type sdoType = getSDOType(helperContext, element);
- if (sdoType != null) {
- // Check if child elements matches
- Class physical = sdoType.getInstanceClass();
- DataType<XMLType> wrapperType =
- new DataTypeImpl<XMLType>(SDODataBinding.NAME, physical, new XMLType(element));
- return wrapperType;
- } else {
- return null;
- }
- }
-
- /**
- * @param helperContext
- * @param element
- * @return
- */
- private Type getSDOType(HelperContext helperContext, ElementInfo element) {
- XSDHelper xsdHelper = helperContext.getXSDHelper();
- Type sdoType = null;
- Property prop =
- xsdHelper.getGlobalProperty(element.getQName().getNamespaceURI(), element.getQName().getLocalPart(), true);
- if (prop != null) {
- sdoType = prop.getType();
- } else {
- TypeInfo type = element.getType();
- QName typeName = type != null ? type.getQName() : null;
- if (typeName != null) {
- sdoType = helperContext.getTypeHelper().getType(typeName.getNamespaceURI(), typeName.getLocalPart());
- }
- }
- return sdoType;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#isInstance(java.lang.Object, Operation, boolean)
- */
- public boolean isInstance(Object wrapper, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- // List<ElementInfo> childElements =
- // input ? wrapperInfo.getInputChildElements() : wrapperInfo.getOutputChildElements();
- HelperContext helperContext = SDOContextHelper.getHelperContext(operation);
- Type sdoType = getSDOType(helperContext, element);
- if (sdoType != null) {
- return sdoType.isInstance(wrapper);
- }
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.java
deleted file mode 100644
index 7ac423f8d8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/String2DataObject.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.databinding.sdo;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLHelper;
-
-public class String2DataObject extends BaseTransformer<String, DataObject> implements
- PullTransformer<String, DataObject> {
-
- public DataObject transform(String source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, false);
- XMLHelper xmlHelper = helperContext.getXMLHelper();
- return xmlHelper.load(source).getRootObject();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<DataObject> getTargetType() {
- return DataObject.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java
deleted file mode 100644
index 4e5aa1d5fd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2String.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import java.io.StringWriter;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-
-public class XMLDocument2String extends BaseTransformer<XMLDocument, String> implements
- PullTransformer<XMLDocument, String> {
-
- public String transform(XMLDocument source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- XMLHelper xmlHelper = helperContext.getXMLHelper();
- StringWriter writer = new StringWriter();
- xmlHelper.save(source, writer, null);
- return writer.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLDocument> getSourceType() {
- return XMLDocument.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java
deleted file mode 100644
index e70fa08477..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReader.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-public class XMLDocument2XMLStreamReader extends BaseTransformer<XMLDocument, XMLStreamReader> implements
- PullTransformer<XMLDocument, XMLStreamReader> {
- /**
- * @param source
- * @param context
- * @return
- */
- public XMLStreamReader transform(XMLDocument source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, true);
- XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
- return streamHelper.createXMLStreamReader(source);
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLDocument> getSourceType() {
- return XMLDocument.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.java
deleted file mode 100644
index baf3e2e90a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2DataObject.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.databinding.sdo;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-
-public class XMLStreamReader2DataObject extends BaseTransformer<XMLStreamReader, DataObject> implements
- PullTransformer<XMLStreamReader, DataObject> {
-
- public DataObject transform(XMLStreamReader source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, false);
- XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
- // The XMLStreamHelper requires that the reader is positioned at
- // START_ELEMENT
- while (source.getEventType() != XMLStreamConstants.START_ELEMENT && source.hasNext()) {
- source.next();
- }
- DataObject target = streamHelper.loadObject(source);
- source.close();
- return target;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<DataObject> getTargetType() {
- return DataObject.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 15;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.java
deleted file mode 100644
index ac452910f6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/XMLStreamReader2XMLDocument.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.databinding.sdo;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.apache.tuscany.sdo.api.XMLStreamHelper;
-
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-
-public class XMLStreamReader2XMLDocument extends BaseTransformer<XMLStreamReader, XMLDocument> implements
- PullTransformer<XMLStreamReader, XMLDocument> {
-
- public XMLDocument transform(XMLStreamReader source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- HelperContext helperContext = SDOContextHelper.getHelperContext(context, false);
- XMLStreamHelper streamHelper = SDOUtil.createXMLStreamHelper(helperContext);
- XMLDocument target = streamHelper.load(source);
- source.close();
- return target;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLDocument> getTargetType() {
- return XMLDocument.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 15;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.java
deleted file mode 100644
index af3a0ab74c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesModelResolver.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.databinding.sdo.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.sdo.SDOTypes;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * SDO types model resolver that aggregates the SDO type registration for an SCA contribution
- */
-public class SDOTypesModelResolver implements ModelResolver {
- private Contribution contribution;
- private HelperContext helperContext;
- private List<SDOTypes> sdoTypes = new ArrayList<SDOTypes>();
- private ContributionFactory contributionFactory;
- private XSDFactory xsdFactory;
- private Monitor monitor;
-
- public SDOTypesModelResolver(Contribution contribution, ExtensionPointRegistry registry) {
- super();
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.xsdFactory = modelFactories.getFactory(XSDFactory.class);
- this.monitor = createMonitor(registry);
- this.contribution = contribution;
- }
-
- private static Monitor createMonitor(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- if (utilities != null) {
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- return monitorFactory.createMonitor();
- }
- }
- return null;
- }
-
- public void addModel(Object resolved) {
- if (helperContext == null) {
- helperContext = SDOUtil.createHelperContext();
- }
- SDOTypes types = (SDOTypes)resolved;
- try {
- loadSDOTypes(types, contribution.getModelResolver());
- } catch (ContributionResolveException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- sdoTypes.add(types);
- }
-
- public Object removeModel(Object resolved) {
- SDOTypes types = (SDOTypes)resolved;
- return sdoTypes.remove(types);
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- SDOTypes types = (SDOTypes)unresolved;
- String ns = types.getNamespace();
- for (SDOTypes t : sdoTypes) {
- if (t.getNamespace().equals(types.getNamespace())) {
- try {
- loadSDOTypes(types, contribution.getModelResolver());
- } catch (ContributionResolveException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return (T)t;
- }
- }
- return (T)types;
- }
-
- private static void register(Class<?> factoryClass, HelperContext helperContext) throws Exception {
- Field field = factoryClass.getField("INSTANCE");
- Object factory = field.get(null);
- Method method = factory.getClass().getMethod("register", new Class[] {HelperContext.class});
- method.invoke(factory, new Object[] {helperContext});
- }
-
- private void defineFromFactory(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
- String factoryName = importSDO.getFactory();
- if (factoryName != null) {
- ClassReference reference = new ClassReference(factoryName);
- ClassReference resolved = resolver.resolveModel(ClassReference.class, reference);
- if (resolved != null && !resolved.isUnresolved()) {
- try {
- Class<?> factoryClass = resolved.getJavaClass();
- // Get the namespace
- Field field = factoryClass.getField("NAMESPACE_URI");
- importSDO.setNamespace((String)field.get(null));
- register(factoryClass, helperContext);
- importSDO.setUnresolved(false);
- } catch (Exception e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- error("FailToResolveClass", resolver, factoryName);
- //ContributionResolveException loaderException =
- //new ContributionResolveException("Fail to resolve class: " + factoryName);
- //throw loaderException;
- }
- }
- }
-
- private void defineFromXSD(SDOTypes importSDO, ModelResolver resolver) throws ContributionResolveException {
- String location = importSDO.getSchemaLocation();
- if (location != null) {
- try {
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(location);
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() != null) {
- String wsdlURL = artifact.getLocation();
- URLConnection connection = new URL(wsdlURL).openConnection();
- connection.setUseCaches(false);
- InputStream xsdInputStream = connection.getInputStream();
- try {
- XSDHelper xsdHelper = helperContext.getXSDHelper();
- List<Type> sdoTypes = xsdHelper.define(xsdInputStream, wsdlURL);
- for (Type t : sdoTypes) {
- importSDO.setNamespace(t.getURI());
- break;
- }
- importSDO.getTypes().addAll(sdoTypes);
- } finally {
- xsdInputStream.close();
- }
- importSDO.setUnresolved(false);
- } else {
- error("FailToResolveLocation", resolver, location);
- //ContributionResolveException loaderException = new ContributionResolveException("Fail to resolve location: " + location);
- //throw loaderException;
- }
- } catch (IOException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- String ns = importSDO.getNamespace();
- if (ns != null) {
- XSDefinition xsd = xsdFactory.createXSDefinition();
- xsd.setUnresolved(true);
- xsd.setNamespace(ns);
- xsd = resolver.resolveModel(XSDefinition.class, xsd);
- if (!xsd.isUnresolved()) {
- XSDHelper xsdHelper = helperContext.getXSDHelper();
- xsdHelper.define(xsd.getLocation().toString());
- }
- }
- }
- }
-
- private void loadSDOTypes(SDOTypes types, ModelResolver resolver) throws ContributionResolveException {
- synchronized (types) {
- if (types.isUnresolved()) {
- defineFromFactory(types, resolver);
- defineFromXSD(types, resolver);
- types.setUnresolved(false);
- }
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem =
- new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
- model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem =
- new ProblemImpl(this.getClass().getName(), "databinding-sdo-validation-messages", Severity.ERROR,
- model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java
deleted file mode 100644
index 3d703afd14..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/java/org/apache/tuscany/sca/databinding/sdo/xml/SDOTypesProcessor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo.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.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.databinding.sdo.SDOTypes;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Loader that handles &lt;import.sdo&gt; elements.
- *
- * @version $Rev: 667376 $ $Date: 2008-06-12 23:29:16 -0700 (Thu, 12 Jun 2008) $
- */
-public class SDOTypesProcessor implements StAXArtifactProcessor<SDOTypes> {
-
- public SDOTypesProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- public QName getXMLType() {
- return SDOTypes.SDO_TYPES;
- }
-
- public SDOTypes read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert SDOTypes.SDO_TYPES.equals(reader.getName());
-
- // FIXME: How do we associate the application HelperContext with the one
- // imported by the composite
- SDOTypes sdoTypes = new SDOTypes();
- String factoryName = reader.getAttributeValue(null, "factory");
- if (factoryName != null) {
- sdoTypes.setFactory(factoryName);
- }
- String location = reader.getAttributeValue(null, "location");
- if (location != null) {
- sdoTypes.setSchemaLocation(location);
- }
- String ns = reader.getAttributeValue(null, "namespace");
- sdoTypes.setNamespace(ns);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && SDOTypes.SDO_TYPES.equals(reader.getName())) {
- break;
- }
- }
- return sdoTypes;
- }
-
- public QName getArtifactType() {
- return SDOTypes.SDO_TYPES;
- }
-
- public void write(SDOTypes model, XMLStreamWriter writer) throws ContributionWriteException {
- try {
- writer.writeStartElement(SDOTypes.SDO_TYPES.getNamespaceURI(), SDOTypes.SDO_TYPES.getLocalPart());
- if (model.getNamespace() != null) {
- writer.writeAttribute("namespace", model.getNamespace());
- }
- if (model.getSchemaLocation() != null) {
- writer.writeAttribute("location", model.getSchemaLocation());
- }
- if (model.getFactory() != null) {
- writer.writeAttribute("factory", model.getFactory());
- }
- writer.writeEndElement();
- } catch (XMLStreamException e) {
- throw new ContributionWriteException(e);
- }
- }
-
- public Class<SDOTypes> getModelType() {
- return SDOTypes.class;
- }
-
- public void resolve(SDOTypes types, ModelResolver resolver) throws ContributionResolveException {
- // Defer the resolution to SDOTypesResolver which aggragates the type registrations into an instance of HelperContext
- resolver.addModel(types);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 7ff9478431..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-org.apache.tuscany.sca.databinding.sdo.ImportSDOProcessor;qname=http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0#import.sdo,model=org.apache.tuscany.sca.databinding.sdo.ImportSDO
-org.apache.tuscany.sca.databinding.sdo.xml.SDOTypesProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#sdo.types,model=org.apache.tuscany.sca.databinding.sdo.SDOTypes
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 6252de51c2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.databinding.sdo.xml.SDOTypesModelResolver;model=org.apache.tuscany.sca.databinding.sdo.SDOTypes \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index 5ae557cc74..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.sdo.SDODataBinding;name=commonj.sdo.DataObject
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index b1916fd32a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /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.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.sdo.DataObject2String;source=commonj.sdo.DataObject,target=java.lang.String,weight=510
-org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader;source=commonj.sdo.DataObject,target=javax.xml.stream.XMLStreamReader,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLDocument2String;source=commonj.sdo.helper.XMLDocument,target=java.lang.String,weight=510
-org.apache.tuscany.sca.databinding.sdo.String2DataObject;source=java.lang.String,target=commonj.sdo.DataObject,weight=500
-org.apache.tuscany.sca.databinding.sdo.XMLDocument2XMLStreamReader;source=commonj.sdo.helper.XMLDocument,target=javax.xml.stream.XMLStreamReader,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2DataObject;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.DataObject,weight=490
-org.apache.tuscany.sca.databinding.sdo.XMLStreamReader2XMLDocument;source=javax.xml.stream.XMLStreamReader,target=commonj.sdo.helper.XMLDocument,weight=490
-org.apache.tuscany.sca.databinding.sdo.DataObject2Node;source=commonj.sdo.DataObject,target=org.w3c.dom.Node,weight=500
-org.apache.tuscany.sca.databinding.sdo.Node2DataObject;source=org.w3c.dom.Node,target=commonj.sdo.DataObject,weight=500
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties b/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties
deleted file mode 100644
index f53f08f377..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/main/resources/databinding-sdo-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-FailToResolveClass = Fail to resolve class: {0}
-FailToResolveLocation = Fail to resolve location: {0}
-ContributionResolveException = ContributionResolveException occured due to:
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java
deleted file mode 100644
index 5a0208b290..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/com/example/stock/sdo/fault/InvalidSymbolFault_Exception.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.example.stock.sdo.fault;
-
-import javax.xml.namespace.QName;
-
-import com.example.stock.sdo.InvalidSymbolFault;
-
-/**
- * Hand-crafted java exception for SDO fault
- *
- * @version $Rev$ $Date$
- */
-public class InvalidSymbolFault_Exception extends Exception {
- private static final long serialVersionUID = 8602157311925253920L;
-
- /**
- * Generated QName for the fault element
- */
- public static final QName FAULT_ELEMENT = new QName("http://www.example.com/stock", "InvalidSymbolFault");
- /**
- * Java type that goes as soapenv:Fault detail element.
- */
- private InvalidSymbolFault faultInfo;
-
- /**
- * @param faultInfo
- * @param message
- */
- public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo) {
- super(message);
- this.faultInfo = faultInfo;
- }
-
- /**
- * @param faultInfo
- * @param message
- * @param cause
- */
- public InvalidSymbolFault_Exception(String message, InvalidSymbolFault faultInfo, Throwable cause) {
- super(message, cause);
- this.faultInfo = faultInfo;
- }
-
- /**
- * @return returns fault bean:
- * org.apache.tuscany.sca.test.exceptions.impl.jaxb.InvalidSymbolFault
- */
- public InvalidSymbolFault getFaultInfo() {
- return faultInfo;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java
deleted file mode 100644
index 4bc41a5541..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2NodeTestCase.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import commonj.sdo.DataObject;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2NodeTestCase extends SDOTransformerTestCaseBase {
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<Class<String>>(String.class, String.class);
- }
-
- public final void testTransform() {
- Node node = new DataObject2Node().transform(dataObject, context);
- Assert.assertNotNull(node);
- Element element = (Element) node;
- Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), element.getNamespaceURI());
- Assert.assertEquals(ORDER_QNAME.getLocalPart(), element.getLocalName());
- DataObject po = new Node2DataObject().transform(node, reversedContext);
- Assert.assertTrue(po instanceof PurchaseOrderType);
- PurchaseOrderType orderType = (PurchaseOrderType)po;
- Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java
deleted file mode 100644
index 44d11cd586..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2StringTestCase.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import commonj.sdo.DataObject;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2StringTestCase extends SDOTransformerTestCaseBase {
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<Class<String>>(String.class, String.class);
- }
-
- public final void testTransform() {
- String xml = new DataObject2String().transform(dataObject, context);
- Assert.assertTrue(xml.indexOf("<city>San Jose</city>") != -1);
- DataObject po = new String2DataObject().transform(xml, reversedContext);
- Assert.assertTrue(po instanceof PurchaseOrderType);
- PurchaseOrderType orderType = (PurchaseOrderType)po;
- Assert.assertEquals("San Jose", orderType.getBillTo().getCity());
- }
-
- public final void testXML() {
- String xml =
- "<foo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- + "xmlns:ipo=\"http://www.example.com/IPO\" xsi:type=\"ipo:USAddress\"/>";
- DataObject dataObject = new String2DataObject().transform(xml, reversedContext);
- context.setSourceDataType(new DataTypeImpl<XMLType>(DataObject.class.getName(), DataObject.class, null));
- xml = new DataObject2String().transform(dataObject, context);
- Assert.assertTrue(xml.contains("xsi:type=\"ipo:USAddress\""));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java
deleted file mode 100644
index 6a82a7fb18..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/DataObject2XMLStreamReaderTestCase.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.sdo;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.xml.Node2String;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.EqualityHelper;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataObject2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
-
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(binding, PurchaseOrderType.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
- }
-
- public final void testTransform() throws XMLStreamException {
- XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context);
- while (reader.hasNext()) {
- int event = reader.next();
- if (event == XMLStreamConstants.START_ELEMENT) {
- break;
- }
- }
- DataObject d = new XMLStreamReader2DataObject().transform(reader, reversedContext);
- assertNotNull(d);
- assertTrue(EqualityHelper.INSTANCE.equal(dataObject, d));
- }
-
- public final void testTransform1() throws XMLStreamException {
- XMLStreamReader reader = new DataObject2XMLStreamReader().transform(dataObject, context);
- XMLStreamReader2Node t2 = new XMLStreamReader2Node();
- org.w3c.dom.Node node = t2.transform(reader, context);
- assertNotNull(node);
- Node2String t3 = new Node2String();
- String xml = t3.transform(node, context);
- assertTrue(xml.contains("xmlns:xsi"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java
deleted file mode 100644
index fa765f9bf4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/ImportSDOProcessorTestCase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.sdo;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-import com.example.ipo.sdo.SdoFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ImportSDOProcessorTestCase extends TestCase {
- private static boolean inited;
-
- private ImportSDOProcessor loader;
- private XMLInputFactory xmlFactory;
-
- public void testMinimal() throws Exception {
- String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0'/>";
- XMLStreamReader reader = getReader(xml);
- assertTrue(loader.read(reader) instanceof ImportSDO);
- }
-
- public void testLocation() throws Exception {
- String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' location='ipo.xsd'/>";
- XMLStreamReader reader = getReader(xml);
- assertTrue(loader.read(reader) instanceof ImportSDO);
- }
-
- public void testFactory() throws Exception {
- String xml = "<import.sdo xmlns='http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0' " + "factory='"
- + MockFactory.class.getName()
- + "'/>";
- XMLStreamReader reader = getReader(xml);
- assertFalse(inited);
- ImportSDO importSDO = loader.read(reader);
- assertNotNull(importSDO);
- ModelResolver resolver = new TestModelResolver();
- resolver.addModel(new ClassReference(MockFactory.class));
- loader.resolve(importSDO, resolver);
- assertTrue(inited);
- }
-
- @Override
- protected void setUp() throws Exception {
- loader = new ImportSDOProcessor(new DefaultModelFactoryExtensionPoint(), null);
- xmlFactory = XMLInputFactory.newInstance();
- }
-
- protected XMLStreamReader getReader(String xml) throws XMLStreamException {
- XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(xml));
- reader.next();
- return reader;
- }
-
- public static class MockFactory {
- public static final Object INSTANCE = SdoFactory.INSTANCE;
-
- static {
- ImportSDOProcessorTestCase.inited = true;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelperTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelperTestCase.java
deleted file mode 100644
index e0d1c9bf12..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOContextHelperTestCase.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.databinding.sdo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sdo.api.SDOUtil;
-import org.junit.Test;
-
-import commonj.sdo.Type;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.TypeHelper;
-import commonj.sdo.helper.XSDHelper;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SDOContextHelperTestCase {
- @Test
- public void testGenerateSchema() throws IOException {
- HelperContext context = SDOUtil.createHelperContext();
- URL url = getClass().getResource("/ipo.xsd");
- Assert.assertNotNull(url);
- InputStream is = url.openStream();
- XSDHelper xsdHelper = context.getXSDHelper();
- xsdHelper.define(is, url.toExternalForm());
- TypeHelper typeHelper = context.getTypeHelper();
- Type type = typeHelper.getType("http://www.example.com/IPO", "PurchaseOrderType");
- Assert.assertNotNull(type);
- /*
- SDOContextHelper.generateSchema(context, Arrays.asList(type));
- */
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.java
deleted file mode 100644
index 3c21b56c9f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDODataBindingTestCase.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.databinding.sdo;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import com.example.ipo.sdo.SdoFactory;
-import com.example.ipo.sdo.USAddress;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.impl.HelperProvider;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SDODataBindingTestCase extends TestCase {
- protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
- private SDODataBinding binding;
- private HelperContext context;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- binding = new SDODataBinding();
- context = HelperProvider.getDefaultContext();
- SdoFactory.INSTANCE.register(context);
- }
-
- public final void testIntrospect() {
- Operation op = null;
- DataType dataType = new DataTypeImpl<Class>(DataObject.class, null);
- boolean yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertTrue(dataType.getDataBinding().equals(binding.getName()));
- assertTrue(dataType.getPhysical() == DataObject.class && dataType.getLogical() == XMLType.UNKNOWN);
- dataType = new DataTypeImpl<Class>(PurchaseOrderType.class, null);
- yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertEquals(PurchaseOrderType.class, dataType.getPhysical());
- assertEquals(new QName("http://www.example.com/IPO", "PurchaseOrderType"), ((XMLType)dataType.getLogical())
- .getTypeName());
- dataType = new DataTypeImpl<Class>(USAddress.class, null);
- yes = binding.introspect(dataType, op);
- assertTrue(yes);
- assertEquals(USAddress.class, dataType.getPhysical());
- assertEquals(new QName("http://www.example.com/IPO", "USAddress"), ((XMLType)dataType.getLogical())
- .getTypeName());
- }
-
- public final void testCopyRoot() {
- PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
- po.setComment("Comment");
- Object copy = binding.copy(po, null, null);
- assertTrue(copy instanceof PurchaseOrderType);
- assertTrue(po != copy);
- assertTrue(context.getEqualityHelper().equal((DataObject)po, (DataObject)copy));
- assertEquals("Comment", ((PurchaseOrderType)copy).getComment());
- }
-
- public final void testCopyNonRoot() {
- USAddress address = SdoFactory.INSTANCE.createUSAddress();
- address.setCity("San Jose");
- Object copy = binding.copy(address, null, null);
- assertTrue(copy instanceof USAddress);
- assertTrue(address != copy);
- assertTrue(context.getEqualityHelper().equal((DataObject)address, (DataObject)copy));
- assertEquals("San Jose", ((USAddress)copy).getCity());
- }
-
- public final void testCopyXMLDocument() {
- PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
- po.setComment("Comment");
- XMLDocument doc =
- context.getXMLHelper().createDocument((DataObject)po,
- ORDER_QNAME.getNamespaceURI(),
- ORDER_QNAME.getLocalPart());
- Object copy = binding.copy(doc, null, null);
- assertTrue(copy instanceof XMLDocument);
- XMLDocument docCopy = (XMLDocument)copy;
- assertTrue(doc != copy);
- assertTrue(context.getEqualityHelper().equal((DataObject)po, docCopy.getRootObject()));
- assertEquals("Comment", ((PurchaseOrderType)docCopy.getRootObject()).getComment());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.java
deleted file mode 100644
index 2aaae3c6d8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOTransformerTestCaseBase.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.databinding.sdo;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.TransformationContextImpl;
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import com.example.ipo.sdo.SdoFactory;
-import com.example.ipo.sdo.USAddress;
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.impl.HelperProvider;
-
-/**
- * The base class for SDO-related test cases
- *
- * @version $Rev$ $Date$
- */
-public abstract class SDOTransformerTestCaseBase extends TestCase {
- protected static final QName ORDER_QNAME = new QName("http://www.example.com/IPO", "purchaseOrder");
-
- protected HelperContext helperContext;
- protected String binding = DataObject.class.getName();
- protected TransformationContext context;
- protected TransformationContext reversedContext;
- protected DataObject dataObject;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- helperContext = HelperProvider.getDefaultContext();
- SdoFactory.INSTANCE.register(helperContext);
-
- context = new TransformationContextImpl();
- context.setSourceDataType(getSourceDataType());
- context.setTargetDataType(getTargetDataType());
-
- reversedContext = new TransformationContextImpl();
- reversedContext.setSourceDataType(getTargetDataType());
- reversedContext.setTargetDataType(getSourceDataType());
-
- PurchaseOrderType po = SdoFactory.INSTANCE.createPurchaseOrderType();
- USAddress address = SdoFactory.INSTANCE.createUSAddress();
- address.setCity("San Jose");
- address.setStreet("123 ABC St");
- address.setState("CA");
- address.setStreet("95131");
- po.setBillTo(address);
- dataObject = (DataObject) po;
- }
-
- protected abstract DataType<?> getSourceDataType();
-
- protected abstract DataType<?> getTargetDataType();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.java
deleted file mode 100644
index 805a1ab5ce..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/SDOWrapperHandlerTestCase.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.databinding.sdo;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sdo.api.SDOUtil;
-
-import commonj.sdo.DataObject;
-import commonj.sdo.helper.HelperContext;
-import commonj.sdo.helper.XMLDocument;
-import commonj.sdo.helper.XMLHelper;
-import commonj.sdo.helper.XSDHelper;
-import commonj.sdo.impl.HelperProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SDOWrapperHandlerTestCase extends TestCase {
- private HelperContext context;
- private SDOWrapperHandler handler;
-
- @Override
- public void setUp() throws Exception {
- context = SDOUtil.createHelperContext();
- handler = new SDOWrapperHandler();
- }
-
- public void testWrapperAnyType() throws Exception {
- XMLHelper xmlHelper = context.getXMLHelper();
- XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
- Operation op = new OperationImpl();
- List children = handler.getChildren(document, op, true);
- assertEquals(5, children.size());
- }
-
- public void testWrapper() throws Exception {
- XSDHelper xsdHelper = context.getXSDHelper();
- xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
- XMLHelper xmlHelper = context.getXMLHelper();
- XMLDocument document = xmlHelper.load(getClass().getResourceAsStream("/wrapper.xml"));
- Operation op = new OperationImpl();
- List children = handler.getChildren(document, op, true);
- assertEquals(5, children.size());
- }
-
- public void testCreate() {
- HelperContext context = HelperProvider.getDefaultContext();
- XSDHelper xsdHelper = context.getXSDHelper();
- xsdHelper.define(getClass().getResourceAsStream("/wrapper.xsd"), null);
- ElementInfo element = new ElementInfo(new QName("http://www.example.com/wrapper", "op"), null);
- Operation op = new OperationImpl();
- WrapperInfo wrapperInfo = new WrapperInfo(SDODataBinding.NAME, element, null);
- op.setInputWrapper(wrapperInfo);
- DataObject wrapper = (DataObject) handler.create(op, true);
- assertNotNull(wrapper);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/TestModelResolver.java
deleted file mode 100644
index ce04f5be3f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/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.databinding.sdo;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * A default implementation of an artifact resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- public TestModelResolver() {
- }
-
- 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-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.java
deleted file mode 100644
index 114c568c38..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/java/org/apache/tuscany/sca/databinding/sdo/XMLDocument2XMLStreamReaderTestCase.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.databinding.sdo;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-import com.example.ipo.sdo.PurchaseOrderType;
-import commonj.sdo.helper.XMLDocument;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XMLDocument2XMLStreamReaderTestCase extends SDOTransformerTestCaseBase {
-
- @Override
- protected DataType<?> getSourceDataType() {
- return new DataTypeImpl<XMLType>(XMLDocument.class.getName(), XMLDocument.class, new XMLType(ORDER_QNAME, null));
- }
-
- @Override
- protected DataType<?> getTargetDataType() {
- return new DataTypeImpl<Class<XMLStreamReader>>(XMLStreamReader.class, XMLStreamReader.class);
- }
-
- public final void testTransform() throws XMLStreamException {
- XMLDocument document =
- helperContext.getXMLHelper().createDocument(dataObject,
- ORDER_QNAME.getNamespaceURI(),
- ORDER_QNAME.getLocalPart());
- XMLStreamReader reader = new XMLDocument2XMLStreamReader().transform(document, context);
- XMLDocument document2 = new XMLStreamReader2XMLDocument().transform(reader, reversedContext);
- Assert.assertEquals(ORDER_QNAME.getNamespaceURI(), document2.getRootElementURI());
- Assert.assertEquals(ORDER_QNAME.getLocalPart(), document2.getRootElementName());
- Assert.assertTrue(document2.getRootObject() instanceof PurchaseOrderType);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/ipo.xsd
deleted file mode 100755
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/stock.xsd b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/stock.xsd
deleted file mode 100644
index a0a6717371..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/stock.xsd
+++ /dev/null
@@ -1,33 +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.
--->
-<schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema">
- <!-- Faults -->
- <element name="InvalidSymbolFault">
- <complexType>
- <sequence>
- <element name="message" minOccurs="1" type="string" />
- <element name="symbol" minOccurs="1" type="string" />
- </sequence>
- </complexType>
- </element>
-
- <element name="MarketClosedFault" type="string" />
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xml b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xml
deleted file mode 100644
index 2526629409..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xml
+++ /dev/null
@@ -1,27 +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.
--->
-<p:op xmlns:p="http://www.example.com/wrapper" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.example.com/wrapper wrapper.xsd ">
- <message>message</message>
- <symbol>symbol</symbol>
- <message>message1</message>
- <symbol>symbol1</symbol>
- <symbol>symbol2</symbol>
-</p:op>
diff --git a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xsd b/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xsd
deleted file mode 100644
index ea4dc5f7f3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-sdo/src/test/resources/wrapper.xsd
+++ /dev/null
@@ -1,38 +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.
--->
-<schema targetNamespace="http://www.example.com/wrapper" xmlns="http://www.w3.org/2001/XMLSchema">
- <!-- Faults -->
- <element name="op">
- <complexType>
- <sequence maxOccurs="unbounded">
- <element name="message" minOccurs="1" type="string" />
- <element name="symbol" minOccurs="1" maxOccurs="3" type="string" />
- </sequence>
- </complexType>
- </element>
-
- <element name="opResponse">
- <complexType>
- <sequence maxOccurs="1">
- <element name="price" minOccurs="1" maxOccurs="unbounded" type="string" />
- </sequence>
- </complexType>
- </element>
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/LICENSE b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/LICENSE
deleted file mode 100755
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/databinding-xmlbeans/NOTICE b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/pom.xml b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/pom.xml
deleted file mode 100644
index 71effc9097..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/pom.xml
+++ /dev/null
@@ -1,125 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding-xmlbeans</artifactId>
- <name>Apache Tuscany SCA Data Binding for XmlBeans</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.3.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/xmlbeans-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-trax</artifactId>
- <version>1.6.5</version>
- </dependency>
- </dependencies>
-
- <executions>
- <execution>
- <id>generate-xmlbeans</id>
- <phase>generate-sources</phase>
- <configuration>
- <tasks>
- <taskdef name="xmlbean" classname="org.apache.xmlbeans.impl.tool.XMLBean"
- classpathref="maven.compile.classpath" />
- <xmlbean schema="${basedir}/src/test/resources" classpathref="maven.compile.classpath"
- destfile="${project.build.directory}/ipo-xmlbeans.jar"
- srcgendir="${project.build.directory}/xmlbeans-source" javasource="1.5"
- classgendir="${project.build.directory}/test-classes" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding.xmlbeans</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding.xmlbeans*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.java
deleted file mode 100644
index e7b240b781..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/Node2XmlObject.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.databinding.xmlbeans;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.w3c.dom.Node;
-
-/**
- * Transforms a DOM Node to an XML Object.
- *
- * @version $Rev$ $Date$
- */
-public class Node2XmlObject extends BaseTransformer<Node, XmlObject> implements
- PullTransformer<Node, XmlObject> {
- // private XmlOptions options;
-
- public XmlObject transform(Node source, TransformationContext context) {
- try {
- return XmlObject.Factory.parse(source);
- } catch (XmlException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XmlObject> getTargetType() {
- return XmlObject.class;
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.java
deleted file mode 100644
index 15616979c2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansDataBinding.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.databinding.xmlbeans;
-
-import java.lang.reflect.Field;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.xmlbeans.SchemaType;
-import org.apache.xmlbeans.XmlObject;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * XMLBeans DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class XMLBeansDataBinding extends BaseDataBinding {
- public static final String NAME = XmlObject.class.getName();
- public static final String[] ALIASES = {"xmlbeans"};
-
- public XMLBeansDataBinding() {
- super(NAME, XmlObject.class);
- }
-
- @Override
- public WrapperHandler getWrapperHandler() {
- return new XMLBeansWrapperHandler();
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (XmlObject.class.isAssignableFrom(type.getPhysical())) {
- Class<?> cls = type.getPhysical();
- SchemaType schemaType = null;
- try {
- Field f = cls.getField("type");
- schemaType = (SchemaType)f.get(null);
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- QName typeName = schemaType.getName();
- Object logical = type.getLogical();
- QName elementName = null;
- if (logical instanceof XMLType) {
- elementName = ((XMLType)logical).getElementName();
- }
- type.setLogical(new XMLType(elementName, typeName));
- type.setMetaData(SchemaType.class, schemaType);
- return true;
- }
- return false;
- }
-
- @Override
- public Object copy(Object object, DataType dataType, Operation operation) {
- return ((XmlObject)object).copy();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansWrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansWrapperHandler.java
deleted file mode 100644
index ccf48174e6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLBeansWrapperHandler.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xmlbeans;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.xmlbeans.SchemaProperty;
-import org.apache.xmlbeans.SimpleValue;
-import org.apache.xmlbeans.XmlObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLBeansWrapperHandler implements WrapperHandler<XmlObject> {
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#create(org.apache.tuscany.sca.interfacedef.Operation, boolean)
- */
- public XmlObject create(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getChildren(java.lang.Object, org.apache.tuscany.sca.interfacedef.Operation, boolean)
- */
- public List getChildren(XmlObject wrapper, Operation operation, boolean input) {
- List<Object> children = new ArrayList<Object>();
-
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- for (ElementInfo e : childElements) {
- XmlObject[] objects = wrapper.selectChildren(e.getQName());
- if (objects != null && objects.length == 1) {
- if (objects[0] instanceof SimpleValue) {
- children.add(((SimpleValue)objects[0]).getObjectValue());
- } else {
- children.add(objects[0]);
- }
- }
- // FIXME: What should we do for many-value?
- }
- return children;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(org.apache.tuscany.sca.interfacedef.Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#isInstance(java.lang.Object, org.apache.tuscany.sca.interfacedef.Operation, boolean)
- */
- public boolean isInstance(Object wrapper, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() :
- outputWrapperInfo.getWrapperElement();
-
- return true;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#setChildren(java.lang.Object, java.lang.Object[], org.apache.tuscany.sca.interfacedef.Operation, boolean)
- */
- public void setChildren(XmlObject wrapper, Object[] childObjects, Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- int i = 0;
- for (ElementInfo c : childElements) {
- SchemaProperty property = wrapper.schemaType().getElementProperty(c.getQName());
-
- String prop = property.getJavaPropertyName();
-
- Method setter;
- try {
- setter = wrapper.schemaType().getJavaClass().getMethod("set" + prop, property.getType().getJavaClass());
- setter.invoke(wrapper, childObjects[i++]);
- } catch (Throwable e) {
- throw new IllegalArgumentException(e);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.java
deleted file mode 100644
index ca84f961b1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XMLStreamReader2XmlObject.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.databinding.xmlbeans;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.xmlbeans.XmlObject;
-
-/**
- * Transforms an XMLStreamReader to an XML Object.
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2XmlObject extends BaseTransformer<XMLStreamReader, XmlObject> implements PullTransformer<XMLStreamReader, XmlObject> {
- // private XmlOptions options;
-
- public XmlObject transform(XMLStreamReader source, TransformationContext context) {
- try {
- XmlObject target = XmlObject.Factory.parse(source);
- source.close();
- return target;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XmlObject> getTargetType() {
- return XmlObject.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java
deleted file mode 100644
index c820d9d250..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2Node.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xmlbeans;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.Transformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.xmlbeans.XmlObject;
-import org.osoa.sca.annotations.Service;
-import org.w3c.dom.Node;
-
-/**
- * Transforms an XML Object to a DOM Node.
- *
- * @version $Rev$ $Date$
- */
-@Service(Transformer.class)
-public class XmlObject2Node extends BaseTransformer<XmlObject, Node> implements
- PullTransformer<XmlObject, Node> {
- // private XmlOptions options;
-
- public Node transform(XmlObject source, TransformationContext context) {
- if (source == null)
- return null;
- return source.newDomNode();
- }
-
- @Override
- protected Class<XmlObject> getSourceType() {
- return XmlObject.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.java
deleted file mode 100644
index bbffb7d748..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObject2XMLStreamReader.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.databinding.xmlbeans;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.xmlbeans.XmlObject;
-
-/**
- * Transforms an XML Object to an XMLStreamReader.
- *
- * @version $Rev$ $Date$
- */
-public class XmlObject2XMLStreamReader extends BaseTransformer<XmlObject, XMLStreamReader> implements PullTransformer<XmlObject, XMLStreamReader> {
- // private XmlOptions options;
-
- public XMLStreamReader transform(XmlObject source, TransformationContext context) {
- return source.newXMLStreamReader();
- }
-
- @Override
- protected Class<XmlObject> getSourceType() {
- return XmlObject.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 10;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index ac76c6ca9b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.xmlbeans.XMLBeansDataBinding;name=org.apache.xmlbeans.XmlObject
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index 4e419de051..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.xmlbeans.Node2XmlObject;source=org.w3c.dom.Node,target=org.apache.xmlbeans.XmlObject,weight=500
-org.apache.tuscany.sca.databinding.xmlbeans.XmlObject2Node;source=org.apache.xmlbeans.XmlObject,target=org.w3c.dom.Node,weight=500
-org.apache.tuscany.sca.databinding.xmlbeans.XmlObject2XMLStreamReader;source=org.apache.xmlbeans.XmlObject,target=javax.xml.stream.XMLStreamReader,weight=490
-org.apache.tuscany.sca.databinding.xmlbeans.XMLStreamReader2XmlObject;source=javax.xml.stream.XMLStreamReader,target=org.apache.xmlbeans.XmlObject,weight=490
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.java
deleted file mode 100644
index 7b98ddb021..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/java/org/apache/tuscany/sca/databinding/xmlbeans/XmlObjectTestCase.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.databinding.xmlbeans;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.xmlbeans.XmlObject;
-import org.w3c.dom.Node;
-
-import com.example.ipo.xmlbeans.PurchaseOrderDocument;
-
-/**
- * Test cases for testing XML Object transformations.
- *
- * @version $Rev$ $Date$
- */
-public class XmlObjectTestCase extends TestCase {
- private static final String IPO_XML = "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\"" + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">" + " <name>Helen Zoe</name>" + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>" + " <postcode>CB1 1JR</postcode>" + " </shipTo>" + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>" + " <street>8 Oak Avenue</street>" + " <city>Old Town</city>" + " <state>PA</state>"
- + " <zip>95819</zip>" + " </billTo>" + " <items>" + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>" + " <quantity>1</quantity>" + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>" + " <shipDate>1999-12-05</shipDate>" + " </item>" + " </items>"
- + "</ipo:purchaseOrder>";
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testXmlObject() throws Exception {
- // URL/Stream/Reader to XmlObject
- XmlObject object = XmlObject.Factory.parse(new StringReader(IPO_XML));
-
- // XmlObject to XMLStreamReader
- XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
- XMLStreamReader reader = t1.transform(object, null);
-
- // XMLStreamReader to XmlObject
- XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
- XmlObject object2 = t2.transform(reader, null);
-
- // XmlObject to Node
- XmlObject2Node t3 = new XmlObject2Node();
- Node node = t3.transform(object2, null);
-
- // Node to XmlObject
- Node2XmlObject t4 = new Node2XmlObject();
- XmlObject object3 = t4.transform(node, null);
- Assert.assertNotNull(object3);
- }
-
- public void testGeneratedXmlObject() throws Exception {
- // URL xmlFile = getClass().getClassLoader().getResource("ipo.xml");
- // URL/Stream/Reader to XmlObject
- PurchaseOrderDocument object = PurchaseOrderDocument.Factory.parse(new StringReader(IPO_XML));
-
- // XmlObject to XMLStreamReader
- XmlObject2XMLStreamReader t1 = new XmlObject2XMLStreamReader();
- XMLStreamReader reader = t1.transform(object, null);
-
- // XMLStreamReader to XmlObject
- XMLStreamReader2XmlObject t2 = new XMLStreamReader2XmlObject();
- PurchaseOrderDocument object2 = (PurchaseOrderDocument) t2.transform(reader, null);
-
- // XmlObject to Node
- XmlObject2Node t3 = new XmlObject2Node();
- Node node = t3.transform(object2, null);
-
- // Node to XmlObject
- Node2XmlObject t4 = new Node2XmlObject();
- PurchaseOrderDocument object3 = (PurchaseOrderDocument) t4.transform(node, null);
- Assert.assertNotNull(object3);
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsd
deleted file mode 100755
index 5a493e1746..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig b/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
deleted file mode 100755
index a397182672..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding-xmlbeans/src/test/resources/ipo.xsdconfig
+++ /dev/null
@@ -1,21 +0,0 @@
-<!-- Copyright 2004 The Apache Software Foundation
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License. -->
-<xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"
- xmlns:ipo="http://www.example.com/IPO">
-
- <xb:namespace uri="http://www.example.com/IPO">
- <xb:package>com.example.ipo.xmlbeans</xb:package>
- </xb:namespace>
-
-</xb:config>
diff --git a/branches/sca-java-1.5.1/modules/databinding/LICENSE b/branches/sca-java-1.5.1/modules/databinding/LICENSE
deleted file mode 100644
index 616bec99ed..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/LICENSE
+++ /dev/null
@@ -1,244 +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.
-
------------------------------------------------------------------
-The test cases use xmlunit with the following license:
------------------------------------------------------------------
-
-/*
-******************************************************************
-Copyright (c) 2001-2007, Jeff Martin, Tim Bacon
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above
- copyright notice, this list of conditions and the following
- disclaimer in the documentation and/or other materials provided
- with the distribution.
- * Neither the name of the xmlunit.sourceforge.net nor the names
- of its contributors may be used to endorse or promote products
- derived from this software without specific prior written
- permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-******************************************************************
-*/
-
-
diff --git a/branches/sca-java-1.5.1/modules/databinding/NOTICE b/branches/sca-java-1.5.1/modules/databinding/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/databinding/pom.xml b/branches/sca-java-1.5.1/modules/databinding/pom.xml
deleted file mode 100644
index b51944202c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/pom.xml
+++ /dev/null
@@ -1,108 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-databinding</artifactId>
- <name>Apache Tuscany SCA DataBinding Framework</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- <version>1.0-2</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.databinding</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.databinding*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.java
deleted file mode 100644
index 7c4ed35eb3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBinding.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.databinding;
-
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * DataBinding represents a data representation, for example, SDO, JAXB and AXIOM
- *
- * @version $Rev$ $Date$
- */
-public interface DataBinding {
- /**
- * A special databinding for input message of an operation
- */
- String IDL_INPUT = "idl:input";
- /**
- * A special databinding for output message of an operation
- */
- String IDL_OUTPUT = "idl:output";
- /**
- * A special databinding for fault message of an operation
- */
- String IDL_FAULT = "idl:fault";
- /**
- * The name of a databinding should be case-insensitive and unique
- *
- * @return The name of the databinding
- */
- String getName();
-
- /**
- * Introspect and populate information to a DataType model
- *
- * @param dataType The data type to be introspected
- * @param operation The operation
- * @return true if the databinding has recognized the given data type
- */
- boolean introspect(DataType dataType, Operation operation);
-
- /**
- * Introspect the data to figure out the corresponding data type
- *
- * @param value The object to be checked
- * @param operation The operation
- * @return The DataType or null if the java type is not supported by this databinding
- */
- DataType introspect(Object value, Operation operation);
-
- /**
- * Provide a WrapperHandler for this databinding
- * @return A wrapper handler which can handle wrapping/wrapping for this databinding
- */
- WrapperHandler getWrapperHandler();
-
- /**
- * Make a copy of the object for "pass-by-value" semantics.
- *
- * @param object source object to copy
- * @param dataType The data type
- * @param operation The operation
- * @return copy of the object passed in as argument
- */
- Object copy(Object object, DataType dataType, Operation operation);
-
- /**
- * Get the XML type helper for Java types
- * @return The databinding-specific XML type helper class
- */
- XMLTypeHelper getXMLTypeHelper();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.java
deleted file mode 100644
index 2ff5d866b4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataBindingExtensionPoint.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.databinding;
-
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * An extension point for data binding extensions.
- *
- * @version $Rev$ $Date$
- */
-public interface DataBindingExtensionPoint {
-
- /**
- * Register a data binding
- *
- * @param dataBinding
- */
- void addDataBinding(DataBinding dataBinding);
-
- /**
- * Look up a data binding by id
- *
- * @param id The name of the databinding
- * @return The databinding
- */
- DataBinding getDataBinding(String id);
-
- /**
- * Unregister a data binding
- *
- * @param id
- * @return The unregistered databinding
- */
- DataBinding removeDataBinding(String id);
-
- /**
- * Introspect the java class to figure out what DataType supports it.
- *
- * @param dataType The initial data type
- * @param operation TODO
- * @return A DataType representing the java type or null if no databinding
- * recognizes the java type
- */
- boolean introspectType(DataType dataType, Operation operation);
-
- /**
- * Introspect the value to figure out the corresponding DataType
- *
- * @param value The object value
- * @param operation TODO
- * @return A DataType representing the value or null if no databinding
- * recognizes the value
- */
- DataType introspectType(Object value, Operation operation);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.java
deleted file mode 100644
index 505a810276..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipe.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.databinding;
-
-/**
- * Data pipe allows a data source pushes data into its sink and pipe the data into its result
- *
- * @param <S> The data binding type of the sink
- * @param <R> The data binding type of the result
- *
- * @version $Rev$ $Date$
- */
-public interface DataPipe<S, R> {
-
- /**
- * Returns a sink (for example, java.io.OutputStream, java.io.Writer or org.xml.sax.ContentHandler) to receive data
- * pushed by the source
- *
- * @return The sink to consume data
- */
- S getSink();
-
- /**
- * Returns the data populated by the sink
- *
- * @return
- */
- R getResult();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.java
deleted file mode 100644
index 1aac6d48be..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DataPipeTransformer.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.databinding;
-
-/**
- * Data pipe allows a data source pushes data into its sink and pipe the data into its result
- *
- * @version $Rev$ $Date$
- */
-public interface DataPipeTransformer<S, R> extends Transformer {
-
- DataPipe<S, R> newInstance();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
deleted file mode 100644
index b12d727ba9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultDataBindingExtensionPoint.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * The default implementation of a data binding extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultDataBindingExtensionPoint implements DataBindingExtensionPoint {
- private ExtensionPointRegistry registry;
- private final Map<String, DataBinding> bindings = new HashMap<String, DataBinding>();
- private final List<DataBinding> databindings = new ArrayList<DataBinding>();
- private static final Logger logger = Logger.getLogger(DefaultDataBindingExtensionPoint.class.getName());
- private boolean loadedDataBindings;
-
- public DefaultDataBindingExtensionPoint() {
- }
-
- public DefaultDataBindingExtensionPoint(ExtensionPointRegistry registry) {
- this.registry = registry;
- }
-
- public DataBinding getDataBinding(String id) {
- if (id == null) {
- return null;
- }
- DataBinding dataBinding = bindings.get(id.toLowerCase());
- if (dataBinding == null) {
- loadDataBindings();
- dataBinding = bindings.get(id.toLowerCase());
- }
- return dataBinding;
- }
-
- public void addDataBinding(DataBinding dataBinding) {
- if (logger.isLoggable(Level.FINE)) {
- String className = dataBinding.getClass().getName();
- boolean lazy = false;
- if (dataBinding instanceof LazyDataBinding) {
- className = ((LazyDataBinding)dataBinding).dataBindingDeclaration.getClassName();
- lazy = true;
- }
- logger.fine("Adding databinding: " + className + ";name=" + dataBinding.getName() + ",lazy=" + lazy);
- }
- databindings.add(dataBinding);
- bindings.put(dataBinding.getName().toLowerCase(), dataBinding);
-
- }
-
- public DataBinding removeDataBinding(String id) {
- if (id == null) {
- return null;
- }
- DataBinding dataBinding = bindings.remove(id.toLowerCase());
- if (dataBinding != null) {
- databindings.remove(dataBinding);
- }
- return dataBinding;
- }
-
- /**
- * Dynamically load data bindings declared under META-INF/services
- */
- private synchronized void loadDataBindings() {
- if (loadedDataBindings)
- return;
-
- // Get the databinding service declarations
- Set<ServiceDeclaration> dataBindingDeclarations;
- try {
- dataBindingDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(DataBinding.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load data bindings
- for (ServiceDeclaration dataBindingDeclaration : dataBindingDeclarations) {
- Map<String, String> attributes = dataBindingDeclaration.getAttributes();
- String name = attributes.get("name");
-
- // Create a data binding wrapper and register it
- DataBinding dataBinding = new LazyDataBinding(name, dataBindingDeclaration);
- addDataBinding(dataBinding);
- }
-
- loadedDataBindings = true;
- }
-
- /**
- * A data binding facade allowing data bindings to be lazily loaded and
- * initialized.
- */
- private class LazyDataBinding implements DataBinding {
-
- private String name;
- private ServiceDeclaration dataBindingDeclaration;
- private DataBinding dataBinding;
-
- private LazyDataBinding(String type, ServiceDeclaration dataBindingDeclaration) {
- this.name = type;
- this.dataBindingDeclaration = dataBindingDeclaration;
- }
-
- /**
- * Load and instantiate the data binding class.
- *
- * @return The data binding.
- */
- @SuppressWarnings("unchecked")
- private DataBinding getDataBinding() {
- if (dataBinding == null) {
- try {
- Class<DataBinding> dataBindingClass = (Class<DataBinding>)dataBindingDeclaration.loadClass();
- try {
- Constructor<DataBinding> constructor = dataBindingClass.getConstructor();
- dataBinding = constructor.newInstance();
- } catch (NoSuchMethodException e) {
- Constructor<DataBinding> constructor =
- dataBindingClass.getConstructor(ExtensionPointRegistry.class);
- dataBinding = constructor.newInstance(DefaultDataBindingExtensionPoint.this.registry);
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return dataBinding;
- }
-
- public Object copy(Object object, DataType dataType, Operation operation) {
- return getDataBinding().copy(object, dataType, operation);
- }
-
- public String getName() {
- return name;
- }
-
- public XMLTypeHelper getXMLTypeHelper() {
- return getDataBinding().getXMLTypeHelper();
- }
-
- public WrapperHandler getWrapperHandler() {
- return getDataBinding().getWrapperHandler();
- }
-
- public boolean introspect(DataType dataType, Operation operation) {
- return getDataBinding().introspect(dataType, operation);
- }
-
- public DataType introspect(Object value, Operation operation) {
- return getDataBinding().introspect(value, operation);
- }
- }
-
- //FIXME The following methods should not be on the extension point
- // they should be on a separate class
- public boolean introspectType(DataType dataType, Operation operation) {
- loadDataBindings();
- for (DataBinding binding : databindings) {
- // don't introspect for JavaBeansDatabinding as all javatypes will
- // anyways match to its basetype
- // which is java.lang.Object. Default to this only if no databinding
- // results
- if (!binding.getName().equals(JavaBeansDataBinding.NAME)) {
- if (binding.introspect(dataType, operation)) {
- return true;
- }
- }
- }
- // FIXME: Should we honor the databinding from operation/interface
- // level?
- Class physical = dataType.getPhysical();
- if (physical == Object.class) {
- dataType.setDataBinding(JavaBeansDataBinding.NAME);
- return false;
- }
- if (dataType.getPhysical().isArray()) {
- introspectArray(dataType, operation);
- return true;
- } else if (Throwable.class.isAssignableFrom(physical)) {
- dataType.setDataBinding(JavaExceptionDataBinding.NAME);
- return true;
- } else {
- dataType.setDataBinding(JavaBeansDataBinding.NAME);
- return false;
- }
- }
-
- private boolean introspectArray(DataType dataType, Operation operation) {
- Class physical = dataType.getPhysical();
- if (!physical.isArray() || physical == byte[].class) {
- return false;
- }
- Class componentType = physical.getComponentType();
- DataType logical = new DataTypeImpl(componentType, dataType.getLogical());
- introspectType(logical, operation);
- dataType.setDataBinding("java:array");
- dataType.setLogical(logical);
- return true;
- }
-
- public DataType introspectType(Object value, Operation operation) {
- loadDataBindings();
- DataType dataType = null;
- for (DataBinding binding : databindings) {
- // don't introspect for JavaBeansDatabinding as all javatypes will
- // anyways match to its basetype
- // which is java.lang.Object. Default to this only if no databinding
- // results
- if (!binding.getName().equals(JavaBeansDataBinding.NAME)) {
- dataType = binding.introspect(value, operation);
- }
- if (dataType != null) {
- return dataType;
- }
- }
- return new DataTypeImpl<XMLType>(JavaBeansDataBinding.NAME, value.getClass(), XMLType.UNKNOWN);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
deleted file mode 100644
index e99dc2e029..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/DefaultTransformerExtensionPoint.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.databinding.impl.DirectedGraph;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DefaultTransformerExtensionPoint implements TransformerExtensionPoint {
- private static final Logger logger = Logger.getLogger(DefaultTransformerExtensionPoint.class.getName());
- private boolean loadedTransformers;
-
- private final DirectedGraph<Object, Transformer> graph = new DirectedGraph<Object, Transformer>();
-
- public DefaultTransformerExtensionPoint() {
- }
-
- public void addTransformer(String sourceType, String resultType, int weight, Transformer transformer, boolean publicTransformer) {
- if (logger.isLoggable(Level.FINE)) {
- String className = transformer.getClass().getName();
- boolean lazy = false;
- boolean pull = (transformer instanceof PullTransformer);
- if (transformer instanceof LazyPullTransformer) {
- className = ((LazyPullTransformer)transformer).transformerDeclaration.getClassName();
- lazy = true;
- }
- if (transformer instanceof LazyPushTransformer) {
- className = ((LazyPushTransformer)transformer).transformerDeclaration.getClassName();
- lazy = true;
- }
-
- logger.fine("Adding transformer: " + className
- + ";source="
- + sourceType
- + ",target="
- + resultType
- + ",weight="
- + weight
- + ",type="
- + (pull ? "pull" : "push")
- + ",lazy="
- + lazy);
- }
- graph.addEdge(sourceType, resultType, transformer, weight, publicTransformer);
- }
-
- public void addTransformer(Transformer transformer, boolean publicTransformer) {
- addTransformer(transformer.getSourceDataBinding(),
- transformer.getTargetDataBinding(),
- transformer.getWeight(),
- transformer, publicTransformer);
- }
-
- public boolean removeTransformer(String sourceType, String resultType) {
- return graph.removeEdge(sourceType, resultType);
- }
-
- public Transformer getTransformer(String sourceType, String resultType) {
- loadTransformers();
-
- DirectedGraph<Object, Transformer>.Edge edge = graph.getEdge(sourceType, resultType);
- return (edge == null) ? null : edge.getValue();
- }
-
- /**
- * Dynamically load transformers registered under META-INF/services.
- *
- */
- private synchronized void loadTransformers() {
- if (loadedTransformers) {
- return;
- }
- loadedTransformers = true;
- loadTransformers(PullTransformer.class);
- loadTransformers(PushTransformer.class);
-
- }
-
- /**
- * Dynamically load transformers registered under META-INF/services.
- *
- * @param transformerClass
- */
- private synchronized void loadTransformers(Class<?> transformerClass) {
-
- // Get the transformer service declarations
- Set<ServiceDeclaration> transformerDeclarations;
-
- try {
- transformerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(transformerClass);
-
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load transformers
- for (ServiceDeclaration transformerDeclaration : transformerDeclarations) {
- Map<String, String> attributes = transformerDeclaration.getAttributes();
-
- String source = attributes.get("source");
- String target = attributes.get("target");
- int weight = Integer.valueOf(attributes.get("weight"));
- String b = attributes.get("public");
- boolean pub = true;
- if (b != null) {
- pub = Boolean.valueOf(b);
- }
-
- // Create a transformer wrapper and register it
- Transformer transformer;
- if (transformerClass == PullTransformer.class) {
- transformer = new LazyPullTransformer(source, target, weight, transformerDeclaration);
- } else {
- transformer = new LazyPushTransformer(source, target, weight, transformerDeclaration);
- }
- addTransformer(transformer, pub);
- }
- }
-
- /**
- * A transformer facade allowing transformers to be lazily loaded
- * and initialized.
- */
- private static class LazyPullTransformer implements PullTransformer<Object, Object> {
-
- private String source;
- private String target;
- private int weight;
- private ServiceDeclaration transformerDeclaration;
- private PullTransformer<Object, Object> transformer;
-
- public LazyPullTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
- this.source = source;
- this.target = target;
- this.weight = weight;
- this.transformerDeclaration = transformerDeclaration;
- }
-
- /**
- * Load and instantiate the transformer class.
- *
- * @return The transformer.
- */
- @SuppressWarnings("unchecked")
- private PullTransformer<Object, Object> getTransformer() {
- if (transformer == null) {
- try {
- Class<PullTransformer<Object, Object>> transformerClass =
- (Class<PullTransformer<Object, Object>>)transformerDeclaration.loadClass();
- Constructor<PullTransformer<Object, Object>> constructor = transformerClass.getConstructor();
- transformer = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return transformer;
- }
-
- public String getSourceDataBinding() {
- return source;
- }
-
- public String getTargetDataBinding() {
- return target;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public Object transform(Object source, TransformationContext context) {
- return getTransformer().transform(source, context);
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer(super.toString());
- sb.append(";className=").append(transformerDeclaration.getClassName());
- return sb.toString();
- }
- }
-
- /**
- * A transformer facade allowing transformers to be lazily loaded
- * and initialized.
- */
- private static class LazyPushTransformer implements PushTransformer<Object, Object> {
-
- private String source;
- private String target;
- private int weight;
- private ServiceDeclaration transformerDeclaration;
- private PushTransformer<Object, Object> transformer;
-
- public LazyPushTransformer(String source, String target, int weight, ServiceDeclaration transformerDeclaration) {
- this.source = source;
- this.target = target;
- this.weight = weight;
- this.transformerDeclaration = transformerDeclaration;
- }
-
- /**
- * Load and instantiate the transformer class.
- *
- * @return The transformer.
- */
- @SuppressWarnings("unchecked")
- private PushTransformer<Object, Object> getTransformer() {
- if (transformer == null) {
- try {
- Class<PushTransformer<Object, Object>> transformerClass =
- (Class<PushTransformer<Object, Object>>)transformerDeclaration.loadClass();
- Constructor<PushTransformer<Object, Object>> constructor = transformerClass.getConstructor();
- transformer = constructor.newInstance();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- return transformer;
- }
-
- public String getSourceDataBinding() {
- return source;
- }
-
- public String getTargetDataBinding() {
- return target;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public void transform(Object source, Object sink, TransformationContext context) {
- getTransformer().transform(source, sink, context);
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer(super.toString());
- sb.append(";className=").append(transformerDeclaration.getClassName());
- return sb.toString();
- }
- }
-
- //FIXME The following methods should be on a different class from
- // extension point
-
- public List<Transformer> getTransformerChain(String sourceType, String resultType) {
- loadTransformers();
-
- String source = sourceType;
- String result = resultType;
- List<Transformer> transformers = new ArrayList<Transformer>();
- // First check if there is a direct path, if yes, use it regardless of the weight
- DirectedGraph<Object, Transformer>.Edge link = graph.getEdge(sourceType, resultType);
- if (link != null) {
- transformers.add(link.getValue());
- } else {
- DirectedGraph<Object, Transformer>.Path path = graph.getShortestPath(source, result);
- if (path == null) {
- return null;
- }
- for (DirectedGraph<Object, Transformer>.Edge edge : path.getEdges()) {
- transformers.add(edge.getValue());
- }
- }
- return transformers;
- }
-
- @Override
- public String toString() {
- loadTransformers();
-
- return graph.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java
deleted file mode 100644
index 8184d739a8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Mediator.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding;
-
-import java.util.Map;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * This interface will be used as a Tuscany system service to perform data mediations
- *
- * Mediate the data from one type to the other one
- *
- * @version $Rev$ $Date$
- */
-public interface Mediator {
-
- /**
- * Mediate the data from the source type to the target type
- * @param source The data to be mediated
- * @param sourceDataType Data type for the source data
- * @param targetDataType Data type for the target data
- * @param context
- * @return
- */
- Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> context);
-
- /**
- * Mediate the source data into the target which is a sink to receive the data
- * @param source The data to be mediated
- * @param target The sink to receive data
- * @param sourceDataType Data type for the source data
- * @param targetDataType Data type for the target data
- */
- void mediate(Object source,
- Object target,
- DataType sourceDataType,
- DataType targetDataType,
- Map<String, Object> context);
-
- /**
- * Transform the input parameters for the source operation to the expected parameters for
- * the target operation
- * @param input The input data, typically an array of parameters
- * @param sourceOperation The source operation
- * @param targetOperation The target operation
- * @param metadata Additional metadata
- * @return The transformed input data for the target operation
- */
- Object mediateInput(Object input, Operation sourceOperation, Operation targetOperation, Map<String, Object> metadata);
-
- /**
- * Transform the return value for the target operation to the expected return value for
- * the source operation
- * @param output The output data, typically the return value
- * @param sourceOperation The source operation
- * @param targetOperation The target operation
- * @param metadata Additional metadata
- * @return The transformed output data for the source operation
- */
- Object mediateOutput(Object output,
- Operation sourceOperation,
- Operation targetOperation,
- Map<String, Object> metadata);
-
- /**
- * Transform the fault data for the target operation to the expected fault data for
- * the source operation
- * @param fault The fault data, such as Java exception or fault message
- * @param sourceOperation The source operation
- * @param targetOperation The target operation
- * @param metadata Additional metadata
- * @return The transformed fault data for the source operation
- */
- Object mediateFault(Object fault, Operation sourceOperation, Operation targetOperation, Map<String, Object> metadata);
-
- /**
- * Copy the data
- * @param data The orginal data
- * @param dataType The data type
- * @return The copy
- */
- Object copy(Object data, DataType dataType);
-
- /**
- * Copy an array of data objects passed to an operation
- * @param data array of objects to copy
- * @return the copy
- */
- public Object copyInput(Object input, Operation operation);
-
- /**
- * Copy the output data
- * @param data The orginal output
- * @param operation The operation
- * @return The copy
- */
- Object copyOutput(Object data, Operation operation);
-
- /**
- * Copy the fault data
- * @param fault The orginal fault data
- * @param operation The operation
- * @return The copy
- */
- Object copyFault(Object fault, Operation operation);
-
- /**
- * Get the DataBindings used by this mediator.
- * @return
- */
- DataBindingExtensionPoint getDataBindings();
-
- /**
- * Get the Transformers used by this mediator.
- * @return
- */
- TransformerExtensionPoint getTransformers();
-
- /**
- * Create an instance of TransformationContext
- * @return
- */
- TransformationContext createTransformationContext();
-
- /**
- * Create an instance of TransformationContext
- * @param sourceDataType
- * @param targetDataType
- * @param metadata
- * @return
- */
- TransformationContext createTransformationContext(DataType sourceDataType,
- DataType targetDataType,
- Map<String, Object> metadata);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java
deleted file mode 100644
index 81264923eb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PullTransformer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding;
-
-/**
- * PullTransformer transforms data from one binding format to the other one which can be directly consumed
- *
- * @param <S> The source data type
- * @param <R> the target data type
- *
- * @version $Rev$ $Date$
- */
-public interface PullTransformer<S, R> extends Transformer {
- /**
- * Transform source data into the result type.
- *
- * @param source The source data
- * @param context The context for the transformation
- * @return The transformed result
- */
- R transform(S source, TransformationContext context);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.java
deleted file mode 100644
index 600a6477f6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/PushTransformer.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.databinding;
-
-/**
- * A transformer that pushes data from its source into the sink
- *
- * @param <S>
- * @param <R>
- *
- * @version $Rev$ $Date$
- */
-public interface PushTransformer<S, R> extends Transformer {
- /**
- * @param source The source data
- * @param sink The sink to receive the data
- * @param context
- */
- void transform(S source, R sink, TransformationContext context);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.java
deleted file mode 100644
index 4e6d130aa9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/SimpleTypeMapper.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.databinding;
-
-import javax.xml.namespace.QName;
-
-/**
- * Type Mapper between XML schema simple data types and java objects
- *
- * @version $Rev$ $Date$
- */
-public interface SimpleTypeMapper {
- /**
- * Parse the XML lexical representation into a java object
- * @param simpleType The XSD simple type
- * @param value the XML lexical representation
- * @param context The context of the transformation
- * @return A java object for the XML value
- */
- Object toJavaObject(QName simpleType, String value, TransformationContext context);
- /**
- * Create the XML lexical representation for a java object
- * @param simpleType The XSD simple type
- * @param obj The java object
- * @param context The context of the transformation
- * @return The XML lexical representation
- */
- String toXMLLiteral(QName simpleType, Object obj, TransformationContext context);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.java
deleted file mode 100644
index 9ffadd1eae..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationContext.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.databinding;
-
-import java.util.Map;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * Context for data transformation
- *
- * @version $Rev$ $Date$
- */
-public interface TransformationContext {
-
- /**
- * @return
- */
- Operation getSourceOperation();
-
- /**
- * @param sourceOperation
- */
- void setSourceOperation(Operation sourceOperation);
-
- /**
- * @return
- */
- Operation getTargetOperation();
-
- /**
- * @param targetOperation
- */
- void setTargetOperation(Operation targetOperation);
-
- /**
- * Get the source data type
- *
- * @return
- */
- DataType getSourceDataType();
-
- /**
- * Get the target data type
- *
- * @return
- */
- DataType getTargetDataType();
-
- /**
- * Set the source data type
- *
- * @param sourceDataType
- */
- void setSourceDataType(DataType sourceDataType);
-
- /**
- * Set the target data type
- *
- * @param targetDataType
- */
- void setTargetDataType(DataType targetDataType);
-
- /**
- * Get the ClassLoader
- *
- * @return Returns the ClassLoader
- */
- ClassLoader getClassLoader();
-
- /**
- * Get a map of metadata
- *
- * @return Returns a map of the metadata
- */
- Map<String, Object> getMetadata();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java
deleted file mode 100644
index 4f949f7dff..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformationException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding;
-
-
-/**
- * Reports problems during data transformation
- *
- * @version $Rev$ $Date$
- */
-public class TransformationException extends RuntimeException {
-
- private static final long serialVersionUID = 7662385613693006428L;
- private String sourceDataBinding;
- private String targetDataBinding;
-
- public TransformationException() {
- super();
- }
-
- public TransformationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TransformationException(String message) {
- super(message);
- }
-
- public TransformationException(Throwable cause) {
- super(cause);
- }
-
- public String getSourceDataBinding() {
- return sourceDataBinding;
- }
-
- public void setSourceDataBinding(String sourceDataBinding) {
- this.sourceDataBinding = sourceDataBinding;
- }
-
- public String getTargetDataBinding() {
- return targetDataBinding;
- }
-
- public void setTargetDataBinding(String targetDataBinding) {
- this.targetDataBinding = targetDataBinding;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.java
deleted file mode 100644
index 2aa0ad7c15..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/Transformer.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.databinding;
-
-/**
- * A transformer provides the data transformation from source type to target type. The cost of the transformation is
- * modelled as weight.
- *
- * @version $Rev$ $Date$
- */
-public interface Transformer {
- /**
- * Get the source type that this transformer transforms data from. The type is used as the key when the transformer
- * is registered with TransformerRegistry.
- *
- * @return A key identifying the source type
- */
- String getSourceDataBinding();
-
- /**
- * Get the target type that this transformer transforms data into. The type is used as the key when the transformer
- * is registered with TransformerRegistry.
- *
- * @return A key identifying the target type
- */
- String getTargetDataBinding();
-
- /**
- * Get the cost of the transformation. The weight can be used to choose the most efficient path if there are more
- * than one available from the source to the target.
- *
- * @return An integer representing the cost of the transformation
- */
- int getWeight();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.java
deleted file mode 100644
index ee7efe4860..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/TransformerExtensionPoint.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.databinding;
-
-import java.util.List;
-
-/**
- * An extension point for data transformer extensions.
- *
- * @version $Rev$ $Date$
- */
-public interface TransformerExtensionPoint {
-
- /**
- * Register a transformer
- *
- * @param sourceDataBinding
- * @param targetDataBinding
- * @param weight
- * @param transformer
- * @param publicTransformer TODO
- */
- void addTransformer(String sourceDataBinding,
- String targetDataBinding,
- int weight,
- Transformer transformer,
- boolean publicTransformer);
-
- /**
- * Register a transformer
- *
- * @param transformer
- * @param publicTransformer TODO
- */
- void addTransformer(Transformer transformer, boolean publicTransformer);
-
- /**
- * Unregister a transformer
- *
- * @param sourceDataBinding
- * @param targetDataBinding
- * @return
- */
- boolean removeTransformer(String sourceDataBinding, String targetDataBinding);
-
- /**
- * Get the direct Transformer which can transform data from source type to
- * result type
- *
- * @param sourceDataBinding
- * @param targetDataBinding
- * @return
- */
- Transformer getTransformer(String sourceDataBinding, String targetDataBinding);
-
- /**
- * Get the a chain of Transformers which can transform data from source type
- * to result type
- *
- * @param sourceDataBinding
- * @param targetDataBinding
- * @return
- */
- List<Transformer> getTransformerChain(String sourceDataBinding, String targetDataBinding);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java
deleted file mode 100644
index a91410ed71..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/WrapperHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * A contract for transformers to deal with wrapping/unwrapping for WSDL wrapper style operations
- *
- * @version $Rev$ $Date$
- */
-public interface WrapperHandler<T> {
- /**
- * Create a wrapper element
- * @param operation The operation
- * @param input Is it for input or output
- * @return An object representing the wrapper element
- */
- T create(Operation operation, boolean input);
-
- /**
- * Get the data type for the wrapper
- * @param operation The operation
- * @param input Is it for input or output?
- * @return The data type of the wrapper, null if it's not a wrapper type
- */
- DataType getWrapperType(Operation operation, boolean input);
-
- /**
- * Check if the given data is an instance of the wrapper
- * @param wrapper
- * @param operation The operation
- * @param input Input or output
- * @return
- */
- boolean isInstance(Object wrapper, Operation operation, boolean input);
-
- /**
- * Populate the wrapper element with the child objects
- * @param wrapper The wrapper object
- * @param childObjects The child objects
- * @param operation The operation
- * @param input Is it for input or output
- */
- public void setChildren(T wrapper,
- Object[] childObjects,
- Operation operation,
- boolean input);
-
- /**
- * Get a list of child elements from the wrapper
- * @param wrapper The wrapper object
- * @param operation The operation
- * @param input Is it for input or output
- * @return child elements under the wrapper
- */
- List getChildren(T wrapper, Operation operation, boolean input);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.java
deleted file mode 100644
index e940f8675f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/XMLTypeHelper.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.databinding;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-
-/**
- * XML and schema helper for Java types
- */
-public interface XMLTypeHelper {
-
- // FIXME: This method seems to require the XMLHelper instance to be stateful
- /**
- * Convert a Java type into XML type information
- * @param javaType the physical Java class
- * @param logical the logical type information
- * @return the XML type information
- */
- TypeInfo getTypeInfo(Class javaType, Object logical);
-
- /**
- * Get schema definitions for the Java types known to this helper
- * @return A list of schema definitions
- */
- // List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver);
-
- /**
- * Get a list of XML schemas for the given data types
- * @param factory
- * @param resolver
- * @param dataTypes
- * @return
- */
- List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, List<DataType> dataTypes);
- /**
- * Get a list of XML schemas for the given interface
- * @param factory
- * @param resolver
- * @param intf
- * @return
- */
- List<XSDefinition> getSchemaDefinitions(XSDFactory factory, ModelResolver resolver, Interface intf);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.java
deleted file mode 100644
index 4405077e29..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataBinding.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.databinding.annotation;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Used to demarcate the mapping style for an interface or operation
- *
- * @version $Rev$ $Date$
- */
-// FIXME: [rfeng] We should consider to use javax.jws.soap.SOAPBinding
-@Target({TYPE, METHOD})
-@Retention(RUNTIME)
-public @interface DataBinding {
-
- /**
- * Indicate the effective databinding that controls the WSDL/Java mapping of the
- * interface/operation
- *
- * @return the data binding with the MIME media type syntax
- */
- String value();
-
- /**
- * Indicate if the operation is mapped using WRAPPED or BARE style. Originated from
- * javax.jws.soap.SOAPBinding.ParameterStyle: Determines whether method parameters
- * represent the entire message body, or whether the parameters are elements wrapped
- * inside a top-level element named after the operation
- *
- * @return true if the parameter style is WRAPPED, false if BARE
- */
- boolean wrapped() default false;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.java
deleted file mode 100644
index 650e909c61..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/annotation/DataType.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.databinding.annotation;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Used to demarcate expected data types for parameters and return type
- *
- * @version $Rev$ $Date$
- */
-@Target( {METHOD, PARAMETER})
-@Retention(RUNTIME)
-public @interface DataType {
-
- /**
- * Returns the data binding configuration in MIME media type syntax
- * @return the data binding
- */
- String value();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java
deleted file mode 100644
index 6f3456fdf0..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/externalizable/ExternalizableDataBinding.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.externalizable;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-
-/**
- * DataNinding for Externalizable objects.
- *
- * @version $Rev$ $Date$
- */
-public class ExternalizableDataBinding extends BaseDataBinding {
-
- public static final String NAME = java.io.Externalizable.class.getName();
-
- public ExternalizableDataBinding() {
- super(NAME, java.io.Externalizable.class);
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.java
deleted file mode 100644
index 04c2f0e0c9..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseDataBinding.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.databinding.impl;
-
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.XMLTypeHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Base Implementation of DataBinding
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseDataBinding implements DataBinding {
-
- private Class<?> baseType;
-
- private String name;
-
- /**
- * Create a databinding with the base java type whose name will be used as
- * the name of the databinding
- *
- * @param baseType The base java class or interface representing the
- * databinding, for example, org.w3c.dom.Node
- */
- protected BaseDataBinding(Class<?> baseType) {
- this(baseType.getName(), baseType);
- }
-
- /**
- * Create a databinding with the name and base java type
- *
- * @param name The name of the databinding
- * @param baseType The base java class or interface representing the
- * databinding, for example, org.w3c.dom.Node
- */
- protected BaseDataBinding(String name, Class<?> baseType) {
- this.name = name;
- this.baseType = baseType;
- }
-
- @SuppressWarnings("unchecked")
- public boolean introspect(DataType type, Operation operation) {
- assert type != null;
- Class cls = type.getPhysical();
- if (baseType != null && baseType.isAssignableFrom(cls)) {
- type.setDataBinding(getName());
- if (type.getLogical() == null) {
- type.setLogical(XMLType.UNKNOWN);
- }
- return true;
- }
- return false;
- }
-
- public DataType introspect(Object value, Operation operation) {
- if (value == null) {
- return null;
- } else {
- DataType<Class> dataType = new DataTypeImpl<Class>(value.getClass(), value.getClass());
- if (introspect(dataType, (Operation) null)) {
- return dataType;
- } else {
- return null;
- }
- }
- }
-
- public final String getName() {
- return name;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.DataBinding#getWrapperHandler()
- */
- public WrapperHandler getWrapperHandler() {
- return null;
- }
-
- public Object copy(Object object, DataType dataType, Operation operation) {
- return object;
- }
-
- public XMLTypeHelper getXMLTypeHelper() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java
deleted file mode 100644
index 94a2cdb0bb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/BaseTransformer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import org.apache.tuscany.sca.databinding.Transformer;
-
-/**
- * Base Implementation of Transformer which provides the registration to the
- * transformer registry
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseTransformer<S, T> implements Transformer {
-
- protected BaseTransformer() {
- super();
- }
-
- protected abstract Class<S> getSourceType();
-
- protected abstract Class<T> getTargetType();
-
- public String getSourceDataBinding() {
- return getSourceType().getName();
- }
-
- public String getTargetDataBinding() {
- return getTargetType().getName();
- }
-
- public int getWeight() {
- // default to 50
- return 50;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
deleted file mode 100644
index 64b3d22c10..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DOMHelper.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * Helper for DOM
- *
- * @version $Rev$ $Date$
- */
-public final class DOMHelper {
- private static DocumentBuilderFactory FACTORY;
-
- private DOMHelper() {
- }
-
- public static Document newDocument() throws ParserConfigurationException {
- return newDocumentBuilder().newDocument();
- }
-
- public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
- init();
- return FACTORY.newDocumentBuilder();
- }
-
- /**
- *
- */
- private static synchronized void init() {
- if (FACTORY == null) {
- FACTORY = DocumentBuilderFactory.newInstance();
- FACTORY.setNamespaceAware(true);
- }
- }
-
- public static QName getQName(Node node) {
- String ns = node.getNamespaceURI();
- if (ns == null) {
- ns = "";
- }
- // node.getLocalName() will return null if it is created using DOM Level
- // 1 method
- // such as createElement()
- return new QName(ns, node.getNodeName());
- }
-
- public static Element createElement(Document document, QName name) {
- String prefix = name.getPrefix();
- String qname =
- (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name.getLocalPart();
- return document.createElementNS(name.getNamespaceURI(), qname);
- }
-
- /**
- * Wrap an element as a DOM document
- * @param node
- * @return
- */
- public static Document promote(Node node) {
- if (node instanceof Document) {
- return (Document)node;
- }
- Element element = (Element)node;
- Document doc = element.getOwnerDocument();
- if (doc.getDocumentElement() == element) {
- return doc;
- }
- doc = (Document)element.getOwnerDocument().cloneNode(false);
- Element schema = (Element)doc.importNode(element, true);
- doc.appendChild(schema);
- Node parent = element.getParentNode();
- while (parent instanceof Element) {
- Element root = (Element)parent;
- NamedNodeMap nodeMap = root.getAttributes();
- for (int i = 0; i < nodeMap.getLength(); i++) {
- Attr attr = (Attr)nodeMap.item(i);
- String name = attr.getName();
- if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
- if (schema.getAttributeNode(name) == null) {
- schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
- }
- }
- }
- parent = parent.getParentNode();
- }
- return doc;
- }
-
- /**
- * @param context
- * @param element
- */
- public static Element adjustElementName(TransformationContext context, Element element) {
- if (context != null) {
- DataType dataType = context.getTargetDataType();
- Object logical = dataType == null ? null : dataType.getLogical();
- if (!(logical instanceof XMLType)) {
- return element;
- }
- XMLType xmlType = (XMLType)logical;
- QName name = new QName(element.getNamespaceURI(), element.getLocalName());
- if (xmlType.isElement() && !xmlType.getElementName().equals(name)) {
- QName newName = xmlType.getElementName();
- String prefix = newName.getPrefix();
- String qname = newName.getLocalPart();
- if (prefix != null && !prefix.equals("")) {
- qname = prefix + ":" + qname;
- }
- Document doc = element.getOwnerDocument();
- Element newElement = doc.createElementNS(newName.getNamespaceURI(), qname);
- // Copy the attributes to the new element
- NamedNodeMap attrs = element.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Attr attr = (Attr)doc.importNode(attrs.item(i), true);
- newElement.getAttributes().setNamedItem(attr);
- }
-
- // Move all the children
- while (element.hasChildNodes()) {
- newElement.appendChild(element.getFirstChild());
- }
-
- // Replace the old node with the new node
- if (element.getParentNode() != null) {
- element.getParentNode().replaceChild(newElement, element);
- }
-
- return newElement;
- }
- }
- return element;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
deleted file mode 100644
index 01916dfb96..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/DirectedGraph.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Directed, weighted graph
- *
- * @param <V> The type of vertex object
- * @param <E> The type of edge object
- *
- * @version $Rev$ $Date$
- */
-public class DirectedGraph<V, E> implements Cloneable {
- private final Map<V, Vertex> vertices = new HashMap<V, Vertex>();
-
- /**
- * Key for the shortest path cache
- */
- private final class VertexPair {
- private Vertex source;
-
- private Vertex target;
-
- /**
- * @param source
- * @param target
- */
- private VertexPair(Vertex source, Vertex target) {
- super();
- this.source = source;
- this.target = target;
- }
-
- @Override
- public boolean equals(Object object) {
- if (!VertexPair.class.isInstance(object)) {
- return false;
- }
- VertexPair pair = (VertexPair)object;
- return source == pair.source && target == pair.target;
- }
-
- @Override
- public int hashCode() {
- int x = source == null ? 0 : source.hashCode();
- int y = target == null ? 0 : target.hashCode();
- return x ^ y;
- }
-
- }
-
- // Fix for TUSCANY-2069, making the map concurrent
- private final Map<VertexPair, Path> paths = new ConcurrentHashMap<VertexPair, Path>();
- private final Path NULL_PATH = new Path();
-
- /**
- * Vertex of a graph
- */
- public final class Vertex {
- private V value;
-
- // TODO: Do we want to support multiple edges for a vertex pair? If so,
- // we should use a List instead of Map
- private Map<Vertex, Edge> outEdges = new HashMap<Vertex, Edge>();
- private Map<Vertex, Edge> inEdges = new HashMap<Vertex, Edge>();
-
- private Vertex(V value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "(" + value + ")";
- }
-
- public V getValue() {
- return value;
- }
-
- public Map<Vertex, Edge> getOutEdges() {
- return outEdges;
- }
-
- public Map<Vertex, Edge> getInEdges() {
- return inEdges;
- }
-
- }
-
- /**
- * An Edge connects two vertices in one direction
- */
- public final class Edge {
- private Vertex sourceVertex;
-
- private Vertex targetVertex;
-
- private E value;
-
- private int weight;
-
- private boolean pub = true;
-
- public Edge(Vertex source, Vertex target, E value, int weight, boolean pub) {
- this.sourceVertex = source;
- this.targetVertex = target;
- this.value = value;
- this.weight = weight;
- this.pub = pub;
- }
-
- @Override
- public String toString() {
- return sourceVertex + "->" + targetVertex + "[" + value + "," + weight + "]";
- }
-
- public E getValue() {
- return value;
- }
-
- public void setValue(E value) {
- this.value = value;
- }
-
- public Vertex getTargetVertex() {
- return targetVertex;
- }
-
- public void setTargetVertex(Vertex vertex) {
- this.targetVertex = vertex;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public void setWeight(int weight) {
- this.weight = weight;
- }
-
- public Vertex getSourceVertex() {
- return sourceVertex;
- }
-
- public void setSourceVertex(Vertex sourceVertex) {
- this.sourceVertex = sourceVertex;
- }
-
- public boolean isPublic() {
- return pub;
- }
-
- public void setPublic(boolean pub) {
- this.pub = pub;
- }
- }
-
- private final class Node implements Comparable<Node> {
-
- private long distance = Integer.MAX_VALUE;
-
- private Node previous; // NOPMD by rfeng on 9/26/06 9:17 PM
-
- private Vertex vertex; // NOPMD by rfeng on 9/26/06 9:17 PM
-
- private Node(Vertex vertex) {
- this.vertex = vertex;
- }
-
- public int compareTo(Node o) {
- return (distance > o.distance) ? 1 : ((distance == o.distance) ? 0 : -1);
- }
- }
-
- public void addEdge(V source, V target, E edgeValue, int weight, boolean publicEdge) {
- Vertex s = getVertex(source);
- if (s == null) {
- s = new Vertex(source);
- vertices.put(source, s);
- }
- Vertex t = getVertex(target);
- if (t == null) {
- t = new Vertex(target);
- vertices.put(target, t);
- }
- Edge edge = new Edge(s, t, edgeValue, weight, publicEdge);
- s.outEdges.put(t, edge);
- t.inEdges.put(s, edge);
- }
-
- public void addEdge(V soure, V target) {
- addEdge(soure, target, null, 0, true);
- }
-
- public Vertex getVertex(V source) {
- Vertex s = vertices.get(source);
- return s;
- }
-
- public boolean removeEdge(V source, V target) {
- Vertex s = getVertex(source);
- if (s == null) {
- return false;
- }
-
- Vertex t = getVertex(target);
- if (t == null) {
- return false;
- }
-
- return s.outEdges.remove(t) != null && t.inEdges.remove(s) != null;
-
- }
-
- public void removeEdge(Edge edge) {
- edge.sourceVertex.outEdges.remove(edge.targetVertex);
- edge.targetVertex.inEdges.remove(edge.sourceVertex);
- }
-
- public void removeVertex(Vertex vertex) {
- vertices.remove(vertex.getValue());
- for (Edge e : new ArrayList<Edge>(vertex.outEdges.values())) {
- removeEdge(e);
- }
- for (Edge e : new ArrayList<Edge>(vertex.inEdges.values())) {
- removeEdge(e);
- }
- }
-
- public Edge getEdge(Vertex source, Vertex target) {
- return source.outEdges.get(target);
- }
-
- public Edge getEdge(V source, V target) {
- Vertex sv = getVertex(source);
- if (sv == null) {
- return null;
- }
- Vertex tv = getVertex(target);
- if (tv == null) {
- return null;
- }
- return getEdge(getVertex(source), getVertex(target));
- }
-
- /**
- * Get the shortest path from the source vertex to the target vertex using
- * Dijkstra's algorithm. If there's no path, null will be returned. If the
- * source is the same as the target, it returns a path with empty edges with
- * weight 0.
- *
- * @param sourceValue The value identifies the source
- * @param targetValue The value identifies the target
- * @return The shortest path
- */
- public Path getShortestPath(V sourceValue, V targetValue) {
- Vertex source = getVertex(sourceValue);
- if (source == null) {
- return null;
- }
- Vertex target = getVertex(targetValue);
- if (target == null) {
- return null;
- }
-
- VertexPair pair = new VertexPair(source, target);
- Path path = null;
- if (paths.containsKey(pair)) {
- path = paths.get(pair);
- return path == NULL_PATH? null: path;
- }
-
- // Check if there is a direct link, if yes, use it instead
- Edge direct = getEdge(source, target);
- path = new Path();
- if (direct != null) {
- path.addEdge(direct);
- paths.put(pair, path);
- return path;
- }
-
- Map<Vertex, Node> nodes = new HashMap<Vertex, Node>();
- for (Vertex v : vertices.values()) {
- Node node = new Node(v);
- if (v == source) {
- node.distance = 0;
- }
- nodes.put(v, node);
- }
-
- Set<Node> otherNodes = new HashSet<Node>(nodes.values());
- Set<Node> nodesOnPath = new HashSet<Node>();
- Node nextNode = null;
- while (!otherNodes.isEmpty()) {
- nextNode = extractMin(otherNodes);
- if (nextNode.vertex == target) {
- path = getPath(nextNode);
- paths.put(pair, path); // Cache it
- return path == NULL_PATH? null: path;
- }
- nodesOnPath.add(nextNode);
- for (Edge edge : nextNode.vertex.outEdges.values()) {
- Node adjacentNode = nodes.get(edge.targetVertex);
- // The private edge can only be used if the edge connects to the target directly
- if (edge.isPublic() || edge.getTargetVertex() == target) {
- if (nextNode.distance + edge.weight < adjacentNode.distance) {
- adjacentNode.distance = nextNode.distance + edge.weight;
- adjacentNode.previous = nextNode;
- }
- }
- }
- }
- paths.put(pair, NULL_PATH); // Cache it
- return null;
- }
-
- /**
- * Searches for the vertex u in the vertex set Q that has the least d[u]
- * value. That vertex is removed from the set Q and returned to the user.
- *
- * @param nodes
- * @return
- */
- private Node extractMin(Set<Node> nodes) {
- Node node = Collections.min(nodes);
- nodes.remove(node);
- return node;
- }
-
- /**
- * The path between two vertices
- */
- public final class Path {
- private List<Edge> edges = new LinkedList<Edge>();
-
- private int weight;
-
- public int getWeight() {
- return weight;
- }
-
- public List<Edge> getEdges() {
- return edges;
- }
-
- public void addEdge(Edge edge) {
- edges.add(0, edge);
- weight += edge.weight;
- }
-
- @Override
- public String toString() {
- return edges + ", " + weight;
- }
- }
-
- private Path getPath(Node t) {
- if (t.distance == Integer.MAX_VALUE) {
- return NULL_PATH;
- }
- Path path = new Path();
- Node u = t;
- while (u.previous != null) {
- Edge edge = getEdge(u.previous.vertex, u.vertex);
- path.addEdge(edge);
- u = u.previous;
- }
- return path;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (Vertex v : vertices.values()) {
- sb.append(v.outEdges.values()).append("\n");
- }
- return sb.toString();
- }
-
- public Map<V, Vertex> getVertices() {
- return vertices;
- }
-
- public void addGraph(DirectedGraph<V, E> otherGraph) {
- for (Vertex v : otherGraph.vertices.values()) {
- for (Edge e : v.outEdges.values()) {
- addEdge(e.sourceVertex.value, e.targetVertex.value, e.value, e.weight, true);
- }
- }
- }
-
- private Vertex getFirst() {
- for (Vertex v : vertices.values()) {
- if (v.inEdges.isEmpty()) {
- return v;
- }
- }
- if (!vertices.isEmpty()) {
- throw new IllegalArgumentException("Circular ordering has been detected: " + toString());
- } else {
- return null;
- }
- }
-
- public List<V> topologicalSort(boolean readOnly) {
- DirectedGraph<V, E> graph = (!readOnly) ? this : (DirectedGraph<V, E>)clone();
- List<V> list = new ArrayList<V>();
- while (true) {
- Vertex v = graph.getFirst();
- if (v == null) {
- break;
- }
- list.add(v.getValue());
- graph.removeVertex(v);
- }
-
- return list;
- }
-
- @Override
- public Object clone() {
- DirectedGraph<V, E> copy = new DirectedGraph<V, E>();
- copy.addGraph(this);
- return copy;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.java
deleted file mode 100644
index cc7b40d06b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Group2GroupTransformer.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.databinding.impl;
-
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-/**
- * This is a special transformer to transform the output from one IDL to the
- * other one
- *
- * @version $Rev$ $Date$
- */
-public class Group2GroupTransformer extends BaseTransformer<Object, Object> implements
- PullTransformer<Object, Object> {
-
- protected Mediator mediator;
-
- /**
- * @param wrapperHandler
- */
- public Group2GroupTransformer() {
- super();
- }
-
- /**
- * @param mediator the mediator to set
- */
- public void setMediator(Mediator mediator) {
- this.mediator = mediator;
- }
-
- @Override
- public String getSourceDataBinding() {
- return GroupDataBinding.NAME;
- }
-
- @Override
- public String getTargetDataBinding() {
- return GroupDataBinding.NAME;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getSourceType()
- */
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.impl.BaseTransformer#getTargetType()
- */
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.Transformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 10;
- }
-
- @SuppressWarnings("unchecked")
- public Object transform(Object source, TransformationContext context) {
- DataType<DataType> sourceType = context.getSourceDataType();
- DataType<DataType> targetType = context.getTargetDataType();
-
- return mediator.mediate(source, sourceType.getLogical(), targetType.getLogical(), context.getMetadata());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java
deleted file mode 100644
index 70efd6a5c5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/GroupDataBinding.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * The base class for a special databinding which represents a group of other databindings
- *
- * @version $Rev$ $Date$
- */
-public abstract class GroupDataBinding extends BaseDataBinding {
- public static final String NAME = "databinding:group";
-
- /**
- * Marker type is a java class or interface representing the data format.
- */
- protected Class[] markerTypes;
-
- public GroupDataBinding(Class[] types) {
- super(NAME, GroupDataBinding.class);
- this.markerTypes = types;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (markerTypes == null) {
- return false;
- }
- Type physical = type.getPhysical();
- if (physical instanceof ParameterizedType) {
- physical = ((ParameterizedType)physical).getRawType();
- }
- if (!(physical instanceof Class)) {
- return false;
- }
- Class cls = (Class)physical;
- for (Class<?> c : markerTypes) {
- if (isTypeOf(c, cls)) {
- type.setDataBinding(getDataBinding(c));
- Object logical = getLogical(cls, null);
- if (logical != null) {
- type.setLogical(getLogical(cls, null));
- } else {
- type.setLogical(XMLType.UNKNOWN);
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * Test if the given type is a subtype of the base type
- * @param markerType
- * @param type
- * @return
- */
- protected boolean isTypeOf(Class<?> markerType, Class<?> type) {
- return markerType.isAssignableFrom(type);
- }
-
- /**
- * Derive the databinding name from a base class
- * @param baseType
- * @return
- */
- protected String getDataBinding(Class<?> baseType) {
- return baseType.getName();
- }
-
- /**
- * Get the logical type
- * @param type The java type
- * @param operation TODO
- * @return
- */
- protected abstract Object getLogical(Class<?> type, Operation operation);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java
deleted file mode 100644
index 45896ca6a1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/Java2SimpleTypeTransformer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Transformer to convert data from a simple java object to a databinding's representation
- *
- * @version $Rev$ $Date$
- */
-public abstract class Java2SimpleTypeTransformer<T> extends BaseTransformer<Object, T> implements
- PullTransformer<Object, T> {
-
- protected SimpleTypeMapper mapper;
-
- public Java2SimpleTypeTransformer() {
- this.mapper = new SimpleTypeMapperImpl();
- }
-
- public Java2SimpleTypeTransformer(SimpleTypeMapper mapper) {
- this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
- }
-
- public T transform(Object source, TransformationContext context) {
- XMLType xmlType = (XMLType) context.getTargetDataType().getLogical();
- String text = mapper.toXMLLiteral(xmlType.getTypeName(), source, context);
- return createElement(xmlType.getElementName(), text, context);
- }
-
- @Override
- public Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- return 10000;
- }
-
- protected abstract T createElement(QName element, String literal, TransformationContext context);
-
- @Override
- public String getSourceDataBinding() {
- return SimpleJavaDataBinding.NAME;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
deleted file mode 100644
index d94166588b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/MediatorImpl.java
+++ /dev/null
@@ -1,585 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import static org.apache.tuscany.sca.databinding.DataBinding.IDL_FAULT;
-import static org.apache.tuscany.sca.databinding.DataBinding.IDL_OUTPUT;
-
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URI;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.Transformer;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Default Mediator implementation
- *
- * @version $Rev$ $Date$
- */
-public class MediatorImpl implements Mediator {
- private static final String TARGET_OPERATION = "target.operation";
- private static final String SOURCE_OPERATION = "source.operation";
- private ExtensionPointRegistry registry;
- private DataBindingExtensionPoint dataBindings;
- private TransformerExtensionPoint transformers;
- private FaultExceptionMapper faultExceptionMapper;
-
- MediatorImpl(DataBindingExtensionPoint dataBindings, TransformerExtensionPoint transformers) {
- this.dataBindings = dataBindings;
- this.transformers = transformers;
- }
-
- public MediatorImpl(ExtensionPointRegistry registry) {
- this.registry = registry;
- this.dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- this.transformers = registry.getExtensionPoint(TransformerExtensionPoint.class);
- this.faultExceptionMapper =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(FaultExceptionMapper.class);
-
- }
-
- @SuppressWarnings("unchecked")
- public Object mediate(Object source, DataType sourceDataType, DataType targetDataType, Map<String, Object> metadata) {
- if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
- if (source != null) {
- Operation operation = (Operation)metadata.get(SOURCE_OPERATION);
- sourceDataType = dataBindings.introspectType(source, operation);
- }
- }
- if (sourceDataType == null || targetDataType == null) {
- return source;
- } else if (sourceDataType.equals(targetDataType)) {
- return source;
- }
-
- List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
-
- Object result = source;
- int size = path.size();
- int i = 0;
- while (i < size) {
- Transformer transformer = path.get(i);
- TransformationContext context =
- createTransformationContext(sourceDataType, targetDataType, size, i, transformer, metadata);
- // the source and target type
- if (transformer instanceof PullTransformer) {
- // For intermediate node, set data type to null
- result = ((PullTransformer)transformer).transform(result, context);
- } else if (transformer instanceof PushTransformer) {
- DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
- DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
- ((PushTransformer)transformer).transform(result, dataPipe.getSink(), context);
- result = dataPipe.getResult();
- }
- i++;
- }
-
- return result;
- }
-
- private TransformationContext createTransformationContext(DataType sourceDataType,
- DataType targetDataType,
- int size,
- int index,
- Transformer transformer,
- Map<String, Object> metadata) {
- DataType sourceType =
- (index == 0) ? sourceDataType : new DataTypeImpl<Object>(transformer.getSourceDataBinding(), Object.class,
- sourceDataType.getLogical());
- DataType targetType =
- (index == size - 1) ? targetDataType : new DataTypeImpl<Object>(transformer.getTargetDataBinding(),
- Object.class, targetDataType.getLogical());
-
- //FIXME The ClassLoader should be passed in
- // Allow privileged access to get ClassLoader. Requires RuntimePermission in security
- // policy.
- ClassLoader classLoader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
-
- Map<String, Object> copy = new HashMap<String, Object>();
- if (metadata != null) {
- copy.putAll(metadata);
- }
- copy.put(ExtensionPointRegistry.class.getName(), registry);
-
- TransformationContext context = new TransformationContextImpl(sourceType, targetType, classLoader, copy);
- return context;
- }
-
- @SuppressWarnings("unchecked")
- public void mediate(Object source,
- Object target,
- DataType sourceDataType,
- DataType targetDataType,
- Map<String, Object> metadata) {
- if (source == null) {
- // Shortcut for null value
- return;
- }
- if (sourceDataType == null || sourceDataType.getDataBinding() == null) {
- Operation operation = (Operation)metadata.get(SOURCE_OPERATION);
- sourceDataType = dataBindings.introspectType(source, operation);
- }
- if (sourceDataType == null) {
- return;
- } else if (sourceDataType.equals(targetDataType)) {
- return;
- }
-
- List<Transformer> path = getTransformerChain(sourceDataType, targetDataType);
- Object result = source;
- int size = path.size();
- for (int i = 0; i < size; i++) {
- Transformer transformer = path.get(i);
- TransformationContext context =
- createTransformationContext(sourceDataType, targetDataType, size, i, transformer, metadata);
-
- if (transformer instanceof PullTransformer) {
- result = ((PullTransformer)transformer).transform(result, context);
- } else if (transformer instanceof PushTransformer) {
- DataPipeTransformer dataPipeFactory = (i < size - 1) ? (DataPipeTransformer)path.get(++i) : null;
- DataPipe dataPipe = dataPipeFactory == null ? null : dataPipeFactory.newInstance();
- Object sink = dataPipe != null ? dataPipe.getSink() : target;
- ((PushTransformer)transformer).transform(result, sink, context);
- result = (dataPipe != null) ? dataPipe.getResult() : null;
- }
- }
- }
-
- private List<Transformer> getTransformerChain(DataType sourceDataType, DataType targetDataType) {
- String sourceId = sourceDataType.getDataBinding();
- String targetId = targetDataType.getDataBinding();
- List<Transformer> path = transformers.getTransformerChain(sourceId, targetId);
- if (path == null) {
- TransformationException ex =
- new TransformationException("No path found for the transformation: " + sourceId + "->" + targetId);
- ex.setSourceDataBinding(sourceId);
- ex.setTargetDataBinding(targetId);
- throw ex;
- }
- return path;
- }
-
- public DataBindingExtensionPoint getDataBindings() {
- return dataBindings;
- }
-
- public TransformerExtensionPoint getTransformers() {
- return transformers;
- }
-
- private DataType getFaultType(DataType exceptionType) {
- return exceptionType == null ? null : (DataType)exceptionType.getLogical();
- }
-
- /**
- * @param qn1
- * @param qn2
- */
- private boolean matches(QName qn1, QName qn2) {
- if (qn1 == qn2) {
- return true;
- }
- if (qn1 == null || qn2 == null) {
- return false;
- }
- String ns1 = qn1.getNamespaceURI();
- String ns2 = qn2.getNamespaceURI();
- String e1 = qn1.getLocalPart();
- String e2 = qn2.getLocalPart();
- if (e1.equals(e2) && (ns1.equals(ns2) || ns1.equals(ns2 + "/") || ns2.equals(ns1 + "/"))) {
- // Tolerating the trailing / which is required by JAX-WS java package --> xml ns mapping
- return true;
- }
- return false;
- }
-
- /**
- * @param source The source exception
- * @param sourceExType The data type for the source exception
- * @param targetExType The data type for the target exception
- * @param sourceType The fault type for the source
- * @param targetType The fault type for the target
- * @return
- */
- private Object transformException(Object source,
- DataType sourceExType,
- DataType targetExType,
- DataType sourceType,
- DataType targetType,
- Map<String, Object> metadata) {
-
- if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
- return source;
- }
-
- DataType<DataType> eSourceDataType =
- new DataTypeImpl<DataType>(IDL_FAULT, sourceExType.getPhysical(), sourceType);
- DataType<DataType> eTargetDataType =
- new DataTypeImpl<DataType>(IDL_FAULT, targetExType.getPhysical(), targetType);
-
- return mediate(source, eSourceDataType, eTargetDataType, metadata);
- }
-
- //
- // Assumes we're going from target->source, knowing that we're throwing BACK an exception, rather than the more
- // obvious source->target
- //
- public Object mediateFault(Object result,
- Operation sourceOperation,
- Operation targetOperation,
- Map<String, Object> metadata) {
-
- // FIXME: How to match fault data to a fault type for the
- // operation?
-
- // If the result is from an InvocationTargetException look at
- // the actual cause.
- if (result instanceof InvocationTargetException) {
- result = ((InvocationTargetException)result).getCause();
- }
- DataType targetDataType = null;
- for (DataType exType : targetOperation.getFaultTypes()) {
- if (((Class)exType.getPhysical()).isInstance(result)) {
- if (result instanceof FaultException) {
- DataType faultType = (DataType)exType.getLogical();
- if (((FaultException)result).isMatchingType(faultType.getLogical())) {
- targetDataType = exType;
- break;
- }
- } else {
- targetDataType = exType;
- break;
- }
- }
- }
-
- /*
- if (targetDataType == null) {
- // Not a business exception
- return resultMsg;
- }
- */
-
- DataType targetFaultType = getFaultType(targetDataType);
- if (targetFaultType == null) {
- // No matching fault type, it's a system exception
- Throwable cause = (Throwable)result;
- throw new ServiceRuntimeException(cause);
- }
-
- // FIXME: How to match a source fault type to a target fault
- // type?
- DataType sourceDataType = null;
- DataType sourceFaultType = null;
- for (DataType exType : sourceOperation.getFaultTypes()) {
- DataType faultType = getFaultType(exType);
- // Match by the QName (XSD element) of the fault type
- if (faultType != null && typesMatch(targetFaultType.getLogical(), faultType.getLogical())) {
- sourceDataType = exType;
- sourceFaultType = faultType;
- break;
- }
- }
-
- if (sourceFaultType == null) {
- // No matching fault type, it's a system exception
- Throwable cause = (Throwable)result;
- throw new ServiceRuntimeException(cause);
- }
-
- Map<String, Object> context = new HashMap<String, Object>();
- if (metadata != null) {
- context.putAll(metadata);
- }
- if (targetOperation != null) {
- context.put(SOURCE_OPERATION, targetOperation);
- }
- if (sourceOperation != null) {
- context.put(TARGET_OPERATION, sourceOperation);
- }
-
- Object newResult =
- transformException(result, targetDataType, sourceDataType, targetFaultType, sourceFaultType, context);
-
- return newResult;
-
- }
-
- private boolean typesMatch(Object first, Object second) {
- if (first.equals(second)) {
- return true;
- }
- if (first instanceof XMLType && second instanceof XMLType) {
- XMLType t1 = (XMLType)first;
- XMLType t2 = (XMLType)second;
- // TUSCANY-2113, we should compare element names only
- return matches(t1.getElementName(), t2.getElementName());
- }
- return false;
- }
-
- /**
- * Assumes we're going from target-to-source, knowing that we're sending BACK an output response, rather than the more
- * obvious source-to-target.
- *
- * @param output
- * @param sourceOperation
- * @param targetOperation
- * @return
- */
- public Object mediateOutput(Object output,
- Operation sourceOperation,
- Operation targetOperation,
- Map<String, Object> metadata) {
- // Create a data type to represent the ouput produced by the target operation
- DataType<DataType> targetType =
- new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, targetOperation.getOutputType());
-
- // Create a data type to represent the ouput expected by the source operation
- DataType<DataType> sourceType =
- new DataTypeImpl<DataType>(IDL_OUTPUT, Object.class, sourceOperation.getOutputType());
-
- if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
- return output;
- }
- Map<String, Object> context = new HashMap<String, Object>();
- if (metadata != null) {
- context.putAll(metadata);
- }
- if (targetOperation != null) {
- context.put(SOURCE_OPERATION, targetOperation);
- }
- if (sourceOperation != null) {
- context.put(TARGET_OPERATION, sourceOperation);
- }
- return mediate(output, targetType, sourceType, context);
- }
-
- public Object mediateInput(Object input,
- Operation sourceOperation,
- Operation targetOperation,
- Map<String, Object> metadata) {
- // Get the data type to represent the input passed in by the source operation
- DataType sourceType = sourceOperation.getInputType();
-
- // Get the data type to represent the input expected by the target operation
- DataType targetType = targetOperation.getInputType();
-
- if (sourceType == targetType || (sourceType != null && sourceType.equals(targetType))) {
- return input;
- }
- Map<String, Object> context = new HashMap<String, Object>();
- if (metadata != null) {
- context.putAll(metadata);
- }
- if (sourceOperation != null) {
- context.put(SOURCE_OPERATION, sourceOperation);
- }
- if (targetOperation != null) {
- context.put(TARGET_OPERATION, targetOperation);
- }
- return mediate(input, sourceType, targetType, context);
- }
-
- public TransformationContext createTransformationContext() {
- return new TransformationContextImpl();
- }
-
- public TransformationContext createTransformationContext(DataType sourceDataType,
- DataType targetDataType,
- Map<String, Object> metadata) {
- return new TransformationContextImpl(sourceDataType, targetDataType, metadata);
- }
-
- public Object copy(Object data, DataType dataType) {
- return copy(data, dataType, null);
- }
-
- /**
- * Copy data using the specified databinding.
- * @param data input data
- * @param dataType
- * @return a copy of the data
- */
- private Object copy(Object data, DataType dataType, Operation operation) {
- if (data == null) {
- return null;
- }
- Class<?> clazz = data.getClass();
- if (String.class == clazz || clazz.isPrimitive()
- || Number.class.isAssignableFrom(clazz)
- || Boolean.class.isAssignableFrom(clazz)
- || Character.class.isAssignableFrom(clazz)
- || Byte.class.isAssignableFrom(clazz)
- || URI.class == clazz
- || UUID.class == clazz
- || QName.class == clazz) {
- // Immutable classes
- return data;
- }
-
- DataBinding javaBeansDataBinding = dataBindings.getDataBinding(JavaBeansDataBinding.NAME);
- // FIXME: The JAXB databinding is hard-coded here
- DataBinding jaxbDataBinding = dataBindings.getDataBinding("javax.xml.bind.JAXBElement");
- DataBinding dataBinding = dataBindings.getDataBinding(dataType.getDataBinding());
- // If no databinding was specified, introspect the given arg to
- // determine its databinding
- if (dataBinding == null) {
- dataType = dataBindings.introspectType(data, operation);
- if (dataType != null) {
- String db = dataType.getDataBinding();
- dataBinding = dataBindings.getDataBinding(db);
- if (dataBinding == null && db != null) {
- return data;
- }
- }
- if (dataBinding == null) {
-
- // Default to the JavaBean databinding
- dataBinding = dataBindings.getDataBinding(JavaBeansDataBinding.NAME);
- }
- }
-
- // Use the JAXB databinding to copy non-Serializable data
- if (dataBinding == javaBeansDataBinding) {
-
- // If the input data is an array containing non Serializable elements
- // use JAXB
- clazz = data.getClass();
- if (clazz.isArray()) {
- if (Array.getLength(data) != 0) {
- Object element = Array.get(data, 0);
- if (element != null && !(element instanceof Serializable)) {
- dataBinding = jaxbDataBinding;
- }
- }
- } else {
-
- // If the input data is not Serializable use JAXB
- if (!((data instanceof Serializable) || (data instanceof Cloneable))) {
- dataBinding = jaxbDataBinding;
- }
- }
- }
-
- if (dataBinding != null) {
- return dataBinding.copy(data, dataType, operation);
- } else {
- return data;
- }
- }
-
- /**
- * Copy an array of data objects passed to an operation
- * @param data array of objects to copy
- * @return the copy
- */
- public Object copyInput(Object input, Operation operation) {
- if (input == null) {
- return null;
- }
- Object[] data = (input instanceof Object[]) ? (Object[])input : new Object[] {input};
- List<DataType> inputTypes = operation.getInputType().getLogical();
- Object[] copy = new Object[data.length];
- Map<Object, Object> map = new IdentityHashMap<Object, Object>();
- for (int i = 0, size = inputTypes.size(); i < size; i++) {
- Object arg = data[i];
- if (arg == null) {
- copy[i] = null;
- } else {
- Object copiedArg = map.get(arg);
- if (copiedArg != null) {
- copy[i] = copiedArg;
- } else {
- copiedArg = copy(arg, inputTypes.get(i));
- map.put(arg, copiedArg);
- copy[i] = copiedArg;
- }
- }
- }
- return copy;
- }
-
- public Object copyOutput(Object data, Operation operation) {
- return copy(data, operation.getOutputType(), operation);
- }
-
- public Object copyFault(Object fault, Operation operation) {
- if (faultExceptionMapper == null) {
- // try to get the fault exception mapper again. It sometime null depending on what order the
- // JavaRuntimeModuleActivator and DatabindingModuleActivator are started
- this.faultExceptionMapper =
- registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(FaultExceptionMapper.class);
-
- if (faultExceptionMapper == null) {
- return fault;
- }
- }
- for (DataType et : operation.getFaultTypes()) {
- if (et.getPhysical().isInstance(fault)) {
- Throwable ex = (Throwable)fault;
- DataType<DataType> exType =
- new DataTypeImpl<DataType>(ex.getClass(), new DataTypeImpl<XMLType>(ex.getClass(), XMLType.UNKNOWN));
- faultExceptionMapper.introspectFaultDataType(exType, operation, false);
- DataType faultType = exType.getLogical();
- Object faultInfo = faultExceptionMapper.getFaultInfo(ex, faultType.getPhysical(), operation);
- faultInfo = copy(faultInfo, faultType);
- fault =
- faultExceptionMapper.wrapFaultInfo(exType, ex.getMessage(), faultInfo, ex.getCause(), operation);
- return fault;
- }
- }
- return fault;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java
deleted file mode 100644
index a1a89005b3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/PipedTransformer.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-
-/**
- * A utility class to connect PushTransformer and DataPipe to create a
- * PullTransformer
- *
- * @param <S> Source type
- * @param <I> Intermediate type
- * @param <R> Result type
- *
- * @version $Rev$ $Date$
- */
-public class PipedTransformer<S, I, R> implements PullTransformer<S, R> {
- private PushTransformer<S, I> pusher;
-
- private DataPipeTransformer<I, R> pipe;
-
- /**
- * @param pumper
- * @param pipe
- */
- public PipedTransformer(PushTransformer<S, I> pumper, DataPipeTransformer<I, R> pipe) {
- super();
- this.pusher = pumper;
- this.pipe = pipe;
- }
-
- public R transform(S source, TransformationContext context) {
- DataPipe<I, R> dataPipe = pipe.newInstance();
- pusher.transform(source, dataPipe.getSink(), context);
- return dataPipe.getResult();
- }
-
- public String getSourceDataBinding() {
- return pusher.getSourceDataBinding();
- }
-
- public String getTargetDataBinding() {
- return pipe.getTargetDataBinding();
- }
-
- public int getWeight() {
- return pusher.getWeight() + pipe.getWeight();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
deleted file mode 100644
index c91176fc2c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleType2JavaTransformer.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Transformer to convert data from a databinding's representation of simple
- * types to Java Objects
- *
- * @version $Rev$ $Date$
- */
-public abstract class SimpleType2JavaTransformer<T> extends BaseTransformer<T, Object> implements
- PullTransformer<T, Object> {
-
- protected SimpleTypeMapper mapper;
-
- public SimpleType2JavaTransformer() {
- this.mapper = new SimpleTypeMapperImpl();
- }
-
- public SimpleType2JavaTransformer(SimpleTypeMapper mapper) {
- this.mapper = (mapper != null) ? mapper : new SimpleTypeMapperImpl();
- }
-
- public Object transform(T source, TransformationContext context) {
- XMLType xmlType = (XMLType)context.getSourceDataType().getLogical();
- QName type = (xmlType != null) ? xmlType.getTypeName() : null;
- if (type == null) {
- xmlType = (XMLType)context.getTargetDataType().getLogical();
- type = (xmlType != null) ? xmlType.getTypeName() : null;
- }
- Object result = mapper.toJavaObject(type, getText(source), context);
- close(source);
- return result;
- }
-
- @Override
- protected Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public int getWeight() {
- // Cannot be used for intermediate
- return 10000;
- }
-
- /**
- * Get the string value from the source
- * @param source
- * @return A string
- */
- protected abstract String getText(T source);
-
- /**
- * To be overrided by the subclass
- * @param source
- */
- protected void close(T source) {
- }
-
- @Override
- public String getTargetDataBinding() {
- return SimpleJavaDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
deleted file mode 100644
index 32a2313f59..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/SimpleTypeMapperImpl.java
+++ /dev/null
@@ -1,401 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-
-/**
- * Simple type mapper that maps from XSD types to Java Classes and Java Classes to XSD types.
- *
- * @version $Rev$ $Date$
- */
-public class SimpleTypeMapperImpl extends XSDDataTypeConverter implements SimpleTypeMapper {
-
- public static final Map<Class, String> JAVA2XML = new HashMap<Class, String>();
-
- public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
-
- public static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
-
- public static final QName XSD_ANY = new QName(URI_2001_SCHEMA_XSD, "any");
-
- public static final QName XSD_ANYSIMPLETYPE = new QName(URI_2001_SCHEMA_XSD, "anySimpleType");
-
- public static final QName XSD_ANYTYPE = new QName(URI_2001_SCHEMA_XSD, "anyType");
-
- public static final QName XSD_ANYURI = new QName(URI_2001_SCHEMA_XSD, "anyURI");
-
- public static final QName XSD_BASE64 = new QName(URI_2001_SCHEMA_XSD, "base64Binary");
-
- public static final QName XSD_BOOLEAN = new QName(URI_2001_SCHEMA_XSD, "boolean");
-
- public static final QName XSD_BYTE = new QName(URI_2001_SCHEMA_XSD, "byte");
-
- public static final QName XSD_DATE = new QName(URI_2001_SCHEMA_XSD, "date");
-
- public static final QName XSD_DATETIME = new QName(URI_2001_SCHEMA_XSD, "dateTime");
-
- public static final QName XSD_DAY = new QName(URI_2001_SCHEMA_XSD, "gDay");
-
- public static final QName XSD_DECIMAL = new QName(URI_2001_SCHEMA_XSD, "decimal");
-
- public static final QName XSD_DOUBLE = new QName(URI_2001_SCHEMA_XSD, "double");
-
- public static final QName XSD_DURATION = new QName(URI_2001_SCHEMA_XSD, "duration");
-
- public static final QName XSD_ENTITIES = new QName(URI_2001_SCHEMA_XSD, "ENTITIES");
-
- public static final QName XSD_ENTITY = new QName(URI_2001_SCHEMA_XSD, "ENTITY");
-
- public static final QName XSD_FLOAT = new QName(URI_2001_SCHEMA_XSD, "float");
-
- public static final QName XSD_HEXBIN = new QName(URI_2001_SCHEMA_XSD, "hexBinary");
-
- public static final QName XSD_IDREF = new QName(URI_2001_SCHEMA_XSD, "IDREF");
-
- public static final QName XSD_IDREFS = new QName(URI_2001_SCHEMA_XSD, "IDREFS");
-
- public static final QName XSD_INT = new QName(URI_2001_SCHEMA_XSD, "int");
-
- public static final QName XSD_INTEGER = new QName(URI_2001_SCHEMA_XSD, "integer");
-
- public static final QName XSD_LONG = new QName(URI_2001_SCHEMA_XSD, "long");
-
- public static final QName XSD_MONTH = new QName(URI_2001_SCHEMA_XSD, "gMonth");
-
- public static final QName XSD_MONTHDAY = new QName(URI_2001_SCHEMA_XSD, "gMonthDay");
-
- public static final QName XSD_NAME = new QName(URI_2001_SCHEMA_XSD, "Name");
-
- public static final QName XSD_NCNAME = new QName(URI_2001_SCHEMA_XSD, "NCName");
-
- public static final QName XSD_NEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "negativeInteger");
-
- public static final QName XSD_NMTOKEN = new QName(URI_2001_SCHEMA_XSD, "NMTOKEN");
-
- public static final QName XSD_NMTOKENS = new QName(URI_2001_SCHEMA_XSD, "NMTOKENS");
-
- public static final QName XSD_NONNEGATIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonNegativeInteger");
-
- public static final QName XSD_NONPOSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "nonPositiveInteger");
-
- public static final QName XSD_NORMALIZEDSTRING = new QName(URI_2001_SCHEMA_XSD, "normalizedString");
-
- public static final QName XSD_NOTATION = new QName(URI_2001_SCHEMA_XSD, "NOTATION");
-
- public static final QName XSD_POSITIVEINTEGER = new QName(URI_2001_SCHEMA_XSD, "positiveInteger");
-
- public static final QName XSD_QNAME = new QName(URI_2001_SCHEMA_XSD, "QName");
-
- public static final QName XSD_SHORT = new QName(URI_2001_SCHEMA_XSD, "short");
-
- public static final Map<String, TypeInfo> XSD_SIMPLE_TYPES = new HashMap<String, TypeInfo>();
-
- public static final QName XSD_STRING = new QName(URI_2001_SCHEMA_XSD, "string");
-
- public static final QName XSD_TIME = new QName(URI_2001_SCHEMA_XSD, "time");
-
- public static final QName XSD_TOKEN = new QName(URI_2001_SCHEMA_XSD, "token");
-
- public static final QName XSD_UNSIGNEDBYTE = new QName(URI_2001_SCHEMA_XSD, "unsignedByte");
-
- public static final QName XSD_UNSIGNEDINT = new QName(URI_2001_SCHEMA_XSD, "unsignedInt");
-
- public static final QName XSD_UNSIGNEDLONG = new QName(URI_2001_SCHEMA_XSD, "unsignedLong");
-
- public static final QName XSD_UNSIGNEDSHORT = new QName(URI_2001_SCHEMA_XSD, "unsignedShort");
-
- public static final QName XSD_YEAR = new QName(URI_2001_SCHEMA_XSD, "gYear");
-
- public static final QName XSD_YEARMONTH = new QName(URI_2001_SCHEMA_XSD, "gYearMonth");
-
- private static final String[] XSD_TYPE_NAMES =
- {"string", "boolean", "double", "float", "int", "integer", "long", "short", "byte", "decimal", "base64Binary",
- "hexBinary", "anySimpleType", "anyType", "any", "QName", "dateTime", "date", "time", "normalizedString",
- "token", "unsignedLong", "unsignedInt", "unsignedShort", "unsignedByte", "positiveInteger", "negativeInteger",
- "nonNegativeInteger", "nonPositiveInteger", "gYearMonth", "gMonthDay", "gYear", "gMonth", "gDay", "duration",
- "Name", "NCName", "NMTOKEN", "NMTOKENS", "NOTATION", "ENTITY", "ENTITIES", "IDREF", "IDREFS", "anyURI",
- "language", "ID"};
-
- static {
- for (String type : XSD_TYPE_NAMES) {
- TypeInfo simpleType = new TypeInfo(new QName(URI_2001_SCHEMA_XSD, type), true, null);
- XSD_SIMPLE_TYPES.put(type, simpleType);
- }
- }
-
- static {
- JAVA2XML.put(boolean.class, "boolean");
- JAVA2XML.put(byte.class, "byte");
- JAVA2XML.put(short.class, "short");
- JAVA2XML.put(int.class, "int");
- JAVA2XML.put(long.class, "long");
- JAVA2XML.put(float.class, "float");
- JAVA2XML.put(double.class, "double");
- JAVA2XML.put(Boolean.class, "boolean");
- JAVA2XML.put(Byte.class, "byte");
- JAVA2XML.put(Short.class, "short");
- JAVA2XML.put(Integer.class, "int");
- JAVA2XML.put(Long.class, "long");
- JAVA2XML.put(Float.class, "float");
- JAVA2XML.put(Double.class, "double");
- JAVA2XML.put(java.lang.String.class, "string");
- JAVA2XML.put(java.math.BigInteger.class, "integer");
- JAVA2XML.put(java.math.BigDecimal.class, "decimal");
- JAVA2XML.put(java.util.Calendar.class, "dateTime");
- JAVA2XML.put(java.util.Date.class, "dateTime");
- JAVA2XML.put(javax.xml.namespace.QName.class, "QName");
- JAVA2XML.put(java.net.URI.class, "string");
- JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, "anySimpleType");
- JAVA2XML.put(javax.xml.datatype.Duration.class, "duration");
- JAVA2XML.put(java.lang.Object.class, "anyType");
- JAVA2XML.put(java.awt.Image.class, "base64Binary");
- JAVA2XML.put(byte[].class, "base64Binary");
- // java2XSD.put(javax.activation.DataHandler.class, "base64Binary");
- JAVA2XML.put(javax.xml.transform.Source.class, "base64Binary");
- JAVA2XML.put(java.util.UUID.class, "string");
- }
-
- static {
- XML2JAVA.put("string", java.lang.String.class);
- XML2JAVA.put("integer", java.math.BigInteger.class);
- XML2JAVA.put("int", int.class);
- XML2JAVA.put("long", long.class);
- XML2JAVA.put("short", short.class);
- XML2JAVA.put("decimal", java.math.BigDecimal.class);
- XML2JAVA.put("float", float.class);
- XML2JAVA.put("double", double.class);
- XML2JAVA.put("boolean", boolean.class);
- XML2JAVA.put("byte", byte.class);
- XML2JAVA.put("QName", javax.xml.namespace.QName.class);
- XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("base64Binary", byte[].class);
- XML2JAVA.put("hexBinary", byte[].class);
- XML2JAVA.put("unsignedInt", long.class);
- XML2JAVA.put("unsignedShort", int.class);
- XML2JAVA.put("unsignedByte", short.class);
- XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements
- // XML2JAVA.put("anySimpleType", java.lang.String.class); // For
- // attributes
- XML2JAVA.put("duration", javax.xml.datatype.Duration.class);
- XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class);
- }
-
- private DatatypeFactory factory;
-
- public SimpleTypeMapperImpl() {
- super();
- try {
- this.factory = DatatypeFactory.newInstance();
- } catch (DatatypeConfigurationException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public static Class getJavaType(QName xmlType) {
- if (xmlType != null && URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
- return XML2JAVA.get(xmlType.getLocalPart());
- } else {
- return null;
- }
- }
-
- public static TypeInfo getXMLType(Class javaType) {
- return XSD_SIMPLE_TYPES.get(JAVA2XML.get(javaType));
- }
-
- public Object toJavaObject(QName simpleType, String literal, TransformationContext context) {
- /**
- * <ul>
- * <li>xsd:string --- java.lang.String
- * <li>xsd:integer --- java.math.BigInteger
- * <li>xsd:int --- int
- * <li>xsd:long --- long
- * <li>xsd:short --- short
- * <li>xsd:decimal --- java.math.BigDecimal
- * <li>xsd:float --- float
- * <li>xsd:double --- double
- * <li>xsd:boolean --- boolean
- * <li>xsd:byte --- byte
- * <li>xsd:QName --- javax.xml.namespace.QName
- * <li>xsd:dateTime --- javax.xml.datatype.XMLGregorianCalendar
- * <li>xsd:base64Binary --- byte[]
- * <li>xsd:hexBinary --- byte[]
- * <li>xsd:unsignedInt --- long
- * <li>xsd:unsignedShort --- int
- * <li>xsd:unsignedByte --- short
- * <li>xsd:time --- javax.xml.datatype.XMLGregorianCalendar
- * <li>xsd:date --- javax.xml.datatype.XMLGregorianCalendar
- * <li>xsd:g* --- javax.xml.datatype.XMLGregorianCalendar
- * <li>xsd:anySimpleType (for xsd:element of this type)a
- * java.lang.Object
- * <li>xsd:anySimpleType (for xsd:attribute of this type)
- * java.lang.String
- * <li>xsd:duration javax.xml.datatype.Duration
- * <li>xsd:NOTATION javax.xml.namespace.QName
- * </ul>
- */
-
- if (literal == null) {
- return null;
- }
- String value = literal.trim();
-
- QName type = simpleType;
- if (type.equals(XSD_STRING)) {
- return parseString(value);
- } else if (type.equals(XSD_INT)) {
- return parseInt(value);
- } else if (type.equals(XSD_INTEGER)) {
- return parseInteger(value);
- } else if (type.equals(XSD_INT)) {
- return parseInt(value);
- } else if (type.equals(XSD_FLOAT)) {
- return parseFloat(value);
- } else if (type.equals(XSD_DOUBLE)) {
- return parseDouble(value);
- } else if (type.equals(XSD_SHORT)) {
- return parseShort(value);
- } else if (type.equals(XSD_DECIMAL)) {
- return parseDecimal(value);
- } else if (type.equals(XSD_BOOLEAN)) {
- return parseBoolean(value);
- } else if (type.equals(XSD_BYTE)) {
- return parseByte(value);
- } else if (type.equals(XSD_LONG)) {
- return parseLong(value);
- } else if (type.equals(XSD_UNSIGNEDBYTE)) {
- return parseUnsignedShort(value);
- } else if (type.equals(XSD_UNSIGNEDSHORT)) {
- return parseUnsignedShort(value);
- } else if (type.equals(XSD_UNSIGNEDINT)) {
- return parseUnsignedInt(value);
- } else if (type.equals(XSD_UNSIGNEDLONG)) {
- return parseUnsignedInt(value);
- } else if (type.equals(XSD_DATETIME)) {
- return parseDateTime(value);
- } else if (type.equals(XSD_DATE)) {
- return parseDate(value);
- } else if (type.equals(XSD_TIME)) {
- return parseTime(value);
- } else if (type.equals(XSD_DURATION)) {
- return parseDuration(value);
- } else if (type.equals(XSD_HEXBIN)) {
- return parseHexBinary(value);
- } else if (type.equals(XSD_BASE64)) {
- return parseBase64Binary(value);
- } else if (type.equals(XSD_QNAME)) {
- NamespaceContext namespaceContext =
- (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
- return parseQName(value, namespaceContext);
- } else if (type.equals(XSD_NOTATION)) {
- NamespaceContext namespaceContext =
- (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
- return parseQName(value, namespaceContext);
- } else if (type.equals(XSD_YEAR)) {
- return factory.newXMLGregorianCalendar(value);
- } else if (type.equals(XSD_MONTH)) {
- return factory.newXMLGregorianCalendar(value);
- } else if (type.equals(XSD_DAY)) {
- return factory.newXMLGregorianCalendar(value);
- } else if (type.equals(XSD_YEARMONTH)) {
- return factory.newXMLGregorianCalendar(value);
- } else if (type.equals(XSD_MONTHDAY)) {
- return factory.newXMLGregorianCalendar(value);
- } else {
- return value;
- }
- }
-
- @SuppressWarnings("deprecation")
- private XMLGregorianCalendar toXMLGregorianCalendar(Date date) {
- GregorianCalendar c =
- new GregorianCalendar(date.getYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(),
- date.getSeconds());
- return factory.newXMLGregorianCalendar(c);
- }
-
- private XMLGregorianCalendar toXMLGregorianCalendar(GregorianCalendar calendar) {
- return factory.newXMLGregorianCalendar(calendar);
- }
-
- public String toXMLLiteral(QName simpleType, Object obj, TransformationContext context) {
- if(obj == null) {
- // It could be null if nilable=true
- return null;
- }
- if (obj instanceof Float || obj instanceof Double) {
- if (obj instanceof Float) {
- return printDouble(((Float)obj).floatValue());
- } else {
- return printDouble(((Double)obj).doubleValue());
- }
- } else if (obj instanceof GregorianCalendar) {
- GregorianCalendar calendar = (GregorianCalendar)obj;
- return toXMLGregorianCalendar(calendar).toXMLFormat();
- } else if (obj instanceof Date) {
- return toXMLGregorianCalendar((Date)obj).toXMLFormat();
- } else if (obj instanceof XMLGregorianCalendar) {
- return ((XMLGregorianCalendar)obj).toXMLFormat();
- } else if (obj instanceof byte[]) {
- if (simpleType != null) {
- if (simpleType.equals(XSD_BASE64)) {
- return printBase64Binary((byte[])obj);
- } else if (simpleType.equals(XSD_HEXBIN)) {
- return printHexBinary((byte[])obj);
- }
- }
- } else if (obj instanceof QName) {
- NamespaceContext namespaceContext =
- (NamespaceContext)((context != null) ? context.getMetadata().get(NamespaceContext.class.getName()) : null);
- return printQName((QName)obj, namespaceContext);
- }
- return obj.toString();
- }
-
- public static boolean isSimpleXSDType(QName typeName) {
- if (typeName == null) {
- return false;
- }
- return typeName.getNamespaceURI().equals(URI_2001_SCHEMA_XSD)
- && XSD_SIMPLE_TYPES.get(typeName.getLocalPart()) != null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java
deleted file mode 100644
index afc6417284..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/TransformationContextImpl.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-public class TransformationContextImpl implements TransformationContext {
- private DataType sourceDataType;
-
- private DataType targetDataType;
-
- private final Map<String, Object> metadata = new HashMap<String, Object>();
-
- private WeakReference<ClassLoader> classLoaderRef;
-
- public TransformationContextImpl() {
- super();
- // This is used only for testing
- setClassLoader(Thread.currentThread().getContextClassLoader());
- }
-
- public TransformationContextImpl(DataType sourceDataType,
- DataType targetDataType,
- ClassLoader classLoader,
- Map<String, Object> metadata) {
- super();
- this.sourceDataType = sourceDataType;
- this.targetDataType = targetDataType;
- setClassLoader(classLoader);
- if (metadata != null) {
- this.metadata.putAll(metadata);
- }
- }
-
- public TransformationContextImpl(DataType sourceDataType,
- DataType targetDataType,
- Map<String, Object> metadata) {
- super();
- this.sourceDataType = sourceDataType;
- this.targetDataType = targetDataType;
- setClassLoader(Thread.currentThread().getContextClassLoader());
- if (metadata != null) {
- this.metadata.putAll(metadata);
- }
- }
-
- public DataType getSourceDataType() {
- return sourceDataType;
- }
-
- public DataType getTargetDataType() {
- return targetDataType;
- }
-
- public void setSourceDataType(DataType sourceDataType) {
- this.sourceDataType = sourceDataType;
- }
-
- public void setTargetDataType(DataType targetDataType) {
- this.targetDataType = targetDataType;
- }
-
- public final void setClassLoader(ClassLoader classLoader) {
- this.classLoaderRef = new WeakReference<ClassLoader>(classLoader);
- }
-
- public ClassLoader getClassLoader() {
- return classLoaderRef.get();
- }
-
- public Map<String, Object> getMetadata() {
- return metadata;
- }
-
- /**
- * @return the sourceOperation
- */
- public Operation getSourceOperation() {
- return (Operation) metadata.get("source.operation");
- }
-
- /**
- * @param sourceOperation the sourceOperation to set
- */
- public void setSourceOperation(Operation sourceOperation) {
- this.metadata.put("source.operation", sourceOperation);
- }
-
- /**
- * @return the targetOperation
- */
- public Operation getTargetOperation() {
- return (Operation) metadata.get("target.operation");
- }
-
- /**
- * @param targetOperation the targetOperation to set
- */
- public void setTargetOperation(Operation targetOperation) {
- this.metadata.put("target.operation", targetOperation);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
deleted file mode 100644
index fb747864e7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/impl/XSDDataTypeConverter.java
+++ /dev/null
@@ -1,945 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.Writer;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.FieldPosition;
-import java.text.Format;
-import java.text.ParsePosition;
-import java.util.Calendar;
-import java.util.TimeZone;
-
-import javax.xml.XMLConstants;
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.Duration;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-
-/**
- * Utility class for XSD data type conversions
- *
- * @version $Rev$ $Date$
- */
-public class XSDDataTypeConverter {
- public static final class Base64Binary {
- private static final char[] S_BASE64CHAR =
- {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
- 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
- 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4',
- '5', '6', '7', '8', '9', '+', '/'};
-
- private static final char S_BASE64PAD = '=';
-
- private static final byte[] S_DECODETABLE = new byte[128];
-
- static {
- for (int i = 0; i < S_DECODETABLE.length; i++) {
- S_DECODETABLE[i] = Byte.MAX_VALUE; // 127
- }
- for (int i = 0; i < S_BASE64CHAR.length; i++) {
- // 0 to 63
- S_DECODETABLE[S_BASE64CHAR[i]] = (byte) i;
- }
- }
-
- private Base64Binary() {
- }
-
- /**
- *
- */
- public static byte[] decode(char[] data, int off, int len) {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[len / 4 * 3 + 3];
- int obufcount = 0;
- for (int i = off; i < off + len; i++) {
- char ch = data[i];
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- obufcount += decode0(ibuf, obuf, obufcount);
- }
- }
- }
- if (obufcount == obuf.length) {
- return obuf;
- }
- byte[] ret = new byte[obufcount];
- System.arraycopy(obuf, 0, ret, 0, obufcount);
- return ret;
- }
-
- /**
- *
- */
- public static void decode(char[] data, int off, int len, OutputStream ostream) throws IOException {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[3];
- for (int i = off; i < off + len; i++) {
- char ch = data[i];
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- int obufcount = decode0(ibuf, obuf, 0);
- ostream.write(obuf, 0, obufcount);
- }
- }
- }
- }
-
- /**
- *
- */
- public static byte[] decode(String data) {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[data.length() / 4 * 3 + 3];
- int obufcount = 0;
- for (int i = 0; i < data.length(); i++) {
- char ch = data.charAt(i);
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- obufcount += decode0(ibuf, obuf, obufcount);
- }
- }
- }
- if (obufcount == obuf.length) {
- return obuf;
- }
- byte[] ret = new byte[obufcount];
- System.arraycopy(obuf, 0, ret, 0, obufcount);
- return ret;
- }
-
- /**
- *
- */
- public static void decode(String data, OutputStream ostream) throws IOException {
- char[] ibuf = new char[4];
- int ibufcount = 0;
- byte[] obuf = new byte[3];
- for (int i = 0; i < data.length(); i++) {
- char ch = data.charAt(i);
- if (ch == S_BASE64PAD || ch < S_DECODETABLE.length && S_DECODETABLE[ch] != Byte.MAX_VALUE) {
- ibuf[ibufcount++] = ch;
- if (ibufcount == ibuf.length) {
- ibufcount = 0;
- int obufcount = decode0(ibuf, obuf, 0);
- ostream.write(obuf, 0, obufcount);
- }
- }
- }
- }
-
- private static int decode0(char[] ibuf, byte[] obuf, int index) {
- int wp = index;
- int outlen = 3;
- if (ibuf[3] == S_BASE64PAD) {
- outlen = 2;
- }
- if (ibuf[2] == S_BASE64PAD) {
- outlen = 1;
- }
- int b0 = S_DECODETABLE[ibuf[0]];
- int b1 = S_DECODETABLE[ibuf[1]];
- int b2 = S_DECODETABLE[ibuf[2]];
- int b3 = S_DECODETABLE[ibuf[3]];
- switch (outlen) {
- case 1:
- obuf[wp] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- return 1;
- case 2:
- obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- obuf[wp] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
- return 2;
- case 3:
- obuf[wp++] = (byte) (b0 << 2 & 0xfc | b1 >> 4 & 0x3);
- obuf[wp++] = (byte) (b1 << 4 & 0xf0 | b2 >> 2 & 0xf);
- obuf[wp] = (byte) (b2 << 6 & 0xc0 | b3 & 0x3f);
- return 3;
- default:
- throw new IllegalArgumentException("The character sequence is not base64 encoded.");
- }
- }
-
- /**
- * Returns base64 representation of specified byte array.
- */
- public static String encode(byte[] data) {
- return encode(data, 0, data.length);
- }
-
- /**
- * Returns base64 representation of specified byte array.
- */
- public static String encode(byte[] data, int off, int len) {
- if (len <= 0) {
- return "";
- }
- char[] out = new char[len / 3 * 4 + 4];
- int rindex = off;
- int windex = 0;
- int rest = len - off;
- while (rest >= 3) {
- int i =
- ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
- + (data[rindex + 2] & 0xff);
- out[windex++] = S_BASE64CHAR[i >> 18];
- out[windex++] = S_BASE64CHAR[(i >> 12) & 0x3f];
- out[windex++] = S_BASE64CHAR[(i >> 6) & 0x3f];
- out[windex++] = S_BASE64CHAR[i & 0x3f];
- rindex += 3;
- rest -= 3;
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[windex++] = S_BASE64CHAR[i >> 2];
- out[windex++] = S_BASE64CHAR[(i << 4) & 0x3f];
- out[windex++] = S_BASE64PAD;
- out[windex++] = S_BASE64PAD;
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[windex++] = S_BASE64CHAR[i >> 10];
- out[windex++] = S_BASE64CHAR[(i >> 4) & 0x3f];
- out[windex++] = S_BASE64CHAR[(i << 2) & 0x3f];
- out[windex++] = S_BASE64PAD;
- }
- return new String(out, 0, windex);
- }
-
- /**
- * Outputs base64 representation of the specified byte array to a byte stream.
- */
- public static void encode(byte[] data, int off, int len, OutputStream ostream) throws IOException {
- if (len <= 0) {
- return;
- }
- byte[] out = new byte[4];
- int rindex = off;
- int rest = len - off;
- while (rest >= 3) {
- int i =
- ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
- + (data[rindex + 2] & 0xff);
- out[0] = (byte) S_BASE64CHAR[i >> 18];
- out[1] = (byte) S_BASE64CHAR[(i >> 12) & 0x3f];
- out[2] = (byte) S_BASE64CHAR[(i >> 6) & 0x3f];
- out[3] = (byte) S_BASE64CHAR[i & 0x3f];
- ostream.write(out, 0, 4);
- rindex += 3;
- rest -= 3;
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[0] = (byte) S_BASE64CHAR[i >> 2];
- out[1] = (byte) S_BASE64CHAR[(i << 4) & 0x3f];
- out[2] = (byte) S_BASE64PAD;
- out[3] = (byte) S_BASE64PAD;
- ostream.write(out, 0, 4);
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[0] = (byte) S_BASE64CHAR[i >> 10];
- out[1] = (byte) S_BASE64CHAR[(i >> 4) & 0x3f];
- out[2] = (byte) S_BASE64CHAR[(i << 2) & 0x3f];
- out[3] = (byte) S_BASE64PAD;
- ostream.write(out, 0, 4);
- }
- }
-
- /**
- * Outputs base64 representation of the specified byte array to a character stream.
- */
- public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
- if (len <= 0) {
- return;
- }
- char[] out = new char[4];
- int rindex = off;
- int rest = len - off;
- int output = 0;
- while (rest >= 3) {
- int i =
- ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8)
- + (data[rindex + 2] & 0xff);
- out[0] = S_BASE64CHAR[i >> 18];
- out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];
- out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];
- out[3] = S_BASE64CHAR[i & 0x3f];
- writer.write(out, 0, 4);
- rindex += 3;
- rest -= 3;
- output += 4;
- if (output % 76 == 0) {
- writer.write("\n");
- }
- }
- if (rest == 1) {
- int i = data[rindex] & 0xff;
- out[0] = S_BASE64CHAR[i >> 2];
- out[1] = S_BASE64CHAR[(i << 4) & 0x3f];
- out[2] = S_BASE64PAD;
- out[3] = S_BASE64PAD;
- writer.write(out, 0, 4);
- } else if (rest == 2) {
- int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
- out[0] = S_BASE64CHAR[i >> 10];
- out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];
- out[2] = S_BASE64CHAR[(i << 2) & 0x3f];
- out[3] = S_BASE64PAD;
- writer.write(out, 0, 4);
- }
- }
- }
-
- /**
- * <p/>
- * Utility class for xs:hexbinary. </p>
- */
- public static final class HexBinary {
- private HexBinary() {
- }
-
- /**
- * Converts the string <code>pValue</code> into an array of hex bytes.
- */
- public static byte[] decode(String pValue) {
- if ((pValue.length() % 2) != 0) {
- throw new IllegalArgumentException("A HexBinary string must have even length.");
- }
- byte[] result = new byte[pValue.length() / 2];
- int j = 0;
- int i = 0;
- while (i < pValue.length()) {
- byte b;
- char c = pValue.charAt(i++);
- char d = pValue.charAt(i++);
- if (c >= '0' && c <= '9') {
- b = (byte) ((c - '0') << 4);
- } else if (c >= 'A' && c <= 'F') {
- b = (byte) ((c - 'A' + 10) << 4);
- } else if (c >= 'a' && c <= 'f') {
- b = (byte) ((c - 'a' + 10) << 4);
- } else {
- throw new IllegalArgumentException("Invalid hex digit: " + c);
- }
- if (d >= '0' && d <= '9') {
- b += (byte) (d - '0');
- } else if (d >= 'A' && d <= 'F') {
- b += (byte) (d - 'A' + 10);
- } else if (d >= 'a' && d <= 'f') {
- b += (byte) (d - 'a' + 10);
- } else {
- throw new IllegalArgumentException("Invalid hex digit: " + d);
- }
- result[j++] = b;
- }
- return result;
- }
-
- /**
- * Converts the byte array <code>pHexBinary</code> into a string.
- */
- public static String encode(byte[] pHexBinary) {
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < pHexBinary.length; i++) {
- byte b = pHexBinary[i];
- byte c = (byte) ((b & 0xf0) >> 4);
- if (c <= 9) {
- result.append((char) ('0' + c));
- } else {
- result.append((char) ('A' + c - 10));
- }
- c = (byte) (b & 0x0f);
- if (c <= 9) {
- result.append((char) ('0' + c));
- } else {
- result.append((char) ('A' + c - 10));
- }
- }
- return result.toString();
- }
-
- /**
- * Creates a clone of the given byte array.
- */
- public static byte[] getClone(byte[] pHexBinary) {
- byte[] result = new byte[pHexBinary.length];
- System.arraycopy(pHexBinary, 0, result, 0, pHexBinary.length);
- return result;
- }
- }
-
- public class XSDDateFormat extends XSDDateTimeFormat {
- private static final long serialVersionUID = -1629412916827246627L;
-
- /**
- * Creates a new instance.
- */
- public XSDDateFormat() {
- super(true, false);
- }
- }
-
- /**
- * <p/>
- * An instance of {@link java.text.Format}, which may be used to parse and format <code>xs:dateTime</code> values.
- * </p>
- */
- public static class XSDDateTimeFormat extends Format {
- private static final long serialVersionUID = -1148332471737068969L;
-
- final boolean parseDate;
-
- final boolean parseTime;
-
- /**
- * Creates a new instance.
- */
- public XSDDateTimeFormat() {
- this(true, true);
- }
-
- XSDDateTimeFormat(boolean pParseDate, boolean pParseTime) {
- parseDate = pParseDate;
- parseTime = pParseTime;
- }
-
- private void append(StringBuffer pBuffer, int pNum, int pMinLen) {
- String s = Integer.toString(pNum);
- for (int i = s.length(); i < pMinLen; i++) {
- pBuffer.append('0');
- }
- pBuffer.append(s);
- }
-
- @Override
- public StringBuffer format(Object pCalendar, StringBuffer pBuffer, FieldPosition pPos) {
- assert pCalendar != null : "The Calendar argument must not be null.";
- assert pBuffer != null : "The StringBuffer argument must not be null.";
- assert pPos != null : "The FieldPosition argument must not be null.";
-
- Calendar cal = (Calendar) pCalendar;
- if (parseDate) {
- int year = cal.get(Calendar.YEAR);
- if (year < 0) {
- pBuffer.append('-');
- year = -year;
- }
- append(pBuffer, year, 4);
- pBuffer.append('-');
- append(pBuffer, cal.get(Calendar.MONTH) + 1, 2);
- pBuffer.append('-');
- append(pBuffer, cal.get(Calendar.DAY_OF_MONTH), 2);
- if (parseTime) {
- pBuffer.append('T');
- }
- }
- if (parseTime) {
- append(pBuffer, cal.get(Calendar.HOUR_OF_DAY), 2);
- pBuffer.append(':');
- append(pBuffer, cal.get(Calendar.MINUTE), 2);
- pBuffer.append(':');
- append(pBuffer, cal.get(Calendar.SECOND), 2);
- int millis = cal.get(Calendar.MILLISECOND);
- if (millis > 0) {
- pBuffer.append('.');
- append(pBuffer, millis, 3);
- }
- }
- TimeZone tz = cal.getTimeZone();
- // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
- int offset = cal.get(Calendar.ZONE_OFFSET);
- if (tz.inDaylightTime(cal.getTime())) {
- offset += cal.get(Calendar.DST_OFFSET);
- }
- if (offset == 0) {
- pBuffer.append('Z');
- } else {
- if (offset < 0) {
- pBuffer.append('-');
- offset = -offset;
- } else {
- pBuffer.append('+');
- }
- int minutes = offset / (60 * 1000);
- int hours = minutes / 60;
- minutes -= hours * 60;
- append(pBuffer, hours, 2);
- pBuffer.append(':');
- append(pBuffer, minutes, 2);
- }
- return pBuffer;
- }
-
- private int parseInt(String pString, int offset, StringBuffer pDigits) {
- int length = pString.length();
- int pOffset = offset;
- pDigits.setLength(0);
- while (pOffset < length) {
- char c = pString.charAt(pOffset);
- if (Character.isDigit(c)) {
- pDigits.append(c);
- ++pOffset;
- } else {
- break;
- }
- }
- return pOffset;
- }
-
- @Override
- public Object parseObject(String pString, ParsePosition pParsePosition) {
- assert pString != null : "The String argument must not be null.";
- assert pParsePosition != null : "The ParsePosition argument must not be null.";
- int offset = pParsePosition.getIndex();
- int length = pString.length();
-
- boolean isMinus = false;
- StringBuffer digits = new StringBuffer();
- int year = 0;
- int month = 0;
- int mday = 0;
- if (parseDate) {
- // Sign
- if (offset < length) {
- char c = pString.charAt(offset);
- if (c == '+') {
- ++offset;
- } else if (c == '-') {
- ++offset;
- isMinus = true;
- }
- }
-
- offset = parseInt(pString, offset, digits);
- if (digits.length() < 4) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- year = Integer.parseInt(digits.toString());
-
- if (offset < length && pString.charAt(offset) == '-') {
- ++offset;
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
-
- offset = parseInt(pString, offset, digits);
- if (digits.length() != 2) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- month = Integer.parseInt(digits.toString());
-
- if (offset < length && pString.charAt(offset) == '-') {
- ++offset;
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
-
- offset = parseInt(pString, offset, digits);
- if (digits.length() != 2) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- mday = Integer.parseInt(digits.toString());
-
- if (parseTime) {
- if (offset < length && pString.charAt(offset) == 'T') {
- ++offset;
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- }
- } else {
- year = month = mday = 0;
- }
-
- int hour = 0;
- int minute = 0;
- int second = 0;
- int millis = 0;
- if (parseTime) {
- offset = parseInt(pString, offset, digits);
- if (digits.length() != 2) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- hour = Integer.parseInt(digits.toString());
-
- if (offset < length && pString.charAt(offset) == ':') {
- ++offset;
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
-
- offset = parseInt(pString, offset, digits);
- if (digits.length() != 2) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- minute = Integer.parseInt(digits.toString());
-
- if (offset < length && pString.charAt(offset) == ':') {
- ++offset;
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
-
- offset = parseInt(pString, offset, digits);
- if (digits.length() != 2) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- second = Integer.parseInt(digits.toString());
-
- if (offset < length && pString.charAt(offset) == '.') {
- ++offset;
- offset = parseInt(pString, offset, digits);
- if (digits.length() > 0) {
- millis = Integer.parseInt(digits.toString());
- } else {
- millis = 0;
- }
- } else {
- millis = 0;
- }
- } else {
- hour = minute = second = millis = 0;
- }
-
- digits.setLength(0);
- digits.append("GMT");
- if (offset < length) {
- char c = pString.charAt(offset);
- if (c == 'Z') {
- // Ignore UTC, it is the default
- ++offset;
- } else if (c == '+' || c == '-') {
- digits.append(c);
- ++offset;
- for (int i = 0; i < 5; i++) {
- if (offset >= length) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- c = pString.charAt(offset);
- if ((i != 2 && Character.isDigit(c)) || (i == 2 && c == ':')) {
- digits.append(c);
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- ++offset;
- }
- }
- }
-
- Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
- cal.set(isMinus ? -year : year, parseDate ? month - 1 : month, mday, hour, minute, second);
- cal.set(Calendar.MILLISECOND, millis);
- pParsePosition.setIndex(offset);
- return cal;
- }
- }
-
- public static class XSDTimeFormat extends XSDDateTimeFormat {
- private static final long serialVersionUID = 1346506860724640517L;
-
- /**
- * Creates a new instance.
- */
- public XSDTimeFormat() {
- super(false, true);
- }
- }
-
- private static final long MAX_UNSIGNED_INT = (((long) Integer.MAX_VALUE) * 2) + 1;
-
- private static final int MAX_UNSIGNED_SHORT = Short.MAX_VALUE * 2 + 1;
-
- public String parseAnySimpleType(String value) {
- return value;
- }
-
- public byte[] parseBase64Binary(String value) {
- return Base64Binary.decode(value);
- }
-
- public boolean parseBoolean(String value) {
- return Boolean.valueOf(value).booleanValue();
- }
-
- public byte parseByte(String value) {
- return Byte.parseByte(value);
- }
-
- public Calendar parseDate(String value) {
- XSDDateFormat format = new XSDDateFormat();
- ParsePosition pos = new ParsePosition(0);
- Calendar cal = (Calendar) format.parseObject(value, pos);
- if (cal == null) {
- throw new IllegalArgumentException("Failed to parse date " + value + " at:"
- + value.substring(pos.getErrorIndex()));
- }
- return cal;
- }
-
- public Calendar parseDateTime(String value) {
- XSDDateTimeFormat format = new XSDDateTimeFormat();
- ParsePosition pos = new ParsePosition(0);
- Calendar cal = (Calendar) format.parseObject(value, pos);
- if (cal == null) {
- throw new IllegalArgumentException("Failed to parse dateTime " + value + " at:"
- + value.substring(pos.getErrorIndex()));
- }
- return cal;
- }
-
- public BigDecimal parseDecimal(String value) {
- return new BigDecimal(value);
- }
-
- public double parseDouble(String value) {
- if ("INF".equals(value)) {
- return Double.POSITIVE_INFINITY;
- } else if ("-INF".equals(value)) {
- return Double.NEGATIVE_INFINITY;
- } else if ("NaN".equals(value)) {
- return Double.NaN;
- } else {
- return Double.parseDouble(value);
- }
- }
-
- public Duration parseDuration(String pDuration) {
- try {
- return DatatypeFactory.newInstance().newDuration(pDuration);
- } catch (DatatypeConfigurationException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public float parseFloat(String value) {
- if ("INF".equals(value)) {
- return Float.POSITIVE_INFINITY;
- } else if ("-INF".equals(value)) {
- return Float.NEGATIVE_INFINITY;
- } else if ("NaN".equals(value)) {
- return Float.NaN;
- } else {
- return Float.parseFloat(value);
- }
- }
-
- public byte[] parseHexBinary(String value) {
- return HexBinary.decode(value);
- }
-
- public int parseInt(String value) {
- return Integer.parseInt(value);
- }
-
- public BigInteger parseInteger(String value) {
- return new BigInteger(value);
- }
-
- public long parseLong(String value) {
- return Long.parseLong(value);
- }
-
- public QName parseQName(String value, NamespaceContext context) {
- int offset = value.indexOf(':');
- String uri;
- String localName;
- switch (offset) {
- case -1:
- localName = value;
- uri = context.getNamespaceURI("");
- if (uri == null) {
- // Should not happen, indicates an error in the
- // NamespaceContext
- // implementation
- throw new IllegalArgumentException("The default prefix is not bound.");
- }
- break;
- case 0:
- throw new IllegalArgumentException("Default prefix must be indicated by not using a colon: "
- + value);
- default:
- String prefix = value.substring(0, offset);
- localName = value.substring(offset + 1);
- uri = context.getNamespaceURI(prefix);
- if (uri == null) {
- throw new IllegalArgumentException("The prefix " + prefix + " is not bound.");
- }
- }
- return new QName(uri, localName);
- }
-
- public short parseShort(String value) {
- return Short.parseShort(value);
- }
-
- public String parseString(String value) {
- return value;
- }
-
- public Calendar parseTime(String value) {
- XSDTimeFormat format = new XSDTimeFormat();
- ParsePosition pos = new ParsePosition(0);
- Calendar cal = (Calendar) format.parseObject(value, pos);
- if (cal == null) {
- throw new IllegalArgumentException("Failed to parse time " + value + " at:"
- + value.substring(pos.getErrorIndex()));
- }
- return cal;
- }
-
- public long parseUnsignedInt(String value) {
- long l = Long.parseLong(value);
- if (l < 0) {
- throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
- + ": result is negative");
- }
- if (l > MAX_UNSIGNED_INT) {
- throw new IllegalArgumentException("Failed to parse UnsignedInt " + value
- + ": result exceeds maximum value " + MAX_UNSIGNED_INT);
- }
- return l;
- }
-
- public int parseUnsignedShort(String value) {
- int i = Integer.parseInt(value);
- if (i < 0) {
- throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
- + ": result is negative");
- }
- if (i > MAX_UNSIGNED_SHORT) {
- throw new IllegalArgumentException("Failed to parse UnsignedShort " + value
- + ": result exceeds maximum value " + MAX_UNSIGNED_SHORT);
- }
- return i;
- }
-
- public String printAnySimpleType(String value) {
- return value;
- }
-
- public String printBase64Binary(byte[] value) {
- return Base64Binary.encode(value);
- }
-
- public String printBoolean(boolean value) {
- return (value ? Boolean.TRUE : Boolean.FALSE).toString();
- }
-
- public String printByte(byte value) {
- return Byte.toString(value);
- }
-
- public String printDate(Calendar value) {
- return new XSDDateFormat().format(value);
- }
-
- public String printDateTime(Calendar value) {
- return new XSDDateTimeFormat().format(value);
- }
-
- public String printDecimal(BigDecimal value) {
- return value.toString();
- }
-
- public String printDouble(double value) {
- return Double.toString(value);
- }
-
- public String printDuration(Duration pDuration) {
- return pDuration.toString();
- }
-
- public String printFloat(float value) {
- return Float.toString(value);
- }
-
- public String printHexBinary(byte[] value) {
- return HexBinary.encode(value);
- }
-
- public String printInt(int value) {
- return Integer.toString(value);
- }
-
- public String printInteger(BigInteger value) {
- return value.toString();
- }
-
- public String printLong(long value) {
- return Long.toString(value);
- }
-
- public String printQName(QName value, NamespaceContext context) {
- String prefix = context.getPrefix(value.getNamespaceURI());
- if (prefix == null) {
- throw new IllegalArgumentException("The namespace URI " + value.getNamespaceURI()
- + " is not bound.");
- } else if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
- return value.getLocalPart();
- } else {
- return prefix + ":" + value.getLocalPart();
- }
- }
-
- public String printShort(short value) {
- return Short.toString(value);
- }
-
- public String printString(String value) {
- return value;
- }
-
- public String printTime(Calendar value) {
- return new XSDTimeFormat().format(value);
- }
-
- public String printUnsignedInt(long value) {
- return Long.toString(value);
- }
-
- public String printUnsignedShort(int value) {
- return Integer.toString(value);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java
deleted file mode 100644
index 2f95c2a9c6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/DOMNode2JavaBeanTransformer.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Transformer to convert data from DOM Node to JavaBean
- *
- * @version $Rev$ $Date$
- */
-public class DOMNode2JavaBeanTransformer extends XML2JavaBeanTransformer<Node> {
-
- @Override
- public Node getRootElement(Node element) throws XML2JavaMapperException {
- if (element instanceof Document) {
- return ((Document)element).getDocumentElement();
- } else {
- return element;
- }
-
- }
-
- @Override
- public Iterator<Node> getChildElements(Node parent) throws XML2JavaMapperException {
- NodeList nodeList = parent.getChildNodes();
- List<Node> nodeArrayList = new ArrayList<Node>(nodeList.getLength());
- for (int count = 0; count < nodeList.getLength(); ++count) {
- nodeArrayList.add(nodeList.item(count));
- }
-
- return nodeArrayList.iterator();
- }
-
- @Override
- public String getElementName(Node element) throws XML2JavaMapperException {
- return element.getLocalName();
- }
-
- @Override
- public String getText(Node element) throws XML2JavaMapperException {
- if (element instanceof Document) {
- element = ((Document)element).getDocumentElement();
- }
- return element.getTextContent();
- }
-
- @Override
- public boolean isTextElement(Node element) throws XML2JavaMapperException {
- return element.getNodeType() == Node.TEXT_NODE;
- }
-
- @Override
- public boolean isTextOnly(Node element) throws XML2JavaMapperException {
- NodeList childNodes = element.getChildNodes();
- return childNodes.getLength() == 1 && isTextElement(childNodes.item(0));
- }
-
- @Override
- public Node getFirstChildWithName(Node element, QName name) throws XML2JavaMapperException {
- Node child;
- for (child = element.getFirstChild();
- child != null && !(child.getNodeName() == name.getLocalPart()
- && child.getNamespaceURI() == name.getNamespaceURI()) ;
- child = child.getNextSibling()) {
- }
- return child;
- }
-
- @Override
- public Class getSourceType() {
- return Node.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java
deleted file mode 100644
index 9615f43572..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/Java2XMLMapperException.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import javax.xml.namespace.QName;
-
-/**
- * This exception is used to encapsulate and rethrow exceptions that arise out
- * of converting JavaBean objects to XML
- *
- * @version $Rev$ $Date$
- */
-public class Java2XMLMapperException extends RuntimeException {
- private static final long serialVersionUID = 6811924384399578686L;
-
- private QName xmlElementName;
- private String javaFieldName;
- private Class javaType;
-
- public Java2XMLMapperException(String message) {
- super(message);
- }
-
- public Java2XMLMapperException(Throwable cause) {
- super(cause);
- }
-
- public String getJavaFieldName() {
- return javaFieldName;
- }
-
- public void setJavaFieldName(String javaFieldName) {
- this.javaFieldName = javaFieldName;
- }
-
- public Class getJavaType() {
- return javaType;
- }
-
- public void setJavaType(Class javaType) {
- this.javaType = javaType;
- }
-
- public QName getXmlElementName() {
- return xmlElementName;
- }
-
- public void setXmlElementName(QName xmlElementName) {
- this.xmlElementName = xmlElementName;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java
deleted file mode 100644
index 58f594751a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2DOMNodeTransformer.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transformer to convert data from a JavaBean object to DOM Node
- *
- * @version $Rev$ $Date$
- */
-public class JavaBean2DOMNodeTransformer extends JavaBean2XMLTransformer<Node> {
-
- public static final String COLON = ":";
- private Document factory;
-
- public JavaBean2DOMNodeTransformer() {
- super();
- try {
- factory = DOMHelper.newDocument();
- } catch (ParserConfigurationException e) {
- throw new Java2XMLMapperException(e);
- }
- }
-
- @Override
- public void appendChild(Node parentElement, Node childElement) throws Java2XMLMapperException {
- parentElement.appendChild(childElement);
- }
-
- @Override
- public Node createElement(QName qName) throws Java2XMLMapperException {
- String qualifedName =
- (qName.getPrefix() == null || qName.getPrefix().length() <= 0) ? qName.getLocalPart()
- : qName.getPrefix() + COLON + qName.getLocalPart();
- return factory.createElementNS(qName.getNamespaceURI(), qualifedName);
- }
-
- @Override
- public void appendText(Node parentElement, String textData) throws Java2XMLMapperException {
- Node textNode;
- if (textData != null) {
- textNode = factory.createTextNode(textData);
- } else {
- Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
- nil.setValue("true");
- textNode = nil;
- }
- appendChild(parentElement, textNode);
- }
-
- @Override
- public Class getTargetType() {
- return Node.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.java
deleted file mode 100644
index 4942fef0da..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLStreamReaderTransformer.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.databinding.javabeans;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.xml.BeanXMLStreamReaderImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Transformer to convert data from a JavaBean object to XMLStreamReader.
- *
- * @version $Rev$ $Date$
- */
-public class JavaBean2XMLStreamReaderTransformer extends BaseTransformer<Object, XMLStreamReader> implements
- PullTransformer<Object, XMLStreamReader> {
-
- public XMLStreamReader transform(Object source, TransformationContext context) {
- try {
- javax.xml.namespace.QName name = null;
- if (context != null) {
- Object logical = context.getSourceDataType().getLogical();
- if (logical instanceof XMLType) {
- name = ((XMLType)logical).getElementName();
- }
- }
- return new BeanXMLStreamReaderImpl(name, source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Object> getSourceType() {
- return Object.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.java
deleted file mode 100644
index b96b394bb8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBean2XMLTransformer.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.databinding.javabeans;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.xml.datatype.XMLGregorianCalendar;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Transformer to convert data from a JavaBean object to xml
- *
- * @version $Rev$ $Date$
- */
-public abstract class JavaBean2XMLTransformer<T> extends BaseTransformer<Object, T> implements
- PullTransformer<Object, T> {
-
- public static final String GET = "get";
- public static final String PREFIX = "n";
- public static final String PERIOD = ".";
- public static final String FWD_SLASH = "/";
- public static final String HTTP = "http://";
- private static int prefixCount = 1;
-
- protected SimpleTypeMapperImpl mapper;
-
- public JavaBean2XMLTransformer() {
- this.mapper = new SimpleTypeMapperImpl();
- }
-
- public T transform(Object source, TransformationContext context) {
- QName rootElement = null;
- if (context != null) {
- DataType<?> type = context.getTargetDataType();
- if (type != null) {
- Object logical = type.getLogical();
- if (logical instanceof XMLType) {
- rootElement = ((XMLType)logical).getElementName();
- }
- }
- }
- //FIXME See how/if we still need to get the metadata here
- //QName rootElementName = (QName)context.getTargetDataType().getMetadata("RootElementName");
- //if (rootElementName == null) {
- QName rootElementName = new QName(resolveRootElementName(source.getClass()));
- //}
-
- T root = createElement(rootElementName);
- appendChildElements(root, resolveElementName(source.getClass()), source.getClass(), source, context);
- return root;
- }
-
- private void appendChildElements(T parent,
- QName elementName,
- Class javaType,
- Object javaObject,
- TransformationContext context) {
- T element = null;
- if (javaObject != null) {
- if (javaType.isPrimitive() || isSimpleJavaType(javaObject)) {
- appendText(parent, mapper.toXMLLiteral(null, javaObject, context));
- } else if (javaType.isArray()) {
- int size = Array.getLength(javaObject);
- for (int count = 0; count < size; ++count) {
- Object item = Array.get(javaObject, count);
- element = createElement(elementName);
- appendChild(parent, element);
- appendChildElements(element, elementName, javaType.getComponentType(), item, context);
- }
- } else {
- Field[] javaFields = javaType.getFields();
- for (Field aField : javaFields) {
- try {
- QName fieldElementName = new QName(aField.getName());
- if (!aField.getType().isArray()) {
- element = createElement(fieldElementName);
- appendChild(parent, element);
- appendChildElements(element,
- fieldElementName,
- aField.getType(),
- aField.get(javaObject),
- context);
- } else {
- appendChildElements(parent,
- fieldElementName,
- aField.getType(),
- aField.get(javaObject),
- context);
- }
- } catch (IllegalAccessException e) {
- Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
- java2xmlEx.setJavaFieldName(aField.getName());
- java2xmlEx.setJavaType(javaType);
- throw java2xmlEx;
- }
- }
-
- Method[] methods = javaType.getMethods();
- String fieldName = null;
- for (Method aMethod : methods) {
- try {
- if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET)
- && aMethod.getParameterTypes().length == 0
- && isMappedGetter(aMethod.getName())) {
- fieldName = resolveFieldFromMethod(aMethod.getName());
- try {
- javaType.getField(fieldName);
- } catch (NoSuchFieldException e) {
- QName fieldElementName = new QName(fieldName);
- if (aMethod.getReturnType().isArray()) {
- appendChildElements(parent, fieldElementName, aMethod.getReturnType(), aMethod
- .invoke(javaObject, new Object[0]), context);
- } else {
- element = createElement(fieldElementName);
- appendChild(parent, element);
- appendChildElements(element, fieldElementName, aMethod.getReturnType(), aMethod
- .invoke(javaObject, new Object[0]), context);
- }
- }
- }
- } catch (IllegalAccessException e) {
- Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
- java2xmlEx.setJavaFieldName(fieldName);
- java2xmlEx.setJavaType(javaType);
- throw java2xmlEx;
- } catch (InvocationTargetException e) {
- Java2XMLMapperException java2xmlEx = new Java2XMLMapperException(e);
- java2xmlEx.setJavaFieldName(fieldName);
- java2xmlEx.setJavaType(javaType);
- throw java2xmlEx;
- }
- }
- }
- }
- }
-
- /*
- * Subclasses can override this method to prevent some getter methods
- * from being mapped. The default implementation provided by this class
- * maps all getter methods.
- */
- protected boolean isMappedGetter(String methodName) {
- return true;
- }
-
- @Override
- public String getSourceDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-
- @Override
- public Class<Object> getSourceType() {
- return Object.class;
- }
-
- private boolean isSimpleJavaType(Object javaObject) {
- if (javaObject instanceof String) {
- return true;
- }
- if (javaObject instanceof Byte || javaObject instanceof Character
- || javaObject instanceof Short
- || javaObject instanceof Integer
- || javaObject instanceof Long
- || javaObject instanceof Float
- || javaObject instanceof Double
- || javaObject instanceof Boolean) {
- return true;
- }
- if (javaObject instanceof GregorianCalendar || javaObject instanceof Date
- || javaObject instanceof XMLGregorianCalendar
- || javaObject instanceof byte[]
- || javaObject instanceof QName) {
- return true;
- }
- return false;
- }
-
- private String resolveRootElementName(Class javaType) {
- if (javaType.isArray()) {
- return javaType.getComponentType().getSimpleName() + "_collection";
- } else {
- return javaType.getSimpleName() + "_instance";
- }
- }
-
- private QName resolveElementName(Class javaType) {
- if (javaType.isArray()) {
- return new QName(javaType.getComponentType().getSimpleName());
- } else {
- return new QName(javaType.getSimpleName());
- }
- }
-
- private String resolveFieldFromMethod(String methodName) {
- StringBuffer fieldName = new StringBuffer();
- fieldName.append(Character.toLowerCase(methodName.charAt(GET.length())));
- fieldName.append(methodName.substring(GET.length() + 1));
- return fieldName.toString();
- }
-
- public String getNexPrefix() {
- return PREFIX + prefixCount++;
- }
-
- @Override
- public int getWeight() {
- return JavaBeansDataBinding.HEAVY_WEIGHT;
- }
-
- /**
- * Create an element with the given name
- * @param qName
- * @return
- * @throws Java2XMLMapperException
- */
- public abstract T createElement(QName qName) throws Java2XMLMapperException;
-
- /**
- * Create a text node and add it to the parent
- * @param parentElement
- * @param textData
- * @throws Java2XMLMapperException
- */
- public abstract void appendText(T parentElement, String textData) throws Java2XMLMapperException;
-
- /**
- * Add the child element to the parent
- * @param parentElement
- * @param childElement
- * @throws Java2XMLMapperException
- */
- public abstract void appendChild(T parentElement, T childElement) throws Java2XMLMapperException;
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
deleted file mode 100644
index 9ee3c1f7d5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-import java.io.OutputStream;
-import java.io.Serializable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * DataBinding for JavaBeans
- *
- * @version $Rev$ $Date$
- */
-public class JavaBeansDataBinding extends BaseDataBinding {
- private final static Logger logger = Logger.getLogger(JavaBeansDataBinding.class.getName());
- /**
- * Defining a weight to a very high number so that the transformer won't be picked
- * up by other paths unless it's the only available path
- */
- public static final int HEAVY_WEIGHT = 10000;
- public static final String NAME = "java:complexType";
-
- public JavaBeansDataBinding() {
- super(NAME, Object.class);
- }
-
- protected JavaBeansDataBinding(String name, Class<?> baseType) {
- super(name, baseType);
- }
-
- @Override
- public Object copy(Object arg, DataType dataType, Operation operation) {
- if (arg == null) {
- return null;
- }
- final Class<?> clazz = arg.getClass();
- if (String.class == clazz || clazz.isPrimitive()
- || Number.class.isAssignableFrom(clazz)
- || Boolean.class.isAssignableFrom(clazz)
- || Character.class.isAssignableFrom(clazz)
- || Byte.class.isAssignableFrom(clazz)) {
- // Immutable classes
- return arg;
- }
- try {
- if (arg instanceof Serializable) {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- ObjectOutputStream oos = getObjectOutputStream(bos);
- oos.writeObject(arg);
- oos.close();
- bos.close();
-
- // Work out which ClassLoader to use for deserializing arg
- // We want to use:
- // * The ClassLoader of arg if it is not the System ClassLoader
- // * The ThreadContext ClassLoader if the ClassLoader of arg is the System ClassLoader
- // because Collection classes are loaded by the System ClassLoader but their contents
- // may be loaded from another ClassLoader
- //
- ClassLoader classLoaderToUse = clazz.getClassLoader();
- if (classLoaderToUse == null)
- {
- // ClassLoader of arg is the System ClassLoader so we will use the ThreadContext ClassLoader
- // instead
- classLoaderToUse = Thread.currentThread().getContextClassLoader();
- }
-
- ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
- ObjectInputStream ois = getObjectInputStream(bis, classLoaderToUse);
- Object objectCopy = ois.readObject();
- ois.close();
- bis.close();
- return objectCopy;
- } else if (arg instanceof Cloneable) {
- Method clone;
- try {
- clone = arg.getClass().getMethod("clone");
- try {
- return clone.invoke(arg, (Object[])null);
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CloneNotSupportedException) {
- // Ignore
- } else {
- throw new ServiceRuntimeException(e);
- }
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- } catch (NoSuchMethodException e) {
- // Ignore it
- }
- }
- // return arg;
- logger.warning("Argument type '" + arg.getClass().getName()
- + "' is not Serializable or Cloneable. Pass-by-value is skipped.");
- return arg;
- } catch (Exception e) {
- throw new IllegalArgumentException("Pass-by-value is not supported for the given object: " + arg.getClass()
- .getName(), e);
- }
- }
-
- protected ObjectOutputStream getObjectOutputStream(OutputStream os) throws IOException {
- return new ObjectOutputStream(os);
- }
-
- protected ObjectInputStream getObjectInputStream(InputStream is, final ClassLoader cl) throws IOException {
- ObjectInputStream ois = new ObjectInputStream(is) {
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
- try {
- return Class.forName(desc.getName(), false, cl);
- } catch (ClassNotFoundException e) {
- try {
- // For OSGi, use context ClassLoader if the bundle ClassLoader cannot load the class
- if (cl != Thread.currentThread().getContextClassLoader()) {
- return Class.forName(desc.getName(), false, Thread.currentThread().getContextClassLoader());
- }
- } catch (ClassNotFoundException e1) {
- // ignore
- } catch (NoClassDefFoundError e1) {
- // ignore
- }
- return super.resolveClass(desc);
- }
- }
-
- };
- return ois;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.java
deleted file mode 100644
index 7ae64c6a27..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaExceptionDataBinding.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.databinding.javabeans;
-
-
-/**
- * DataBinding for Java Exceptions
- *
- * @version $Rev$ $Date$
- */
-public class JavaExceptionDataBinding extends JavaBeansDataBinding {
-
- public static final String NAME = "java:exception";
-
- public JavaExceptionDataBinding() {
- super(NAME, null);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java
deleted file mode 100644
index 61a2189c72..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/SimpleJavaDataBinding.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.javabeans;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * DataBinding for Java simple types
- *
- * @version $Rev$ $Date$
- */
-public class SimpleJavaDataBinding extends BaseDataBinding {
- public static final String NAME = "java:simpleType";
-
- public SimpleJavaDataBinding() {
- super(NAME, Object.class);
- }
-
- @Override
- public Object copy(Object arg, DataType dataType, Operation operation) {
- if (arg instanceof byte[]) {
- return ((byte[])arg).clone();
- }
- return arg;
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- Class<?> cls = type.getPhysical();
- if (cls == Object.class) {
- return false;
- }
- // HACK: [rfeng] By pass the one know to XMLString
- String db = type.getDataBinding();
- if (db != null && (XMLStringDataBinding.NAME.equals(db))) {
- return false;
- }
- if (SimpleTypeMapperImpl.JAVA2XML.keySet().contains(cls)) {
- type.setDataBinding(NAME);
- QName elementName = null;
- Object logical = type.getLogical();
- if (logical instanceof XMLType) {
- elementName = ((XMLType)logical).getElementName();
- }
- TypeInfo typeInfo = SimpleTypeMapperImpl.getXMLType(cls);
- type.setLogical(new XMLType(elementName, typeInfo == null ? null : typeInfo.getQName()));
- return true;
- } else {
- return false;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
deleted file mode 100644
index 06feeffabd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaBeanTransformer.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Transformer to convert data from XML to JavaBean
- *
- * @version $Rev$ $Date$
- */
-public abstract class XML2JavaBeanTransformer<T> extends BaseTransformer<T, Object> implements
- PullTransformer<T, Object> {
-
- public static final String SET = "set";
- public static final QName QNAME_MESSAGE = new QName("message");
-
- protected SimpleTypeMapperImpl mapper;
-
- public XML2JavaBeanTransformer() {
- this.mapper = new SimpleTypeMapperImpl();
- }
-
- @Override
- public int getWeight() {
- return JavaBeansDataBinding.HEAVY_WEIGHT;
- }
-
- public Object transform(T source, TransformationContext context) {
- //FIXME why is the logical type sometimes a Class instead of an XMLType?
- if (context.getSourceDataType().getLogical() instanceof XMLType) {
- XMLType xmlType = (XMLType) context.getSourceDataType().getLogical();
- return toJavaObject(xmlType.getTypeName(), getRootElement(source), context);
- } else {
- return toJavaObject(null, getRootElement(source), context);
- }
- }
-
- public Object toJavaObject(QName xmlType, T xmlElement, TransformationContext context) {
- if (xmlType != null && SimpleTypeMapperImpl.isSimpleXSDType(xmlType)) {
- return mapper.toJavaObject(xmlType, getText(xmlElement), context);
- } else {
- Class<?> javaType = (Class<?>)context.getTargetDataType().getPhysical();
- return createJavaObject(xmlElement, javaType, context);
- }
- }
-
- @SuppressWarnings("unchecked")
- private <L> L createJavaObject(T element, Class<L> javaType, TransformationContext context)
- throws XML2JavaMapperException {
- if (isTextOnly(element)) {
- return (L) mapper.toJavaObject(SimpleTypeMapperImpl.getXMLType(javaType).getQName(),
- getText(element),
- context);
- } else {
- String fieldName = null;
- try {
- L javaInstance;
- T detailMsg = null;
- if (Throwable.class.isAssignableFrom(javaType)) {
- T msgElement = getFirstChildWithName(element, QNAME_MESSAGE);
- if (msgElement != null && isTextOnly(msgElement)) {
- detailMsg = msgElement; // skip this when handling child elements
- Constructor constructor = javaType.getConstructor(new Class[] {String.class});
- javaInstance = (L)constructor.newInstance(new Object[] {getText(detailMsg)});
- } else {
- javaInstance = javaType.newInstance();
- }
- } else {
- javaInstance = javaType.newInstance();
- }
- Map<Field, List<Object>> arrayFields = new Hashtable<Field, List<Object>>();
- Map<Method, List<Object>> arraySetters = new Hashtable<Method, List<Object>>();
-
- for (Iterator<T> childElements = getChildElements(element); childElements.hasNext(); ) {
- T childElement = childElements.next();
- if (!isTextElement(childElement) && childElement != detailMsg) {
- fieldName = getElementName(childElement);
- try {
- Field javaField = javaType.getField(fieldName);
- setFieldValue(javaInstance,
- javaField,
- childElement,
- arrayFields,
- context);
-
- } catch (NoSuchFieldException e1) {
- setFieldValueUsingSetter(javaType,
- javaInstance,
- fieldName,
- childElement,
- arraySetters,
- context);
- }
- }
- }
-
- setArrayValues(javaInstance, arrayFields, arraySetters);
- return javaInstance;
- } catch (Exception e2) {
- XML2JavaMapperException xml2JavaEx = new XML2JavaMapperException(e2);
- xml2JavaEx.setJavaType(javaType);
- xml2JavaEx.setJavaFieldName(fieldName);
- throw xml2JavaEx;
- }
- }
- }
-
- private void setFieldValue(Object javaInstance,
- Field javaField,
- T fieldValue,
- Map<Field, List<Object>> arrayFields,
- TransformationContext context) throws IllegalAccessException {
- Class<?> javaFieldType = (Class<?>) javaField.getType();
-
- if (javaFieldType.isArray()) {
- Class<?> componentType = javaFieldType.getComponentType();
- List<Object> fldValueArray = arrayFields.get(javaField);
- if (fldValueArray == null) {
- fldValueArray = new ArrayList<Object>();
- arrayFields.put(javaField, fldValueArray);
- }
- fldValueArray.add(createJavaObject(fieldValue, componentType, context));
- } else {
- javaField.setAccessible(true);
- javaField.set(javaInstance, createJavaObject(fieldValue, javaFieldType, context));
- }
- }
-
- private void setFieldValueUsingSetter(Class javaType,
- Object javaInstance,
- String fieldName,
- T fieldValue,
- Map<Method, List<Object>> arraySetters,
- TransformationContext context) throws IllegalAccessException,
- InvocationTargetException {
- char firstChar = Character.toUpperCase(fieldName.charAt(0));
- StringBuilder methodName = new StringBuilder(SET + fieldName);
- methodName.setCharAt(SET.length(), firstChar);
- boolean methodNotFound = true;
-
- for (int methodCount = 0; methodNotFound && methodCount < javaType.getMethods().length; ++methodCount) {
- Method aMethod = javaType.getMethods()[methodCount];
- if (aMethod.getName().equals(methodName.toString())
- && aMethod.getParameterTypes().length == 1) {
- Class<?> paramType = aMethod.getParameterTypes()[0];
-
- if (paramType.isArray()) {
- Class<?> componentType = paramType.getComponentType();
- List<Object> setterValueArray = arraySetters.get(aMethod);
- if (setterValueArray == null) {
- setterValueArray = new ArrayList<Object>();
- arraySetters.put(aMethod, setterValueArray);
- }
- setterValueArray.add(createJavaObject(fieldValue, componentType, context));
- } else {
- aMethod.invoke(javaInstance, new Object[] {createJavaObject(fieldValue,
- paramType,
- context)});
- }
- methodNotFound = false;
- }
- }
-
- if (methodNotFound) {
- XML2JavaMapperException xml2JavaEx =
- new XML2JavaMapperException("No field or setter method to configure xml data");
- xml2JavaEx.setJavaFieldName(fieldName);
- xml2JavaEx.setJavaType(javaType);
- throw xml2JavaEx;
- }
- }
-
- private void setArrayValues(Object javaInstance,
- Map<Field, List<Object>> arrayFields,
- Map<Method, List<Object>> arraySetters) throws IllegalAccessException,
- InvocationTargetException {
- if (arrayFields.size() > 0) {
- for (Field javaField : arrayFields.keySet()) {
- javaField.setAccessible(true);
-
- if (javaField.getType().getComponentType().isPrimitive()) {
- javaField.set(javaInstance, createPrimitiveArray(javaField.getType()
- .getComponentType(),
- arrayFields.get(javaField)));
- } else {
- javaField.set(javaInstance,
- createNonPrimitiveArray(javaField.getType().getComponentType(),
- arrayFields.get(javaField)));
- }
- }
- }
-
- if (arraySetters.size() > 0) {
- for (Method aMethod : arraySetters.keySet()) {
- Class paramType = aMethod.getParameterTypes()[0];
- if (paramType.getComponentType().isPrimitive()) {
- aMethod.invoke(javaInstance,
- new Object[] {createPrimitiveArray(paramType.getComponentType(),
- arraySetters.get(aMethod))});
- } else {
- aMethod.invoke(javaInstance,
- new Object[] {createNonPrimitiveArray(paramType.getComponentType(),
- arraySetters.get(aMethod))});
- }
- }
- }
- }
-
- private Object createNonPrimitiveArray(Class fieldType, List values) {
- Object objectArray = Array.newInstance(fieldType, values.size());
- for (int count = 0; count < values.size(); ++count) {
- Array.set(objectArray, count, values.get(count));
- }
- return objectArray;
- }
-
- private Object createPrimitiveArray(Class fieldType, List values) {
- if (fieldType.isPrimitive()) {
- if (fieldType.getName().equals("int")) {
- int[] primitiveValues = new int[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Integer) values.get(count)).intValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("float")) {
- float[] primitiveValues = new float[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Float) values.get(count)).floatValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("boolean")) {
- boolean[] primitiveValues = new boolean[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Boolean) values.get(count)).booleanValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("char")) {
- char[] primitiveValues = new char[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Character) values.get(count)).charValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("byte")) {
- byte[] primitiveValues = new byte[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Byte) values.get(count)).byteValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("short")) {
- short[] primitiveValues = new short[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Short) values.get(count)).shortValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("long")) {
- long[] primitiveValues = new long[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Long) values.get(count)).longValue();
- }
- return primitiveValues;
- } else if (fieldType.getName().equals("double")) {
- double[] primitiveValues = new double[values.size()];
- for (int count = 0; count < values.size(); ++count) {
- primitiveValues[count] = ((Double) values.get(count)).doubleValue();
- }
- return primitiveValues;
- }
- }
- return values;
- }
-
- public abstract String getText(T source) throws XML2JavaMapperException;
-
- public abstract Iterator<T> getChildElements(T parent) throws XML2JavaMapperException;
-
- public abstract String getElementName(T element) throws XML2JavaMapperException;
-
- public abstract boolean isTextElement(T element) throws XML2JavaMapperException;
-
- public abstract boolean isTextOnly(T element) throws XML2JavaMapperException;
-
- public abstract T getFirstChildWithName(T element, QName name) throws XML2JavaMapperException;
-
- public abstract T getRootElement(T element) throws XML2JavaMapperException;
-
- @Override
- public Class<Object> getTargetType() {
- return Object.class;
- }
-
- @Override
- public String getTargetDataBinding() {
- return JavaBeansDataBinding.NAME;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java
deleted file mode 100644
index a723fd445c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/XML2JavaMapperException.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.javabeans;
-
-import javax.xml.namespace.QName;
-
-/**
- * This exception is used to encapsulate and rethrow exceptions that arise out
- * of converting XML Data to Java Objects.
- *
- * @version $Rev$ $Date$
- */
-public class XML2JavaMapperException extends RuntimeException {
- private static final long serialVersionUID = 6596530102591630642L;
-
- private QName xmlElementName;
- private String javaFieldName;
- private Class javaType;
-
- public XML2JavaMapperException(String message) {
- super(message);
- }
-
- public XML2JavaMapperException(Throwable cause) {
- super(cause);
- }
-
- public QName getXmlElementName() {
- return xmlElementName;
- }
-
- public void setXmlElementName(QName xmlElementName) {
- this.xmlElementName = xmlElementName;
- }
-
- public String getJavaFieldName() {
- return javaFieldName;
- }
-
- public void setJavaFieldName(String javaFieldName) {
- this.javaFieldName = javaFieldName;
- }
-
- public Class getJavaType() {
- return javaType;
- }
-
- public void setJavaType(Class javaType) {
- this.javaType = javaType;
- }
-
- @Override
- public String getMessage() {
- return super.getMessage() + " <" + getJavaFieldName() + "> " + " in <" + getJavaType() + ">";
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java
deleted file mode 100644
index ce3237a574..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/DataTypeHelper.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.util;
-
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataTypeHelper {
- private DataTypeHelper() {
- }
-
- /**
- * Find all classes referenced by this data type though java generics
- * @param d
- * @return
- */
- public static Set<Class<?>> findClasses(DataType d) {
- Set<Class<?>> classes = new HashSet<Class<?>>();
- Set<Type> visited = new HashSet<Type>();
- findClasses(d, classes, visited);
- return classes;
- }
-
- private static void findClasses(DataType d, Set<Class<?>> classes, Set<Type> visited) {
- if (d == null) {
- return;
- }
- classes.add(d.getPhysical());
- if (d.getPhysical() != d.getGenericType()) {
- findClasses(d.getGenericType(), classes, visited);
- }
- }
-
- /**
- * Find referenced classes in the generic type
- * @param type
- * @param classSet
- * @param visited
- */
- private static void findClasses(Type type, Set<Class<?>> classSet, Set<Type> visited) {
- if (visited.contains(type) || type == null) {
- return;
- }
- visited.add(type);
- if (type instanceof Class) {
- Class<?> cls = (Class<?>)type;
- if (!cls.isInterface()) {
- classSet.add(cls);
- }
- return;
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- findClasses(pType.getRawType(), classSet, visited);
- for (Type t : pType.getActualTypeArguments()) {
- findClasses(t, classSet, visited);
- }
- } else if (type instanceof TypeVariable) {
- TypeVariable<?> tv = (TypeVariable<?>)type;
- for (Type t : tv.getBounds()) {
- findClasses(t, classSet, visited);
- }
- } else if (type instanceof GenericArrayType) {
- GenericArrayType gType = (GenericArrayType)type;
- findClasses(gType, classSet, visited);
- } else if (type instanceof WildcardType) {
- WildcardType wType = (WildcardType)type;
- for (Type t : wType.getLowerBounds()) {
- findClasses(t, classSet, visited);
- }
- for (Type t : wType.getUpperBounds()) {
- findClasses(t, classSet, visited);
- }
- }
- }
-
- /**
- * Get all the data types in the interface
- * @param intf The interface
- * @param useWrapper Use wrapper classes?
- * @return A list of DataTypes
- */
- public static List<DataType> getDataTypes(Interface intf, boolean useWrapper) {
- List<DataType> dataTypes = new ArrayList<DataType>();
- for (Operation op : intf.getOperations()) {
- getDataTypes(dataTypes, op, useWrapper);
- }
- return dataTypes;
- }
-
- /**
- * Get all the data types in the operation
- * @param op The operaiton
- * @param useWrapper Use wrapper classes?
- * @return A list of DataTypes
- */
- public static List<DataType> getDataTypes(Operation op, boolean useWrapper) {
- List<DataType> dataTypes = new ArrayList<DataType>();
- getDataTypes(dataTypes, op, useWrapper);
- return dataTypes;
- }
-
- private static void getDataTypes(List<DataType> dataTypes, Operation op, boolean useWrapper) {
-
- WrapperInfo inputWrapperInfo = op.getInputWrapper();
- WrapperInfo outputWrapperInfo = op.getOutputWrapper();
-
- if (useWrapper && (inputWrapperInfo != null) && (outputWrapperInfo != null)) {
- DataType dt1 = inputWrapperInfo.getWrapperType();
- if (dt1 != null) {
- dataTypes.add(dt1);
- }
- DataType dt2 = outputWrapperInfo.getWrapperType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- }
- // FIXME: [rfeng] We may need to find the referenced classes in the child types
- // else
- {
- for (DataType dt1 : op.getInputType().getLogical()) {
- dataTypes.add(dt1);
- }
- DataType dt2 = op.getOutputType();
- if (dt2 != null) {
- dataTypes.add(dt2);
- }
- }
- for (DataType<DataType> dt3 : op.getFaultTypes()) {
- DataType dt4 = dt3.getLogical();
- if (dt4 != null) {
- dataTypes.add(dt4);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.java
deleted file mode 100644
index 34a82fd2d3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/util/LRUCache.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.databinding.util;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/**
- * A Simple LRU Cache
- *
- * @version $Revision$
- * @param <K>
- * @param <V>
- */
-
-public class LRUCache<K, V> extends LinkedHashMap<K, V> {
- private static final long serialVersionUID = -342098639681884413L;
- protected int maxCacheSize = 4096;
-
- /**
- * Default constructor for an LRU Cache The default capacity is 10000
- */
- public LRUCache() {
- this(0, 4096, 0.75f, true);
- }
-
- /**
- * Constructs a LRUCache with a maximum capacity
- *
- * @param maximumCacheSize
- */
- public LRUCache(int maximumCacheSize) {
- this(0, maximumCacheSize, 0.75f, true);
- }
-
- /**
- * Constructs an empty <tt>LRUCache</tt> instance with the specified
- * initial capacity, maximumCacheSize,load factor and ordering mode.
- *
- * @param initialCapacity the initial capacity.
- * @param maximumCacheSize
- * @param loadFactor the load factor.
- * @param accessOrder the ordering mode - <tt>true</tt> for access-order,
- * <tt>false</tt> for insertion-order.
- * @throws IllegalArgumentException if the initial capacity is negative or
- * the load factor is non-positive.
- */
-
- public LRUCache(int initialCapacity, int maximumCacheSize, float loadFactor, boolean accessOrder) {
- super(initialCapacity, loadFactor, accessOrder);
- this.maxCacheSize = maximumCacheSize;
- }
-
- /**
- * @return Returns the maxCacheSize.
- */
- public int getMaxCacheSize() {
- return maxCacheSize;
- }
-
- /**
- * @param maxCacheSize The maxCacheSize to set.
- */
- public void setMaxCacheSize(int maxCacheSize) {
- this.maxCacheSize = maxCacheSize;
- }
-
- @Override
- protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
- return size() > maxCacheSize;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
deleted file mode 100644
index 3423d3e3b0..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderImpl.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Array;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BeanXMLStreamReaderImpl extends XmlTreeStreamReaderImpl {
- private static final Comparator<Accessor> COMPARATOR = new Comparator<Accessor>() {
- public int compare(Accessor o1, Accessor o2) {
- return o1.getName().compareTo(o2.getName());
- }
- };
-
- public static class BeanXmlNodeImpl extends SimpleXmlNodeImpl implements XmlNode {
- private static final Object[] NULL = null;
- private static final SimpleTypeMapperImpl MAPPER = new SimpleTypeMapperImpl();
-
- public BeanXmlNodeImpl(Object bean) {
- super(getName(bean == null ? null : bean.getClass()), bean);
- }
-
- public BeanXmlNodeImpl(QName name, Object bean) {
- super(name, bean);
- }
-
- private static boolean isSimpleType(Class<?> javaType) {
- return SimpleTypeMapperImpl.getXMLType(javaType) != null;
- }
-
- private static String getStringValue(Object o) {
- if (o == null) {
- return null;
- }
- TypeInfo info = SimpleTypeMapperImpl.getXMLType(o.getClass());
- if (info != null) {
- return MAPPER.toXMLLiteral(info.getQName(), o, null);
- } else {
- return String.valueOf(o);
- }
- }
-
- @Override
- public Iterator<XmlNode> children() {
- if (name == null) {
- return null;
- }
- if (value == null) {
- return super.children();
- }
- if (isSimpleType(value.getClass())) {
- XmlNode textNode = new BeanXmlNodeImpl(null, value);
- return Arrays.asList(textNode).iterator();
- }
- if (Map.class.isAssignableFrom(value.getClass())) {
- List<XmlNode> entries = new ArrayList<XmlNode>();
- QName entryName = new QName(name.getNamespaceURI(), "entry");
- Map map = (Map)value;
- if (map != null) {
- for (Object e : map.entrySet()) {
- Map.Entry entry = (Map.Entry)e;
- entries.add(new BeanXmlNodeImpl(entryName, entry));
- }
- }
- return entries.iterator();
- }
- try {
- Map<String, Accessor> accessorMap = getAccessors(value);
- List<Accessor> accessorList = new ArrayList<Accessor>(accessorMap.values());
- Collections.sort(accessorList, COMPARATOR);
-
- List<XmlNode> props = new ArrayList<XmlNode>();
- for (Accessor accessor : accessorList) {
- Class<?> pType = accessor.getType();
-
- QName pName = new QName(name.getNamespaceURI(), accessor.getName());
- Object pValue = accessor.getValue();
- if (pType.isArray()) {
- if (pValue != null) {
- int i1 = Array.getLength(pValue);
- for (int j = 0; j < i1; j++) {
- Object o = Array.get(pValue, j);
- props.add(new BeanXmlNodeImpl(pName, o));
- }
- } else {
- // TODO: How to handle null?
- }
- } else if (Collection.class.isAssignableFrom(pType)) {
- Collection objList = (Collection)pValue;
- if (objList != null && objList.size() > 0) {
- for (Iterator j = objList.iterator(); j.hasNext();) {
- Object o = j.next();
- props.add(new BeanXmlNodeImpl(pName, o));
- }
-
- } else {
- // How to handle null
- }
- } else {
- props.add(new BeanXmlNodeImpl(pName, pValue));
- }
- }
- return props.iterator();
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- @Override
- public QName getName() {
- return name;
- }
-
- @Override
- public String getValue() {
- return getStringValue(value);
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static QName getName(Class<?> cls) {
- if (cls == null) {
- return null;
- }
-
- String packageName = getPackageName(cls);
-
- if ("".equals(packageName)) {
- return new QName("", cls.getSimpleName());
- }
- StringBuffer ns = new StringBuffer("http://");
- String[] names = packageName.split("\\.");
- for (int i = names.length - 1; i >= 0; i--) {
- ns.append(names[i]);
- if (i != 0) {
- ns.append('.');
- }
- }
- ns.append('/');
- return new QName(ns.toString(), cls.getSimpleName());
- }
-
- }
-
- public BeanXMLStreamReaderImpl(QName name, Object bean) {
- super(getXmlNode(name, bean));
- }
-
- private static BeanXmlNodeImpl getXmlNode(QName name, Object bean) {
- BeanXmlNodeImpl root = null;
- if (name != null) {
- root = new BeanXmlNodeImpl(name, bean);
- } else {
- root = new BeanXmlNodeImpl(bean);
- }
- return root;
- }
-
- public static interface Accessor {
- String getName();
-
- Class<?> getType();
-
- Object getValue() throws Exception;
-
- void setValue(Object value) throws Exception;
- }
-
- private static class FieldAccessor implements Accessor {
- private Object target;
- private Field field;
-
- public FieldAccessor(Object target, Field field) {
- super();
- this.target = target;
- this.field = field;
- this.field.setAccessible(true);
- }
-
- public String getName() {
- return field.getName();
- }
-
- public Object getValue() throws Exception {
- return field.get(target);
- }
-
- public void setValue(Object value) throws Exception {
- field.set(target, value);
- }
-
- public Class<?> getType() {
- return field.getType();
- }
-
- }
-
- private static class PropertyAccessor implements Accessor {
- private Object target;
- private PropertyDescriptor prop;
-
- public PropertyAccessor(Object target, PropertyDescriptor prop) {
- super();
- this.target = target;
- this.prop = prop;
- }
-
- public String getName() {
- return prop.getName();
- }
-
- public Class<?> getType() {
- return prop.getPropertyType();
- }
-
- public Object getValue() throws Exception {
- Method getter = prop.getReadMethod();
- if (getter != null) {
- getter.setAccessible(true);
- return getter.invoke(target);
- }
- throw new IllegalAccessException("The property cannot be read: " + getName());
- }
-
- public void setValue(Object value) throws Exception {
- Method setter = prop.getWriteMethod();
- if (setter != null) {
- setter.setAccessible(true);
- setter.invoke(target);
- }
- throw new IllegalAccessException("The property cannot be written: " + getName());
- }
-
- }
-
- private static Map<String, Accessor> getAccessors(Object target) throws Exception {
- if (target == null) {
- return Collections.emptyMap();
- }
- Map<String, Accessor> map = new HashMap<String, Accessor>();
- Class<?> type = target.getClass();
- for (Field f : type.getFields()) {
- map.put(f.getName(), new FieldAccessor(target, f));
- }
- BeanInfo info = Introspector.getBeanInfo(type, Object.class);
- for (PropertyDescriptor p : info.getPropertyDescriptors()) {
- // if (p.getReadMethod() != null && p.getWriteMethod() != null) {
- map.put(p.getName(), new PropertyAccessor(target, p));
- // }
- }
- return map;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.java
deleted file mode 100644
index e029604722..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMDataBinding.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.databinding.xml;
-
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Node;
-
-/**
- * DOM DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class DOMDataBinding extends BaseDataBinding {
- public static final String NAME = Node.class.getName();
-
- public static final String ROOT_NAMESPACE = "http://tuscany.apache.org/xmlns/sca/databinding/dom/1.0";
- public static final QName ROOT_ELEMENT = new QName(ROOT_NAMESPACE, "root");
-
- public DOMDataBinding() {
- super(NAME, Node.class);
- }
-
- @Override
- public WrapperHandler getWrapperHandler() {
- return new DOMWrapperHandler();
- }
-
- @Override
- public Object copy(Object source, DataType dataType, Operation operation) {
- if (Node.class.isAssignableFrom(source.getClass())) {
- Node nodeSource = (Node)source;
- return nodeSource.cloneNode(true);
- }
- return super.copy(source, dataType, operation);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (Node.class.isAssignableFrom(type.getPhysical())) {
- if (type.getLogical() == null) {
- type.setLogical(new XMLType(ROOT_ELEMENT, null));
- }
- type.setDataBinding(NAME);
- return true;
- }
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.java
deleted file mode 100644
index 19a8fe32d3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMWrapperHandler.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.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.WrapperHandler;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-public class DOMWrapperHandler implements WrapperHandler<Node> {
-
- public DOMWrapperHandler() {
- super();
- }
-
- public Node create(Operation operation, boolean input) {
- try {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
-
- Document document = DOMHelper.newDocument();
- QName name = element.getQName();
- return DOMHelper.createElement(document, name);
- } catch (ParserConfigurationException e) {
- throw new TransformationException(e);
- }
- }
-
- public void setChildren(Node wrapper,
- Object[] childObjects,
- Operation operation, boolean input) {
- List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements():
- operation.getOutputWrapper().getChildElements();
- for (int i = 0; i < childElements.size(); i++) {
- setChild(wrapper, i, childElements.get(i), childObjects[i]);
- }
-
- }
- public void setChild(Node wrapper, int i, ElementInfo childElement, Object value) {
- Node node = (Node)value;
- if (node.getNodeType() == Node.DOCUMENT_NODE) {
- node = ((Document)node).getDocumentElement();
- }
- wrapper.appendChild(wrapper.getOwnerDocument().importNode(node, true));
- }
-
- public List getChildren(Node wrapper, Operation operation, boolean input) {
- assert wrapper != null;
- List<ElementInfo> childElements = input? operation.getInputWrapper().getChildElements():
- operation.getOutputWrapper().getChildElements();
- if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
- wrapper = ((Document)wrapper).getDocumentElement();
- }
- List<Node> elements = new ArrayList<Node>();
- NodeList nodes = wrapper.getChildNodes();
- for (int j = 0; j < nodes.getLength(); j++) {
- Node node = nodes.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- elements.add(node);
- }
- }
- return elements;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.WrapperHandler#getWrapperType(Operation, boolean)
- */
- public DataType getWrapperType(Operation operation, boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
- DataType<XMLType> wrapperType =
- new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(element));
- return wrapperType;
- }
-
- public boolean isInstance(Object wrapperObj,
- Operation operation,
- boolean input) {
- WrapperInfo inputWrapperInfo = operation.getInputWrapper();
- WrapperInfo outputWrapperInfo = operation.getOutputWrapper();
- ElementInfo element = input ? inputWrapperInfo.getWrapperElement() : outputWrapperInfo.getWrapperElement();
-
- List<ElementInfo> childElements = input? inputWrapperInfo.getChildElements():
- outputWrapperInfo.getChildElements();
-
- Node wrapper = (Node)wrapperObj;
- if (wrapper.getNodeType() == Node.DOCUMENT_NODE) {
- wrapper = ((Document)wrapper).getDocumentElement();
- }
- QName elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
- if (!element.getQName().equals(elementName)) {
- return false;
- }
- Set<QName> names = new HashSet<QName>();
- for (ElementInfo e : childElements) {
- names.add(e.getQName());
- }
- NodeList nodes = wrapper.getChildNodes();
- for (int j = 0; j < nodes.getLength(); j++) {
- Node node = nodes.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- elementName = new QName(wrapper.getNamespaceURI(), wrapper.getLocalName());
- if (!names.contains(elementName)) {
- return false;
- }
- }
- }
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.java
deleted file mode 100644
index 8c7a742cdd..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXMLStreamReader.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.databinding.xml;
-
-import org.w3c.dom.Node;
-
-public class DOMXMLStreamReader extends XmlTreeStreamReaderImpl {
-
- public DOMXMLStreamReader(Node node) {
- super(new DOMXmlNodeImpl(node));
- switch (node.getNodeType()) {
- case Node.DOCUMENT_NODE:
- break;
- case Node.ELEMENT_NODE:
- break;
- default:
- throw new IllegalArgumentException("Illegal node type: " + node);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java
deleted file mode 100644
index 507c141c33..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DOMXmlNodeImpl.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DOMXmlNodeImpl implements XmlNode {
- private Node node;
- private Map<String, String> namespaces;
- private Type type;
-
- /**
- * @param element
- */
- public DOMXmlNodeImpl(Node element) {
- super();
- if (element.getNodeType() == Node.DOCUMENT_NODE) {
- this.node = ((Document)element).getDocumentElement();
- } else {
- this.node = element;
- }
- switch (node.getNodeType()) {
- case Node.CDATA_SECTION_NODE:
- this.type = Type.CHARACTERS;
- break;
- case Node.ELEMENT_NODE:
- this.type = Type.ELEMENT;
- break;
- case Node.TEXT_NODE:
- this.type = Type.CHARACTERS;
- break;
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
- */
- public List<XmlNode> attributes() {
- if (type != Type.ELEMENT) {
- return null;
- }
- NamedNodeMap attrs = node.getAttributes();
- List<XmlNode> xmlAttrs = new ArrayList<XmlNode>();
- for (int i = 0; i < attrs.getLength(); i++) {
- Attr attr = (Attr)attrs.item(i);
- if (!attr.getName().equals("xmlns") && !attr.getName().startsWith("xmlns:")) {
- xmlAttrs.add(new SimpleXmlNodeImpl(getQName(attr), attr.getValue(), XmlNode.Type.ATTRIBUTE));
- }
- }
- return xmlAttrs;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
- */
- public Iterator<XmlNode> children() {
- if (type != Type.ELEMENT) {
- return null;
- }
- NodeList nodes = node.getChildNodes();
- List<XmlNode> xmlNodes = new ArrayList<XmlNode>();
- for (int i = 0; i < nodes.getLength(); i++) {
- Node child = (Node)nodes.item(i);
- int nodeType = child.getNodeType();
- if (nodeType == Node.ELEMENT_NODE || nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
- xmlNodes.add(new DOMXmlNodeImpl(child));
- }
- }
- return xmlNodes.iterator();
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
- */
- public QName getName() {
- return getQName(node);
- }
-
- private static QName getQName(Node node) {
- int type = node.getNodeType();
- if (type == Node.ELEMENT_NODE || type == Node.ATTRIBUTE_NODE) {
- String ns = node.getNamespaceURI();
- String prefix = node.getPrefix();
- String localName = node.getLocalName();
- return new QName(ns == null ? "" : ns, localName, prefix == null ? "" : prefix);
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
- */
- public String getValue() {
- return node.getNodeValue();
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
- */
- public Map<String, String> namespaces() {
- if (type != Type.ELEMENT) {
- return null;
- }
- if (namespaces == null) {
- namespaces = new HashMap<String, String>();
- NamedNodeMap attrs = node.getAttributes();
- for (int i = 0; i < attrs.getLength(); i++) {
- Attr attr = (Attr)attrs.item(i);
- if ("xmlns".equals(attr.getPrefix())) {
- namespaces.put(attr.getLocalName(), attr.getValue());
- }
- if ("xmlns".equals(attr.getName())) {
- namespaces.put("", attr.getValue());
- }
- }
- }
- return namespaces;
- }
-
- public Type getType() {
- return type;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
deleted file mode 100644
index 7f49a50e1e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/DelegatingNamespaceContext.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.EmptyStackException;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.NamespaceContext;
-
-public class DelegatingNamespaceContext implements NamespaceContext {
- private static int count;
-
- private class WrappingIterator implements Iterator {
-
- private Iterator containedIterator;
-
- public WrappingIterator(Iterator containedIterator) {
- this.containedIterator = containedIterator;
- }
-
- public Iterator getContainedIterator() {
- return containedIterator;
- }
-
- public boolean hasNext() {
- return containedIterator.hasNext();
- }
-
- public Object next() {
- return containedIterator.next();
- }
-
- /**
- * As per the contract on the API of Namespace context the returned iterator should be immutable
- */
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public void setContainedIterator(Iterator containedIterator) {
- this.containedIterator = containedIterator;
- }
- }
-
- private NamespaceContext parentNsContext;
-
- private FastStack<String> prefixStack = new FastStack<String>();
-
- // Keep two ArrayLists for the prefixes and namespaces. They should be in
- // sync
- // since the index of the entry will be used to relate them
- // use the minimum initial capacity to let things handle memory better
-
- private FastStack<String> uriStack = new FastStack<String>();
-
- /**
- * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
- *
- * @return string
- */
- public String generateUniquePrefix() {
- String prefix = "p" + count++;
- // null should be returned if the prefix is not bound!
- while (getNamespaceURI(prefix) != null) {
- prefix = "p" + count++;
- }
-
- return prefix;
- }
-
- public String getNamespaceURI(String prefix) {
- // do the corrections as per the Javadoc
- int index = prefixStack.search(prefix);
- if (index != -1) {
- return uriStack.get(index);
- }
- if (parentNsContext != null) {
- return parentNsContext.getPrefix(prefix);
- }
- return null;
- }
-
- public NamespaceContext getParentNsContext() {
- return parentNsContext;
- }
-
- public String getPrefix(String uri) {
- // do the corrections as per the Javadoc
- int index = uriStack.search(uri);
- if (index != -1) {
- return prefixStack.get(index);
- }
-
- if (parentNsContext != null) {
- return parentNsContext.getPrefix(uri);
- }
- return null;
- }
-
- public Iterator getPrefixes(String uri) {
- // create an ArrayList that contains the relevant prefixes
- String[] uris = uriStack.toArray(new String[uriStack.size()]);
- List<String> tempList = new ArrayList<String>();
- for (int i = uris.length - 1; i >= 0; i--) {
- if (uris[i].equals(uri)) {
- tempList.add(prefixStack.get(i));
- // we assume that array conversion preserves the order
- }
- }
- // by now all the relevant prefixes are collected
- // make a new iterator and provide a wrapper iterator to
- // obey the contract on the API
- return new WrappingIterator(tempList.iterator());
- }
-
- /**
- * Pop a namespace
- */
- public void popNamespace() {
- prefixStack.pop();
- uriStack.pop();
- }
-
- /**
- * Register a namespace in this context
- *
- * @param prefix
- * @param uri
- */
- public void pushNamespace(String prefix, String uri) {
- prefixStack.push(prefix);
- uriStack.push(uri);
-
- }
-
- public void setParentNsContext(NamespaceContext parentNsContext) {
- this.parentNsContext = parentNsContext;
- }
-
- /**
- * An implementation of the {@link java.util.Stack} API that is based on an <code>ArrayList</code> instead of a
- * <code>Vector</code>, so it is not synchronized to protect against multi-threaded access. The implementation is
- * therefore operates faster in environments where you do not need to worry about multiple thread contention.
- * <p>
- * The removal order of an <code>ArrayStack</code> is based on insertion order: The most recently added element is
- * removed first. The iteration order is <i>not</i> the same as the removal order. The iterator returns elements
- * from the bottom up, whereas the {@link #remove()} method removes them from the top down.
- * <p>
- * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
- */
- public static class FastStack<T> extends ArrayList<T> {
-
- /** Ensure Serialization compatibility */
- private static final long serialVersionUID = 2130079159931574599L;
-
- /**
- * Constructs a new empty <code>ArrayStack</code>. The initial size is controlled by <code>ArrayList</code>
- * and is currently 10.
- */
- public FastStack() {
- super();
- }
-
- /**
- * Constructs a new empty <code>ArrayStack</code> with an initial size.
- *
- * @param initialSize the initial size to use
- * @throws IllegalArgumentException if the specified initial size is negative
- */
- public FastStack(int initialSize) {
- super(initialSize);
- }
-
- /**
- * Return <code>true</code> if this stack is currently empty.
- * <p>
- * This method exists for compatibility with <code>java.util.Stack</code>. New users of this class should use
- * <code>isEmpty</code> instead.
- *
- * @return true if the stack is currently empty
- */
- public boolean empty() {
- return isEmpty();
- }
-
- /**
- * Returns the top item off of this stack without removing it.
- *
- * @return the top item on the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T peek() throws EmptyStackException {
- int n = size();
- if (n <= 0) {
- throw new EmptyStackException();
- } else {
- return get(n - 1);
- }
- }
-
- /**
- * Returns the n'th item down (zero-relative) from the top of this stack without removing it.
- *
- * @param n the number of items down to go
- * @return the n'th item on the stack, zero relative
- * @throws EmptyStackException if there are not enough items on the stack to satisfy this request
- */
- public T peek(int n) throws EmptyStackException {
- int m = (size() - n) - 1;
- if (m < 0) {
- throw new EmptyStackException();
- } else {
- return get(m);
- }
- }
-
- /**
- * Pops the top item off of this stack and return it.
- *
- * @return the top item on the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T pop() throws EmptyStackException {
- int n = size();
- if (n <= 0) {
- throw new EmptyStackException();
- } else {
- return remove(n - 1);
- }
- }
-
- /**
- * Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling
- * <code>add</code>.
- *
- * @param item the item to be added
- * @return the item just pushed
- */
- public Object push(T item) {
- add(item);
- return item;
- }
-
- /**
- * Returns the top-most index for the object in the stack
- *
- * @param object the object to be searched for
- * @return top-most index, or -1 if not found
- */
- public int search(T object) {
- int i = size() - 1; // Current index
- while (i >= 0) {
- T current = get(i);
- if ((object == null && current == null) || (object != null && object.equals(current))) {
- return i;
- }
- i--;
- }
- return -1;
- }
-
- /**
- * Returns the element on the top of the stack.
- *
- * @return the element on the top of the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T get() {
- int size = size();
- if (size == 0) {
- throw new EmptyStackException();
- }
- return get(size - 1);
- }
-
- /**
- * Removes the element on the top of the stack.
- *
- * @return the removed element
- * @throws EmptyStackException if the stack is empty
- */
- public T remove() {
- int size = size();
- if (size == 0) {
- throw new EmptyStackException();
- }
- return remove(size - 1);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.java
deleted file mode 100644
index 5f583da283..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2Node.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.databinding.xml;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * Push DOM InputSource to Node
- *
- * @version $Rev$ $Date$
- */
-public class InputSource2Node extends BaseTransformer<InputSource, Node> implements
- PullTransformer<InputSource, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(InputSource source, TransformationContext context) {
- try {
- Source streamSource = new StreamSource(source.getCharacterStream());
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputSource> getSourceType() {
- return InputSource.class;
- }
-
- @Override
- public Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
deleted file mode 100644
index 39116ba4a1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputSource2SAX.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Push InputSource to SAX
- *
- * @version $Rev$ $Date$
- */
-public class InputSource2SAX extends BaseTransformer<InputSource, ContentHandler> implements
- PushTransformer<InputSource, ContentHandler> {
-
- public void transform(InputSource source, ContentHandler target, TransformationContext context) {
- try {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setFeature("http://xml.org/sax/features/namespaces", true);
- reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
- reader.setContentHandler(target);
- reader.parse(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputSource> getSourceType() {
- return InputSource.class;
- }
-
- @Override
- public Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
deleted file mode 100644
index e40c3006fb..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2Node.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.InputStream;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.sax.SAXSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * Push DOM InputSource to Node
- *
- * @version $Rev$ $Date$
- */
-public class InputStream2Node extends BaseTransformer<InputStream, Node> implements
- PullTransformer<InputStream, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(InputStream source, TransformationContext context) {
- try {
- Source streamSource = new SAXSource(new InputSource(source));
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- public Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
deleted file mode 100644
index 3b7bd3088a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/InputStream2SAX.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Push InputStream to SAX
- *
- * @version $Rev$ $Date$
- */
-public class InputStream2SAX extends BaseTransformer<InputStream, ContentHandler> implements
- PushTransformer<InputStream, ContentHandler> {
- public void transform(InputStream source, ContentHandler target, TransformationContext context) {
- try {
- XMLReader reader = XMLReaderFactory.createXMLReader();
- reader.setContentHandler(target);
- reader.parse(new InputSource(source));
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<InputStream> getSourceType() {
- return InputStream.class;
- }
-
- @Override
- public Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
deleted file mode 100644
index 5a31d9db91..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValueArrayStreamReader.java
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-
-public class NameValueArrayStreamReader implements XMLFragmentStreamReader {
-
- private static final int START_ELEMENT_STATE = 0;
- private static final int TEXT_STATE = 1;
- private static final int END_ELEMENT_STATE = 2;
- private static final int FINAL_END_ELEMENT_STATE = 3;
- private static final int START_ELEMENT_STATE_WITH_NULL = 4;
-
- private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
- // the index of the array
- private int arrayIndex;
-
- private QName name;
- private String[] values;
-
- // start element is the default state
- private int state = START_ELEMENT_STATE;
-
- public NameValueArrayStreamReader(QName name, String[] values) {
- this.name = name;
- this.values = values;
- }
-
- public void setParentNamespaceContext(NamespaceContext nsContext) {
- this.namespaceContext.setParentNsContext(nsContext);
- }
-
- public void init() {
- // TODO what if the QName namespace has not been declared
- }
-
- public Object getProperty(String string) throws IllegalArgumentException {
- return null;
- }
-
- /**
- * @throws XMLStreamException
- */
- public int next() throws XMLStreamException {
- switch (state) {
- case START_ELEMENT_STATE:
- if (values.length > 0) {
- state = TEXT_STATE;
- return CHARACTERS;
- } else {
- state = FINAL_END_ELEMENT_STATE;
- return END_ELEMENT;
- }
-
- case START_ELEMENT_STATE_WITH_NULL:
- if (arrayIndex == (values.length - 1)) {
- state = FINAL_END_ELEMENT_STATE;
- } else {
- state = END_ELEMENT_STATE;
- }
- return END_ELEMENT;
- case FINAL_END_ELEMENT_STATE:
- // oops, not supposed to happen!
- throw new XMLStreamException("end already reached!");
- case END_ELEMENT_STATE:
- // we've to have more values since this is not the
- // last value
- // increment the counter
- arrayIndex++;
- if (values[arrayIndex] == null) {
- state = START_ELEMENT_STATE_WITH_NULL;
- } else {
- state = START_ELEMENT_STATE;
- }
- return START_ELEMENT;
- case TEXT_STATE:
- if (arrayIndex == (values.length - 1)) {
- state = FINAL_END_ELEMENT_STATE;
- return END_ELEMENT;
- } else {
- state = END_ELEMENT_STATE;
- return END_ELEMENT;
- }
-
- default:
- throw new XMLStreamException("unknown event type!");
- }
- }
-
- public void require(int i, String string, String string1) throws XMLStreamException {
- // nothing done here
- }
-
- public String getElementText() throws XMLStreamException {
- return null; // not implemented
- }
-
- public int nextTag() throws XMLStreamException {
- return 0; // not implemented
- }
-
- public String getAttributeValue(String string, String string1) {
- if (state == TEXT_STATE) {
- // TODO something
- return null;
- } else {
- return null;
- }
-
- }
-
- public int getAttributeCount() {
- if (state == START_ELEMENT_STATE_WITH_NULL) {
- return 1;
- }
- if (state == START_ELEMENT_STATE) {
- return 0;
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public QName getAttributeName(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
- return NIL_QNAME;
- }
- if (state == START_ELEMENT_STATE) {
- return null;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeNamespace(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
- return NIL_QNAME.getNamespaceURI();
- }
- if (state == START_ELEMENT_STATE) {
- return null;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeLocalName(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
- return NIL_QNAME.getLocalPart();
- }
- if (state == START_ELEMENT_STATE) {
- return null;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributePrefix(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
- return NIL_QNAME.getPrefix();
- }
- if (state == START_ELEMENT_STATE) {
- return null;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeType(int i) {
- return null; // not implemented
- }
-
- public String getAttributeValue(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && i == 0) {
- return NIL_VALUE_TRUE;
- }
- if (state == START_ELEMENT_STATE) {
- return null;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public boolean isAttributeSpecified(int i) {
- return false; // not supported
- }
-
- public int getNamespaceCount() {
- if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent()) {
- return 1;
- } else {
- return 0;
- }
-
- }
-
- public String getNamespacePrefix(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) {
- return NIL_QNAME.getPrefix();
- } else {
- return null;
- }
- }
-
- public String getNamespaceURI(int i) {
- if (state == START_ELEMENT_STATE_WITH_NULL && isXsiNamespacePresent() && i == 0) {
- return NIL_QNAME.getNamespaceURI();
- } else {
- return null;
- }
- }
-
- public NamespaceContext getNamespaceContext() {
- return this.namespaceContext;
- }
-
- public boolean isDone() {
- return state == FINAL_END_ELEMENT_STATE;
- }
-
- public int getEventType() {
- switch (state) {
- case START_ELEMENT_STATE:
- return START_ELEMENT;
- case END_ELEMENT_STATE:
- return END_ELEMENT;
- case TEXT_STATE:
- return CHARACTERS;
- case FINAL_END_ELEMENT_STATE:
- return END_ELEMENT;
- default:
- throw new UnsupportedOperationException();
- // we've no idea what this is!!!!!
- }
-
- }
-
- public String getText() {
- if (state == TEXT_STATE) {
- return values[arrayIndex];
- } else {
- throw new IllegalStateException();
- }
- }
-
- public char[] getTextCharacters() {
- if (state == TEXT_STATE) {
- return values[arrayIndex].toCharArray();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- // not implemented
- throw new UnsupportedOperationException();
- }
-
- public int getTextStart() {
- if (state == TEXT_STATE) {
- return 0;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextLength() {
- if (state == TEXT_STATE) {
- return values[arrayIndex].length();
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public String getEncoding() {
- return null;
- }
-
- public boolean hasText() {
- return state == TEXT_STATE;
- }
-
- public Location getLocation() {
- return null; // not supported
- }
-
- public QName getName() {
- if (state != TEXT_STATE) {
- return name;
- } else {
- return null;
- }
- }
-
- public String getLocalName() {
- if (state != TEXT_STATE) {
- return name.getLocalPart();
- } else {
- return null;
- }
- }
-
- public boolean hasName() {
- return state != TEXT_STATE;
-
- }
-
- public String getNamespaceURI() {
- if (state != TEXT_STATE) {
- return name.getNamespaceURI();
- } else {
- return null;
- }
-
- }
-
- public String getPrefix() {
- if (state != TEXT_STATE) {
- return name.getPrefix();
- } else {
- return null;
- }
- }
-
- public String getVersion() {
- return null; // TODO 1.0 ?
- }
-
- public boolean isStandalone() {
- return false;
- }
-
- public boolean standaloneSet() {
- return false;
- }
-
- public String getCharacterEncodingScheme() {
- return null;
- }
-
- public String getPITarget() {
- return null;
- }
-
- public String getPIData() {
- return null;
- }
-
- public boolean hasNext() throws XMLStreamException {
- return state != FINAL_END_ELEMENT_STATE;
- }
-
- public void close() throws XMLStreamException {
- // Do nothing - we've nothing to free here
- }
-
- public String getNamespaceURI(String prefix) {
- return namespaceContext.getNamespaceURI(prefix);
- }
-
- public boolean isStartElement() {
- return state == START_ELEMENT_STATE;
- }
-
- public boolean isEndElement() {
- return state == END_ELEMENT_STATE;
- }
-
- public boolean isCharacters() {
- return state == TEXT_STATE;
- }
-
- public boolean isWhiteSpace() {
- return false; // no whitespaces here
- }
-
- /**
- * Test whether the xsi namespace is present
- */
- private boolean isXsiNamespacePresent() {
- return namespaceContext.getNamespaceURI(NIL_QNAME.getPrefix()) != null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
deleted file mode 100644
index fdc3c4139b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NameValuePairStreamReader.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-
-
-public class NameValuePairStreamReader implements XMLFragmentStreamReader {
-
- private static final int START_ELEMENT_STATE = 0;
- private static final int TEXT_STATE = 1;
- private static final int END_ELEMENT_STATE = 2;
-
- private DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
-
- private QName name;
- private String value;
-
- private int state = START_ELEMENT_STATE;
- // initiate at the start element state
-
- // keeps track whether the namespace is declared
- // false by default
- private boolean nsDeclared;
-
- public NameValuePairStreamReader(QName name, String value) {
- this.name = name;
- this.value = value;
- }
-
- public Object getProperty(String key) throws IllegalArgumentException {
- return null;
- }
-
- public int next() throws XMLStreamException {
- // no need to handle null here. it should have been handled
- // already
- switch (state) {
- case START_ELEMENT_STATE:
- state = TEXT_STATE;
- return CHARACTERS;
- case END_ELEMENT_STATE:
- // oops, not supposed to happen!
- throw new XMLStreamException("end already reached!");
- case TEXT_STATE:
- state = END_ELEMENT_STATE;
- return END_ELEMENT;
- default:
- throw new XMLStreamException("unknown event type!");
- }
- }
-
- public void require(int i, String string, String string1) throws XMLStreamException {
- // not implemented
- }
-
- public String getElementText() throws XMLStreamException {
- if (state == START_ELEMENT) {
- // move to the end state and return the value
- state = END_ELEMENT_STATE;
- return value;
- } else {
- throw new XMLStreamException();
- }
-
- }
-
- public int nextTag() throws XMLStreamException {
- return 0; // TODO
- }
-
- public boolean hasNext() throws XMLStreamException {
- return state != END_ELEMENT_STATE;
- }
-
- public void close() throws XMLStreamException {
- // Do nothing - we've nothing to free here
- }
-
- public String getNamespaceURI(String prefix) {
- return namespaceContext.getNamespaceURI(prefix);
- }
-
- public boolean isStartElement() {
- return state == START_ELEMENT_STATE;
- }
-
- public boolean isEndElement() {
- return state == END_ELEMENT_STATE;
- }
-
- public boolean isCharacters() {
- return state == TEXT_STATE;
- }
-
- public boolean isWhiteSpace() {
- return false; // no whitespaces here
- }
-
- public String getAttributeValue(String string, String string1) {
- return null;
- }
-
- public int getAttributeCount() {
- return 0;
- }
-
- public QName getAttributeName(int i) {
- return null;
- }
-
- public String getAttributeNamespace(int i) {
- return null;
- }
-
- public String getAttributeLocalName(int i) {
- return null;
- }
-
- public String getAttributePrefix(int i) {
- return null;
- }
-
- public String getAttributeType(int i) {
- return null;
- }
-
- public String getAttributeValue(int i) {
- return null;
- }
-
- public boolean isAttributeSpecified(int i) {
- return false; // no attributes here
- }
-
- public int getNamespaceCount() {
- return nsDeclared ? 1 : 0;
- }
-
- public String getNamespacePrefix(int i) {
- return (nsDeclared && i == 0) ? name.getPrefix() : null;
- }
-
- public String getNamespaceURI(int i) {
- return (nsDeclared && i == 0) ? name.getNamespaceURI() : null;
- }
-
- public NamespaceContext getNamespaceContext() {
- return this.namespaceContext;
- }
-
- public int getEventType() {
- switch (state) {
- case START_ELEMENT_STATE:
- return START_ELEMENT;
- case END_ELEMENT_STATE:
- return END_ELEMENT;
- case TEXT_STATE:
- return CHARACTERS;
- default:
- throw new UnsupportedOperationException();
- // we've no idea what this is!!!!!
- }
-
- }
-
- public String getText() {
- if (state == TEXT_STATE) {
- return value;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public char[] getTextCharacters() {
- if (state == TEXT_STATE) {
- return value.toCharArray();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- // not implemented
- throw new UnsupportedOperationException();
- }
-
- public int getTextStart() {
- if (state == TEXT_STATE) {
- return 0;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextLength() {
- if (state == TEXT_STATE) {
- return value.length();
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public String getEncoding() {
- return null;
- }
-
- public boolean hasText() {
- return state == TEXT_STATE;
- }
-
- public Location getLocation() {
- return new Location() {
- public int getLineNumber() {
- return 0;
- }
-
- public int getColumnNumber() {
- return 0;
- }
-
- public int getCharacterOffset() {
- return 0;
- }
-
- public String getPublicId() {
- return null;
- }
-
- public String getSystemId() {
- return null;
- }
- };
- }
-
- public QName getName() {
- if (state != TEXT_STATE) {
- return name;
- } else {
- return null;
- }
- }
-
- public String getLocalName() {
- if (state != TEXT_STATE) {
- return name.getLocalPart();
- } else {
- return null;
- }
- }
-
- public boolean hasName() {
- return state != TEXT_STATE;
-
- }
-
- public String getNamespaceURI() {
- if (state != TEXT_STATE) {
- return name.getNamespaceURI();
- } else {
- return null;
- }
-
- }
-
- public String getPrefix() {
- if (state != TEXT_STATE) {
- return name.getPrefix();
- } else {
- return null;
- }
- }
-
- public String getVersion() {
- return null; // TODO 1.0 ?
- }
-
- public boolean isStandalone() {
- return false;
- }
-
- public boolean standaloneSet() {
- return false;
- }
-
- public String getCharacterEncodingScheme() {
- return null;
- }
-
- public String getPITarget() {
- return null;
- }
-
- public String getPIData() {
- return null;
- }
-
- public boolean isDone() {
- return state == END_ELEMENT_STATE;
- }
-
- public void setParentNamespaceContext(NamespaceContext nsContext) {
- this.namespaceContext.setParentNsContext(nsContext);
- }
-
- public void init() {
- // just add the current elements namespace and prefix to the this
- // elements nscontext
- addToNsMap(name.getPrefix(), name.getNamespaceURI());
-
- }
-
- /**
- * @param prefix
- * @param uri
- */
- private void addToNsMap(String prefix, String uri) {
- // TODO - need to fix this up to cater for cases where
- // namespaces are having no prefixes
- if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
- // this namespace is not there. Need to declare it
- namespaceContext.pushNamespace(prefix, uri);
- nsDeclared = true;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.java
deleted file mode 100644
index 04d7d65a0d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NamedProperty.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.databinding.xml;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-/**
- * A named property
- *
- * @version $Rev$ $Date$
- */
-public class NamedProperty implements Map.Entry<QName, Object> {
- private QName key;
-
- private Object value;
-
- public NamedProperty(QName key, Object value) {
- this.key = key;
- this.value = value;
- }
-
- public NamedProperty(String key, Object value) {
- this.key = new QName(key);
- this.value = value;
- }
-
- public QName getKey() {
- return key;
- }
-
- public Object getValue() {
- return value;
- }
-
- public Object setValue(Object value) {
- Object v = this.value;
- this.value = value;
- return v;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
deleted file mode 100644
index abc4bf3785..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/NilElementStreamReader.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-
-public class NilElementStreamReader implements XMLFragmentStreamReader {
-
- private static final int END_ELEMENT_STATE = 2;
-
- private static final int START_ELEMENT_STATE = 1;
- private int currentState = START_ELEMENT;
-
- private QName elementQName;
-
- public NilElementStreamReader(QName elementQName) {
- this.elementQName = elementQName;
- }
-
- public void setParentNamespaceContext(NamespaceContext nsContext) {
- // NOOP
- }
-
- public void close() throws XMLStreamException {
- // do nothing
- }
-
- public int getAttributeCount() {
- return 1;
- }
-
- public String getAttributeLocalName(int i) {
- return (i == 0) ? NIL_QNAME.getLocalPart() : null;
- }
-
- public QName getAttributeName(int i) {
- return (i == 0) ? NIL_QNAME : null;
- }
-
- public String getAttributeNamespace(int i) {
- return (i == 0) ? NIL_QNAME.getNamespaceURI() : null;
- }
-
- public String getAttributePrefix(int i) {
- return (i == 0) ? NIL_QNAME.getPrefix() : null;
- }
-
- public String getAttributeType(int i) {
- throw new UnsupportedOperationException();
- }
-
- public String getAttributeValue(int i) {
- return (i == 0) ? NIL_VALUE_TRUE : null;
- }
-
- public String getAttributeValue(String string, String string1) {
- if (string == null && NIL_QNAME.getLocalPart().equals(string1)) {
- return NIL_VALUE_TRUE;
- }
- return null;
- }
-
- public String getCharacterEncodingScheme() {
- throw new UnsupportedOperationException();
- }
-
- public String getElementText() throws XMLStreamException {
- return null;
- }
-
- public String getEncoding() {
- return null;
- }
-
- public int getEventType() {
- int returnEvent = START_DOCUMENT;
- switch (currentState) {
- case START_ELEMENT_STATE:
- returnEvent = START_ELEMENT;
- break;
- case END_ELEMENT_STATE:
- returnEvent = END_ELEMENT;
- break;
- }
- return returnEvent;
- }
-
- public String getLocalName() {
- return elementQName.getLocalPart();
- }
-
- public Location getLocation() {
- return new Location() {
- public int getCharacterOffset() {
- return 0;
- }
-
- public int getColumnNumber() {
- return 0;
- }
-
- public int getLineNumber() {
- return 0;
- }
-
- public String getPublicId() {
- return null;
- }
-
- public String getSystemId() {
- return null;
- }
- };
- }
-
- public QName getName() {
- return elementQName;
- }
-
- public NamespaceContext getNamespaceContext() {
- throw new UnsupportedOperationException();
- }
-
- public int getNamespaceCount() {
- return 0;
- }
-
- public String getNamespacePrefix(int i) {
- return null;
- }
-
- public String getNamespaceURI() {
- return elementQName.getNamespaceURI();
- }
-
- public String getNamespaceURI(int i) {
- return null;
- }
-
- public String getNamespaceURI(String string) {
- if (elementQName.getPrefix() != null && elementQName.getPrefix().equals(string)) {
- return elementQName.getNamespaceURI();
- } else {
- return null;
- }
- }
-
- public String getPIData() {
- throw new UnsupportedOperationException();
- }
-
- public String getPITarget() {
- throw new UnsupportedOperationException();
- }
-
- public String getPrefix() {
- return elementQName.getPrefix();
- }
-
- public Object getProperty(String key) throws IllegalArgumentException {
- // since optimization is a global property
- // we've to implement it everywhere
- return null;
- }
-
- public String getText() {
- return null;
- }
-
- public char[] getTextCharacters() {
- return new char[0];
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- return 0;
- }
-
- public int getTextLength() {
- return 0;
- }
-
- public int getTextStart() {
- return 0;
- }
-
- public String getVersion() {
- throw new UnsupportedOperationException();
- }
-
- public boolean hasName() {
- return true;
- }
-
- public boolean hasNext() throws XMLStreamException {
- return currentState != END_ELEMENT_STATE;
-
- }
-
- public boolean hasText() {
- return false;
- }
-
- public void init() {
- // NOOP
- }
-
- public boolean isAttributeSpecified(int i) {
- return i == 0;
- }
-
- public boolean isCharacters() {
- return false;
- }
-
- public boolean isDone() {
- return currentState == END_ELEMENT_STATE;
- }
-
- public boolean isEndElement() {
- return currentState == END_ELEMENT_STATE;
- }
-
- public boolean isStandalone() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isStartElement() {
- return currentState == START_ELEMENT_STATE;
- }
-
- public boolean isWhiteSpace() {
- return false;
- }
-
- public int next() throws XMLStreamException {
- int returnEvent = START_DOCUMENT;
- switch (currentState) {
- case START_ELEMENT_STATE:
- currentState = END_ELEMENT_STATE;
- returnEvent = END_ELEMENT;
- break;
- case END_ELEMENT_STATE:
- throw new XMLStreamException("parser completed!");
-
- }
- return returnEvent;
- }
-
- public int nextTag() throws XMLStreamException {
- throw new UnsupportedOperationException();
- }
-
- public void require(int i, String string, String string1) throws XMLStreamException {
- // nothing
- }
-
- public boolean standaloneSet() {
- throw new UnsupportedOperationException();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.java
deleted file mode 100644
index 5500d0bcca..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2OutputStream.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.databinding.xml;
-
-import java.io.OutputStream;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Node to OutputStream
- *
- * @version $Rev$ $Date$
- */
-public class Node2OutputStream extends BaseTransformer<Node, OutputStream> implements
- PushTransformer<Node, OutputStream> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public void transform(Node source, OutputStream writer, TransformationContext context) {
- try {
- Source domSource = new DOMSource(source);
- Result result = new StreamResult(writer);
- TRANSFORMER.transform(domSource, result, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<OutputStream> getTargetType() {
- return OutputStream.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.java
deleted file mode 100644
index d5bf7e76b5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SimpleJavaType.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.databinding.xml;
-
-import org.apache.tuscany.sca.databinding.impl.SimpleType2JavaTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transformer to convert data from a simple java Object to OMElement.
- *
- * @version $Rev$ $Date$
- */
-public class Node2SimpleJavaType extends SimpleType2JavaTransformer<Node> {
-
- @Override
- protected String getText(Node source) {
- if (source instanceof Document) {
- source = ((Document)source).getDocumentElement();
- }
- return source.getTextContent();
-
- }
-
- @Override
- public Class getSourceType() {
- return Node.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.java
deleted file mode 100644
index 3c9022bc3c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2SourceTransformer.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.databinding.xml;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform TrAX Node to Source
- *
- * @version $Rev$ $Date$
- */
-public class Node2SourceTransformer extends BaseTransformer<Node, Source> implements
- PullTransformer<Node, Source> {
-
- public Source transform(Node source, TransformationContext context) {
- try {
- return new DOMSource(source);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<Source> getTargetType() {
- return Source.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.java
deleted file mode 100644
index 1b54b1fd1e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2String.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.databinding.xml;
-
-import java.io.StringWriter;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform DOM Node to XML String
- *
- * @version $Rev$ $Date$
- */
-public class Node2String extends BaseTransformer<Node, String> implements PullTransformer<Node, String> {
- private static final Node2Writer TRANSFORMER = new Node2Writer();
-
- public String transform(Node source, TransformationContext context) {
- try {
- StringWriter writer = new StringWriter();
- TRANSFORMER.transform(source, writer, context);
- return writer.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- public Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- public Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.java
deleted file mode 100644
index c9631595dc..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2Writer.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.databinding.xml;
-
-import java.io.Writer;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Node to Writer
- *
- * @version $Rev$ $Date$
- */
-public class Node2Writer extends BaseTransformer<Node, Writer> implements PushTransformer<Node, Writer> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public void transform(Node source, Writer writer, TransformationContext context) {
- try {
- Source domSource = new DOMSource(source);
- Result result = new StreamResult(writer);
- TRANSFORMER.transform(domSource, result, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<Writer> getTargetType() {
- return Writer.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
deleted file mode 100644
index 1e8d14a151..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Node2XMLStreamReader.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Transform DOM Node to XML XMLStreamReader
- *
- * @version $Rev$ $Date$
- */
-public class Node2XMLStreamReader extends BaseTransformer<Node, XMLStreamReader> implements
- PullTransformer<Node, XMLStreamReader> {
-
- public XMLStreamReader transform(Node source, TransformationContext context) {
- if (source == null) {
- return null;
- }
- try {
- DOMXMLStreamReader reader = new DOMXMLStreamReader(source);
- return reader;
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.java
deleted file mode 100644
index 70387fa862..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2Node.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.databinding.xml;
-
-import java.io.Reader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-
-/**
- * Push DOM Reader to Node
- *
- * @version $Rev$ $Date$
- */
-public class Reader2Node extends BaseTransformer<Reader, Node> implements PullTransformer<Reader, Node> {
- private static final Source2ResultTransformer TRANSFORMER = new Source2ResultTransformer();
-
- public Node transform(Reader source, TransformationContext context) {
- try {
- Source streamSource = new StreamSource(source);
- DOMResult result = new DOMResult();
- TRANSFORMER.transform(streamSource, result, context);
- return result.getNode();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Reader> getSourceType() {
- return Reader.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
deleted file mode 100644
index 188ecaffa3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Reader2SAX.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.Reader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * Transform XML string to SAX
- *
- * @version $Rev$ $Date$
- */
-public class Reader2SAX extends BaseTransformer<Reader, ContentHandler> implements
- PushTransformer<Reader, ContentHandler> {
- public void transform(Reader source, ContentHandler target, TransformationContext context) {
- try {
- new InputSource2SAX().transform(new InputSource(source), target, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Reader> getSourceType() {
- return Reader.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
deleted file mode 100644
index 38c61d64c8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOM.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * Copyright 2001-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Stack;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Comment;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.ProcessingInstruction;
-import org.w3c.dom.Text;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
-
-/**
- * SAX2DOM adapter
- *
- * @version $Rev$ $Date$
- */
-public class SAX2DOM implements ContentHandler, LexicalHandler {
- public static final String EMPTYSTRING = "";
- public static final String XML_PREFIX = "xml";
- public static final String XMLNS_PREFIX = "xmlns";
- public static final String XMLNS_STRING = "xmlns:";
- public static final String XMLNS_URI = "http://www.w3.org/2000/xmlns/";
-
- private Node root;
-
- private Document document;
-
- private Node nextSibling;
-
- private Stack<Node> nodeStk = new Stack<Node>();
-
- private List<String> namespaceDecls;
-
- private Node lastSibling;
-
- public SAX2DOM() throws ParserConfigurationException {
- this.document = DOMHelper.newDocument();
- this.root = document;
- }
-
- public SAX2DOM(Node root, Node nextSibling) throws ParserConfigurationException {
- this.root = root;
- if (root instanceof Document) {
- this.document = (Document)root;
- } else if (root != null) {
- this.document = root.getOwnerDocument();
- } else {
- this.document = DOMHelper.newDocument();
- this.root = document;
- }
-
- this.nextSibling = nextSibling;
- }
-
- public SAX2DOM(Node root) throws ParserConfigurationException {
- this(root, null);
- }
-
- public Node getDOM() {
- return root;
- }
-
- public void characters(char[] ch, int start, int length) {
- final Node last = nodeStk.peek();
-
- // No text nodes can be children of root (DOM006 exception)
- if (last != document) {
- final String text = new String(ch, start, length);
- if (lastSibling != null && lastSibling.getNodeType() == Node.TEXT_NODE) {
- ((Text)lastSibling).appendData(text);
- } else if (last == root && nextSibling != null) {
- lastSibling = last.insertBefore(document.createTextNode(text), nextSibling);
- } else {
- lastSibling = last.appendChild(document.createTextNode(text));
- }
-
- }
- }
-
- public void startDocument() {
- nodeStk.push(root);
- }
-
- public void endDocument() {
- nodeStk.pop();
- }
-
- public void startElement(String namespace, String localName, String qName, Attributes attrs) {
- final Element tmp = document.createElementNS(namespace, qName);
-
- // Add namespace declarations first
- if (namespaceDecls != null) {
- final int nDecls = namespaceDecls.size();
- for (int i = 0; i < nDecls; i++) {
- final String prefix = namespaceDecls.get(i++);
-
- if (prefix == null || prefix.equals(EMPTYSTRING)) {
- tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, namespaceDecls.get(i));
- } else {
- tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix, namespaceDecls.get(i));
- }
- }
- namespaceDecls.clear();
- }
-
- // Add attributes to element
- final int nattrs = attrs.getLength();
- for (int i = 0; i < nattrs; i++) {
- if (attrs.getLocalName(i) == null) {
- tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
- } else {
- tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i));
- }
- }
-
- // Append this new node onto current stack node
- Node last = nodeStk.peek();
-
- // If the SAX2DOM is created with a non-null next sibling node,
- // insert the result nodes before the next sibling under the root.
- if (last == root && nextSibling != null) {
- last.insertBefore(tmp, nextSibling);
- } else {
- last.appendChild(tmp);
- }
-
- // Push this node onto stack
- nodeStk.push(tmp);
- lastSibling = null;
- }
-
- public void endElement(String namespace, String localName, String qName) {
- nodeStk.pop();
- lastSibling = null;
- }
-
- public void startPrefixMapping(String prefix, String uri) {
- if (namespaceDecls == null) {
- namespaceDecls = new ArrayList<String>(2);
- }
- namespaceDecls.add(prefix);
- namespaceDecls.add(uri);
- }
-
- public void endPrefixMapping(String prefix) {
- // do nothing
- }
-
- /**
- * This class is only used internally so this method should never be called.
- */
- public void ignorableWhitespace(char[] ch, int start, int length) {
- }
-
- /**
- * adds processing instruction node to DOM.
- */
- public void processingInstruction(String target, String data) {
- final Node last = nodeStk.peek();
- ProcessingInstruction pi = document.createProcessingInstruction(target, data);
- if (pi != null) {
- if (last == root && nextSibling != null) {
- last.insertBefore(pi, nextSibling);
- } else {
- last.appendChild(pi);
- }
-
- lastSibling = pi;
- }
- }
-
- /**
- * This class is only used internally so this method should never be called.
- */
- public void setDocumentLocator(Locator locator) {
- }
-
- /**
- * This class is only used internally so this method should never be called.
- */
- public void skippedEntity(String name) {
- }
-
- /**
- * Lexical Handler method to create comment node in DOM tree.
- */
- public void comment(char[] ch, int start, int length) {
- final Node last = nodeStk.peek();
- Comment comment = document.createComment(new String(ch, start, length));
- if (comment != null) {
- if (last == root && nextSibling != null) {
- last.insertBefore(comment, nextSibling);
- } else {
- last.appendChild(comment);
- }
-
- lastSibling = comment;
- }
- }
-
- // Lexical Handler methods- not implemented
- public void startCDATA() {
- }
-
- public void endCDATA() {
- }
-
- public void startEntity(java.lang.String name) {
- }
-
- public void endDTD() {
- }
-
- public void endEntity(String name) {
- }
-
- public void startDTD(String name, String publicId, String systemId) throws SAXException {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.java
deleted file mode 100644
index cb9d538389..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SAX2DOMPipe.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.databinding.xml;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-public class SAX2DOMPipe extends BaseTransformer<ContentHandler, Node> implements DataPipeTransformer<ContentHandler, Node> {
-
- /**
- *
- */
- public SAX2DOMPipe() {
- super();
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.DataPipeTransformer#newInstance()
- */
- public DataPipe<ContentHandler, Node> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- protected Class<ContentHandler> getSourceType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 30;
- }
-
- private static class Pipe implements DataPipe<ContentHandler, Node> {
- private SAX2DOM pipe;
-
- public Pipe() {
- super();
- try {
- this.pipe = new SAX2DOM();
- } catch (ParserConfigurationException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public Node getResult() {
- return pipe.getDOM();
- }
-
- public ContentHandler getSink() {
- return pipe;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.java
deleted file mode 100644
index d2625fba11..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleJavaType2Node.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.databinding.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.apache.tuscany.sca.databinding.impl.Java2SimpleTypeTransformer;
-import org.apache.tuscany.sca.databinding.javabeans.Java2XMLMapperException;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transformer to convert data from an simple OMElement to Java Object
- *
- * @version $Rev$ $Date$
- */
-public class SimpleJavaType2Node extends Java2SimpleTypeTransformer<Node> {
-
- private Document factory;
-
- public SimpleJavaType2Node() {
- super();
- try {
- factory = DOMHelper.newDocument();
- } catch (ParserConfigurationException e) {
- throw new Java2XMLMapperException(e);
- }
- }
-
- @Override
- protected Node createElement(QName element, String text, TransformationContext context) {
- if (element == null) {
- element = DOMDataBinding.ROOT_ELEMENT;
- }
- Node root = DOMHelper.createElement(factory, element);
- if (text != null) {
- root.appendChild(factory.createTextNode(text));
- } else {
- Attr nil = factory.createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "xsi:nil");
- nil.setValue("true");
- root.appendChild(nil);
- }
- return root;
- }
-
- @Override
- public Class getTargetType() {
- return Node.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.java
deleted file mode 100644
index e041f85214..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/SimpleXmlNodeImpl.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.databinding.xml;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SimpleXmlNodeImpl implements XmlNode {
- private static final String XSI_PREFIX = "xsi";
- private static final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
- private static final QName XSI_NIL = new QName(XSI_NS, "nil", XSI_PREFIX);
- private static final Map<String, String> NS_MAP = new HashMap<String, String>();
- static {
- NS_MAP.put(XSI_PREFIX, XSI_NS);
- }
-
- protected Type type;
- protected QName name;
- protected Object value;
-
- public SimpleXmlNodeImpl(QName name, Object value) {
- this(name, value, name != null ? Type.ELEMENT : Type.CHARACTERS);
- }
-
- public SimpleXmlNodeImpl(QName name, Object value, Type type) {
- super();
- this.type = type;
- this.name = name;
- this.value = value;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
- */
- public List<XmlNode> attributes() {
- if (type == Type.ELEMENT && value == null) {
- // Nil element
- XmlNode attr = new SimpleXmlNodeImpl(XSI_NIL, "true");
- return Arrays.asList(attr);
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
- */
- public Iterator<XmlNode> children() {
- if (type == Type.ELEMENT && value != null) {
- // Nil element
- XmlNode node = new SimpleXmlNodeImpl(null, value);
- return Arrays.asList(node).iterator();
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
- */
- public QName getName() {
- return name;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
- */
- public String getValue() {
- return value == null ? null : String.valueOf(value);
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
- */
- public Map<String, String> namespaces() {
- if (type == Type.ELEMENT && value == null) {
- return NS_MAP;
- }
- return null;
- }
-
- public Type getType() {
- return type;
- }
-
- public void setType(Type type) {
- this.type = type;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java
deleted file mode 100644
index ee9aa1bb76..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2NodeTransformer.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-/**
- * Transform TrAX Source to Node
- *
- * @version $Rev$ $Date$
- */
-public class Source2NodeTransformer extends BaseTransformer<Source, Node> implements
- PullTransformer<Source, Node> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
-
- public Node transform(Source source, TransformationContext context) {
- try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
- DOMResult result = new DOMResult();
- transformer.transform(source, result);
- Document doc = (Document) result.getNode();
- return DOMHelper.adjustElementName(context, doc.getDocumentElement());
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.java
deleted file mode 100644
index 8a2b6b39aa..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2ResultTransformer.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.databinding.xml;
-
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform TrAX Source to Result
- *
- * @version $Rev$ $Date$
- */
-public class Source2ResultTransformer extends BaseTransformer<Source, Result> implements
- PushTransformer<Source, Result> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
-
- public void transform(Source source, Result result, TransformationContext context) {
- try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
- transformer.transform(source, result);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<Result> getTargetType() {
- return Result.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.java
deleted file mode 100644
index 2ed548ad76..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Source2StringTransformer.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.databinding.xml;
-
-import java.io.StringWriter;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform TrAX Source to String
- *
- * @version $Rev$ $Date$
- */
-public class Source2StringTransformer extends BaseTransformer<Source, String> implements
- PullTransformer<Source, String> {
- private static final TransformerFactory FACTORY = TransformerFactory.newInstance();
-
- public String transform(Source source, TransformationContext context) {
- try {
- javax.xml.transform.Transformer transformer = FACTORY.newTransformer();
- StringWriter sw = new StringWriter();
- StreamResult result = new StreamResult(sw);
- transformer.transform(source, result);
- return sw.toString();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<Source> getSourceType() {
- return Source.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
deleted file mode 100644
index 6257681091..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAX2SAXAdapter.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
-
-/**
- * Adapter that converts from StAX to SAX event streams. Currently the following
- * SAX events are not generated:
- * <ul>
- * <li>ignorableWhitespace</li>
- * <li>skippedEntity</li>
- * <ul>
- * Also the following StAX events are not mapped:
- * <ul>
- * <li>CDATA</li>
- * <li>COMMENT</li>
- * <li>DTD</li>
- * <li>ENTITY_DECLARATION</li>
- * <li>ENTITY_REFERENCE</li>
- * <li>NOTATION_DECLARATION</li>
- * <li>SPACE</li>
- * </ul>
- * StAX ATTRIBUTE events are ignored but the equivalent attributes (derived from
- * the START_ELEMENT event) are supplied in the SAX startElement event's
- * Attributes parameter. If the adaptor is configured to pass namespace prefixes
- * then namespace information will also be included in the Attributes; StAX
- * NAMESPACE events are ignored. <p/> Another issue is namespace processing. If
- * the reader is positioned at a sub-node, we cannot capture all the in-scope
- * namespace bindings. Therefore we cannot re-create a proper SAX event stream
- * from a StAX parser. <p/> For example <p/> &lt;a:root xmlns:a="foo"
- * xmlns:b="bar"&gt;&lt;b:sub&gt;a:foo&lt;/b:sub&gt;&lt;/a:root&gt; <p/> And if
- * you are handed a parser at &lt;b:sub&gt;, then your SAX events should look
- * like: <p/> &lt;b:sub xmlns:a="foo" xmlns:b="bar"&gt;a:foo&lt;/b:sub&gt; <p/>
- * not: <p/> &lt;b:sub&gt;a:foo&lt;/b:sub&gt; <p/> <p/> Proposal: we change the
- * receiver of SAX events (SDOXMLResourceImpl) so that it uses NamespaceContext
- * to resolve prefix (as opposed to record start/endPrefixMappings and use it
- * for resolution.)
- *
- * @version $Rev$ $Date$
- */
-public class StAX2SAXAdapter {
- private final boolean namespacePrefixes;
-
- /**
- * Construct a new StAX to SAX adapter that will convert a StAX event stream
- * into a SAX event stream.
- *
- * @param namespacePrefixes whether xmlns attributes should be included in
- * startElement events;
- */
- public StAX2SAXAdapter(boolean namespacePrefixes) {
- this.namespacePrefixes = namespacePrefixes;
- }
-
- /**
- * Pull events from the StAX stream and dispatch to the SAX ContentHandler.
- * The StAX stream would typically be located on a START_DOCUMENT or
- * START_ELEMENT event and when this method returns it will be located on
- * the associated END_DOCUMENT or END_ELEMENT event. Behaviour with other
- * start events is undefined.
- *
- * @param reader StAX event source to read
- * @param handler SAX ContentHandler for processing events
- * @throws XMLStreamException if there was a problem reading the stream
- * @throws SAXException passed through from the ContentHandler
- */
- public void parse(XMLStreamReader reader, ContentHandler handler) throws XMLStreamException, SAXException {
- handler.setDocumentLocator(new LocatorAdaptor(reader.getLocation()));
-
- // remembers the nest level of elements to know when we are done
- int level = 0;
- int event = reader.getEventType();
- while (true) {
- switch (event) {
- case XMLStreamConstants.START_DOCUMENT:
- level++;
- handler.startDocument();
- break;
- case XMLStreamConstants.START_ELEMENT:
- level++;
- handleStartElement(reader, handler);
- break;
- case XMLStreamConstants.PROCESSING_INSTRUCTION:
- handler.processingInstruction(reader.getPITarget(), reader.getPIData());
- break;
- case XMLStreamConstants.CHARACTERS:
- handler.characters(reader.getTextCharacters(), reader.getTextStart(), reader
- .getTextLength());
- break;
- case XMLStreamConstants.END_ELEMENT:
- handleEndElement(reader, handler);
- level--;
- if (level == 0) {
- return;
- }
- break;
- case XMLStreamConstants.END_DOCUMENT:
- handler.endDocument();
- return;
- /*
- * uncomment to handle all events rather than just mapped
- * ones // StAX events that are not mapped to SAX case
- * XMLStreamConstants.COMMENT: case
- * XMLStreamConstants.SPACE: case
- * XMLStreamConstants.ENTITY_REFERENCE: case
- * XMLStreamConstants.DTD: case XMLStreamConstants.CDATA:
- * case XMLStreamConstants.NOTATION_DECLARATION: case
- * XMLStreamConstants.ENTITY_DECLARATION: break; // StAX
- * events handled in START_ELEMENT case
- * XMLStreamConstants.ATTRIBUTE: case
- * XMLStreamConstants.NAMESPACE: break; default: throw new
- * AssertionError("Unknown StAX event: " + event);
- */
- }
- event = reader.next();
- }
- }
-
- private void handleStartElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
- // send startPrefixMapping events immediately before startElement event
- int nsCount = reader.getNamespaceCount();
- for (int i = 0; i < nsCount; i++) {
- String prefix = reader.getNamespacePrefix(i);
- if (prefix == null) { // true for default namespace
- prefix = "";
- }
- handler.startPrefixMapping(prefix, reader.getNamespaceURI(i));
- }
-
- // fire startElement
- QName qname = reader.getName();
- String prefix = qname.getPrefix();
- String rawname;
- if (prefix == null || prefix.length() == 0) {
- rawname = qname.getLocalPart();
- } else {
- rawname = prefix + ':' + qname.getLocalPart();
- }
- Attributes attrs = getAttributes(reader);
- handler.startElement(qname.getNamespaceURI(), qname.getLocalPart(), rawname, attrs);
- }
-
- private static void handleEndElement(XMLStreamReader reader, ContentHandler handler) throws SAXException {
- // fire endElement
- QName qname = reader.getName();
- handler.endElement(qname.getNamespaceURI(), qname.getLocalPart(), qname.toString());
-
- // send endPrefixMapping events immediately after endElement event
- // we send them in the opposite order to that returned but this is not
- // actually required by SAX
- int nsCount = reader.getNamespaceCount();
- for (int i = nsCount - 1; i >= 0; i--) {
- String prefix = reader.getNamespacePrefix(i);
- if (prefix == null) { // true for default namespace
- prefix = "";
- }
- handler.endPrefixMapping(prefix);
- }
- }
-
- /**
- * Get the attributes associated with the current START_ELEMENT event.
- *
- * @return the StAX attributes converted to org.xml.sax.Attributes
- */
- private Attributes getAttributes(XMLStreamReader reader) {
- assert reader.getEventType() == XMLStreamConstants.START_ELEMENT;
-
- AttributesImpl attrs = new AttributesImpl();
-
- // add namespace declarations if required
- if (namespacePrefixes) {
- for (int i = 0; i < reader.getNamespaceCount(); i++) {
- String prefix = reader.getNamespacePrefix(i);
- String uri = reader.getNamespaceURI(i);
- attrs.addAttribute(null, prefix, "xmlns:" + prefix, "CDATA", uri);
- }
- }
-
- // Regular attributes
- for (int i = 0; i < reader.getAttributeCount(); i++) {
- String uri = reader.getAttributeNamespace(i);
- if (uri == null) {
- uri = "";
- }
- String localName = reader.getAttributeLocalName(i);
- String prefix = reader.getAttributePrefix(i);
- String qname;
- if (prefix == null || prefix.length() == 0) {
- qname = localName;
- } else {
- qname = prefix + ':' + localName;
- }
- String type = reader.getAttributeType(i);
- String value = reader.getAttributeValue(i);
-
- attrs.addAttribute(uri, localName, qname, type, value);
- }
-
- return attrs;
- }
-
- /**
- * Adaptor for mapping Locator information.
- */
- private static final class LocatorAdaptor implements Locator {
- private final Location location;
-
- private LocatorAdaptor(Location location) {
- this.location = location;
- }
-
- public int getColumnNumber() {
- return location == null ? 0 : location.getColumnNumber();
- }
-
- public int getLineNumber() {
- return location == null ? 0 : location.getLineNumber();
- }
-
- public String getPublicId() {
- return location == null ? "" : location.getPublicId();
- }
-
- public String getSystemId() {
- return location == null ? "" : location.getSystemId();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
deleted file mode 100644
index ed57992910..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXDataBinding.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * A DataBinding for the StAX
- *
- * @version $Rev$ $Date$
- */
-public class StAXDataBinding extends BaseDataBinding {
- public static final String NAME = XMLStreamReader.class.getName();
-
- public StAXDataBinding() {
- super(NAME, XMLStreamReader.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (super.introspect(type, operation)) {
- type.setLogical(XMLType.UNKNOWN);
- type.setDataBinding(NAME);
- return true;
- } else {
- return false;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.java
deleted file mode 100644
index 103ecbd7d1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StAXHelper.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.databinding.xml;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.Source;
-
-
-public final class StAXHelper {
- private static final XMLInputFactory INPUT_FACTORY = XMLInputFactory.newInstance();
- private static final XMLOutputFactory OUTPUT_FACTORY = XMLOutputFactory.newInstance();
-
- private StAXHelper() {
- }
-
- public static XMLStreamReader createXMLStreamReader(InputStream inputStream) throws XMLStreamException {
- return INPUT_FACTORY.createXMLStreamReader(inputStream);
- }
-
- public static XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
- return INPUT_FACTORY.createXMLStreamReader(reader);
- }
-
- public static XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
- return INPUT_FACTORY.createXMLStreamReader(source);
- }
-
- public static XMLStreamReader createXMLStreamReader(String string) throws XMLStreamException {
- StringReader reader = new StringReader(string);
- return createXMLStreamReader(reader);
- }
-
- public static String save(XMLStreamReader reader) throws XMLStreamException {
- StringWriter writer = new StringWriter();
- save(reader, writer);
- return writer.toString();
- }
-
- public static void save(XMLStreamReader reader, OutputStream outputStream) throws XMLStreamException {
- XMLStreamSerializer serializer = new XMLStreamSerializer();
- XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(outputStream);
- serializer.serialize(reader, streamWriter);
- streamWriter.flush();
- }
-
- public static void save(XMLStreamReader reader, Writer writer) throws XMLStreamException {
- XMLStreamSerializer serializer = new XMLStreamSerializer();
- XMLStreamWriter streamWriter = OUTPUT_FACTORY.createXMLStreamWriter(writer);
- serializer.serialize(reader, streamWriter);
- streamWriter.flush();
- }
-
- public static void save(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- XMLStreamSerializer serializer = new XMLStreamSerializer();
- serializer.serialize(reader, writer);
- writer.flush();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
deleted file mode 100644
index f8967e35b6..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/StreamDataPipe.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class StreamDataPipe extends BaseTransformer<OutputStream, InputStream> implements
- DataPipeTransformer<OutputStream, InputStream> {
-
- public DataPipe<OutputStream, InputStream> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<InputStream> getTargetType() {
- return InputStream.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
- @Override
- protected Class<OutputStream> getSourceType() {
- return OutputStream.class;
- }
-
- public static class Pipe implements DataPipe<OutputStream, InputStream> {
- private ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-
- public InputStream getResult() {
- return new ByteArrayInputStream(outputStream.toByteArray());
- }
-
- public OutputStream getSink() {
- return outputStream;
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
deleted file mode 100644
index 062e10cc45..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2Node.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.StringReader;
-
-import javax.xml.parsers.DocumentBuilder;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-public class String2Node extends BaseTransformer<String, Node> implements PullTransformer<String, Node> {
-
- public Node transform(String source, TransformationContext context) {
- try {
- DocumentBuilder builder = DOMHelper.newDocumentBuilder();
- InputSource inputSource = new InputSource(new StringReader(source));
- return builder.parse(inputSource);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.java
deleted file mode 100644
index c56dba1843..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SAX.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.databinding.xml;
-
-import java.io.StringReader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * Transform XML string to SAX
- *
- * @version $Rev$ $Date$
- */
-public class String2SAX extends BaseTransformer<String, ContentHandler> implements
- PushTransformer<String, ContentHandler> {
-
- public void transform(String source, ContentHandler target, TransformationContext context) {
- try {
- new InputSource2SAX().transform(new InputSource(new StringReader(source)), target, context);
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.java
deleted file mode 100644
index c2de202a9b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2SourceTransformer.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.databinding.xml;
-
-import java.io.StringReader;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-/**
- * Transform XML String to Source
- *
- * @version $Rev$ $Date$
- */
-public class String2SourceTransformer extends BaseTransformer<String, Source> implements
- PullTransformer<String, Source> {
-
- public Source transform(String source, TransformationContext context) {
- try {
- return new StreamSource(new StringReader(source));
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<Source> getTargetType() {
- return Source.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.java
deleted file mode 100644
index a7364006d0..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/String2XMLStreamReader.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.databinding.xml;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class String2XMLStreamReader extends BaseTransformer<String, XMLStreamReader> implements
- PullTransformer<String, XMLStreamReader> {
-
- public XMLStreamReader transform(String source, TransformationContext context) {
- try {
- return StAXHelper.createXMLStreamReader(source);
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<String> getSourceType() {
- return String.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
deleted file mode 100644
index d73e495798..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/WrappingXMLStreamReader.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.util.StreamReaderDelegate;
-
-public class WrappingXMLStreamReader extends StreamReaderDelegate implements XMLFragmentStreamReader {
-
- private boolean done;
- private int level;
-
- public WrappingXMLStreamReader(XMLStreamReader realReader) throws XMLStreamException {
- super(realReader);
- if (realReader == null) {
- throw new UnsupportedOperationException("Reader cannot be null");
- }
-
- if (realReader instanceof XMLFragmentStreamReader) {
- ((XMLFragmentStreamReader)realReader).init();
- }
-
- if (realReader.getEventType() == START_DOCUMENT) {
- // Position to the 1st element
- realReader.nextTag();
- }
- if (realReader.getEventType() != START_ELEMENT) {
- throw new IllegalStateException("The reader is not positioned at START_DOCUMENT or START_ELEMENT");
- }
- this.done = false;
- this.level = 1;
- }
-
- @Override
- public boolean hasNext() throws XMLStreamException {
- return !done && super.hasNext();
- }
-
- @Override
- public int next() throws XMLStreamException {
- if (!hasNext()) {
- throw new IllegalStateException("No more events");
- }
- int event = super.next();
- if (!super.hasNext()) {
- done = true;
- }
- if (event == START_ELEMENT) {
- level++;
- } else if (event == END_ELEMENT) {
- level--;
- if (level == 0) {
- done = true;
- }
- }
- return event;
- }
-
- @Override
- public int nextTag() throws XMLStreamException {
- int event = 0;
- while (true) {
- event = next();
- if (event == START_ELEMENT || event == END_ELEMENT) {
- return event;
- }
- }
- }
-
- public void setParentNamespaceContext(NamespaceContext nsContext) {
- // nothing to do here
- }
-
- public void init() {
- // Nothing to do here
- }
-
- public boolean isDone() {
- return done;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.java
deleted file mode 100644
index 5ab7272d58..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/Writer2ReaderDataPipe.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.databinding.xml;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class Writer2ReaderDataPipe extends BaseTransformer<Writer, Reader> implements DataPipeTransformer<Writer, Reader> {
-
- public DataPipe<Writer, Reader> newInstance() {
- return new Pipe();
- }
-
- @Override
- protected Class<Reader> getTargetType() {
- return Reader.class;
- }
-
- @Override
- public int getWeight() {
- return 50;
- }
-
- @Override
- protected Class<Writer> getSourceType() {
- return Writer.class;
- }
-
- private static class Pipe implements DataPipe<Writer, Reader> {
- private StringWriter writer = new StringWriter();
-
- public Reader getResult() {
- return new StringReader(writer.toString());
- }
-
- public Writer getSink() {
- return writer;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
deleted file mode 100644
index a7088eada3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLDocumentStreamReader.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.NoSuchElementException;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * This class is derived from Apache Axis2 class
- * org.apache.axis2.util.StreamWrapper</a>. It's used wrap a XMLStreamReader to
- * create a XMLStreamReader representing a document and it will produce
- * START_DOCUMENT, END_DOCUMENT events.
- *
- * @version $Rev$ $Date$
- */
-public class XMLDocumentStreamReader implements XMLStreamReader {
- private static final int STATE_COMPLETE_AT_NEXT = 2; // The wrapper
- // will produce
- // END_DOCUMENT
-
- private static final int STATE_COMPLETED = 3; // Done
-
- private static final int STATE_INIT = 0; // The wrapper will produce
- // START_DOCUMENT
-
- private static final int STATE_SWITCHED = 1; // The real reader will
- // produce events
-
- private XMLStreamReader realReader;
- private boolean fragment;
- private int level = 1;
-
- private int state = STATE_INIT;
-
- public XMLDocumentStreamReader(XMLStreamReader realReader) {
- if (realReader == null) {
- throw new UnsupportedOperationException("Reader cannot be null");
- }
-
- this.realReader = realReader;
-
- if (realReader instanceof XMLFragmentStreamReader) {
- ((XMLFragmentStreamReader)realReader).init();
- }
-
- // If the real reader is positioned at START_DOCUMENT, always use
- // the real reader
- if (realReader.getEventType() == START_DOCUMENT) {
- fragment = false;
- state = STATE_SWITCHED;
- }
- }
-
- public void close() throws XMLStreamException {
- realReader.close();
- }
-
- public int getAttributeCount() {
- if (isDelegating()) {
- return realReader.getAttributeCount();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeLocalName(int i) {
- if (isDelegating()) {
- return realReader.getAttributeLocalName(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public QName getAttributeName(int i) {
- if (isDelegating()) {
- return realReader.getAttributeName(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeNamespace(int i) {
- if (isDelegating()) {
- return realReader.getAttributeNamespace(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributePrefix(int i) {
- if (isDelegating()) {
- return realReader.getAttributePrefix(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeType(int i) {
- if (isDelegating()) {
- return realReader.getAttributeType(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeValue(int i) {
- if (isDelegating()) {
- return realReader.getAttributeValue(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeValue(String s, String s1) {
- if (isDelegating()) {
- return realReader.getAttributeValue(s, s1);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getCharacterEncodingScheme() {
- return realReader.getCharacterEncodingScheme();
- }
-
- public String getElementText() throws XMLStreamException {
- if (isDelegating()) {
- return realReader.getElementText();
- } else {
- throw new XMLStreamException();
- }
- }
-
- public String getEncoding() {
- return realReader.getEncoding();
- }
-
- public int getEventType() {
- int event = -1;
- switch (state) {
- case STATE_SWITCHED:
- case STATE_COMPLETE_AT_NEXT:
- event = realReader.getEventType();
- break;
- case STATE_INIT:
- event = START_DOCUMENT;
- break;
- case STATE_COMPLETED:
- event = END_DOCUMENT;
- break;
- }
- return event;
- }
-
- public String getLocalName() {
- if (isDelegating()) {
- return realReader.getLocalName();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public Location getLocation() {
- if (isDelegating()) {
- return realReader.getLocation();
- } else {
- return null;
- }
- }
-
- public QName getName() {
- if (isDelegating()) {
- return realReader.getName();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public NamespaceContext getNamespaceContext() {
- return realReader.getNamespaceContext();
- }
-
- public int getNamespaceCount() {
- if (isDelegating()) {
- return realReader.getNamespaceCount();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespacePrefix(int i) {
- if (isDelegating()) {
- return realReader.getNamespacePrefix(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI() {
- if (isDelegating()) {
- return realReader.getNamespaceURI();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI(int i) {
- if (isDelegating()) {
- return realReader.getNamespaceURI(i);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getNamespaceURI(String s) {
- if (isDelegating()) {
- return realReader.getNamespaceURI(s);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPIData() {
- if (isDelegating()) {
- return realReader.getPIData();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPITarget() {
- if (isDelegating()) {
- return realReader.getPITarget();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getPrefix() {
- if (isDelegating()) {
- return realReader.getPrefix();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public Object getProperty(String s) throws IllegalArgumentException {
- if (isDelegating()) {
- return realReader.getProperty(s);
- } else {
- throw new IllegalArgumentException();
- }
- }
-
- public String getText() {
- if (isDelegating()) {
- return realReader.getText();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public char[] getTextCharacters() {
- if (isDelegating()) {
- return realReader.getTextCharacters();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- if (isDelegating()) {
- return realReader.getTextCharacters(i, chars, i1, i2);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextLength() {
- if (isDelegating()) {
- return realReader.getTextLength();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextStart() {
- if (isDelegating()) {
- return realReader.getTextStart();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getVersion() {
- if (isDelegating()) {
- return realReader.getVersion();
- } else {
- return null;
- }
- }
-
- public boolean hasName() {
- if (isDelegating()) {
- return realReader.hasName();
- } else {
- return false;
- }
- }
-
- public boolean hasNext() throws XMLStreamException {
- if (state == STATE_COMPLETE_AT_NEXT) {
- return true;
- } else if (state == STATE_COMPLETED) {
- return false;
- } else if (state == STATE_SWITCHED) {
- return realReader.hasNext();
- } else {
- return true;
- }
- }
-
- public boolean hasText() {
- if (isDelegating()) {
- return realReader.hasText();
- } else {
- return false;
- }
- }
-
- public boolean isAttributeSpecified(int i) {
- if (isDelegating()) {
- return realReader.isAttributeSpecified(i);
- } else {
- return false;
- }
- }
-
- public boolean isCharacters() {
- if (isDelegating()) {
- return realReader.isCharacters();
- } else {
- return false;
- }
- }
-
- private boolean isDelegating() {
- return state == STATE_SWITCHED || state == STATE_COMPLETE_AT_NEXT;
- }
-
- public boolean isEndElement() {
- if (isDelegating()) {
- return realReader.isEndElement();
- } else {
- return false;
- }
- }
-
- public boolean isStandalone() {
- if (isDelegating()) {
- return realReader.isStandalone();
- } else {
- return false;
- }
- }
-
- public boolean isStartElement() {
- if (isDelegating()) {
- return realReader.isStartElement();
- } else {
- return false;
- }
- }
-
- public boolean isWhiteSpace() {
- if (isDelegating()) {
- return realReader.isWhiteSpace();
- } else {
- return false;
- }
- }
-
- public int next() throws XMLStreamException {
- int returnEvent;
-
- switch (state) {
- case STATE_SWITCHED:
- returnEvent = realReader.next();
- if (returnEvent == END_DOCUMENT) {
- state = STATE_COMPLETED;
- } else if (!realReader.hasNext()) {
- state = STATE_COMPLETE_AT_NEXT;
- }
- if (fragment && returnEvent == END_ELEMENT) {
- level--;
- if (level == 0) {
- // We are now at the end of the top-level element in the fragment
- state = STATE_COMPLETE_AT_NEXT;
- }
- }
- if (fragment && returnEvent == START_ELEMENT) {
- level++;
- }
- break;
- case STATE_INIT:
- state = STATE_SWITCHED;
- returnEvent = realReader.getEventType();
- if (returnEvent == START_ELEMENT) {
- // The real reader is positioned at the top-level element in the fragment
- level = 0;
- fragment = true;
- }
- break;
- case STATE_COMPLETE_AT_NEXT:
- state = STATE_COMPLETED;
- returnEvent = END_DOCUMENT;
- break;
- case STATE_COMPLETED:
- // oops - no way we can go beyond this
- throw new NoSuchElementException("End of stream has reached.");
- default:
- throw new UnsupportedOperationException();
- }
-
- return returnEvent;
- }
-
- public int nextTag() throws XMLStreamException {
- if (isDelegating()) {
- int returnEvent = realReader.nextTag();
- if (fragment && returnEvent == END_ELEMENT) {
- level--;
- if (level == 0) {
- // We are now at the end of the top-level element in the fragment
- state = STATE_COMPLETE_AT_NEXT;
- }
- }
- if (fragment && returnEvent == START_ELEMENT) {
- level++;
- }
- return returnEvent;
- } else {
- throw new XMLStreamException();
- }
- }
-
- public void require(int i, String s, String s1) throws XMLStreamException {
- if (isDelegating()) {
- realReader.require(i, s, s1);
- }
- }
-
- public boolean standaloneSet() {
- if (isDelegating()) {
- return realReader.standaloneSet();
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java
deleted file mode 100644
index a42d6acc9a..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReader.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-public interface XMLFragmentStreamReader extends XMLStreamReader {
- QName NIL_QNAME = new QName("http://www.w3.org/2001/XMLSchema-instance", "nil", "xsi");
- String NIL_VALUE_TRUE = "true";
-
- /**
- * this will help to handle Text within the current element. user should
- * pass the element text to the property list as this ELEMENT_TEXT as the
- * key. This key deliberately has a space in it so that it is not a valid
- * XML name
- */
- String ELEMENT_TEXT = "Element Text";
-
- /**
- * Extra method to query the state of the pullparser
- */
- boolean isDone();
-
- /**
- * add the parent namespace context to this parser
- */
- void setParentNamespaceContext(NamespaceContext nsContext);
-
- /**
- * Initiate the parser - this will do whatever the needed tasks to initiate
- * the parser and must be called before attempting any specific parsing
- * using this parser
- */
- void init();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
deleted file mode 100644
index f1084cf2a3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLFragmentStreamReaderImpl.java
+++ /dev/null
@@ -1,857 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * This is the new implementation of the XMLFramentStreamReader. The approach
- * here is simple When the pull parser needs to generate events for a particular
- * name-value(s) pair it always hands over (delegates) the task to another pull
- * parser which knows how to deal with it The common types of name value pairs
- * we'll come across are
- * <ul>
- * <li> String name/QName name - String value
- * <li> String name/QName name - String[] value
- * <li> QName name/String name - XMLStreamReader value
- * <li> QName name/String name - XMLStreamable value
- * <li> QName name/String name - Java bean
- * <li> QName name/String name - Datahandler
- *
- * </ul>
- * <p/> As for the attributes, these are the possible combinations in the array
- * <ul>
- * <li> String name/QName name - String value
- * </ul>
- * Note that certain array methods have been deliberately removed to avoid
- * complications. The generated code will take the trouble to lay the elements
- * of the array in the correct order <p/> <p/> Hence there will be a parser impl
- * that knows how to handle these types, and this parent parser will always
- * delegate these tasks to the child pullparasers in effect this is one huge
- * state machine that has only a few states and delegates things down to the
- * child parsers whenever possible <p/>
- *
- * @version $Rev$ $Date$
- */
-public class XMLFragmentStreamReaderImpl implements XMLFragmentStreamReader {
-
- private static final int DELEGATED_STATE = 2;
- private static final int END_ELEMENT_STATE = 1;
- // states for this pullparser - it can only have four states
- private static final int START_ELEMENT_STATE = 0;
- private static final int TEXT_STATE = 3;
-
- protected NamedProperty[] attributes;
-
- // reference to the child reader
- protected XMLFragmentStreamReader childReader;
- // current property index
- // initialized at zero
- protected int index;
- protected Map<String, String> declaredNamespaceMap = new HashMap<String, String>();
- protected QName elementQName;
-
- // we always create a new namespace context
- protected DelegatingNamespaceContext namespaceContext = new DelegatingNamespaceContext();
-
- protected NamedProperty[] elements;
-
- // integer field that keeps the state of this
- // parser.
- protected int state = START_ELEMENT_STATE;
-
- /*
- * we need to pass in a namespace context since when delegated, we've no
- * idea of the current namespace context. So it needs to be passed on here!
- */
- public XMLFragmentStreamReaderImpl(QName elementQName, NamedProperty[] elements, NamedProperty[] attributes) {
- // validate the lengths, since both the arrays are supposed
- // to have
- this.elements = elements == null ? new NamedProperty[0] : elements;
- this.elementQName = elementQName;
- this.attributes = attributes == null ? new NamedProperty[0] : attributes;
- }
-
- protected XMLFragmentStreamReaderImpl(QName elementQName) {
- this.elementQName = elementQName;
- }
-
- /**
- * add the namespace context
- */
-
- public void setParentNamespaceContext(NamespaceContext nsContext) {
- // register the namespace context passed in to this
- this.namespaceContext.setParentNsContext(nsContext);
-
- }
-
- protected NamedProperty[] getElements() {
- return elements;
- }
-
- protected NamedProperty[] getAttributes() {
- return attributes;
- }
-
- protected QName[] getNamespaces() {
- return new QName[0];
- }
-
- /**
- * @param prefix
- * @param uri
- */
- protected void addToNsMap(String prefix, String uri) {
- if (!uri.equals(namespaceContext.getNamespaceURI(prefix))) {
- namespaceContext.pushNamespace(prefix, uri);
- declaredNamespaceMap.put(prefix, uri);
- }
- }
-
- public void close() throws XMLStreamException {
- // do nothing here - we have no resources to free
- }
-
- public int getAttributeCount() {
- return (state == DELEGATED_STATE) ? childReader.getAttributeCount() : (state == START_ELEMENT_STATE
- ? getAttributes().length : 0);
- }
-
- public String getAttributeLocalName(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getAttributeLocalName(i);
- } else if (state == START_ELEMENT_STATE) {
- QName name = getAttributeName(i);
- if (name == null) {
- return null;
- } else {
- return name.getLocalPart();
- }
- } else {
- throw new IllegalStateException();
- }
- }
-
- /**
- * @param i
- */
- public QName getAttributeName(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getAttributeName(i);
- } else if (state == START_ELEMENT_STATE) {
- if ((i >= (getAttributes().length)) || i < 0) { // out of range
- return null;
- } else {
- // get the attribute pointer
- QName attribPointer = getAttributes()[i].getKey();
- // case one - attrib name is null
- // this should be the pointer to the OMAttribute then
- if (attribPointer == null) {
- throw new UnsupportedOperationException();
- } else if (attribPointer instanceof QName) {
- return attribPointer;
- } else {
- return null;
- }
- }
- } else {
- throw new IllegalStateException(); // as per the API contract
- }
-
- }
-
- public String getAttributeNamespace(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getAttributeNamespace(i);
- } else if (state == START_ELEMENT_STATE) {
- QName name = getAttributeName(i);
- if (name == null) {
- return null;
- } else {
- return name.getNamespaceURI();
- }
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributePrefix(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getAttributePrefix(i);
- } else if (state == START_ELEMENT_STATE) {
- QName name = getAttributeName(i);
- if (name == null) {
- return null;
- } else {
- return name.getPrefix();
- }
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getAttributeType(int i) {
- return null; // not supported
- }
-
- public String getAttributeValue(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getAttributeValue(i);
- } else if (state == START_ELEMENT_STATE) {
- if ((i >= (getAttributes().length)) || i < 0) { // out of range
- return null;
- } else {
- // get the attribute pointer
- QName attribPointer = getAttributes()[i].getKey();
- Object omAttribObj = getAttributes()[i].getValue();
- // case one - attrib name is null
- // this should be the pointer to the OMAttribute then
- if (attribPointer == null) {
- throw new UnsupportedOperationException();
- } else if (attribPointer instanceof QName) {
- return (String)omAttribObj;
- } else {
- return null;
- }
- }
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public String getAttributeValue(String nsUri, String localName) {
-
- int attribCount = getAttributeCount();
- String returnValue = null;
- QName attribQualifiedName;
- for (int i = 0; i < attribCount; i++) {
- attribQualifiedName = getAttributeName(i);
- if (nsUri == null) {
- if (localName.equals(attribQualifiedName.getLocalPart())) {
- returnValue = getAttributeValue(i);
- break;
- }
- } else {
- if (localName.equals(attribQualifiedName.getLocalPart()) && nsUri.equals(attribQualifiedName
- .getNamespaceURI())) {
- returnValue = getAttributeValue(i);
- break;
- }
- }
-
- }
-
- return returnValue;
- }
-
- public String getCharacterEncodingScheme() {
- return null; // TODO - should we return something for this ?
- }
-
- /**
- * TODO implement the right contract for this
- *
- * @throws XMLStreamException
- */
- public String getElementText() throws XMLStreamException {
- if (state == DELEGATED_STATE) {
- return childReader.getElementText();
- } else {
- return null;
- }
-
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / attribute handling
- // /////////////////////////////////////////////////////////////////////////
-
- public String getEncoding() {
- if (state == DELEGATED_STATE) {
- return childReader.getEncoding();
- } else {
- // we've no idea what the encoding is going to be in this case
- // perhaps we ought to return some constant here, which the user
- // might
- // have access to change!
- return null;
- }
- }
-
- public int getEventType() {
- if (state == START_ELEMENT_STATE) {
- return START_ELEMENT;
- } else if (state == END_ELEMENT_STATE) {
- return END_ELEMENT;
- } else if (state == TEXT_STATE) {
- return CHARACTERS;
- } else { // this is the delegated state
- return childReader.getEventType();
- }
- }
-
- public String getLocalName() {
- if (state == DELEGATED_STATE) {
- return childReader.getLocalName();
- } else if (state != TEXT_STATE) {
- return elementQName.getLocalPart();
- } else {
- throw new IllegalStateException();
- }
- }
-
- /**
- */
- public Location getLocation() {
- // return a default location
- return new Location() {
- public int getCharacterOffset() {
- return 0;
- }
-
- public int getColumnNumber() {
- return 0;
- }
-
- public int getLineNumber() {
- return 0;
- }
-
- public String getPublicId() {
- return null;
- }
-
- public String getSystemId() {
- return null;
- }
- };
- }
-
- public QName getName() {
- if (state == DELEGATED_STATE) {
- return childReader.getName();
- } else if (state != TEXT_STATE) {
- return elementQName;
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public NamespaceContext getNamespaceContext() {
- if (state == DELEGATED_STATE) {
- return childReader.getNamespaceContext();
- } else {
- return namespaceContext;
- }
-
- }
-
- public int getNamespaceCount() {
- if (state == DELEGATED_STATE) {
- return childReader.getNamespaceCount();
- } else {
- return declaredNamespaceMap.size();
- }
- }
-
- /**
- * @param i
- */
- public String getNamespacePrefix(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getNamespacePrefix(i);
- } else if (state != TEXT_STATE) {
- // order the prefixes
- String[] prefixes = makePrefixArray();
- if ((i >= prefixes.length) || (i < 0)) {
- return null;
- } else {
- return prefixes[i];
- }
-
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public String getNamespaceURI() {
- if (state == DELEGATED_STATE) {
- return childReader.getNamespaceURI();
- } else if (state == TEXT_STATE) {
- return null;
- } else {
- return elementQName.getNamespaceURI();
- }
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // //////////// end of attribute handling
- // /////////////////////////////////////////////////////////////////////////
-
- // //////////////////////////////////////////////////////////////////////////
- // //////////// namespace handling
- // //////////////////////////////////////////////////////////////////////////
-
- public String getNamespaceURI(int i) {
- if (state == DELEGATED_STATE) {
- return childReader.getNamespaceURI(i);
- } else if (state != TEXT_STATE) {
- String namespacePrefix = getNamespacePrefix(i);
- return namespacePrefix == null ? null : (String)declaredNamespaceMap.get(namespacePrefix);
- } else {
- throw new IllegalStateException();
- }
-
- }
-
- public String getNamespaceURI(String prefix) {
- return namespaceContext.getNamespaceURI(prefix);
- }
-
- public String getPIData() {
- throw new UnsupportedOperationException("Yet to be implemented !!");
- }
-
- public String getPITarget() {
- throw new UnsupportedOperationException("Yet to be implemented !!");
- }
-
- public String getPrefix() {
- if (state == DELEGATED_STATE) {
- return childReader.getPrefix();
- } else if (state == TEXT_STATE) {
- return null;
- } else {
- String prefix = elementQName.getPrefix();
- return "".equals(prefix) ? null : prefix;
- }
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // /////// end of namespace handling
- // /////////////////////////////////////////////////////////////////////////
-
- /**
- * @param key
- * @throws IllegalArgumentException
- */
- public Object getProperty(String key) throws IllegalArgumentException {
- if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
- return null;
- } else if (state == TEXT_STATE) {
- return null;
- } else if (state == DELEGATED_STATE) {
- return childReader.getProperty(key);
- } else {
- return null;
- }
-
- }
-
- public String getText() {
- if (state == DELEGATED_STATE) {
- return childReader.getText();
- } else if (state == TEXT_STATE) {
- return (String)getElements()[index - 1].getValue();
- } else {
- throw new IllegalStateException();
- }
- }
-
- public char[] getTextCharacters() {
- if (state == DELEGATED_STATE) {
- return childReader.getTextCharacters();
- } else if (state == TEXT_STATE) {
- return getElements()[index - 1].getValue() == null ? new char[0] : ((String)getElements()[index - 1]
- .getValue()).toCharArray();
- } else {
- throw new IllegalStateException();
- }
- }
-
- private int copy(int sourceStart, char[] target, int targetStart, int length) {
- char[] source = getTextCharacters();
- if (sourceStart > source.length) {
- throw new IndexOutOfBoundsException("source start > source length");
- }
- int sourceLen = source.length - sourceStart;
- if (length > sourceLen) {
- length = sourceLen;
- }
- System.arraycopy(source, sourceStart, target, targetStart, length);
- return sourceLen;
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- if (state == DELEGATED_STATE) {
- return childReader.getTextCharacters(i, chars, i1, i2);
- } else if (state == TEXT_STATE) {
- return copy(i, chars, i1, i2);
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextLength() {
- if (state == DELEGATED_STATE) {
- return childReader.getTextLength();
- } else if (state == TEXT_STATE) {
- return getTextCharacters().length;
- } else {
- throw new IllegalStateException();
- }
- }
-
- public int getTextStart() {
- if (state == DELEGATED_STATE) {
- return childReader.getTextStart();
- } else if (state == TEXT_STATE) {
- return 0; // assume text always starts at 0
- } else {
- throw new IllegalStateException();
- }
- }
-
- public String getVersion() {
- return null;
- }
-
- public boolean hasName() {
- // since this parser always has a name, the hasName
- // has to return true if we are still navigating this element
- // if not we should ask the child reader for it.
- if (state == DELEGATED_STATE) {
- return childReader.hasName();
- } else {
- return state != TEXT_STATE;
- }
- }
-
- /**
- * @throws XMLStreamException
- */
- public boolean hasNext() throws XMLStreamException {
- if (state == DELEGATED_STATE) {
- if (childReader.isDone()) {
- // the child reader is done. We shouldn't be getting the
- // hasNext result from the child pullparser then
- return true;
- } else {
- return childReader.hasNext();
- }
- } else {
- return state == START_ELEMENT_STATE || state == TEXT_STATE;
-
- }
- }
-
- /**
- * check the validity of this implementation
- */
- public boolean hasText() {
- if (state == DELEGATED_STATE) {
- return childReader.hasText();
- } else {
- return state == TEXT_STATE;
- }
-
- }
-
- /**
- * we need to split out the calling to the populate namespaces separately
- * since this needs to be done *after* setting the parent namespace context.
- * We cannot assume it will happen at construction!
- */
- public void init() {
- // here we have an extra issue to attend to. we need to look at the
- // prefixes and URIs (the combination) and populate a HashMap of
- // namespaces. The HashMap of namespaces will be used to serve the
- // namespace context
-
- populateNamespaceContext();
- }
-
- public boolean isAttributeSpecified(int i) {
- return false; // not supported
- }
-
- public boolean isCharacters() {
- if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
- return false;
- }
- return childReader.isCharacters();
- }
-
- /**
- * are we done ?
- */
- public boolean isDone() {
- return state == END_ELEMENT_STATE;
- }
-
- public boolean isEndElement() {
- if (state == START_ELEMENT_STATE) {
- return false;
- } else if (state == END_ELEMENT_STATE) {
- return true;
- }
- return childReader.isEndElement();
- }
-
- public boolean isStandalone() {
- return true;
- }
-
- public boolean isStartElement() {
- if (state == START_ELEMENT_STATE) {
- return true;
- } else if (state == END_ELEMENT_STATE) {
- return false;
- }
- return childReader.isStartElement();
- }
-
- public boolean isWhiteSpace() {
- if (state == START_ELEMENT_STATE || state == END_ELEMENT_STATE) {
- return false;
- }
- return childReader.isWhiteSpace();
- }
-
- /**
- * Get the prefix list from the HashTable and take that into an array
- */
- private String[] makePrefixArray() {
- String[] prefixes = declaredNamespaceMap.keySet().toArray(new String[declaredNamespaceMap.size()]);
- Arrays.sort(prefixes);
- return prefixes;
- }
-
- /**
- * By far this should be the most important method in this class this method
- * changes the state of the parser
- */
- public int next() throws XMLStreamException {
- int returnEvent = -1; // invalid state is the default state
- switch (state) {
- case START_ELEMENT_STATE:
- // current element is start element. We should be looking at the
- // property list and making a pullparser for the property value
- if (getElements() == null || getElements().length == 0) {
- // no properties - move to the end element state
- // straight away
- state = END_ELEMENT_STATE;
- returnEvent = END_ELEMENT;
- } else {
- // there are properties. now we should delegate this task to
- // a
- // child reader depending on the property type
- returnEvent = processProperties();
-
- }
- break;
- case END_ELEMENT_STATE:
- // we've reached the end element already. If the user tries to
- // push
- // further ahead then it is an exception
- throw new XMLStreamException("Trying to go beyond the end of the pullparser");
-
- case DELEGATED_STATE:
- if (childReader.isDone()) {
- // we've reached the end!
- if (index > (getElements().length - 1)) {
- state = END_ELEMENT_STATE;
- returnEvent = END_ELEMENT;
- } else {
- returnEvent = processProperties();
- }
- } else {
- returnEvent = childReader.next();
- }
- break;
-
- case TEXT_STATE:
- // if there are any more event we should be delegating to
- // processProperties. if not we just return an end element
- if (index > (getElements().length - 1)) {
- state = END_ELEMENT_STATE;
- returnEvent = END_ELEMENT;
- } else {
- returnEvent = processProperties();
- }
- break;
- }
- return returnEvent;
- }
-
- // /////////////////////////////////////////////////////////////////////////
- // / Other utility methods
- // ////////////////////////////////////////////////////////////////////////
-
- /**
- * TODO implement this
- *
- * @throws XMLStreamException
- */
- public int nextTag() throws XMLStreamException {
- return 0;
- }
-
- /**
- * Populates a namespace context
- */
- private void populateNamespaceContext() {
-
- // first add the current element namespace to the namespace context
- // declare it if not found
- addToNsMap(elementQName.getPrefix(), elementQName.getNamespaceURI());
-
- for (QName n : getNamespaces()) {
- addToNsMap(n.getPrefix(), n.getNamespaceURI());
- }
-
- // traverse through the attributes and populate the namespace context
- // the attrib list can be of many combinations
- // the valid combinations are
- // String - String
- // QName - QName
- // null - OMAttribute
-
- for (int i = 0; i < getAttributes().length; i++) { // jump in two
- QName attrQName = getAttributes()[i].getKey();
- if (!"".equals(attrQName.getNamespaceURI())) {
- addToNsMap(attrQName.getPrefix(), attrQName.getNamespaceURI());
- }
- }
- }
-
- /**
- * A convenient method to reuse the properties
- *
- * @return event to be thrown
- * @throws XMLStreamException
- */
- private int processProperties() throws XMLStreamException {
- // move to the next property depending on the current property
- // index
- QName propertyQName = getElements()[index].getKey();
- boolean textFound = false;
- if (propertyQName == null) {
- throw new XMLStreamException("property key cannot be null!");
- } else if (ELEMENT_TEXT.equals(propertyQName.getLocalPart())) {
- // propPointer being a String has a special case
- // that is it can be a the special constant ELEMENT_TEXT that
- // says this text event
- textFound = true;
- }
-
- // OK! we got the key. Now look at the value
- Object propertyValue = getElements()[index].getValue();
- // cater for the special case now
- if (textFound) {
- // no delegation here - make the parser null and immediately
- // return with the event characters
- childReader = null;
- state = TEXT_STATE;
- ++index;
- return CHARACTERS;
- } else if (propertyValue == null) {
- // if the value is null we delegate the work to a nullable
- // parser
- childReader = new NilElementStreamReader(propertyQName);
- childReader.setParentNamespaceContext(this.namespaceContext);
- childReader.init();
- } else if (propertyValue instanceof String) {
- // strings are handled by the NameValuePairStreamReader
- childReader = new NameValuePairStreamReader(propertyQName, (String)propertyValue);
- childReader.setParentNamespaceContext(this.namespaceContext);
- childReader.init();
- } else if (propertyValue instanceof String[]) {
- // string[] are handled by the NameValueArrayStreamReader
- // if the array is empty - skip it
- if (((String[])propertyValue).length == 0) {
- // advance the index
- ++index;
- return processProperties();
- } else {
- childReader = new NameValueArrayStreamReader(propertyQName, (String[])propertyValue);
- childReader.setParentNamespaceContext(this.namespaceContext);
- childReader.init();
- }
-
- } else if (propertyValue instanceof XMLStreamable) {
- // ADBbean has it's own method to get a reader
- XMLStreamReader reader = ((XMLStreamable)propertyValue).getXMLStreamReader(propertyQName);
- // we know for sure that this is an ADB XMLStreamreader.
- // However we need to make sure that it is compatible
- if (reader instanceof XMLFragmentStreamReader) {
- childReader = (XMLFragmentStreamReader)reader;
- childReader.setParentNamespaceContext(this.namespaceContext);
- childReader.init();
- } else {
- // wrap it to make compatible
- childReader = new WrappingXMLStreamReader(reader);
- }
- } else if (propertyValue instanceof XMLStreamReader) {
- XMLStreamReader reader = (XMLStreamReader)propertyValue;
- if (reader instanceof XMLFragmentStreamReader) {
- childReader = (XMLFragmentStreamReader)reader;
- childReader.setParentNamespaceContext(this.namespaceContext);
- childReader.init();
- } else {
- // wrap it to make compatible
- childReader = new WrappingXMLStreamReader(reader);
- }
-
- } else {
- // all special possibilities has been tried! Let's treat
- // the thing as a bean and try generating events from it
- childReader = new WrappingXMLStreamReader(new BeanXMLStreamReaderImpl(propertyQName, propertyValue));
- // we cannot register the namespace context here
- }
-
- // set the state here
- state = DELEGATED_STATE;
- // we are done with the delegation
- // increment the property index
- ++index;
- return childReader.getEventType();
- }
-
- public void require(int i, String string, String string1) throws XMLStreamException {
- throw new UnsupportedOperationException();
- }
-
- public boolean standaloneSet() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
deleted file mode 100644
index f7c895db1e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLGroupDataBinding.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.databinding.impl.GroupDataBinding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * A Group DataBinding
- *
- * @version $Rev$ $Date$
- */
-public class XMLGroupDataBinding extends GroupDataBinding {
-
- public XMLGroupDataBinding() {
- super(new Class[] {InputStream.class, OutputStream.class, Reader.class, Writer.class,
- // Source.class, Result.class,
- InputSource.class, ContentHandler.class, XMLStreamReader.class,
- XMLStreamWriter.class, XMLEventReader.class, XMLEventWriter.class});
- }
-
- @Override
- protected Object getLogical(Class<?> markerType, Operation operation) {
- return XMLType.UNKNOWN;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
deleted file mode 100644
index e2d0416aec..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2Node.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- * Transform DOM Node to XML XMLStreamReader
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2Node extends BaseTransformer<XMLStreamReader, Node> implements
- PullTransformer<XMLStreamReader, Node> {
-
- private XMLStreamReader2SAX stax2sax = new XMLStreamReader2SAX();
-
- public Node transform(XMLStreamReader source, TransformationContext context) {
- try {
- DataPipe<ContentHandler, Node> pipe = new SAX2DOMPipe().newInstance();
- stax2sax.transform(source, pipe.getSink(), context);
- Node node = pipe.getResult();
- source.close();
- if (node instanceof Document) {
- Document doc = (Document)node;
- return DOMHelper.adjustElementName(context, doc.getDocumentElement());
- } else {
- return node;
- }
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<Node> getTargetType() {
- return Node.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
deleted file mode 100644
index 9b39f039b1..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2SAX.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PushTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.xml.sax.ContentHandler;
-
-/**
- * XMLStreamReader to SAX events
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamReader2SAX extends BaseTransformer<XMLStreamReader, ContentHandler> implements
- PushTransformer<XMLStreamReader, ContentHandler> {
-
- @Override
- protected Class<ContentHandler> getTargetType() {
- return ContentHandler.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#getWeight()
- */
- @Override
- public int getWeight() {
- return 20;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.PushTransformer#transform(java.lang.Object,
- * java.lang.Object,
- * org.apache.tuscany.sca.databinding.TransformationContext)
- */
- public void transform(XMLStreamReader source, ContentHandler sink, TransformationContext context) {
- StAX2SAXAdapter adapter = new StAX2SAXAdapter(false);
- try {
- adapter.parse(source, sink);
- source.close();
- } catch (Exception e) {
- throw new TransformationException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
deleted file mode 100644
index 6db731bc9f..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamReader2String.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.databinding.PullTransformer;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformationException;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-
-public class XMLStreamReader2String extends BaseTransformer<XMLStreamReader, String> implements
- PullTransformer<XMLStreamReader, String> {
-
- public String transform(XMLStreamReader source, TransformationContext context) {
- try {
- String str = StAXHelper.save(source);
- source.close();
- return str;
- } catch (XMLStreamException e) {
- throw new TransformationException(e);
- }
- }
-
- @Override
- protected Class<XMLStreamReader> getSourceType() {
- return XMLStreamReader.class;
- }
-
- @Override
- protected Class<String> getTargetType() {
- return String.class;
- }
-
- @Override
- public int getWeight() {
- return 40;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
deleted file mode 100644
index 920ebb511c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamSerializer.java
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-/**
- * The XMLStreamSerializer pulls events from the XMLStreamReader and dumps into the XMLStreamWriter
- *
- * @version $Rev$ $Date$
- */
-public class XMLStreamSerializer implements XMLStreamConstants {
- public static final String NAMESPACE_PREFIX = "ns";
- private static int namespaceSuffix;
-
- /*
- * The behavior of the Serializer is such that it returns when it encounters the starting element for the second
- * time. The depth variable tracks the depth of the Serializer and tells it when to return. Note that it is assumed
- * that this Serialization starts on an Element.
- */
-
- /**
- * Field depth
- */
- private int depth;
-
- /**
- * Generates a unique namespace prefix that is not in the scope of the NamespaceContext
- *
- * @param nsCtxt
- * @return string
- */
- private String generateUniquePrefix(NamespaceContext nsCtxt) {
- String prefix = NAMESPACE_PREFIX + namespaceSuffix++;
- // null should be returned if the prefix is not bound!
- while (nsCtxt.getNamespaceURI(prefix) != null) {
- prefix = NAMESPACE_PREFIX + namespaceSuffix++;
- }
-
- return prefix;
- }
-
- /**
- * Method serialize.
- *
- * @param node
- * @param writer
- * @throws XMLStreamException
- */
- public void serialize(XMLStreamReader node, XMLStreamWriter writer) throws XMLStreamException {
- serializeNode(node, writer);
- }
-
- /**
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeAttributes(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- int count = reader.getAttributeCount();
- String prefix;
- String namespaceName;
- String writerPrefix;
- for (int i = 0; i < count; i++) {
- prefix = reader.getAttributePrefix(i);
- namespaceName = reader.getAttributeNamespace(i);
- /*
- * Due to parser implementations returning null as the namespace URI (for the empty namespace) we need to
- * make sure that we deal with a namespace name that is not null. The best way to work around this issue is
- * to set the namespace URI to "" if it is null
- */
- if (namespaceName == null) {
- namespaceName = "";
- }
-
- writerPrefix = writer.getPrefix(namespaceName);
-
- if (!"".equals(namespaceName)) {
- // prefix has already being declared but this particular
- // attrib has a
- // no prefix attached. So use the prefix provided by the
- // writer
- if (writerPrefix != null && (prefix == null || prefix.equals(""))) {
- writer.writeAttribute(writerPrefix, namespaceName, reader.getAttributeLocalName(i), reader
- .getAttributeValue(i));
-
- // writer prefix is available but different from the
- // current
- // prefix of the attrib. We should be declaring the new
- // prefix
- // as a namespace declaration
- } else if (prefix != null && !"".equals(prefix) && !prefix.equals(writerPrefix)) {
- writer.writeNamespace(prefix, namespaceName);
- writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
- .getAttributeValue(i));
-
- // prefix is null (or empty), but the namespace name is
- // valid! it has not
- // being written previously also. So we need to generate
- // a prefix
- // here
- } else if (prefix == null || prefix.equals("")) {
- prefix = generateUniquePrefix(writer.getNamespaceContext());
- writer.writeNamespace(prefix, namespaceName);
- writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
- .getAttributeValue(i));
- } else {
- writer.writeAttribute(prefix, namespaceName, reader.getAttributeLocalName(i), reader
- .getAttributeValue(i));
- }
- } else {
- // empty namespace is equal to no namespace!
- writer.writeAttribute(reader.getAttributeLocalName(i), reader.getAttributeValue(i));
- }
-
- }
- }
-
- /**
- * Method serializeCData.
- *
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeCData(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- writer.writeCData(reader.getText());
- }
-
- /**
- * Method serializeComment.
- *
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeComment(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- writer.writeComment(reader.getText());
- }
-
- /**
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeElement(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- String prefix = reader.getPrefix();
- String nameSpaceName = reader.getNamespaceURI();
- if (nameSpaceName != null) {
- String writerPrefix = writer.getPrefix(nameSpaceName);
- if (writerPrefix != null) {
- writer.writeStartElement(nameSpaceName, reader.getLocalName());
- } else {
- if (prefix != null) {
- writer.writeStartElement(prefix, reader.getLocalName(), nameSpaceName);
- writer.writeNamespace(prefix, nameSpaceName);
- // writer.setPrefix(prefix, nameSpaceName);
- } else {
- // [rfeng] We need to set default NS 1st before calling writeStateElement
- writer.setDefaultNamespace(nameSpaceName);
- writer.writeStartElement(nameSpaceName, reader.getLocalName());
- writer.writeDefaultNamespace(nameSpaceName);
- }
- }
- } else {
- writer.writeStartElement(reader.getLocalName());
- }
-
- // add the namespaces
- int count = reader.getNamespaceCount();
- String namespacePrefix;
- for (int i = 0; i < count; i++) {
- namespacePrefix = reader.getNamespacePrefix(i);
- // [rfeng] The following is commented out to allow to default ns
- // if (namespacePrefix != null && namespacePrefix.length() == 0) {
- // continue;
- // }
-
- serializeNamespace(namespacePrefix, reader.getNamespaceURI(i), writer);
- }
-
- // add attributes
- serializeAttributes(reader, writer);
-
- }
-
- /**
- * Method serializeEndElement.
- *
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeEndElement(XMLStreamWriter writer) throws XMLStreamException {
- writer.writeEndElement();
- }
-
- /**
- * Method serializeNamespace.
- *
- * @param prefix
- * @param uri
- * @param writer
- * @throws XMLStreamException
- */
- private void serializeNamespace(String prefix, String uri, XMLStreamWriter writer) throws XMLStreamException {
- String prefix1 = writer.getPrefix(uri);
- if (prefix1 == null) {
- writer.writeNamespace(prefix, uri);
- // writer.setPrefix(prefix, uri);
- }
- }
-
- /**
- * Method serializeNode.
- *
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeNode(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- while (true) {
- int event = reader.getEventType();
- if (event == START_ELEMENT) {
- serializeElement(reader, writer);
- depth++;
- } else if (event == ATTRIBUTE) {
- serializeAttributes(reader, writer);
- } else if (event == CHARACTERS) {
- serializeText(reader, writer);
- } else if (event == COMMENT) {
- serializeComment(reader, writer);
- } else if (event == CDATA) {
- serializeCData(reader, writer);
- } else if (event == END_ELEMENT) {
- serializeEndElement(writer);
- depth--;
- } else if (event == START_DOCUMENT) {
- depth++; // if a start document is found then increment
- writer.writeStartDocument();
- // the depth
- } else if (event == END_DOCUMENT) {
- if (depth != 0) {
- depth--; // for the end document - reduce the depth
- }
- writer.writeEndDocument();
- }
- if (depth == 0) {
- break;
- }
- if (reader.hasNext()) {
- reader.next();
- } else {
- break;
- }
- }
- }
-
- /**
- * @param reader
- * @param writer
- * @throws XMLStreamException
- */
- protected void serializeText(XMLStreamReader reader, XMLStreamWriter writer) throws XMLStreamException {
- writer.writeCharacters(reader.getText());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.java
deleted file mode 100644
index f32f93d098..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStreamable.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.databinding.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- * An interface represents data that can be read using StAX streaming
- *
- * @version $Rev$ $Date$
- */
-public interface XMLStreamable {
- /**
- * Get the XMLStreamReader for StAX processing
- *
- * @param rootElementName the name of the element to be generated
- * @return Returns a pull parser.
- */
- XMLStreamReader getXMLStreamReader(QName rootElementName);
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
deleted file mode 100644
index 22b173dce5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XMLStringDataBinding.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * A DataBinding for the XML string
- *
- * @version $Rev$ $Date$
- */
-public class XMLStringDataBinding extends BaseDataBinding {
- public static final String NAME = String.class.getName();
-
- public XMLStringDataBinding() {
- super(NAME, String.class);
- }
-
- @Override
- public boolean introspect(DataType type, Operation operation) {
- if (type.getPhysical() == String.class && NAME.equals(type.getDataBinding())) {
- type.setDataBinding(NAME);
- type.setLogical(XMLType.UNKNOWN);
- return true;
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java
deleted file mode 100644
index 86ebd627f7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNode.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface XmlNode {
- enum Type {ELEMENT, ATTRIBUTE, CHARACTERS, READER};
- /**
- * Returns the children of the receiver as an <code>Iterator</code>.
- */
- Iterator<XmlNode> children();
-
- /**
- * Returns the attributes of the element as an <code>List</code>. Namespace declarations
- * should be excluded.
- *
- * @return
- */
- List<XmlNode> attributes();
-
- /**
- * Returns a map of prefix to namespace URI
- * @return
- */
- Map<String, String> namespaces();
-
- /**
- * Return the QName of the element. If it's for a text node, the name is null.
- * @return
- */
- QName getName();
-
- /**
- * Return the text value of the leaf element
- * @return
- */
- <T> T getValue();
-
- /**
- * Return the type of the XML node
- * @return
- */
- Type getType();
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.java
deleted file mode 100644
index 3dd125463e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlNodeIterator.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.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.EmptyStackException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XmlNodeIterator implements Iterator<XmlNode> {
- public static final int START = 0;
- public static final int END = 1;
-
- protected FastStack<ElementHolder> stack;
- protected int state;
- protected NamespaceContextImpl nsContext;
-
- public XmlNodeIterator(XmlNode rootNode) {
- super();
- List<XmlNode> v = new ArrayList<XmlNode>(1);
- v.add(rootNode);
- stack = new FastStack<ElementHolder>();
- Iterator<XmlNode> i = v.iterator();
- stack.push(new ElementHolder(null, i));
- this.state = START;
- this.nsContext = new NamespaceContextImpl(null);
- }
-
- public boolean hasNext() {
- return !(stack.empty() || (state == END && stack.peek().parent == null));
- }
-
- public XmlNode next() {
- this.state = START;
- ElementHolder element = stack.peek();
- Iterator<XmlNode> it = element.children;
- if (it == null || (!it.hasNext())) {
- // End of the children, return END event of parent
- stack.pop();
- this.state = END;
- this.nsContext = (NamespaceContextImpl)nsContext.getParent();
- return element.parent;
- }
- XmlNode node = it.next();
- stack.push(new ElementHolder(node, node.children()));
- this.nsContext = new NamespaceContextImpl(this.nsContext);
- populateNamespaces(node);
- return node;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- public int getState() {
- return state;
- }
-
- public NamespaceContext getNamespaceContext() {
- return nsContext;
- }
-
- private void populateNamespaces(XmlNode element) {
- if (element.getName() != null) {
- if (element.namespaces() != null) {
- for (Map.Entry<String, String> e : element.namespaces().entrySet()) {
- nsContext.register(e.getKey(), e.getValue());
- }
- }
- }
- }
-
- private static class ElementHolder {
- private XmlNode parent;
- private Iterator<XmlNode> children;
-
- public ElementHolder(XmlNode parent, Iterator<XmlNode> children) {
- this.parent = parent;
- this.children = children;
- }
- }
-
- private static class NamespaceContextImpl implements NamespaceContext {
- private NamespaceContext parent;
- private Map<String, String> map = new HashMap<String, String>();
-
- /**
- * @param parent
- */
- public NamespaceContextImpl(NamespaceContext parent) {
- super();
- this.parent = parent;
- if (parent == null) {
- map.put("xml", "http://www.w3.org/XML/1998/namespace");
- map.put("xmlns", "http://www.w3.org/2000/xmlns/");
- }
- }
-
- public String getNamespaceURI(String prefix) {
- if (prefix == null) {
- throw new IllegalArgumentException("Prefix is null");
- }
-
- String ns = (String)map.get(prefix);
- if (ns != null) {
- return ns;
- }
- if (parent != null) {
- return parent.getNamespaceURI(prefix);
- }
- return null;
- }
-
- public String getPrefix(String nsURI) {
- if (nsURI == null)
- throw new IllegalArgumentException("Namespace is null");
- for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
- Map.Entry<String, String> entry = i.next();
- if (entry.getValue().equals(nsURI)) {
- return entry.getKey();
- }
- }
- if (parent != null) {
- return parent.getPrefix(nsURI);
- }
- return null;
- }
-
- public Iterator getPrefixes(String nsURI) {
- List<String> prefixList = new ArrayList<String>();
- for (Iterator<Map.Entry<String, String>> i = map.entrySet().iterator(); i.hasNext();) {
- Map.Entry<String, String> entry = i.next();
- if (entry.getValue().equals(nsURI)) {
- prefixList.add(entry.getKey());
- }
- }
- final Iterator currentIterator = prefixList.iterator();
- final Iterator parentIterator = parent != null ? null : parent.getPrefixes(nsURI);
- return new Iterator() {
-
- public boolean hasNext() {
- return currentIterator.hasNext() || (parentIterator != null && parentIterator.hasNext());
- }
-
- public Object next() {
- if (!hasNext()) {
- throw new IllegalStateException("End of iterator has reached");
- }
- return currentIterator.hasNext() ? currentIterator.next() : parentIterator.next();
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- };
-
- }
-
- public void register(String prefix, String ns) {
- map.put(prefix, ns);
- }
-
- public NamespaceContext getParent() {
- return parent;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer(map.toString());
- if (parent != null) {
- sb.append("\nParent: ");
- sb.append(parent);
- }
- return sb.toString();
- }
- }
-
- /**
- * An implementation of the {@link java.util.Stack} API that is based on an <code>ArrayList</code> instead of a
- * <code>Vector</code>, so it is not synchronized to protect against multi-threaded access. The implementation is
- * therefore operates faster in environments where you do not need to worry about multiple thread contention.
- * <p>
- * The removal order of an <code>ArrayStack</code> is based on insertion order: The most recently added element is
- * removed first. The iteration order is <i>not</i> the same as the removal order. The iterator returns elements
- * from the bottom up, whereas the {@link #remove()} method removes them from the top down.
- * <p>
- * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
- */
- public static class FastStack<T> extends ArrayList<T> {
-
- /** Ensure Serialization compatibility */
- private static final long serialVersionUID = 2130079159931574599L;
-
- /**
- * Constructs a new empty <code>ArrayStack</code>. The initial size is controlled by <code>ArrayList</code>
- * and is currently 10.
- */
- public FastStack() {
- super();
- }
-
- /**
- * Constructs a new empty <code>ArrayStack</code> with an initial size.
- *
- * @param initialSize the initial size to use
- * @throws IllegalArgumentException if the specified initial size is negative
- */
- public FastStack(int initialSize) {
- super(initialSize);
- }
-
- /**
- * Return <code>true</code> if this stack is currently empty.
- * <p>
- * This method exists for compatibility with <code>java.util.Stack</code>. New users of this class should use
- * <code>isEmpty</code> instead.
- *
- * @return true if the stack is currently empty
- */
- public boolean empty() {
- return isEmpty();
- }
-
- /**
- * Returns the top item off of this stack without removing it.
- *
- * @return the top item on the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T peek() throws EmptyStackException {
- int n = size();
- if (n <= 0) {
- throw new EmptyStackException();
- } else {
- return get(n - 1);
- }
- }
-
- /**
- * Returns the n'th item down (zero-relative) from the top of this stack without removing it.
- *
- * @param n the number of items down to go
- * @return the n'th item on the stack, zero relative
- * @throws EmptyStackException if there are not enough items on the stack to satisfy this request
- */
- public T peek(int n) throws EmptyStackException {
- int m = (size() - n) - 1;
- if (m < 0) {
- throw new EmptyStackException();
- } else {
- return get(m);
- }
- }
-
- /**
- * Pops the top item off of this stack and return it.
- *
- * @return the top item on the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T pop() throws EmptyStackException {
- int n = size();
- if (n <= 0) {
- throw new EmptyStackException();
- } else {
- return remove(n - 1);
- }
- }
-
- /**
- * Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling
- * <code>add</code>.
- *
- * @param item the item to be added
- * @return the item just pushed
- */
- public Object push(T item) {
- add(item);
- return item;
- }
-
- /**
- * Returns the top-most index for the object in the stack
- *
- * @param object the object to be searched for
- * @return top-most index, or -1 if not found
- */
- public int search(T object) {
- int i = size() - 1; // Current index
- while (i >= 0) {
- T current = get(i);
- if ((object == null && current == null) || (object != null && object.equals(current))) {
- return i;
- }
- i--;
- }
- return -1;
- }
-
- /**
- * Returns the element on the top of the stack.
- *
- * @return the element on the top of the stack
- * @throws EmptyStackException if the stack is empty
- */
- public T get() {
- int size = size();
- if (size == 0) {
- throw new EmptyStackException();
- }
- return get(size - 1);
- }
-
- /**
- * Removes the element on the top of the stack.
- *
- * @return the removed element
- * @throws EmptyStackException if the stack is empty
- */
- public T remove() {
- int size = size();
- if (size == 0) {
- throw new EmptyStackException();
- }
- return remove(size - 1);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java b/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
deleted file mode 100644
index f4bc357c7d..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderImpl.java
+++ /dev/null
@@ -1,531 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.namespace.QName;
-import javax.xml.stream.Location;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XmlTreeStreamReaderImpl implements XMLStreamReader {
-
- protected int state;
- protected XmlNodeIterator iterator;
- protected XmlNode current;
-
- protected XMLStreamReader reader;
-
- /*
- * we need to pass in a namespace context since when delegated, we've no
- * idea of the current namespace context. So it needs to be passed on here!
- */
- public XmlTreeStreamReaderImpl(XmlNode root) {
- this.iterator = new XmlNodeIterator(root);
- this.current = null;
- this.state = START_DOCUMENT;
- this.reader = null;
- }
-
- public void close() throws XMLStreamException {
- if (reader != null) {
- reader.close();
- }
- }
-
- private void checkElementState() {
- if (getEventType() != START_ELEMENT && getEventType() != END_ELEMENT) {
- throw new IllegalStateException();
- }
- }
-
- private List<XmlNode> getAttributes() {
- if (current != null && current.attributes() != null) {
- return current.attributes();
- } else {
- return Collections.emptyList();
- }
- }
-
- public int getAttributeCount() {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeCount();
- }
- return getAttributes().size();
- }
-
- public String getAttributeLocalName(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeLocalName(i);
- }
- return getAttributes().get(i).getName().getLocalPart();
- }
-
- /**
- * @param i
- */
- public QName getAttributeName(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeName(i);
- }
- return getAttributes().get(i).getName();
- }
-
- public String getAttributeNamespace(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeNamespace(i);
- }
- return getAttributes().get(i).getName().getNamespaceURI();
- }
-
- public String getAttributePrefix(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributePrefix(i);
- }
- return getAttributes().get(i).getName().getPrefix();
- }
-
- public String getAttributeType(int i) {
- if (reader != null) {
- return reader.getAttributeType(i);
- }
- return null; // not supported
- }
-
- public String getAttributeValue(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeValue(i);
- }
- return getAttributes().get(i).getValue();
- }
-
- public String getAttributeValue(String nsUri, String localName) {
- checkElementState();
- if (reader != null) {
- return reader.getAttributeValue(nsUri, localName);
- }
- int count = getAttributeCount();
- String value = null;
- QName attrQName;
- for (int i = 0; i < count; i++) {
- attrQName = getAttributeName(i);
- if (nsUri == null) {
- if (localName.equals(attrQName.getLocalPart())) {
- value = getAttributeValue(i);
- break;
- }
- } else {
- if (localName.equals(attrQName.getLocalPart()) && nsUri.equals(attrQName.getNamespaceURI())) {
- value = getAttributeValue(i);
- break;
- }
- }
-
- }
-
- return value;
- }
-
- public String getCharacterEncodingScheme() {
- if (reader != null) {
- return reader.getCharacterEncodingScheme();
- }
- return "UTF-8";
- }
-
- public String getElementText() throws XMLStreamException {
- checkElementState();
- if (reader != null) {
- return reader.getElementText();
- }
- return current.getValue();
- }
-
- public String getEncoding() {
- if (reader != null) {
- return reader.getEncoding();
- }
- return "UTF-8";
- }
-
- public int getEventType() {
- return state;
- }
-
- public String getLocalName() {
- checkElementState();
- if (reader != null) {
- return reader.getLocalName();
- }
- return current.getName().getLocalPart();
- }
-
- /**
- */
- public Location getLocation() {
- if (reader != null) {
- return reader.getLocation();
- }
- // return a default location
- return new Location() {
- public int getCharacterOffset() {
- return 0;
- }
-
- public int getColumnNumber() {
- return 0;
- }
-
- public int getLineNumber() {
- return 0;
- }
-
- public String getPublicId() {
- return null;
- }
-
- public String getSystemId() {
- return null;
- }
- };
- }
-
- public QName getName() {
- checkElementState();
- if (reader != null) {
- return reader.getName();
- }
- return current.getName();
- }
-
- public NamespaceContext getNamespaceContext() {
- if (reader != null) {
- return reader.getNamespaceContext();
- }
- return iterator.getNamespaceContext();
- }
-
- private Map<String, String> getNamespaces() {
- if (current != null && current.namespaces() != null) {
- return current.namespaces();
- } else {
- return Collections.emptyMap();
- }
- }
-
- public int getNamespaceCount() {
- checkElementState();
- if (reader != null) {
- return reader.getNamespaceCount();
- }
- return getNamespaces().size();
- }
-
- /**
- * @param i
- */
- public String getNamespacePrefix(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getNamespacePrefix(i);
- }
- return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getKey();
- }
-
- public String getNamespaceURI() {
- checkElementState();
- if (reader != null) {
- return reader.getNamespaceURI();
- }
- return current.getName().getNamespaceURI();
- }
-
- public String getNamespaceURI(int i) {
- checkElementState();
- if (reader != null) {
- return reader.getNamespaceURI(i);
- }
- return new ArrayList<Map.Entry<String, String>>(getNamespaces().entrySet()).get(i).getValue();
- }
-
- public String getNamespaceURI(String prefix) {
- if (reader != null) {
- return reader.getNamespaceURI(prefix);
- }
- return getNamespaceContext().getNamespaceURI(prefix);
- }
-
- public String getPIData() {
- if (reader != null) {
- return reader.getPIData();
- }
- throw new UnsupportedOperationException("Yet to be implemented !!");
- }
-
- public String getPITarget() {
- if (reader != null) {
- return reader.getPITarget();
- }
- throw new UnsupportedOperationException("Yet to be implemented !!");
- }
-
- public String getPrefix() {
- if (reader != null) {
- return reader.getPrefix();
- }
- if (state == START_ELEMENT || state == END_ELEMENT) {
- String prefix = current.getName().getPrefix();
- return "".equals(prefix) ? null : prefix;
- } else if (state == START_DOCUMENT) {
- return null;
- } else {
- throw new IllegalStateException("State==" + state);
- }
- }
-
- /**
- * @param key
- * @throws IllegalArgumentException
- */
- public Object getProperty(String key) throws IllegalArgumentException {
- if (reader != null) {
- return reader.getProperty(key);
- }
- return null;
- }
-
- public String getText() {
- if (reader != null) {
- return reader.getText();
- }
- return current.getValue();
- }
-
- public char[] getTextCharacters() {
- if (reader != null) {
- return reader.getTextCharacters();
- }
- String value = current.getValue();
- return value == null ? new char[0] : value.toCharArray();
- }
-
- private int copy(int sourceStart, char[] target, int targetStart, int length) {
- char[] source = getTextCharacters();
- if (sourceStart > source.length) {
- throw new IndexOutOfBoundsException("source start > source length");
- }
- int sourceLen = source.length - sourceStart;
- if (length > sourceLen) {
- length = sourceLen;
- }
- System.arraycopy(source, sourceStart, target, targetStart, length);
- return sourceLen;
- }
-
- public int getTextCharacters(int i, char[] chars, int i1, int i2) throws XMLStreamException {
- if (reader != null) {
- return reader.getTextCharacters(i, chars, i1, i2);
- }
- return copy(i, chars, i1, i2);
- }
-
- public int getTextLength() {
- if (reader != null) {
- return reader.getTextLength();
- }
- return getTextCharacters().length;
- }
-
- public int getTextStart() {
- if (reader != null) {
- return reader.getTextStart();
- }
- return 0;
- }
-
- public String getVersion() {
- return "1.0";
- }
-
- public boolean hasName() {
- if (reader != null) {
- return reader.hasName();
- }
- return current.getName() != null;
- }
-
- /**
- * @throws XMLStreamException
- */
- public boolean hasNext() throws XMLStreamException {
- return iterator.hasNext() || state != END_DOCUMENT || (reader != null && reader.hasNext());
- }
-
- public boolean hasText() {
- if (reader != null) {
- return reader.hasText();
- }
- return current.getType() == XmlNode.Type.CHARACTERS;
- }
-
- public boolean isAttributeSpecified(int i) {
- if (reader != null) {
- return reader.isAttributeSpecified(i);
- }
- return false; // not supported
- }
-
- public boolean isCharacters() {
- if (reader != null) {
- return reader.isCharacters();
- }
- return current.getType() == XmlNode.Type.CHARACTERS;
- }
-
- public boolean isEndElement() {
- if (reader != null) {
- return reader.isEndElement();
- }
- return getEventType() == END_ELEMENT;
- }
-
- public boolean isStandalone() {
- return true;
- }
-
- public boolean isStartElement() {
- if (reader != null) {
- return reader.isStartElement();
- }
- return getEventType() == START_ELEMENT;
- }
-
- public boolean isWhiteSpace() {
- if (reader != null) {
- return reader.isWhiteSpace();
- }
- return false;
- }
-
- /**
- * By far this should be the most important method in this class this method
- * changes the state of the parser
- */
- public int next() throws XMLStreamException {
- if (!hasNext()) {
- throw new IllegalStateException("No more events");
- }
- if (reader != null) {
- if (!reader.hasNext()) {
- this.reader = null;
- } else {
- // Go to the delegation mode
- state = reader.next();
- return state;
- }
- }
- if (!iterator.hasNext()) {
- state = END_DOCUMENT;
- current = null;
- return state;
- }
- current = iterator.next();
- XmlNode.Type type = current.getType();
-
- int itState = iterator.getState();
- if (itState == XmlNodeIterator.END) {
- if (type == XmlNode.Type.ELEMENT) {
- state = END_ELEMENT;
- } else {
- // Ignore the pop
- state = next();
- }
- }
- if (itState == XmlNodeIterator.START) {
- if (type == XmlNode.Type.ELEMENT) {
- state = START_ELEMENT;
- } else if (type == XmlNode.Type.CHARACTERS) {
- state = CHARACTERS;
- } else if (type == XmlNode.Type.READER) {
- XMLStreamReader value = current.getValue();
- this.reader = new WrappingXMLStreamReader(value);
- state = reader.getEventType();
- return state;
- }
- }
- return state;
- }
-
- /**
- * TODO implement this
- *
- * @throws XMLStreamException
- */
- public int nextTag() throws XMLStreamException {
- while (true) {
- int event = next();
- if (event == START_ELEMENT || event == END_ELEMENT) {
- return event;
- }
- }
- }
-
- public void require(int i, String ns, String localPart) throws XMLStreamException {
- if (reader != null) {
- reader.require(i, ns, localPart);
- return;
- }
- int event = getEventType();
- if (event != i) {
- throw new IllegalStateException("Event type is " + event + " (!=" + i + ")");
- }
- QName name = getName();
- String ns1 = name.getNamespaceURI();
- String localName1 = name.getLocalPart();
-
- if (ns != null && !ns.equals(ns1)) {
- throw new IllegalStateException("Namespace URI is " + ns1 + " (!=" + ns + ")");
- }
-
- if (localPart != null && !localPart.equals(localName1)) {
- throw new IllegalStateException("Local name is " + localName1 + " (!=" + localPart + ")");
- }
-
- }
-
- public boolean standaloneSet() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
deleted file mode 100644
index afb00c91ee..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBinding
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# implementation classes for the databindings
-org.apache.tuscany.sca.databinding.xml.DOMDataBinding;name=org.w3c.dom.Node
-org.apache.tuscany.sca.databinding.xml.XMLStringDataBinding;name=java.lang.String
-org.apache.tuscany.sca.databinding.xml.XMLGroupDataBinding;name=databinding:group
-org.apache.tuscany.sca.databinding.javabeans.JavaBeansDataBinding;name=java:complexType
-org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;name=java:simpleType
-org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;name=java:exception
-org.apache.tuscany.sca.databinding.externalizable.ExternalizableDataBinding;name=java.io.Externalizable
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
deleted file mode 100644
index 568e04f9de..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.DataBindingExtensionPoint
+++ /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.databinding.DefaultDataBindingExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator
deleted file mode 100644
index e01e121aa5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.Mediator
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.databinding.impl.MediatorImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
deleted file mode 100644
index 96115be404..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PullTransformer
+++ /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.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.xml.InputSource2Node;source=org.xml.sax.InputSource,target=org.w3c.dom.Node,weight=80
-org.apache.tuscany.sca.databinding.xml.InputStream2Node;source=java.io.InputStream,target=org.w3c.dom.Node,weight=80
-# org.apache.tuscany.sca.databinding.javabeans.DOMNode2JavaBeanTransformer;source=org.w3c.dom.Node,target=java:complexType,weight=80000
-org.apache.tuscany.sca.databinding.xml.Node2String;source=org.w3c.dom.Node,target=java.lang.String,weight=80
-org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;source=org.w3c.dom.Node,target=javax.xml.stream.XMLStreamReader,weight=80
-# org.apache.tuscany.sca.databinding.javabeans.JavaBean2DOMNodeTransformer;source=java:complexType,target=org.w3c.dom.Node,weight=80000
-# org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;source=java:complexType,target=javax.xml.stream.XMLStreamReader,weight=79000
-org.apache.tuscany.sca.databinding.xml.Reader2Node;source=java.io.Reader,target=org.w3c.dom.Node,weight=80
-org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;source=org.xml.sax.ContentHandler,target=org.w3c.dom.Node,weight=70
-org.apache.tuscany.sca.databinding.xml.StreamDataPipe;source=java.io.OutputStream,target=java.io.InputStream,weight=90
-org.apache.tuscany.sca.databinding.xml.String2Node;source=java.lang.String,target=org.w3c.dom.Node,weight=90
-org.apache.tuscany.sca.databinding.xml.String2XMLStreamReader;source=java.lang.String,target=javax.xml.stream.XMLStreamReader,weight=90
-org.apache.tuscany.sca.databinding.xml.Writer2ReaderDataPipe;source=java.io.Writer,target=java.io.Reader,weight=90
-org.apache.tuscany.sca.databinding.xml.XMLStreamReader2Node;source=javax.xml.stream.XMLStreamReader,target=org.w3c.dom.Node,weight=80
-org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;source=javax.xml.stream.XMLStreamReader,target=java.lang.String,weight=80
-# org.apache.tuscany.sca.databinding.xml.Node2SimpleJavaType;source=org.w3c.dom.Node,target=java:simpleType,weight=80000
-# org.apache.tuscany.sca.databinding.xml.SimpleJavaType2Node;source=java:simpleType,target=org.w3c.dom.Node,weight=80000
-org.apache.tuscany.sca.databinding.xml.Source2NodeTransformer;source=javax.xml.transform.Source,target=org.w3c.dom.Node,weight=80
-org.apache.tuscany.sca.databinding.xml.Source2StringTransformer;source=javax.xml.transform.Source,target=java.lang.String,weight=80
-
-org.apache.tuscany.sca.databinding.xml.Node2SourceTransformer;source=org.w3c.dom.Node,target=javax.xml.transform.Source,weight=80
-org.apache.tuscany.sca.databinding.xml.String2SourceTransformer;source=java.lang.String,target=javax.xml.transform.Source,weight=80
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
deleted file mode 100644
index e02cd5c934..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.PushTransformer
+++ /dev/null
@@ -1,26 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation classes for the transformers
-org.apache.tuscany.sca.databinding.xml.InputSource2SAX;source=org.xml.sax.InputSource,target=org.xml.sax.ContentHandler,weight=80
-org.apache.tuscany.sca.databinding.xml.InputStream2SAX;source=java.io.InputStream,target=org.xml.sax.ContentHandler,weight=80
-org.apache.tuscany.sca.databinding.xml.Node2OutputStream;source=org.w3c.dom.Node,target=java.io.OutputStream,weight=80
-org.apache.tuscany.sca.databinding.xml.Node2Writer;source=org.w3c.dom.Node,target=java.io.Writer,weight=80
-org.apache.tuscany.sca.databinding.xml.Reader2SAX;source=java.io.Reader,target=org.xml.sax.ContentHandler,weight=80
-org.apache.tuscany.sca.databinding.xml.Source2ResultTransformer;source=javax.xml.transform.Source,target=javax.xml.transform.Result,weight=80
-org.apache.tuscany.sca.databinding.xml.String2SAX;source=java.lang.String,target=org.xml.sax.ContentHandler,weight=80
-org.apache.tuscany.sca.databinding.xml.XMLStreamReader2SAX;source=javax.xml.stream.XMLStreamReader,target=org.xml.sax.ContentHandler,weight=70
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint b/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
deleted file mode 100644
index 7d8642fb1e..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/main/resources/META-INF/services/org.apache.tuscany.sca.databinding.TransformerExtensionPoint
+++ /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.databinding.DefaultTransformerExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java
deleted file mode 100644
index 8c710062ad..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DOMHelperTestCase.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.extension;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DOMHelperTestCase extends TestCase {
- private static final QName FOO_NAME = new QName("http://foo", "foo");
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testDOM() throws Exception {
- DocumentBuilder builder = DOMHelper.newDocumentBuilder();
- assertNotNull(builder);
- Document document = DOMHelper.newDocument();
- assertNotNull(document);
- Element element = DOMHelper.createElement(document, FOO_NAME);
- document.appendChild(element);
- QName name = DOMHelper.getQName(element);
- assertEquals(FOO_NAME, name);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.java
deleted file mode 100644
index f9e331fbf3..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/DataBindingExtensionTestCase.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.databinding.extension;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.BaseDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.easymock.EasyMock;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingExtensionTestCase extends TestCase {
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- @SuppressWarnings("unchecked")
- public void testExtension() {
- DataBinding1 binding1 = new DataBinding1(Node.class);
- assertEquals(Node.class.getName(), binding1.getName());
- DataType dt1 = new DataTypeImpl<Class>(Element.class, null);
- assertTrue(binding1.introspect(dt1, null));
- DataType dt2 = new DataTypeImpl<Class>(String.class, null);
- assertFalse(binding1.introspect(dt2, null));
- assertNull(binding1.getWrapperHandler());
-
- DataBindingExtensionPoint registry = EasyMock.createMock(DataBindingExtensionPoint.class);
- registry.addDataBinding(binding1);
- EasyMock.expect(registry.getDataBinding(Node.class.getName())).andReturn(binding1);
- EasyMock.replay(registry);
-
- assertNotNull(registry.getDataBinding(Node.class.getName()));
-
- DataBinding1 binding2 = new DataBinding1("dom", Node.class);
- assertEquals("dom", binding2.getName());
- }
-
- private static class DataBinding1 extends BaseDataBinding {
-
- /**
- * @param baseType
- */
- public DataBinding1(Class<?> baseType) {
- super(baseType);
- }
-
- /**
- * @param name
- * @param baseType
- */
- public DataBinding1(String name, Class<?> baseType) {
- super(name, baseType);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java
deleted file mode 100644
index 562c22354c..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/SimpleTypeMapperExtensionTestCase.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.extension;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.easymock.EasyMock;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SimpleTypeMapperExtensionTestCase extends TestCase {
-
- private static final Map<String, Object> SAMPLE_VALUES = new HashMap<String, Object>();
-
- static {
- SAMPLE_VALUES.put("anyURI", "http://www.w3.com");
- SAMPLE_VALUES.put("boolean", new String[] {"true", "false", "1", "0"});
- SAMPLE_VALUES.put("byte", new String[] {"-128", "127"});
- SAMPLE_VALUES.put("date", new String[] {"2004-03-15", "2002-09-24-06:00"});
- SAMPLE_VALUES.put("dateTime", "2003-12-25T08:30:00");
- SAMPLE_VALUES.put("decimal", "3.1415292");
- SAMPLE_VALUES.put("double", new String[] {"3.1415292", "INF", "NaN"});
- SAMPLE_VALUES.put("duration", new String[] {"P8M3DT7H33M2S", "P5Y2M10DT15H"});
- SAMPLE_VALUES.put("float", new String[] {"3.1415292", "INF", "NaN"});
- SAMPLE_VALUES.put("gDay", "---11");
- if (System.getProperty("java.vendor").toUpperCase().contains("SUN") && System.getProperty("java.version").contains("1.5.0")
- ||
- System.getProperty("java.vendor").toUpperCase().contains("APPLE INC.") && System.getProperty("java.version").contains("1.5.0")) {
-
- // Work around a bug in SUN JDK (including Mac OS JDK)
- SAMPLE_VALUES.put("gMonth", "--02--");
- } else {
- SAMPLE_VALUES.put("gMonth", "--02");
- }
- SAMPLE_VALUES.put("gMonthDay", "--02-14");
- SAMPLE_VALUES.put("gYear", "1999");
- SAMPLE_VALUES.put("gYearMonth", "1972-08");
- SAMPLE_VALUES.put("ID", "id-102");
- SAMPLE_VALUES.put("IDREF", "id-102");
- SAMPLE_VALUES.put("IDREFS", "id-102 id-103 id-100");
- SAMPLE_VALUES.put("int", "77");
- SAMPLE_VALUES.put("integer", "77");
- SAMPLE_VALUES.put("long", "214");
- SAMPLE_VALUES.put("negativeInteger", "-123");
- SAMPLE_VALUES.put("nonNegativeInteger", "2");
- SAMPLE_VALUES.put("nonPositiveInteger", "0");
- SAMPLE_VALUES.put("positiveInteger", "500");
- SAMPLE_VALUES.put("short", "476");
- SAMPLE_VALUES.put("string", "Joeseph");
- SAMPLE_VALUES.put("time", "13:02:00");
- SAMPLE_VALUES.put("base64Binary", "TWFu");
- SAMPLE_VALUES.put("hexBinary", "2CDB5F");
- SAMPLE_VALUES.put("QName", "f:foo");
- SAMPLE_VALUES.put("NOTATION", "f:bar");
- }
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testMap() throws Exception {
- SimpleTypeMapperImpl extension = new SimpleTypeMapperImpl();
- TransformationContext context = EasyMock.createMock(TransformationContext.class);
- Map<String, Object> metaData = new HashMap<String, Object>();
- EasyMock.expect(context.getMetadata()).andReturn(metaData).anyTimes();
- EasyMock.replay(context);
-
- NamespaceContext namespaceContext = EasyMock.createMock(NamespaceContext.class);
- EasyMock.expect(namespaceContext.getNamespaceURI(EasyMock.eq("f"))).andReturn("http://foo").anyTimes();
- EasyMock.expect(namespaceContext.getPrefix(EasyMock.eq("http://foo"))).andReturn("f").anyTimes();
- EasyMock.replay(namespaceContext);
- context.getMetadata().put(NamespaceContext.class.getName(), namespaceContext);
- for (TypeInfo simpleType : SimpleTypeMapperImpl.XSD_SIMPLE_TYPES.values()) {
- String name = simpleType.getQName().getLocalPart();
- Object value = SAMPLE_VALUES.get(name);
- if (value instanceof String[]) {
- for (String s : (String[])value) {
- Object obj = extension.toJavaObject(simpleType.getQName(), s, context);
- String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
- assertNotNull(str);
- // assertTrue("[" + name + "] " + s + " " + str,
- // str.contains((String) s));
- }
- } else if (value instanceof String) {
- Object obj = extension.toJavaObject(simpleType.getQName(), (String)value, context);
- String str = extension.toXMLLiteral(simpleType.getQName(), obj, context);
- assertNotNull(str);
- // assertTrue("[" + name + "] " + value + " " + str,
- // str.contains((String) value));
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.java
deleted file mode 100644
index 243ac71201..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/TransformerExtensionTestCase.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.databinding.extension;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.Transformer;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.BaseTransformer;
-import org.easymock.EasyMock;
-import org.w3c.dom.Node;
-
-/**
- * Test case for TransformerExtension
- *
- * @version $Rev$ $Date$
- */
-public class TransformerExtensionTestCase extends TestCase {
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testExtension() {
- MyTransformer transformer = new MyTransformer();
- assertEquals(Node.class.getName(), transformer.getSourceDataBinding());
- assertEquals(XMLStreamReader.class.getName(), transformer.getTargetDataBinding());
- assertEquals(50, transformer.getWeight());
- TransformerExtensionPoint registry = EasyMock.createMock(TransformerExtensionPoint.class);
- registry.addTransformer(EasyMock.isA(Transformer.class), EasyMock.eq(true));
- EasyMock
- .expect(registry.getTransformer(transformer.getSourceDataBinding(), transformer.getTargetDataBinding()))
- .andReturn(transformer);
- EasyMock.replay(registry);
- registry.addTransformer(transformer, true);
- assertSame(transformer, registry.getTransformer(transformer.getSourceDataBinding(), transformer
- .getTargetDataBinding()));
- }
-
- private static class MyTransformer extends BaseTransformer<Node, XMLStreamReader> {
-
- @Override
- protected Class<Node> getSourceType() {
- return Node.class;
- }
-
- @Override
- protected Class<XMLStreamReader> getTargetType() {
- return XMLStreamReader.class;
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java
deleted file mode 100644
index 07ee0b0ca4..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/extension/XSDDataTypeConverterTestCase.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.extension;
-
-import java.math.BigInteger;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.impl.XSDDataTypeConverter;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class XSDDataTypeConverterTestCase extends TestCase {
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testConvert() throws Exception {
- XSDDataTypeConverter c = new XSDDataTypeConverter();
- assertEquals("123", c.parseAnySimpleType(c.printAnySimpleType("123")));
- assertEquals(true, c.parseBoolean(c.printBoolean(true)));
- assertEquals(false, c.parseBoolean(c.printBoolean(false)));
- assertEquals(123.0, c.parseDouble(c.printDouble(123.0)));
- assertEquals(123.0f, c.parseFloat(c.printFloat(123.0f)));
- assertEquals(64, c.parseByte(c.printByte((byte)64)));
- assertEquals(123, c.parseInt(c.printInt(123)));
- assertEquals(new BigInteger("123456"), c.parseInteger(c.printInteger(new BigInteger("123456"))));
- assertEquals(123456L, c.parseLong(c.printLong(123456L)));
- assertEquals((short)123, c.parseShort(c.printShort((short)123)));
-
- Calendar calendar = new GregorianCalendar();
- String s = c.printDate(calendar);
- calendar = c.parseDate(s);
- assertEquals(s, c.printDate(calendar));
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java
deleted file mode 100644
index 15b9242340..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingRegistryImplTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.easymock.EasyMock;
-import org.xml.sax.ContentHandler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingRegistryImplTestCase extends TestCase {
- private DataBindingExtensionPoint registry;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- registry = new DefaultDataBindingExtensionPoint();
- }
-
- @SuppressWarnings("unchecked")
- public void testRegistry() {
- DataBinding db1 = createMock(DataBinding.class);
- expect(db1.getName()).andReturn(ContentHandler.class.getName()).anyTimes();
- DataType<Class> dataType1 = new DataTypeImpl<Class>(ContentHandler.class, ContentHandler.class);
- expect(db1.introspect(dataType1, null)).andReturn(true);
- expect(db1.introspect(EasyMock.not(EasyMock.same(dataType1)), (Operation) EasyMock.isNull()))
- .andReturn(false).anyTimes();
- replay(db1);
-
- registry.addDataBinding(db1);
-
- DataBinding db2 = createMock(DataBinding.class);
- expect(db2.getName()).andReturn(XMLStreamReader.class.getName()).anyTimes();
- DataType<Class> dataType2 = new DataTypeImpl<Class>(XMLStreamReader.class, XMLStreamReader.class);
- expect(db2.introspect(dataType2, null)).andReturn(true);
- expect(db2.introspect(EasyMock.not(EasyMock.same(dataType2)), (Operation) EasyMock.isNull()))
- .andReturn(false).anyTimes();
- replay(db2);
-
- registry.addDataBinding(db2);
-
- // Lookup by name
- String name = db1.getName();
- DataBinding db3 = registry.getDataBinding(name);
- assertSame(db1, db3);
-
- DataType dt = new DataTypeImpl<Class>(ContentHandler.class, null);
- registry.introspectType(dt, null);
- assertEquals(dataType1.getLogical(), ContentHandler.class);
- //FIXME does not match with dynamically loaded databindings
- //assertTrue(dt.getDataBinding().equalsIgnoreCase("java.lang.Object"));
-
- registry.removeDataBinding(name);
- DataBinding db4 = registry.getDataBinding(name);
- assertNull(db4);
-
- dt = new DataTypeImpl<Class>(null, String.class, null);
- registry.introspectType(dt, null);
- //FIXME does not match with dynamically loaded databindings
- //assertEquals("java.lang.Object", dt.getDataBinding());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.java
deleted file mode 100644
index 7c882c0285..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DataBindingTestCase.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.databinding.impl;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.annotation.DataBinding;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DataBindingTestCase extends TestCase {
- @SuppressWarnings("unused")
- public void testDataType() throws Exception {
- Class<Test> testClass = Test.class;
- DataBinding d = testClass.getAnnotation(DataBinding.class);
- Assert.assertEquals(d.value(), "sdo");
-
- Method method = testClass.getMethod("test", new Class[] {Object.class});
- DataBinding d2 = method.getAnnotation(DataBinding.class);
- Assert.assertEquals(d2.value(), "jaxb");
- }
-
- @DataBinding("sdo")
- private static interface Test {
- @DataBinding("jaxb")
- Object test(Object object);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java
deleted file mode 100644
index 053e4f2a59..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/DirectedGraphTestCase.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Edge;
-import org.apache.tuscany.sca.databinding.impl.DirectedGraph.Vertex;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DirectedGraphTestCase extends TestCase {
- private DirectedGraph<String, Object> graph;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- graph = new DirectedGraph<String, Object>();
- }
-
- public void testGraph() {
- graph.addEdge("a", "b", null, 3, true);
- graph.addEdge("b", "c", null, 1, true);
- // graph.addEdge("a", "c", null, 8, true);
- graph.addEdge("a", "d", null, 3, true);
- graph.addEdge("b", "d", null, 2, true);
- graph.addEdge("d", "c", null, 3, true);
- graph.addEdge("c", "b", null, 1, true);
- graph.addEdge("c", "d", null, 2, true);
- graph.addEdge("d", "b", null, 1, true);
- graph.addEdge("a", "e", null, 8, true);
- graph.addEdge("c", "c", null, 2, true);
- graph.addEdge("f", "g", null, 2, false);
- graph.addEdge("f", "h", null, 8, true);
- graph.addEdge("g", "j", null, 2, false);
- graph.addEdge("j", "i", null, 2, true);
- graph.addEdge("h", "i", null, 8, true);
-
- Vertex vertex = graph.getVertex("a");
- Assert.assertNotNull(vertex);
- Assert.assertEquals(vertex.getValue(), "a");
-
- Assert.assertNull(graph.getVertex("1"));
-
- Edge edge = graph.getEdge("a", "b");
- Assert.assertNotNull(edge);
- Assert.assertEquals(edge.getWeight(), 3);
-
- edge = graph.getEdge("b", "a");
- Assert.assertNull(edge);
-
- DirectedGraph<String, Object>.Path path = graph.getShortestPath("a", "c");
-
- List<DirectedGraph<String, Object>.Edge> edges = path.getEdges();
- Assert.assertEquals(edges.size(), 2);
- Assert.assertEquals(edges.get(0), graph.getEdge("a", "b"));
- Assert.assertEquals(edges.get(1), graph.getEdge("b", "c"));
-
- Assert.assertEquals(path.getWeight(), 4);
-
- DirectedGraph<String, Object>.Path path2 = graph.getShortestPath("b", "e");
- Assert.assertNull(path2);
-
- DirectedGraph<String, Object>.Path path3 = graph.getShortestPath("a", "a");
- Assert.assertTrue(path3.getWeight() == 0 && path3.getEdges().isEmpty());
-
- DirectedGraph<String, Object>.Path path4 = graph.getShortestPath("c", "c");
- Assert.assertTrue(path4.getWeight() == 2 && path4.getEdges().size() == 1);
-
- DirectedGraph<String, Object>.Path path5 = graph.getShortestPath("f", "i");
- Assert.assertTrue(path5.getWeight() == 16 && path5.getEdges().size() == 2);
-
- }
-
- public void testSort() {
- graph.addEdge("a", "b");
- graph.addEdge("a", "c");
- graph.addEdge("c", "d");
- graph.addEdge("b", "c");
- List<String> order = graph.topologicalSort(true);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(!graph.getVertices().isEmpty());
-
- graph.addEdge("d", "a");
- try {
- order = graph.topologicalSort(true);
- assertTrue("Should have failed", false);
- } catch (IllegalArgumentException e) {
- assertTrue(true);
- }
-
- graph.removeEdge("d", "a");
- order = graph.topologicalSort(false);
- assertEquals(Arrays.asList("a", "b", "c", "d"), order);
- assertTrue(graph.getVertices().isEmpty());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.java
deleted file mode 100644
index 6cc8868397..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/MediatorImplTestCase.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.databinding.impl;
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.TransformationContext;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.xml.Node2String;
-import org.apache.tuscany.sca.databinding.xml.Node2Writer;
-import org.apache.tuscany.sca.databinding.xml.SAX2DOMPipe;
-import org.apache.tuscany.sca.databinding.xml.String2SAX;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Test case for MediatorImpl
- *
- * @version $Rev$ $Date$
- */
-public class MediatorImplTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + "<state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + "<USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- private MediatorImpl mediator;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- DataBindingExtensionPoint dataBindingRegistry = new DefaultDataBindingExtensionPoint();
- TransformerExtensionPoint registry = new DefaultTransformerExtensionPoint();
-
- registry.addTransformer(new String2SAX(), true);
- registry.addTransformer(new SAX2DOMPipe(), true);
- registry.addTransformer(new Node2String(), true);
- registry.addTransformer(new Node2Writer(), true);
-
- mediator = new MediatorImpl(dataBindingRegistry, registry);
- }
-
- private TransformationContext createTransformationContext(Class sourceType, Class targetType) {
- TransformationContext context = new TransformationContextImpl();
- DataType sourceDataType = new DataTypeImpl<Class>(sourceType.getName(), sourceType, sourceType);
- DataType targetDataType = new DataTypeImpl<Class>(targetType.getName(), targetType, targetType);
- context.setSourceDataType(sourceDataType);
- context.setTargetDataType(targetDataType);
- return context;
- }
-
- public void testTransform1() {
- TransformationContext context = createTransformationContext(String.class, Node.class);
- Object node =
- mediator.mediate(IPO_XML, context.getSourceDataType(), context.getTargetDataType(), null);
- Assert.assertTrue(node instanceof Document);
- Element root = ((Document)node).getDocumentElement();
- Assert.assertEquals(root.getNamespaceURI(), "http://www.example.com/IPO");
- Assert.assertEquals(root.getLocalName(), "purchaseOrder");
- }
-
- public void testTransform2() {
- TransformationContext context = createTransformationContext(String.class, Writer.class);
- Writer writer = new StringWriter();
- mediator.mediate(IPO_XML, writer, context.getSourceDataType(), context.getTargetDataType(), null);
- String str = writer.toString();
- Assert.assertTrue(str != null && str.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java
deleted file mode 100644
index 31c3fd4f00..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/TransformerRegistryImplTestCase.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint;
-import org.apache.tuscany.sca.databinding.Transformer;
-import org.apache.tuscany.sca.databinding.TransformerExtensionPoint;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TransformerRegistryImplTestCase extends TestCase {
- private TransformerExtensionPoint registry;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- registry = new DefaultTransformerExtensionPoint();
- }
-
- public void testRegisterTransformer1() {
- Transformer transformer = createMock(Transformer.class);
- registry.addTransformer("a", "b", 10, transformer, true);
- Transformer t = registry.getTransformer("a", "b");
- Assert.assertSame(t, transformer);
- }
-
- public void testRegisterTransformerTransformer() {
- Transformer transformer = createMock(Transformer.class);
- expect(transformer.getSourceDataBinding()).andReturn("a");
- expect(transformer.getTargetDataBinding()).andReturn("b");
- expect(transformer.getWeight()).andReturn(10);
- replay(transformer);
- registry.addTransformer(transformer, true);
- Transformer t = registry.getTransformer("a", "b");
- Assert.assertSame(t, transformer);
- }
-
- public void testUnregisterTransformer() {
- Transformer transformer = createMock(Transformer.class);
- registry.addTransformer("a", "b", 10, transformer, true);
- boolean result = registry.removeTransformer("a", "b");
- Assert.assertTrue(result);
- Transformer t = registry.getTransformer("a", "b");
- Assert.assertNull(t);
- }
-
- public void testGetTransformerChain() {
- Transformer t1 = createMock(Transformer.class);
- expect(t1.getSourceDataBinding()).andReturn("a");
- expect(t1.getTargetDataBinding()).andReturn("b");
- expect(t1.getWeight()).andReturn(10);
- replay(t1);
- Transformer t2 = createMock(Transformer.class);
- expect(t2.getSourceDataBinding()).andReturn("b");
- expect(t2.getTargetDataBinding()).andReturn("c");
- expect(t2.getWeight()).andReturn(20);
- replay(t2);
-
- Transformer t3 = createMock(Transformer.class);
- expect(t3.getSourceDataBinding()).andReturn("a");
- expect(t3.getTargetDataBinding()).andReturn("c");
- expect(t3.getWeight()).andReturn(120);
- replay(t3);
-
- registry.addTransformer(t1, true);
- registry.addTransformer(t2, true);
- registry.addTransformer(t3, true);
-
- List<Transformer> l1 = registry.getTransformerChain("a", "b");
- Assert.assertTrue(l1.size() == 1 && l1.get(0) == t1);
- List<Transformer> l2 = registry.getTransformerChain("a", "c");
- Assert.assertTrue(l2.size() == 1 && l2.get(0) == t3);
- List<Transformer> l3 = registry.getTransformerChain("a", "d");
- Assert.assertNull(l3);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
deleted file mode 100644
index dd3d000798..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/impl/XMLDocumentStreamReaderTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.impl;
-
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.databinding.xml.XMLDocumentStreamReader;
-import org.apache.tuscany.sca.databinding.xml.XMLStreamReader2String;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLDocumentStreamReaderTestCase {
- private static final String xml = "<e1><e2 a2=\"a2\"><e4>E4</e4></e2><e3 a3=\"a3\"/></e1>";
-
- @org.junit.Test
- public void testReader() throws Exception {
- XMLInputFactory factory = XMLInputFactory.newInstance();
- XMLStreamReader r1 = factory.createXMLStreamReader(new StringReader(xml));
- XMLDocumentStreamReader r2 = new XMLDocumentStreamReader(r1);
- XMLStreamReader2String t1 = new XMLStreamReader2String();
- String result = t1.transform(r2, null);
- System.out.println(result);
- XMLStreamReader r3 = factory.createXMLStreamReader(new StringReader(xml));
- r3.nextTag();
- r3.nextTag();
- Assert.assertEquals(XMLStreamConstants.START_ELEMENT, r3.getEventType());
- Assert.assertEquals(new QName(null, "e2"), r3.getName());
- XMLDocumentStreamReader r4 = new XMLDocumentStreamReader(r3);
- result = t1.transform(r4, null);
- System.out.println(result);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
deleted file mode 100644
index bdc9690285..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/BeanXMLStreamReaderTestCase.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.custommonkey.xmlunit.Diff;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BeanXMLStreamReaderTestCase extends TestCase {
- private static final String XML_RESULT =
- "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
- + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
- + "<list>Item1</list><list>Item2</list>"
- + "<map><entry><key>key1</key><value>value1</value></entry>"
- + "<entry><key>key2</key><value>value2</value></entry></map>"
- + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
- + "<str>ABC</str></MyBean>";
-
- // The map entries can come in a different order
- private static final String XML_RESULT1 =
- "<?xml version='1.0' encoding='UTF-8'?>" + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
- + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i>"
- + "<list>Item1</list><list>Item2</list>"
- + "<map><entry><key>key2</key><value>value2</value></entry>"
- + "<entry><key>key1</key><value>value1</value></entry></map>"
- + "<nil xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\" />"
- + "<str>ABC</str></MyBean>";
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testTransformation() throws Exception {
- MyBean bean = new MyBean();
- bean.str = "ABC";
- bean.i = 1;
- bean.arr = new long[] {1, 2, 3};
- bean.bean = new AnotherBean();
- bean.bean.setName("Name");
- bean.list.add("Item1");
- bean.list.add("Item2");
- bean.map.put("key1", "value1");
- bean.map.put("key2", "value2");
- XMLStreamReader reader = new BeanXMLStreamReaderImpl(null, bean);
- XMLStreamReader2String t3 = new XMLStreamReader2String();
- String xml = t3.transform(reader, null);
- Diff diff = new Diff(XML_RESULT, xml);
- Diff diff1 = new Diff(XML_RESULT1, xml);
- assertTrue(diff.similar() || diff1.similar());
- }
-
- private static class MyBean {
- private long arr[];
- private String str;
- private int i;
- private String nil;
- private List<String> list = new ArrayList();
- private AnotherBean bean;
- private Map<String, String> map = new HashMap<String, String>();
-
- /**
- * @return the i
- */
- public int getI() {
- return i;
- }
-
- /**
- * @param i the i to set
- */
- public void setI(int i) {
- this.i = i;
- }
-
- /**
- * @return the arr
- */
- public long[] getArr() {
- return arr;
- }
-
- /**
- * @param arr the arr to set
- */
- public void setArr(long[] arr) {
- this.arr = arr;
- }
-
- /**
- * @return the str
- */
- public String getStr() {
- return str;
- }
-
- /**
- * @param str the str to set
- */
- public void setStr(String str) {
- this.str = str;
- }
-
- /**
- * @return the bean
- */
- public AnotherBean getBean() {
- return bean;
- }
-
- /**
- * @param bean the bean to set
- */
- public void setBean(AnotherBean bean) {
- this.bean = bean;
- }
-
- public List<String> getList() {
- return list;
- }
-
- public void setList(List<String> list) {
- this.list = list;
- }
-
- public String getNil() {
- return nil;
- }
-
- public void setNil(String nil) {
- this.nil = nil;
- }
-
- public Map<String, String> getMap() {
- return map;
- }
-
- public void setMap(Map<String, String> map) {
- this.map = map;
- }
-
- }
-
- private static class AnotherBean {
- private String name;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
deleted file mode 100644
index 9e9dabcea7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DOM2StAXTestCase.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.custommonkey.xmlunit.XMLAssert;
-import org.w3c.dom.Node;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DOM2StAXTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- private static final String CRAZY_XML =
- "<p:e1 xmlns=\"http://ns0\" xmlns:p=\"http://p1\">" + "<p:e2 xmlns:p=\"http://p2\"/><e3/><e4 xmlns=\"\">E4</e4></p:e1>";
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testTransformation() throws Exception {
- String2Node t1 = new String2Node();
- Node node = t1.transform(IPO_XML, null);
- Node2XMLStreamReader t2 = new Node2XMLStreamReader();
- XMLStreamReader reader = t2.transform(node, null);
- XMLStreamReader2String t3 = new XMLStreamReader2String();
- String xml = t3.transform(reader, null);
- XMLAssert.assertXMLEqual(IPO_XML, xml);
- // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
- }
-
- public void testTransformation2() throws Exception {
- String2Node t1 = new String2Node();
- Node node = t1.transform(CRAZY_XML, null);
- Node2XMLStreamReader t2 = new Node2XMLStreamReader();
- XMLStreamReader reader = t2.transform(node, null);
- XMLStreamReader2String t3 = new XMLStreamReader2String();
- String xml = t3.transform(reader, null);
- // System.out.println(xml);
- XMLAssert.assertXMLEqual(CRAZY_XML, xml);
- assertTrue(xml.contains("<p:e2 xmlns:p=\"http://p2\""));
- }
-
- public void testTransformation3() throws Exception {
- String2Node t1 = new String2Node();
- Node node = t1.transform(IPO_XML, null);
- DOMXmlNodeImpl element = new DOMXmlNodeImpl(node);
- XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(element);
- XMLStreamReader2String t3 = new XMLStreamReader2String();
- String xml = t3.transform(reader, null);
- XMLAssert.assertXMLEqual(IPO_XML, xml);
- // assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.java
deleted file mode 100644
index f3b37c86db..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/DataPipeTestCase.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.databinding.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.io.Writer;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataPipe;
-import org.apache.tuscany.sca.databinding.DataPipeTransformer;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Test case for DataPipe
- *
- * @version $Rev$ $Date$
- */
-public class DataPipeTestCase extends TestCase {
-
- public final void testStreamPipe() throws IOException {
- byte[] bytes = new byte[] {1, 2, 3};
- DataPipeTransformer<OutputStream, InputStream> pipe = new StreamDataPipe();
- DataPipe<OutputStream, InputStream> dataPipe = pipe.newInstance();
- OutputStream os = dataPipe.getSink();
- os.write(bytes);
- byte[] newBytes = new byte[16];
- int count = dataPipe.getResult().read(newBytes);
- Assert.assertEquals(3, count);
- for (int i = 0; i < bytes.length; i++) {
- Assert.assertEquals(bytes[i], newBytes[i]);
- }
- }
-
- public final void testWriter2ReaderPipe() throws IOException {
- String str = "ABC";
- Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
- Assert.assertSame(Writer.class, pipe.getSourceType());
- Assert.assertSame(Reader.class, pipe.getTargetType());
- DataPipe<Writer, Reader> dataPipe = pipe.newInstance();
- dataPipe.getSink().write(str);
- char[] buf = new char[16];
- int count = dataPipe.getResult().read(buf);
- Assert.assertEquals(3, count);
- for (int i = 0; i < str.length(); i++) {
- Assert.assertEquals(str.charAt(i), buf[i]);
- }
- }
-
- public final void testPiped() throws Exception {
- Node2Writer node2Writer = new Node2Writer();
- Writer2ReaderDataPipe pipe = new Writer2ReaderDataPipe();
- PipedTransformer<Node, Writer, Reader> transformer =
- new PipedTransformer<Node, Writer, Reader>(node2Writer, pipe);
- Document document = DOMHelper.newDocument();
- Element element = document.createElementNS("http://ns1", "root");
- document.appendChild(element);
- Reader reader = transformer.transform(document, null);
- Assert.assertEquals(transformer.getWeight(), node2Writer.getWeight() + pipe.getWeight());
- Assert.assertEquals(transformer.getSourceDataBinding(), node2Writer.getSourceDataBinding());
- Assert.assertEquals(transformer.getTargetDataBinding(), pipe.getTargetDataBinding());
- char[] buf = new char[120];
- int count = reader.read(buf);
- String xml = new String(buf, 0, count);
- Assert.assertTrue(xml.contains("<root xmlns=\"http://ns1\"/>"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
deleted file mode 100644
index 3a287a5bb7..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/JavaBean2XMLStreamReaderTestCase.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.javabeans.JavaBean2XMLStreamReaderTransformer;
-import org.custommonkey.xmlunit.XMLAssert;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaBean2XMLStreamReaderTestCase extends TestCase {
- private static final String XML_RESULT =
- "<?xml version='1.0' encoding='UTF-8'?>"
- + "<MyBean xmlns=\"http://xml.databinding.sca.tuscany.apache.org/\">"
- + "<arr>1</arr><arr>2</arr><arr>3</arr><bean><name>Name</name></bean><i>1</i><str>ABC</str>"
- + "</MyBean>";
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testTransformation() throws Exception {
- JavaBean2XMLStreamReaderTransformer t2 = new JavaBean2XMLStreamReaderTransformer();
- MyBean bean = new MyBean();
- bean.str = "ABC";
- bean.i = 1;
- bean.arr = new long[] {1, 2, 3};
- bean.bean = new AnotherBean();
- bean.bean.setName("Name");
- XMLStreamReader reader = t2.transform(bean, null);
- XMLStreamReader2String t3 = new XMLStreamReader2String();
- String xml = t3.transform(reader, null);
- XMLAssert.assertXMLEqual(XML_RESULT, xml);
-
- }
-
- private static class MyBean {
- private String str;
- private int i;
- private long arr[];
- private AnotherBean bean;
-
- /**
- * @return the arr
- */
- public long[] getArr() {
- return arr;
- }
-
- /**
- * @param arr the arr to set
- */
- public void setArr(long[] arr) {
- this.arr = arr;
- }
-
- /**
- * @return the i
- */
- public int getI() {
- return i;
- }
-
- /**
- * @param i the i to set
- */
- public void setI(int i) {
- this.i = i;
- }
-
- /**
- * @return the str
- */
- public String getStr() {
- return str;
- }
-
- /**
- * @param str the str to set
- */
- public void setStr(String str) {
- this.str = str;
- }
-
- /**
- * @return the bean
- */
- public AnotherBean getBean() {
- return bean;
- }
-
- /**
- * @param bean the bean to set
- */
- public void setBean(AnotherBean bean) {
- this.bean = bean;
- }
-
- }
-
- private static class AnotherBean {
- private String name;
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
deleted file mode 100644
index cc1f9375c8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/Node2StringTestCase.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.databinding.xml;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Node2StringTestCase extends TestCase {
- public void testTransformation() throws Exception {
- Document document = DOMHelper.newDocument();
- Element element = document.createElementNS("http://ns1", "test");
- document.appendChild(element);
-
- new Node2String().transform(document, null);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.java
deleted file mode 100644
index 5ae0616577..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/PushTransformationTestCase.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.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.impl.PipedTransformer;
-import org.w3c.dom.Node;
-import org.xml.sax.ContentHandler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class PushTransformationTestCase extends TestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testTransformation() {
- String2XMLStreamReader t1 = new String2XMLStreamReader();
- XMLStreamReader reader = t1.transform(IPO_XML, null);
- XMLStreamReader2SAX t2 = new XMLStreamReader2SAX();
- PipedTransformer<XMLStreamReader, ContentHandler, Node> t3 =
- new PipedTransformer<XMLStreamReader, ContentHandler, Node>(t2, new SAX2DOMPipe());
- Node node = t3.transform(reader, null);
- Assert.assertNotNull(node);
- Node2String t4 = new Node2String();
- String xml = t4.transform(node, null);
- Assert.assertTrue(xml != null && xml.indexOf("<shipDate>1999-12-05</shipDate>") != -1);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.java
deleted file mode 100644
index 9ca490f2d8..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/StAXHelperTestCase.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.databinding.xml;
-
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.custommonkey.xmlunit.XMLAssert;
-
-/**
- * Test Case for StAXHelper
- *
- * @version $Rev$ $Date$
- */
-public class StAXHelperTestCase extends TestCase {
- private static final String XML =
- "<a:foo xmlns:a='http://a' name='foo'><bar name='bar'>"
- + "<doo a:name='doo' xmlns:a='http://doo'/>"
- + "</bar></a:foo>";
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public void testHelper() throws Exception {
- XMLStreamReader reader = StAXHelper.createXMLStreamReader(XML);
- String xml = StAXHelper.save(reader);
- XMLAssert.assertXMLEqual(XML, xml);
- reader = StAXHelper.createXMLStreamReader(xml);
- assertNotNull(reader);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
deleted file mode 100644
index ff6f8c1406..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/TraxTransformerTestCase.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.w3c.dom.Node;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TraxTransformerTestCase extends TestCase {
- private URL url;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- url = getClass().getResource("foo.xml");
- }
-
- public void testTransformDOM() throws IOException {
- InputStream is = url.openStream();
- InputStream2Node t1 = new InputStream2Node();
- Node node = t1.transform(is, null);
- is.close();
- Writer writer = new StringWriter();
- Node2Writer t2 = new Node2Writer();
- t2.transform(node, writer, null);
- String str = writer.toString();
- StringReader reader = new StringReader(str);
- Reader2Node t3 = new Reader2Node();
- node = t3.transform(reader, null);
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- Node2OutputStream t4 = new Node2OutputStream();
- t4.transform(node, os, null);
- InputSource inputSource = new InputSource(new ByteArrayInputStream(os.toByteArray()));
- InputSource2Node t5 = new InputSource2Node();
- node = t5.transform(inputSource, null);
- }
-
- public void testTransformSAX() throws IOException {
- MyContentHandler handler = new MyContentHandler();
- InputStream is = url.openStream();
- InputStream2SAX t1 = new InputStream2SAX();
- t1.transform(is, handler, null);
- is.close();
-
- String xml = "<foo xmlns=\"http://foo\">bar</foo>";
-
- InputSource inputSource = new InputSource(new StringReader(xml));
- InputSource2SAX t2 = new InputSource2SAX();
- MyContentHandler handler2 = new MyContentHandler();
- t2.transform(inputSource, handler2, null);
-
- }
-
- private static class MyContentHandler extends DefaultHandler {
-
- @Override
- public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
- throws SAXException {
- super.startElement(namespaceURI, localName, qName, atts);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java b/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
deleted file mode 100644
index 0463e7d9f5..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/java/org/apache/tuscany/sca/databinding/xml/XmlTreeStreamReaderTestCase.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.databinding.xml;
-
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-
-import org.custommonkey.xmlunit.XMLAssert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XmlTreeStreamReaderTestCase {
- private static final String IPO_XML =
- "<?xml version=\"1.0\"?>" + "<ipo:purchaseOrder"
- + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
- + " xmlns:ipo=\"http://www.example.com/IPO\""
- + " xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\""
- + " orderDate=\"1999-12-01\">"
- + " <shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\">"
- + " <name>Helen Zoe</name>"
- + " <street>47 Eden Street</street>"
- + " <city>Cambridge</city>"
- + " <postcode>CB1 1JR</postcode>"
- + " </shipTo>"
- + " <billTo xsi:type=\"ipo:USAddress\">"
- + " <name>Robert Smith</name>"
- + " <street>8 Oak Avenue</street>"
- + " <city>Old Town</city>"
- + " <state>PA</state>"
- + " <zip>95819</zip>"
- + " </billTo>"
- + " <items>"
- + " <item partNum=\"833-AA\">"
- + " <productName>Lapis necklace</productName>"
- + " <quantity>1</quantity>"
- + " <USPrice>99.95</USPrice>"
- + " <ipo:comment>Want this for the holidays</ipo:comment>"
- + " <shipDate>1999-12-05</shipDate>"
- + " </item>"
- + " </items>"
- + "</ipo:purchaseOrder>";
-
- private static final String XML_RESULT =
- "<?xml version='1.0' encoding='UTF-8'?>" + "<p1:e1 xmlns:p1=\"http://ns\">"
- + "<p2:e11 xmlns:p2=\"http://ns1\">MyText</p2:e11>"
- + "<p1:e12><p1:e121 /></p1:e12>"
- + "<ipo:purchaseOrder xmlns:ipo=\"http://www.example.com/IPO\" "
- + "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
- + "xsi:schemaLocation=\"http://www.example.com/IPO ipo.xsd\" orderDate=\"1999-12-01\"> "
- + "<shipTo exportCode=\"1\" xsi:type=\"ipo:UKAddress\"> "
- + "<name>Helen Zoe</name> <street>47 Eden Street</street> "
- + "<city>Cambridge</city> <postcode>CB1 1JR</postcode> </shipTo> "
- + "<billTo xsi:type=\"ipo:USAddress\"> <name>Robert Smith</name> "
- + "<street>8 Oak Avenue</street> <city>Old Town</city> <state>PA</state> "
- + "<zip>95819</zip> </billTo> <items> <item partNum=\"833-AA\"> "
- + "<productName>Lapis necklace</productName> <quantity>1</quantity> "
- + "<USPrice>99.95</USPrice> <ipo:comment>Want this for the holidays</ipo:comment> "
- + "<shipDate>1999-12-05</shipDate> </item> </items></ipo:purchaseOrder></p1:e1>";
- private XmlNodeImpl root;
-
- @Before
- public void setUp() throws Exception {
- root = new XmlNodeImpl();
- root.name = new QName("http://ns", "e1", "p1");
-
- XmlNodeImpl e11 = new XmlNodeImpl();
- e11.name = new QName("http://ns1", "e11", "p2");
-
- XmlNodeImpl e12 = new XmlNodeImpl();
- e12.name = new QName("http://ns", "e12");
-
- root.children.add(e11);
- root.children.add(e12);
-
- XmlNodeImpl e121 = new XmlNodeImpl();
- e121.name = new QName("http://ns", "e121");
- e12.children.add(e121);
-
- XmlNodeImpl e111 = new XmlNodeImpl();
- e111.value = "MyText";
- e11.children.add(e111);
-
- XmlNodeImpl e13 = new XmlNodeImpl();
- e13.value = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(IPO_XML));
- root.children.add(e13);
-
- }
-
- @Test
- public void testIterator() {
- List<QName> elements = new ArrayList<QName>();
- XmlNodeIterator i = new XmlNodeIterator(root);
- for (; i.hasNext();) {
- XmlNode e = i.next();
- elements.add(e.getName());
- }
- // System.out.println(elements);
- QName[] names =
- {new QName("http://ns", "e1"), new QName("http://ns1", "e11"), null, null, new QName("http://ns1", "e11"),
- new QName("http://ns", "e12"), new QName("http://ns", "e121"), new QName("http://ns", "e121"),
- new QName("http://ns", "e12"), null, null, new QName("http://ns", "e1")};
- Assert.assertEquals(Arrays.asList(names), elements);
- }
-
- @Test
- public void testReader() throws Exception {
- XmlTreeStreamReaderImpl reader = new XmlTreeStreamReaderImpl(root);
- XMLStreamReader2String t = new XMLStreamReader2String();
- String xml = t.transform(reader, null);
- XMLAssert.assertXMLEqual(XML_RESULT, xml);
- }
-
- private static class XmlNodeImpl implements XmlNode {
- private List<XmlNode> children = new ArrayList<XmlNode>();
- private List<XmlNode> attrs = new ArrayList<XmlNode>();
- private Map<String, String> namespaces = new HashMap<String, String>();
- private QName name;
- private Object value = "123";
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#attributes()
- */
- public List<XmlNode> attributes() {
- return attrs;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#children()
- */
- public Iterator<XmlNode> children() {
- return children.iterator();
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getName()
- */
- public QName getName() {
- return name;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#getValue()
- */
- public <T> T getValue() {
- return (T)value;
- }
-
- /**
- * @see org.apache.tuscany.sca.databinding.xml.XmlNode#namespaces()
- */
- public Map<String, String> namespaces() {
- return namespaces;
- }
-
- @Override
- public String toString() {
- return String.valueOf(name);
- }
-
- public Type getType() {
- if (value instanceof XMLStreamReader) {
- return Type.READER;
- }
- return name == null ? Type.CHARACTERS : Type.ELEMENT;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd b/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd
deleted file mode 100644
index 92a576fb98..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl b/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl
deleted file mode 100644
index 100890e10b..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/impl/order.wsdl
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/order.wsdl" xmlns:tns="http://example.com/order.wsdl"
- xmlns:xsd1="http://example.com/order.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/order.xsd" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd"/>
- <element name="checkOrderStatus">
- <complexType>
- <sequence>
- <element name="customerId" type="string" />
- <element name="order" type="ipo:PurchaseOrderType" />
- <element name="flag" type="int" />
- </sequence>
- </complexType>
- </element>
- <element name="checkOrderStatusResponse">
- <complexType>
- <sequence>
- <element name="status" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="note" type="string" />
- </schema>
- </types>
-
- <message name="CheckOrderStatusInput1">
- <part name="body" element="xsd1:checkOrderStatus" />
- </message>
-
- <message name="CheckOrderStatusOutput1">
- <part name="body" element="xsd1:checkOrderStatusResponse" />
- </message>
-
- <message name="CheckOrderStatusInput2">
- <part name="p1" element="xsd1:checkOrderStatus" />
- <part name="p2" element="xsd1:note" />
- </message>
-
- <message name="CheckOrderStatusOutput2">
- <part name="p1" element="xsd1:checkOrderStatusResponse" />
- </message>
-
- <portType name="OrderPortType">
- <operation name="checkOrderStatus">
- <input message="tns:CheckOrderStatusInput1" />
- <output message="tns:CheckOrderStatusOutput1" />
- </operation>
- <operation name="checkOrderStatus2">
- <input message="tns:CheckOrderStatusInput2" />
- <output message="tns:CheckOrderStatusOutput2" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml b/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml
deleted file mode 100644
index 0ba8ade1e0..0000000000
--- a/branches/sca-java-1.5.1/modules/databinding/src/test/resources/org/apache/tuscany/sca/databinding/xml/foo.xml
+++ /dev/null
@@ -1,22 +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.
--->
-<f:foo xmlns:f="http://foo" name="foo">
- <b:bar xmlns:b="http://bar">bar</b:bar>
-</f:foo> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/LICENSE b/branches/sca-java-1.5.1/modules/definitions-xml/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-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-java-1.5.1/modules/definitions-xml/NOTICE b/branches/sca-java-1.5.1/modules/definitions-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/pom.xml b/branches/sca-java-1.5.1/modules/definitions-xml/pom.xml
deleted file mode 100644
index 3744186719..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/pom.xml
+++ /dev/null
@@ -1,82 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-definitions-xml</artifactId>
- <name>Apache Tuscany SCA Definitions XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.definitions.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.definitions.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java b/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
deleted file mode 100644
index 3c315cadcd..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsDocumentProcessor.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.definitions.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * A SCA Definitions Document processor.
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsDocumentProcessor implements URLArtifactProcessor<SCADefinitions> {
- private StAXArtifactProcessor<Object> extensionProcessor;
- private XMLInputFactory inputFactory;
- private static final String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
- private static final String DEFINITIONS = "definitions";
- private static final QName DEFINITIONS_QNAME = new QName(TUSCANY_NS, DEFINITIONS);
- private Monitor monitor;
-
- /**
- * Construct a new SCADefinitions processor
- * @param assemblyFactory
- * @param policyFactory
- * @param staxProcessor
- */
- public SCADefinitionsDocumentProcessor(StAXArtifactProcessor<Object> staxProcessor,
- XMLInputFactory inputFactory,
- Monitor monitor) {
- this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
- this.inputFactory = inputFactory;
- this.monitor = monitor;
- }
-
- /**
- * Constructs a new SCADefinitions processor.
- *
- * @param modelFactories
- * @param staxProcessor
- */
- public SCADefinitionsDocumentProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> staxProcessor,
- Monitor monitor) {
- this.extensionProcessor = (StAXArtifactProcessor<Object>)staxProcessor;
- this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "definitions-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "definitions-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
-
- public SCADefinitions read(URL contributionURL, final URI uri, final URL url) throws ContributionReadException {
- InputStream urlStream = null;
- try {
- // Allow privileged access to open URL stream. Add FilePermission to added to security
- // policy file.
- try {
- urlStream = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
- public InputStream run() throws IOException {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- return connection.getInputStream();
- }
- });
- } catch (PrivilegedActionException e) {
- error("PrivilegedActionException", url, (IOException)e.getException());
- throw (IOException)e.getException();
- }
-
- //urlStream = createInputStream(url);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(url.toString(), urlStream);
-
- SCADefinitions definitions = new SCADefinitionsImpl();
- QName name = null;
- int event;
- while ( reader.hasNext() ) {
- event = reader.next();
-
- if ( event == XMLStreamConstants.START_ELEMENT ||
- event == XMLStreamConstants.END_ELEMENT ) {
- name = reader.getName();
- if ( name.equals(DEFINITIONS_QNAME) ) {
- if ( event == XMLStreamConstants.END_ELEMENT ) {
- return definitions;
- }
- } else {
- SCADefinitions aDefn = (SCADefinitions)extensionProcessor.read(reader);
- SCADefinitionsUtil.aggregateSCADefinitions(aDefn, definitions);
- }
- }
- }
-
- return definitions;
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } catch (IOException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } finally {
-
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(SCADefinitions scaDefinitions, ModelResolver resolver) throws ContributionResolveException {
- SCADefinitionsUtil.stripDuplicates(scaDefinitions);
- extensionProcessor.resolve(scaDefinitions, resolver);
- }
-
- public String getArtifactType() {
- return "definitions.xml";
- }
-
- public Class<SCADefinitions> getModelType() {
- return SCADefinitions.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java b/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
deleted file mode 100644
index 0bea894854..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/java/org/apache/tuscany/sca/definitions/xml/SCADefinitionsProcessor.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.definitions.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.DefinitionElement;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Processor for SCA Definitions
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<SCADefinitions> {
-
- private StAXArtifactProcessor<Object> extensionProcessor;
- private Monitor monitor;
-
- public static final String BINDING = "binding";
- public static final String IMPLEMENTATION = "implementation";
- public static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- public static final String SCA_DEFINITIONS = "definitions";
- public static final QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
- public static final String TARGET_NAMESPACE = "targetNamespace";
- public static final String NAME = "name";
-
- /**
- * Construct a new definitions processor
- * @param extensionProcessor
- * @param modelResolver
- */
- public SCADefinitionsProcessor(StAXArtifactProcessor<Object> extensionProcessor,
- ModelResolver modelResolver, Monitor monitor) {
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- public SCADefinitionsProcessor(ExtensionPointRegistry extensionPoints,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- public SCADefinitions read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- QName name = null;
- SCADefinitions definitions = null;
- String targetNamespace = null;
-
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT: {
- name = reader.getName();
- if ( SCA_DEFINITIONS_QNAME.equals(name)) {
- definitions = new SCADefinitionsImpl();
- targetNamespace = reader.getAttributeValue(null, TARGET_NAMESPACE);
- definitions.setTargetNamespace(targetNamespace);
- } else {
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if ( extension instanceof Intent ) {
- Intent intent = (Intent)extension;
- intent.setName(new QName(targetNamespace,
- intent.getName().getLocalPart()));
- if ( intent instanceof QualifiedIntent ) {
- QualifiedIntent qualifiedIntent = (QualifiedIntent)intent;
- qualifiedIntent.getQualifiableIntent().
- setName(new QName(targetNamespace,
- qualifiedIntent.getQualifiableIntent().getName().getLocalPart()));
- }
-
- // FIXME: Workaround for TUSCANY-2499
- intent.setUnresolved(false);
-
- definitions.getPolicyIntents().add(intent);
- } else if ( extension instanceof PolicySet ) {
- PolicySet policySet = (PolicySet)extension;
- policySet.setName(new QName(targetNamespace,
- policySet.getName().getLocalPart()));
- definitions.getPolicySets().add(policySet);
- } else if ( extension instanceof Binding ) {
- Binding binding = (Binding)extension;
- if (binding instanceof DefinitionElement)
- ((DefinitionElement)binding).setTargetNamespace(targetNamespace);
- definitions.getBindings().add(binding);
- } else if ( extension instanceof IntentAttachPointType ) {
- IntentAttachPointType type = (IntentAttachPointType)extension;
- if ( type.getName().getLocalPart().startsWith(BINDING)) {
- definitions.getBindingTypes().add((IntentAttachPointType)extension);
- } else if ( type.getName().getLocalPart().startsWith(IMPLEMENTATION)) {
- definitions.getImplementationTypes().add((IntentAttachPointType)extension);
- }
- }
- }
- break;
- }
- }
-
- case XMLStreamConstants.CHARACTERS:
- break;
-
- case END_ELEMENT:
- name = reader.getName();
- if ( SCA_DEFINITIONS_QNAME.equals(name)) {
- return definitions;
- }
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- return definitions;
- }
-
- public void write(SCADefinitions definitions, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- writeStartDocument(writer, SCA10_NS, SCA_DEFINITIONS,
- new XAttr(TARGET_NAMESPACE, definitions.getTargetNamespace()));
-
- for (Intent policyIntent : definitions.getPolicyIntents()) {
- extensionProcessor.write(policyIntent, writer);
- }
-
- for (PolicySet policySet : definitions.getPolicySets()) {
- extensionProcessor.write(policySet, writer);
- }
-
- for (IntentAttachPointType bindingType : definitions.getBindingTypes()) {
- extensionProcessor.write(bindingType, writer);
- }
-
- for (IntentAttachPointType implType : definitions.getImplementationTypes()) {
- extensionProcessor.write(implType, writer);
- }
-
- writeEndDocument(writer);
- }
-
- public void resolve(SCADefinitions scaDefns, ModelResolver resolver) throws ContributionResolveException {
- // start by adding all of the top level artifacts into the resolver as there
- // are many cross artifact references in a definitions file and we don't want
- // to be dependent on the order things appear
-
- List<Intent> simpleIntents = new ArrayList<Intent>();
- List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
- List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
- List<PolicySet> simplePolicySets = new ArrayList<PolicySet>();
- List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
-
- for (Intent policyIntent : scaDefns.getPolicyIntents()) {
- if (policyIntent instanceof ProfileIntent)
- profileIntents.add((ProfileIntent)policyIntent);
- else if (policyIntent instanceof QualifiedIntent)
- qualifiedIntents.add((QualifiedIntent)policyIntent);
- else simpleIntents.add(policyIntent);
-
- resolver.addModel(policyIntent);
- }
-
- for (PolicySet policySet : scaDefns.getPolicySets()) {
- if (policySet.getReferencedPolicySets().isEmpty())
- simplePolicySets.add(policySet);
- else referredPolicySets.add(policySet);
-
- resolver.addModel(policySet);
- }
-
- for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
- resolver.addModel(bindingType);
- }
-
- for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
- resolver.addModel(implType);
- }
-
- for (Object binding : scaDefns.getBindings() ) {
- resolver.addModel(binding);
- }
-
- // now resolve everything to ensure that any references between
- // artifacts are satisfied
-
- for (Intent policyIntent : simpleIntents)
- extensionProcessor.resolve(policyIntent, resolver);
-
- for (ProfileIntent policyIntent : profileIntents)
- extensionProcessor.resolve(policyIntent, resolver);
-
- for (QualifiedIntent policyIntent : qualifiedIntents)
- extensionProcessor.resolve(policyIntent, resolver);
-
- for (PolicySet policySet : simplePolicySets)
- extensionProcessor.resolve(policySet, resolver);
-
- for (PolicySet policySet : referredPolicySets)
- extensionProcessor.resolve(policySet, resolver);
-
- for (int count = 0, size = scaDefns.getBindingTypes().size(); count < size; count++) {
- IntentAttachPointType bindingType = scaDefns.getBindingTypes().get(count);
- extensionProcessor.resolve(bindingType, resolver);
- }
-
- for (int count = 0, size = scaDefns.getImplementationTypes().size(); count < size; count++) {
- IntentAttachPointType implType = scaDefns.getImplementationTypes().get(count);
- extensionProcessor.resolve(implType, resolver);
- }
- }
-
- public QName getArtifactType() {
- return SCA_DEFINITIONS_QNAME;
- }
-
- public Class<SCADefinitions> getModelType() {
- return SCADefinitions.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 38fe3c5225..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#definitions,model=org.apache.tuscany.sca.definitions.SCADefinitions
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 4392461df1..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;type=definitions.xml,model=org.apache.tuscany.sca.definitions.SCADefinitions
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties
deleted file mode 100644
index 857887ec3f..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/main/resources/definitions-xml-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionReadException = ContributionReadException occured due to :
-PrivilegedActionException = Privileged Action Exception occured due to FilePermission in security policy file: \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java b/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.java
deleted file mode 100644
index 187b7fa9f8..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/Policy.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.definitions;
-
-import javax.xml.namespace.QName;
-
-/**
- * Interface that will abstract various types of policy specifications
- * and attachments for example WS-Policy
- *
- * @version $Rev$ $Date$
- */
-public interface Policy {
- QName getSchemaName();
- void setUnresolved(boolean unresolved);
- boolean isUnresolved();
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java b/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
deleted file mode 100644
index ec4ead8b87..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/ReadDocumentTestCase.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.definitions;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
- */
-public class ReadDocumentTestCase extends TestCase {
-
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor = null;
- private SCADefinitions definitions;
- Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
- Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
- Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
- Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
- public static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
- public static final String namespace = "http://test";
-
- private static final QName secureWsPolicy = new QName(namespace, "SecureWSPolicy");
- private static final QName confidentiality = new QName(namespace, "confidentiality");
- private static final QName integrity = new QName(namespace, "integrity");
- private static final QName messageProtection = new QName(namespace, "messageProtection");
- private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
- private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
- private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
- private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
- private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
- private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
- private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
-
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
-
- // Create StAX processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
-
- URL url = getClass().getResource("test_definitions.xml");
- URI uri = URI.create("test_definitions.xml");
- definitions = policyDefinitionsProcessor.read(null, uri, url);
-
- for ( Intent intent : definitions.getPolicyIntents() ) {
- intentTable.put(intent.getName(), intent);
- }
-
- for ( PolicySet policySet : definitions.getPolicySets() ) {
- policySetTable.put(policySet.getName(), policySet);
- }
-
- for ( IntentAttachPointType bindingType : definitions.getBindingTypes() ) {
- bindingTypesTable.put(bindingType.getName(), bindingType);
- }
-
- for ( IntentAttachPointType implType : definitions.getImplementationTypes() ) {
- implTypesTable.put(implType.getName(), implType);
- }
- }
-
- public void testReadSCADefinitions() throws Exception {
- assertNotNull(definitions);
-
- assertNotNull(intentTable.get(confidentiality));
- assertNotNull(intentTable.get(messageProtection));
- assertNotNull(intentTable.get(confidentiality_transport));
- assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
-
- assertNotNull(policySetTable.get(secureReliablePolicy));
- assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
- assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
-
- assertNotNull(policySetTable.get(secureMessagingPolicies));
- assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
- //assertTrue(policySetTable.get(secureWsPolicy).getPolicies().get(0) instanceof org.apache.neethi.Policy);
-
- assertEquals(bindingTypesTable.size(), 1);
- assertNotNull(bindingTypesTable.get(wsBinding));
- assertEquals(implTypesTable.size(), 1);
- assertNotNull(implTypesTable.get(javaImpl));
- }
-
- public void testResolveSCADefinitions() throws Exception {
- assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
- ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
- assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
-
- QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
- QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
- assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
-
- PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
- PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
- PolicySet securityPolicySet = policySetTable.get(securityPolicy);
-
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
- assertTrue(secureMessagingPolicySet.isUnresolved());
- assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
-
- //testing to ensure that inclusion of referred policy sets has not happened
- PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
- assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
-
- IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
- assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
-
- IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
- assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
-
- ModelResolver resolver = new DefaultModelResolver();
- policyDefinitionsProcessor.resolve(definitions, resolver);
- //builder.build(scaDefinitions);
-
- //testing if policy intents have been linked have property been linked up
- assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
- assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
-
- //testing if policysets have been properly linked up with intents
- assertFalse(secureMessagingPolicySet.isUnresolved());
- assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
- assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
-
- //testing if intent maps have been properly mapped to policies
- assertFalse(securityPolicySet.isUnresolved());
- assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
- assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
-
- //testing for inclusion of referred policysets
- assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
- assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
-
- assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
-
- assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java b/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java
deleted file mode 100644
index b4d7a8c584..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/java/org/apache/tuscany/sca/definitions/TestPolicyProcessor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.definitions;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * A PolicyProcessor used for testing.
- *
- * @version $Rev$ $Date$
- */
-public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
-
- public QName getArtifactType() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
- return new MockPolicyImplOne();
- }
-
- public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<Policy> getModelType() {
- // TODO Auto-generated method stub
- return Policy.class;
- }
-
- public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-
- public class MockPolicyImplOne implements Policy {
- public QName getSchemaName() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml b/branches/sca-java-1.5.1/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
deleted file mode 100644
index f60047e769..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
+++ /dev/null
@@ -1,255 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://test"
- xmlns:test="http://test"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
-<!-- Extension Types Metadata -->
-<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
- mayProvide="test:tracing"/>
-<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
- mayProvide="test:integrity"/>
-
-<!-- Intents and Policysets to assume targetnamespace -->
-<intent name="TestIntentOne"
- constrains="sca:binding">
- <description>
- Test Intent
- </description>
- </intent>
-
- <intent name="TestIntentTwo"
- constrains="sca:binding"
- requires="test:TestIntentOne">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <policySet name="TestPolicySetOne"
- provides="test:TestIntentOne"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
-
- <!-- qualified intents -->
- <intent name="confidentiality.transport" />
- <intent name="confidentiality.message" />
- <intent name="confidentiality.message.whole" />
- <intent name="confidentiality.message.body" />
-
- <!-- POLICY SETS -->
- <policySet name="SecureReliablePolicy"
- provides="test:confidentiality.transport test:integrity"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
- <policySet name="SecureMessagingPolicies"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport" alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message" alternative" -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="SecurityPolicy"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
- <intentMap provides="test:confidentiality" default="message">
- <qualifier name="message">
- <intentMap provides="message" default="whole">
- <qualifier name="body">
- <wsp:PolicyAttachment>
- <!-- policy attachment for body encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="whole">
- <wsp:PolicyAttachment>
- <!-- policy attachment for whole message encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
- </qualifier>
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy attachment for transport encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="BasicAuthMsgProtSecurity"
- provides="test:authentication test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0">
- <policySetReference name="test:AuthenticationPolicies"/>
- <policySetReference name="test:ConfidentialityPolicies"/>
-</policySet>
-
-<policySet name="AuthenticationPolicies"
- provides="test:authentication"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "basic
- authentication" -->
- </wsp:PolicyAttachment>
-</policySet>
-
-<policySet name="ConfidentialityPolicies"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport"
- alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message"
- alternative" -->...
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="SecureWSPolicy"
- provides="test:confidentiality"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:Policy>
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SecurityToken>
- <sp:TokenType>sp:X509v3</sp:TokenType>
- </sp:SecurityToken>
- <sp:UsernameToken />
- <sp:SignedParts />
- <sp:EncryptedParts>
- <sp:Body />
- </sp:EncryptedParts>
- <sp:TransportBinding>
- <sp:IncludeTimeStamp />
- </sp:TransportBinding>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </policySet>
-
-<!-- profile intent -->
- <intent name="reliableMessageProtection"
- constrains="sca:binding"
- requires="test:messageProtection">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <intent name="messageProtection"
- constrains="sca:binding"
- requires="test:confidentiality test:integrity">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
-<!-- simple intent -->
- <intent name="confidentiality"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized users from reading the messages.
- </description>
- </intent>
-
- <intent name="integrity"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized modification of the messages.
- </description>
- </intent>
-
- <intent name="authentication"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding required
- Authentication.
- </description>
- </intent>
-
- <intent name="logging"
- constrains="sca:implementation">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-
- <intent name="tracing"
- constrains="sca:implementation.java">
- <description>
- Need to figure out some description for this
- </description>
- </intent>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/definitions/LICENSE b/branches/sca-java-1.5.1/modules/definitions/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/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-java-1.5.1/modules/definitions/NOTICE b/branches/sca-java-1.5.1/modules/definitions/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/definitions/pom.xml b/branches/sca-java-1.5.1/modules/definitions/pom.xml
deleted file mode 100644
index 8dfe0b6d94..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-definitions</artifactId>
- <name>Apache Tuscany SCA Definitions</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.definitions</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.definitions*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.java
deleted file mode 100644
index 2039b9ecc9..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitions.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.definitions;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-
-/**
- * Represents SCA Definitions.
- *
- * @version $Rev$ $Date$
- */
-public interface SCADefinitions {
- /**
- * Returns the target namespace for this SCA Definition
- * @return the target namespace
- */
- String getTargetNamespace();
-
- /**
- * Sets the target names for this SCA Definition.
- *
- * @param ns the target namespace for this SCA Definition
- */
- void setTargetNamespace(String ns);
-
- /**
- * Returns a list of domain wide Policy Intents
- *
- * @return a list of domain wide Policy Intents
- */
- List<Intent> getPolicyIntents();
-
- /**
- * Returns a list of domain wide PolicySets
- *
- * @return a list of domain wide PolicySets
- */
- List<PolicySet> getPolicySets();
-
- /**
- * Returns a list of domain wide Binding Types
- *
- * @return a list of domain wide Binding Types
- */
- List<IntentAttachPointType> getBindingTypes();
-
-
- /**
- * Returns a list of domain wide Implementation Types
- *
- * @return a list of domain wide Implementation Types
- */
- List<IntentAttachPointType> getImplementationTypes();
-
- /**
- * Returns a list of domain wide binding definition objects
- *
- * @return a list of domain wide binding definition objects
- */
- List<Object> getBindings();
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java
deleted file mode 100644
index a41d7a6717..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilder.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.definitions;
-
-
-/**
- * Interface to abstract building of SCA Definitions for a Domain
- *
- * @version $Rev$ $Date$
- */
-public interface SCADefinitionsBuilder {
- /**
- * Builds the SCA definitions
- *
- * @param scaDefns
- */
- void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException;
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.java
deleted file mode 100644
index 85b9ad7f7d..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderException.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.definitions;
-
-/**
- * Builder Exception
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsBuilderException extends Exception {
- private static final long serialVersionUID = 2513219325230252783L;
-
- public SCADefinitionsBuilderException() {
- }
-
- public SCADefinitionsBuilderException(String message) {
- super(message);
- }
-
- public SCADefinitionsBuilderException(Throwable cause) {
- super(cause);
- }
-
- public SCADefinitionsBuilderException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
deleted file mode 100644
index 8b9ff3e1a9..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/SCADefinitionsBuilderImpl.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.definitions;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Provides a concrete implementation for a SCADefinitionsBuilder
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsBuilderImpl implements SCADefinitionsBuilder {
-
- public void build(SCADefinitions scaDefns) throws SCADefinitionsBuilderException {
- Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
- for (Intent intent : scaDefns.getPolicyIntents()) {
- definedIntents.put(intent.getName(), intent);
- }
-
- Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
- for (PolicySet policySet : scaDefns.getPolicySets()) {
- definedPolicySets.put(policySet.getName(), policySet);
- }
-
- Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
- for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
- definedBindingTypes.put(bindingType.getName(), bindingType);
- }
-
- Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
- for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
- definedImplTypes.put(implType.getName(), implType);
- }
-
- //filling up the maps removes all duplicate entries... so fill this unique lists
- //into the scaDefns.
- scaDefns.getPolicyIntents().clear();
- scaDefns.getPolicySets().clear();
- scaDefns.getBindingTypes().clear();
- scaDefns.getImplementationTypes().clear();
-
- scaDefns.getPolicyIntents().addAll(definedIntents.values());
- scaDefns.getPolicySets().addAll(definedPolicySets.values());
- scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
- scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
-
- buildPolicyIntents(scaDefns, definedIntents);
- buildPolicySets(scaDefns, definedPolicySets, definedIntents);
- buildBindingTypes(scaDefns, definedBindingTypes, definedIntents);
- buildImplementationTypes(scaDefns, definedImplTypes, definedIntents);
- }
-
- private void buildBindingTypes(SCADefinitions scaDefns,
- Map<QName, IntentAttachPointType> definedBindingTypes,
- Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
- for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
- buildAlwaysProvidedIntents(bindingType, definedIntents);
- buildMayProvideIntents(bindingType, definedIntents);
- }
-
- }
-
- private void buildImplementationTypes(SCADefinitions scaDefns,
- Map<QName, IntentAttachPointType> definedImplTypes,
- Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
- for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
- buildAlwaysProvidedIntents(implType, definedIntents);
- buildMayProvideIntents(implType, definedIntents);
- }
- }
-
-
- private void buildPolicyIntents(SCADefinitions scaDefns, Map<QName, Intent> definedIntents)
- throws SCADefinitionsBuilderException {
- for (Intent policyIntent : scaDefns.getPolicyIntents()) {
- if (policyIntent instanceof ProfileIntent) {
- buildProfileIntent((ProfileIntent)policyIntent, definedIntents);
- }
-
- if (policyIntent instanceof QualifiedIntent) {
- buildQualifiedIntent((QualifiedIntent)policyIntent, definedIntents);
- }
- }
- }
-
- private void buildPolicySets(SCADefinitions scaDefns,
- Map<QName, PolicySet> definedPolicySets,
- Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
-
- for (PolicySet policySet : scaDefns.getPolicySets()) {
- buildProvidedIntents(policySet, definedIntents);
- buildIntentsInMappedPolicies(policySet, definedIntents);
- buildReferredPolicySets(policySet, definedPolicySets);
- }
-
- for (PolicySet policySet : scaDefns.getPolicySets()) {
- for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
- includeReferredPolicySets(policySet, referredPolicySet);
- }
- }
- }
-
- private void buildProfileIntent(ProfileIntent policyIntent, Map<QName, Intent> definedIntents)
- throws SCADefinitionsBuilderException {
- //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
- if (policyIntent != null) {
- //resolve all required intents
- List<Intent> requiredIntents = new ArrayList<Intent>();
- for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
- if (requiredIntent.isUnresolved()) {
- Intent resolvedRequiredIntent = definedIntents.get(requiredIntent.getName());
- if (resolvedRequiredIntent != null) {
- requiredIntents.add(resolvedRequiredIntent);
- } else {
- throw new SCADefinitionsBuilderException("Required Intent - " + requiredIntent
- + " not found for ProfileIntent "
- + policyIntent);
-
- }
- } else {
- requiredIntents.add(requiredIntent);
- }
- }
- policyIntent.getRequiredIntents().clear();
- policyIntent.getRequiredIntents().addAll(requiredIntents);
- }
- }
-
- private void buildQualifiedIntent(QualifiedIntent policyIntent, Map<QName, Intent> definedIntents)
- throws SCADefinitionsBuilderException {
- if (policyIntent != null) {
- //resolve the qualifiable intent
- Intent qualifiableIntent = policyIntent.getQualifiableIntent();
- if (qualifiableIntent.isUnresolved()) {
- Intent resolvedQualifiableIntent = definedIntents.get(qualifiableIntent.getName());
-
- if (resolvedQualifiableIntent != null) {
- policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
- } else {
- throw new SCADefinitionsBuilderException("Qualifiable Intent - " + qualifiableIntent
- + " not found for QualifiedIntent "
- + policyIntent);
- }
-
- }
- }
- }
-
-
- private void buildAlwaysProvidedIntents(IntentAttachPointType extensionType,
- Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
- if (extensionType != null) {
- // resolve all provided intents
- List<Intent> alwaysProvided = new ArrayList<Intent>();
- for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
- if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
- if (resolvedProvidedIntent != null) {
- alwaysProvided.add(resolvedProvidedIntent);
- } else {
- throw new SCADefinitionsBuilderException(
- "Always Provided Intent - " + providedIntent
- + " not found for ExtensionType "
- + extensionType);
-
- }
- } else {
- alwaysProvided.add(providedIntent);
- }
- }
- extensionType.getAlwaysProvidedIntents().clear();
- extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
- }
- }
-
- private void buildMayProvideIntents(IntentAttachPointType extensionType,
- Map<QName, Intent> definedIntents) throws SCADefinitionsBuilderException {
- if (extensionType != null) {
- // resolve all provided intents
- List<Intent> mayProvide = new ArrayList<Intent>();
- for (Intent providedIntent : extensionType.getMayProvideIntents()) {
- if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
- if (resolvedProvidedIntent != null) {
- mayProvide.add(resolvedProvidedIntent);
- } else {
- throw new SCADefinitionsBuilderException(
- "May Provide Intent - " + providedIntent
- + " not found for ExtensionType "
- + extensionType);
-
- }
- } else {
- mayProvide.add(providedIntent);
- }
- }
- extensionType.getMayProvideIntents().clear();
- extensionType.getMayProvideIntents().addAll(mayProvide);
- }
- }
-
- private void buildProvidedIntents(PolicySet policySet, Map<QName, Intent> definedIntents)
- throws SCADefinitionsBuilderException {
- if (policySet != null) {
- //resolve all provided intents
- List<Intent> providedIntents = new ArrayList<Intent>();
- for (Intent providedIntent : policySet.getProvidedIntents()) {
- if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = definedIntents.get(providedIntent.getName());
- if (resolvedProvidedIntent != null) {
- providedIntents.add(resolvedProvidedIntent);
- } else {
- throw new SCADefinitionsBuilderException("Provided Intent - " + providedIntent
- + " not found for PolicySet "
- + policySet);
-
- }
- } else {
- providedIntents.add(providedIntent);
- }
- }
- policySet.getProvidedIntents().clear();
- policySet.getProvidedIntents().addAll(providedIntents);
- }
- }
-
- private void buildIntentsInMappedPolicies(PolicySet policySet, Map<QName, Intent> definedIntents)
- throws SCADefinitionsBuilderException {
- Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
- for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
- Intent mappedIntent = entry.getKey();
- if (mappedIntent.isUnresolved()) {
- Intent resolvedMappedIntent = definedIntents.get(mappedIntent.getName());
-
- if (resolvedMappedIntent != null) {
- mappedPolicies.put(resolvedMappedIntent, entry.getValue());
- } else {
- throw new SCADefinitionsBuilderException("Mapped Intent - " + mappedIntent
- + " not found for PolicySet "
- + policySet);
-
- }
- } else {
- mappedPolicies.put(mappedIntent, entry.getValue());
- }
- }
-
- policySet.getMappedPolicies().clear();
- policySet.getMappedPolicies().putAll(mappedPolicies);
- }
-
- private void buildReferredPolicySets(PolicySet policySet, Map<QName, PolicySet> definedPolicySets)
- throws SCADefinitionsBuilderException {
-
- List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
- for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
- if (referredPolicySet.isUnresolved()) {
- PolicySet resolvedReferredPolicySet = definedPolicySets.get(referredPolicySet.getName());
- if (resolvedReferredPolicySet != null) {
- referredPolicySets.add(resolvedReferredPolicySet);
- } else {
- throw new SCADefinitionsBuilderException("Referred PolicySet - " + referredPolicySet
- + "not found for PolicySet - "
- + policySet);
- }
- } else {
- referredPolicySets.add(referredPolicySet);
- }
- }
- policySet.getReferencedPolicySets().clear();
- policySet.getReferencedPolicySets().addAll(referredPolicySets);
- }
-
- private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
- for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
- includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
- }
- policySet.getPolicies().addAll(referredPolicySet.getPolicies());
- policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.java
deleted file mode 100644
index a5178497a0..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/impl/SCADefinitionsImpl.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.definitions.impl;
-
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Provides a concrete implementation for SCADefinitions
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsImpl implements SCADefinitions {
- private String targetNamespace = null;
- private List<Intent> policyIntents = new CopyOnWriteArrayList<Intent>();
- private List<PolicySet> policySets = new CopyOnWriteArrayList<PolicySet>();
- private List<IntentAttachPointType> bindingTypes = new CopyOnWriteArrayList<IntentAttachPointType>();
- private List<IntentAttachPointType> implementationTypes = new CopyOnWriteArrayList<IntentAttachPointType>();
- private List<Object> bindings = new CopyOnWriteArrayList<Object>();
-
-
- public List<IntentAttachPointType> getBindingTypes() {
- return bindingTypes;
- }
-
- public List<IntentAttachPointType> getImplementationTypes() {
- return implementationTypes;
- }
-
- public List<Intent> getPolicyIntents() {
- return policyIntents;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String ns) {
- this.targetNamespace = ns;
- }
-
- public List<Object> getBindings() {
- return bindings;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java b/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java
deleted file mode 100644
index 8de6f63c05..0000000000
--- a/branches/sca-java-1.5.1/modules/definitions/src/main/java/org/apache/tuscany/sca/definitions/util/SCADefinitionsUtil.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.definitions.util;
-
-import java.net.URI;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Some utility functions to deal with SCADefinitions
- *
- * @version $Rev$ $Date$
- */
-public class SCADefinitionsUtil {
-
- public static void stripDuplicates(SCADefinitions scaDefns) {
- Map<QName, Intent> definedIntents = new HashMap<QName, Intent>();
- for (Intent intent : scaDefns.getPolicyIntents()) {
- definedIntents.put(intent.getName(), intent);
- }
-
- Map<QName, PolicySet> definedPolicySets = new HashMap<QName, PolicySet>();
- for (PolicySet policySet : scaDefns.getPolicySets()) {
- definedPolicySets.put(policySet.getName(), policySet);
- }
-
- Map<QName, IntentAttachPointType> definedBindingTypes = new HashMap<QName, IntentAttachPointType>();
- for (IntentAttachPointType bindingType : scaDefns.getBindingTypes()) {
- definedBindingTypes.put(bindingType.getName(), bindingType);
- }
-
- Map<QName, IntentAttachPointType> definedImplTypes = new HashMap<QName, IntentAttachPointType>();
- for (IntentAttachPointType implType : scaDefns.getImplementationTypes()) {
- definedImplTypes.put(implType.getName(), implType);
- }
-
- scaDefns.getPolicyIntents().clear();
- scaDefns.getPolicyIntents().addAll(definedIntents.values());
- scaDefns.getPolicySets().clear();
- scaDefns.getPolicySets().addAll(definedPolicySets.values());
- scaDefns.getBindingTypes().clear();
- scaDefns.getBindingTypes().addAll(definedBindingTypes.values());
- scaDefns.getImplementationTypes().clear();
- scaDefns.getImplementationTypes().addAll(definedImplTypes.values());
- }
-
- public static void aggregateSCADefinitions(SCADefinitions source, SCADefinitions target) {
- target.getPolicyIntents().addAll(source.getPolicyIntents());
- target.getPolicySets().addAll(source.getPolicySets());
- target.getBindingTypes().addAll(source.getBindingTypes());
- target.getImplementationTypes().addAll(source.getImplementationTypes());
- target.getBindings().addAll(source.getBindings());
- }
-
- public static boolean isSCADefnsFile(URI uri) {
- int index = uri.toString().lastIndexOf("/");
-
- index = (index != -1) ? index + 1 : 0;
-
- return uri.toString().substring(index).equals("definitions.xml");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/LICENSE b/branches/sca-java-1.5.1/modules/domain-manager/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/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-java-1.5.1/modules/domain-manager/NOTICE b/branches/sca-java-1.5.1/modules/domain-manager/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/pom.xml b/branches/sca-java-1.5.1/modules/domain-manager/pom.xml
deleted file mode 100644
index 42e8263a47..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/pom.xml
+++ /dev/null
@@ -1,215 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-domain-manager</artifactId>
- <name>Apache Tuscany SCA Domain Manager Application</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>commons-fileupload</groupId>
- <artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
- </dependency>
-
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-manager</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-resource</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-widget-runtime-tuscany</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom-abdera</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom-js</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-monitor</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.domain.manager</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.domain.manager*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationCollectionImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationCollectionImpl.java
deleted file mode 100644
index 0e25068f5f..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationCollectionImpl.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeTitle;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a component that returns composite configuration collections.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
-public class CompositeConfigurationCollectionImpl implements ItemCollection, LocalItemCollection {
-
- private static final Logger logger = Logger.getLogger(CompositeConfigurationCollectionImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public LocalItemCollection cloudCollection;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() {
- }
-
- public Entry<String, Item>[] getAll() {
- throw new UnsupportedOperationException();
- }
-
- public Item get(String key) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public String post(String key, Item item) {
- throw new UnsupportedOperationException();
- }
-
- public void put(String key, Item item) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void delete(String key) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public Entry<String, Item>[] query(String queryString) {
- logger.fine("query " + queryString);
-
- if (queryString.startsWith("composite=")) {
-
- // Expecting a key in the form:
- // composite:contributionURI;namespace;localName
- int e = queryString.indexOf('=');
- String key = queryString.substring(e + 1);
- String contributionURI = contributionURI(key);
- QName qname = compositeQName(key);
-
- // Return a collection containing the following entries:
- // the resolved version of the specified composite
- // the required contributions
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
-
- // Add the resolved composite entry
- Entry<String, Item> compositeEntry = new Entry<String, Item>();
- Item compositeItem = new Item();
- compositeItem.setTitle(compositeTitle(contributionURI, qname));
- compositeItem.setLink("/composite-resolved/" + key);
- compositeEntry.setKey(key);
- compositeEntry.setData(compositeItem);
- entries.add(compositeEntry);
-
- // Get the collection of required contributions
- Entry<String, Item>[] contributionEntries = contributionCollection.query("alldependencies=" + contributionURI);
- for (Entry<String, Item> entry: contributionEntries) {
- Item item = entry.getData();
- item.setContents(null);
- entries.add(entry);
- }
-
- return entries.toArray(new Entry[entries.size()]);
-
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
deleted file mode 100644
index 4178a2e8a0..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeConfigurationServiceImpl.java
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.locationURL;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.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.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeIncludeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.implementation.node.builder.impl.NodeCompositeBuilderImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.MonitorRuntimeException;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
-import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
-import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a service that returns a fully configured composite.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(Servlet.class)
-public class CompositeConfigurationServiceImpl extends HttpServlet implements Servlet {
- private static final long serialVersionUID = -8809641932774129152L;
-
- private static final Logger logger = Logger.getLogger(CompositeConfigurationServiceImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public LocalItemCollection domainCompositeCollection;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- @Reference
- public LocalItemCollection cloudCollection;
-
- private ExtensionPointRegistry extensionPoints;
- private ModelFactoryExtensionPoint modelFactories;
- private ModelResolverExtensionPoint modelResolvers;
- private AssemblyFactory assemblyFactory;
- private WorkspaceFactory workspaceFactory;
- private URLArtifactProcessor<Contribution> contributionProcessor;
- private StAXArtifactProcessorExtensionPoint staxProcessors;
- private StAXArtifactProcessor<Composite> compositeProcessor;
- private XMLOutputFactory outputFactory;
- private ContributionDependencyBuilder contributionDependencyBuilder;
- private CompositeBuilder compositeIncludeBuilder;
- private CompositeBuilder nodeConfigurationBuilder;
- private Monitor monitor;
- private List<SCADefinitions> policyDefinitions;
- private ModelResolver policyDefinitionsResolver;
- private SCABindingFactory scaBindingFactory;
- private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private DocumentBuilderFactory documentBuilderFactory;
- private TransformerFactory transformerFactory;
- private InterfaceContractMapper contractMapper;
- private Map<Binding, Binding> bindingMap;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- extensionPoints = domainManagerConfiguration.getExtensionPoints();
-
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
- // Get model factories
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
- workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
-
- // Get and initialize artifact processors
- staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(Composite.class);
- StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<Object> urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors, monitor);
- policyDefinitionsResolver = new DefaultModelResolver();
- policyDefinitions = new ArrayList<SCADefinitions>();
-
- // The following was copied from RuntimeBuilder to fix TUSCANY-3171
- XMLInputFactory validatingInputFactory = modelFactories.getFactory(ValidatingXMLInputFactory.class);
- documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
- //documentBuilderFactory.setNamespaceAware(true);
- urlProcessors.getProcessor(Composite.class);
- urlProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
- documentBuilderFactory, policyDefinitions, monitor));
-
- // Create contribution processor
- modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- contributionProcessor = new ContributionContentProcessor(extensionPoints, monitor, policyDefinitionsResolver, policyDefinitions);
-
- // Create contribution and composite builders
- transformerFactory = modelFactories.getFactory(TransformerFactory.class);
- contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
- scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- contractMapper = utilities.getUtility(InterfaceContractMapper.class);
- compositeIncludeBuilder = new CompositeIncludeBuilderImpl(monitor);
- bindingMap = new HashMap<Binding, Binding>();
- nodeConfigurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory,
- transformerFactory, contractMapper, null, monitor, bindingMap);
-
- // Load the definitions.xml
- loadSCADefinitions(extensionPoints);
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- String key;
- if (path.startsWith("/")) {
- if (path.length() > 1) {
- key = path.substring(1);
- } else {
- key ="";
- }
- } else {
- key =path;
- }
- logger.fine("get " + key);
-
- // Expect a key in the form composite:contributionURI;namespace;localName or
- // a path in the form componentName/componentName/...
- // and return the corresponding resolved composite
- String requestedContributionURI = null;
- QName requestedCompositeName = null;
- String[] requestedComponentPath = null;
- if (key.startsWith("composite:")) {
-
- // Extract the composite qname from the key
- requestedContributionURI = contributionURI(key);
- requestedCompositeName = compositeQName(key);
-
- } else if (key.length() != 0) {
-
- // Extract the path to the requested component from the key
- requestedComponentPath = key.split("/");
- }
-
- // Somewhere to store the composite we expect to write out at the end
- Composite requestedComposite = null;
-
- // Create a domain composite model
- Composite domainComposite = assemblyFactory.createComposite();
- domainComposite.setName(new QName(Constants.SCA10_TUSCANY_NS, "domain"));
-
- // Get the domain composite items
- Entry<String, Item>[] domainEntries = domainCompositeCollection.getAll();
-
- // Populate the domain composite
- Workspace workspace = workspaceFactory.createWorkspace();
- workspace.setModelResolver(new ExtensibleModelResolver(workspace, extensionPoints));
-
- Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
- for (Entry<String, Item> domainEntry: domainEntries) {
-
- // Load the required contributions
- String contributionURI = contributionURI(domainEntry.getKey());
- Contribution contribution = contributionMap.get(contributionURI);
- if (contribution == null) {
-
- // The contribution has not been loaded yet, load it with all its dependencies
- Entry<String, Item>[] entries = contributionCollection.query("alldependencies=" + contributionURI);
- for (Entry<String, Item> entry: entries) {
- Item dependencyItem = entry.getData();
- String dependencyURI = entry.getKey();
-
- if (!contributionMap.containsKey(dependencyURI)) {
-
- // Read the contribution
- Contribution dependency;
- try {
- String dependencyLocation = dependencyItem.getAlternate();
- dependency = contribution(workspace, dependencyURI, dependencyLocation);
- } catch (Exception e) {
- if (contributionURI.equals(dependencyURI)) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getDescription(e));
- return;
- } else {
- continue;
- }
- }
- workspace.getContributions().add(dependency);
- contributionMap.put(dependencyURI, dependency);
-
- if (contributionURI.equals(entry.getKey())) {
- contribution = dependency;
- }
- }
- }
- }
-
- if (contribution == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, contributionURI);
- return;
- }
-
- // Find the specified deployable composite in the contribution
- Composite deployable = null;
- QName qn = compositeQName(domainEntry.getKey());
- for (Composite d: contribution.getDeployables()) {
- if (qn.equals(d.getName())) {
- deployable = d;
- break;
- }
- }
- if (deployable == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, qn.toString());
- return;
- }
-
- // add the deployable composite to the domain composite
- domainComposite.getIncludes().add(deployable);
-
- // Fuse includes into the deployable composite
- try {
- compositeIncludeBuilder.build(deployable);
- analyzeProblems();
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getDescription(e));
- return;
- }
-
- // Store away the requested composite
- if (requestedCompositeName != null) {
- if (requestedContributionURI.equals(contributionURI) && requestedCompositeName.equals(deployable.getName())){
- requestedComposite = deployable;
- }
- }
- }
-
- // The requested composite was not found
- if (requestedCompositeName != null && requestedComposite == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Get the clouds composite
- Composite cloudsComposite;
- try {
- cloudsComposite = cloud();
- } catch (NotFoundException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, e.getMessage());
- return;
- }
-
- // configure the endpoints for each composite in the domain
- List<Composite> domainIncludes = domainComposite.getIncludes();
- for (int i = 0, n =domainIncludes.size(); i < n; i++) {
- Composite composite = domainIncludes.get(i);
- QName compositeName = composite.getName();
- String contributionURI = contributionURI(domainEntries[i].getKey());
-
- // find the node that will run this composite and the default
- // bindings that it configures
- Component nodeComponent = null;
- QName nodeCompositeName = null;
- for (Composite cloudComposite : cloudsComposite.getIncludes()) {
- for (Component nc : cloudComposite.getComponents()) {
- NodeImplementation nodeImplementation = (NodeImplementation)nc.getImplementation();
- if (nodeImplementation.getComposite().getName().equals(compositeName) &&
- nodeImplementation.getComposite().getURI().equals(contributionURI)) {
- nodeImplementation.setComposite(composite);
- nodeComponent = nc;
- nodeCompositeName = cloudComposite.getName();
- break;
- }
- }
- }
-
- if (nodeComponent != null) {
- try {
- Composite nodeComposite = assemblyFactory.createComposite();
- nodeComposite.setName(nodeCompositeName);
- nodeComposite.getComponents().add(nodeComponent);
- nodeConfigurationBuilder.build(nodeComposite);
- } catch (CompositeBuilderException e) {
- throw new ServletException(e);
- }
- }
- }
-
- // Build the domain composite
- SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
- for (SCADefinitions definition : policyDefinitions) {
- SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
- }
- CompositeBuilder compositeBuilder = new CompositeBuilderImpl(assemblyFactory, null, scaBindingFactory,
- intentAttachPointTypeFactory, documentBuilderFactory, transformerFactory,
- contractMapper, aggregatedDefinitions, monitor, bindingMap);
- try {
- compositeBuilder.build(domainComposite);
- analyzeProblems();
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, getDescription(e));
- return;
- }
-
- // Return the requested composite
- if (requestedComposite != null) {
-
- // Rebuild the requested composite from the domain composite
- // we have to reverse the flattening that went on when the domain
- // composite was built
- List<Component> tempComponentList = new ArrayList<Component>();
- tempComponentList.addAll(requestedComposite.getComponents());
- requestedComposite.getComponents().clear();
- for (Component inputComponent : tempComponentList){
- for (Component deployComponent : domainComposite.getComponents()){
- if (deployComponent.getName().equals(inputComponent.getName())){
- requestedComposite.getComponents().add(deployComponent);
- }
- }
- }
-
- } else if (requestedComponentPath != null) {
-
- // If a component path was specified, walk the path to get to the requested
- // component and the composite that implements it
- Composite nestedComposite = domainComposite;
- for (String componentName: requestedComponentPath) {
- Component component = null;
- for (Component c: nestedComposite.getComponents()) {
- if (componentName.equals(c.getName())) {
- component = c;
- break;
- }
- }
- if (component == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- } else {
- if (component.getImplementation() instanceof Composite) {
- nestedComposite = (Composite)component.getImplementation();
- } else {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
- }
- }
-
- // Return the nested composite
- requestedComposite = nestedComposite;
-
- } else {
-
-
- // Return the whole domain composite
- requestedComposite = domainComposite;
- }
-
- // Write the composite in the requested format
- StAXArtifactProcessor<Composite> processor;
- String queryString = request.getQueryString();
- if (queryString != null && queryString.startsWith("format=")) {
- String format = queryString.substring(7);
- int s = format.indexOf(';');
- QName formatName = new QName(format.substring(0, s), format.substring(s +1));
- processor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(formatName);
- if (processor == null) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, new IllegalArgumentException(queryString).toString());
- return;
- }
- } else {
- processor = compositeProcessor;
- }
- try {
- response.setContentType("text/xml");
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(response.getOutputStream());
- processor.write(requestedComposite, writer);
- } catch (Exception e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- return;
- }
-
-
- }
-
- /**
- * Returns the cloud composite.
- *
- * @return the cloud composite
- */
- private Composite cloud() throws NotFoundException {
-
- // Create a new composite for the clouds
- Composite cloudComposite = assemblyFactory.createComposite();
- cloudComposite.setName(new QName(Constants.SCA10_TUSCANY_NS, "cloud"));
-
- // Get the collection of cloud composites
- Entry<String, Item>[] cloudEntries = cloudCollection.getAll();
-
- // Load the cloud contributions
- Workspace workspace = workspaceFactory.createWorkspace();
- Map<String, Contribution> contributionMap = new HashMap<String, Contribution>();
- for (Entry<String, Item> cloudEntry: cloudEntries) {
- String key = cloudEntry.getKey();
- String contributionURI = contributionURI(key);
-
- // Load the contribution
- Contribution contribution = contributionMap.get(contributionURI);
- if (contribution == null) {
- Item contributionItem = contributionCollection.get(contributionURI);
-
- // Read the contribution
- try {
- contribution = contribution(workspace, contributionURI, contributionItem.getAlternate());
- } catch (ContributionReadException e) {
- continue;
- }
- workspace.getContributions().add(contribution);
- contributionMap.put(contributionURI, contribution);
-
- }
-
- // Include the cloud composite in the clouds composite
- QName qname = compositeQName(key);
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof Composite) {
- Composite composite = (Composite)artifact.getModel();
- if (composite.getName().equals(qname)) {
- cloudComposite.getIncludes().add(composite);
- }
- }
- }
- }
-
- return cloudComposite;
- }
-
- /**
- * Returns the contribution with the given URI.
- *
- * @param workspace
- * @param contributionURI
- * @param contributionLocation
- * @return
- * @throws NotFoundException
- */
- private Contribution contribution(Workspace workspace, String contributionURI, String contributionLocation) throws ContributionReadException {
- try {
- URI uri = URI.create(contributionURI);
- URL location = locationURL(contributionLocation);
-
- Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
- try {
- analyzeProblems();
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ContributionReadException(e);
- }
-
- // Resolve the contribution dependencies
- contributionDependencyBuilder.buildContributionDependencies(contribution, workspace);
-
- contributionProcessor.resolve(contribution, workspace.getModelResolver());
- try {
- analyzeProblems();
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ContributionReadException(e);
- }
- return contribution;
-
- } catch (ContributionReadException e) {
- throw e;
- } catch (ContributionResolveException e) {
- throw new ContributionReadException(e);
- } catch (MalformedURLException e) {
- throw new ContributionReadException(e);
- }
- }
-
- private void analyzeProblems() throws Exception {
-
- for (Problem problem : monitor.getProblems()) {
- if ((problem.getSeverity() == Severity.ERROR) && (!problem.getMessageId().equals("SchemaError"))) {
- if (problem.getCause() != null) {
- throw new ServiceRuntimeException(new MonitorRuntimeException(problem.getCause()));
- } else {
- throw new ServiceRuntimeException(new MonitorRuntimeException(problem.toString()));
- }
- }
- }
- }
-
- private String getDescription(Exception e) {
- if (e instanceof ServiceRuntimeException && e.getCause() instanceof MonitorRuntimeException) {
- Throwable ce = e.getCause();
- return ce.getCause() != null ? ce.getCause().toString() : ce.getMessage();
- } else {
- return e.toString();
- }
- }
-
-
- /**
- * The following code was copied from RuntimeBootStrapper to fix TUSCANY-3171
- *
- * @param registry
- */
- private void loadSCADefinitions(ExtensionPointRegistry registry) throws ParserConfigurationException {
- try {
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<SCADefinitions> definitionsProcessor =
- documentProcessors.getProcessor(SCADefinitions.class);
- SCADefinitionsProviderExtensionPoint scaDefnProviders =
- registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
-
- SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
- SCADefinitions aSCADefn = null;
- for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
- aSCADefn = aProvider.getSCADefinition();
- SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
- }
-
- policyDefinitions.add(systemSCADefinitions);
-
- //we cannot expect that providers will add the intents and policysets into the resolver
- //so we do this here explicitly
- for (Intent intent : systemSCADefinitions.getPolicyIntents()) {
- policyDefinitionsResolver.addModel(intent);
- }
-
- for (PolicySet policySet : systemSCADefinitions.getPolicySets()) {
- policyDefinitionsResolver.addModel(policySet);
- }
-
- for (IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes()) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- for (IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes()) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- //now that all system sca definitions have been read, lets resolve them right away
- definitionsProcessor.resolve(systemSCADefinitions, policyDefinitionsResolver);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeGeneratorServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeGeneratorServiceImpl.java
deleted file mode 100644
index c476d82e72..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/CompositeGeneratorServiceImpl.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.lastModified;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.locationURL;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLDecoder;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.domain.manager.impl.CompositeGeneratorServiceImpl.Cache.ContributionCache;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a service that generates a composite from a composite model.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={Servlet.class})
-public class CompositeGeneratorServiceImpl extends HttpServlet implements Servlet {
- private static final long serialVersionUID = -6531448326726908269L;
-
- private static final Logger logger = Logger.getLogger(CompositeGeneratorServiceImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private ModelFactoryExtensionPoint modelFactories;
- private ModelResolverExtensionPoint modelResolvers;
- private URLArtifactProcessor<Contribution> contributionProcessor;
- private StAXArtifactProcessor<Composite> compositeProcessor;
- private XMLOutputFactory outputFactory;
-
- /**
- * Cache contribution models.
- */
- static class Cache {
- static class ContributionCache {
- private Contribution contribution;
- private long contributionLastModified;
- }
- private Map<URL, ContributionCache> contributions = new HashMap<URL, ContributionCache>();
- }
-
- private Cache cache = new Cache();
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
-
- // Create a monitor
- UtilityExtensionPoint services = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = services.getUtility(MonitorFactory.class);
- Monitor monitor = monitorFactory.createMonitor();
-
- // Get model factories
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-
- // Get and initialize artifact processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = (StAXArtifactProcessor<Composite>)staxProcessors.getProcessor(Composite.class);
- StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<Object> urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors, monitor);
-
- // Create contribution processor
- modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- contributionProcessor = new ContributionContentProcessor(extensionPoints, monitor);
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Expect a key in the form
- // composite:contributionURI;namespace;localName
- // and return the corresponding source file
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- String key = path.startsWith("/")? path.substring(1) : path;
- logger.fine("get " + key);
-
- // Get the specified contribution info
- String contributionURI = contributionURI(key);
- Item contributionItem;
- try {
- contributionItem = contributionCollection.get(contributionURI);
- } catch (NotFoundException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Read the contribution
- Contribution contribution;
- try {
- contribution = contribution(contributionURI, contributionItem.getAlternate());
- } catch (ContributionReadException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Find the specified deployable composite
- QName qname = compositeQName(key);
- Composite composite = null;
- for (Composite deployable: contribution.getDeployables()) {
- if (qname.equals(deployable.getName())) {
- if (!deployable.isUnresolved()) {
- composite = deployable;
- }
- break;
- }
- }
- if (composite == null) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Write the composite
- response.setContentType("text/xml");
- ServletOutputStream os = response.getOutputStream();
- try {
- compositeProcessor.write(composite, outputFactory.createXMLStreamWriter(os));
- } catch (ContributionWriteException e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- return;
- } catch (XMLStreamException e) {
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- return;
- }
- os.flush();
- }
-
- /**
- * Returns the contribution with the given URI.
- *
- * @param contributionURI
- * @param contributionLocation
- * @return
- * @throws NotFoundException
- */
- private Contribution contribution(String contributionURI, String contributionLocation) throws ContributionReadException {
- try {
- URI uri = URI.create(contributionURI);
- URL location = locationURL(contributionLocation);
-
- // Get contribution from cache
- ContributionCache contributionCache = cache.contributions.get(location);
- long lastModified = lastModified(location);
- if (contributionCache != null) {
- if (contributionCache.contributionLastModified == lastModified) {
- return contributionCache.contribution;
- }
-
- // Reset contribution cache
- cache.contributions.remove(location);
- }
-
- Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
-
- contributionProcessor.resolve(contribution, new DefaultModelResolver());
-
- // Cache contribution
- contributionCache = new ContributionCache();
- contributionCache.contribution = contribution;
- contributionCache.contributionLastModified = lastModified;
- cache.contributions.put(location, contributionCache);
-
- return contribution;
-
- } catch (ContributionReadException e) {
- throw e;
- } catch (MalformedURLException e) {
- throw new ContributionReadException(e);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } catch (ContributionResolveException e) {
- throw new ContributionReadException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
deleted file mode 100644
index 5deccc893e..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionCollectionImpl.java
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.DEPLOYMENT_CONTRIBUTION_URI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeSimpleTitle;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeSourceLink;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.lastModified;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.locationURL;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.domain.manager.impl.ContributionCollectionImpl.Cache.ContributionCache;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
-import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-import org.w3c.dom.Document;
-
-/**
- * Implementation of a contribution collection service component.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
-public class ContributionCollectionImpl implements ItemCollection, LocalItemCollection {
-
- private static final Logger logger = Logger.getLogger(ContributionCollectionImpl.class.getName());
-
- @Property
- public String workspaceFile;
-
- @Property
- public String deploymentContributionDirectory;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private Monitor monitor;
- private ContributionFactory contributionFactory;
- private WorkspaceFactory workspaceFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private URLArtifactProcessor<Contribution> contributionProcessor;
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private DocumentBuilder documentBuilder;
-
- /**
- * Cache workspace and contribution models.
- */
- static class Cache {
- private Workspace workspace;
- private long workspaceLastModified;
-
- static class ContributionCache {
- private Contribution contribution;
- private long contributionLastModified;
- }
- private Map<URL, ContributionCache> contributions = new HashMap<URL, ContributionCache>();
- }
-
- private Cache cache = new Cache();
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
-
- // Create a validation monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
- // Create model factories
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
- contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
-
- // Create artifact processors
- inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-
- // Create contribution info processor
- contributionProcessor = urlProcessors.getProcessor(".contribution/info");
-
- // Create a document builder (used to pretty print XML)
- documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- // Return all the contributions
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- Workspace workspace = readContributions(readWorkspace());
-
- for (Contribution contribution: workspace.getContributions()) {
- if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) {
- continue;
- }
- entries.add(entry(workspace, contribution));
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
-
- // Returns the contribution with the given URI key
- Workspace workspace = readContributions(readWorkspace());
- for (Contribution contribution: workspace.getContributions()) {
- if (key.equals(contribution.getURI())) {
- return item(workspace, contribution);
- }
- }
- throw new NotFoundException(key);
- }
-
- public String post(String key, Item item) {
- logger.fine("post " + key);
-
- // Adds a new contribution to the workspace
- Workspace workspace = readWorkspace();
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(key);
- try {
- contribution.setLocation(locationURL(item.getLink()).toString());
- } catch (MalformedURLException e) {
- throw new ServiceRuntimeException(e);
- }
- workspace.getContributions().add(contribution);
-
- // Write the workspace
- writeWorkspace(workspace);
-
- return key;
- }
-
- public void put(String key, Item item) throws NotFoundException {
-
- // Update a contribution already in the workspace
- Workspace workspace = readWorkspace();
- Contribution newContribution = contributionFactory.createContribution();
- newContribution.setURI(key);
- try {
- newContribution.setLocation(locationURL(item.getLink()).toString());
- } catch (MalformedURLException e) {
- throw new ServiceRuntimeException(e);
- }
- List<Contribution> contributions = workspace.getContributions();
- for (int i = 0, n = contributions.size(); i < n; i++) {
- if (contributions.get(i).getURI().equals(key)) {
- contributions.set(i, newContribution);
-
- // Write the workspace
- writeWorkspace(workspace);
- return;
- }
- }
- throw new NotFoundException(key);
- }
-
- public void delete(String key) throws NotFoundException {
- logger.fine("delete " + key);
-
- // Delete a contribution from the workspace
- Workspace workspace = readWorkspace();
- List<Contribution> contributions = workspace.getContributions();
- for (int i = 0, n = contributions.size(); i < n; i++) {
- if (contributions.get(i).getURI().equals(key)) {
- contributions.remove(i);
-
- // Write the workspace
- writeWorkspace(workspace);
- return;
- }
- }
- throw new NotFoundException(key);
- }
-
- public Entry<String, Item>[] query(String queryString) {
- logger.fine("query " + queryString);
-
- if (queryString.startsWith("dependencies=") || queryString.startsWith("alldependencies=")) {
-
- // Return the collection of dependencies of the specified contribution
- List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
-
- // Extract the contribution URI
- int eq = queryString.indexOf('=');
- String key = queryString.substring(eq+1);
-
- // Read the metadata for all the contributions
- Workspace workspace = readContributions(readWorkspace());
-
- // Look for the specified contribution
- for (Contribution contribution: workspace.getContributions()) {
- if (key.equals(contribution.getURI())) {
-
- // Compute the contribution dependencies
- ContributionDependencyBuilder analyzer = new ContributionDependencyBuilderImpl(monitor);
- List<Contribution> dependencies = analyzer.buildContributionDependencies(contribution, workspace);
-
- // Returns entries for the dependencies
- // optionally skip the specified contribution
- boolean allDependencies = queryString.startsWith("alldependencies=");
- for (Contribution dependency: dependencies) {
- if (!allDependencies && dependency == contribution) {
- // Skip the specified contribution
- continue;
- }
- entries.add(entry(workspace, dependency));
- }
- break;
- }
- }
-
- return entries.toArray(new Entry[entries.size()]);
-
- } if (queryString.startsWith("suggestions=true")) {
-
- // Returns a list of contribution suggestions, scan the parent of the workspace
- // directory for potential contribution directories
-
- // For now, recognize project directories that contain .project files
- // Directories containing .classpath files are likely to be Java projects, we parse
- // the .classpath file to determine the Java project output location
- Workspace suggestionWorkspace = workspaceFactory.createWorkspace();
- List<Entry> entries = new ArrayList<Entry>();
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
- File rootLocation = new File(new File(rootDirectory).toURI().normalize());
- for (File project: rootLocation.getParentFile().listFiles()) {
- File dotProject = new File(project, ".project");
- if (!dotProject.exists()) {
- continue;
- }
-
- // We have a potential contribution
- String uri = project.getName();
- File location = project;
-
- // If this is a Java project, parse its .classpath file to determine it's output location
- File dotClasspath = new File(project, ".classpath");
- if (dotClasspath.exists()) {
- try {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new FileInputStream(dotClasspath));
- reader.nextTag();
- while (reader.hasNext()) {
- int event = reader.getEventType();
- if (event == START_ELEMENT) {
- if ("classpathentry".equals(reader.getName().getLocalPart())) {
- if ("output".equals(reader.getAttributeValue("", "kind"))) {
- location = new File(project, reader.getAttributeValue("", "path"));
- break;
- }
- }
- }
- if (reader.hasNext()) {
- reader.next();
- }
- }
- } catch (FileNotFoundException e) {
- } catch (XMLStreamException e) {
- }
-
- }
-
- // Create a contribution entry, skip the domain root directory and childrens of the
- // domain root directory
- String rootLocationPath = rootLocation.getPath();
- if (rootLocationPath.indexOf('\\') != -1 || rootLocationPath.indexOf(' ') != -1) {
- rootLocationPath = new File(rootLocationPath.replace('\\', '/')).toURI().toString();
- }
- String locationPath = location.getPath();
- if (locationPath.indexOf('\\') != -1 || locationPath.indexOf(' ') != -1) {
- locationPath = new File(locationPath.replace('\\', '/')).toURI().toString();
- }
- if (!locationPath.startsWith(rootLocationPath + "/") && !locationPath.equals(rootLocationPath)) {
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(uri);
- contribution.setLocation(locationPath);
- entries.add(entry(suggestionWorkspace, contribution));
- }
- }
-
- return entries.toArray(new Entry[entries.size()]);
-
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Returns an entry representing a contribution
- * @param contribution
- * @return
- */
- private static Entry<String, Item> entry(Workspace workspace, Contribution contribution) {
- Entry<String, Item> entry = new Entry<String, Item>();
- entry.setKey(contribution.getURI());
- entry.setData(item(workspace, contribution));
- return entry;
- }
-
- /**
- * Returns an item representing a contribution.
- *
- * @param contribution
- * @return
- */
- private static Item item(Workspace workspace, Contribution contribution) {
- String contributionURI = contribution.getURI();
- Item item = new Item();
- item.setTitle(title(contributionURI));
- item.setLink(link(contributionURI));
- item.setAlternate(contribution.getLocation());
-
- // List the contribution dependencies in the item contents
- final List<String> problems = new ArrayList<String>();
- Monitor monitor = new Monitor() {
- public void problem(Problem problem) {
- problems.add(problem.getMessageId() + " " + problem.getProblemObject().toString());
- }
-
- public List<Problem> getProblems() {
- return null;
- }
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Exception cause) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, cause);
- }
-
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Object... messageParams) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, messageParams);
- }
- };
-
- StringBuffer sb = new StringBuffer();
- ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(monitor);
- List<Contribution> dependencies = analyzer.buildContributionDependencies(contribution, workspace);
- if (dependencies.size() > 1) {
- sb.append("Dependencies: <span id=\"dependencies\">");
- for (int i = 0, n = dependencies.size(); i < n ; i++) {
- if (i > 0) {
- sb.append(" ");
- }
- Contribution dependency = dependencies.get(i);
- if (dependency != contribution) {
- String dependencyURI = dependency.getURI();
- sb.append("<a href=\""+ link(dependencyURI) +"\">" + title(dependencyURI) + "</a>");
- }
- }
- sb.append("</span><br>");
- }
-
- // List the deployables
- List<Composite> deployables = contribution.getDeployables();
- if (!deployables.isEmpty()) {
- sb.append("Deployables: <span id=\"deployables\">");
- for (int i = 0, n = deployables.size(); i < n ; i++) {
- if (i > 0) {
- sb.append(" ");
- }
- Composite deployable = deployables.get(i);
- QName qname = deployable.getName();
- sb.append("<a href=\""+ compositeSourceLink(contributionURI, qname) +"\">" + compositeSimpleTitle(contributionURI, qname) + "</a>");
- }
- sb.append("</span><br>");
- }
-
- // List the dependency problems
- if (contribution.isUnresolved()) {
- problems.add("Contribution not found");
- }
- if (problems.size() > 0) {
- sb.append("<span id=\"problems\" style=\"color: red\">");
- for (int i = 0, n = problems.size(); i < n ; i++) {
- sb.append("Problem: "+ problems.get(i) + "<br>");
- }
- sb.append("</span>");
- }
-
- // Store in the item contents
- item.setContents(sb.toString());
-
- return item;
- }
-
- /**
- * Returns a link to a contribution.
- * @param contributionURI
- * @return
- */
- private static String link(String contributionURI) {
- return "/contribution/" + contributionURI;
- }
-
- /**
- * Returns a title for the given contribution
- *
- * @param contributionURI
- * @return
- */
- private static String title(String contributionURI) {
- return contributionURI;
- }
-
-
- /**
- * Read the workspace.
- *
- * @return
- */
- private Workspace readWorkspace() {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- Workspace workspace;
- File file = new File(rootDirectory + "/" + workspaceFile);
- if (file.exists()) {
-
- // Get workspace from cache
- if (cache.workspace != null && file.lastModified() == cache.workspaceLastModified) {
- workspace = cache.workspace;
-
- } else {
-
- try {
- FileInputStream is = new FileInputStream(file);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- reader.nextTag();
- workspace = (Workspace)staxProcessor.read(reader);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- // Cache workspace
- cache.workspaceLastModified = file.lastModified();
- cache.workspace = workspace;
- }
-
- } else {
-
- // Create new workspace
- workspace = workspaceFactory.createWorkspace();
-
- // Cache workspace
- cache.workspaceLastModified = 0;
- cache.workspace = workspace;
- }
-
- // Make sure that the workspace contains the cloud contribution
- // The cloud contribution contains the composites describing the
- // SCA nodes declared in the cloud
- Contribution cloudContribution = null;
- for (Contribution contribution: workspace.getContributions()) {
- if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) {
- cloudContribution = contribution;
- }
- }
- if (cloudContribution == null) {
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(DEPLOYMENT_CONTRIBUTION_URI);
- File cloudDirectory = new File(rootDirectory + "/" + deploymentContributionDirectory);
- contribution.setLocation(cloudDirectory.toURI().toString());
- workspace.getContributions().add(contribution);
- }
-
- return workspace;
- }
-
- /**
- * Write the workspace back to disk
- *
- * @param workspace
- */
- private void writeWorkspace(Workspace workspace) {
- try {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- // First write to a byte stream
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
- staxProcessor.write(workspace, writer);
-
- // Parse again to pretty format the document
- Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setIndent(2);
-
- // Write to workspace.xml
- File file = new File(rootDirectory + "/" + workspaceFile);
- FileOutputStream os = new FileOutputStream(file);
- XMLSerializer serializer = new XMLSerializer(os, format);
- serializer.serialize(document);
- os.close();
-
- // Cache workspace
- cache.workspace = workspace;
- cache.workspaceLastModified = file.lastModified();
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Returns a workspace populated with the contribution info read from
- * the contributions.
- *
- * @param workspace
- * @return
- */
- private Workspace readContributions(Workspace workspace) {
-
- Workspace contributions = workspaceFactory.createWorkspace();
- try {
- for (Contribution c: workspace.getContributions()) {
- URI uri = URI.create(c.getURI());
- URL location = locationURL(c.getLocation());
-
- // Get contribution from cache
- ContributionCache contributionCache = cache.contributions.get(location);
- long lastModified = lastModified(location);
- if (contributionCache != null) {
- if (contributionCache.contributionLastModified == lastModified) {
- Contribution contribution = contributionCache.contribution;
- contribution.setUnresolved(false);
- contributions.getContributions().add(contribution);
- continue;
- }
-
- // Reset contribution cache
- cache.contributions.remove(location);
- }
-
- try {
- Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
- contribution.setUnresolved(false);
- contributions.getContributions().add(contribution);
-
- // Cache contribution
- contributionCache = new ContributionCache();
- contributionCache.contribution = contribution;
- contributionCache.contributionLastModified = lastModified;
- cache.contributions.put(location, contributionCache);
-
-
- // Make sure that the cloud contribution does not contain
- // default imports/exports as we want to isolate it from application
- // provided contributions
- if (contribution.getURI().equals(DEPLOYMENT_CONTRIBUTION_URI)) {
- for (Iterator<Import> i = contribution.getImports().iterator(); i.hasNext(); ) {
- Import import_ = i.next();
- if (import_ instanceof DefaultImport) {
- i.remove();
- }
- }
- for (Iterator<Export> i = contribution.getExports().iterator(); i.hasNext(); ) {
- Export export = i.next();
- if (export instanceof DefaultExport) {
- i.remove();
- }
- }
- }
-
- } catch (ContributionReadException e) {
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(c.getURI());
- contribution.setLocation(c.getLocation());
- contribution.setUnresolved(true);
- contributions.getContributions().add(contribution);
- }
- }
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return contributions;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionServiceImpl.java
deleted file mode 100644
index a4d7680cb0..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/ContributionServiceImpl.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.domain.manager.impl;
-
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a contribution collection service component.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={Servlet.class})
-public class ContributionServiceImpl extends HttpServlet implements Servlet {
- private static final long serialVersionUID = -4759297945439322773L;
-
- private static final Logger logger = Logger.getLogger(ContributionServiceImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
-
- // The key is the contribution URI
- String key = path.startsWith("/")? path.substring(1) : path;
- logger.fine("get " + key);
-
- // Get the item describing the composite
- Item item;
- try {
- item = contributionCollection.get(key);
- } catch (NotFoundException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Redirect to the actual contribution location
- response.sendRedirect("/files/" + item.getAlternate());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java
deleted file mode 100644
index 3dac9b535e..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeCollectionImpl.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeAlternateLink;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeKey;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeSourceLink;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeTitle;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.lastModified;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.locationURL;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-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.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeCollectionImpl.Cache.ContributionCache;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
-import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
-import org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a deployable composite collection service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
-public class DeployableCompositeCollectionImpl implements ItemCollection, LocalItemCollection {
-
- private static final Logger logger = Logger.getLogger(DeployableCompositeCollectionImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private ModelFactoryExtensionPoint modelFactories;
- private ModelResolverExtensionPoint modelResolvers;
- private URLArtifactProcessor<Contribution> contributionProcessor;
- private XMLOutputFactory outputFactory;
- private ContributionDependencyBuilder contributionDependencyBuilder;
- private Monitor monitor;
-
- /**
- * Cache contribution models.
- */
- static class Cache {
- static class ContributionCache {
- private Contribution contribution;
- private long contributionLastModified;
- }
- private Map<URL, ContributionCache> contributions = new HashMap<URL, ContributionCache>();
- }
-
- private Cache cache = new Cache();
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
-
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
- // Get model factories
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-
- // Get and initialize artifact processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- StAXArtifactProcessor<Object> staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- URLArtifactProcessorExtensionPoint urlProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<Object> urlProcessor = new ExtensibleURLArtifactProcessor(urlProcessors, monitor);
-
- // Create contribution processor
- modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- contributionProcessor = new ContributionContentProcessor(extensionPoints, monitor);
-
- // Create contribution and composite builders
- contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- // Return all the deployable composites in the contributions
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
-
- // Get the list of contributions in the workspace
- Entry<String, Item>[] contributionEntries = contributionCollection.getAll();
-
- // Read contribution metadata
- for (Entry<String, Item> contributionEntry: contributionEntries) {
- Item contributionItem = contributionEntry.getData();
- Contribution contribution;
- try {
- contribution = contribution(contributionEntry.getKey(), contributionItem.getAlternate());
- } catch (ContributionReadException e) {
- continue;
- }
-
- // Create entries for the deployable composites
- for (Composite deployable: contribution.getDeployables()) {
- entries.add(entry(contribution, deployable));
- }
-
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
-
- // Get the specified contribution info
- String contributionURI = contributionURI(key);
- Item contributionItem = contributionCollection.get(contributionURI);
-
- // Read the contribution
- Contribution contribution;
- try {
- contribution = contribution(contributionURI, contributionItem.getAlternate());
- } catch (ContributionReadException e) {
- throw new NotFoundException(key);
- }
-
- // Find the specified deployable composite
- QName qname = compositeQName(key);
- for (Composite deployable: contribution.getDeployables()) {
- if (qname.equals(deployable.getName())) {
- // find the deployable composite
- deployable = contribution.getModelResolver().resolveModel(Composite.class, deployable);
-
- if (deployable.isUnresolved()) {
- throw new NotFoundException(key);
- }
-
- // Return an item describing the deployable composite
- return item(contribution, deployable);
- }
- }
-
- throw new NotFoundException(key);
- }
-
- public String post(String key, Item item) {
- throw new UnsupportedOperationException();
- }
-
- public void put(String key, Item item) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void delete(String key) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public Entry<String, Item>[] query(String queryString) {
- logger.fine("query " + queryString);
-
- if (queryString.startsWith("contribution=")) {
-
- // Return all the deployable composites in the specified
- // contribution
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
-
- // Get the specified contribution info
- String contributionURI = queryString.substring(queryString.indexOf('=') + 1);
- Item contributionItem;
- try {
- contributionItem = contributionCollection.get(contributionURI);
- } catch (NotFoundException e) {
- return entries.toArray(new Entry[entries.size()]);
- }
-
- // Read the contribution
- Contribution contribution;
- try {
- contribution = contribution(contributionURI, contributionItem.getAlternate());
- } catch (ContributionReadException e) {
- return entries.toArray(new Entry[entries.size()]);
- }
-
- // Create entries for the deployable composites
- for (Composite deployable: contribution.getDeployables()) {
- entries.add(entry(contribution, deployable));
- }
-
- return entries.toArray(new Entry[entries.size()]);
-
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Returns the contribution with the given URI.
- *
- * @param contributionURI
- * @param contributionLocation
- * @return
- * @throws NotFoundException
- */
- private Contribution contribution(String contributionURI, String contributionLocation) throws ContributionReadException {
- try {
- URI uri = URI.create(contributionURI);
- URL location = locationURL(contributionLocation);
-
- // Get contribution from cache
- ContributionCache contributionCache = cache.contributions.get(location);
- long lastModified = lastModified(location);
- if (contributionCache != null) {
- if (contributionCache.contributionLastModified == lastModified) {
- return contributionCache.contribution;
- }
-
- // Reset contribution cache
- cache.contributions.remove(location);
- }
-
- Contribution contribution = (Contribution)contributionProcessor.read(null, uri, location);
-
- // TODO - analyse dependencies here?
-
- //contributionProcessor.resolve(contribution, new DefaultModelResolver());
-
- // Cache contribution
- contributionCache = new ContributionCache();
- contributionCache.contribution = contribution;
- contributionCache.contributionLastModified = lastModified;
- cache.contributions.put(location, contributionCache);
-
- return contribution;
-
- } catch (ContributionReadException e) {
- throw e;
- } catch (MalformedURLException e) {
- throw new ContributionReadException(e);
- // } catch (ContributionResolveException e) {
- // throw new ContributionReadException(e);
- } catch (Throwable e) {
- throw new ContributionReadException(e);
- }
- }
-
- /**
- * Returns the entry contents describing a composite.
- *
- * @param composite
- * @return
- */
- private static String content(Composite composite) {
- StringBuffer sb = new StringBuffer();
- List<Component> components = composite.getComponents();
- for (int i = 0, n = components.size(); i < n; i++) {
- Component component = components.get(i);
- if (component.getImplementation() instanceof NodeImplementation) {
- List<ComponentService> services = component.getServices();
- if (!services.isEmpty()) {
- List<Binding> bindings = services.get(0).getBindings();
- if (!bindings.isEmpty()) {
-
- // List node URIs
- sb.append("Node URI: <span id=\"nodeURI\">");
- sb.append(component.getServices().get(0).getBindings().get(0).getURI());
- break;
- }
- }
- } else {
-
- // List component names
- if (sb.length() == 0) {
- sb.append("Components: <span id=\"components\">");
- } else {
- sb.append(" ");
- }
- sb.append(component.getName());
- }
- }
- if (sb.length() != 0) {
- sb.append("</span>");
- }
- return sb.toString();
- }
-
- /**
- * Returns the link to the resource related to a composite.
- *
- * @param composite
- * @return
- */
- private static String relatedLink(Composite composite) {
- for (Component component: composite.getComponents()) {
- if (component.getImplementation() instanceof NodeImplementation) {
- NodeImplementation nodeImplementation = (NodeImplementation)component.getImplementation();
- Composite deployable = nodeImplementation.getComposite();
- String contributionURI = deployable.getURI();
- QName qname = deployable.getName();
- String key = compositeKey(contributionURI, qname);
- return "/composite-source/" + key;
- }
- }
- return null;
- }
-
- /**
- * Returns an entry describing the given deployable.
- *
- * @param contribution
- * @param deployable
- * @return
- */
- private static Entry<String, Item> entry(Contribution contribution, Composite deployable) {
- Entry<String, Item> entry = new Entry<String, Item>();
- entry.setKey(DomainManagerUtil.compositeKey(contribution.getURI(), deployable.getName()));
- entry.setData(item(contribution, deployable));
- return entry;
- }
-
- /**
- * Returns an item describing the given deployable.
- *
- * @param contribution
- * @param deployable
- * @return
- */
- private static Item item(Contribution contribution, Composite deployable) {
- String contributionURI = contribution.getURI();
- String contributionLocation = contribution.getLocation();
- QName qname = deployable.getName();
- String deployableURI = deployable.getURI();
- Item item = new Item();
- item.setTitle(compositeTitle(contributionURI, qname));
- item.setContents(content(deployable));
- item.setLink(compositeSourceLink(contributionURI, qname));
- item.setAlternate(compositeAlternateLink(contributionLocation, deployableURI));
- item.setRelated(relatedLink(deployable));
- return item;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeServiceImpl.java
deleted file mode 100644
index 14ab9579f4..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployableCompositeServiceImpl.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.domain.manager.impl;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLDecoder;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a service that returns the source of a deployable composite.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(Servlet.class)
-public class DeployableCompositeServiceImpl extends HttpServlet implements Servlet {
- private static final long serialVersionUID = -3477992129462720902L;
-
- private static final Logger logger = Logger.getLogger(DeployableCompositeServiceImpl.class.getName());
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- @Reference
- public LocalItemCollection deployableCollection;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Expect a key in the form
- // composite:contributionURI;namespace;localName
- // and return the corresponding source file
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- String key = path.startsWith("/")? path.substring(1) : path;
- logger.fine("get " + key);
-
- // Get the item describing the composite
- Item item;
- try {
- item = deployableCollection.get(key);
- } catch (NotFoundException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- // Redirect if there is no composite file
- String uri = item.getAlternate();
- if (uri == null) {
- response.sendRedirect("/composite-generated/" + key);
- return;
- }
-
- // Read the composite file and write to response
- InputStream is;
- try {
- URLConnection connection = new URL(uri).openConnection();
- connection.setUseCaches(false);
- connection.connect();
- is = connection.getInputStream();
- } catch (FileNotFoundException ex) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-
- response.setContentType("text/xml");
- ServletOutputStream os = response.getOutputStream();
- byte[] buffer = new byte[4096];
- for (;;) {
- int n = is.read(buffer);
- if (n < 0) {
- break;
- }
- os.write(buffer, 0, n);
- }
- is.close();
- os.flush();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
deleted file mode 100644
index e95a0cc585..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DeployedCompositeCollectionImpl.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.DEPLOYMENT_CONTRIBUTION_URI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeKey;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeSourceLink;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeTitle;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.XMLSerializer;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-import org.w3c.dom.Document;
-
-/**
- * Implementation of a composite collection service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class,LocalItemCollection.class})
-public class DeployedCompositeCollectionImpl implements ItemCollection, LocalItemCollection {
- private static final Logger logger = Logger.getLogger(DeployedCompositeCollectionImpl.class.getName());
-
- @Property
- public String compositeFile;
-
- @Property
- public String deploymentContributionDirectory;
-
- @Reference
- public LocalItemCollection deployableCollection;
-
- @Reference(required=false)
- public LocalItemCollection processCollection;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private ModelFactoryExtensionPoint modelFactories;
- private AssemblyFactory assemblyFactory;
- private StAXArtifactProcessor<Composite> compositeProcessor;
- private XMLOutputFactory outputFactory;
- private DocumentBuilder documentBuilder;
-
- /**
- * Cache domain composite model.
- */
- static class Cache {
- private Composite compositeCollection;
- private long compositeCollectionLastModified;
- }
-
- private Cache cache = new Cache();
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
-
- // Create factories
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
-
- // Create composite processor
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = staxProcessors.getProcessor(Composite.class);
-
- // Create a document builder (used to pretty print XML)
- documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- // Return all the composites in the domain composite
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- Composite compositeCollection = readCompositeCollection();
- for (Composite composite: compositeCollection.getIncludes()) {
- String contributionURI = composite.getURI();
- QName qname = composite.getName();
- String key = compositeKey(contributionURI, qname);
- Item item;
- try {
- item = deployableCollection.get(key);
- } catch (NotFoundException e) {
- item = new Item();
- item.setTitle(compositeTitle(contributionURI, qname));
- item.setLink(compositeSourceLink(contributionURI, qname));
- item.setContents("<span id=\"problem\" style=\"color: red\">Problem: Composite not found</span>");
- }
- Entry<String, Item> entry = new Entry<String, Item>();
- entry.setKey(key);
- entry.setData(item);
- entries.add(entry);
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
-
- String contributionURI = contributionURI(key);
- QName qname = compositeQName(key);
-
- // Look for the specified composite in the domain composite
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- Composite compositeCollection = readCompositeCollection();
- for (Composite composite: compositeCollection.getIncludes()) {
- if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
- return deployableCollection.get(key);
- }
- }
- throw new NotFoundException(key);
- }
-
- public String post(String key, Item item) {
- logger.fine("post " + key);
-
- String contributionURI = contributionURI(key);
- QName qname = compositeQName(key);
-
- // Adds a new composite to the domain composite
- Composite compositeCollection = readCompositeCollection();
- Composite composite = assemblyFactory.createComposite();
- composite.setName(qname);
- composite.setURI(contributionURI);
- composite.setUnresolved(true);
- compositeCollection.getIncludes().add(composite);
-
- // Optionally, write the composite contents in a new composite file
- // under the deployment composites directory, if that directory is
- // configured on this component
- if (deploymentContributionDirectory != null && item.getContents() != null) {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- File directory = new File(rootDirectory + "/" + deploymentContributionDirectory);
- if (!directory.exists()) {
- directory.mkdirs();
- }
- File file = new File(directory, qname.getLocalPart() + ".composite");
- try {
- Writer w = new OutputStreamWriter(new FileOutputStream(file));
- w.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
- w.write(item.getContents());
- w.close();
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- // Write the composite collection
- writeCompositeCollection(compositeCollection);
-
- return key;
- }
-
- public void put(String key, Item item) throws NotFoundException {
- logger.fine("put " + key);
-
- String contributionURI = contributionURI(key);
- QName qname = compositeQName(key);
-
- // Update a composite already in the domain composite
- Composite compositeCollection = readCompositeCollection();
- Composite newComposite = assemblyFactory.createComposite();
- newComposite.setName(qname);
- newComposite.setURI(contributionURI);
- newComposite.setUnresolved(true);
- List<Composite> composites = compositeCollection.getIncludes();
- for (int i = 0, n = composites.size(); i < n; i++) {
- Composite composite = composites.get(i);
- if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
- composites.set(i, newComposite);
-
- // Write the domain composite
- writeCompositeCollection(compositeCollection);
-
- return;
- }
- }
- throw new NotFoundException(key);
- }
-
- public void delete(String key) throws NotFoundException {
- logger.fine("delete " + key);
-
- String contributionURI = contributionURI(key);
- QName qname = compositeQName(key);
-
- // Delete/stop the corresponding process, if any
- try {
- processCollection.delete(qname.getLocalPart());
- } catch (Exception e) {}
-
- // Delete a composite from the composite collection
- Composite compositeCollection = readCompositeCollection();
- List<Composite> composites = compositeCollection.getIncludes();
- Composite deleted = null;
- for (int i = 0, n = composites.size(); i < n; i++) {
- Composite composite = composites.get(i);
- if (contributionURI.equals(composite.getURI()) && qname.equals(composite.getName())) {
- composites.remove(i);
- deleted = composite;
-
- // Write the domain composite
- writeCompositeCollection(compositeCollection);
- break;
- }
- }
-
- // Delete the file too if it is in the deployment contribution directory
- if (deploymentContributionDirectory != null && contributionURI.equals(DEPLOYMENT_CONTRIBUTION_URI)) {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- File file = new File(rootDirectory + "/" + deploymentContributionDirectory, qname.getLocalPart() + ".composite");
- if (file.exists()) {
- file.delete();
- }
- }
-
- if (deleted == null) {
- throw new NotFoundException(key);
- }
- }
-
- public Entry<String, Item>[] query(String queryString) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Reads the domain composite.
- *
- * @return the domain composite
- * @throws ServiceRuntimeException
- */
- private Composite readCompositeCollection() throws ServiceRuntimeException {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- Composite compositeCollection;
- File file = new File(rootDirectory + "/" + compositeFile);
- if (file.exists()) {
-
- // Get composite collection from cache
- if (cache.compositeCollection != null && file.lastModified() == cache.compositeCollectionLastModified) {
- compositeCollection = cache.compositeCollection;
-
- } else {
-
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- try {
- FileInputStream is = new FileInputStream(file);
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- compositeCollection = compositeProcessor.read(reader);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- // Cache composite collection
- cache.compositeCollectionLastModified = file.lastModified();
- cache.compositeCollection = compositeCollection;
- }
-
- } else {
- compositeCollection = assemblyFactory.createComposite();
- String name;
- int d = compositeFile.lastIndexOf('.');
- if (d != -1) {
- name = compositeFile.substring(0, d);
- } else {
- name = compositeFile;
- }
- compositeCollection.setName(new QName(Constants.SCA10_TUSCANY_NS, name));
-
- // Cache composite collection
- cache.compositeCollectionLastModified = 0;
- cache.compositeCollection = compositeCollection;
- }
- return compositeCollection;
- }
-
- /**
- * Write the domain composite back to disk.
- *
- * @param compositeCollection
- */
- private void writeCompositeCollection(Composite compositeCollection) {
- try {
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- // First write to a byte stream
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(bos);
- compositeProcessor.write(compositeCollection, writer);
-
- // Parse again to pretty format the document
- Document document = documentBuilder.parse(new ByteArrayInputStream(bos.toByteArray()));
- OutputFormat format = new OutputFormat();
- format.setIndenting(true);
- format.setIndent(2);
-
- // Write to domain.composite
- File file = new File(rootDirectory + "/" + compositeFile);
- FileOutputStream os = new FileOutputStream(file);
- XMLSerializer serializer = new XMLSerializer(os, format);
- serializer.serialize(document);
-
- // Cache composite collection
- cache.compositeCollection = compositeCollection;
- cache.compositeCollectionLastModified = file.lastModified();
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfiguration.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfiguration.java
deleted file mode 100644
index 1831728f07..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfiguration.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-
-/**
- * Domain manager configuration service interface.
- *
- * @version $Rev$ $Date$
- */
-public interface DomainManagerConfiguration {
-
- /**
- * Sets the domain manager root directory.
- *
- * @param rootDirectory
- */
- void setRootDirectory(String rootDirectory);
-
- /**
- * Returns the domain manager root directory.
- *
- * @return the domain manager root directory
- */
- String getRootDirectory();
-
- /**
- * Returns the extension point registry used in the
- * domain manager.
- *
- * @return
- */
- ExtensionPointRegistry getExtensionPoints();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfigurationImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfigurationImpl.java
deleted file mode 100644
index a5ce6e12d6..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerConfigurationImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a domain manager configuration component.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(DomainManagerConfiguration.class)
-public class DomainManagerConfigurationImpl implements DomainManagerConfiguration {
-
- private String rootDirectory = ".";
- private ExtensionPointRegistry extensionPoints;
-
- @Init
- public void initialize() {
-
- // Create extension point registry
- extensionPoints = new DefaultExtensionPointRegistry();
-
- // Initialize module activators
- ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
- for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
- try {
- activator.start(extensionPoints);
- } catch (Exception e) {
- //FIXME fix the module activators that have cross module dependencies
- // and currently fail when the whole runtime is not present
- }
- }
- }
-
- @Destroy
- public void destroy() {
- ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
- for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
- try {
- activator.stop(extensionPoints);
- } catch (Exception e) {
- //FIXME fix the module activators that have cross module dependencies
- // and currently fail when the whole runtime is not present
- }
- }
- }
-
- public String getRootDirectory() {
- return rootDirectory;
- }
-
- public void setRootDirectory(String rootDirectory) {
- this.rootDirectory = rootDirectory;
- }
-
- public ExtensionPointRegistry getExtensionPoints() {
- return extensionPoints;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerUtil.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerUtil.java
deleted file mode 100644
index 069cc9f5ae..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerUtil.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-
-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.Composite;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Common functions and constants used by the admin components.
- *
- * @version $Rev$ $Date$
- */
-public final class DomainManagerUtil {
-
- static final String DEPLOYMENT_CONTRIBUTION_URI = "http://tuscany.apache.org/cloud";
-
- /**
- * Extracts a qname from a key expressed as contributionURI;namespace;localpart.
- * @param key
- * @return
- */
- static QName compositeQName(String key) {
- int i = key.indexOf(';');
- key = key.substring(i + 1);
- i = key.indexOf(';');
- return new QName(key.substring(0, i), key.substring(i + 1));
- }
-
- /**
- * Returns a composite title expressed as contributionURI - namespace;localpart.
- * @param qname
- * @return
- */
- static String compositeTitle(String uri, QName qname) {
- if (uri.equals(DEPLOYMENT_CONTRIBUTION_URI)) {
- return qname.getLocalPart();
- } else {
- return uri + " - " + qname.getNamespaceURI() + ";" + qname.getLocalPart();
- }
- }
-
- /**
- * Extracts a contribution uri from a key expressed as contributionURI;namespace;localpart.
- * @param key
- * @return
- */
- static String contributionURI(String key) {
- int i = key.indexOf(';');
- return key.substring("composite:".length(), i);
- }
-
- /**
- * Returns a composite key expressed as contributionURI;namespace;localpart.
- * @param qname
- * @return
- */
- static String compositeKey(String uri, QName qname) {
- return "composite:" + uri + ';' + qname.getNamespaceURI() + ';' + qname.getLocalPart();
- }
-
- /**
- * Returns a link to the source of a composite
- * @param contributionURI
- * @param qname
- * @return
- */
- static String compositeSourceLink(String contributionURI, QName qname) {
- return "/composite-source/" + compositeKey(contributionURI, qname);
- }
-
- /**
- * Returns a composite title expressed as contributionURI - namespace;localpart.
- * @param qname
- * @return
- */
- static String compositeSimpleTitle(String uri, QName qname) {
- if (uri.equals(DomainManagerUtil.DEPLOYMENT_CONTRIBUTION_URI)) {
- return qname.getLocalPart();
- } else {
- return qname.getNamespaceURI() + ";" + qname.getLocalPart();
- }
- }
-
- /**
- * Returns a URL from a location string.
- * @param location
- * @return
- * @throws MalformedURLException
- */
- static URL locationURL(String location) throws MalformedURLException {
- String scheme = null;
- URI uri = null;
-
- IllegalArgumentException uriException = null;
- try {
- uri = URI.create(location);
- scheme = uri.getScheme();
- }catch (java.lang.IllegalArgumentException e) {
- uriException = e;
- }
-
- if (scheme == null) {
- File file = new File(location);
- return file.toURI().toURL();
- } else if (scheme.equals("file")) {
- File file = new File(location.substring(5));
- return file.toURI().toURL();
- } else if(uri == null){
- throw uriException;
- } else {
- return uri.toURL();
- }
- }
-
- /**
- * Returns a link to a deployable composite.
- *
- * If the containing contribution is a local directory, return the URI of the local composite file
- * inside the contribution.
- *
- * If the containing contribution is a local or remote file, return a URI of the form:
- * jar: contribution URI !/ composite URI.
- *
- * @param contributionLocation
- * @param deployableURI
- * @return
- */
- static String compositeAlternateLink(String contributionLocation, String deployableURI) {
- if (deployableURI == null) {
- return null;
- }
- URI u = URI.create(contributionLocation);
- String uri;
- if ("file".equals(u.getScheme())) {
- String path = u.toString().substring(5);
- File file = new File(path);
- if (file.isDirectory()) {
- if (contributionLocation.endsWith("/")) {
- uri = contributionLocation + deployableURI;
- } else {
- uri = contributionLocation + "/" + deployableURI;
- }
- } else {
- uri = contributionLocation + "!/" + deployableURI;
- }
- } else {
- uri = contributionLocation + "!/" + deployableURI;
- }
- int e = uri.indexOf("!/");
- if (e != -1) {
- int s = uri.lastIndexOf('/', e - 2) +1;
- if (uri.substring(s, e).contains(".")) {
- uri = "jar:" + uri;
- } else {
- uri = uri.substring(0, e) + uri.substring(e + 1);
- }
- }
- return uri;
- }
-
- /**
- * Extract a node URI from an ATOM entry content.
- *
- * @param content
- * @return
- */
- static String nodeURI(String content) {
- if (content != null) {
- int bs = content.indexOf("<span id=\"nodeURI\">");
- if (bs != -1) {
- content = content.substring(bs + 19);
- int es = content.indexOf("</span>");
- if (es != -1) {
- return content.substring(0, es);
- }
- }
- }
- return null;
- }
-
- /**
- * Create a new service reference dynamically.
- *
- * @param <B>
- * @param businessInterface
- * @param binding
- * @param assemblyFactory
- * @param compositeActivator
- * @return
- */
- static <B> ServiceReference<B> dynamicReference(Class<B> businessInterface, Binding binding, AssemblyFactory assemblyFactory, CompositeActivator compositeActivator) {
- try {
-
- Composite composite = assemblyFactory.createComposite();
- composite.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "default"));
- RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
- component.setName("default");
- component.setURI("default");
- compositeActivator.configureComponentContext(component);
- composite.getComponents().add(component);
- RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
- reference.setName("default");
- JavaInterfaceFactory javaInterfaceFactory = compositeActivator.getJavaInterfaceFactory();
- InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
- reference.setInterfaceContract(interfaceContract);
- component.getReferences().add(reference);
- reference.setComponent(component);
- reference.getBindings().add(binding);
-
- ProxyFactory proxyFactory = compositeActivator.getProxyFactory();
- return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, proxyFactory, compositeActivator);
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Returns the last modified time of the content at the given URL.
- *
- * @param url
- * @return
- * @throws IOException
- */
- static long lastModified(URL url) throws IOException {
-
- if (url.getProtocol() == null || "file".equals(url.getProtocol())) {
- return lastModified(new File(url.getPath()));
- } else {
- URLConnection connection = url.openConnection();
- long lastModified = connection.getLastModified();
- return lastModified;
- }
- }
-
- /**
- * Returns the last modified time of the given file or directory.
- *
- * @param file
- * @return
- */
- static long lastModified(File file) {
- if (file.isDirectory()) {
- long lastModified = file.lastModified();
-
- for (File child: file.listFiles()) {
- long m = lastModified(child);
- if (m > lastModified) {
- lastModified = m;
- }
- }
- return lastModified;
-
- } else {
- return file.lastModified();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
deleted file mode 100644
index a53250515a..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileCollectionImpl.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a file collection service component.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(ItemCollection.class)
-public class FileCollectionImpl implements ItemCollection {
-
- private static final Logger logger = Logger.getLogger(FileCollectionImpl.class.getName());
-
- @Property
- public String directoryName;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws IOException {
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
-
- // Return all the files
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- File directory = new File(rootDirectory + "/" + directoryName);
- if (directory.exists()) {
- for (File file: directory.listFiles()) {
- if (file.getName().startsWith(".")) {
- continue;
- }
- entries.add(entry(file.getName()));
- }
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
- return item(key);
- }
-
- public String post(String key, Item item) {
- throw new UnsupportedOperationException();
- }
-
- public void put(String key, Item item) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void delete(String key) throws NotFoundException {
- logger.fine("delete " + key);
-
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
- File directory = new File(rootDirectory + "/" + directoryName);
- File file = new File(directory, key);
- if (file.exists()) {
- file.delete();
- } else {
- throw new NotFoundException(key);
- }
- }
-
- public Entry<String, Item>[] query(String queryString) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Returns an entry representing a file.
- *
- * @param fileName
- * @return
- */
- private static Entry<String, Item> entry(String fileName) {
- Entry<String, Item> entry = new Entry<String, Item>();
- entry.setKey(fileName);
- entry.setData(item(fileName));
- return entry;
- }
-
- /**
- * Returns an item representing a file.
- *
- * @param fileName
- * @return
- */
- private static Item item(String fileName) {
- Item item = new Item();
- item.setTitle(fileName);
- item.setLink("/files/" + fileName);
- return item;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
deleted file mode 100644
index 2adb623876..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/FileServiceImpl.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URLConnection;
-import java.net.URLDecoder;
-import java.util.List;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
-import org.apache.commons.fileupload.servlet.ServletFileUpload;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a servlet component supporting file upload/download.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(Servlet.class)
-public class FileServiceImpl extends HttpServlet {
- private static final long serialVersionUID = -4560385595481971616L;
-
- private static final Logger logger = Logger.getLogger(FileServiceImpl.class.getName());
-
- @Property
- public String directoryName;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private ServletFileUpload upload;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws IOException {
- upload = new ServletFileUpload(new DiskFileItemFactory());
- }
-
- @Override
- public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
-
- // Upload files
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
- try {
- for (FileItem item: (List<FileItem>)upload.parseRequest(request)) {
- if (!item.isFormField()) {
- File directory = new File(rootDirectory + "/" + directoryName);
- if (!directory.exists()) {
- directory.mkdirs();
- }
- logger.fine("post " + item.getName());
- item.write(new File(directory, item.getName()));
- }
- }
-
- // Redirect to the admin page
- response.sendRedirect("/ui/files");
- }
- catch (Exception e) {
- throw new IOException(e.toString());
- }
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Download a file
- String requestURI = URLDecoder.decode(request.getRequestURI(), "UTF-8");
- String path = requestURI.substring(request.getServletPath().length());
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- logger.fine("get " + path);
-
- try {
-
- // Analyze the given path
- URI uri = URI.create(path);
- String scheme = uri.getScheme();
- if (scheme == null) {
-
- // If no scheme is specified then the path identifies file
- // inside our directory
- String rootDirectory = domainManagerConfiguration.getRootDirectory();
- uri = new File(rootDirectory + "/" + directoryName, path).toURI();
-
- } else if (!scheme.equals("file")) {
-
- // If the scheme does not identify a local file, just redirect to the server
- // hosting the file
- response.sendRedirect(path);
- }
-
- // Read the file and write to response
- URLConnection connection = uri.toURL().openConnection();
- connection.setUseCaches(false);
- connection.connect();
- InputStream is = connection.getInputStream();
- ServletOutputStream os = response.getOutputStream();
- byte[] buffer = new byte[4096];
- for (;;) {
- int n = is.read(buffer);
- if (n < 0) {
- break;
- }
- os.write(buffer, 0, n);
- }
- is.close();
- os.flush();
-
- } catch (FileNotFoundException e) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeConfigurationServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeConfigurationServiceImpl.java
deleted file mode 100644
index 06d28b0502..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeConfigurationServiceImpl.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.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-
-import java.io.IOException;
-import java.net.URLDecoder;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a service that returns a node configuration.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(Servlet.class)
-public class NodeConfigurationServiceImpl extends HttpServlet implements Servlet {
- private static final long serialVersionUID = 6913769467386954463L;
-
- private static final Logger logger = Logger.getLogger(NodeConfigurationServiceImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public LocalItemCollection cloudCollection;
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- String key = path.startsWith("/")? path.substring(1) : path;
- logger.fine("get " + key);
-
- // The key contains a node name, redirect
- // to the corresponding composite config
-
- // Get the collection of cloud composites
- Entry<String, Item>[] cloudEntries = cloudCollection.getAll();
-
- // Find the specified node
- for (Entry<String, Item> cloudEntry: cloudEntries) {
- QName qname = compositeQName(cloudEntry.getKey());
- if (qname.getLocalPart().equals(key)) {
-
- // Found the specified node
- String related = cloudEntry.getData().getRelated();
- int i = related.indexOf("composite:");
- if (i != -1) {
-
- // Redirect to its composite config
- String compositeConfiguration = "/composite-config/?composite=" + related.substring(i);
- response.sendRedirect(compositeConfiguration);
- return;
- }
- }
- }
-
- // Node not found
- response.sendError(HttpServletResponse.SC_NOT_FOUND, key);
- return;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeProcessCollectionFacadeImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeProcessCollectionFacadeImpl.java
deleted file mode 100644
index d68cfa3786..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/NodeProcessCollectionFacadeImpl.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.nodeURI;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.binding.atom.AtomBindingFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a node process collection service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
-public class NodeProcessCollectionFacadeImpl implements ItemCollection, LocalItemCollection {
-
- private static final Logger logger = Logger.getLogger(NodeProcessCollectionFacadeImpl.class.getName());
-
- @Reference
- public LocalItemCollection cloudCollection;
-
- @Reference
- public ItemCollection processCollection;
-
- @Reference
- public DomainManagerConfiguration domainManagerConfiguration;
-
- private AssemblyFactory assemblyFactory;
- private AtomBindingFactory atomBindingFactory;
- private CompositeActivator compositeActivator;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() {
-
- // Get its composite activator
- //FIXME
- //compositeActivator = runtime.getCompositeActivator();
-
- // Get the model factories
- ExtensionPointRegistry extensionPoints = domainManagerConfiguration.getExtensionPoints();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- atomBindingFactory = modelFactories.getFactory(AtomBindingFactory.class);
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- // Get the collection of nodes
- Entry<String, Item>[] nodeEntries = cloudCollection.getAll();
-
- // Dispatch to the hosts hosting these nodes
- List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>();
- for (String host: hosts(nodeEntries)) {
- ItemCollection processCollection = processCollection(host);
- for (Entry<String, Item> remoteEntry: processCollection.getAll()) {
- entries.add(remoteEntry);
- }
- break;
- }
-
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
-
- // Get the host hosting the given node
- String host = host(key);
-
- // Dispatch the request to that host
- ItemCollection processCollection = processCollection(host);
- return processCollection.get(key);
- }
-
- public String post(String key, Item item) {
- logger.fine("post " + key);
-
- // Get the host hosting the given node
- String host;
- try {
- host = host(key);
- } catch (NotFoundException e) {
- throw new ServiceRuntimeException(e);
- }
-
- // Dispatch the request to that host
- ItemCollection processCollection = processCollection(host);
- return processCollection.post(key, item);
- }
-
- public void put(String key, Item item) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void delete(String key) throws NotFoundException {
- logger.fine("delete " + key);
-
- // Get the host hosting the given node
- String host = host(key);
-
- // Dispatch the request to that host
- ItemCollection processCollection = processCollection(host);
- processCollection.delete(key);
- }
-
- public Entry<String, Item>[] query(String queryString) {
- logger.fine("query " + queryString);
-
- if (queryString.startsWith("node=")) {
- String key = queryString.substring(queryString.indexOf('=') + 1);
-
- // Get the host hosting the given node
- String host;
- try {
- host = host(key);
- } catch (NotFoundException e) {
- return new Entry[0];
- }
-
- // Dispatch the request to that host
- ItemCollection processCollection = processCollection(host);
- return processCollection.query(queryString);
-
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- private String host(String nodeName) throws NotFoundException {
-
- // Get the entry representing the given node
- Entry<String, Item> nodeEntry = nodeEntry(cloudCollection.getAll(), nodeName);
- if (nodeEntry == null) {
- throw new NotFoundException(nodeName);
- }
-
- // Get the host hosting it
- return host(nodeEntry.getData());
- }
-
- /**
- * Returns the entry representing the given node.
- *
- * @param entries
- * @param name
- * @return
- */
- private static Entry<String, Item> nodeEntry(Entry<String, Item>[] entries, String name) {
- for (Entry<String, Item> entry: entries) {
- QName qname = compositeQName(entry.getKey());
- if (qname.getLocalPart().equals(name)) {
- return entry;
- }
- }
- return null;
- }
-
- /**
- * Returns the lists of hosts hosting the nodes in the given entries.
- *
- * @param entries
- * @return
- */
- private static List<String> hosts(Entry<String, Item>[] entries) {
- List<String> hosts = new ArrayList<String>();
- for (Entry<String, Item> entry: entries) {
- String host = host(entry.getData());
- if (!hosts.contains(host)) {
- hosts.add(host);
- }
- }
- return hosts;
- }
-
- /**
- * Returns the host of the node represented by the given item.
- *
- * @param item
- * @return
- */
- private static String host(Item item) {
- String uri = nodeURI(item.getContents());
- if (uri != null) {
- return URI.create(uri).getHost();
- } else {
- return null;
- }
- }
-
- /**
- * Returns a proxy to the process collection service on the specified
- * host.
- *
- * @param host
- * @return
- */
- private ItemCollection processCollection(String host) {
- return processCollection;
-
-//FIXME
-// AtomBinding binding = atomBindingFactory.createAtomBinding();
-// binding.setURI("http://" + host + ":9990/node/processes");
-// ServiceReference<ItemCollection> reference = dynamicReference(ItemCollection.class, binding, assemblyFactory, compositeActivator);
-// return reference.getService();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
deleted file mode 100644
index 564fa103c2..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/impl/QuickStartServiceImpl.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeKey;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.compositeQName;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.contributionURI;
-import static org.apache.tuscany.sca.domain.manager.impl.DomainManagerUtil.nodeURI;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URLDecoder;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a component that provides a quick start path for a
- * composite in a contribution.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={Servlet.class})
-public class QuickStartServiceImpl extends HttpServlet {
- private static final long serialVersionUID = -3477992129462720901L;
-
- private static final Logger logger = Logger.getLogger(QuickStartServiceImpl.class.getName());
-
- @Reference
- public LocalItemCollection contributionCollection;
-
- @Reference
- public LocalItemCollection deployableCollection;
-
- @Reference
- public LocalItemCollection domainCompositeCollection;
-
- @Reference
- public LocalItemCollection cloudCollection;
-
- @Reference
- public LocalItemCollection processCollection;
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- try {
-
- // Get the request path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
-
- // Get the request parameters
- String contributionURI = request.getParameter("contribution");
- String contributionLocation = request.getParameter("location");
- String compositeURI = request.getParameter("composite");
- String start = request.getParameter("start");
-
- logger.info("Composite Quick Start.");
- logger.info("Contribution URI: " + contributionURI);
- logger.info("Contribution location: " + contributionLocation);
- logger.info("Composite URI: " + compositeURI);
-
- // Look for the contribution in the workspace
- Entry<String, Item>[] contributionEntries = contributionCollection.getAll();
- Entry<String, Item> contributionEntry = null;
- for (Entry<String, Item> entry: contributionEntries) {
- if (entry.getKey() != null &&
- contributionURI.equals(entry.getKey())) {
- contributionEntry = entry;
- break;
- }
- }
-
- // Add the contribution if necessary
- if (contributionEntry == null) {
- Item item = new Item();
- item.setLink(contributionLocation);
- contributionCollection.post(contributionURI, item);
- }
-
- // Look for the specified deployable composite in the contribution
- String compositeKey = null;
- Entry<String, Item>[] deployableEntries = deployableCollection.query("contribution=" + contributionURI);
- for (Entry<String, Item> entry: deployableEntries) {
- Item item = entry.getData();
- String compositeFileName = compositeURI.substring(compositeURI.lastIndexOf("/") + 1);
- if ( contributionURI.equals(contributionURI(entry.getKey())) ||
- item.getAlternate().endsWith(compositeURI) ||
- item.getAlternate().endsWith(compositeFileName)) {
- compositeKey = entry.getKey();
- break;
- }
- }
-
- if (compositeKey == null) {
- logger.info("Composite not found");
- response.sendError(HttpServletResponse.SC_NOT_FOUND, compositeURI);
- return;
- }
-
- // Look for the deployable composite in the domain composite
- try {
- domainCompositeCollection.get(compositeKey);
- } catch (NotFoundException e) {
-
- // Add the deployable composite to the domain composite
- Item item = new Item();
- domainCompositeCollection.post(compositeKey, item);
- }
-
- // Check if the deployable composite is already assigned a node
- Entry<String, Item>[] nodeEntries = cloudCollection.getAll();
- String nodeName = null;
- for (Entry<String, Item> entry: nodeEntries) {
- Item item = entry.getData();
- String related = item.getRelated();
- if (related != null) {
- int c = related.indexOf("composite:");
- related = related.substring(c);
- if (compositeKey.equals(related)) {
- nodeName = compositeQName(entry.getKey()).getLocalPart();
- }
- }
- }
-
- // Create a new node for the composite if necessary
- if (nodeName == null) {
-
- // Construct node name and key
- QName compositeName = compositeQName(compositeKey);
- nodeName = compositeName.getLocalPart() + "Node";
- String nodeKey = compositeKey("http://tuscany.apache.org/cloud", new QName("http://tuscany.apache.org/cloud", nodeName));
-
- // Find a free node port
- Set<Integer> nodePorts = new HashSet<Integer>();
- for (Entry<String, Item> entry: nodeEntries) {
- Item item = entry.getData();
- String uri = nodeURI(item.getContents());
- if (uri != null) {
- URI u = URI.create(uri);
- int port = u.getPort();
- if (port != -1) {
- nodePorts.add(port);
- }
- }
- }
- String nodeURI = null;
- for (int port = 8100; port<8200; port++) {
- if (!nodePorts.contains(port)) {
- nodeURI = "http://localhost:" + port;
- break;
- }
- }
- if (nodeURI == null) {
- throw new RuntimeException("Couldn't find a free port for new node: " + nodeName);
- }
-
- // Build the entry describing the node
- Item item = new Item();
- String content =
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"\n" +
- " xmlns:t=\"http://tuscany.apache.org/xmlns/sca/1.0\"\n" +
- " targetNamespace=\"http://tuscany.apache.org/cloud\"\n" +
- " xmlns:c=\"" + compositeName.getNamespaceURI() + "\"\n" +
- " name=\"" + nodeName + "\">\n" +
- "\n" +
- " <component name=\"" + nodeName + "\">\n" +
- " <t:implementation.node uri=\"" + contributionURI + "\" composite=\"c:" + compositeName.getLocalPart() + "\"/>\n" +
- " <service name=\"Node\">\n" +
- " <binding.sca uri=\"" + nodeURI + "\"/>\n" +
- " <binding.ws uri=\"" + nodeURI + "\"/>\n" +
- " <t:binding.http uri=\"" + nodeURI + "\"/>\n" +
- " <t:binding.jsonrpc uri=\"" + nodeURI + "\"/>\n" +
- " <t:binding.atom uri=\"" + nodeURI + "\"/>\n" +
- " </service>\n" +
- " </component>\n" +
- "</composite>";
- item.setContents(content);
-
- // Create the new node
- cloudCollection.post(nodeKey, item);
- }
-
- // Finally, start the node
- if ("true".equals(start)) {
- processCollection.post(nodeName, new Item());
- }
-
- response.getWriter().print("<html><body>Node <span id=\"node\">" + nodeName + "</span> OK.</body></html>");
-
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Could not start composite", e);
- response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.toString());
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java b/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.java
deleted file mode 100644
index f96e19ed72..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/java/org/apache/tuscany/sca/domain/manager/launcher/DomainManagerLauncherBootstrap.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.domain.manager.launcher;
-
-import org.apache.tuscany.sca.domain.manager.impl.DomainManagerConfiguration;
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-
-/**
- * Bootstrap class for the SCA domain manager.
- *
- * @version $Rev$ $Date$
- */
-public class DomainManagerLauncherBootstrap {
- private SCANode node;
-
- /**
- * A node wrappering an instance of a domain manager.
- */
- public static class NodeFacade implements SCANode {
- private ClassLoader threadContextClassLoader;
- private ClassLoader runtimeClassLoader;
- private SCANode node;
- private String rootDirectory;
-
- private NodeFacade(String rootDirectory) {
- this.rootDirectory = rootDirectory;
- runtimeClassLoader = Thread.currentThread().getContextClassLoader();
- }
-
- public void start() {
- threadContextClassLoader = Thread.currentThread().getContextClassLoader();
- boolean started = false;
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- SCANodeFactory factory = SCANodeFactory.newInstance();
- node = factory.createSCANodeFromClassLoader("DomainManager.composite", getClass().getClassLoader());
- node.start();
-
- // Set the domain manager's root directory
- DomainManagerConfiguration domainManagerConfiguration = ((SCAClient) node).getService(DomainManagerConfiguration.class, "DomainManagerConfigurationComponent");
- domainManagerConfiguration.setRootDirectory(rootDirectory);
-
- started = true;
- } finally {
- if (!started) {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
- }
-
- public void stop() {
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- node.stop();
- } finally {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
- }
-
- /**
- * Constructs a new domain manager bootstrap.
- */
- public DomainManagerLauncherBootstrap(String rootDirectory) throws Exception {
- node = new NodeFacade(rootDirectory);
- }
-
- /**
- * Returns the node representing the domain manager.
- * @return
- */
- public SCANode getNode() {
- return node;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/DomainManager.composite b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/DomainManager.composite
deleted file mode 100644
index ba57ea45d1..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/DomainManager.composite
+++ /dev/null
@@ -1,281 +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:t="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- name="DomainManager">
-
- <component name="HomePage">
- <t:implementation.widget location="home.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/home"/>
- </service>
- </component>
-
- <component name="HomeGadget">
- <t:implementation.widget location="home-gadget.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/home-gadget"/>
- </service>
- </component>
-
- <component name="WorkspacePage">
- <t:implementation.widget location="workspace.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/workspace"/>
- </service>
- </component>
-
- <component name="WorkspaceGadget">
- <t:implementation.widget location="workspace-gadget.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/workspace-gadget"/>
- </service>
- <reference name="workspace" target="ContributionCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- </component>
-
- <component name="FilesPage">
- <t:implementation.widget location="files.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/files"/>
- </service>
- </component>
-
- <component name="FilesGadget">
- <t:implementation.widget location="files-gadget.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/files-gadget"/>
- </service>
- <reference name="files" target="FileCollectionComponent">
- <t:binding.atom/>
- </reference>
- </component>
-
- <component name="DomainCompositePage">
- <t:implementation.widget location="composite.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/composite"/>
- </service>
- </component>
-
- <component name="DomainCompositeGadget">
- <t:implementation.widget location="composite-gadget.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/composite-gadget"/>
- </service>
- <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- <reference name="workspace" target="ContributionCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- </component>
-
- <component name="CloudPage">
- <t:implementation.widget location="cloud.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/cloud"/>
- </service>
- </component>
-
- <component name="CloudGadget">
- <t:implementation.widget location="cloud-gadget.html"/>
- <service name="Widget">
- <t:binding.http uri="http://localhost:9990/ui/cloud-gadget"/>
- </service>
- <reference name="cloudComposite" target="CloudCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- <reference name="domainComposite" target="DomainCompositeCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- </component>
-
- <component name="ContributionCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.ContributionCollectionImpl"/>
- <property name="workspaceFile">workspace.xml</property>
- <property name="deploymentContributionDirectory">cloud</property>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/workspace" title="Contributions"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="ContributionServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.ContributionServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/contribution"/>
- </service>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="FileCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.FileCollectionImpl"/>
- <property name="directoryName">files</property>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/feed/files" title="Files"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="FileServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.FileServiceImpl"/>
- <property name="directoryName">files</property>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/files"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="DomainCompositeCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployedCompositeCollectionImpl"/>
- <property name="compositeFile">domain.composite</property>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/composite" title="Domain Composite"/>
- </service>
- <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="DeployableCompositeServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/composite-source"/>
- </service>
- <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="DeployableCompositeCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeCollectionImpl"/>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/deployable" title="Deployable Composites"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="CompositeGeneratorServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeGeneratorServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/composite-generated"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="CompositeConfigurationServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeConfigurationServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/composite-resolved"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="CloudCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployedCompositeCollectionImpl"/>
- <property name="compositeFile">cloud.composite</property>
- <property name="deploymentContributionDirectory">cloud</property>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/cloud" title="Cloud"/>
- </service>
- <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="processCollection" target="NodeProcessCollectionFacadeComponent/LocalItemCollection"/>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="CloudCompositeServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DeployableCompositeServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/cloud-source"/>
- </service>
- <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- </component>
-
- <component name="CompositeConfigurationCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.CompositeConfigurationCollectionImpl"/>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/composite-config" title="Node Configuration"/>
- </service>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="NodeConfigurationServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.NodeConfigurationServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/node-config"/>
- </service>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="QuickStartServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.QuickStartServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/quickstart"/>
- </service>
- <reference name="contributionCollection" target="ContributionCollectionComponent/LocalItemCollection"/>
- <reference name="deployableCollection" target="DeployableCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="domainCompositeCollection" target="DomainCompositeCollectionComponent/LocalItemCollection"/>
- <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
- <reference name="processCollection" target="NodeProcessCollectionComponent/LocalItemCollection"/>
- </component>
-
- <component name="NodeProcessCollectionFacadeComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.NodeProcessCollectionFacadeImpl"/>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/processes" title="Log"/>
- </service>
- <reference name="domainManagerConfiguration" target="DomainManagerConfigurationComponent"/>
- <reference name="cloudCollection" target="CloudCollectionComponent/LocalItemCollection"/>
- <reference name="processCollection" target="NodeProcessCollectionComponent/ItemCollection">
- <t:binding.atom/>
- </reference>
- </component>
-
- <component name="NodeProcessCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.node.manager.NodeProcessCollectionImpl"/>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/node/processes" title="Log"/>
- </service>
- </component>
-
- <component name="PingServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.node.manager.PingServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/ping"/>
- </service>
- </component>
-
- <component name="DomainManagerConfigurationComponent">
- <implementation.java class="org.apache.tuscany.sca.domain.manager.impl.DomainManagerConfigurationImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud-gadget.html
deleted file mode 100644
index 1936f9896c..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud-gadget.html
+++ /dev/null
@@ -1,408 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Cloud</title>
-
-<script type="text/javascript" src="../cloud-gadget/cloud-gadget.js"></script>
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="cloudComposite">
-
- <form id="cloudCompositeForm">
- <div id="composites" ></div>
- <br>
- &gt;<a href="" id="addNodeLink">Add</a>
- &nbsp;<a href="" id="deleteNodeLink">Delete</a>
- &nbsp;&nbsp;
- <a href="" id="startNodeLink">Start</a>
- &nbsp;<a href="" id="stopNodeLink">Stop</a>
- </form>
-
- <div id="newNode" style="visibility: hidden;">
- <form id="newNodeForm">
- <table width="100%">
- <tr><th>Add a Node</th></tr>
- <tr><td>Add a node to the cloud. The node will run the SCA components declared in the specified composite.</td></tr>
- </table>
- <br>
- <table>
- <tr><td>Node name:</td><td><input type="text" name="nodeName" size="50"/></td><td>e.g. YourNode</td></tr>
- <tr><td>Node URI:</td><td><input type="text" name="nodeURI" size="50"/></td></td><td>e.g. http://yourhost:8080</td></tr>
- <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td></td><td>e.g. http://your/namespace</td></tr>
- <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td></td><td>e.g. yourcomposite</td></tr>
- <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
- </table>
- <input id="addNodeButton" type="button" value="Add" />
- </form>
- </div>
-
- </div>
-</body>
-
-<script type="text/javascript">
-
- //@Reference
- var cloudComposite = new tuscany.sca.Reference("cloudComposite");
-
- //@Reference
- var domainComposite = new tuscany.sca.Reference("domainComposite");
-
- //@Reference
- var processCollection = new tuscany.sca.Reference("processCollection");
-
- var gadget = gadget(window, document);
- if (gadget.showStatus == null) {
- gadget.showStatus = true;
- }
- if (gadget.showConfigurations == null) {
- gadget.showConfigurations = true;
- }
-
- var cloudCompositeForm = elementByID(gadget, 'cloudCompositeForm');
- var compositesElement = elementByID(gadget, 'composites');
- var newNodeElement = elementByID(gadget, 'newNode');
- var newNodeForm = elementByID(gadget, 'newNodeForm');
-
- var nodeNames;
- var deployedComposites = new Array();
-
- function getNodes() {
- cloudComposite.get("", getNodesResponse);
- }
-
- function contributionURI(id) {
- var i = id.indexOf(';');
- return id.substring(10, i);
- }
-
- function compositeName(id) {
- var i = id.indexOf(';');
- return id.substring(i + 1);
- }
-
- function compositeLocalName(id) {
- name = compositeName(id);
- var i = name.indexOf(';');
- return name.substring(i + 1);
- }
-
- function getNodesResponse(feed) {
- nodeNames = new Array();
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var composites = "";
- composites += '<table width="100%">';
- composites += '<tr><th>Node</th>';
- if (gadget.showStatus) {
- composites += '<th>Status</th>';
- }
- if (gadget.showComposites) {
- composites += '<th>Composite</th>';
- }
- if (gadget.showContributions) {
- composites += '<th>Contribution</th>';
- }
- if (gadget.showConfigurations) {
- composites += '<th>Node Config</th>';
- }
- composites += '</tr>';
-
- for (var i=0; i<entries.length; i++) {
- var nodeId = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var links = entries[i].getElementsByTagName("link");
- var nodeLink = undefined;
- var compositeLink = undefined;
- var compositeId = "composite:undefined;undefined;undefined";
- var uri = '<span style="color: red">unknown</span>';
- var qname = undefined;
- for (var l = 0; l < links.length; l++) {
- var a = links[l].getAttribute('rel');
- if (a == undefined) {
- nodeLink = links[l].getAttribute('href');
- } else if (a == 'related') {
- compositeLink = links[l].getAttribute('href');
- var c = compositeLink.indexOf('composite:');
- compositeId = compositeLink.substring(c);
- uri = contributionURI(compositeId);
- qname = compositeName(compositeId);
- }
- }
-
- var nodeName = compositeLocalName(nodeId);
- nodeNames[i] = nodeName;
-
- var content = "";
- if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
- content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- }
-
- composites += '<tr>'
- if (content.indexOf('<span id="problem"') != -1) {
- composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
- '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
- if (gadget.showStatus) {
- composites += '<td><span id="status_' + nodeName + '">unknown</span></td>';
- }
- if (gadget.showComposites) {
- composites += '<td>' + content + '</td>';
- }
- if (gadget.showContributions) {
- composites += '<td>' + uri + '</td>';
- }
- } else {
- composites += '<td><input name="composites" type="checkbox" value="' + nodeId + '">' +
- '<a href=\"' + nodeLink + '\">' + nodeName + '</a></td>';
- if (gadget.showStatus) {
- composites += '<td><span id="status_' + nodeName + '">unknown</span></td>';
- }
- if (gadget.showComposites) {
- composites += '<td><a href=\"' + compositeLink + '\">' + qname + '</a></td>';
- }
- if (gadget.showContributions) {
- composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
- }
- }
- if (gadget.showConfigurations) {
- composites += '<td><a href="/node-config/' + nodeName + '"><img src="icons/feed-icon.png" border="0"></a></td>';
- }
- composites += '</tr>';
- }
- composites += '</table>';
- compositesElement.innerHTML = composites;
-
- processCollection.get("", getProcessesResponse);
- }
- }
-
- function getProcessesResponse(feed) {
- if (feed != null) {
- var nodeStatus = new Array();
-
- var entries = feed.getElementsByTagName("entry");
- for (var i=0; i<entries.length; i++) {
- var nodeName = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- nodeStatus[nodeName] = 'started';
- }
-
- if (gadget.showStatus) {
- for (var i = 0; i < nodeNames.length; i++) {
- var element = elementByID(gadget, 'status_' + nodeNames[i]);
- var nodeName = nodeNames[i];
- if (nodeStatus[nodeName] == null) {
- element.innerHTML = '<span>stopped</span>';
- } else {
- element.innerHTML = '<span><a style="color: green" href="/processes/?node=' + nodeName + '">started</a></span>';
- }
- }
- }
- }
- }
-
- function deleteNode() {
- var composites = array(cloudCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- var id = composites[i].value;
- cloudComposite.del(id, deleteNodeResponse);
- }
- }
- return false;
- }
-
- function deleteNodeResponse() {
- getNodes();
- }
-
- function addNode() {
- var nodeName = newNodeForm.nodeName.value;
- var nodeURI = newNodeForm.nodeURI.value;
- var compositeNamespace = newNodeForm.compositeNamespace.value;
- var compositeName = newNodeForm.compositeName.value;
- var contributionURI = newNodeForm.contributionURI.value;
- var id = 'composite:' +
- 'http://tuscany.apache.org/cloud' + ';' +
- 'http://tuscany.apache.org/cloud' + ';' +
- nodeName;
-
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom">\n' +
- '<id>' + id + '</id>\n' +
- '<content type="text/xml">\n' +
- '<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"\n' +
- ' xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"\n' +
- ' targetNamespace="http://tuscany.apache.org/cloud"\n' +
- ' xmlns:c="' + compositeNamespace + '"\n' +
- ' name="' + nodeName + '">\n' +
- '\n' +
- ' <component name="' + nodeName + '">\n' +
- ' <t:implementation.node uri="' + contributionURI + '" composite="c:' + compositeName + '"/>\n' +
- ' <service name="Node">\n' +
- ' <binding.ws uri="' + nodeURI + '"/>\n' +
- ' <t:binding.http uri="' + nodeURI + '"/>\n' +
- ' <t:binding.jsonrpc uri="' + nodeURI + '"/>\n' +
- ' <t:binding.atom uri="' + nodeURI + '"/>\n' +
- ' </service>\n' +
- ' </component>\n' +
- '</composite>' +
- '</content>' +
- '</entry>';
- cloudComposite.post(entry, addNodeResponse);
- }
-
- function addNodeResponse() {
- newNodeForm.nodeName.value = "";
- newNodeForm.nodeURI.value = "";
- newNodeForm.compositeNamespace.value = "";
- newNodeForm.compositeName.value = "";
- newNodeForm.contributionURI.value = "";
- getNodes();
- }
-
- function startNode() {
- var composites = array(cloudCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- var id = nodeNames[i];
-
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
- '<id>' + id + '</id>' +
- '</entry>';
- processCollection.post(entry, startNodeResponse);
- }
- }
- return false;
- }
-
- function startNodeResponse() {
- processCollection.get("", getProcessesResponse);
-
- var composites = array(cloudCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- composites[i].checked = false;
- }
- }
- }
-
- function stopNode() {
- var composites = array(cloudCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- var id = nodeNames[i];
- processCollection.del(id, stopNodeResponse);
- }
- }
- return false;
- }
-
- function stopNodeResponse() {
- processCollection.get("", getProcessesResponse);
-
- var composites = array(cloudCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- composites[i].checked = false;
- }
- }
- }
-
- function getComposites() {
- domainComposite.get("", getCompositesResponse);
- }
-
- function getCompositesResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- for (var i=0; i<entries.length; i++) {
- var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- deployedComposites[id] = id;
- }
- }
- }
-
- function suggestCompositeNamespaces() {
- var namespaces = new Array();
- for (var uri in deployedComposites) {
- var qname = compositeName(uri);
- var ns = qname.substring(0, qname.indexOf(';'));
- namespaces[ns] = ns;
- }
- return array(namespaces);
- }
-
- function suggestCompositeNames() {
- var inputns = newNodeForm.compositeNamespace.value;
- var names = new Array();
- for (var uri in deployedComposites) {
- var qname = compositeName(uri);
- var sc = qname.indexOf(';');
- var ns = qname.substring(0, sc);
- var name = qname.substring(sc + 1);
- if (ns == inputns || inputns == "") {
- names[name] = name;
- }
- }
- return array(names);
- }
-
- function suggestContributionURIs() {
- var inputns = newNodeForm.compositeNamespace.value;
- var inputname = newNodeForm.compositeName.value;
- var uris = new Array();
- for (var uri in deployedComposites) {
- var qname = compositeName(uri);
- var sc = qname.indexOf(';');
- var ns = qname.substring(0, sc);
- var name = qname.substring(sc + 1);
- if ((ns == inputns || inputns == "") && (name == inputname || inputname == "")) {
- var curi = contributionURI(uri);
- uris[curi] = curi;
- }
- }
- return array(uris);
- }
-
- function toggleNewNode() {
- var visibility = newNodeElement.style.visibility;
- if (visibility == 'hidden') {
- newNodeElement.style.visibility = 'visible';
- } else {
- newNodeElement.style.visibility = 'hidden';
- }
- return false;
- }
-
- elementByID(gadget, 'deleteNodeLink').onclick = deleteNode;
- elementByID(gadget, 'addNodeLink').onclick = toggleNewNode;
- elementByID(gadget, 'startNodeLink').onclick = startNode;
- elementByID(gadget, 'stopNodeLink').onclick = stopNode;
- elementByID(gadget, 'addNodeButton').onclick = addNode;
-
- getNodes();
- getComposites();
- suggest(newNodeForm.compositeNamespace, suggestCompositeNamespaces);
- suggest(newNodeForm.compositeName, suggestCompositeNames);
- suggest(newNodeForm.contributionURI, suggestContributionURIs);
-
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud.html
deleted file mode 100644
index d661d5d38b..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/cloud.html
+++ /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.
--->
-<html>
-<head>
-<title>SCA Domain - Cloud</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbarGadgetDiv"></div>
- <br>
-
- <span class=hd1>
- SCA Domain<br><br>
- Cloud</b>&nbsp;<a href="/cloud/"><img src="icons/feed-icon.png" border="0"></a>
- </span>
- <br>
- Here is the list of SCA nodes configured in your SCA domain cloud.
- <br><br>
-
- <div id="cloudGadgetDiv"></div>
-
- <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe>
- <iframe id="cloudGadget" src="cloud-gadget.html"></iframe>
-</body>
-
-<script type="text/javascript">
- var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv');
- var cloudGadgetDiv = elementByID(document, 'cloudGadgetDiv');
-
- var toolbarGadget = elementByID(document, 'toolbarGadget');
- var cloudGadget = elementByID(document, 'cloudGadget');
-
- function ongadget(win, doc) {
- if (doc == content(toolbarGadget)) {
- toolbarGadgetDiv.innerHTML = doc.body.innerHTML;
- return toolbarGadgetDiv;
- } else if (doc == content(cloudGadget)) {
- cloudGadgetDiv.innerHTML = doc.body.innerHTML;
- cloudGadgetDiv.showStatus = true;
- cloudGadgetDiv.showComposites = true;
- cloudGadgetDiv.showContributions = true;
- cloudGadgetDiv.showConfigurations = true;
- return cloudGadgetDiv;
- }
- return document;
- }
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite-gadget.html
deleted file mode 100644
index ce1039d9e5..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite-gadget.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Domain Composite</title>
-
-<script type="text/javascript" src="../composite-gadget/composite-gadget.js"></script>
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="domainComposite">
-
- <form id="domainCompositeForm">
- <div id="composites" ></div>
- <br>
- &gt;<a href="" id="addCompositeLink">Add</a>
- &nbsp;<a href="" id="deleteCompositeLink">Delete</a>
- </form>
-
- <div id="newComposite" style="visibility: hidden;">
- <form id="newCompositeForm">
- <table width="100%">
- <tr><th>Add Composite</th></tr>
- <tr><td>Add an SCA composite describing your SCA service components.</td></tr>
- </table>
- <br>
- <table>
- <tr><td>Composite namespace:</td><td><input type="text" name="compositeNamespace" size="50"/></td><td>e.g. http://your/namespace</td></tr>
- <tr><td>Composite name:</td><td><input type="text" name="compositeName" size="50"/></td><td>e.g. yourcomposite</td></tr>
- <tr><td>Contribution URI:</td><td><input type="text" name="contributionURI" size="50"/></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
- </table>
- <input id="addCompositeButton" type="button" value="Add" />
- </form>
- </div>
-
- </div>
-</body>
-
-<script type="text/javascript">
- //@Reference
- var domainComposite = new tuscany.sca.Reference("domainComposite");
-
- //@Reference
- var workspace = new tuscany.sca.Reference("workspace");
-
- var gadget = gadget(window, document);
- if (gadget.showContributions == null) {
- gadget.showContributions = true;
- }
-
- var domainCompositeForm = elementByID(gadget, 'domainCompositeForm');
- var compositesElement = elementByID(gadget, 'composites');
- var newCompositeElement = elementByID(gadget, 'newComposite');
- var newCompositeForm = elementByID(gadget, 'newCompositeForm');
-
- var contributedComposites = new Array();
-
- function getComposites() {
- domainComposite.get("", getCompositesResponse);
- }
-
- function contributionURI(id) {
- var i = id.indexOf(';');
- return id.substring(10, i);
- }
-
- function compositeName(id) {
- var i = id.indexOf(';');
- return id.substring(i + 1);
- }
-
- function getCompositesResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var composites = "";
- composites += '<table width="100%">';
- composites += '<tr><th>Composite</th>';
- if (gadget.showContributions) {
- composites += '<th>Contribution</th>';
- }
- if (gadget.showComponents) {
- composites += '<th>Components</th>';
- }
- composites += '</tr>';
- //'<th>Composite Configuration</th>' +
-
- for (var i=0; i<entries.length; i++) {
- var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var link = entries[i].getElementsByTagName("link")[0].getAttribute("href");
- var uri = contributionURI(id);
- var qname = compositeName(id);
-
- var content = "";
- if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
- content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- }
- var components = '';
- var bs = content.indexOf('<span id="components">');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- components = content.substring(bs, es + 7);
- } else {
- bs = content.indexOf('<span id="problem"');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- components = content.substring(bs, es + 7);
- }
- }
-
- composites += '<tr>'
- composites += '<td><input name="composites" type="checkbox" value="' + id + '">';
- composites += '<a href=\"' + link + '\">' + qname + '</a></td>';
- if (gadget.showContributions) {
- composites += '<td><a href="/contribution/' + uri + '">' + uri + '</a></td>';
- }
- if (gadget.showComponents) {
- composites += '<td class=tdw>' + components + '</td>';
- }
- //composites += '<td><a href="/composite-config/?composite=' + id + '"><img src="icons/feed-icon.png" border="0"></a></td>';
- composites += '</tr>';
- }
- composites += '</table>';
- compositesElement.innerHTML = composites;
- }
- }
-
- function deleteComposite() {
- var composites = array(domainCompositeForm.composites);
- for (var i = 0; i < composites.length; i++) {
- if (composites[i].checked) {
- var id = composites[i].value;
- domainComposite.del(id, deleteCompositeResponse);
- }
- }
- return false;
- }
-
- function deleteCompositeResponse() {
- getComposites();
- }
-
- function addComposite() {
- var id = 'composite:' +
- newCompositeForm.contributionURI.value + ';' +
- newCompositeForm.compositeNamespace.value + ';' +
- newCompositeForm.compositeName.value;
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
- '<title>' + id +'</title>' +
- '<id>' + id + '</id>' +
- '</entry>';
- domainComposite.post(entry, addCompositeResponse);
- }
-
- function addCompositeResponse() {
- newCompositeForm.compositeNamespace.value = "";
- newCompositeForm.compositeName.value = "";
- newCompositeForm.contributionURI.value = "";
- getComposites();
- }
-
- function getContributions() {
- workspace.get("", getContributionsResponse);
- }
-
- function getContributionsResponse(feed) {
- if (feed != null) {
- contributedComposites = new Array();
- var entries = feed.getElementsByTagName("entry");
- for (var i=0; i<entries.length; i++) {
- if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
- var content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- var bs = content.indexOf('<span id="deployables">');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- content = content.substring(bs, es + 7);
- for (;;) {
- var bc = content.indexOf('composite:');
- if (bc == -1) {
- break;
- }
- var ec = content.indexOf('">', bc);
- if (ec == -1) {
- break;
- }
- var uri = content.substring(bc, ec);
- contributedComposites[uri] = uri;
- content = content.substring(ec +1);
- }
- }
- }
- }
- }
- }
-
- function suggestCompositeNamespaces() {
- var namespaces = new Array();
- for (var uri in contributedComposites) {
- var qname = compositeName(uri);
- var ns = qname.substring(0, qname.indexOf(';'));
- namespaces[ns] = ns;
- }
- return array(namespaces);
- }
-
- function suggestCompositeNames() {
- var inputns = newCompositeForm.compositeNamespace.value;
- var names = new Array();
- for (var uri in contributedComposites) {
- var qname = compositeName(uri);
- var sc = qname.indexOf(';');
- var ns = qname.substring(0, sc);
- var name = qname.substring(sc + 1);
- if (ns == inputns || inputns == "") {
- names[name] = name;
- }
- }
- return array(names);
- }
-
- function suggestContributionURIs() {
- var inputns = newCompositeForm.compositeNamespace.value;
- var inputname = newCompositeForm.compositeName.value;
- var uris = new Array();
- for (var uri in contributedComposites) {
- var qname = compositeName(uri);
- var sc = qname.indexOf(';');
- var ns = qname.substring(0, sc);
- var name = qname.substring(sc + 1);
- if ((ns == inputns || inputns == "") && (name == inputname || inputname == "")) {
- var curi = contributionURI(uri);
- uris[curi] = curi;
- }
- }
- return array(uris);
- }
-
- function toggleNewComposite() {
- var visibility = newCompositeElement.style.visibility;
- if (visibility == 'hidden') {
- newCompositeElement.style.visibility = 'visible';
- } else {
- newCompositeElement.style.visibility = 'hidden';
- }
- return false;
- }
-
- elementByID(gadget, 'deleteCompositeLink').onclick = deleteComposite;
- elementByID(gadget, 'addCompositeLink').onclick = toggleNewComposite;
- elementByID(gadget, 'addCompositeButton').onclick = addComposite;
-
- getComposites();
- getContributions();
- suggest(newCompositeForm.compositeNamespace, suggestCompositeNamespaces);
- suggest(newCompositeForm.compositeName, suggestCompositeNames);
- suggest(newCompositeForm.contributionURI, suggestContributionURIs);
-
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite.html
deleted file mode 100644
index b0631e1d66..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/composite.html
+++ /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.
--->
-<html>
-<head>
-<title>SCA Domain - Domain Composite</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbarGadgetDiv"></div>
- <br>
-
- <span class=hd1>
- SCA Domain<br><br>
- Domain Composite&nbsp;<a href="/composite/"><img src="icons/feed-icon.png" border="0"></a>
- </span>
- <br>
- Here is the list of SCA composites currently included as top-level composites in your SCA domain.
- <br><br>
-
- <div id="compositeGadgetDiv"></div>
-
- <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe>
- <iframe id="compositeGadget" src="composite-gadget.html"></iframe>
-</body>
-
-<script type="text/javascript">
- var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv');
- var compositeGadgetDiv = elementByID(document, 'compositeGadgetDiv');
-
- var toolbarGadget = elementByID(document, 'toolbarGadget');
- var compositeGadget = elementByID(document, 'compositeGadget');
-
- function ongadget(win, doc) {
- if (doc == content(toolbarGadget)) {
- toolbarGadgetDiv.innerHTML = doc.body.innerHTML;
- return toolbarGadgetDiv;
- } else if (doc == content(compositeGadget)) {
- compositeGadgetDiv.innerHTML = doc.body.innerHTML;
- compositeGadgetDiv.showContributions = true;
- compositeGadgetDiv.showComponents = true;
- return compositeGadgetDiv;
- }
- return document;
- }
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files-gadget.html
deleted file mode 100644
index 7ddc923223..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files-gadget.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Contribution File Server</title>
-
-<script type="text/javascript" src="../files-gadget/files-gadget.js"></script>
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="fileServer">
-
- <form id="filesForm">
- <div id="files" ></div>
- <br>
- &gt;<a href="" id="uploadFileLink">Upload</a>
- &nbsp;<a href="" id="deleteFileLink">Delete</a>
- </form>
-
- <div id="uploadFile" style="visibility: hidden;">
- <form method="post" id="uploadFileForm" enctype='multipart/form-data' action='/files'>
- <table width="100%">
- <tr><th>Upload File</th></tr>
- <tr><td>Upload a file to the server.</td></tr>
- </table>
- <br>
- <table border="0">
- <tr><td>File:</td><td><input type="file" name="file" size="50"/></td></tr>
- </table>
- <br/>
- <input id="uploadFileButton" type="button" value="Upload" />
- </form>
- </div>
-
- </div>
-</body>
-
-<script type="text/javascript">
- //@Reference
- var files = new tuscany.sca.Reference("files");
-
- var gadget = gadget(window, document);
-
- var filesForm = elementByID(gadget, "filesForm");
- var filesElement = elementByID(gadget, 'files');
- var uploadFileElement = elementByID(gadget, 'uploadFile');
- var uploadFileForm = elementByID(gadget, 'uploadFileForm');
-
- function getFiles() {
- files.get("", getFilesResponse);
- }
-
- function getFilesResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var list = '<table width="100%"><tr><th>Files</th></tr>';
- for (var i=0; i<entries.length; i++) {
- var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
- list += '<tr><td><input name="files" type="checkbox" value="' + id + '">' +
- '<a href=\"' + location + '\">' + id + '</a></td></tr>';
- }
- list += "</table>";
- filesElement.innerHTML = list;
- }
- }
-
- function deleteFile() {
- var list = array(filesForm.files);
- for (var i=0; i < list.length; i++) {
- if (list[i].checked) {
- var id = list[i].value;
- files.del(id, deleteFileResponse);
- }
- }
- return false;
- }
-
- function deleteFileResponse() {
- getFiles();
- }
-
- function uploadFile() {
- uploadFileForm.submit();
- return false;
- }
-
- function toggleUploadFile() {
- var visibility = uploadFileElement.style.visibility;
- if (visibility == 'hidden') {
- uploadFileElement.style.visibility = 'visible';
- } else {
- uploadFileElement.style.visibility = 'hidden';
- }
- return false;
- }
-
- elementByID(gadget, 'deleteFileLink').onclick = deleteFile;
- elementByID(gadget, 'uploadFileLink').onclick = toggleUploadFile;
- elementByID(gadget, 'uploadFileButton').onclick = uploadFile;
-
- getFiles();
-
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files.html
deleted file mode 100644
index 37d89e7665..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/files.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Contribution File Server</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbarGadgetDiv"></div>
- <br>
-
- <span class=hd1>
- SCA Domain<br><br>
- File Server&nbsp;<a href="/feed/files/"><img src="icons/feed-icon.png" border="0"></a>
- </span>
- <br>
- This is a simple ATOM-based file server useful to share files if you don't have an FTP, SVN or Maven repository.
- <br><br>
-
- <div id="filesGadgetDiv"></div>
-
- <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe>
- <iframe id="filesGadget" src="files-gadget.html"></iframe>
-</body>
-
-<script type="text/javascript">
- var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv');
- var filesGadgetDiv = elementByID(document, 'filesGadgetDiv');
-
- var toolbarGadget = elementByID(document, 'toolbarGadget');
- var filesGadget = elementByID(document, 'filesGadget');
-
- function ongadget(win, doc) {
- if (doc == content(toolbarGadget)) {
- toolbarGadgetDiv.innerHTML = doc.body.innerHTML;
- return toolbarGadgetDiv;
- } else if (doc == content(filesGadget)) {
- filesGadgetDiv.innerHTML = doc.body.innerHTML;
- return filesGadgetDiv;
- }
- return document;
- }
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home-gadget.html
deleted file mode 100644
index 05e262e4df..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home-gadget.html
+++ /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.
--->
-<html>
-<head>
-<title>SCA Domain - Home</title>
-
-<script type="text/javascript" src="../home-gadget/home-gadget.js"></script>
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="home">
-
- <form>
- <table border="0" align="center">
- <tr><td valign="top"><span style="font-size:150%; color: blue">Search:</span></td><td><input type="text" name="search" size="50"/></td></tr>
- <tr><td></td><td align="center"><input type="button" name="search" value="Search" /></td></tr>
- </table>
- </form>
-
- </div>
-</body>
-
-<script type="text/javascript">
- var gadget = gadget(window, document);
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home.html
deleted file mode 100644
index aad1856621..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/home.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Home</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbarGadgetDiv"></div>
- <br>
-
- <span class=hd1>
- SCA Domain
- </span>
- <br><br><br><br><br><br>
-
- <div id="homeGadgetDiv"></div>
-
- <br><br><br><br><br><br><br>
- <center>This page is under construction, searching the domain is not implemented yet.</center>
-
- <iframe id="toolbarGadget" src="toolbar-gadget.html" style="visibility: hidden;"></iframe>
- <iframe id="homeGadget" src="home-gadget.html" style="visibility: hidden;"></iframe>
-</body>
-
-<script type="text/javascript">
- var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv');
- var homeGadgetDiv = elementByID(document, 'homeGadgetDiv');
-
- var toolbarGadget = elementByID(document, 'toolbarGadget');
- var homeGadget = elementByID(document, 'homeGadget');
-
- function ongadget(win, doc) {
- if (doc == content(toolbarGadget)) {
- toolbarGadgetDiv.innerHTML = doc.body.innerHTML;
- return toolbarGadgetDiv;
- } else if (doc == content(homeGadget)) {
- homeGadgetDiv.innerHTML = doc.body.innerHTML;
- return homeGadgetDiv;
- }
- return document;
- }
-</script>
-
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/icons/feed-icon.png b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/icons/feed-icon.png
deleted file mode 100644
index a59728b2ad..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/icons/feed-icon.png
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/manager.css b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/manager.css
deleted file mode 100644
index e080ff1d87..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/manager.css
+++ /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.
- */
-
-body {
- white-space: nowrap; margin: 2px;
-}
-
-table {
- border: 1px; border-collapse: separate
-}
-
-th {
- font-weight: bold; white-space: nowrap; background-color: #e5ecf9; color: #598edd;
- text-align: left; padding-left: 2px; padding-right: 20px; padding-top: 2px; padding-bottom: 2px; vertical-align: text-top;
- border-top: 1px; border-bottom: 1px; border-left: 0px; border-right: 0px;
- border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4
-}
-
-td {
- padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: nowrap; vertical-align: text-top
-}
-
-iframe {
- visibility: hidden;
-}
-
-input {
- vertical-align: middle
-}
-
-a:link {
- color: blue
-}
-
-a:visited {
- color: blue
-}
-
-.tdw {
- padding-left: 2px; padding-top: 2px; padding-right: 20px; white-space: normal; vertical-align: text-top
-}
-
-.hd1 {
- font-size:150%; font-weight: bold
-}
-
-.tbar {
- margin: 0px;
- padding-top: 0px; padding-left: 0px; padding-right: 0px; padding-bottom: 3px;
- border-bottom: 1px solid #a2bae7
-}
-
-.ltbar {
- padding-left: 0px; padding-top: 0px; padding-right: 20px; white-space: nowrap; vertical-align: top
-}
-
-.rtbar {
- padding-left: 0px; padding-right: 0px; padding-top: 0px; white-space: nowrap; vertical-align: top;
- text-align: right
-}
-
-.suggest {
- background-color: #e5ecf9; color: #598edd;
- border-top: 1px; border-bottom: 1px; border-left: 1px; border-right: 1px;
- border-style: solid; border-top-color: #a2bae7; border-bottom-color: #d1d3d4;
- border-left-color: #d1d3d4; border-right-color: #d1d3d4;
- position: absolute;
- overflow: auto; overflow-x: hidden;
- cursor: default;
- padding: 0px; margin: 0px;
-}
-
-suggestTable {
- border: 0px; border-collapse: separate;
- padding-left: 5px; padding-right: 5px; padding-top: 2px; padding-bottom: 2px;
- margin: 0px;
-}
-
-.suggestItem {
- padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; white-space: nowrap; vertical-align: text-top;
- background-color: #e5ecf9; color: #598edd;
-}
-
-.suggestHilighted {
- padding-left: 2px; padding-top: 0px; padding-bottom: 0px; padding-right: 2px; white-space: nowrap; vertical-align: text-top;
- background-color: #598edd; color: #e5ecf9;
-}
-
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/toolbar-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/toolbar-gadget.html
deleted file mode 100644
index c9389affc3..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/toolbar-gadget.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Toolbar</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbar"></div>
-</body>
-
-<script type="text/javascript">
- var gadget = gadget(window, document);
-
- var tools = new Array();
- tools[0] = new Tool("Contributions", "../workspace");
- tools[1] = new Tool("Composites", "../composite");
- tools[2] = new Tool("Cloud", "../cloud");
- tools[3] = new Tool("Files", "../files");
-
- var home = new Tool("Home", "../home");
-
- var toolbarDiv = elementByID(gadget, 'toolbar');
- toolbarDiv.innerHTML = toolbar(home, tools);
-
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/utils.js b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/utils.js
deleted file mode 100644
index 77ed807e85..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/utils.js
+++ /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.
- */
-
-/**
- * Autocomplete / suggest support for input fields
- *
- * To use it declare a 'suggest' function as follows:
- * function suggestItems() {
- * return new Array('abc', 'def', 'ghi');
- * }
- *
- * then hook it to an input field as follows:
- * suggest(document.yourForm.yourInputField, suggestItems);
- */
-function selectSuggestion(node, value) {
- for (;;) {
- node = node.parentNode;
- if (node.tagName.toLowerCase() == 'div') {
- break;
- }
- }
- node.selectSuggestion(value);
-}
-
-function hilightSuggestion(node, over) {
- if (over) {
- node.className = 'suggestHilighted';
- } else {
- node.className = 'suggestItem';
- }
-}
-
-function suggest(input, suggestFunction) {
-
- input.suggest = suggestFunction;
-
- input.selectSuggestion = function(value) {
- this.hideSuggestDiv();
- this.value = value;
- }
-
- input.hideSuggestDiv = function() {
- if (this.suggestDiv != null) {
- this.suggestDiv.style.visibility = 'hidden';
- }
- }
-
- input.showSuggestDiv = function() {
- if (this.suggestDiv == null) {
- this.suggestDiv = document.createElement('div');
- this.suggestDiv.input = this;
- this.suggestDiv.className = 'suggest';
- input.parentNode.insertBefore(this.suggestDiv, input);
- this.suggestDiv.style.visibility = 'hidden';
- this.suggestDiv.style.zIndex = '99';
-
- this.suggestDiv.selectSuggestion = function(value) {
- this.input.selectSuggestion(value);
- }
- }
-
- var values = this.suggest();
- var items = "";
- for (var i = 0; i < values.length; i++) {
- if (values[i].indexOf(this.value) == -1) {
- continue;
- }
- if (items.length == 0) {
- items += '<table class=suggestTable>';
- }
- items += '<tr><td class="suggestItem" ' +
- 'onmouseover="hilightSuggestion(this, true)" onmouseout="hilightSuggestion(this, false)" ' +
- 'onmousedown="selectSuggestion(this, \'' + values[i] + '\')">' + values[i] + '</td></tr>';
- }
- if (items.length != 0) {
- items += '</table>';
- }
- this.suggestDiv.innerHTML = items;
-
- if (items.length != 0) {
- var node = input;
- var left = 0;
- var top = 0;
- for (;;) {
- left += node.offsetLeft;
- top += node.offsetTop;
- node = node.offsetParent;
- if (node.tagName.toLowerCase() == 'body') {
- break;
- }
- }
- this.suggestDiv.style.left = left;
- this.suggestDiv.style.top = top + input.offsetHeight;
- this.suggestDiv.style.visibility = 'visible';
- } else {
- this.suggestDiv.style.visibility = 'hidden';
- }
- }
-
- input.onkeydown = function(event) {
- this.showSuggestDiv();
- };
-
- input.onkeyup = function(event) {
- this.showSuggestDiv();
- };
-
- input.onmousedown = function(event) {
- this.showSuggestDiv();
- };
-
- input.onblur = function(event) {
- setTimeout(function() { input.hideSuggestDiv(); }, 50);
- };
-}
-
-/**
- * A Toolbar class
- */
-function Tool(name, href) {
- this.name = name;
- this.href = href;
-}
-
-Tool.prototype.print = function() {
- var loc = '' + location;
- if (loc.match(this.href) == null) {
- return '<a href="' + this.href + '" target="_parent">' + this.name + '</a>';
- } else {
- return '<span>' + this.name + '</span>';
- }
-}
-
-/**
- * Initialize the toolbar
- */
-function toolbar(home, tools) {
- var toolbar = '<table width="100%" cellpadding="0" cellspacing="0" class=tbar><tr>' +
- '<td class=ltbar><table border="0" cellspacing="0" cellpadding="0"><tr>';
-
- for (var i = 0; i < tools.length; i++) {
- toolbar = toolbar + '<td class=ltbar>' +tools[i].print() + '</td>'
- }
-
- toolbar = toolbar + '</tr></table></td>' +
- '<td class=rtbar><table border="0" cellpadding="0" cellspacing="0" align="right"><tr>' +
- '<td class=rtbar>' + home.print() + '</td></tr></table></td>' +
- '</tr></table>';
-
- return toolbar;
-}
-
-/**
- * Return an non-sparse array from an array or an object.
- */
-function array(obj) {
- if (obj.length == undefined) {
- var a = new Array();
- a[0] = obj;
- return a;
- }
- else {
- var a = new Array();
- var n = 0;
- for (var i in obj) {
- a[n++] = obj[i];
- }
- return a;
- }
-}
-
-/**
- * Dump a Javascript object to the console
- */
-function dump(o) {
- for (f in o) {
- try {
- console.log(f + '=' + o[f]);
- } catch (e) {}
- }
-}
-
-/**
- * Return the content document of the given window.
- */
-function content(win) {
- if (win.document != 'undefined' && win.document != null) {
- return win.document;
- } else if (win.contentDocument != 'undefined' && win.contentDocument != null) {
- return win.contentDocument;
- } else {
- return null;
- }
-}
-
-/**
- * Returns a child element with the given id.
- */
-function elementByID(node, id) {
- for (var i in node.childNodes) {
- var child = node.childNodes[i];
- if (child.id == id) {
- return child;
- } else {
- child = elementByID(child, id);
- if (child != null) {
- return child;
- }
- }
- }
- return null;
-}
-
-/**
- * Install a gadget.
- */
-function gadget(win, doc) {
- var ongadget = null;
- try {
- if (win.parent.ongadget != null && win.parent.ongadget != 'undefined') {
- ongadget = win.parent.ongadget;
- }
- } catch (e) {
- }
- if (ongadget != null) {
- return ongadget(win, doc);
- } else {
- return doc;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace-gadget.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace-gadget.html
deleted file mode 100644
index 3b8a32c940..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace-gadget.html
+++ /dev/null
@@ -1,232 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Contributions</title>
-
-<script type="text/javascript" src="../workspace-gadget/workspace-gadget.js"></script>
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="workspace">
-
- <form id="workspaceForm">
- <div id="contributions" ></div>
- <br>
- &gt;<a href="" id="addContributionLink">Add</a>
- &nbsp;<a href="" id="deleteContributionLink">Delete</a>
- </form>
-
- <div id="newContribution" style="visibility: hidden;">
- <form id="newContributionForm">
- <table width="100%">
- <tr><th>Add Contribution</th></tr>
- <tr><td>Add an SCA contribution containing your application artifacts to the SCA domain.</td></tr>
- </table>
- <br>
- <table>
- <tr><td>Contribution URI:</td><td><input type="text" name="contributionID" size="50"/></td></td><td>e.g. yourcontrib, http://yourcontrib</td></tr>
- <tr><td>Location:</td><td><input type="text" name="contributionLocation" size="50"/></td></td><td>e.g. http://host/yourjar.jar, file:/yourdir, file:/yourjar.jar</td></tr>
- </table>
- <input id="addContributionButton" type="button" value="Add" />
- </form>
- </div>
-
- </div>
-</body>
-
-<script type="text/javascript">
-
- //@Reference
- var workspace = new tuscany.sca.Reference("workspace");
-
- var gadget = gadget(window, document);
- if (gadget.showDependencies == null) {
- gadget.showDependencies = true;
- }
-
- var workspaceForm = elementByID(gadget, 'workspaceForm');
- var contributionsElement = elementByID(gadget, 'contributions');
- var newContributionElement = elementByID(gadget, 'newContribution');
- var newContributionForm = elementByID(gadget, 'newContributionForm');
-
- var suggestedContributions = new Array();
-
- function getContributions() {
- workspace.get("", getContributionsResponse);
- }
-
- function getContributionsResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var contributions = "";
- contributions += '<table width="100%">';
- contributions += '<tr><th>Contribution</th>';
- if (gadget.showDependencies) {
- contributions += '<th>Dependencies</td>';
- }
- if (gadget.showDeployables) {
- contributions += '<th>Deployable Composites</th>';
- }
- contributions += '</tr>';
- for (var i=0; i<entries.length; i++) {
- var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var location = entries[i].getElementsByTagName("link")[0].getAttribute("href");
- var content = '';
- if (entries[i].getElementsByTagName("content")[0].firstChild != null) {
- content = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- }
-
- contributions += '<tr>';
- contributions += '<td><input name="contributions" type="checkbox" value="' + id + '">' +
- '<a href=\"' + location + '\">' + id + '</a></td>';
-
- var dependencies = '';
- var bs = content.indexOf('<span id="dependencies">');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- dependencies = content.substring(bs, es + 7);
- }
-
- var deployables = '';
- var bs = content.indexOf('<span id="deployables">');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- deployables = content.substring(bs, es + 7);
- }
-
- var problems = "";
- var bs = content.indexOf('<span id="problems" ');
- if (bs != -1) {
- var es = content.indexOf('</span>', bs);
- if (dependencies.length != 0) {
- problems = '<br>';
- }
- problems += content.substring(bs, es + 7);
- }
-
- if (gadget.showDependencies) {
- contributions += '<td class=tdw>' + dependencies + problems + ' </td>';
- }
- if (gadget.showDeployables) {
- contributions += '<td class=tdw>' + deployables + '</td>';
- }
- contributions += '</tr>';
- }
- contributions += '</table>';
- contributionsElement.innerHTML = contributions;
- }
- }
-
- function getSuggestedContributions() {
- workspace.get("?suggestions=true", getSuggestedContributionsResponse);
- }
-
- function getSuggestedContributionsResponse(feed) {
- suggestedContributions = new Array();
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- for (var i=0; i<entries.length; i++) {
- var id = entries[i].getElementsByTagName("id")[0].firstChild.nodeValue;
- var location = entries[i].getElementsByTagName("link")[1].getAttribute("href");
- suggestedContributions[i] = id + ':' + location;
- }
- }
- }
-
- function deleteContribution() {
- var contributions = array(workspaceForm.contributions);
- for (var i=0; i < contributions.length; i++) {
- if (contributions[i].checked) {
- var id = contributions[i].value;
- alert("hey " + id);
- workspace.del(id, deleteContributionResponse);
- }
- }
- return false;
- }
-
- function deleteContributionResponse() {
- getContributions();
- }
-
- function addContribution() {
- var id = newContributionForm.contributionID.value;
- var location = newContributionForm.contributionLocation.value;
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom">' +
- '<title>Contribution - ' + id +'</title>' +
- '<id>' + id + '</id>' +
- '<link href="' + location + '" />' +
- '</entry>';
- workspace.post(entry, addContributionResponse);
- }
-
- function addContributionResponse() {
- newContributionForm.contributionID.value = "";
- newContributionForm.contributionLocation.value = "";
- getContributions();
- }
-
- function suggestContributionIDs() {
- var ids = new Array();
- for (var i=0; i<suggestedContributions.length; i++) {
- var uri = suggestedContributions[i];
- var id = uri.substring(0, uri.indexOf(':'));
- ids[id] = id;
- }
- return array(ids);
- }
-
- function suggestContributionLocations() {
- var locations = new Array();
- for (var i=0; i<suggestedContributions.length; i++) {
- var uri = suggestedContributions[i];
- var id = uri.substring(0, uri.indexOf(':'));
- if (id == newContributionForm.contributionID.value) {
- var location = uri.substring(uri.indexOf(':') +1);
- locations[location] = location;
- }
- }
- return array(locations);
- }
-
- function toggleNewContribution() {
- var visibility = newContributionElement.style.visibility;
- if (visibility == 'hidden') {
- newContributionElement.style.visibility = 'visible';
- } else {
- newContributionElement.style.visibility = 'hidden';
- }
- return false;
- }
-
- elementByID(gadget, 'deleteContributionLink').onclick = deleteContribution;
- elementByID(gadget, 'addContributionLink').onclick = toggleNewContribution;
- elementByID(gadget, 'addContributionButton').onclick = addContribution;
-
- getContributions();
- getSuggestedContributions();
- suggest(newContributionForm.contributionID, suggestContributionIDs);
- suggest(newContributionForm.contributionLocation, suggestContributionLocations);
-
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace.html b/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace.html
deleted file mode 100644
index 36c02ab1e6..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/main/resources/workspace.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>SCA Domain - Contributions</title>
-
-<script type="text/javascript" src="utils.js"></script>
-
-<link rel="stylesheet" type="text/css" href="manager.css">
-</head>
-
-<body>
- <div id="toolbarGadgetDiv"></div>
- <br>
-
- <span class=hd1>
- SCA Domain<br><br>
- Contributions</b>&nbsp;<a href="/workspace/"><img src="icons/feed-icon.png" border="0"></a> </span>
- <br>
- Here is the list of SCA contributions currently available in your SCA domain.
- <br><br>
-
- <div id="workspaceGadgetDiv"></div>
-
- <iframe id="toolbarGadget" src="toolbar-gadget.html"></iframe>
- <iframe id="workspaceGadget" src="workspace-gadget.html"></iframe>
-</body>
-
-<script type="text/javascript">
- var toolbarGadgetDiv = elementByID(document, 'toolbarGadgetDiv');
- var workspaceGadgetDiv = elementByID(document, 'workspaceGadgetDiv');
-
- var toolbarGadget = elementByID(document, 'toolbarGadget');
- var workspaceGadget = elementByID(document, 'workspaceGadget');
-
- function ongadget(win, doc) {
- if (doc == content(toolbarGadget)) {
- toolbarGadgetDiv.innerHTML = doc.body.innerHTML;
- return toolbarGadgetDiv;
- } else if (doc == content(workspaceGadget)) {
- workspaceGadgetDiv.innerHTML = doc.body.innerHTML;
- workspaceGadgetDiv.showDependencies = true;
- workspaceGadgetDiv.showDeployables = true;
- return workspaceGadgetDiv;
- }
- return document;
- }
-</script>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java b/branches/sca-java-1.5.1/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
deleted file mode 100644
index 5e76556a14..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/test/java/org/apache/tuscany/sca/domain/manager/impl/DomainManagerTestCase.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain.manager.impl;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-
-/**
- * Test case for the workspace admin services.
- *
- * @version $Rev$ $Date$
- */
-public class DomainManagerTestCase extends TestCase {
-
- private ContributionCollectionImpl contributionCollection;
- private DeployableCompositeCollectionImpl deployableCollection;
- private DomainManagerConfigurationImpl domainManagerConfiguration;
-
- private static final String WORKSPACE_XML =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\" " +
- "xmlns:ns1=\"http://tuscany.apache.org/xmlns/sca/1.0\">\n" +
- "</workspace>";
-
- @Override
- protected void setUp() throws Exception {
- ClassLoader cl = getClass().getClassLoader();
-
- // Make sure we start with a clean workspace.xml file
- URL url = cl.getResource("workspace.xml");
- FileOutputStream os = new FileOutputStream(new File(url.toURI()));
- Writer writer = new OutputStreamWriter(os);
- writer.write(WORKSPACE_XML);
- writer.flush();
- writer.close();
-
- // Create a workspace collection component
- domainManagerConfiguration = new DomainManagerConfigurationImpl();
- domainManagerConfiguration.initialize();
- String root = url.getFile();
- root = root.substring(0, root.lastIndexOf('/'));
- domainManagerConfiguration.setRootDirectory(root);
-
- contributionCollection = new ContributionCollectionImpl();
- contributionCollection.domainManagerConfiguration = domainManagerConfiguration;
- contributionCollection.workspaceFile = "workspace.xml";
- contributionCollection.deploymentContributionDirectory = "cloud";
- contributionCollection.domainManagerConfiguration = domainManagerConfiguration;
- deployableCollection = new DeployableCompositeCollectionImpl();
- deployableCollection.domainManagerConfiguration = domainManagerConfiguration;
- deployableCollection.contributionCollection = contributionCollection;
- contributionCollection.initialize();
- deployableCollection.initialize();
-
- // Populate the workspace with test data
- Item item = new Item();
- item.setLink(cl.getResource("contributions/store").toString());
- contributionCollection.post("store", item);
- item.setLink(cl.getResource("contributions/assets").toString());
- contributionCollection.post("assets", item);
- }
-
- public void testGetAll() {
- Entry<String, Item>[] entries = contributionCollection.getAll();
- assertEquals(2, entries.length);
- assertEquals(entries[0].getKey(), "store");
- }
-
- public void testGet() throws NotFoundException {
- Item item = contributionCollection.get("assets");
- assertTrue(item.getAlternate().endsWith("contributions/assets/"));
- }
-
- public void testDependencies1() {
- Entry<String, Item>[] entries = contributionCollection.query("alldependencies=store");
- assertEquals(2, entries.length);
- }
-
- public void testDependencies2() {
- Entry<String, Item>[] entries = contributionCollection.query("alldependencies=assets");
- assertEquals(1, entries.length);
- assertEquals("assets", entries[0].getKey());
- }
-
- public void testDeployables() throws NotFoundException {
- Entry<String, Item>[] entries = deployableCollection.getAll();
- assertEquals(1, entries.length);
- assertEquals("composite:store;http://store;store", entries[0].getKey());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/assets/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/assets/META-INF/sca-contribution.xml
deleted file mode 100644
index e96d97312e..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/assets/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,26 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0">
- <export.java package="services"/>
- <export.java package="services.merger"/>
- <export.java package="services.db"/>
- <import.java package="org.apache.tuscany.sca.data.collection"/>
- <import.java package="org.apache.derby.*"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/store/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/store/META-INF/sca-contribution.xml
deleted file mode 100644
index 794bfae98a..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/contributions/store/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,24 +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.
--->
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:s="http://store">
- <deployable composite="s:store"/>
- <import.java package="services"/>
-</contribution> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/workspace.xml b/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/workspace.xml
deleted file mode 100644
index e6ac7d7701..0000000000
--- a/branches/sca-java-1.5.1/modules/domain-manager/src/test/resources/workspace.xml
+++ /dev/null
@@ -1,21 +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.
--->
-<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0">
-</workspace>
diff --git a/branches/sca-java-1.5.1/modules/endpoint/LICENSE b/branches/sca-java-1.5.1/modules/endpoint/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/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-java-1.5.1/modules/endpoint/NOTICE b/branches/sca-java-1.5.1/modules/endpoint/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/endpoint/pom.xml b/branches/sca-java-1.5.1/modules/endpoint/pom.xml
deleted file mode 100644
index 2eeccf3651..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/pom.xml
+++ /dev/null
@@ -1,122 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-endpoint</artifactId>
- <name>Apache Tuscany SCA Default Endpoint Implementation</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-monitor</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.endpoint</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.endpoint*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.java
deleted file mode 100644
index f0646e934e..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverFactoryImpl.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.endpoint.impl;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
-
-/**
- * The factory for creating endpoint Binding providers
- *
- * @version $Rev$ $Date$
- */
-public class EndpointResolverFactoryImpl implements EndpointResolverFactory<Endpoint> {
-
- private ExtensionPointRegistry extensionPoints;
-
- public EndpointResolverFactoryImpl(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- public EndpointResolver createEndpointResolver(Endpoint endpoint, Binding binding) {
-
- return new EndpointResolverImpl(extensionPoints, endpoint);
- }
-
- public Class<Endpoint> getModelType() {
- return Endpoint.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.java
deleted file mode 100644
index b76c4b82f0..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/main/java/org/apache/tuscany/sca/endpoint/impl/EndpointResolverImpl.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.endpoint.impl;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
-
-
-/**
- * The endpoint resolver allows unresolved endpoints to be plumbed into
- * the runtime start and message send processing as a hook to late resolution
- * of target services
- *
- * @version $Rev$ $Date$
- */
-public class EndpointResolverImpl implements EndpointResolver {
-
- private final static Logger logger = Logger.getLogger(EndpointResolverImpl.class.getName());
-
- private Endpoint endpoint;
- private List<EndpointResolver> endpointResolvers = new ArrayList<EndpointResolver>();
-
- public EndpointResolverImpl(ExtensionPointRegistry extensionPoints,
- Endpoint endpoint) {
- this.endpoint = endpoint;
-
- EndpointResolverFactoryExtensionPoint resolverFactories =
- extensionPoints.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
-
- for (Binding binding : endpoint.getCandidateBindings()){
- EndpointResolverFactory resolverFactory = resolverFactories.getEndpointResolverFactory(binding.getClass());
-
- // if the binding in question has a endpoint resolver factory they try and
- // create an endpoint resolver
- if (resolverFactory != null){
- EndpointResolver resolver = resolverFactory.createEndpointResolver(endpoint, binding);
-
- if (resolver != null){
- endpointResolvers.add(resolver);
- }
- }
- }
- }
-
- public void start(){
- // do nothing
- }
-
- public void stop(){
- // do nothing
- }
-
- public void resolve() {
- if (endpoint.isUnresolved()){
- // Resolve the endpoint binding here
-
- // first do any general resolution that's required
-
- // ask the bindings to resolve the endpoint one by one
- for (EndpointResolver resolver : endpointResolvers){
- resolver.resolve();
- if (endpoint.isUnresolved() != true){
- break;
- }
- }
-
- if (endpoint.isUnresolved()){
- // TODO: TUSCANY-2580: if its still unresolved use the first candidate binding
- endpoint.setSourceBinding(endpoint.getCandidateBindings().get(0));
- endpoint.getSourceBinding().setURI(endpoint.getTargetName());
- }
-
- if (endpoint.isUnresolved() != true){
- // If we have to build the endpoint because we are matching
- // intents and policies then we do that now. If the binding
- // is just configured by setting its uri we can just do local binding
- // configuration here
-
- // EndpointBuilderImpl.build(endpoint);
- } else {
- // raise an exception saying the endpoint can't be resolved
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory b/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
deleted file mode 100644
index 50e0a930d2..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/META-INF/services/org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the binding extension
-org.apache.tuscany.sca.endpoint.impl.EndpointResolverFactoryImpl;model=org.apache.tuscany.sca.assembly.Endpoint
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml b/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
deleted file mode 100644
index 8bac9e01c9..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml
+++ /dev/null
@@ -1,26 +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://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <sca:bindingType type="sca:binding.sca" mayProvide="" alwaysProvides=""/>
- </sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddService.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddService.java
deleted file mode 100644
index 188451ebac..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddService.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 calculator;
-
-/**
- * The Add service interface
- */
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddServiceImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddServiceImpl.java
deleted file mode 100644
index 7ca8fb04b5..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/AddServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Add service
- */
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Adding " + n1 + " and " + n2);
- return n1 + n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorService.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorService.java
deleted file mode 100644
index 031fa8b912..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-
-/**
- * The Calculator service interface.
- */
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java
deleted file mode 100644
index 3d861f2018..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/CalculatorServiceImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Reference;
-
-
-/**
- * An implementation of the Calculator service.
- */
-public class CalculatorServiceImpl implements CalculatorService {
-
- private AddService addService;
- private SubtractService subtractService;
- private MultiplyService multiplyService;
- private DivideService divideService;
-
- @Reference
- public void setAddService(AddService addService) {
- this.addService = addService;
- }
-
- @Reference
- public void setSubtractService(SubtractService subtractService) {
- this.subtractService = subtractService;
- }
-
- @Reference
- public void setDivideService(DivideService divideService) {
- this.divideService = divideService;
- }
-
- @Reference
- public void setMultiplyService(MultiplyService multiplyService) {
- this.multiplyService = multiplyService;
- }
-
- public double add(double n1, double n2) {
- return addService.add(n1, n2);
- }
-
- public double subtract(double n1, double n2) {
- return subtractService.subtract(n1, n2);
- }
-
- public double multiply(double n1, double n2) {
- return multiplyService.multiply(n1, n2);
- }
-
- public double divide(double n1, double n2) {
- return divideService.divide(n1, n2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideService.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideService.java
deleted file mode 100644
index 30d248208b..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideService.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 calculator;
-
-/**
- * The divide service interface
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java
deleted file mode 100644
index 1323edf55a..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/DivideServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Divide service.
- */
-public class DivideServiceImpl implements DivideService {
-
- public double divide(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Dividing " + n1 + " with " + n2);
- return n1 / n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyService.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyService.java
deleted file mode 100644
index 5290605938..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyService.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 calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java
deleted file mode 100644
index 91b803bc9e..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/MultiplyServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the Multiply service.
- */
-public class MultiplyServiceImpl implements MultiplyService {
-
- public double multiply(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Multiplying " + n1 + " with " + n2);
- return n1 * n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractService.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractService.java
deleted file mode 100644
index bf0d1882b6..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractService.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 calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java
deleted file mode 100644
index 58cc4a3547..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/calculator/SubtractServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * An implementation of the subtract service.
- */
-public class SubtractServiceImpl implements SubtractService {
-
- public double subtract(double n1, double n2) {
- Logger logger = Logger.getLogger("calculator");
- logger.log(Level.FINEST, "Subtracting " + n1 + " from " + n2);
- return n1 - n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java b/branches/sca-java-1.5.1/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java
deleted file mode 100644
index 371f6e624d..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/java/org/apace/tuscany/sca/binding/sca/EndpointTestCase.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apace.tuscany.sca.binding.sca;
-
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Endpoint;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
-import org.apache.tuscany.sca.endpoint.impl.EndpointResolverFactoryImpl;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolver;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * EndpointTestCase
- *
- * @version $Rev$ $Date$
- */
-public class EndpointTestCase {
-
- private static URLArtifactProcessor<Contribution> contributionProcessor;
- private static ModelFactoryExtensionPoint modelFactories;
- private static AssemblyFactory assemblyFactory;
- private static XMLOutputFactory outputFactory;
- private static StAXArtifactProcessor<Object> xmlProcessor;
- private static CompositeBuilder compositeBuilder;
- private static ModelResolver modelResolver;
- private static CompositeActivator compositeActivator;
- private static ExtensionPointRegistry extensionPoints;
-
- @BeforeClass
- public static void init() {
-
- // Create extension point registry
- extensionPoints = new DefaultExtensionPointRegistry();
-
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- Monitor monitor = monitorFactory.createMonitor();
-
- modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Initialize the Tuscany module activators
- ModuleActivatorExtensionPoint moduleActivators = extensionPoints.getExtensionPoint(ModuleActivatorExtensionPoint.class);
- for (ModuleActivator activator: moduleActivators.getModuleActivators()) {
- activator.start(extensionPoints);
- }
-
- // Get XML input/output factories
-
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
-
- // Get contribution workspace and assembly model factories
- assemblyFactory = new RuntimeAssemblyFactory();
- modelFactories.addFactory(assemblyFactory);
-
- // Create XML artifact processors
- StAXArtifactProcessorExtensionPoint xmlProcessorExtensions = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- xmlProcessor = new ExtensibleStAXArtifactProcessor(xmlProcessorExtensions, inputFactory, outputFactory, monitor);
-
- // Create contribution content processor
- URLArtifactProcessorExtensionPoint docProcessorExtensions = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- contributionProcessor = docProcessorExtensions.getProcessor(Contribution.class);
-
- // Get the model resolvers
- modelResolver = new ExtensibleModelResolver(null, extensionPoints);
-
- // Create a composite builder
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- InterfaceContractMapper contractMapper = utilities.getUtility(InterfaceContractMapper.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, contractMapper, monitor);
-
- // Runtime Init ===================
-/*
- ContextFactoryExtensionPoint contextFactories = new DefaultContextFactoryExtensionPoint(extensionPoints);
- extensionPoints.addExtensionPoint(contextFactories);
-
- // Create a wire post processor extension point
- RuntimeWireProcessorExtensionPoint wireProcessors =
- extensionPoints.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
- RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
-
- JavaInterfaceFactory javaInterfaceFactory =
- extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
- RequestContextFactory requestContextFactory =
- extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
-
- ConversationManager conversationManager = new ConversationManagerImpl();
- extensionPoints.addExtensionPoint(conversationManager);
-
-
- ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
- ScopeContainerFactory[] factories =
- new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
- new RequestScopeContainerFactory(),
- new ConversationalScopeContainerFactory(null),
- // new HttpSessionScopeContainer(monitor)
- };
- for (ScopeContainerFactory f : factories) {
- scopeRegistry.register(f);
- }
-
- compositeActivator =new CompositeActivatorImpl(assemblyFactory,
- messageFactory,
- javaInterfaceFactory,
- scaBindingFactory,
- mapper,
- scopeRegistry,
- extensionPoints.getExtensionPoint(WorkScheduler.class),
- wireProcessor,
- requestContextFactory,
- new DefaultProxyFactoryExtensionPoint(messageFactory, mapper),
- extensionPoints.getExtensionPoint(ProviderFactoryExtensionPoint.class),
- extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class),
- conversationManager);
-
-*/
-
-
- }
-
- @Test
- public void testProvider(){
- try {
- URI calculatorURI = URI.create("calcualtor");
- URL calculatorURL = new File("./target/test-classes").toURI().toURL();
- Contribution contribution = contributionProcessor.read(null, calculatorURI, calculatorURL);
-
- contributionProcessor.resolve(contribution, modelResolver);
-
- Composite composite = contribution.getDeployables().get(0);
-
- compositeBuilder.build(composite);
-
- ComponentReference ref = (composite.getComponents().get(0).getReferences().get(0));
-
- Assert.assertEquals(1, ref.getEndpoints().size());
-
- Endpoint endpoint = ref.getEndpoints().get(0);
-
- EndpointResolverFactory<Endpoint> factory = new EndpointResolverFactoryImpl(extensionPoints);
-
- EndpointResolver endpointResolver = factory.createEndpointResolver(endpoint, null);
-
- Assert.assertNotNull(endpointResolver);
-
-
- } catch(Exception ex) {
- ex.printStackTrace();
- System.out.println(ex.toString());
- Assert.fail();
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/endpoint/src/test/resources/Calculator.composite b/branches/sca-java-1.5.1/modules/endpoint/src/test/resources/Calculator.composite
deleted file mode 100644
index 3b743f6e26..0000000000
--- a/branches/sca-java-1.5.1/modules/endpoint/src/test/resources/Calculator.composite
+++ /dev/null
@@ -1,52 +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">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponentOff">
- <implementation.java class="calculator.AddServiceImpl"/>
- <service name="AddServiceImpl">
- <interface.java interface="calculator.AddService"/>
- </service>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/LICENSE b/branches/sca-java-1.5.1/modules/extensibility-osgi/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/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-java-1.5.1/modules/extensibility-osgi/NOTICE b/branches/sca-java-1.5.1/modules/extensibility-osgi/NOTICE
deleted file mode 100644
index 644a49d98b..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/pom.xml b/branches/sca-java-1.5.1/modules/extensibility-osgi/pom.xml
deleted file mode 100644
index 72490877b0..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/pom.xml
+++ /dev/null
@@ -1,73 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-extensibility-osgi</artifactId>
- <name>Apache Tuscany SCA Extensibility for OSGi</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.framework</artifactId>
- <version>1.0.4</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.foundation</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.extensibility.osgi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Bundle-Activator>org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoveryActivator</Bundle-Activator>
- <!-- This bundle will be the gateway to all exported packages -->
- <DynamicImport-Package>*</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoverer.java b/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoverer.java
deleted file mode 100644
index a536684b2e..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoverer.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extensibility.osgi;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.security.SecureClassLoader;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscoverer;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The ServiceDiscoverer that find META-INF/services/... in installed bundles
- */
-public class OSGiServiceDiscoverer implements ServiceDiscoverer {
- private static final Logger logger = Logger.getLogger(OSGiServiceDiscoverer.class.getName());
- private BundleContext context;
- private ClassLoader classLoader;
-
- public OSGiServiceDiscoverer(BundleContext context) {
- this.context = context;
- this.classLoader = new ClassLoaderImpl();
- }
-
- /**
- * This class loader provides resource access to META-INF/services/... which is used by
- * many frameworks. OSGi Import-Package and DynmaicImport-Package headers do not support
- * split packages. Another option is to use Require-Bundle header. We can collect the list
- * of bundles and add them as required bundles to a special gateway bundle.
- */
- public class ClassLoaderImpl extends SecureClassLoader {
-
- public ClassLoaderImpl() {
- super(OSGiServiceDiscoverer.class.getClassLoader());
- }
-
- /**
- * Open a back-door to expose the META-INF/services resources
- */
- @Override
- protected URL findResource(String name) {
- int index = name.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- String path = name.substring(0, index);
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
-
- if (!path.startsWith("META-INF/services")) {
- return null;
- }
-
- for (Bundle bundle : context.getBundles()) {
- URL url = bundle.getEntry(name);
- if (url != null) {
- return url;
- }
- }
-
- return null;
- }
-
- /**
- * Open a back-door to expose the META-INF/services resources
- */
- @Override
- protected Enumeration<URL> findResources(String name) throws IOException {
- int index = name.lastIndexOf('/');
- if (index == -1) {
- return null;
- }
- String path = name.substring(0, index);
- String file = name.substring(index + 1);
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
-
- if (!path.startsWith("META-INF/services")) {
- return null;
- }
-
- Set<URL> urlSet = new HashSet<URL>();
-
- for (Bundle bundle : context.getBundles()) {
- Enumeration<URL> urls = bundle.findEntries(path, file, false);
- if (urls != null) {
- urlSet.addAll(Collections.list(urls));
- }
- }
- return Collections.enumeration(urlSet);
- }
-
- }
-
- public static class ServiceDeclarationImpl implements ServiceDeclaration {
- private Bundle bundle;
- private URL url;
- private String className;
- private Class<?> javaClass;
- private Map<String, String> attributes;
-
- public ServiceDeclarationImpl(Bundle bundle, URL url, String className, Map<String, String> attributes) {
- super();
- this.bundle = bundle;
- this.url = url;
- this.className = className;
- this.attributes = attributes;
- }
-
- public Map<String, String> getAttributes() {
- return attributes;
- }
-
- public String getClassName() {
- return className;
- }
-
- public Class<?> loadClass() throws ClassNotFoundException {
- if (className == null) {
- return null;
- }
- if (javaClass == null) {
- javaClass = loadClass(className);
- }
- return javaClass;
- }
-
- public Class<?> loadClass(String className) throws ClassNotFoundException {
- try {
- return bundle.loadClass(className);
- } catch (ClassNotFoundException e) {
- logger.severe(e.getMessage() + ": " + OSGiServiceDiscoverer.toString(bundle));
- throw e;
- }
- }
-
- public URL getLocation() {
- return url;
- }
-
- public URL getResource(final String name) {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return bundle.getResource(name);
- }
- });
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Bundle: ").append(OSGiServiceDiscoverer.toString(bundle));
- sb.append(" Resource: ").append(url);
- sb.append(" Attributes: ").append(attributes);
- return sb.toString();
- }
-
- }
-
- public static String toString(Bundle b) {
- StringBuffer sb = new StringBuffer();
- sb.append(b.getBundleId()).append(" ").append(b.getSymbolicName());
- int s = b.getState();
- if ((s & Bundle.UNINSTALLED) != 0) {
- sb.append(" UNINSTALLED");
- }
- if ((s & Bundle.INSTALLED) != 0) {
- sb.append(" INSTALLED");
- }
- if ((s & Bundle.RESOLVED) != 0) {
- sb.append(" RESOLVED");
- }
- if ((s & Bundle.STARTING) != 0) {
- sb.append(" STARTING");
- }
- if ((s & Bundle.STOPPING) != 0) {
- sb.append(" STOPPING");
- }
- if ((s & Bundle.ACTIVE) != 0) {
- sb.append(" ACTIVE");
- }
- return sb.toString();
-
- }
-
- /**
- * Parse a service declaration in the form class;attr=value,attr=value and
- * return a map of attributes
- *
- * @param declaration
- * @return a map of attributes
- */
- protected static Map<String, String> parseServiceDeclaration(String declaration) {
- Map<String, String> attributes = new HashMap<String, String>();
- int index = declaration.indexOf(';');
- if (index != -1) {
- attributes.put("class", declaration.substring(0, index).trim());
- declaration = declaration.substring(index);
- } else {
- int j = declaration.indexOf('=');
- if (j == -1) {
- attributes.put("class", declaration.trim());
- return attributes;
- } else {
- declaration = ";" + declaration;
- }
- }
- StringTokenizer tokens = new StringTokenizer(declaration);
- for (; tokens.hasMoreTokens();) {
- String key = tokens.nextToken("=").substring(1).trim();
- if (key == null)
- break;
- String value = tokens.nextToken(",").substring(1).trim();
- if (value == null)
- break;
- attributes.put(key, value);
- }
- return attributes;
- }
-
- public BundleContext getBundleContext() {
- return context;
- }
-
- /**
- * This class loader can be set as the thread context class loader for non-OSGi code
- * @return
- */
- public ClassLoader getContextClassLoader() {
- return classLoader;
- }
-
- @SuppressWarnings("unchecked")
- public Set<ServiceDeclaration> discover(String serviceName, boolean firstOnly) {
- boolean debug = logger.isLoggable(Level.FINE);
- Set<ServiceDeclaration> descriptors = new HashSet<ServiceDeclaration>();
-
- serviceName = "META-INF/services/" + serviceName;
-
- // int index = serviceName.lastIndexOf('/');
- // String path = serviceName.substring(0, index);
- // String file = serviceName.substring(index + 1);
-
- // long start = System.currentTimeMillis();
- try {
- for (Bundle bundle : context.getBundles()) {
- // Enumeration<URL> urls = bundle.findEntries(path, file, false); // This is expensive
- final URL url = bundle.getEntry(serviceName);
- if (url == null) {
- continue;
- }
-
- if (debug) {
- logger.fine("Reading service provider file: " + url.toExternalForm());
- }
- try {
- // Allow privileged access to open URL stream. Add FilePermission to added to security
- // policy file.
- InputStream is;
- try {
- is = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
- public InputStream run() throws IOException {
- return url.openStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- int count = 0;
- while (true) {
- String line = reader.readLine();
- if (line == null)
- break;
- line = line.trim();
- if (!line.startsWith("#") && !"".equals(line)) {
- String reg = line.trim();
- if (debug) {
- logger.fine("Registering service provider: " + reg);
- }
-
- Map<String, String> attributes = parseServiceDeclaration(reg);
- String className = attributes.get("class");
- if (className == null) {
- // Add a unique class name to prevent equals() from returning true
- className = "_class_" + count;
- count++;
- }
- ServiceDeclarationImpl descriptor =
- new ServiceDeclarationImpl(bundle, url, className, attributes);
- descriptors.add(descriptor);
- if (firstOnly) {
- return descriptors;
- }
- }
- }
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // Ignore
- }
- }
- }
- } catch (IOException e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- } finally {
-// long end = System.currentTimeMillis();
-// if (true) {
-// logger.info("Duration: " + (end - start) + " ms");
-// }
- }
- return descriptors;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoveryActivator.java b/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoveryActivator.java
deleted file mode 100644
index 208ef1a74f..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/main/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscoveryActivator.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.extensibility.osgi;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * The Bundle Activator that creates the OSGi-based service discoverer
- */
-public class OSGiServiceDiscoveryActivator implements BundleActivator {
- private static BundleContext bundleContext;
-
- public void start(BundleContext context) throws Exception {
- if (bundleContext == null) {
- bundleContext = context;
- OSGiServiceDiscoverer discoverer = new OSGiServiceDiscoverer(bundleContext);
- ServiceDiscovery.getInstance().setServiceDiscoverer(discoverer);
- }
- }
-
- public void stop(BundleContext context) throws Exception {
- bundleContext = null;
- // ServiceDiscovery.setServiceDiscoverer(discoverer);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscovererTestCase.java b/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscovererTestCase.java
deleted file mode 100644
index aba7e62637..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/java/org/apache/tuscany/sca/extensibility/osgi/OSGiServiceDiscovererTestCase.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extensibility.osgi;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Assert;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.framework.cache.BundleCache;
-import org.apache.felix.framework.util.FelixConstants;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-
-/**
- *
- */
-public class OSGiServiceDiscovererTestCase {
- private static Felix felix;
- private static OSGiServiceDiscoverer discoverer;
- private static Bundle testBundle;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // Create a configuration property map.
- Map<String, String> configMap = new HashMap<String, String>();
- // Configure the Felix instance to be embedded.
- configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
- // Add core OSGi packages to be exported from the class path
- // via the system bundle.
- configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES,
- "org.osgi.framework; version=1.3.0," + "org.osgi.service.packageadmin; version=1.2.0,"
- + "org.osgi.service.startlevel; version=1.0.0,"
- + "org.osgi.service.url; version=1.0.0");
- // Explicitly specify the directory to use for caching bundles.
- configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "target/.felix");
- List<BundleActivator> list = new ArrayList<BundleActivator>();
-
- // Now create an instance of the framework with
- // our configuration properties and activator.
- felix = new Felix(configMap, list);
-
- // Now start Felix instance.
- felix.start();
- BundleContext context = felix.getBundleContext();
- InputStream is = OSGiServiceDiscovererTestCase.class.getResourceAsStream("/test-bundle.jar");
- testBundle = context.installBundle("test-bundle", is);
- is.close();
- discoverer = new OSGiServiceDiscoverer(context);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- if (felix != null) {
- // Uninstall the bundle to clean up the cache
- testBundle.uninstall();
- felix.stop();
- }
- }
-
- @Test
- public void testDiscovery() {
- Set<ServiceDeclaration> descriptors =
- discoverer.discover("test.TestService", false);
- Assert.assertEquals(1, descriptors.size());
- descriptors = discoverer.discover("notthere", false);
- Assert.assertEquals(0, descriptors.size());
- }
-
- @Test
- public void testDiscoveryFirst() {
- Set<ServiceDeclaration> descriptors =
- discoverer.discover("test.TestService", true);
- Assert.assertEquals(1, descriptors.size());
- descriptors = discoverer.discover("notthere", true);
- Assert.assertEquals(0, descriptors.size());
- }
-
- @Test
- public void testClassLoader () throws IOException {
- Enumeration<URL> resources = discoverer.getContextClassLoader().getResources("META-INF/services/test.TestService");
- List<URL> list = Collections.list(resources);
- Assert.assertEquals(1, list.size());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/resources/test-bundle.jar b/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/resources/test-bundle.jar
deleted file mode 100644
index afee051f61..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility-osgi/src/test/resources/test-bundle.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/extensibility/LICENSE b/branches/sca-java-1.5.1/modules/extensibility/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/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-java-1.5.1/modules/extensibility/NOTICE b/branches/sca-java-1.5.1/modules/extensibility/NOTICE
deleted file mode 100644
index 644a49d98b..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/extensibility/pom.xml b/branches/sca-java-1.5.1/modules/extensibility/pom.xml
deleted file mode 100644
index 13a74b39da..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-extensibility</artifactId>
- <name>Apache Tuscany SCA Extensibility</name>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.extensibility</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
deleted file mode 100644
index 48f240559c..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultExtensionPointRegistry.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of a registry to hold all the Tuscany core extension
- * points. As the point of contact for all extension artifacts this registry
- * allows loaded extensions to find all other parts of the system and register
- * themselves appropriately.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultExtensionPointRegistry implements ExtensionPointRegistry {
- private Map<Class<?>, Object> extensionPoints = new HashMap<Class<?>, Object>();
-
- /**
- * Constructs a new registry.
- */
- public DefaultExtensionPointRegistry() {
- }
-
- /**
- * Add an extension point to the registry. This default implementation
- * stores extensions against the interfaces that they implement.
- *
- * @param extensionPoint The instance of the extension point
- *
- * @throws IllegalArgumentException if extensionPoint is null
- */
- public void addExtensionPoint(Object extensionPoint) {
- if (extensionPoint == null) {
- throw new IllegalArgumentException("Cannot register null as an ExtensionPoint");
- }
-
- Set<Class<?>> interfaces = getAllInterfaces(extensionPoint.getClass());
- for (Class<?> i : interfaces) {
- extensionPoints.put(i, extensionPoint);
- }
- }
-
- private Constructor<?> getConstructor(Constructor<?>[] constructors, Class<?>[] paramTypes) {
- for (Constructor<?> c : constructors) {
- Class<?>[] types = c.getParameterTypes();
- if (c.getParameterTypes().length == paramTypes.length) {
- boolean found = true;
- for (int i = 0; i < types.length; i++) {
- if (types[i] != paramTypes[i]) {
- found = false;
- break;
- }
- }
- if (found) {
- return c;
- }
- }
- }
- return null;
- }
-
- /**
- * Get the extension point by the interface that it implements
- *
- * @param extensionPointType The lookup key (extension point interface)
- * @return The instance of the extension point
- *
- * @throws IllegalArgumentException if extensionPointType is null
- */
- public <T> T getExtensionPoint(Class<T> extensionPointType) {
- if (extensionPointType == null) {
- throw new IllegalArgumentException("Cannot lookup ExtensionPoint of type null");
- }
-
- Object extensionPoint = extensionPoints.get(extensionPointType);
- if (extensionPoint == null) {
-
- // Dynamically load an extension point class declared under META-INF/services
- try {
- Class<?> extensionPointClass =
- ServiceDiscovery.getInstance().loadFirstServiceClass(extensionPointType);
- if (extensionPointClass != null) {
- // Construct the extension point
- Constructor<?>[] constructors = extensionPointClass.getConstructors();
- Constructor<?> constructor = getConstructor(constructors, new Class<?>[] {ExtensionPointRegistry.class});
- if (constructor != null) {
- extensionPoint = constructor.newInstance(this);
- } else {
- constructor = getConstructor(constructors, new Class<?>[] {});
- if (constructor != null) {
- extensionPoint = constructor.newInstance();
- } else {
- throw new IllegalArgumentException(
- "No valid constructor is found for " + extensionPointClass);
- }
- }
-
- // Cache the loaded extension point
- addExtensionPoint(extensionPoint);
- }
- } catch (InvocationTargetException e) {
- throw new IllegalArgumentException(e);
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- }
- return extensionPointType.cast(extensionPoint);
- }
-
- /**
- * Remove an extension point based on the interface that it implements
- *
- * @param extensionPoint The extension point to remove
- *
- * @throws IllegalArgumentException if extensionPoint is null
- */
- public void removeExtensionPoint(Object extensionPoint) {
- if (extensionPoint == null) {
- throw new IllegalArgumentException("Cannot remove null as an ExtensionPoint");
- }
-
- Set<Class<?>> interfaces = getAllInterfaces(extensionPoint.getClass());
- for (Class<?> i : interfaces) {
- extensionPoints.remove(i);
- }
- }
-
- /**
- * Returns the set of interfaces implemented by the given class and its
- * ancestors or a blank set if none
- */
- private static Set<Class<?>> getAllInterfaces(Class<?> clazz) {
- Set<Class<?>> implemented = new HashSet<Class<?>>();
- getAllInterfaces(clazz, implemented);
- return implemented;
- }
-
- private static void getAllInterfaces(Class<?> clazz, Set<Class<?>> implemented) {
- Class<?>[] interfaces = clazz.getInterfaces();
- for (Class<?> interfaze : interfaces) {
- if (Modifier.isPublic(interfaze.getModifiers())) {
- implemented.add(interfaze);
- }
- }
- Class<?> superClass = clazz.getSuperclass();
- // Object has no superclass so check for null
- if (superClass != null && !superClass.equals(Object.class)) {
- getAllInterfaces(superClass, implemented);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.java
deleted file mode 100644
index 8034de67fe..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultModuleActivatorExtensionPoint.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.core;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of an extension point to hold Tuscany module activators.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultModuleActivatorExtensionPoint implements ModuleActivatorExtensionPoint {
- private final static Logger logger = Logger.getLogger(DefaultModuleActivatorExtensionPoint.class.getName());
-
- private List<ModuleActivator> activators = new ArrayList<ModuleActivator>();
- private boolean loadedActivators;
-
- /**
- * Constructs a new extension point.
- */
- public DefaultModuleActivatorExtensionPoint() {
- }
-
- public void addModuleActivator(ModuleActivator activator) {
- activators.add(activator);
- }
-
- public List<ModuleActivator> getModuleActivators() {
- loadModuleActivators();
- return activators;
- }
-
- public void removeModuleActivator(Object activator) {
- activators.remove(activator);
- }
-
- /**
- * Dynamically load module activators declared under META-INF/services
- */
- private synchronized void loadModuleActivators() {
- if (loadedActivators)
- return;
-
- // Get the activator service declarations
- Set<ServiceDeclaration> activatorDeclarations;
- try {
- activatorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load and instantiate module activators
- for (ServiceDeclaration activatorDeclaration: activatorDeclarations) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Loading " + activatorDeclaration.getClassName());
- }
- ModuleActivator activator = null;
- try {
- Class<ModuleActivator> activatorClass = (Class<ModuleActivator>)activatorDeclaration.loadClass();
- activator = activatorClass.newInstance();
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- addModuleActivator(activator);
- }
-
- loadedActivators = true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java
deleted file mode 100644
index 6f7c83c8d9..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/DefaultUtilityExtensionPoint.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Default implementation of an extension point to hold Tuscany utility utilities.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultUtilityExtensionPoint implements UtilityExtensionPoint {
- private Map<Class<?>, Object> utilities = new HashMap<Class<?>, Object>();
-
- private ExtensionPointRegistry extensionPoints;
-
- /**
- * Constructs a new extension point.
- */
- public DefaultUtilityExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
- }
-
- /**
- * Add a utility to the extension point. This default implementation
- * stores utilities against the interfaces that they implement.
- *
- * @param utility The instance of the utility
- *
- * @throws IllegalArgumentException if utility is null
- */
- public void addUtility(Object utility) {
- if (utility == null) {
- throw new IllegalArgumentException("Cannot register null as a Service");
- }
-
- Set<Class<?>> interfaces = getAllInterfaces(utility.getClass());
- for (Class<?> i : interfaces) {
- utilities.put(i, utility);
- }
- }
-
- private Constructor<?> getConstructor(Constructor<?>[] constructors, Class<?>[] paramTypes) {
- for (Constructor<?> c : constructors) {
- Class<?>[] types = c.getParameterTypes();
- if (c.getParameterTypes().length == paramTypes.length) {
- boolean found = true;
- for (int i = 0; i < types.length; i++) {
- if (types[i] != paramTypes[i]) {
- found = false;
- break;
- }
- }
- if (found) {
- return c;
- }
- }
- }
- return null;
- }
-
- /**
- * Get the utility by the interface that it implements
- *
- * @param utilityType The lookup key (utility interface)
- * @return The instance of the utility
- *
- * @throws IllegalArgumentException if utilityType is null
- */
- public <T> T getUtility(Class<T> utilityType) {
- if (utilityType == null) {
- throw new IllegalArgumentException("Cannot lookup Service of type null");
- }
-
- Object utility = utilities.get(utilityType);
- if (utility == null) {
-
- // Dynamically load a utility class declared under META-INF/utilities
- try {
- Class<?> utilityClass =
- ServiceDiscovery.getInstance().loadFirstServiceClass(utilityType);
- if (utilityClass != null) {
- // Construct the utility
- Constructor<?>[] constructors = utilityClass.getConstructors();
- Constructor<?> constructor = getConstructor(constructors, new Class<?>[] {ExtensionPointRegistry.class});
- if (constructor != null) {
- utility = constructor.newInstance(extensionPoints);
- } else {
- constructor = getConstructor(constructors, new Class<?>[] {});
- if (constructor != null) {
- utility = constructor.newInstance();
- } else {
- throw new IllegalArgumentException(
- "No valid constructor is found for " + utilityClass);
- }
- }
-
- // Cache the loaded utility
- addUtility(utility);
- }
- } catch (InvocationTargetException e) {
- throw new IllegalArgumentException(e);
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- }
- return utilityType.cast(utility);
- }
-
- /**
- * Remove a utility based on the interface that it implements
- *
- * @param utility The utility to remove
- *
- * @throws IllegalArgumentException if utility is null
- */
- public void removeUtility(Object utility) {
- if (utility == null) {
- throw new IllegalArgumentException("Cannot remove null as a Service");
- }
-
- Set<Class<?>> interfaces = getAllInterfaces(utility.getClass());
- for (Class<?> i : interfaces) {
- utilities.remove(i);
- }
- }
-
- /**
- * Returns the set of interfaces implemented by the given class and its
- * ancestors or a blank set if none
- */
- private static Set<Class<?>> getAllInterfaces(Class<?> clazz) {
- Set<Class<?>> implemented = new HashSet<Class<?>>();
- getAllInterfaces(clazz, implemented);
- return implemented;
- }
-
- private static void getAllInterfaces(Class<?> clazz, Set<Class<?>> implemented) {
- Class<?>[] interfaces = clazz.getInterfaces();
- for (Class<?> interfaze : interfaces) {
- if (Modifier.isPublic(interfaze.getModifiers())) {
- implemented.add(interfaze);
- }
- }
- Class<?> superClass = clazz.getSuperclass();
- // Object has no superclass so check for null
- if (superClass != null && !superClass.equals(Object.class)) {
- getAllInterfaces(superClass, implemented);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.java
deleted file mode 100644
index f2f67b2d52..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ExtensionPointRegistry.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.core;
-
-
-/**
- * The registry for the Tuscany core extension points. As the point of contact
- * for all extension artifacts this registry allows loaded extensions to find
- * all other parts of the system and register themselves appropriately.
- *
- * @version $Rev$ $Date$
- */
-public interface ExtensionPointRegistry {
-
- /**
- * Add an extension point to the registry
- * @param extensionPoint The instance of the extension point
- *
- * @throws IllegalArgumentException if extensionPoint is null
- */
- void addExtensionPoint(Object extensionPoint);
-
- /**
- * Get the extension point by the interface
- * @param extensionPointType The lookup key (extension point interface)
- * @return The instance of the extension point
- *
- * @throws IllegalArgumentException if extensionPointType is null
- */
- <T> T getExtensionPoint(Class<T> extensionPointType);
-
- /**
- * Remove an extension point
- * @param extensionPoint The extension point to remove
- *
- * @throws IllegalArgumentException if extensionPoint is null
- */
- void removeExtensionPoint(Object extensionPoint);
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
deleted file mode 100644
index dbfd0dcd90..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivator.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-
-/**
- * ModuleActivator represents a module that plugs into the Tuscany system. Each
- * module should provide an implementation of this interface and register the
- * ModuleActivator implementation class by defining a file named
- *
- * "META-INF/services/org.apache.tuscany.core.ModuleActivator"
- *
- * The content of the file is the class name of the ModuleActivator implementation.
- * The implementation class must have a no-arg constructor. The same instance
- * will be used to invoke all the methods during different phases of the module
- * activation. Note that the start and stop methods defined by this interface
- * take a reference to the Tuscany SCA runtime ExtensionPointRegistry. This
- * gives the ModuleActivator the opportunity to add extension points to the
- * registry as it is requested to start up and remove them when it is requested
- * to shut down.
- *
- * @version $Rev$ $Date$
- */
-public interface ModuleActivator {
-
- /**
- * This method is invoked when the module is started by the Tuscany system.
- * It can be used by this module to register extensions against extension
- * points.
- *
- * @param registry The extension point registry
- */
- void start(ExtensionPointRegistry registry);
-
- /**
- * This method is invoked when the module is stopped by the Tuscany system.
- * It can be used by this module to unregister extensions against the
- * extension points.
- *
- * @param registry The extension point registry
- */
- void stop(ExtensionPointRegistry registry);
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java
deleted file mode 100644
index ec0f12b8ba..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/ModuleActivatorExtensionPoint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-import java.util.List;
-
-
-/**
- * The extension point for the Tuscany module activator extensions.
- *
- * @version $Rev$ $Date$
- */
-public interface ModuleActivatorExtensionPoint {
-
- /**
- * Add a module activator extension to the extension point
- * @param activator The instance of the module activator
- *
- * @throws IllegalArgumentException if activator is null
- */
- void addModuleActivator(ModuleActivator activator);
-
- /**
- * Returns the module activator extensions.
- * @return The module activator extensions
- */
- List<ModuleActivator> getModuleActivators();
-
- /**
- * Remove a module activator
- * @param activator The module activator to remove
- *
- * @throws IllegalArgumentException if activator is null
- */
- void removeModuleActivator(Object activator);
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java
deleted file mode 100644
index 6b14b95666..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/core/UtilityExtensionPoint.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.core;
-
-
-/**
- * The extension point for the Tuscany core utility extensions.
- *
- * @version $Rev$ $Date$
- */
-public interface UtilityExtensionPoint {
-
- /**
- * Add a utility to the extension point
- * @param utility The instance of the utility
- *
- * @throws IllegalArgumentException if utility is null
- */
- void addUtility(Object utility);
-
- /**
- * Get the utility by the interface
- * @param utilityType The lookup key (utility interface)
- * @return The instance of the utility
- *
- * @throws IllegalArgumentException if utilityType is null
- */
- <T> T getUtility(Class<T> utilityType);
-
- /**
- * Remove a utility
- * @param utility The utility to remove
- *
- * @throws IllegalArgumentException if utility is null
- */
- void removeUtility(Object utility);
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscoverer.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscoverer.java
deleted file mode 100644
index c9bed94692..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscoverer.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.extensibility;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.ref.WeakReference;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A ServiceDiscoverer that find META-INF/services/... using the Context ClassLoader.
- *
- * @version $Rev$ $Date$
- */
-public class ClassLoaderServiceDiscoverer implements ServiceDiscoverer {
- private static final Logger logger = Logger.getLogger(ClassLoaderServiceDiscoverer.class.getName());
-
- public class ServiceDeclarationImpl implements ServiceDeclaration {
- private URL url;
- private String className;
- private Class<?> javaClass;
- private Map<String, String> attributes;
-
- public ServiceDeclarationImpl(URL url, String className, Map<String, String> attributes) {
- super();
- this.url = url;
- this.className = className;
- this.attributes = attributes;
- }
-
- public Map<String, String> getAttributes() {
- return attributes;
- }
-
- public String getClassName() {
- return className;
- }
-
- public URL getLocation() {
- return url;
- }
-
- public Class<?> loadClass() throws ClassNotFoundException {
- if (className == null) {
- return null;
- }
- if (javaClass == null) {
- javaClass = loadClass(className);
- }
- return javaClass;
- }
-
- public Class<?> loadClass(String className) throws ClassNotFoundException {
- return classLoaderReference.get().loadClass(className);
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("ClassLoader: ").append(classLoaderReference.get());
- sb.append(" Attributes: ").append(attributes);
- return sb.toString();
- }
-
- public URL getResource(final String name) {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return classLoaderReference.get().getResource(name);
- }
- });
- }
-
- }
-
- private WeakReference<ClassLoader> classLoaderReference;
-
- /**
- * Construct a service discoverer based on TCCL
- */
- public ClassLoaderServiceDiscoverer() {
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- this.classLoaderReference = new WeakReference<ClassLoader>(classLoader);
- }
-
- /**
- * Construct a service discoverer using the given classloader
- * @param classLoader
- */
- public ClassLoaderServiceDiscoverer(ClassLoader classLoader) {
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- this.classLoaderReference = new WeakReference<ClassLoader>(classLoader);
- }
-
- private List<URL> getResources(final String name, final boolean firstOnly) throws IOException {
- try {
- return AccessController.doPrivileged(new PrivilegedExceptionAction<List<URL>>() {
- public List<URL> run() throws IOException {
- if (firstOnly) {
- URL url = classLoaderReference.get().getResource(name);
- if (url != null) {
- return Arrays.asList(url);
- } else {
- return Collections.emptyList();
- }
- } else {
- List<URL> urls = Collections.list(classLoaderReference.get().getResources(name));
- return urls;
- }
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- }
-
- /**
- * Parse a service declaration in the form class;attr=value,attr=value and
- * return a map of attributes
- *
- * @param declaration
- * @return a map of attributes
- */
- private static Map<String, String> parseServiceDeclaration(String declaration) {
- Map<String, String> attributes = new HashMap<String, String>();
- int index = declaration.indexOf(';');
- if (index != -1) {
- attributes.put("class", declaration.substring(0, index).trim());
- declaration = declaration.substring(index);
- } else {
- int j = declaration.indexOf('=');
- if (j == -1) {
- attributes.put("class", declaration.trim());
- return attributes;
- } else {
- declaration = ";" + declaration;
- }
- }
- StringTokenizer tokens = new StringTokenizer(declaration);
- for (; tokens.hasMoreTokens();) {
- String key = tokens.nextToken("=").substring(1).trim();
- if (key == null)
- break;
- String value = tokens.nextToken(",").substring(1).trim();
- if (value == null)
- break;
- attributes.put(key, value);
- }
- return attributes;
- }
-
- public Set<ServiceDeclaration> discover(String serviceName, boolean firstOnly) {
- Set<ServiceDeclaration> descriptors = new HashSet<ServiceDeclaration>();
-
- String name = "META-INF/services/" + serviceName;
- boolean debug = logger.isLoggable(Level.FINE);
- try {
- for (final URL url : getResources(name, firstOnly)) {
- if (debug) {
- logger.fine("Reading service provider file: " + url.toExternalForm());
- }
-
- // Allow privileged access to open URL stream. Add FilePermission to added to security
- // policy file.
- InputStream is;
- try {
- is = AccessController.doPrivileged(new PrivilegedExceptionAction<InputStream>() {
- public InputStream run() throws IOException {
- URLConnection connection = url.openConnection();
- // TUSCANY-2539
- // Don't cache connections by default to stop Tuscany locking contribution jar files
- // done here as this is one of the first places we open a stream and the only way to
- // set the default is to set it on an instance of URLConnection
- connection.setDefaultUseCaches(false);
- connection.setUseCaches(false);
- return url.openStream();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (IOException)e.getException();
- }
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- int count = 0;
- while (true) {
- String line = reader.readLine();
- if (line == null)
- break;
- line = line.trim();
- if (!line.startsWith("#") && !"".equals(line)) {
- String reg = line.trim();
- if (debug) {
- logger.fine("Registering service provider: " + reg);
- }
-
- Map<String, String> attributes = parseServiceDeclaration(reg);
- String className = attributes.get("class");
- if (className == null) {
- // Add a unique class name to prevent equals() from returning true
- className = "_class_" + count;
- count++;
- }
- ServiceDeclarationImpl descriptor = new ServiceDeclarationImpl(url, className, attributes);
- descriptors.add(descriptor);
- if (firstOnly) {
- return descriptors;
- }
- }
- }
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException e) {
- // Ignore
- }
- }
- }
- }
- } catch (IOException e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- return descriptors;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.java
deleted file mode 100644
index 403b6aa7a7..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDeclaration.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.extensibility;
-
-import java.net.URL;
-import java.util.Map;
-
-/**
- * Service declaration using J2SE Jar service provider spec Classes specified
- * inside this declaration are loaded using the ClassLoader used to read the
- * configuration file corresponding to this declaration.
- *
- * @version $Rev$ $Date$
- */
-public interface ServiceDeclaration {
- /**
- * Load a java class in the same context as the service definition
- * @param className The class name
- * @return The loaded class
- * @throws ClassNotFoundException
- */
- Class<?> loadClass(String className) throws ClassNotFoundException;
- /**
- * Get the java class for the service impl
- * @return The java class
- */
- Class<?> loadClass() throws ClassNotFoundException;
- /**
- * Get all attributes (name=value pairs) defined for the given entry
- * @return All attributes keyed by name
- */
- Map<String, String> getAttributes();
-
- URL getLocation();
-
- String getClassName();
-
- URL getResource(String name);
-
- /**
- * The service descriptor might be hashed
- * @param obj Another object
- * @return
- */
- boolean equals(Object obj);
- /**
- * The service descriptor might be hashed
- * @return
- */
- int hashCode();
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.java
deleted file mode 100644
index 1722cd5f49..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscoverer.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.extensibility;
-
-import java.util.Set;
-
-/**
- * A SPI that allows different implementations of discovering service declarations
- */
-public interface ServiceDiscoverer {
- /**
- * Discover the service descriptors by name
- * @param serviceName The name of the service
- * @param firstOnly A flag to indicate if only the first instance is to be discovered
- *
- * @return A set of service descriptors
- */
- Set<ServiceDeclaration> discover(String serviceName, boolean firstOnly);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java b/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
deleted file mode 100644
index a95ab253ae..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/java/org/apache/tuscany/sca/extensibility/ServiceDiscovery.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extensibility;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Service discovery for Tuscany based on J2SE Jar service provider spec.
- * Services are described using configuration files in META-INF/services.
- * Service description specifies a class name followed by optional properties.
- *
- *
- * @version $Rev$ $Date$
- */
-public class ServiceDiscovery {
- private static final Logger logger = Logger.getLogger(ServiceDiscovery.class.getName());
-
- private final static ServiceDiscovery INSTANCE = new ServiceDiscovery();
-
- private ServiceDiscoverer discoverer;
- private Set<ClassLoader> registeredClassLoaders = new HashSet<ClassLoader>();
-
- /**
- * Get an instance of Service discovery, one instance is created per
- * ClassLoader that this class is loaded from
- *
- * @return
- */
- public static ServiceDiscovery getInstance() {
- return INSTANCE;
- }
-
- public ServiceDiscoverer getServiceDiscoverer() {
- if (discoverer == null) {
- discoverer = new ClassLoaderServiceDiscoverer();
- }
- return discoverer;
- }
-
- public void setServiceDiscoverer(ServiceDiscoverer sd) {
- if (discoverer != null) {
- throw new IllegalStateException("The ServiceDiscoverer cannot be reset");
- }
- discoverer = sd;
- }
-
- /**
- * @deprecated
- * Register a ClassLoader with this discovery mechanism. Tuscany extension
- * ClassLoaders are registered here.
- *
- * @param classLoader
- */
- @Deprecated
- public synchronized void registerClassLoader(ClassLoader classLoader) {
- registeredClassLoaders.add(classLoader);
- }
-
- /**
- * @deprecated
- * Unregister a ClassLoader with this discovery mechanism.
- *
- * @param classLoader
- */
- @Deprecated
- public synchronized void unregisterClassLoader(ClassLoader classLoader) {
- registeredClassLoaders.remove(classLoader);
- }
-
- /**
- * Get all service declarations for this name
- *
- * @param name
- * @return set of service declarations
- * @throws IOException
- */
- public Set<ServiceDeclaration> getServiceDeclarations(String name) throws IOException {
- Set<ServiceDeclaration> services = getServiceDiscoverer().discover(name, false);
- return services;
- }
-
- /**
- * Get all service declarations for this interface
- *
- * @param serviceInterface
- * @return set of service declarations
- * @throws IOException
- */
- public Set<ServiceDeclaration> getServiceDeclarations(Class<?> serviceInterface) throws IOException {
-
- return getServiceDeclarations(serviceInterface.getName());
- }
-
- /**
- * Load one service implementation class for this interface
- *
- * @param serviceInterface
- * @return service implementation class
- * @throws IOException
- * @throws ClassNotFoundException
- */
- public Class<?> loadFirstServiceClass(final Class<?> serviceInterface) throws IOException, ClassNotFoundException {
- // Try System property first
- String className = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty(serviceInterface.getName());
- }
- });
- if (className != null) {
- try {
- // Try the classloader for the service interface first
- return Class.forName(className, false, serviceInterface.getClassLoader());
- } catch (ClassNotFoundException e) {
- try {
- // Try the thread context classloader
- return Class.forName(className, false, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException ex) {
- logger.log(Level.WARNING, ex.getMessage(), ex);
- }
- }
- }
- Set<ServiceDeclaration> services = getServiceDiscoverer().discover(serviceInterface.getName(), true);
- if (services.isEmpty()) {
- return null;
- }
- return services.iterator().next().loadClass();
- }
-
- /**
- * Create a new instance of a factory service class.
- *
- * @param serviceInterface
- * @return service implementation class
- * @throws SecurityException
- * @throws NoSuchMethodException
- * @throws InvocationTargetException
- * @throws IllegalAccessException
- */
- public Object newFactoryClassInstance(final Class<?> serviceInterface) throws SecurityException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
- Method newInstanceMethod = serviceInterface.getMethod("newInstance");
- Object factory = newInstanceMethod.invoke(null);
- return factory;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint b/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint
deleted file mode 100644
index 42bad63132..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint
+++ /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.core.DefaultModuleActivatorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint b/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint
deleted file mode 100644
index d769bad283..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.UtilityExtensionPoint
+++ /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.core.DefaultUtilityExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscovererTestCase.java b/branches/sca-java-1.5.1/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscovererTestCase.java
deleted file mode 100644
index 92164eccc7..0000000000
--- a/branches/sca-java-1.5.1/modules/extensibility/src/test/java/org/apache/tuscany/sca/extensibility/ClassLoaderServiceDiscovererTestCase.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.extensibility;
-
-import java.util.Set;
-
-import junit.framework.Assert;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * Test Case for ClasspathServiceDiscover
- */
-public class ClassLoaderServiceDiscovererTestCase {
- private static ClassLoaderServiceDiscoverer discover;
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- discover = new ClassLoaderServiceDiscoverer();
- }
-
- @Test
- public void testDiscovery() {
- Set<ServiceDeclaration> discriptors =
- discover.discover("org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint", false);
- Assert.assertEquals(1, discriptors.size());
- discriptors =
- discover.discover("notthere", false);
- Assert.assertEquals(0, discriptors.size());
- }
-
- @Test
- public void testDiscoveryFirst() {
- Set<ServiceDeclaration> discriptors =
- discover.discover("org.apache.tuscany.sca.core.ModuleActivatorExtensionPoint", true);
- Assert.assertEquals(1, discriptors.size());
- discriptors =
- discover.discover("notthere", true);
- Assert.assertEquals(0, discriptors.size());
- }
-
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/LICENSE b/branches/sca-java-1.5.1/modules/extension-helper/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/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-java-1.5.1/modules/extension-helper/NOTICE b/branches/sca-java-1.5.1/modules/extension-helper/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/pom.xml b/branches/sca-java-1.5.1/modules/extension-helper/pom.xml
deleted file mode 100644
index 972566f4e5..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/pom.xml
+++ /dev/null
@@ -1,95 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-extension-helper</artifactId>
- <name>Apache Tuscany SCA Extension Helper</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.extension.helper</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.extension*</Export-Package>
- <DynamicImport-Package>org.apache.tuscany.sca.host.http</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java
deleted file mode 100644
index e117e952c7..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/BindingActivator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A BindingActivator adds an SCA binding type to the Tuscany runtime.
- *
- * The SCDL XML used for the binding is derived from the name of the
- * class returned from the getBindingClass method - the package name and
- * any trailing "Binding" string is removed, leading upper case characters
- * are converted to lowercase, and the suffix "binding." is added.
- * For example if getBindingClass returns a class named "mypkg.FooBinding"
- * then the SCDL for the binding will be <binding.foo>.
- *
- * Attributes of the <binding.foo> SCDL are based on the getters/setters of
- * the binding class. So if FooBinding had getBar/setBar then there
- * would be an attribute name 'bar', for example, <binding.foo bar="xxx">.
- *
- * BindingActivator implementations may use constructor arguments to have
- * Tuscany ExtensionPointRegistry objects passed in on their constructor.
- * For example:
- *
- * public class MyBindingActivator implements BindingActivator {
- * ServletHost servletHost;
- * public MyBindingActivator(ServletHost servletHost) {
- * this.servletHost = servletHost;
- * }
- * ...
- * }
- *
- * BindingActivator implementations are discovered by the Tuscany runtime
- * using the J2SE jar file extensions for service provider discovery. All
- * that means is packaging the new binding type in a jar which contains a
- * file META-INF/services/org.apache.tuscany.sca.extension.helper.BindingActivator and
- * that file lists the BindingActivator implementation class name.
- *
- * @version $Rev$ $Date$
- */
-public interface BindingActivator<B> {
-
- Class<B> getBindingClass();
-
- InvokerFactory createInvokerFactory(RuntimeComponent rc, RuntimeComponentReference rcr, Binding b, B pojoBinding);
-
- ComponentLifecycle createService(RuntimeComponent rc, RuntimeComponentService rcs, Binding b, B pojoBinding);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java
deleted file mode 100644
index 92b6e4191f..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ComponentLifecycle.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper;
-
-/**
- * Interface that defines the Component Lifecycle methods.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentLifecycle {
-
- void start();
- void stop();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java
deleted file mode 100644
index 7d2a9c3d2d..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/ImplementationActivator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * An ImplementationActivator adds an SCA implementation type to the Tuscany runtime.
- *
- * The SCDL XML used for the implementation is derived from the name of the
- * class returned from the getImplementationClass method - the package name and
- * any trailing "Implementation" string is removed, leading upper case characters
- * are converted to lowercase, and the suffix "implementation." is added. For
- * example if getImplementationClass returns a class named "mypkg.FooImplementation"
- * then the SCDL for the implementation will be <implementation.foo>.
- *
- * Attributes of the <implementation.foo> SCDL are based on the getters/setters of
- * the Implementation class. So if FooImplementation had getBar/setBar then there
- * would be an attribute name 'bar', for example, <implementation.foo bar="xxx">.
- *
- * BindingActivator implementations may use constructor arguments to have
- * Tuscany ExtensionPointRegistry objects passed in on their constructor.
- * For example:
- *
- * public class MyImplementationActivator implements ImplementationActivator {
- * ServletHost servletHost;
- * public MyImplementationActivator(ServletHost servletHost) {
- * this.servletHost = servletHost;
- * }
- * ...
- * }
- *
- * ImplementationActivator implementations are discovered by the Tuscany runtime
- * using the J2SE jar file extensions for service provider discovery. All
- * that means is packaging the new binding type in a jar which contains a
- * file META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator and
- * that file lists the ImplementationActivator implementation class name.
- *
- * @version $Rev$ $Date$
- */
-public interface ImplementationActivator<T> {
-
- Class<T> getImplementationClass();
-
- InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, T implementation);
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java
deleted file mode 100644
index c51a7267cc..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/InvokerFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-
-/**
- * Interface that defines the methods for an Invoker Factory.
- *
- * @version $Rev$ $Date$
- */
-public interface InvokerFactory {
-
- Invoker createInvoker(Operation operation);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
deleted file mode 100644
index 8b99701baa..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingSCDLProcessor.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.NamespaceContext;
-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.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.extension.helper.utils.AbstractBinding;
-
-/**
- * An SCDL ArtifactProcessor which uses the Binding class getters/setters
- * to define the SCDL attributes.
- *
- * TODO: merge this with SCDLProcessor
- *
- * @version $Rev$ $Date$
- */
-public class BindingSCDLProcessor implements StAXArtifactProcessor {
-
- protected QName scdlQName;
- protected Class<Binding> bindingClass;
-
- protected Map<String, Method> attributeSetters;
- protected Method elementTextSetter;
-
- public BindingSCDLProcessor(QName scdlQName, Class<Binding> implementationClass) {
- this.scdlQName = scdlQName;
- this.bindingClass = implementationClass;
- initAttributes();
- }
-
- protected void initAttributes() {
- attributeSetters = new HashMap<String, Method>();
- Set<Method> methods = new HashSet<Method>(Arrays.asList(bindingClass.getMethods()));
- methods.removeAll(Arrays.asList(AbstractBinding.class.getMethods()));
- for (Method m : methods) {
- if ("setElementText".equals(m.getName())) {
- elementTextSetter = m;
- } else if ((m.getName().startsWith("set"))) {
- attributeSetters.put(getFieldName(m), m);
- }
- }
- }
-
- /**
- * Remove get/set from method name, set 1st char to lowercase and
- * remove any trailing underscore character
- */
- protected String getFieldName(Method m) {
- StringBuilder sb = new StringBuilder(m.getName().substring(3));
- sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
- String name = sb.toString();
- if (name.endsWith("_")) {
- name = name.substring(0,name.length()-1);
- }
- return name;
- }
-
- public QName getArtifactType() {
- return scdlQName;
- }
-
- public Class getModelType() {
- //FIXME Having two different bindings, PojoBinding wrapping
- // the real binding is pretty confusing, looks like if you don't return
- // PojoBinding here, the write and resolve methods will never be
- // called, returning PojoBinding.class seems to fix that issue without
- // breaking anything else
- return PojoBinding.class;
- }
-
- public Binding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Object impl;
- try {
- impl = bindingClass.newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- for (String attribute : attributeSetters.keySet()) {
- String value = reader.getAttributeValue(null, attribute);
- if (value != null && value.length() > 0) {
- try {
- attributeSetters.get(attribute).invoke(impl, new Object[] {value});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- //FIXME: none of the attributes of Binding seem to be working with PojoBinding
- // For now at least read the binding URI
- String uri = reader.getAttributeValue(null, "uri");
-
- if (elementTextSetter != null) {
- try {
- String value = reader.getElementText();
- if (value != null && value.length() > 0) {
- elementTextSetter.invoke(impl, value);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
- reader.next();
- }
-
- if (!(impl instanceof Binding)) {
- impl = new PojoBinding(impl);
-
- //FIXME: none of the attributes of Binding seem to be working with PojoBinding
- // For now at least read the binding URI
- if (uri != null) {
- ((PojoBinding)impl).setURI(uri);
- }
- }
- return (Binding)impl;
- }
-
- public void resolve(Object model, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public void write(Object model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- //FIXME: none of the attributes of Binding seem to be working with PojoBinding
- // For now at least write the binding URI
-
- // Find a namespace prefix and write the element
- String prefix = writer.getPrefix(scdlQName.getNamespaceURI());
- if (prefix == null) {
- NamespaceContext nsc = writer.getNamespaceContext();
- for (int i=1; ; i++) {
- prefix = "ns" + i;
- if (nsc.getNamespaceURI(prefix) == null) {
- break;
- }
- }
- // writer.setPrefix(prefix, scdlQName.getNamespaceURI());
- }
- writer.writeStartElement(scdlQName.getNamespaceURI(), scdlQName.getLocalPart());
- writer.writeNamespace(prefix, scdlQName.getNamespaceURI());
-
- // Write the binding URI attribute
- String uri;
- try {
- uri = (String)model.getClass().getMethod("getURI").invoke(model);
- } catch (Exception e) {
- uri = null;
- }
- if (uri != null) {
- writer.writeAttribute("uri", uri);
- }
-
- writer.writeEndElement();
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.java
deleted file mode 100644
index bca1dac0ed..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/BindingsActivator.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.extension.helper.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.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.extension.helper.BindingActivator;
-import org.apache.tuscany.sca.extension.helper.ComponentLifecycle;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.BindingProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
-import org.apache.tuscany.sca.provider.ServiceBindingProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BindingsActivator implements ModuleActivator {
-
- protected List<BindingActivator> bindingActivators;
- protected AssemblyFactory assemblyFactory;
- protected Map<Class, BindingActivator> bindingActivatorMap = new HashMap<Class, BindingActivator>();
-
- public void start(ExtensionPointRegistry registry) {
-
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
-
-
- this.bindingActivators =
- DiscoveryUtils.discoverActivators(BindingActivator.class, registry);
-
- StAXArtifactProcessorExtensionPoint staxProcessors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- for (final BindingActivator bindingActivator : bindingActivators) {
- Class bindingClass = bindingActivator.getBindingClass();
- bindingActivatorMap.put(bindingClass, bindingActivator);
- QName scdlQName = getBindingQName(bindingClass);
- staxProcessors.addArtifactProcessor(new BindingSCDLProcessor(scdlQName, bindingClass));
-
- // Check if the binding extends from Binding interface
- if (Binding.class.isAssignableFrom(bindingClass)) {
- // Add provider factory against the binding class
- providerFactories.addProviderFactory(new DelegatingBindingProviderFactory(bindingClass));
- }
-
- }
-
- // Add a generic provider factory against PojoBinding.class
- providerFactories.addProviderFactory(new DelegatingBindingProviderFactory(PojoBinding.class));
- }
-
- public void stop(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint staxProcessors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- for (final BindingActivator bindingActivator : bindingActivators) {
-
- // Remove the binding SCDL processor from the runtime
- if (staxProcessors != null) {
- StAXArtifactProcessor processor =
- staxProcessors.getProcessor(getBindingQName(bindingActivator.getBindingClass()));
- if (processor != null) {
- staxProcessors.removeArtifactProcessor(processor);
- }
- }
-
- // Remove the ProviderFactory from the runtime
- if (providerFactories != null && bindingActivator.getBindingClass() != null) {
- ProviderFactory factory = providerFactories.getProviderFactory(bindingActivator.getBindingClass());
- if (factory != null) {
- providerFactories.removeProviderFactory(factory);
- }
- }
- }
- if (providerFactories != null) {
- ProviderFactory factory = providerFactories.getProviderFactory(PojoBinding.class);
- if (factory != null) {
- providerFactories.removeProviderFactory(factory);
- }
- }
- }
-
- protected QName getBindingQName(Class bindingClass) {
- String localName = bindingClass.getName();
- if (localName.lastIndexOf('.') > -1) {
- localName = localName.substring(localName.lastIndexOf('.') + 1);
- }
- if (localName.endsWith("Binding")) {
- localName = localName.substring(0, localName.length() - 7);
- }
- StringBuilder sb = new StringBuilder(localName);
- for (int i = 0; i < sb.length(); i++) {
- if (Character.isUpperCase(sb.charAt(i))) {
- sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
- } else {
- break;
- }
- }
- return new QName(Constants.SCA10_TUSCANY_NS, "binding." + sb.toString());
- }
-
- private final class DelegatingBindingProviderFactory implements BindingProviderFactory {
- private Class modelType;
-
- public DelegatingBindingProviderFactory(Class modelType) {
- super();
- this.modelType = modelType;
- }
-
- public ReferenceBindingProvider createReferenceBindingProvider(final RuntimeComponent rc,
- final RuntimeComponentReference rcr,
- final Binding b) {
- final Object realBinding;
- if (b instanceof PojoBinding) {
- realBinding = ((PojoBinding)b).getUserBinding();
- } else {
- realBinding = b;
- }
- final BindingActivator bindingActivator = bindingActivatorMap.get(realBinding.getClass());
- return new ReferenceBindingProvider() {
- List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
- private InvokerFactory factory;
-
- public Invoker createInvoker(Operation operation) {
- InvokerProxy invoker = new InvokerProxy(factory, operation);
- invokers.add(invoker);
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
-
- public void start() {
- if (b instanceof PojoBinding) {
- factory = bindingActivator.createInvokerFactory(rc, rcr, b, ((PojoBinding)b).getUserBinding());
- } else {
- factory = bindingActivator.createInvokerFactory(rc, rcr, b, b);
- }
- if ( (factory != null) && (factory instanceof ComponentLifecycle)) {
- ((ComponentLifecycle)factory).start();
- }
-// for (InvokerProxy invoker : invokers) {
-// invoker.start(factory);
-// }
- }
-
- public void stop() {
- if (factory instanceof ComponentLifecycle) {
- ((ComponentLifecycle)factory).stop();
- }
- }
- };
- }
-
- public ServiceBindingProvider createServiceBindingProvider(final RuntimeComponent rc,
- final RuntimeComponentService rcs,
- final Binding b) {
- final Object realBinding;
- if (b instanceof PojoBinding) {
- realBinding = ((PojoBinding)b).getUserBinding();
- } else {
- realBinding = b;
- }
- final BindingActivator bindingActivator = bindingActivatorMap.get(realBinding.getClass());
- return new ServiceBindingProvider() {
- ComponentLifecycle listener = bindingActivator.createService(rc, rcs, b, realBinding);
-
- public InterfaceContract getBindingInterfaceContract() {
- return null;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- listener.start();
- }
-
- public void stop() {
- listener.stop();
- }
- };
- }
-
- public Class getModelType() {
- return modelType;
- }
- }
-
-}
-
-class InvokerProxy implements Invoker {
- InvokerFactory factory;
- Invoker invoker;
- Operation op;
-
- InvokerProxy(InvokerFactory factory, Operation op) {
- this.factory = factory;
- this.op = op;
- this.invoker = factory.createInvoker(op);
- }
-
- public Message invoke(Message arg0) {
- return invoker.invoke(arg0);
- }
-
-// public void start(InvokerFactory factory) {
-// invoker = factory.createInvoker(op);
-// }
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java
deleted file mode 100644
index 720d409a44..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/DiscoveryUtils.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.impl;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Discovers Activators in the classpath using the J2SE
- * jar file extensions for Service Provider discovery
- *
- * @version $Rev$ $Date$
- */
-public class DiscoveryUtils {
-
- @SuppressWarnings("unchecked")
- public static <T> List<T> discoverActivators(Class<T> activatorClass, ExtensionPointRegistry registry) {
- List<T> activators;
- try {
- Set<ServiceDeclaration> activatorClasses =
- ServiceDiscovery.getInstance().getServiceDeclarations(activatorClass);
- activators = new ArrayList<T>();
- for (ServiceDeclaration declaration : activatorClasses) {
- try {
- Class<T> c = (Class<T>)declaration.loadClass();
- activators.add(c.cast(instantiateActivator(c, registry)));
- } catch (Throwable e) {
- e.printStackTrace(); // TODO: log
- }
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return activators;
- }
-
- static Object instantiateActivator(Class activator, ExtensionPointRegistry registry) {
- Constructor[] cs = activator.getConstructors();
- if (cs.length != 1) {
- throw new RuntimeException("Activator must have only one constructors");
- }
-
- Class<?>[] paramTypes = cs[0].getParameterTypes();
- Object[] extensions = new Object[paramTypes.length];
-
- for (int i = 0; i < paramTypes.length; i++) {
- if ("org.apache.tuscany.sca.host.http.ServletHost".equals(paramTypes[i].getName())) {
- extensions[i] = getServletHost(registry);
- } else {
- extensions[i] = registry.getExtensionPoint(paramTypes[i]);
- }
- }
-
- try {
-
- return cs[0].newInstance(extensions);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- private static Object getServletHost(ExtensionPointRegistry registry) {
- try {
-
- Class<?> servletHostEPClass = Class.forName("org.apache.tuscany.sca.host.http.ServletHostExtensionPoint");
- Object servletHostEP = registry.getExtensionPoint(servletHostEPClass);
- Class<?> extensibleServletHost = Class.forName("org.apache.tuscany.sca.host.http.ExtensibleServletHost");
- return extensibleServletHost.getConstructor(new Class[] {servletHostEPClass}).newInstance(servletHostEP);
-
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.java
deleted file mode 100644
index f7c65acb3d..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationImplementationProvider.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.extension.helper.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The ImplementationProvider createInvoker method is called before the start method
- * but the runtime isn't properly setup until the start method is called. This means
- * that Invoker's can't initialize things like the services, references and properties
- * until start is called. This class tries to get around that by using an Invoker
- * proxy that delays creating the real Invoker till start is called.
- *
- * @version $Rev$ $Date$
- */
-public class ImplementationImplementationProvider implements ImplementationProvider {
-
- ImplementationActivator implementationActivator;
- RuntimeComponent runtimeComponent;
- Implementation impl;
- Object userImpl;
- InvokerFactory factory;
-
- List<InvokerProxy> invokers = new ArrayList<InvokerProxy>();
-
- public ImplementationImplementationProvider(ImplementationActivator implementationActivator,
- RuntimeComponent rc,
- Implementation impl,
- Object userImpl) {
- this.implementationActivator = implementationActivator;
- this.runtimeComponent = rc;
- this.impl = impl;
- this.userImpl = userImpl;
- }
-
- public Invoker createInvoker(RuntimeComponentService arg0, final Operation op) {
- InvokerProxy invoker = new InvokerProxy(op);
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- factory = implementationActivator.createInvokerFactory(runtimeComponent, impl, userImpl);
- }
-
- public void stop() {
- }
-
- class InvokerProxy implements Invoker {
- Invoker invoker;
- Operation op;
-
- InvokerProxy(Operation op) {
- this.op = op;
- }
-
- public Message invoke(Message msg) {
- init();
- return invoker.invoke(msg);
- }
-
- public synchronized void init() {
- if (invoker == null) {
- invoker = factory.createInvoker(op);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java
deleted file mode 100644
index a861a8ddf0..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/ImplementationsActivator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.impl;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
-import org.apache.tuscany.sca.extension.helper.utils.DefaultPropertyValueObjectFactory;
-import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A Tuscany ModuleActivator which activates all the ImplementationActivators
- *
- * @version $Rev$ $Date$
- */
-public class ImplementationsActivator implements ModuleActivator {
-
- protected List<ImplementationActivator> implementationActivators;
-
- public void start(ExtensionPointRegistry registry) {
-
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
-
- Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
-
- //FIXME Pass this factory differently as it's not an extension point
- PropertyValueObjectFactory propertyFactory = new DefaultPropertyValueObjectFactory(mediator);
- registry.addExtensionPoint(propertyFactory);
-
- this.implementationActivators = DiscoveryUtils.discoverActivators(ImplementationActivator.class, registry);
-
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- for (final ImplementationActivator implementationActivator : implementationActivators) {
-
- Class<Implementation> implClass = implementationActivator.getImplementationClass();
- QName scdlQName = getSCDLQName(implClass);
- staxProcessors.addArtifactProcessor(new SCDLProcessor(assemblyFactory, scdlQName, implClass, registry, factories));
-
- if (implementationActivator.getImplementationClass() != null && providerFactories != null) {
- addImplementationProvider(implementationActivator, providerFactories);
- }
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint staxProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- for (final ImplementationActivator implementationActivator : implementationActivators) {
- if (staxProcessors != null) {
- StAXArtifactProcessor processor = staxProcessors.getProcessor(getSCDLQName(implementationActivator.getImplementationClass()));
- if (processor != null) {
- staxProcessors.removeArtifactProcessor(processor);
- }
- }
- }
- }
-
- private void addImplementationProvider(final ImplementationActivator implementationActivator, ProviderFactoryExtensionPoint providerFactories) {
-
- providerFactories.addProviderFactory(new ImplementationProviderFactory() {
- public ImplementationProvider createImplementationProvider(final RuntimeComponent rc, final Implementation impl) {
- if (impl instanceof PojoImplementation) {
- return new ImplementationImplementationProvider(implementationActivator, rc, impl, ((PojoImplementation)impl).getUserImpl());
- } else {
- return new ImplementationImplementationProvider(implementationActivator, rc, impl, impl);
- }
- }
- public Class getModelType() {
- Class c = implementationActivator.getImplementationClass();
-
- if (Implementation.class.isAssignableFrom(c)) {
- return c;
- } else {
- return PojoImplementation.class;
- }
- }
- });
- }
-
- protected QName getSCDLQName(Class implementationClass) {
- String localName = implementationClass.getName();
- if (localName.lastIndexOf('.') > -1) {
- localName = localName.substring(localName.lastIndexOf('.') + 1);
- }
- if (localName.endsWith("Implementation")) {
- localName = localName.substring(0, localName.length() - 14);
- }
- StringBuilder sb = new StringBuilder(localName);
- for (int i=0; i<sb.length(); i++) {
- if (Character.isUpperCase(sb.charAt(i))) {
- sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
- } else {
- break;
- }
- }
- return new QName(Constants.SCA10_TUSCANY_NS, "implementation." + sb.toString());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.java
deleted file mode 100644
index de9a5bfbb1..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoBinding.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.extension.helper.impl;
-
-import org.apache.tuscany.sca.extension.helper.utils.AbstractBinding;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class PojoBinding extends AbstractBinding {
-
- Object userBinding;
-
- public PojoBinding(Object userImpl) {
- this.userBinding = userImpl;
- }
-
- public Object getUserBinding() {
- return userBinding;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java
deleted file mode 100644
index a59733aced..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/PojoImplementation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.impl;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.extension.helper.utils.DynamicImplementation;
-
-/**
- * Enables Implementation extensions to use a simple POJO
- * for the implementation object instead of requiring
- * implementing the Implementation interface.
- *
- * @version $Rev$ $Date$
- */
-public class PojoImplementation<Implementation> extends DynamicImplementation {
-
- Object userImpl;
-
- public PojoImplementation(Object userImpl) {
- this.userImpl = userImpl;
- }
-
- public Object getUserImpl() {
- return userImpl;
- }
-
- public void resolve(ModelResolver resolver) {
-
- try {
- Method resolveMethod;
- if (userImpl != null &&
- (resolveMethod = userImpl.getClass().getMethod("resolve", ModelResolver.class)) != null) {
- resolveMethod.invoke(userImpl, resolver);
- }
- } catch (Exception e) {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java
deleted file mode 100644
index c91618c24d..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/impl/SCDLProcessor.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.extension.helper.utils.AbstractStAXArtifactProcessor;
-import org.apache.tuscany.sca.extension.helper.utils.DynamicImplementation;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * An SCDL ArtifactProcessor which uses the Implementation class getters/setters
- * to define the SCDL attributes.
- *
- * @version $Rev$ $Date$
- */
-public class SCDLProcessor extends AbstractStAXArtifactProcessor<Implementation> {
-
- protected QName scdlQName;
- protected Class<Implementation> implementationClass;
- protected ExtensionPointRegistry registry;
- protected ModelFactoryExtensionPoint factories;
-
- protected Map<String, Method> attributeSetters;
- protected Method elementTextSetter;
-
- public SCDLProcessor(AssemblyFactory assemblyFactory, QName scdlQName, Class<Implementation> implementationClass, ExtensionPointRegistry registry, ModelFactoryExtensionPoint factories) {
- super(assemblyFactory);
- this.scdlQName = scdlQName;
- this.implementationClass = implementationClass;
- this.registry = registry;
- this.factories = factories;
- initAttributes();
- }
-
- protected void initAttributes() {
- attributeSetters = new HashMap<String, Method>();
- Set<Method> methods = new HashSet<Method>(Arrays.asList(implementationClass.getMethods()));
- methods.removeAll(Arrays.asList(DynamicImplementation.class.getMethods()));
- for (Method m : methods) {
- if ("setElementText".equals(m.getName())) {
- elementTextSetter = m;
- } else if ((m.getName().startsWith("set"))) {
- attributeSetters.put(getFieldName(m), m);
- }
- }
- }
-
- /**
- * Remove get/set from method name, set 1st char to lowercase and
- * remove any trailing underscore character
- */
- protected String getFieldName(Method m) {
- StringBuilder sb = new StringBuilder(m.getName().substring(3));
- sb.setCharAt(0, Character.toLowerCase(sb.charAt(0)));
- String name = sb.toString();
- if (name.endsWith("_")) {
- name = name.substring(0,name.length()-1);
- }
- return name;
- }
-
- private Object[] getImplConstrArgs() {
- Constructor[] cs = implementationClass.getConstructors();
- if (cs.length != 1) {
- throw new IllegalArgumentException("Implementation class must have a single constructor: "+ implementationClass.getName());
- }
- List args = new ArrayList();
- for (Class c : cs[0].getParameterTypes()) {
- Object o = factories.getFactory(c);
- if (o == null) {
- o = registry.getExtensionPoint(c);
- }
- args.add(o);
- }
- return args.toArray();
- }
-
-
- public QName getArtifactType() {
- return scdlQName;
- }
-
- public Class<Implementation> getModelType() {
- Class clazz;
- if (Implementation.class.isAssignableFrom(implementationClass)) {
- clazz = implementationClass;
- } else {
- clazz = PojoImplementation.class;
- }
- return clazz;
- }
-
- public Implementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Object impl;
- try {
- impl = implementationClass.getConstructors()[0].newInstance(getImplConstrArgs());
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- for (String attribute : attributeSetters.keySet()) {
- String value = reader.getAttributeValue(null, attribute);
- if (value != null && value.length() > 0) {
- try {
- attributeSetters.get(attribute).invoke(impl, new Object[] {value});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- if (elementTextSetter != null) {
- try {
- String value = reader.getElementText();
- if (value != null && value.length() > 0) {
- elementTextSetter.invoke(impl, value);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- while (!(reader.getEventType() == END_ELEMENT && scdlQName.equals(reader.getName())) && reader.hasNext()) {
- reader.next();
- }
-
- if (!(impl instanceof Implementation)) {
- impl = new PojoImplementation(impl);
- }
-
- return (Implementation)impl;
- }
-
- public void write(Implementation arg0, XMLStreamWriter arg1) throws ContributionWriteException, XMLStreamException {
- }
-
- @Override
- protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
-// protected void addSideFileComponentType(Implementation impl, ModelResolver resolver) {
-
- ComponentType componentType;
- try {
- componentType = getComponentType(resolver, impl);
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
-
- if (componentType != null && !componentType.isUnresolved()) {
- for (Reference reference : componentType.getReferences()) {
- impl.getReferences().add(reference);
- }
- for (Service service : componentType.getServices()) {
- impl.getServices().add(service);
- }
- for (Property property : componentType.getProperties()) {
- impl.getProperties().add(property);
- }
- if (componentType.getConstrainingType() != null) {
- impl.setConstrainingType(componentType.getConstrainingType());
- }
- }
- }
-
- ComponentType getComponentType(ModelResolver resolver, Implementation impl) throws IllegalArgumentException, IllegalAccessException,
- InvocationTargetException {
- for (Method m : getGetters()) {
- Object io;
- if (impl instanceof PojoImplementation) {
- io = ((PojoImplementation) impl).getUserImpl();
- } else {
- io = impl;
- }
- String value = (String) m.invoke(io, new Object[] {});
- if (value != null) {
- value = value.substring(0, value.lastIndexOf('.'));
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- componentType.setURI(value + ".componentType");
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (!componentType.isUnresolved()) {
- return componentType;
- }
- }
- }
- return null;
- }
-
- private List<Method> getGetters() {
- List<Method> ms = new ArrayList<Method>();
- for (Method setter : attributeSetters.values()) {
- String s = getFieldName(setter);
- for (Method m : implementationClass.getMethods()) {
- String name = m.getName();
- if (name.length() > 3 && name.startsWith("get")) {
- if (s.endsWith(name.substring(4))) {
- ms.add(m);
- }
- }
- }
- }
- return ms;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.java
deleted file mode 100644
index 112fb09f2a..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractBinding.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.extension.helper.utils;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-
-/**
- * Helper for implementing Bindings, implements all the
- * standard getters and setters on the binding interface.
- *
- * @version $Rev$ $Date$
- */
-public class AbstractBinding implements Binding {
-
- private String name;
- private String uri;
- private List<Object> extensions;
- private boolean unresolved;
-
- 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 unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java
deleted file mode 100644
index 0e658cfd1e..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-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.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Helper for implementing Implementations, implements all the
- * standard getters and setters on the Implementation interface.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractImplementation implements Implementation {
-
- private List<Service> services = new ArrayList<Service>();
- private List<Reference> references = new ArrayList<Reference>();
- private List<Property> properties = new ArrayList<Property>();
- private ConstrainingType constrainingType;
- private String uri;
- private boolean unresolved = true;
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private IntentAttachPointType type = null;
-
- public AbstractImplementation() {
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public List<Reference> getReferences() {
- return references;
- }
-
- public List<Service> getServices() {
- return services;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public ConstrainingType getConstrainingType() {
- return constrainingType;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- this.constrainingType = constrainingType;
- }
-
- public List<Object> getExtensions() {
- // TODO what is this for?
- return null;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public Service getService(String name) {
- for (Service service : getServices()) {
- if (service.getName().equals(name)) {
- return service;
- }
- }
- return null;
- }
-
- public Reference getReference(String name) {
- for (Reference reference : getReferences()) {
- if (reference.getName().equals(name)) {
- return reference;
- }
- }
- return null;
- }
-
- public Property getProptery(String name) {
- for (Property property : getProperties()) {
- if (property.getName().equals(name)) {
- return property;
- }
- }
- return null;
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- // public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- // this.configuredOperations = configuredOperations;
- // }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return type;
- }
-
- public void setType(IntentAttachPointType type) {
- this.type = type;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.java
deleted file mode 100644
index 9a521b5b79..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractStAXArtifactProcessor.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.extension.helper.utils;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-
-/**
- * TODO: couldn't something like this class be provided by the runtime?
- * Each impl shouldn't have to have their own .componentType merging code
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractStAXArtifactProcessor<I extends Implementation> implements StAXArtifactProcessor<I> {
-
- protected AssemblyFactory assemblyFactory;
-
- public AbstractStAXArtifactProcessor(AssemblyFactory assemblyFactory) {
- this.assemblyFactory = assemblyFactory;
- }
-
- public void resolve(I model, ModelResolver resolver) throws ContributionResolveException {
-
- addSideFileComponentType(model.getURI(), model, resolver);
-
- if (model instanceof DynamicImplementation) {
- // if no services have been defined then add a dynamic one
- if (model.getServices().size() < 1) {
- Service dynamicService = createDynamicService();
- model.getServices().add(dynamicService);
- }
- }
-
- // Allow implementation classes to resolve themselves
- try {
- Method resolveMethod;
- if ((resolveMethod = model.getClass().getMethod("resolve", ModelResolver.class)) != null) {
- resolveMethod.invoke(model, resolver);
- }
- } catch (Exception e) {
- }
-
- model.setUnresolved(false);
- }
-
- protected void addSideFileComponentType(String name, Implementation impl, ModelResolver resolver) {
- if (name == null) {
- return;
- }
- int lastDot = name.lastIndexOf('.');
- if (lastDot < 0) {
- return;
- }
- String sideFileName = name.substring(0, lastDot) + ".componentType";
-
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setURI(sideFileName);
- componentType.setUnresolved(true);
-
- componentType = resolver.resolveModel(ComponentType.class, componentType);
-
- if (!componentType.isUnresolved()) {
- for (Reference reference : componentType.getReferences()) {
- impl.getReferences().add(reference);
- }
- for (Service service : componentType.getServices()) {
- impl.getServices().add(service);
- }
- for (Property property : componentType.getProperties()) {
- impl.getProperties().add(property);
- }
- if (componentType.getConstrainingType() != null) {
- impl.setConstrainingType(componentType.getConstrainingType());
- }
- }
- }
-
- protected Service createDynamicService() {
- Service dynamicService = assemblyFactory.createService();
- dynamicService.setName("$dynamic$");
- InterfaceContract dynamicInterfaceContract = new InterfaceContractImpl() {};
- Interface dynamicInterface = new DynamicInterfaceImpl();
- Operation dynamicOperation = new OperationImpl();
- dynamicOperation.setDynamic(true);
- dynamicInterface.getOperations().add(dynamicOperation);
- dynamicInterfaceContract.setInterface(dynamicInterface);
- dynamicService.setInterfaceContract(dynamicInterfaceContract);
-
- return dynamicService;
- }
-
- private static class DynamicInterfaceImpl extends InterfaceImpl {
- @Override
- public boolean isDynamic() {
- return true;
- }
-
- }
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java
deleted file mode 100644
index 550498d7b1..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DefaultPropertyValueObjectFactory.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.extension.helper.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * TODO: Shouldn't this class be provided by the runtime?
- *
- * @version $Rev$ $Date$
- */
-public class DefaultPropertyValueObjectFactory implements PropertyValueObjectFactory {
- // protected DataBindingRegistry dbRegistry = new DataBindingRegistryImpl();
- protected Mediator mediator = null;
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- boolean isSimpleType;
-
- public DefaultPropertyValueObjectFactory(Mediator mediator) {
- this.mediator = mediator;
- }
-
- /* (non-Javadoc)
- * @see org.apache.tuscany.sca.extension.helper.utils.PVOF#createValueFactory(org.apache.tuscany.sca.assembly.Property)
- */
- public ObjectFactory createValueFactory(Property property) {
- isSimpleType = isSimpleType(property);
- Document doc = (Document)property.getValue();
- Element rootElement = doc.getDocumentElement();
-
- //FIXME : since scripts use dynamic types we need to generate a dynamic java type using the
- //XML structure of the property value. Should this be done in the JavaBeansDataBinding...
- Class javaType = null;
-
- if (property.isMany()) {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- List<String> values =
- getSimplePropertyValues(value, javaType);
- return new ListObjectFactoryImpl(property,
- values,
- isSimpleType,
- javaType);
- } else {
- return new ListObjectFactoryImpl(property,
- getComplexPropertyValues(doc),
- isSimpleType,
- javaType);
- }
- } else {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- } else {
- Object value = getComplexPropertyValues(doc).get(0);
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- }
-
- }
- }
-
- private boolean isSimpleType(Property property) {
- if (property.getXSDType() != null) {
- return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
- } else {
- if (property instanceof Document) {
- Document doc = (Document)property;
- Element element = doc.getDocumentElement();
- if (element.getChildNodes().getLength() == 1 &&
- element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) {
- return true;
- }
- }
- }
- return false;
- }
-
- private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
- List<String> propValues = new ArrayList<String>();
- StringTokenizer st = null;
- if ( javaType.getName().equals("java.lang.String")) {
- st = new StringTokenizer(concatenatedValue, "\"");
- } else {
- st = new StringTokenizer(concatenatedValue);
- }
- String aToken = null;
- while (st.hasMoreTokens()) {
- aToken = st.nextToken();
- if (aToken.trim().length() > 0) {
- propValues.add(aToken);
- }
- }
- return propValues;
- }
-
- private List<Node> getComplexPropertyValues(Document document) {
- Element rootElement = document.getDocumentElement();
- List<Node> propValues = new ArrayList<Node>();
- for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
- if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) {
- propValues.add(rootElement.getChildNodes().item(count));
- }
- }
- return propValues;
- }
-
- public abstract class ObjectFactoryImplBase implements ObjectFactory {
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- protected Property property;
- protected Object propertyValue;
- protected Class javaType;
- protected DataType<XMLType> sourceDataType;
- protected DataType<?> targetDataType;
- boolean isSimpleType;
-
- public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
-
- this.isSimpleType = isSimpleType;
- this.property = property;
- this.propertyValue = propertyValue;
- this.javaType = javaType;
- //FIXME : fix this when we have managed to generate dynamic java types
- /*sourceDataType =
- new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
- new XMLType(null, this.property.getXSDType()));
- TypeInfo typeInfo = null;
- if (this.property.getXSDType() != null) {
- if (SimpleTypeMapperExtension.isSimpleXSDType(this.property.getXSDType())) {
- typeInfo = new TypeInfo(property.getXSDType(), true, null);
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
-
- XMLType xmlType = new XMLType(typeInfo);
- String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
- if (dataBinding != null) {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- } else {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- mediator.getDataBindingRegistry().introspectType(targetDataType, null);
- }*/
- }
- }
-
- public class ObjectFactoryImpl extends ObjectFactoryImplBase {
- public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- super(property, propertyValue, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public Object getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
- } else {
- return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
- //return null;
- }
- }
- }
-
- public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
- public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
- super(property, propertyValues, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public List<?> getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- List<Object> values = new ArrayList<Object>();
- for (String aValue : (List<String>)propertyValue) {
- values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
- }
- return values;
- } else {
- List instances = new ArrayList();
- for (Node aValue : (List<Node>)propertyValue) {
- instances.add(mediator.mediate(aValue,
- sourceDataType,
- targetDataType,
- null));
- }
- return instances;
- }
- }
- }
-}
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.java
deleted file mode 100644
index dbfb9d089f..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/DynamicImplementation.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.extension.helper.utils;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class DynamicImplementation extends AbstractImplementation implements ComponentPreProcessor {
-
- public void preProcess(Component component) {
- RuntimeComponent rtc = (RuntimeComponent) component;
-
- for (Service service : rtc.getServices()) {
- if (getService(service.getName()) == null) {
- getServices().add(createService(service));
- }
- }
-
- Service dynamicService = getService("$dynamic$");
- if (dynamicService != null && getServices().size() > 1) {
- getServices().remove(dynamicService);
- dynamicService = null;
- }
-
- for (Reference reference : rtc.getReferences()) {
- if (getReference(reference.getName()) == null) {
- getReferences().add(createReference(reference));
- }
- }
-
- for (Property property : rtc.getProperties()) {
- if (getProptery(property.getName()) == null) {
- getProperties().add(createProperty(property));
- }
- }
-
- // TODO: support properties
- }
-
- protected Service createService(Service service) {
- Service newService;
- try {
- newService = (Service)service.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
-
- return newService;
- }
-
- protected Reference createReference(Reference reference) {
- Reference newReference;
- try {
- newReference = (Reference)reference.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newReference;
- }
-
- protected Property createProperty(Property property) {
- Property newProperty;
- try {
- newProperty = (Property)property.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newProperty;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.java
deleted file mode 100644
index f209825679..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/PropertyValueObjectFactory.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.extension.helper.utils;
-
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface PropertyValueObjectFactory {
-
- ObjectFactory createValueFactory(Property property);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java b/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
deleted file mode 100644
index 4e7965ce60..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/ResourceHelper.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.extension.helper.utils;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.net.URLConnection;
-
-/**
- * TODO: Shouldn't this be using the contribution service?
- *
- * @version $Rev$ $Date$
- */
-public class ResourceHelper {
-
- public static String readResource(URL scriptSrcUrl) {
-
- InputStream is;
- try {
- URLConnection connection = scriptSrcUrl.openConnection();
- connection.setUseCaches(false);
- is = connection.getInputStream();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
-
- try {
-
- Reader reader = new InputStreamReader(is, "UTF-8");
- char[] buffer = new char[1024];
- StringBuilder source = new StringBuilder();
- int count;
- while ((count = reader.read(buffer)) > 0) {
- source.append(buffer, 0, count);
- }
-
- return source.toString();
-
- } catch (IOException e) {
- throw new RuntimeException(e);
- } finally {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index a408b0d061..0000000000
--- a/branches/sca-java-1.5.1/modules/extension-helper/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.extension.helper.impl.ImplementationsActivator
-org.apache.tuscany.sca.extension.helper.impl.BindingsActivator
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/LICENSE b/branches/sca-java-1.5.1/modules/host-corba-jee/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/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-java-1.5.1/modules/host-corba-jee/NOTICE b/branches/sca-java-1.5.1/modules/host-corba-jee/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/pom.xml b/branches/sca-java-1.5.1/modules/host-corba-jee/pom.xml
deleted file mode 100644
index 9d7f44a53b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/pom.xml
+++ /dev/null
@@ -1,63 +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>1.5.1-SNAPSHOT</version>
- </parent>
- <artifactId>tuscany-host-corba-jee</artifactId>
- <name>Apache Tuscany SCA JEE environment CORBA Host</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jse</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.corba.jdk</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.corba.jdk*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/CorbaRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/CorbaRuntimeModuleActivator.java
deleted file mode 100644
index b5fe9f5d0f..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/CorbaRuntimeModuleActivator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.corba.jee;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaRuntimeModuleActivator implements ModuleActivator {
-
- private JEECorbaHost server;
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- // Register our Corba host
- CorbaHostExtensionPoint corbaHosts = extensionPointRegistry.getExtensionPoint(CorbaHostExtensionPoint.class);
-
- server = new JEECorbaHost();
- try {
- server.start();
- corbaHosts.addCorbaHost(server);
- } catch (Exception e) {
-
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- if (server != null) {
- server.stop();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.java
deleted file mode 100644
index 7e714c1ca5..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/java/org/apache/tuscany/sca/host/corba/jee/JEECorbaHost.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.host.corba.jee;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.rmi.PortableRemoteObject;
-
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
-import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
-import org.apache.tuscany.sca.host.corba.CorbanameURL;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContextPackage.InvalidName;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-
-/**
- * @version $Rev$ $Date$
- * Implementation of JEE CORBA host
- */
-public class JEECorbaHost implements CorbaHost {
-
- public static final String ORB_NAME = "java:comp/ORB";
-
- private List<String> registeredServants = Collections.synchronizedList(new ArrayList<String>());
- private ORB orb;
-
- private void registerURI(String uri) {
- registeredServants.add(uri);
- }
-
- private void removeURI(String uri) {
- registeredServants.remove(uri);
- }
-
- private NamingContextExt getNamingContext(String nameService) throws Exception {
- org.omg.CORBA.Object objRef = orb.resolve_initial_references(nameService);
- return NamingContextExtHelper.narrow(objRef);
- }
-
- private void handleException(Exception e) throws CorbaHostException {
- // The cause of the Exception is JDK specific
- if (e instanceof NotFound) {
- throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT, e);
- } else if (e instanceof InvalidName) {
- throw new CorbaHostException(e);
- } else {
- throw new CorbaHostException(e);
- }
- }
-
- public void registerServant(String uri, Object servantObject) throws CorbaHostException {
- CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
- try {
- NamingContext namingCtx = getNamingContext(details.getNameService());
- for (int i = 0; i < details.getNamePath().size() - 1; i++) {
- NameComponent nc = new NameComponent(details.getNamePath().get(i), "");
- NameComponent[] path = new NameComponent[] {nc};
- try {
- namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path));
- } catch (Exception e) {
- namingCtx = namingCtx.bind_new_context(path);
- }
- }
- NameComponent finalName =
- new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), "");
- try {
- namingCtx.resolve(new NameComponent[] {finalName});
- // no exception means that some object is already registered
- // under this name, we need to crash here
- throw new CorbaHostException(CorbaHostException.BINDING_IN_USE);
- } catch (NotFound e) {
- namingCtx.bind(new NameComponent[] {finalName}, servantObject);
- registerURI(uri);
- }
- } catch (CorbaHostException e) {
- throw e;
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void unregisterServant(String uri) throws CorbaHostException {
- CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
- try {
- NamingContextExt namingCtx = getNamingContext(details.getNameService());
- namingCtx.unbind(namingCtx.to_name(details.getName()));
- removeURI(uri);
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public Object lookup(String uri) throws CorbaHostException {
- Object result = null;
- try {
- CorbanameURL url = new CorbanameURL(uri);
- NamingContextExt context = getNamingContext(url.getNameService());
- result = context.resolve_str(url.getName());
- } catch (Exception e) {
- // e.printStackTrace();
- handleException(e);
- }
- if (result == null) {
- throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT);
- }
- return result;
- }
-
- // obtain ORB from environment
- public void start() throws CorbaHostException {
- Context ctx;
- try {
- ctx = new InitialContext();
- orb = (ORB)PortableRemoteObject.narrow(ctx.lookup(ORB_NAME), org.omg.CORBA.ORB.class);
- } catch (Exception e) {
- throw new CorbaHostException(e);
- }
- }
-
- // unregister registered servants
- public void stop() {
- // use copy because unregisterServant(...) method removes from
- // registeredServants collection
- List<String> rsCopy = new ArrayList<String>(registeredServants);
- for (String servantURI : rsCopy) {
- try {
- unregisterServant(servantURI);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 3762550c01..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.host.corba.jee.CorbaRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.java
deleted file mode 100644
index fd952a02c7..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/JEECorbaHostTestCase.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.host.corba.jee.testing;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-
-import javax.naming.Context;
-
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
-import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost;
-import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface;
-import org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper;
-import org.apache.tuscany.sca.host.corba.jee.testing.servants.TestInterfaceServant;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * General tests for JEECorbaHost. Uses host-corba-jdk as mock for JEE
- * environment ORB.
- */
-public class JEECorbaHostTestCase {
-
- public static final String LOCALHOST = "localhost";
- public static final int DEFAULT_PORT = 11100;
- private static JEECorbaHost host;
- private static TransientNameServer server;
- private static String factoryClassName;
-
- private String createCorbanameURI(String name) {
- return "corbaname:#" + name;
- }
-
- @BeforeClass
- public static void start() {
- try {
- server = new TransientNameServer(LOCALHOST, DEFAULT_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
- Thread t = server.start();
- if (t == null) {
- fail("The naming server cannot be started");
- }
- factoryClassName = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, TestInitialContextFactory.class.getName());
- host = new JEECorbaHost();
- host.start();
- } catch (Throwable e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void stop() {
- server.stop();
- if (factoryClassName != null) {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY, factoryClassName);
- } else {
- System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);
- }
- }
-
- /**
- * Tests registering and lookup CORBA services
- */
- @Test
- public void test_registerServant() {
- try {
- String uri = createCorbanameURI("Nested/Test");
- TestInterface servant = new TestInterfaceServant();
- host.registerServant(uri, servant);
- TestInterface ref = TestInterfaceHelper.narrow(host.lookup(uri));
- assertEquals(2, ref.getInt(2));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests unregistering servants
- */
- @Test
- public void test_unregisterServant() {
- try {
- String uri = createCorbanameURI("Unregistering/Test");
- TestInterface servant = new TestInterfaceServant();
-
- // creating and releasing using corbaname URI
- host.registerServant(uri, servant);
- host.unregisterServant(uri);
- host.registerServant(uri, servant);
- host.unregisterServant(uri);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests situation when name is already registered
- */
- @Test
- public void test_nameAlreadyRegistered() {
- // test using URI
- try {
- TestInterface servant = new TestInterfaceServant();
- String uri = createCorbanameURI("AlreadyRegisteredTest2");
- host.registerServant(uri, servant);
- host.registerServant(uri, servant);
- fail();
- } catch (CorbaHostException e) {
- assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests getting non existing reference
- */
- @Test
- public void test_getNonExistingObject() {
- // try to fetch object with corbaname URI
- try {
- host.lookup(createCorbanameURI("NonExistingOne"));
- fail();
- } catch (CorbaHostException e) {
- // The message is JDK-specific
- // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
- } catch (Exception e) {
- // e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests unregistering non existing reference
- */
- @Test
- public void test_unregisterNonExistentObject() {
- // test using URI
- try {
- String uri = createCorbanameURI("NonExistingReference1");
- host.unregisterServant(uri);
- fail();
- } catch (CorbaHostException e) {
- assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests unregistering servants on host stop
- */
- @Test
- public void test_unregisterOnStop() {
- try {
- String uri1 = createCorbanameURI("TempService1");
- String uri2 = createCorbanameURI("TempService2");
- JEECorbaHost innerHost = new JEECorbaHost();
- innerHost.start();
- TestInterfaceServant servant = new TestInterfaceServant();
- innerHost.registerServant(uri1, servant);
- innerHost.registerServant(uri2, servant);
- innerHost.stop();
- try {
- innerHost.lookup(uri1);
- fail();
- } catch (CorbaHostException e) {
- assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage());
- }
- try {
- innerHost.lookup(uri2);
- fail();
- } catch (CorbaHostException e) {
- assertEquals(CorbaHostException.NO_SUCH_OBJECT, e.getMessage());
- }
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.java
deleted file mode 100644
index a0b9b7c514..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestContext.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.host.corba.jee.testing;
-
-import java.util.Hashtable;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.host.corba.jee.JEECorbaHost;
-import org.omg.CORBA.ORB;
-
-/**
- * Mock implementation of javax.naming.Context interface.
- */
-public class TestContext implements Context {
-
- private ORB orb;
-
- public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- return null;
- }
-
- public void bind(Name name, Object obj) throws NamingException {
-
- }
-
- public void bind(String name, Object obj) throws NamingException {
-
- }
-
- public void close() throws NamingException {
-
- }
-
- public Name composeName(Name name, Name prefix) throws NamingException {
- return null;
- }
-
- public String composeName(String name, String prefix) throws NamingException {
- return null;
- }
-
- public Context createSubcontext(Name name) throws NamingException {
- return null;
- }
-
- public Context createSubcontext(String name) throws NamingException {
- return null;
- }
-
- public void destroySubcontext(Name name) throws NamingException {
-
- }
-
- public void destroySubcontext(String name) throws NamingException {
-
- }
-
- public Hashtable<?, ?> getEnvironment() throws NamingException {
- return null;
- }
-
- public String getNameInNamespace() throws NamingException {
- return null;
- }
-
- public NameParser getNameParser(Name name) throws NamingException {
- return null;
- }
-
- public NameParser getNameParser(String name) throws NamingException {
- return null;
- }
-
- public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
- return null;
- }
-
- public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
- return null;
- }
-
- public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
- return null;
- }
-
- public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
- return null;
- }
-
- public Object lookup(Name name) throws NamingException {
- return null;
- }
-
- public Object lookup(String name) throws NamingException {
- try {
- if (name.equals(JEECorbaHost.ORB_NAME)) {
- if (orb == null) {
- // get ORB which was spawned under host and port declared in
- // test class
- String[] args =
- {"-ORBInitialHost", JEECorbaHostTestCase.LOCALHOST, "-ORBInitialPort",
- "" + JEECorbaHostTestCase.DEFAULT_PORT};
- orb = ORB.init(args, null);
- }
- } else {
- throw new NamingException("Unknown name: " + name);
- }
- } catch (Exception e) {
- throw new NamingException(e.getMessage());
- }
- return orb;
- }
-
- public Object lookupLink(Name name) throws NamingException {
- return null;
- }
-
- public Object lookupLink(String name) throws NamingException {
- return null;
- }
-
- public void rebind(Name name, Object obj) throws NamingException {
-
- }
-
- public void rebind(String name, Object obj) throws NamingException {
-
- }
-
- public Object removeFromEnvironment(String propName) throws NamingException {
- return null;
- }
-
- public void rename(Name oldName, Name newName) throws NamingException {
-
- }
-
- public void rename(String oldName, String newName) throws NamingException {
-
- }
-
- public void unbind(Name name) throws NamingException {
-
- }
-
- public void unbind(String name) throws NamingException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.java
deleted file mode 100644
index f480235fa8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/TestInitialContextFactory.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.host.corba.jee.testing;
-
-import java.util.Hashtable;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.naming.spi.InitialContextFactory;
-
-/**
- * Factory for mock implementation of javax.naming.Context interface.
- */
-public class TestInitialContextFactory implements InitialContextFactory {
-
- public Context getInitialContext(Hashtable<?, ?> environment) throws NamingException {
- return new TestContext();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.java
deleted file mode 100644
index 5bb43fbb98..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterface.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.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public interface TestInterface extends TestInterfaceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface TestInterface
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java
deleted file mode 100644
index 376a5bf2fa..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-abstract public class TestInterfaceHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0";
-
- public static void insert(org.omg.CORBA.Any a,
- org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB
- .init()
- .create_interface_tc(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.id(),
- "TestInterface");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_TestInterfaceStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)
- return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub =
- new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)
- return (org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub stub =
- new org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.java
deleted file mode 100644
index 8aa2f59f71..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceHolder.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.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public final class TestInterfaceHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface value = null;
-
- public TestInterfaceHolder() {
- }
-
- public TestInterfaceHolder(org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterfaceHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.java
deleted file mode 100644
index ca491c1b0e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/TestInterfaceOperations.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.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public interface TestInterfaceOperations {
- int getInt(int arg);
-} // interface TestInterfaceOperations
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.java
deleted file mode 100644
index 69795e0e25..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceImplBase.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.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public abstract class _TestInterfaceImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _TestInterfaceImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("getInt", new java.lang.Integer(0));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/host/corba/testing/general/TestInterface/getInt
- {
- int arg = in.read_long();
- int $result = (int)0;
- $result = this.getInt(arg);
- out = $rh.createReply();
- out.write_long($result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
-
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _TestInterfaceImplBase
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java
deleted file mode 100644
index d806a25c6a..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/general/_TestInterfaceStub.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.jee.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public class _TestInterfaceStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.host.corba.jee.testing.general.TestInterface {
-
- public int getInt(int arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getInt", true);
- $out.write_long(arg);
- $in = _invoke($out);
- int $result = $in.read_long();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getInt(arg);
- } finally {
- _releaseReply($in);
- }
- } // getInt
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
-
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _TestInterfaceStub
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.java
deleted file mode 100644
index 6195f3af9c..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/java/org/apache/tuscany/sca/host/corba/jee/testing/servants/TestInterfaceServant.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.host.corba.jee.testing.servants;
-
-import org.apache.tuscany.sca.host.corba.jee.testing.general._TestInterfaceImplBase;
-
-/**
- * Testing servant
- */
-public class TestInterfaceServant extends _TestInterfaceImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public int getInt(int arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/resources/general.idl b/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/resources/general.idl
deleted file mode 100644
index 9194a37334..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jee/src/test/resources/general.idl
+++ /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.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase general.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module host {
- module corba {
- module jee {
- module testing {
- module general {
- interface TestInterface {
- long getInt(in long arg);
- };
- };
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/LICENSE b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/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-java-1.5.1/modules/host-corba-jse-tns/NOTICE b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/pom.xml b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/pom.xml
deleted file mode 100644
index 407cc1b567..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/pom.xml
+++ /dev/null
@@ -1,71 +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>1.5.1-SNAPSHOT</version>
- </parent>
- <artifactId>tuscany-host-corba-jse-tns</artifactId>
- <name>Apache Tuscany SCA Transient Name Server CORBA Host</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba-jse</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-corba-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.corba.jse.tns</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.corba.jse.tns*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/CorbaRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/CorbaRuntimeModuleActivator.java
deleted file mode 100644
index 312d739c53..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/CorbaRuntimeModuleActivator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.corba.jse.tns;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
-
-/**
- * @version $Rev: 683329 $ $Date: 2008-08-06 19:06:39 +0200 (śro, 06 sie 2008) $
- */
-public class CorbaRuntimeModuleActivator implements ModuleActivator {
- // private static final Logger logger =
- // Logger.getLogger(CorbaRuntimeModuleActivator.class.getName());
-
- private TnsDefaultCorbaHost server;
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
- // Register our Corba host
- CorbaHostExtensionPoint corbaHosts = extensionPointRegistry.getExtensionPoint(CorbaHostExtensionPoint.class);
- server = new TnsDefaultCorbaHost();
- if (corbaHosts.getCorbaHosts().size() > 0 && corbaHosts.getCorbaHosts().get(0) instanceof DefaultCorbaHost) {
- // Set TnsDefaultCorbaHost as default when DefaultCorbaHost was registered before
- corbaHosts.getCorbaHosts().add(0, server);
- } else {
- corbaHosts.getCorbaHosts().add(server);
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- if (server != null) {
- server.stop();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/TnsDefaultCorbaHost.java b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/TnsDefaultCorbaHost.java
deleted file mode 100644
index 2dc2c7ddd4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/java/org/apache/tuscany/sca/host/corba/jse/tns/TnsDefaultCorbaHost.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.host.corba.jse.tns;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
-import org.apache.tuscany.sca.host.corba.CorbanameURL;
-import org.apache.tuscany.sca.host.corba.SocketUtil;
-import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- * Default implementation of CORBA host
- */
-public class TnsDefaultCorbaHost implements CorbaHost {
-
- private static final Logger logger = Logger.getLogger(TnsDefaultCorbaHost.class.getName());
- private Map<Integer, TransientNameServer> localServers = new ConcurrentHashMap<Integer, TransientNameServer>();
- private Map<Integer, Integer> clientsCount = new ConcurrentHashMap<Integer, Integer>();
- private CorbaHost targetHost = new DefaultCorbaHost();
-
- public void registerServant(String uri, Object servantObject) throws CorbaHostException {
- CorbanameURL details = new CorbanameURL(uri);
- if (SocketUtil.isLocalhost(details.getHost())) {
- createLocalNameServer(details.getPort());
- }
- targetHost.registerServant(uri, servantObject);
- }
-
- public void unregisterServant(String uri) throws CorbaHostException {
- targetHost.unregisterServant(uri);
- CorbanameURL details = new CorbanameURL(uri);
- if (SocketUtil.isLocalhost(details.getHost())) {
- releaseLocalNameServer(details.getPort());
- }
- }
-
- public Object lookup(String uri) throws CorbaHostException {
- return targetHost.lookup(uri);
- }
-
- /**
- * Starts transient name server under given port. If TNS was previously
- * spawned it increments clients counter.
- */
- synchronized private void createLocalNameServer(int port) throws CorbaHostException {
- int useCount = clientsCount.containsKey(port) ? clientsCount.get(port) : 0;
- // no server previously spawned
- if (useCount == 0) {
- TransientNameServer server =
- new TransientNameServer("localhost", port, TransientNameService.DEFAULT_SERVICE_NAME);
- Thread thread = server.start();
- if (thread == null) {
- throw new CorbaHostException("TransientNameServer couldn't be started");
- } else {
- localServers.put(port, server);
- }
- }
- clientsCount.put(port, ++useCount);
- }
-
- /**
- * Stops transient name server if there is only one client left using such
- * TNS. Decrements clients counter if TNS is used by 2 or more clients.
- */
- synchronized private void releaseLocalNameServer(int port) throws CorbaHostException {
- int useCount = clientsCount.containsKey(port) ? clientsCount.get(port) : 0;
- if (useCount == 1) {
- // last client executed stop, cleaning up
- TransientNameServer server = localServers.get(port);
- if (server != null) {
- server.stop();
- clientsCount.remove(port);
- localServers.remove(port);
- } else {
- logger.warning("Local name server on port " + port + " was null!");
- }
- } else if (useCount > 1) {
- clientsCount.put(port, --useCount);
- } else {
- logger.warning("Tried to release non existing local name server on port " + port);
- }
-
- }
-
- public void stop() {
- for (TransientNameServer tns : localServers.values()) {
- tns.stop();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 906ec4efce..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.host.corba.jse.tns.CorbaRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/test/java/org/apache/tuscany/sca/host/corba/testing/TnsDefaultCorbaHostTestCase.java b/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/test/java/org/apache/tuscany/sca/host/corba/testing/TnsDefaultCorbaHostTestCase.java
deleted file mode 100644
index 9f6be0f27d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse-tns/src/test/java/org/apache/tuscany/sca/host/corba/testing/TnsDefaultCorbaHostTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.testing;
-
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-
-import java.net.Socket;
-import java.net.SocketException;
-
-import org.apache.tuscany.sca.binding.corba.impl.service.DynaCorbaServant;
-import org.apache.tuscany.sca.host.corba.jse.tns.TnsDefaultCorbaHost;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- * General tests
- */
-public class TnsDefaultCorbaHostTestCase {
-
- private static TnsDefaultCorbaHost host;
-
- @BeforeClass
- public static void start() {
- try {
- host = new TnsDefaultCorbaHost();
- } catch (Throwable e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void stop() {
- host.stop();
- }
-
- /**
- * Test for creating and releasing local name server
- */
- @Test
- public void test_localNameServer() {
- int testPort = 5070;
- try {
- String testUri1 = "corbaname::localhost:" + testPort + "#Test1";
- String testUri2 = "corbaname::localhost:" + testPort + "#Test2";
- String testUri3 = "corbaname::localhost:" + testPort + "#Test3";
- DynaCorbaServant servant = new DynaCorbaServant(null, "IDL:org/apache/tuscany:1.0");
- host.registerServant(testUri1, servant);
- host.registerServant(testUri2, servant);
- host.registerServant(testUri3, servant);
- Thread.sleep(1000);
- // make test connection to name server
- Socket socket = new Socket("localhost", testPort);
- socket.close();
- // and stop server
- host.unregisterServant(testUri1);
- host.unregisterServant(testUri2);
- // after releasing 2 clients 3rd should still hold the server
- socket = new Socket("localhost", testPort);
- socket.close();
- host.unregisterServant(testUri3);
- Thread.sleep(1000);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- try {
- // previously made 3rd stop so there should be no name server under
- // this port
- new Socket("localhost", testPort);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof SocketException);
- }
- }
-}
-
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/LICENSE b/branches/sca-java-1.5.1/modules/host-corba-jse/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/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-java-1.5.1/modules/host-corba-jse/NOTICE b/branches/sca-java-1.5.1/modules/host-corba-jse/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/pom.xml b/branches/sca-java-1.5.1/modules/host-corba-jse/pom.xml
deleted file mode 100644
index 26e40e5ce6..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/pom.xml
+++ /dev/null
@@ -1,57 +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>1.5.1-SNAPSHOT</version>
- </parent>
- <artifactId>tuscany-host-corba-jse</artifactId>
- <name>Apache Tuscany SCA JSE built-in CORBA Host</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-corba</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.corba.jse</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.corba.jse*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/CorbaRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/CorbaRuntimeModuleActivator.java
deleted file mode 100644
index 252a1512e4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/CorbaRuntimeModuleActivator.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.corba.jse;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CorbaRuntimeModuleActivator implements ModuleActivator {
- // private static final Logger logger =
- // Logger.getLogger(CorbaRuntimeModuleActivator.class.getName());
-
- private DefaultCorbaHost server;
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- // Register our Corba host
- CorbaHostExtensionPoint corbaHosts = extensionPointRegistry.getExtensionPoint(CorbaHostExtensionPoint.class);
- server = new DefaultCorbaHost();
- corbaHosts.addCorbaHost(server);
- }
-
- public void stop(ExtensionPointRegistry registry) {
- if (server != null) {
- server.stop();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/DefaultCorbaHost.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/DefaultCorbaHost.java
deleted file mode 100644
index 015644e19d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/jse/DefaultCorbaHost.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.jse;
-
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
-import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
-import org.apache.tuscany.sca.host.corba.CorbanameURL;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Object;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExt;
-import org.omg.CosNaming.NamingContextExtHelper;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContextPackage.InvalidName;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-
-/**
- * @version $Rev$ $Date$
- * Default implementation of JSE CORBA host
- */
-public class DefaultCorbaHost implements CorbaHost {
- private static final Logger logger = Logger.getLogger(DefaultCorbaHost.class.getName());
-
- private Map<String, ORB> orbs = new ConcurrentHashMap<String, ORB>();
-
- private void validatePort(int port) throws IllegalArgumentException {
- if (port < 1) {
- throw new IllegalArgumentException("Port value should be > 0");
- }
- }
-
- private NamingContextExt getNamingContext(ORB orb, String nameService) throws Exception {
- org.omg.CORBA.Object objRef = orb.resolve_initial_references(nameService);
- return NamingContextExtHelper.narrow(objRef);
- }
-
- private void handleException(Exception e) throws CorbaHostException {
- // The cause of the Exception is JDK specific
- if (e instanceof NotFound) {
- throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT, e);
- } else if (e instanceof InvalidName) {
- throw new CorbaHostException(e);
- } else {
- throw new CorbaHostException(e);
- }
- }
-
- public void registerServant(String uri, Object servantObject) throws CorbaHostException {
- CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
- ORB orb = createORB(details.getHost(), details.getPort(), false);
- try {
- NamingContext namingCtx = getNamingContext(orb, details.getNameService());
- for (int i = 0; i < details.getNamePath().size() - 1; i++) {
- NameComponent nc = new NameComponent(details.getNamePath().get(i), "");
- NameComponent[] path = new NameComponent[] {nc};
- try {
- namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path));
- } catch (Exception e) {
- namingCtx = namingCtx.bind_new_context(path);
- }
- }
- NameComponent finalName =
- new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), "");
- try {
- namingCtx.resolve(new NameComponent[] {finalName});
- // no exception means that some object is already registered
- // under this name, we need to crash here
- throw new CorbaHostException(CorbaHostException.BINDING_IN_USE);
- } catch (NotFound e) {
- namingCtx.bind(new NameComponent[] {finalName}, servantObject);
- }
- } catch (CorbaHostException e) {
- throw e;
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public void unregisterServant(String uri) throws CorbaHostException {
- CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
- ORB orb = createORB(details.getHost(), details.getPort(), false);
- try {
- NamingContextExt namingCtx = getNamingContext(orb, details.getNameService());
- namingCtx.unbind(namingCtx.to_name(details.getName()));
- } catch (Exception e) {
- handleException(e);
- }
- }
-
- public Object lookup(String uri) throws CorbaHostException {
- Object result = null;
- try {
- CorbanameURL url = new CorbanameURL(uri);
- ORB orb = createORB(url.getHost(), url.getPort(), false);
- NamingContextExt context = getNamingContext(orb, url.getNameService());
- result = context.resolve_str(url.getName());
- } catch (Exception e) {
- handleException(e);
- }
- if (result == null) {
- throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT);
- }
- return result;
- }
-
- public ORB createORB(String host, int port, boolean server) throws CorbaHostException {
- validatePort(port);
-
- String key = host + ":" + port;
- ORB orb = orbs.get(key);
- if (orb != null) {
- return orb;
- }
- // Create an ORB object
- Properties props = new Properties();
- props.putAll(System.getProperties());
-
- String portStr = String.valueOf(port);
- props.put("org.omg.CORBA.ORBServerId", "1000000");
- props.put("org.omg.CORBA.ORBInitialHost", host);
- props.put("org.omg.CORBA.ORBInitialPort", portStr);
-
- // STEP 1: Set ORBPeristentServerPort property
- // Set the proprietary property to open up a port to listen to
- // INS requests.
-
- if (server) {
- props.put("com.sun.CORBA.POA.ORBPersistentServerPort", portStr);
- props.put("com.ibm.CORBA.ListenerPort", portStr);
- props.put("gnu.CORBA.ListenerPort", portStr);
- // props.put("org.omg.CORBA.ORBClass",
- // "org.apache.yoko.orb.CORBA.ORB");
- // props.put("org.omg.CORBA.ORBSingletonClass",
- // "org.apache.yoko.orb.CORBA.ORBSingleton");
- props.put("yoko.orb.oa.endpoint", "iiop --host " + host + " --port " + port);
- props.put("yoko.orb.poamanager.TNameService.endpoint", "iiop --host " + host);
- }
-
- String[] args = {"-ORBInitialHost", host, "-ORBInitialPort", "" + port};
- orb = ORB.init(args, props);
- orbs.put(key, orb);
- return orb;
- }
-
- public void stop() {
- for (ORB orb : orbs.values()) {
- try {
- orb.shutdown(true);
- orb.destroy();
- } catch (Throwable e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/NamingContextBase.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/NamingContextBase.java
deleted file mode 100644
index 59f0ce9a53..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/NamingContextBase.java
+++ /dev/null
@@ -1,863 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * @version $Rev$ $Date$
- */
-
-package org.apache.tuscany.sca.host.corba.naming;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.omg.CORBA.BAD_PARAM;
-import org.omg.CORBA.CompletionStatus;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.SystemException;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextExtPOA;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContextExtPackage.InvalidAddress;
-import org.omg.CosNaming.NamingContextPackage.AlreadyBound;
-import org.omg.CosNaming.NamingContextPackage.InvalidName;
-import org.omg.CosNaming.NamingContextPackage.NotFound;
-import org.omg.CosNaming.NamingContextPackage.NotFoundReason;
-import org.omg.PortableServer.POA;
-
-public abstract class NamingContextBase extends NamingContextExtPOA {
- // the real logger backing instance. We use the interface class as the locator
- protected static final Logger logger = Logger.getLogger(NamingContext.class.getName());
-
- // set of URL characters that don't require escaping when encoded.
- protected final String nonEscaped = ";/?:@&=+$;-_.!~* ()";
- // the orb we're attached to
- protected ORB orb;
- // the poa we're associated with
- protected POA poa;
-
- /**
- * Create a new base NamingContext (super class constructor
- * for the derived classes).
- *
- * @param orb The ORB this is hosted on.
- *
- * @exception java.lang.Exception
- */
- public NamingContextBase(ORB orb, POA poa) throws java.lang.Exception {
- super();
- this.orb = orb;
- this.poa = poa;
- }
-
- /**
- * Bind an object to a given name.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- * @param obj The object to be bound.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public void bind(org.omg.CosNaming.NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound {
- // perform various name validations
- validateName(n);
-
- logNameComponent("bind() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- context.bind(subName, obj);
- } else {
- NameComponent name = n[0];
- // we need the resolveObject() and bindObject() calls to be consistent, so
- // synchronize on this
- synchronized (this) {
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- if (resolveObject(name, type) != null) {
- throw new AlreadyBound();
- }
- type.value = BindingType.nobject;
- // ok, this is a new binding, go do it.
- bindObject(name, obj, type);
- }
- }
- }
-
- /**
- * Rebind an object to a given name. If an object is
- * already bound with this name, the new object replaces
- * the bound object's value. If no object has been
- * bound already, this is the same as a bind operation.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- * @param obj The new value for this binding.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public void rebind(org.omg.CosNaming.NameComponent[] n, org.omg.CORBA.Object obj)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName {
- // perform various name validations
- validateName(n);
-
- logNameComponent("rebind() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- context.rebind(subName, obj);
- } else {
- NameComponent name = n[0];
- // we need the resolveObject() and bindObject() calls to be consistent, so
- // synchronize on this
- synchronized (this) {
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- // for a rebind, we must have an object, and it must be a real object
- if (resolveObject(name, type) != null) {
- // it has to resolve to a real object. If it is a naming context,
- // then this is the wrong binding operation.
- if (type.value.value() == BindingType._ncontext) {
- throw new NotFound(NotFoundReason.not_object, n);
- }
- // safe to unbind
- unbindObject(name);
- }
- type.value = BindingType.nobject;
- // now bind this object
- bindObject(name, obj, type);
- }
- }
- }
-
- /**
- * Bind a new context to a given name.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- * @param nc The new naming context added to the tree.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public void bind_context(org.omg.CosNaming.NameComponent[] n, org.omg.CosNaming.NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName, org.omg.CosNaming.NamingContextPackage.AlreadyBound {
- // perform various name validations
- validateName(n);
-
- logNameComponent("bind_context() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- context.bind_context(subName, nc);
- } else {
- NameComponent name = n[0];
- // we need the resolveObject() and bindObject() calls to be consistent, so
- // synchronize on this
- synchronized (this) {
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- if (resolveObject(name, type) != null) {
- throw new AlreadyBound();
- }
- type.value = BindingType.ncontext;
- // ok, this is a new binding, go do it.
- bindObject(name, nc, type);
- }
- }
- }
-
- /**
- * Rebind a context to a given name. If a context is
- * already bound with this name, the new context replaces
- * the existing context. If no context has been
- * bound already, this is the same as a bind operation.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- * @param nc The new context to be bound with the name.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public void rebind_context(org.omg.CosNaming.NameComponent[] n, org.omg.CosNaming.NamingContext nc)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName {
- // perform various name validations
- validateName(n);
-
- logNameComponent("rebind_context() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- context.rebind_context(subName, nc);
- } else {
- NameComponent name = n[0];
- // we need the resolveObject() and bindObject() calls to be consistent, so
- // synchronize on this
- synchronized (this) {
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- // for a rebind, we must have an object, and it must be a real object
- if (resolveObject(name, type) != null) {
- // it has to resolve to a real object. If it is a naming context,
- // then this is the wrong binding operation.
- if (type.value.value() != BindingType._ncontext) {
- throw new NotFound(NotFoundReason.not_context, n);
- }
- // safe to unbind
- unbindObject(name);
- }
- type.value = BindingType.ncontext;
- // now bind this object
- bindObject(name, nc, type);
- }
- }
- }
-
- /**
- * Resolve an an entry in the context tree. The
- * resolved object may be a bound object or another
- * NamingContext. If the named entry is not found,
- * a NotFound exception is thrown.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- *
- * @return The object bound at the indicated location.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public org.omg.CORBA.Object resolve(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed,
- org.omg.CosNaming.NamingContextPackage.InvalidName {
- // perform various name validations
- validateName(n);
-
- logNameComponent("resolve() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- return context.resolve(subName);
- } else {
- NameComponent name = n[0];
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- org.omg.CORBA.Object obj = resolveObject(name, type);
- if (obj == null) {
- // Object was not found
- throw new NotFound(NotFoundReason.missing_node, n);
- }
- return obj;
- }
- }
-
- /**
- * Remove an entry from the context tree. The
- * target object may be a bound object or another
- * NamingContext. If the named entry is not found,
- * a NotFound exception is thrown.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public void unbind(org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName {
- // perform various name validations
- validateName(n);
-
- logNameComponent("unbind() name", n);
-
- // do we need to push through to a deeper naming context first?
- if (n.length > 1) {
- // resolve the top level name to a context, and have that context
- // resolve the rest.
- NamingContext context = resolveContext(n[0]);
- NameComponent[] subName = extractSubName(n);
-
- // now pass this along to the next context for the real bind operation.
- context.unbind(subName);
- } else {
- NameComponent name = n[0];
- synchronized (this) {
- // see if we have this bound already...can't replace these.
- BindingTypeHolder type = new BindingTypeHolder();
- org.omg.CORBA.Object obj = unbindObject(name);
- if (obj == null) {
- // Object was not found
- throw new NotFound(NotFoundReason.missing_node, n);
- }
- }
- }
- }
-
- /**
- * Create a new context and bind it in at the target
- * location.
- *
- * @param n An array of NameComponents that are the target name.
- * The last element in the array is binding name for the
- * object. The remainder of the array is the path
- * for resolving the naming context, relative to the
- * current context. All path contexts must already be
- * bound in the context tree.
- *
- * @return The newly created context.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
- */
- public synchronized org.omg.CosNaming.NamingContext bind_new_context(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.AlreadyBound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName {
- logNameComponent("bind_new_context() name", n);
-
- NamingContext context = new_context();
- try {
- bind_context(n, context);
- NamingContext returnContext = context;
- // transfer this to another variable so the finally block doesn't try to destroy this.
- context = null;
- return returnContext;
- } finally {
- // if there is a bind failure on this, we need to ensure the context has
- // an opportunity to clean up any of its resources.
- if (context != null) {
- try {
- context.destroy();
- } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
- // new contexts should be empty.
- }
- }
- }
- }
-
- /**
- * Convert an array of NameComponents into the string
- * form of a context name.
- *
- * @param n The array of NameComponents to convert.
- *
- * @return The context name, in string form.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- */
- public String to_string(org.omg.CosNaming.NameComponent[] n)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName {
- validateName(n);
-
- logNameComponent("to_string() name", n);
-
- // convert the first part of the name
- StringBuffer value = new StringBuffer();
- ;
- // convert the first component, then build up from there.
- nameToString(n[0], value);
-
- // the remainder need to get a separator
- for (int i = 1; i < n.length; i++) {
- value.append('/');
- nameToString(n[i], value);
- }
- return value.toString();
- }
-
- /**
- * Perform the reverse operation of the to_string() method,
- * parsing a String context name into an array of
- * NameComponents.
- *
- * @param sn The string form of the name.
- *
- * @return An array of NameComponents parsed from the String name.
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- */
- public org.omg.CosNaming.NameComponent[] to_name(String sn)
- throws org.omg.CosNaming.NamingContextPackage.InvalidName {
- // must have a argument to parse
- if (sn == null || sn.length() == 0) {
- throw new InvalidName();
- }
-
- List components = new ArrayList();
-
- StringBuffer component = new StringBuffer();
-
- int index = 0;
- String id = null;
- String kind = null;
- while (index < sn.length()) {
- char ch = sn.charAt(index++);
-
- // found an escape character or a delimiter?
- if (ch == '\\') {
- // nothing after the escape? Trouble
- if (index >= sn.length()) {
- throw new InvalidName();
- }
- // get the next character
- ch = sn.charAt(index++);
- component.append(ch);
- }
- // we need to process the periods here, to avoid getting
- // mixed up with unescaped periods.
- else if (ch == '.') {
- // already seen a period while scanning? That's not allowed
- if (id != null) {
- throw new InvalidName();
- }
- // pull off the id piece and reset the buffer
- id = component.toString();
- component.setLength(0);
- }
- // found a component delimiter?
- else if (ch == '/') {
- // not seen a id/kind separator yet? This is an id with no kind
- if (id == null) {
- id = component.toString();
- kind = "";
- } else {
- // we have an id already, pull off the kind
- kind = component.toString();
- }
- // add the parsed name component
- components.add(new NameComponent(id, kind));
- // make sure these are all reset after pulling off a component
- component.setLength(0);
- id = null;
- kind = null;
- } else {
- component.append(ch);
- }
- }
-
- // parse the last section
- // not seen a id/kind separator yet? This is an id with no kind
- if (id == null) {
- id = component.toString();
- kind = "";
- } else {
- // we have an id already, pull off the kind
- kind = component.toString();
- }
- // add the parsed name component
- components.add(new NameComponent(id, kind));
-
- // and turn this into a component array
- return (NameComponent[])components.toArray(new NameComponent[components.size()]);
- }
-
- /**
- * Create a URL name for accessing a component by name. The
- * URL will have a corbaname: protocol.
- *
- * @param addr The address location for the naming service used
- * to resolve the object. This is in "host:port" form,
- * just line a corbaloc: URL.
- * @param sn The string mae of the target object.
- *
- * @return A URL for accessing this object, in String form.
- * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidAddress
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- */
- public String to_url(String addr, String sn) throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
- org.omg.CosNaming.NamingContextPackage.InvalidName {
- // basic validation
- if (addr == null || addr.length() == 0) {
- throw new InvalidAddress();
- }
-
- if (sn == null || sn.length() == 0) {
- throw new InvalidName();
- }
-
- // TODO: What validation, if any, needs to be done here?
- return "corbaname:" + addr + "#" + encodeRFC2396Name(sn);
- }
-
- /**
- * Resolve a bound object or context using a name
- * in String form.
- *
- * @param n The string name of the object context. This must
- * be a form parseable by to_name().
- *
- * @return The bound object or context.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
- * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
- */
- public org.omg.CORBA.Object resolve_str(String n) throws org.omg.CosNaming.NamingContextPackage.NotFound,
- org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName {
- // this is just a simple convenience method
- return resolve(to_name(n));
- }
-
- // abstract methods that are part of the NamingContext interface that need to be
- // implemented by the subclasses.
-
- /**
- * Create a new context of the same type as the
- * calling context.
- *
- * @return A new NamingContext item.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception SystemException
- */
- public abstract org.omg.CosNaming.NamingContext new_context() throws SystemException;
-
- /**
- * Destroy a context. This method should clean up
- * any backing resources associated with the context.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty
- */
- public abstract void destroy() throws org.omg.CosNaming.NamingContextPackage.NotEmpty;
-
- /**
- * Create a list of bound objects an contexts contained
- * within this context.
- *
- * @param how_many The count of elements to return as a BindingList.
- * @param bl A holder element for returning the source binding list.
- * @param bi A holder for returning a BindingIterator. Any extra
- * elements not returned in the BindingList are returned
- * in the BindingIterator.
- *
- * @exception SystemException
- */
- public abstract void list(int how_many,
- org.omg.CosNaming.BindingListHolder bl,
- org.omg.CosNaming.BindingIteratorHolder bi) throws SystemException;
-
- // abstract methods for the sub class to implement
-
- /**
- * Resolve an object in this context (single level
- * resolution).
- *
- * @param n The name of the target object.
- * @param type A type holder for returning the bound object type
- * information.
- *
- * @return The bound object. Returns null if the object does not
- * exist in the context.
- * @exception SystemException
- */
- protected abstract org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type)
- throws SystemException;
-
- /**
- * Bind an object into the current context. This can
- * be either an object or a naming context.
- *
- * @param n The single-level name of the target object.
- * @param obj The object or context to be bound.
- * @param type
- *
- * @exception SystemException
- */
- protected abstract void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type)
- throws SystemException;
-
- /**
- * Unbind an object from the current context.
- *
- * @param n The name of the target object (single level).
- *
- * @return The object associated with the binding. Returns null
- * if there was no binding currently associated with this
- * name.
- * @exception SystemException
- */
- protected abstract org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException;
-
- // implementation specific routines
-
- /**
- * Resolve a name to a context object stored that has
- * already been stored in this context. Throws an exception
- * if the name cannot be resolved or if the resolved
- * object is not a naming context.
- *
- * @param name The target name.
- *
- * @return The resolved NamingContext object.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- */
- protected synchronized NamingContext resolveContext(NameComponent name)
- throws org.omg.CosNaming.NamingContextPackage.NotFound {
- BindingTypeHolder type = new BindingTypeHolder();
- // Resolve this to an object. We must be able to resolve this.
- org.omg.CORBA.Object resolvedReference = resolveObject(name, type);
- if (resolvedReference == null) {
- throw new NotFound(NotFoundReason.missing_node, new NameComponent[] {name});
- }
-
- // it has to resolve to a naming context
- if (type.value.value() != BindingType._ncontext) {
- throw new NotFound(NotFoundReason.not_context, new NameComponent[] {name});
- }
-
- // in theory, this is a naming context. Narrow it an return. Any
- // errors just become a NotFound exception
- try {
- return NamingContextHelper.narrow(resolvedReference);
- } catch (org.omg.CORBA.BAD_PARAM ex) {
- throw new NotFound(NotFoundReason.not_context, new NameComponent[] {name});
- }
- }
-
- /**
- * Extract the tail portion of a name. This is used
- * to strip off the first name element so we can recurse
- * on the name resolutions with a resolved context.
- *
- * @param name The current name array (this MUST have 2 or more
- * elements).
- *
- * @return An array of NameComponent items that is one element
- * smaller than the argument array, with the elements
- * shifted over.
- */
- protected NameComponent[] extractSubName(NameComponent[] name) {
- NameComponent[] subName = new NameComponent[name.length - 1];
- System.arraycopy(name, 1, subName, 0, name.length - 1);
- return subName;
- }
-
- /**
- * Perform common name validity checking.
- *
- * @param n The NameComponent array to check.
- *
- * @exception InvalidName
- */
- protected void validateName(NameComponent[] n) throws InvalidName {
- // perform various name validations
- if (n == null) {
- throw new BAD_PARAM(27 | org.omg.CORBA.OMGVMCID.value, CompletionStatus.COMPLETED_NO);
- }
-
- // Valid name?
- if (n.length < 1) {
- throw new InvalidName();
- }
-
- // we have at least one name, so validate the toplevel item
- NameComponent name = n[0];
-
- // more name validation
- if (name.id.length() == 0 && name.kind.length() == 0) {
- throw new InvalidName();
- }
- }
-
- /**
- * Convert a NameComponent item into a string form,
- * appending it to a StringBuffer.
- *
- * @param name The source NameComponent.
- * @param out The StringBuffer location used to store the name
- * value (appended to the end).
- */
- protected void nameToString(NameComponent name, StringBuffer out) {
- // if the id is null, then we base off of the kind.
- if (name.id == null || name.id.length() == 0) {
- out.append(".");
- // true null name element? That displays as a "."
- if (name.kind != null && name.kind.length() != 0) {
- escapeName(name.kind, out);
- }
- } else {
- // escape the name
- escapeName(name.id, out);
- // have a kind qualifier to add on?
- if (name.kind != null && name.kind.length() != 0) {
- out.append(".");
- escapeName(name.kind, out);
- }
- }
- }
-
- /**
- * Process a name or kind element of a NameComponent,
- * adding escape characters for '.' or '/' characters
- * that might appear in the name.
- *
- * @param name The name element to process.
- * @param out The StringBuffer to copy the escaped name into.
- */
- protected void escapeName(String name, StringBuffer out) {
- // no characters requiring escapes (common)?
- // use this directly
- if (name.indexOf('.') == -1 && name.indexOf('/') == -1) {
- out.append(name);
- } else {
- // scan the string adding the escapes
- for (int i = 0; i < name.length(); i++) {
- char ch = name.charAt(i);
- if (ch == '.' || ch == '/') {
- out.append('/');
- }
- out.append(ch);
- }
- }
- }
-
- /**
- * Perform RFC 2396 escape encoding of a name value.
- *
- * @param name The input name value.
- *
- * @return An encoded name, with special characters converted
- * into a hex encoded value.
- */
- protected String encodeRFC2396Name(String name) {
- StringBuffer value = new StringBuffer();
-
- for (int i = 0; i < name.length(); i++) {
- char ch = name.charAt(i);
-
- // Alphanumerics and the "acceptable" set of special characters just get copied
- // without encoding.
- if (Character.isLetterOrDigit(ch) || nonEscaped.indexOf(ch) != -1) {
- value.append(ch);
- } else {
- // this gets converted into a hex value, marked by "%".
- value.append('%');
- value.append(Integer.toHexString((int)ch));
- }
- }
- return value.toString();
- }
-
- /**
- * Test if debug logging is currently available.
- *
- * @return True if debug level (FINE) logging is currently turned on.
- */
- protected boolean isDebugEnabled() {
- return logger.isLoggable(Level.FINE);
- }
-
- /**
- * Log a line of debug output
- *
- * @param message The message to log
- */
- protected void debug(String message) {
- logger.fine(message);
- }
-
- /**
- * Log the name components passed in for a request.
- *
- * @param message A message describing the request context.
- * @param n The array of name components.
- */
- protected void logNameComponent(String message, NameComponent[] n) {
- if (isDebugEnabled()) {
- debug(message);
- for (int i = 0; i < n.length; i++) {
- debug(" NameComponent " + i + " id=" + n[i].id + " kind=" + n[i].kind);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameServer.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameServer.java
deleted file mode 100644
index 599f5bca54..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameServer.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @version $Rev$ $Date$
- */
-package org.apache.tuscany.sca.host.corba.naming;
-
-import org.omg.CORBA.ORB;
-
-/**
- * A stand-alone naming service launchable from a command line.
- */
-public class TransientNameServer {
- private final TransientNameService service;
- private final Object flag = new Object();
- private Boolean started;
-
- public TransientNameServer(String host, int port, String serviceName) {
- this.service = new TransientNameService(host, port, serviceName);
- }
-
- public ORB getORB() {
- return service.getORB();
- }
-
- public Thread start() {
- Thread t = new Thread() {
- public void run() {
- ORB orb = null;
- synchronized (flag) {
- try {
- service.run();
- orb = service.getORB();
- started = Boolean.TRUE;
- } catch (Throwable e) {
- started = Boolean.FALSE;
- throw new IllegalStateException(e);
- } finally {
- flag.notifyAll();
- }
- }
- // Wait for requests
- orb.run();
- }
- };
- t.setDaemon(true);
- t.start();
- checkState();
- return t.isAlive() ? t : null;
- }
-
- private Boolean checkState() {
- synchronized (flag) {
- while (started == null) {
- try {
- flag.wait();
- } catch (InterruptedException e) {
- return null;
- }
- }
- return started;
- }
- }
-
- public void stop() {
- if (started == Boolean.TRUE) {
- service.destroy();
- }
- }
-
- /**
- * Launch a name service as a stand alone process. The
- * Host, port, and service name are controlled using
- * program arguments.
- *
- * @param args The array of arguments for tailoring the service.
- *
- * @exception Exception
- */
- public static void main(String args[]) throws Exception {
- int port = TransientNameService.DEFAULT_SERVICE_PORT;
- String host = TransientNameService.DEFAULT_SERVICE_HOST;
- String serviceName = TransientNameService.DEFAULT_SERVICE_NAME;
-
- // see if we have
- for (int i = 0; i < args.length; i++) {
- if (args[i].equals("-ORBInitialPort")) {
- i++;
- if (i < args.length) {
- port = java.lang.Integer.parseInt(args[i]);
- } else {
- throw new IllegalArgumentException("Invalid -ORBInitialPort option");
- }
- } else if (args[i].equals("-ORBInitialHost")) {
- i++;
- if (i < args.length) {
- host = args[i];
- } else {
- throw new IllegalArgumentException("Invalid -ORBInitialHost option");
- }
- } else if (args[i].equals("-ORBServiceName")) {
- i++;
- if (i < args.length) {
- serviceName = args[i];
- } else {
- throw new IllegalArgumentException("Invalid -ORBServiceName option");
- }
- }
-
- }
- // create a services, and just spin it off. We wait forever after that.
- TransientNameServer server = new TransientNameServer(host, port, serviceName);
- server.start().join();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java
deleted file mode 100644
index 0a437f9ae9..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNameService.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @version $Rev$ $Date$
- */
-package org.apache.tuscany.sca.host.corba.naming;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Properties;
-
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.Policy;
-import org.omg.PortableServer.IdAssignmentPolicyValue;
-import org.omg.PortableServer.LifespanPolicyValue;
-import org.omg.PortableServer.POA;
-import org.omg.PortableServer.ServantRetentionPolicyValue;
-
-/**
- * A transient name service attached to an ORB. This
- * class manages all of the housekeeping for creating a
- * TransientNamingContext and a exposing it using an
- * ORB.
- */
-public class TransientNameService {
- // the default registered name service
- static public final String DEFAULT_SERVICE_NAME = "TNameService";
- // the default listening port
- static public final int DEFAULT_SERVICE_PORT = 900;
- // the default host name
- static public final String DEFAULT_SERVICE_HOST = "localhost";
-
- // the service root context
- protected TransientNamingContext initialContext;
- // initial listening port
- protected int port;
- // initial listening host
- protected String host;
- // the service name (used for registing for the corbaloc:: URL name
- protected String serviceName;
- // the orb instance we're running on
- protected ORB createdOrb;
-
- /**
- * Create a new TransientNameService, using all default
- * attributes.
- */
- public TransientNameService() {
- this(DEFAULT_SERVICE_HOST, DEFAULT_SERVICE_PORT, DEFAULT_SERVICE_NAME);
- }
-
- /**
- * Create a default-named name service using the specified
- * host and port parameters.
- *
- * @param host The host to expose this under.
- * @param port The initial listening port.
- */
- public TransientNameService(String host, int port) {
- this(host, port, DEFAULT_SERVICE_NAME);
- }
-
- /**
- * Create a specifically-named name service using the specified
- * host and port parameters.
- *
- * @param host The host to expose this under.
- * @param port The initial listening port.
- * @param name The name to register this service under using the
- * BootManager.
- */
- public TransientNameService(String host, int port, String name) {
- this.port = port;
- this.host = host;
- this.serviceName = name;
- }
-
- /**
- * Start up the name service, including creating an
- * ORB instance to expose it under.
- *
- * @exception TransientServiceException
- */
- public void run() throws TransientServiceException {
- // Create an ORB object
- Properties props = new Properties();
- props.putAll(System.getProperties());
-
- String portStr = String.valueOf(port);
- props.put("org.omg.CORBA.ORBServerId", "1000000");
- props.put("org.omg.CORBA.ORBInitialHost", host);
- props.put("org.omg.CORBA.ORBInitialPort", portStr);
-
- // STEP 1: Set ORBPeristentServerPort property
- // Set the proprietary property to open up a port to listen to
- // INS requests.
-
- props.put("com.sun.CORBA.POA.ORBPersistentServerPort", portStr);
- props.put("com.ibm.CORBA.ListenerPort", portStr);
- props.put("gnu.CORBA.ListenerPort", portStr);
- // props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
- // props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
- props.put("yoko.orb.oa.endpoint", "iiop --host " + host + " --port " + port);
- props.put("yoko.orb.poamanager.TNameService.endpoint", "iiop --host " + host);
-
- String[] args = {"-ORBInitialHost", host, "-ORBInitialPort", "" + port};
- createdOrb = ORB.init(args, props);
-
- // now initialize the service
- initialize(createdOrb);
-
- }
-
- /**
- * Initialize a transient name service on a specific
- * ORB.
- *
- * @param orb The ORB hosting the service.
- *
- * @exception TransientServiceException
- */
- public void initialize(ORB orb) throws TransientServiceException {
- try {
- // get the root POA. We're going to re
- POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
- rootPOA.the_POAManager().activate();
-
- // we need to create a POA to manage this named instance, and then activate
- // a context on it.
- Policy[] policy = new Policy[3];
- policy[0] = rootPOA.create_lifespan_policy(LifespanPolicyValue.TRANSIENT);
- policy[1] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.SYSTEM_ID);
- policy[2] = rootPOA.create_servant_retention_policy(ServantRetentionPolicyValue.RETAIN);
-
- POA nameServicePOA = rootPOA.create_POA("TNameService", null, policy);
- nameServicePOA.the_POAManager().activate();
-
- // create our initial context, and register that with the ORB as the name service
- initialContext = new TransientNamingContext(orb, nameServicePOA);
- org.omg.CORBA.Object context = initialContext.getRootContext();
- Method method =
- orb.getClass().getMethod("register_initial_reference", String.class, org.omg.CORBA.Object.class);
- method.invoke(orb, serviceName, context);
- method.invoke(orb, "NamingService", context);
- method.invoke(orb, "NameService", context);
- } catch (Exception e) {
- throw new TransientServiceException("Unable to initialize name service", e);
- }
- }
-
- /**
- * Destroy the created service.
- */
- public void destroy() {
- // only destroy this if we created the orb instance.
- if (createdOrb != null) {
- createdOrb.shutdown(false);
-
- try {
- // This is a workaround to close the sockets for SUN ORB
- Method m = createdOrb.getClass().getMethod("getTransportManager");
- Object tm = m.invoke(createdOrb);
- m = tm.getClass().getMethod("close");
- m.invoke(tm);
- m = tm.getClass().getMethod("getAcceptors");
- Collection acceptors = (Collection) m.invoke(tm);
- for(Object a: acceptors) {
- m = a.getClass().getMethod("close");
- m.invoke(a);
- }
- } catch (Throwable e) {
- // Ignore
- }
-
- // Call destroy after close the acceptors
- // In JDK 1.6u14 or later, destroy clean up the acceptors but it doesn't close them
- createdOrb.destroy();
- createdOrb = null;
- }
- }
-
- public ORB getORB() {
- return createdOrb;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNamingContext.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNamingContext.java
deleted file mode 100644
index a7164e9ef3..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientNamingContext.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-/**
- * @version $Rev$ $Date$
- */
-
-package org.apache.tuscany.sca.host.corba.naming;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.omg.CORBA.INTERNAL;
-import org.omg.CORBA.ORB;
-import org.omg.CORBA.SystemException;
-import org.omg.CosNaming.Binding;
-import org.omg.CosNaming.BindingHolder;
-import org.omg.CosNaming.BindingIteratorHelper;
-import org.omg.CosNaming.BindingIteratorPOA;
-import org.omg.CosNaming.BindingType;
-import org.omg.CosNaming.BindingTypeHolder;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextHelper;
-import org.omg.CosNaming.NamingContextPackage.NotEmpty;
-import org.omg.PortableServer.POA;
-
-public class TransientNamingContext extends NamingContextBase {
- // the bindings maintained by this context
- protected HashMap bindings = new HashMap();
- // the root context object
- protected org.omg.CORBA.Object rootContext = null;
-
- /**
- * Create a top-level naming context.
- *
- * @param orb The orb hosting this context.
- * @param poa The POA used to activate the object.
- *
- * @exception Exception
- */
- public TransientNamingContext(ORB orb, POA poa) throws Exception {
- this(orb, poa, null);
- // now get the initial root context as a corba object.
-
- byte[] objectId = poa.activate_object(this);
- rootContext = poa.id_to_reference(objectId);
-
- }
-
- /**
- * Construct a TransientNamingContext subcontext.
- *
- * @param orb The orb this context is associated with.
- * @param poa The POA the root context is activated under.
- * @param root The root context.
- *
- * @exception Exception
- */
- public TransientNamingContext(ORB orb, POA poa, org.omg.CORBA.Object root) throws Exception {
- super(orb, poa);
- // save the root context link.
- rootContext = root;
- }
-
- // abstract methods part of the interface contract that the implementation is required
- // to supply.
-
- /**
- * Create a new context of the same type as the
- * calling context.
- *
- * @return A new NamingContext item.
- * @exception org.omg.CosNaming.NamingContextPackage.NotFound
- * @exception SystemException
- */
- public NamingContext new_context() throws SystemException {
- try {
- // create a new context. Then we need to register this with the POA and activate it.
- TransientNamingContext newContext = new TransientNamingContext(orb, poa, rootContext);
-
- byte[] objectId = poa.activate_object(newContext);
- org.omg.CORBA.Object obj = poa.id_to_reference(objectId);
- return NamingContextHelper.narrow(obj);
- } catch (SystemException e) {
- // just propagate system exceptions
- throw e;
- } catch (Exception e) {
- throw (INTERNAL)(new INTERNAL("Unable to create new naming context").initCause(e));
- }
- }
-
- /**
- * Destroy a context. This method should clean up
- * any backing resources associated with the context.
- *
- * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty
- */
- public synchronized void destroy() throws org.omg.CosNaming.NamingContextPackage.NotEmpty {
- // still holding bound objects? Not allowed to destroy
- if (!bindings.isEmpty()) {
- throw new NotEmpty();
- }
-
- try {
- // now detach ourselves from the POA
- byte[] objectId = poa.servant_to_id(this);
- if (objectId != null) {
- poa.deactivate_object(objectId);
- }
- } catch (Exception e) {
- // ignore
- }
- }
-
- /**
- * Create a list of bound objects an contexts contained
- * within this context.
- *
- * @param how_many The count of elements to return as a BindingList.
- * @param bl A holder element for returning the source binding list.
- * @param bi A holder for returning a BindingIterator. Any extra
- * elements not returned in the BindingList are returned
- * in the BindingIterator.
- *
- * @exception SystemException
- */
- public synchronized void list(int how_many,
- org.omg.CosNaming.BindingListHolder bl,
- org.omg.CosNaming.BindingIteratorHolder bi) throws SystemException {
- TransientBindingIterator iterator = new TransientBindingIterator(poa, (HashMap)bindings.clone());
- // have the iterator fill in the entries here
- iterator.next_n(how_many, bl);
-
- // now it's necessary to activate this iterator with the poa. The value we pass
- // back is the narrowed activated object
- try {
- byte[] objectId = poa.activate_object(iterator);
- org.omg.CORBA.Object obj = poa.id_to_reference(objectId);
-
- bi.value = BindingIteratorHelper.narrow(obj);
- } catch (SystemException e) {
- // just propagate system exceptions
- throw e;
- } catch (Exception e) {
- throw (INTERNAL)(new INTERNAL("Unable to activate BindingIterator").initCause(e));
- }
- }
-
- // lower level functions that are used by the base class
-
- /**
- * Resolve an object in this context (single level
- * resolution).
- *
- * @param n The name of the target object.
- * @param type A type holder for returning the bound object type
- * information.
- *
- * @return The bound object. Returns null if the object does not
- * exist in the context.
- * @exception SystemException
- */
- protected org.omg.CORBA.Object resolveObject(NameComponent n, BindingTypeHolder type) throws SystemException {
- // special call to resolve the root context. This is the only one that goes backwards.
- if (n.id.length() == 0 && n.kind.length() == 0) {
- // this is a name context item, so set it properly.
- type.value = BindingType.ncontext;
- return rootContext;
- }
-
- BindingKey key = new BindingKey(n);
- BoundObject obj = (BoundObject)bindings.get(key);
- // if not in the table, just return null
- if (obj == null) {
- return null;
- }
- // update the type information and return the bound object reference.
- type.value = obj.type;
- return obj.boundObject;
- }
-
- /**
- * Bind an object into the current context. This can
- * be either an object or a naming context.
- *
- * @param n The single-level name of the target object.
- * @param obj The object or context to be bound.
- * @param type
- *
- * @exception SystemException
- */
- protected void bindObject(NameComponent n, org.omg.CORBA.Object obj, BindingTypeHolder type) throws SystemException {
- // fairly simple table put...
- bindings.put(new BindingKey(n), new BoundObject(n, obj, type.value));
- }
-
- /**
- * Unbind an object from the current context.
- *
- * @param n The name of the target object (single level).
- *
- * @return The object associated with the binding. Returns null
- * if there was no binding currently associated with this
- * name.
- * @exception SystemException
- */
- protected org.omg.CORBA.Object unbindObject(NameComponent n) throws SystemException {
- //remove the object from the hash table, returning the bound object if it exists.
- BindingKey key = new BindingKey(n);
- BoundObject obj = (BoundObject)bindings.remove(key);
-
- if (obj != null) {
- return obj.boundObject;
- }
- return null;
- }
-
- /**
- * Retrieve the rootContext for this NamingContext.
- *
- * @return The rootContext CORBA object associated with this context.
- */
- public org.omg.CORBA.Object getRootContext() {
- return rootContext;
- }
-
- /**
- * Internal class used for HashMap lookup keys.
- */
- class BindingKey {
- // the name component this is a HashMap key for.
- public NameComponent name;
- private int hashval = 0;
-
- /**
- * Create a new BindingKey for a NameComponent.
- *
- * @param n The lookup name.
- */
- public BindingKey(NameComponent n) {
- name = n;
- // create a hash value used for lookups
- if (name.id != null) {
- hashval += name.id.hashCode();
- }
- if (name.kind != null) {
- hashval += name.kind.hashCode();
- }
- }
-
- /**
- * Return the hashcode associated with this binding key. The
- * hashcode is created using the NameComponent id and
- * kind fields.
- *
- * @return The lookup hashvalue associated with this key.
- */
- public int hashCode() {
- return hashval;
- }
-
- /**
- * Compare two BindingKeys for equality (used for HashMap
- * lookups).
- *
- * @param other The comparison partner.
- *
- * @return True if the keys are equivalent, false otherwise.
- */
- public boolean equals(Object other) {
- // if not given or the wrong type, this is false.
- if (other == null || !(other instanceof BindingKey)) {
- return false;
- }
-
- BindingKey otherKey = (BindingKey)other;
-
- // verify first on the id name.
- if (name.id != null) {
- if (otherKey.name.id == null) {
- return false;
- }
- if (!name.id.equals(otherKey.name.id)) {
- return false;
- }
- } else {
- if (otherKey.name.id != null) {
- return false;
- }
- }
- // this is a match so far...now compare the kinds
- if (name.kind != null) {
- if (otherKey.name.kind == null) {
- return false;
- }
- if (!name.kind.equals(otherKey.name.kind)) {
- return false;
- }
- } else {
- if (otherKey.name.kind != null) {
- return false;
- }
- }
- return true;
- }
- }
-
- /**
- * Internal class used to store bound objects in the HashMap.
- */
- public class BoundObject {
- // the name this object is bound under.
- public NameComponent name;
- // the type of binding (either nobject or ncontext).
- public BindingType type;
- // the actual bound object.
- public org.omg.CORBA.Object boundObject;
-
- /**
- * Create a new object binding for our HashMap.
- *
- * @param name The bound object's name.
- * @param boundObject
- * The bound object (real object or NamingContext).
- * @param type The type information associated with this binding.
- */
- public BoundObject(NameComponent name, org.omg.CORBA.Object boundObject, BindingType type) {
- this.name = name;
- this.boundObject = boundObject;
- this.type = type;
- }
- }
-
- /**
- * Context implementation version of the BindingIterator
- * object used to return list items.
- */
- public class TransientBindingIterator extends BindingIteratorPOA {
- // the POA used to activate this object (required for destroy();
- private POA poa;
- // the binding set we're iterating over (this must be a snapshot copy)
- private HashMap bindings;
- // the iterator use to access the bindings
- private Iterator iterator;
-
- /**
- * Create a new BindingIterator hosted by the given POA and
- * iterating over the map of items.
- *
- * @param poa The hosting POA.
- * @param bindings The HashMap of bound objects.
- */
- public TransientBindingIterator(POA poa, HashMap bindings) {
- this.poa = poa;
- this.bindings = bindings;
- this.iterator = bindings.values().iterator();
- }
-
- /**
- * Return the next object in the iteration sequence.
- *
- * @param b The BindingHolder used to return the next item. If
- * we've reached the end of the sequence, an item
- * with an empty name is returned.
- *
- * @return true if there is another item, false otherwise.
- */
- public boolean next_one(org.omg.CosNaming.BindingHolder b) {
- if (iterator.hasNext()) {
- // return this as a Binding value.
- BoundObject obj = (BoundObject)iterator.next();
- b.value = new Binding(new NameComponent[] {obj.name}, obj.type);
- return true;
- } else {
- // return an empty element
- b.value = new Binding(new NameComponent[0], BindingType.nobject);
- return false;
- }
- }
-
- /**
- * Retrieve the next "n" items from the list, returned
- * as a BindingList.
- *
- * @param how_many The count of items to retrieve.
- * @param bl A holder for returning an array of Bindings for
- * the returned items.
- *
- * @return true if any items were returned, false if there's
- * nothing left to return.
- */
- public boolean next_n(int how_many, org.omg.CosNaming.BindingListHolder bl) {
- List accum = new ArrayList();
- BindingHolder holder = new BindingHolder();
- int i = 0;
- // Keep iterating as long as there are entries
- while (i < how_many && next_one(holder)) {
- accum.add(holder.value);
- i++;
- }
-
- // convert to an array and return whether we found anything.
- bl.value = (Binding[])accum.toArray(new Binding[accum.size()]);
- return accum.isEmpty();
- }
-
- /**
- * Destory this BindingIterator instance, which deativates
- * it from the hosting POA.
- */
- public void destroy() {
- try {
- // we need to deactivate this from the POA.
- byte[] objectId = poa.servant_to_id(this);
- if (objectId != null) {
- poa.deactivate_object(objectId);
- }
- } catch (Exception e) {
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientServiceException.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientServiceException.java
deleted file mode 100644
index 444143f173..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/java/org/apache/tuscany/sca/host/corba/naming/TransientServiceException.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.
- */
-
-/**
- * @version $Rev$ $Date$
- */
-package org.apache.tuscany.sca.host.corba.naming;
-
-public class TransientServiceException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -2611596914331994827L;
-
- public TransientServiceException() {
- super();
- }
-
- public TransientServiceException(String reason) {
- super(reason);
- }
-
- public TransientServiceException(String reason, Exception cause) {
- super(reason, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index a96baed33e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.host.corba.jse.CorbaRuntimeModuleActivator \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java
deleted file mode 100644
index 8084e39956..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/DefaultCorbaHostTestCase.java
+++ /dev/null
@@ -1,250 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.testing;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-
-import java.net.ConnectException;
-import java.net.Socket;
-import java.net.SocketException;
-
-import org.apache.tuscany.sca.host.corba.CorbaHost;
-import org.apache.tuscany.sca.host.corba.CorbaHostException;
-import org.apache.tuscany.sca.host.corba.CorbaHostUtils;
-import org.apache.tuscany.sca.host.corba.jse.DefaultCorbaHost;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameServer;
-import org.apache.tuscany.sca.host.corba.naming.TransientNameService;
-import org.apache.tuscany.sca.host.corba.testing.general.TestInterface;
-import org.apache.tuscany.sca.host.corba.testing.general.TestInterfaceHelper;
-import org.apache.tuscany.sca.host.corba.testing.servants.TestInterfaceServant;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * General tests
- */
-public class DefaultCorbaHostTestCase {
-
- private static final String LOCALHOST = "localhost";
- private static final int DEFAULT_PORT = 11100; // 1050;
-
- private static CorbaHost host;
-
- private static TransientNameServer server;
-
- @BeforeClass
- public static void start() {
- try {
- server = new TransientNameServer(LOCALHOST, DEFAULT_PORT, TransientNameService.DEFAULT_SERVICE_NAME);
- Thread t = server.start();
- if (t == null) {
- fail("The naming server cannot be started");
- }
- host = new DefaultCorbaHost();
- } catch (Throwable e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- @AfterClass
- public static void stop() {
- server.stop();
- }
-
- /**
- * Tests registering and lookup CORBA services
- */
- @Test
- public void test_registerServant() {
- try {
- String uri = CorbaHostUtils.createCorbanameURI(LOCALHOST, DEFAULT_PORT, "Nested/Test");
- TestInterface servant = new TestInterfaceServant();
- host.registerServant(uri, servant);
- TestInterface ref = TestInterfaceHelper.narrow(host.lookup(uri));
- assertEquals(2, ref.getInt(2));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests unregistering servants
- */
- @Test
- public void test_unregisterServant() {
- try {
- String objName = "Unregistering/Test";
- String uri = CorbaHostUtils.createCorbanameURI(LOCALHOST, DEFAULT_PORT, objName);
- TestInterface servant = new TestInterfaceServant();
-
- // creating and releasing using corbaname URI
- host.registerServant(uri, servant);
- host.unregisterServant(uri);
- host.registerServant(uri, servant);
- host.unregisterServant(uri);
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests situation when name is already registered
- */
- @Test
- public void test_nameAlreadyRegistered() {
- // test using URI
- try {
- TestInterface servant = new TestInterfaceServant();
- String uri = CorbaHostUtils.createCorbanameURI(LOCALHOST, DEFAULT_PORT, "AlreadyRegisteredTest2");
- host.registerServant(uri, servant);
- host.registerServant(uri, servant);
- fail();
- } catch (CorbaHostException e) {
- assertTrue(e.getMessage().equals(CorbaHostException.BINDING_IN_USE));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests getting non existing reference
- */
- @Test
- public void test_getNonExistingObject() {
- // try to fetch object with corbaname URI
- try {
- host.lookup(CorbaHostUtils.createCorbanameURI("NonExistingOne", DEFAULT_PORT, LOCALHOST));
- fail();
- } catch (CorbaHostException e) {
- // The message is JDK-specific
- // assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
- } catch (Exception e) {
- // e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests unregistering non existing reference
- */
- @Test
- public void test_unregisterNonExistentObject() {
- // test using URI
- try {
- String uri = CorbaHostUtils.createCorbanameURI(LOCALHOST, DEFAULT_PORT, "NonExistingReference1");
- host.unregisterServant(uri);
- fail();
- } catch (CorbaHostException e) {
- assertTrue(e.getMessage().equals(CorbaHostException.NO_SUCH_OBJECT));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- * Tests registering under invalid host
- */
- @Test
- public void test_invalidHost() {
- try {
- String url = CorbaHostUtils.createCorbanameURI("not_" + LOCALHOST, DEFAULT_PORT, "Name");
- TestInterface servant = new TestInterfaceServant();
- host.registerServant(url, servant);
- fail();
- } catch (CorbaHostException e) {
- // Expected
- } catch (Exception e) {
- // e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- /**
- * Tests registering under invalid port
- */
- @Test
- public void test_invalidPort() {
- try {
- String url = CorbaHostUtils.createCorbanameURI(LOCALHOST, DEFAULT_PORT + 1, "Name");
- TestInterface servant = new TestInterfaceServant();
- host.registerServant(url, servant);
- fail();
- } catch (CorbaHostException e) {
- // Expected
- } catch (Exception e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- }
-
- /**
- * Tests registering under invalid name
- */
- @Test
- @Ignore("SUN JDK 6 is happy with all kind of names")
- public void test_invalidBindingName() {
- try {
- TestInterface servant = new TestInterfaceServant();
- host.registerServant("---", servant);
- fail();
- } catch (CorbaHostException e) {
- assertTrue(e.getMessage().equals(CorbaHostException.WRONG_NAME));
- } catch (Exception e) {
- e.printStackTrace();
- fail();
- }
- }
-
- /**
- *
- */
- @Test
- public void test_ensureORBStopped() {
- try {
- int innerORBPort = 11102;
- TransientNameServer innerServer =
- new TransientNameServer(LOCALHOST, innerORBPort, TransientNameService.DEFAULT_SERVICE_NAME);
- innerServer.start();
- innerServer.stop();
- try {
- Thread.sleep(500);
- } catch (Exception e) {
- }
- new Socket(LOCALHOST, innerORBPort);
- fail();
- } catch (Exception e) {
- if (e instanceof ConnectException) {
- assertTrue(true);
- } else {
- e.printStackTrace();
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java
deleted file mode 100644
index 7e4b429fbd..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterface.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.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterface.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public interface TestInterface extends TestInterfaceOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity {
-} // interface TestInterface
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java
deleted file mode 100644
index 1408d4f705..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHelper.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-abstract public class TestInterfaceHelper {
- private static String _id = "IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0";
-
- public static void insert(org.omg.CORBA.Any a, org.apache.tuscany.sca.host.corba.testing.general.TestInterface that) {
- org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
- a.type(type());
- write(out, that);
- a.read_value(out.create_input_stream(), type());
- }
-
- public static org.apache.tuscany.sca.host.corba.testing.general.TestInterface extract(org.omg.CORBA.Any a) {
- return read(a.create_input_stream());
- }
-
- private static org.omg.CORBA.TypeCode __typeCode = null;
-
- synchronized public static org.omg.CORBA.TypeCode type() {
- if (__typeCode == null) {
- __typeCode =
- org.omg.CORBA.ORB.init()
- .create_interface_tc(org.apache.tuscany.sca.host.corba.testing.general.TestInterfaceHelper.id(),
- "TestInterface");
- }
- return __typeCode;
- }
-
- public static String id() {
- return _id;
- }
-
- public static org.apache.tuscany.sca.host.corba.testing.general.TestInterface read(org.omg.CORBA.portable.InputStream istream) {
- return narrow(istream.read_Object(_TestInterfaceStub.class));
- }
-
- public static void write(org.omg.CORBA.portable.OutputStream ostream,
- org.apache.tuscany.sca.host.corba.testing.general.TestInterface value) {
- ostream.write_Object((org.omg.CORBA.Object)value);
- }
-
- public static org.apache.tuscany.sca.host.corba.testing.general.TestInterface narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.host.corba.testing.general.TestInterface)
- return (org.apache.tuscany.sca.host.corba.testing.general.TestInterface)obj;
- else if (!obj._is_a(id()))
- throw new org.omg.CORBA.BAD_PARAM();
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.host.corba.testing.general._TestInterfaceStub stub =
- new org.apache.tuscany.sca.host.corba.testing.general._TestInterfaceStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
- public static org.apache.tuscany.sca.host.corba.testing.general.TestInterface unchecked_narrow(org.omg.CORBA.Object obj) {
- if (obj == null)
- return null;
- else if (obj instanceof org.apache.tuscany.sca.host.corba.testing.general.TestInterface)
- return (org.apache.tuscany.sca.host.corba.testing.general.TestInterface)obj;
- else {
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- org.apache.tuscany.sca.host.corba.testing.general._TestInterfaceStub stub =
- new org.apache.tuscany.sca.host.corba.testing.general._TestInterfaceStub();
- stub._set_delegate(delegate);
- return stub;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java
deleted file mode 100644
index 2c517e3c56..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.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.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceHolder.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public final class TestInterfaceHolder implements org.omg.CORBA.portable.Streamable {
- public org.apache.tuscany.sca.host.corba.testing.general.TestInterface value = null;
-
- public TestInterfaceHolder() {
- }
-
- public TestInterfaceHolder(org.apache.tuscany.sca.host.corba.testing.general.TestInterface initialValue) {
- value = initialValue;
- }
-
- public void _read(org.omg.CORBA.portable.InputStream i) {
- value = org.apache.tuscany.sca.host.corba.testing.general.TestInterfaceHelper.read(i);
- }
-
- public void _write(org.omg.CORBA.portable.OutputStream o) {
- org.apache.tuscany.sca.host.corba.testing.general.TestInterfaceHelper.write(o, value);
- }
-
- public org.omg.CORBA.TypeCode _type() {
- return org.apache.tuscany.sca.host.corba.testing.general.TestInterfaceHelper.type();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java
deleted file mode 100644
index d34f62d006..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.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.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/TestInterfaceOperations.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public interface TestInterfaceOperations {
- int getInt(int arg);
-} // interface TestInterfaceOperations
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java
deleted file mode 100644
index a4d5703a30..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.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.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceImplBase.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public abstract class _TestInterfaceImplBase extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.host.corba.testing.general.TestInterface, org.omg.CORBA.portable.InvokeHandler {
-
- // Constructors
- public _TestInterfaceImplBase() {
- }
-
- private static java.util.Hashtable _methods = new java.util.Hashtable();
- static {
- _methods.put("getInt", new java.lang.Integer(0));
- }
-
- public org.omg.CORBA.portable.OutputStream _invoke(String $method,
- org.omg.CORBA.portable.InputStream in,
- org.omg.CORBA.portable.ResponseHandler $rh) {
- org.omg.CORBA.portable.OutputStream out = null;
- java.lang.Integer __method = (java.lang.Integer)_methods.get($method);
- if (__method == null)
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
-
- switch (__method.intValue()) {
- case 0: // org/apache/tuscany/sca/host/corba/testing/general/TestInterface/getInt
- {
- int arg = in.read_long();
- int $result = (int)0;
- $result = this.getInt(arg);
- out = $rh.createReply();
- out.write_long($result);
- break;
- }
-
- default:
- throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
- }
-
- return out;
- } // _invoke
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
-
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
-} // class _TestInterfaceImplBase
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java
deleted file mode 100644
index c475bcc0ef..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba.testing.general;
-
-/**
-* org/apache/tuscany/sca/host/corba/testing/general/_TestInterfaceStub.java .
-* Generated by the IDL-to-Java compiler (portable), version "3.2"
-* from general_tests.idl
-* roda, 25 czerwiec 2008 16:19:44 CEST
-*/
-
-public class _TestInterfaceStub extends org.omg.CORBA.portable.ObjectImpl implements
- org.apache.tuscany.sca.host.corba.testing.general.TestInterface {
-
- public int getInt(int arg) {
- org.omg.CORBA.portable.InputStream $in = null;
- try {
- org.omg.CORBA.portable.OutputStream $out = _request("getInt", true);
- $out.write_long(arg);
- $in = _invoke($out);
- int $result = $in.read_long();
- return $result;
- } catch (org.omg.CORBA.portable.ApplicationException $ex) {
- $in = $ex.getInputStream();
- String _id = $ex.getId();
- throw new org.omg.CORBA.MARSHAL(_id);
- } catch (org.omg.CORBA.portable.RemarshalException $rm) {
- return getInt(arg);
- } finally {
- _releaseReply($in);
- }
- } // getInt
-
- // Type-specific CORBA::Object operations
- private static String[] __ids = {"IDL:org/apache/tuscany/sca/host/corba/testing/general/TestInterface:1.0"};
-
- public String[] _ids() {
- return (String[])__ids.clone();
- }
-
- private void readObject(java.io.ObjectInputStream s) throws java.io.IOException {
- String str = s.readUTF();
- String[] args = null;
- java.util.Properties props = null;
- org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init(args, props).string_to_object(str);
- org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
- _set_delegate(delegate);
- }
-
- private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
- String[] args = null;
- java.util.Properties props = null;
- String str = org.omg.CORBA.ORB.init(args, props).object_to_string(this);
- s.writeUTF(str);
- }
-} // class _TestInterfaceStub
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/servants/TestInterfaceServant.java b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/servants/TestInterfaceServant.java
deleted file mode 100644
index 0ebde8ef0d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/java/org/apache/tuscany/sca/host/corba/testing/servants/TestInterfaceServant.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.host.corba.testing.servants;
-
-import org.apache.tuscany.sca.host.corba.testing.general._TestInterfaceImplBase;
-
-/**
- * Testing servant
- */
-public class TestInterfaceServant extends _TestInterfaceImplBase {
-
- private static final long serialVersionUID = 1L;
-
- public int getInt(int arg) {
- return arg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/resources/general.idl b/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/resources/general.idl
deleted file mode 100644
index f67566deb8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba-jse/src/test/resources/general.idl
+++ /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.
- */
-
-/*
- * compile by
- * idlj -fall -oldImplBase genera.idl
- */
-
-module org {
- module apache {
- module tuscany {
- module sca {
- module host {
- module corba {
- module testing {
- module general {
- interface TestInterface {
- long getInt(in long arg);
- };
- };
- };
- };
- };
- };
- };
- };
-};
diff --git a/branches/sca-java-1.5.1/modules/host-corba/LICENSE b/branches/sca-java-1.5.1/modules/host-corba/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/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-java-1.5.1/modules/host-corba/NOTICE b/branches/sca-java-1.5.1/modules/host-corba/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-corba/pom.xml b/branches/sca-java-1.5.1/modules/host-corba/pom.xml
deleted file mode 100644
index 41f459a2ad..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/pom.xml
+++ /dev/null
@@ -1,57 +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>1.5.1-SNAPSHOT</version>
- </parent>
- <artifactId>tuscany-host-corba</artifactId>
- <name>Apache Tuscany SCA CORBA Host Extension Point</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.corba</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.corba*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.java
deleted file mode 100644
index eb49f3f841..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHost.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.host.corba;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- * CORBA Service hosting interface
- */
-public interface CorbaHost {
-
- /**
- * Registers servant in name server.
- *
- * @param uri corbaname URI
- * @param serviceObject
- * @throws CorbaHostException
- */
- void registerServant(String uri, Object serviceObject) throws CorbaHostException;
-
- /**
- * Removes servant from name server
- *
- * @param orb The ORB instance
- * @param name binding name
- * @throws CorbaHostException
- */
- void unregisterServant(String uri) throws CorbaHostException;
-
- /**
- * Gets reference to object
- *
- * @param name binding name
- * @return objects reference
- * @throws CorbaHostException
- */
- Object lookup(String uri) throws CorbaHostException;
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java
deleted file mode 100644
index 049bfdb6cd..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba;
-
-/**
- * @version $Rev$ $Date$
- * General exception for corba hosts operations
- */
-public class CorbaHostException extends Exception {
-
- private static final long serialVersionUID = 1L;
-
- public static final String BINDING_IN_USE = "Binding name is already in use";
- public static final String NO_SUCH_OBJECT = "There is no object under given location";
- public static final String NO_SUCH_HOST = "Couldn't find specified host";
- public static final String NO_SUCH_PORT = "Couldn't connect to specified port";
- public static final String WRONG_NAME = "Characters used in binding name are illegal";
-
- public CorbaHostException(String message) {
- super(message);
- }
-
- public CorbaHostException(Exception cause) {
- super(cause);
- }
-
- public CorbaHostException(String message, Exception cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostExtensionPoint.java
deleted file mode 100644
index 067b9193c5..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostExtensionPoint.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.host.corba;
-
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- * An extension point for CORBA hostst
- */
-public interface CorbaHostExtensionPoint {
-
- /**
- * Removes CORBA host extension
- *
- * @param corbaHost
- */
- void addCorbaHost(CorbaHost corbaHost);
-
- /**
- * Removes CORBA host extension
- *
- * @param corbaHost
- */
- void removeCorbaHost(CorbaHost corbaHost);
-
- /**
- * Gets all CORBA host extensions
- *
- * @return
- */
- List<CorbaHost> getCorbaHosts();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostUtils.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostUtils.java
deleted file mode 100644
index b90fe9c78b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbaHostUtils.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.host.corba;
-
-
-/**
- * @version $Rev$ $Date$
- * Various utilities for host-corba
- */
-public class CorbaHostUtils {
-
- /**
- * Tests if given URI is valid corbaname string
- * @param uri
- * @return
- */
- public static boolean isValidCorbanameURI(String uri) {
- return uri != null && uri.startsWith("corbaname:") && uri.contains("#") && uri.indexOf('#') < uri.length() - 1;
- }
-
- /**
- * Creates corbaname URI basing on given parameters
- * @param host
- * @param port
- * @param name
- *
- * @return
- */
- public static String createCorbanameURI(String host, int port, String name) {
- return new CorbanameURL(host, port, name).toString();
- }
-
- /**
- * Translates corbaname URI to CorbanameDetails instances
- *
- * @param uri
- * @return
- */
- public static CorbanameURL getServiceDetails(String uri) {
- CorbanameURL details = new CorbanameURL(uri);
- return details;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java
deleted file mode 100644
index a380fd6d79..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/CorbanameURL.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URLDecoder;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- * Holds corbaname URI details
- */
-public class CorbanameURL {
- public static String DEFAULT_PROTOCOL = "iiop";
- public static String DEFAULT_VERSION = "";
- public static String DEFAULT_NAME_SERVICE = "NameService";
- public static String DEFAULT_HOST = "localhost";
- public static int DEFAULT_PORT = 2809;
-
- private String protocol = "";
- private String version = "";
- private String host;
- private int port;
- private String nameService;
- private List<String> namePath;
-
- public CorbanameURL(String host, int port, String namePath, String nameService) {
- super();
- this.host = host == null ? DEFAULT_HOST : host;
- this.port = port <= 0 ? DEFAULT_PORT : port;
- this.namePath = parseName(namePath);
- this.nameService = nameService == null ? DEFAULT_NAME_SERVICE : nameService;
- }
-
- public CorbanameURL(String host, int port, String namePath) {
- this(host, port, namePath, DEFAULT_NAME_SERVICE);
- }
-
- public CorbanameURL(String url) {
- if (url == null || (!url.startsWith("corbaname"))) {
- throw new IllegalArgumentException("Malformed corbaname URL: " + url);
- }
- try {
- url = URLDecoder.decode(url, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException(e);
- }
- String[] parts = url.split("#");
- if (parts.length == 2) {
- String serviceLocation = parts[0];
- String servicePath = parts[1];
- namePath = parseName(servicePath);
-
- parts = serviceLocation.split("/");
- if (parts.length == 2) {
- nameService = parts[1];
- } else {
- nameService = DEFAULT_NAME_SERVICE;
- }
-
- parts = parts[0].split(":");
-
- if (parts.length >= 2) {
- protocol = parts[1];
- }
- if (parts.length >= 3) {
- version = parts[2];
- String[] strs = version.split("@");
- if (strs.length == 2) {
- version = strs[0];
- host = strs[1];
- } else {
- version = "";
- host = strs[0];
- }
- }
- if (host == null || "".equals(host)) {
- host = DEFAULT_HOST;
- }
- if (parts.length >= 4 && !"".equals(parts[3])) {
- port = Integer.parseInt(parts[3]);
- } else {
- port = DEFAULT_PORT;
- }
- } else {
- throw new IllegalArgumentException("Malformed corbaname URL: " + url);
- }
- }
-
- private static List<String> parseName(String name) {
- try {
- name = URLDecoder.decode(name, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new IllegalArgumentException(e);
- }
- String[] names = name.split("/");
- return Arrays.asList(names);
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public void setProtocol(String protocol) {
- this.protocol = protocol;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getNameService() {
- return nameService;
- }
-
- public void setNameService(String nameService) {
- this.nameService = nameService;
- }
-
- public List<String> getNamePath() {
- return namePath;
- }
-
- public String getName() {
- if (namePath != null) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < namePath.size(); i++) {
- buf.append(namePath.get(i));
- if (i < namePath.size() - 1) {
- buf.append("/");
- }
- }
- return buf.toString();
- }
- return null;
- }
-
- public void setNamePath(List<String> namePath) {
- this.namePath = namePath;
- }
-
- @Override
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append("corbaname:");
- buf.append(protocol).append(":");
- if (version != null && !"".equals(version)) {
- buf.append(version).append("@");
- }
- buf.append(host).append(":").append(port);
- buf.append("/").append(nameService);
- buf.append("#");
- if (namePath != null) {
- for (int i = 0; i < namePath.size(); i++) {
- buf.append(namePath.get(i));
- if (i < namePath.size() - 1) {
- buf.append("/");
- }
- }
- }
- return buf.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/DefaultCorbaHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/DefaultCorbaHostExtensionPoint.java
deleted file mode 100644
index 438734086d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/DefaultCorbaHostExtensionPoint.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @version $Rev$ $Date$
- * Default implementation of CorbaHostExtensionPoint
- */
-public class DefaultCorbaHostExtensionPoint implements CorbaHostExtensionPoint {
-
- private List<CorbaHost> corbaHosts = new ArrayList<CorbaHost>();
-
- public DefaultCorbaHostExtensionPoint() {
- }
-
- public void addCorbaHost(CorbaHost host) {
- corbaHosts.add(host);
- }
-
- public void removeCorbaHost(CorbaHost host) {
- corbaHosts.remove(host);
- }
-
- public List<CorbaHost> getCorbaHosts() {
- return corbaHosts;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.java
deleted file mode 100644
index 7e043667a9..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/ExtensibleCorbaHost.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.host.corba;
-
-import org.omg.CORBA.Object;
-
-/**
- * @version $Rev$ $Date$
- * Default implementation of extensible CORBA host
- */
-public class ExtensibleCorbaHost implements CorbaHost {
-
- private CorbaHostExtensionPoint hosts;
-
- public ExtensibleCorbaHost(CorbaHostExtensionPoint chep) {
- this.hosts = chep;
- }
-
- public Object lookup(String uri) throws CorbaHostException {
- return getCorbaHost().lookup(uri);
- }
-
- public void registerServant(String uri, Object serviceObject) throws CorbaHostException {
- getCorbaHost().registerServant(uri, serviceObject);
- }
-
- public void unregisterServant(String uri) throws CorbaHostException {
- getCorbaHost().unregisterServant(uri);
- }
-
- protected CorbaHost getCorbaHost() throws CorbaHostException {
- if (hosts.getCorbaHosts().isEmpty()) {
- throw new CorbaHostException("No registered CORBA hosts");
- }
- return hosts.getCorbaHosts().get(0);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/SocketUtil.java b/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/SocketUtil.java
deleted file mode 100755
index 6989b3ad06..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/java/org/apache/tuscany/sca/host/corba/SocketUtil.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba;
-
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @version $Rev$ $Date$
- * Class partially copied from eclipse wst project
- * (http://repo1.maven.org/maven2/org/eclipse/wst/server/core/1.0.205-v20070829b/).
- * Finally we should use jar from maven dependency. Problem described in
- * http://www.fornax-platform.org/cp/display/fornax/2.+Hello+World+Tutorial+(CSC)?replyToComment=2098#comment-2098
- * needs to be fixed.
- */
-public class SocketUtil {
-
- protected static final Object lock = new Object();
-
- private static Set<String> localHostCache;
- private static Set<String> notLocalHostCache = new HashSet<String>();
- private static Map<String, CacheThread> threadMap = new HashMap<String, CacheThread>();
-
- private static Set<InetAddress> addressCache;
-
- static class CacheThread extends Thread {
- private Set<InetAddress> currentAddresses;
- private Set<String> addressList;
- private String host;
- private Set<String> nonAddressList;
- private Map<String, CacheThread> threadMap2;
-
- public CacheThread(String host,
- Set<InetAddress> currentAddresses,
- Set<String> addressList,
- Set<String> nonAddressList,
- Map<String, CacheThread> threadMap2) {
- super("Caching localhost information");
- this.host = host;
- this.currentAddresses = currentAddresses;
- this.addressList = addressList;
- this.nonAddressList = nonAddressList;
- this.threadMap2 = threadMap2;
- }
-
- public void run() {
- if (currentAddresses != null) {
- Iterator<InetAddress> iter2 = currentAddresses.iterator();
- while (iter2.hasNext()) {
- InetAddress addr = iter2.next();
- String hostname = addr.getHostName();
- String hostname2 = addr.getCanonicalHostName();
- synchronized (lock) {
- if (hostname != null && !addressList.contains(hostname))
- addressList.add(hostname);
- if (hostname2 != null && !addressList.contains(hostname2))
- addressList.add(hostname2);
- }
- }
- }
-
- try {
- InetAddress[] addrs = InetAddress.getAllByName(host);
- int length = addrs.length;
- for (int j = 0; j < length; j++) {
- InetAddress addr = addrs[0];
- String hostname = addr.getHostName();
- String hostname2 = addr.getCanonicalHostName();
- synchronized (lock) {
- if (addr.isLoopbackAddress()) {
- if (hostname != null && !addressList.contains(hostname))
- addressList.add(hostname);
- if (hostname2 != null && !addressList.contains(hostname2))
- addressList.add(hostname2);
- } else {
- if (hostname != null && !nonAddressList.contains(hostname))
- nonAddressList.add(hostname);
- if (hostname2 != null && !nonAddressList.contains(hostname2))
- nonAddressList.add(hostname2);
- }
- }
- }
- } catch (UnknownHostException e) {
- synchronized (lock) {
- if (host != null && !nonAddressList.contains(host))
- nonAddressList.add(host);
- }
- }
- synchronized (lock) {
- threadMap2.remove(host);
- }
- }
- }
-
- public static boolean isLocalhost(final String host) {
- if (host == null || host.equals(""))
- return false;
-
- if ("localhost".equals(host) || "127.0.0.1".equals(host))
- return true;
-
- // check simple cases
- try {
- InetAddress localHostaddr = InetAddress.getLocalHost();
- if (localHostaddr.getHostName().equals(host) || host.equals(localHostaddr.getCanonicalHostName())
- || localHostaddr.getHostAddress().equals(host))
- return true;
- } catch (Exception e) {
-
- }
-
- // check for current thread and wait if necessary
- boolean currentThread = false;
- try {
- Thread t = null;
- synchronized (lock) {
- t = threadMap.get(host);
- }
- if (t != null && t.isAlive()) {
- currentThread = true;
- t.join(30);
- }
- } catch (Exception e) {
-
- }
-
- // check if cache is still ok
- boolean refreshedCache = false;
- try {
- // get network interfaces
- final Set<InetAddress> currentAddresses = new HashSet<InetAddress>();
- currentAddresses.add(InetAddress.getLocalHost());
- Enumeration<?> nis = NetworkInterface.getNetworkInterfaces();
- while (nis.hasMoreElements()) {
- NetworkInterface inter = (NetworkInterface)nis.nextElement();
- Enumeration<InetAddress> ias = inter.getInetAddresses();
- while (ias.hasMoreElements())
- currentAddresses.add(ias.nextElement());
- }
-
- // check if cache is empty or old and refill it if necessary
- if (addressCache == null || !addressCache.containsAll(currentAddresses)
- || !currentAddresses.containsAll(addressCache)) {
- CacheThread cacheThread = null;
- refreshedCache = true;
-
- synchronized (lock) {
- addressCache = currentAddresses;
- notLocalHostCache = new HashSet<String>();
- localHostCache = new HashSet<String>(currentAddresses.size() * 3);
-
- Iterator<InetAddress> iter = currentAddresses.iterator();
- while (iter.hasNext()) {
- InetAddress addr = iter.next();
- String a = addr.getHostAddress();
- if (a != null && !localHostCache.contains(a))
- localHostCache.add(a);
- }
-
- cacheThread = new CacheThread(host, currentAddresses, localHostCache, notLocalHostCache, threadMap);
- threadMap.put(host, cacheThread);
- cacheThread.setDaemon(true);
- cacheThread.setPriority(Thread.NORM_PRIORITY - 1);
- cacheThread.start();
- }
- cacheThread.join(200);
- }
- } catch (Exception e) {
- }
-
- synchronized (lock) {
- if (localHostCache.contains(host))
- return true;
- if (notLocalHostCache.contains(host))
- return false;
- }
-
- // if the cache hasn't been cleared, maybe we still need to lookup the
- // host
- if (!refreshedCache && !currentThread) {
- try {
- CacheThread cacheThread = null;
- synchronized (lock) {
- cacheThread = new CacheThread(host, null, localHostCache, notLocalHostCache, threadMap);
- threadMap.put(host, cacheThread);
- cacheThread.setDaemon(true);
- cacheThread.setPriority(Thread.NORM_PRIORITY - 1);
- cacheThread.start();
- }
- cacheThread.join(75);
-
- synchronized (lock) {
- if (localHostCache.contains(host))
- return true;
- }
- } catch (Exception e) {
- }
- }
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint b/branches/sca-java-1.5.1/modules/host-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint
deleted file mode 100644
index a72bed4ea8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.corba.CorbaHostExtensionPoint
+++ /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.host.corba.DefaultCorbaHostExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java b/branches/sca-java-1.5.1/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java
deleted file mode 100644
index 4e076f9342..0000000000
--- a/branches/sca-java-1.5.1/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.corba;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- * Tests for host utils
- */
-public class UtilsTestCase {
-
- private void assertDetailsAreOk(CorbanameURL details, String host, int port, String nameService, List<String> namePath) {
- assertTrue(details.getHost().equals(host));
- assertTrue(details.getNameService().equals(nameService));
- assertTrue(details.getPort() == port);
- assertTrue(details.getNamePath().size() == namePath.size());
- for (int i = 0; i < namePath.size(); i++) {
- assertTrue(details.getNamePath().get(i).equals(namePath.get(i)));
- }
- }
-
- /**
- * Tests if corbaname url is beeing processes properly
- */
- @Test
- public void test_validCorbaname() {
- String testUri = null;
- CorbanameURL details = null;
- List<String> namePath = null;
-
- testUri = "corbaname:ignore:host:1234/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, "host", 1234, "Service", namePath);
-
- testUri = "corbaname:ignore:host:/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, "host", CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname:ignore:host/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, "host", CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname:ignore:/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname:ignore/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname:/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname/Service#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath);
-
- testUri = "corbaname#Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, CorbanameURL.DEFAULT_NAME_SERVICE, namePath);
-
- testUri = "corbaname#Parent/Mid/Reference";
- details = CorbaHostUtils.getServiceDetails(testUri);
- namePath = new ArrayList<String>();
- namePath.add("Parent");
- namePath.add("Mid");
- namePath.add("Reference");
- assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, CorbanameURL.DEFAULT_NAME_SERVICE, namePath);
- }
-
- /**
- * Test for invalid corbaname url
- */
- @Test
- public void test_invalidCorbaname() {
- String testUri = null;
-
- try {
- testUri = "this.string.should.not.appear.in.the.beggining:ignore:host:1234/Service#Reference";
- CorbaHostUtils.getServiceDetails(testUri);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof IllegalArgumentException);
- }
-
- try {
- testUri = "corbaname:ignore:host:1234/Service#";
- CorbaHostUtils.getServiceDetails(testUri);
- fail();
- } catch (Exception e) {
- assertTrue(e instanceof IllegalArgumentException);
- }
- }
-
- /**
- * Test for creating corbaname url from host, port, name parameters
- */
- @Test
- public void test_creatingCorbanameURI() {
- String uri = CorbaHostUtils.createCorbanameURI("SomeHost", 1000, "SomeName");
- assertEquals("corbaname::SomeHost:1000/NameService#SomeName", uri);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/LICENSE b/branches/sca-java-1.5.1/modules/host-embedded/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/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-java-1.5.1/modules/host-embedded/NOTICE b/branches/sca-java-1.5.1/modules/host-embedded/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/pom.xml b/branches/sca-java-1.5.1/modules/host-embedded/pom.xml
deleted file mode 100644
index 7660c41298..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/pom.xml
+++ /dev/null
@@ -1,138 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-embedded</artifactId>
- <name>Apache Tuscany SCA Embedded Host</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-endpoint</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.embedded</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.embedded*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
deleted file mode 100644
index bb8b8ad0e0..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomain.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * A handle to an SCA domain.
- *
- * @version $Rev$ $Date$
- */
-public abstract class SCADomain {
-
- static final String LOCAL_DOMAIN_URI = "http://localhost";
-
- /**
- * Static variable to hold the most recent instance of SCADomain
- */
- // TODO: Temporary support for SCADomain.connect() API
- protected static SCADomain theDomain;
-
-
- /**
- * Returns a new instance of a local SCA domain.
- *
- * @return
- */
- public static SCADomain newInstance() {
- return createNewInstance(LOCAL_DOMAIN_URI, null);
- }
-
- /**
- * Returns a new instance of a local SCA domain. The specified deployable
- * composite will be included in the SCA domain.
- *
- * @param composite the deployable composite to include in the SCA domain.
- * @return
- */
- public static SCADomain newInstance(String composite) {
- return createNewInstance(LOCAL_DOMAIN_URI, "/", composite);
- }
-
- /**
- * Returns a new instance of a local SCA domain. The specified deployable
- * composites will be included in the SCA domain.
- *
- * @param domainURI the URI of the SCA domain
- * @param contributionLocation the location of an SCA contribution
- * @param composites the deployable composites to include in the SCA domain.
- * @return
- */
- public static SCADomain newInstance(String domainURI, String contributionLocation, String... composites) {
- return createNewInstance(domainURI, contributionLocation, composites);
- }
-
- /**
- * Removes the specified local SCA Domain instance
- *
- * @param domainInstance the instance to be removed
- */
- // FIXME: Adding this as temporary support for the "connect" API
- public static void removeInstance(SCADomain domainInstance) {
- theDomain = null;
- }
-
- /**
- * Returns an SCADomain representing a remote SCA domain.
- *
- * @param domainURI the URI of the SCA domain
- * @return
- */
- // FIXME : this is a temporary implementation to get the capability working
- public static SCADomain connect(String domainURI) {
- return theDomain;
- }
-
- /**
- * Close the SCA domain.
- */
- public void close() {
- // TODO: temporary to support initial SCADomain.connect capability
- SCADomain.removeInstance(this);
- }
-
- /**
- * Returns the URI of the SCA Domain.
- *
- * @return the URI of the SCA Domain
- */
- public abstract String getURI();
-
- /**
- * Cast a type-safe reference to a CallableReference. Converts a type-safe
- * reference to an equivalent CallableReference; if the target refers to a
- * service then a ServiceReference will be returned, if the target refers to
- * a callback then a CallableReference will be returned.
- *
- * @param target a reference proxy provided by the SCA runtime
- * @param <B> the Java type of the business interface for the reference
- * @param <R> the type of reference to be returned
- * @return a CallableReference equivalent for the proxy
- * @throws IllegalArgumentException if the supplied instance is not a
- * reference supplied by the SCA runtime
- */
- public abstract <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
-
- /**
- * Returns a proxy for a service provided by a component in the SCA domain.
- *
- * @param businessInterface the interface that will be used to invoke the
- * service
- * @param serviceName the name of the service
- * @param <B> the Java type of the business interface for the service
- * @return an object that implements the business interface
- */
- public abstract <B> B getService(Class<B> businessInterface, String serviceName);
-
- /**
- * Returns a ServiceReference for a service provided by a component in the
- * SCA domain.
- *
- * @param businessInterface the interface that will be used to invoke the
- * service
- * @param serviceName the name of the service
- * @param <B> the Java type of the business interface for the service
- * @return a ServiceReference for the designated service
- */
- public abstract <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName);
-
- /**
- * Returns an SCADomain instance. If the system property
- * "org.apache.tuscany.sca.host.embedded.SCADomain" is set, its value is used as
- * the name of the implementation class. Otherwise, if the resource
- * "META-INF/services/org.apache.tuscany.sca.host.embedded.SCADomain" can be
- * loaded from the supplied ClassLoader. Otherwise, it will use
- * "org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain" as the default.
- * The named class is loaded from the supplied ClassLoader.
- *
- * @param classLoader
- * @param domainURI
- * @param contributionLocation
- * @param composites
- * @return
- */
- static SCADomain createNewInstance(String domainURI, String contributionLocation, String... composites) {
-
- SCADomain domain = null;
-
- try {
- // Determine the runtime and application ClassLoader
- final ClassLoader runtimeClassLoader = SCADomain.class.getClassLoader();
- final ClassLoader applicationClassLoader = Thread.currentThread().getContextClassLoader();
-
- Class<?> implClass = ServiceDiscovery.getInstance().loadFirstServiceClass(SCADomain.class);
-
- if (implClass == null) {
-
- // Create a default SCA domain implementation
- domain =
- new DefaultSCADomain(runtimeClassLoader, applicationClassLoader, domainURI, contributionLocation,
- composites);
- } else {
-
- // Create an instance of the discovered SCA domain implementation
- Constructor<?> constructor = null;
- try {
- constructor =
- implClass.getConstructor(ClassLoader.class,
- ClassLoader.class,
- String.class,
- String.class,
- String[].class);
- } catch (NoSuchMethodException e) {
- }
- if (constructor != null) {
- domain =
- (SCADomain)constructor.newInstance(runtimeClassLoader,
- applicationClassLoader,
- domainURI,
- contributionLocation,
- composites);
- } else {
-
- constructor = implClass.getConstructor(ClassLoader.class, String.class);
- domain = (SCADomain)constructor.newInstance(runtimeClassLoader, domainURI);
- }
- }
-
- // FIXME: temporary support for connect() API
- theDomain = domain;
-
- return domain;
-
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public ComponentManager getComponentManager() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java
deleted file mode 100644
index c9bfe499c6..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCADomainBean.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded;
-
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SCADomainBean extends SCADomain {
-
- private SCADomain instance;
-
- private String uri = LOCAL_DOMAIN_URI;
- private String location = "/";
- private String[] composites;
-
- /**
- * Constructs a new SCA domain
- */
- public SCADomainBean() {
- }
-
- @Override
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setContributionLocation(String contributionLocation) {
- this.location = contributionLocation;
- }
-
- public String getContributionLocation() {
- return location;
- }
-
- public void setDeployableComposite(String composite) {
- setDeployableComposites(composite);
- }
-
- public void setDeployableComposites(String... composites) {
- this.composites = composites;
- }
-
- public String[] getDeployableComposites() {
- return composites;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- if (instance == null) {
- instance = SCADomain.createNewInstance(uri, location, composites);
- }
- Object result = instance.cast(target);
- return (R) result;
- }
-
- @Override
- public void close() {
- if (instance == null) {
- instance = SCADomain.createNewInstance(uri, location, composites);
- }
- instance.close();
- instance = null;
- }
-
- @Override
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- if (instance == null) {
- instance = SCADomain.createNewInstance(uri, location, composites);
- }
- return instance.getService(businessInterface, serviceName);
- }
-
- @Override
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
- if (instance == null) {
- instance = SCADomain.createNewInstance(uri, location, composites);
- }
- return instance.getServiceReference(businessInterface, referenceName);
- }
-
- @Override
- protected void finalize() throws Throwable {
-
- // Make sure that the SCA domain is closed
- if (instance != null) {
- instance.close();
- instance = null;
- }
- }
-
- @Override
- public ComponentManager getComponentManager() {
- if (instance == null) {
- instance = SCADomain.createNewInstance(uri, location, composites);
- }
- return instance.getComponentManager();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
deleted file mode 100644
index 7c893a5c9e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/SCATestCaseRunner.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.embedded;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-/**
- * A helper class that can be used to run an SCA JUnit test case. The test case will run in an isolated class loader.
- *
- * @version $Rev$ $Date$
- */
-public class SCATestCaseRunner {
-
- private ClassLoader classLoader;
- private Class<?> testSuiteClass;
- private Object testSuite;
- private Class<?> testResultClass;
- private Class<?> testCaseClass;
- private Object testCase;
-
- private Class<?> beforeAnnotation;
- private Class<?> beforeClassAnnotation;
- private Class<?> afterAnnotation;
- private Class<?> afterClassAnnotation;
- private Class<?> junit4AdapterClass;
- private Class<?> junit3TestCaseClass;
-
- /**
- * Constructs a new TestCase runner.
- *
- * @param testClass
- */
- public SCATestCaseRunner(Class testClass) {
- try {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- classLoader = testClass.getClassLoader();
- if (classLoader instanceof URLClassLoader) {
- URL[] urls = ((URLClassLoader)classLoader).getURLs();
- classLoader = new URLClassLoader(urls, classLoader.getParent());
- } else if (classLoader == tccl || classLoader.getParent() == tccl) {
- classLoader = new URLClassLoader(new URL[0], classLoader);
- } else {
- classLoader = tccl;
- }
-
- try {
- // Thread.currentThread().setContextClassLoader(classLoader);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finalClassLoader = classLoader;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finalClassLoader);
- return null;
- }
- });
-
- testCaseClass = Class.forName(testClass.getName(), true, classLoader);
- testCase = testCaseClass.newInstance();
- ClassLoader testClassLoader = testCaseClass.getClassLoader();
-
- junit3TestCaseClass = Class.forName("junit.framework.TestCase", true, testClassLoader);
-
- testSuiteClass = Class.forName("junit.framework.TestSuite", true, testClassLoader);
- Constructor testSuiteConstructor = testSuiteClass.getConstructor(Class.class);
- testSuite = testSuiteConstructor.newInstance(testCaseClass);
-
- testResultClass = Class.forName("junit.framework.TestResult", true, testClassLoader);
-
- try {
- beforeAnnotation = Class.forName("org.junit.Before", true, testClassLoader);
- afterAnnotation = Class.forName("org.junit.After", true, testClassLoader);
- beforeClassAnnotation = Class.forName("org.junit.BeforeClass", true, testClassLoader);
- afterClassAnnotation = Class.forName("org.junit.AfterClass", true, testClassLoader);
- junit4AdapterClass = Class.forName("junit.framework.JUnit4TestAdapter", true, testClassLoader);
- } catch (Exception e) {
- // Unexpected
- throw new AssertionError(e);
- }
- } catch (Throwable e) {
- e.printStackTrace();
- } finally {
- // Thread.currentThread().setContextClassLoader(tccl);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finaltccl = tccl;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finaltccl);
- return null;
- }
- });
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Run the test case
- */
- public void run() {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- // Thread.currentThread().setContextClassLoader(classLoader);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finalClassLoader = classLoader;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finalClassLoader);
- return null;
- }
- });
-
- if (junit3TestCaseClass.isAssignableFrom(testCaseClass)) {
- Object testResult = testResultClass.newInstance();
- Method runMethod = testSuiteClass.getMethod("run", testResultClass);
- runMethod.invoke(testSuite, testResult);
- } else {
- Object junit4Adapter = junit4AdapterClass.getConstructor(Class.class).newInstance(testCaseClass);
- Object testResult = testResultClass.newInstance();
- Method runMethod = junit4AdapterClass.getMethod("run", testResultClass);
- runMethod.invoke(junit4Adapter, testResult);
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- // Thread.currentThread().setContextClassLoader(tccl);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finaltccl = tccl;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finaltccl);
- return null;
- }
- });
- }
- }
-
- /**
- * Invoke the setUp method
- */
- public void setUp() {
- execute("setUp");
- }
-
- /**
- * Invoke the before methods
- */
- public void before() {
- execute(beforeAnnotation);
- }
-
- /**
- * Invoke the beforeClass methods
- */
- public void beforeClass() {
- execute(beforeClassAnnotation);
- }
-
- /**
- * Invoke the tearDown method
- */
- public void tearDown() {
- execute("tearDown");
- }
-
- /**
- * Invoke the after methods
- */
- public void after() {
- execute(afterAnnotation);
- }
-
- /**
- * Invoke the afterClass methods
- */
- public void afterClass() {
- execute(afterClassAnnotation);
- }
-
- /**
- * Invoke the specified test method.
- */
- public void run(String methodName) {
- execute(methodName);
- }
-
- /**
- * Invoke the methods annotated with the specified annotation.
- */
- private void execute(Class<?> annotationClass) {
- if (annotationClass == null) {
- throw new RuntimeException(new NoSuchMethodException());
- }
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- // Thread.currentThread().setContextClassLoader(classLoader);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finalClassLoader = classLoader;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finalClassLoader);
- return null;
- }
- });
-
- for (Method method : testCaseClass.getDeclaredMethods()) {
- for (Annotation annotation : method.getAnnotations()) {
- if (annotation.annotationType() == annotationClass) {
- method.invoke(testCase);
- }
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- // Thread.currentThread().setContextClassLoader(tccl);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finaltccl = tccl;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finaltccl);
- return null;
- }
- });
- }
- }
-
- /**
- * Invoke the specified method
- */
- private void execute(String methodName) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- // Thread.currentThread().setContextClassLoader(classLoader);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finalClassLoader = classLoader;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finalClassLoader);
- return null;
- }
- });
- Method setUpMethod = testCaseClass.getDeclaredMethod(methodName);
- setUpMethod.setAccessible(true);
- setUpMethod.invoke(testCase);
- } catch (Exception e) {
- throw new RuntimeException(e);
- } finally {
- // Thread.currentThread().setContextClassLoader(tccl);
- // Allow privileged access to set class loader. Requires RuntimePermission
- // setContextClassLoader in security policy.
- final ClassLoader finaltccl = tccl;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- Thread.currentThread().setContextClassLoader(finaltccl);
- return null;
- }
- });
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java
deleted file mode 100644
index 187f32f405..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ComponentManagerImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
-import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-
-/**
- * Implementation of the ComponentManager.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentManagerImpl implements ComponentManager {
-
- protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
- protected EmbeddedSCADomain domain;
-
- public ComponentManagerImpl(EmbeddedSCADomain domain) {
- this.domain = domain;
- }
-
- public void addComponentListener(ComponentListener listener) {
- this.listeners.add(listener);
- }
-
- public void removeComponentListener(ComponentListener listener) {
- this.listeners.remove(listener);
- }
-
- public Set<String> getComponentNames() {
- Set<String> names = new HashSet<String>();
- for (Composite composite: domain.getDomainComposite().getIncludes()) {
- for (Component component: composite.getComponents()) {
- names.add(component.getName());
- }
- }
- return names;
- }
-
- public Component getComponent(String componentName) {
- for (Composite composite: domain.getDomainComposite().getIncludes()) {
- for (Component component: composite.getComponents()) {
- if (component.getName().equals(componentName)) {
- return component;
- }
- }
- }
- return null;
- }
-
- public void startComponent(String componentName) throws ActivationException {
- Component component = getComponent(componentName);
- if (component == null) {
- throw new IllegalArgumentException("no component: " + componentName);
- }
- domain.getCompositeActivator().start(component);
- notifyComponentStarted(componentName);
- }
-
- public void stopComponent(String componentName) throws ActivationException {
- Component component = getComponent(componentName);
- if (component == null) {
- throw new IllegalArgumentException("no component: " + componentName);
- }
- domain.getCompositeActivator().stop(component);
- notifyComponentStopped(componentName);
- }
-
- public void notifyComponentStarted(String componentName) {
- for (ComponentListener listener : listeners) {
- try {
- listener.componentStarted(componentName);
- } catch (Exception e) {
- e.printStackTrace(); // TODO: log
- }
- }
- }
-
- public void notifyComponentStopped(String componentName) {
- for (ComponentListener listener : listeners) {
- try {
- listener.componentStopped(componentName);
- } catch (Exception e) {
- e.printStackTrace(); // TODO: log
- }
- }
- }
-
- public boolean isComponentStarted(String componentName) {
- RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
- return runtimeComponent.isStarted();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
deleted file mode 100644
index 9b02ee9fa2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomain.java
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import javax.xml.XMLConstants;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.RuntimeComponentImpl;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-import org.apache.tuscany.sca.node.impl.NodeImpl;
-import org.apache.tuscany.sca.node.impl.RuntimeBootStrapper;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- * A default SCA domain facade implementation.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultSCADomain extends SCADomain {
-
- private String uri;
- private String[] composites;
- // private Composite domainComposite;
- // private List<Contribution> contributions;
- private Map<String, Component> components;
- private ComponentManager componentManager;
- // private ClassLoader runtimeClassLoader;
- private ClassLoader applicationClassLoader;
- private String domainURI;
- private List<String> contributionURLs;
-
- private CompositeActivator compositeActivator;
- private SCANode node;
- private SCAClient client;
-
- /**
- * Constructs a new domain facade.
- *
- * @param domainURI
- * @param contributionLocation
- * @param composites
- */
- public DefaultSCADomain(ClassLoader runtimeClassLoader,
- ClassLoader applicationClassLoader,
- String domainURI,
- String contributionLocation,
- String... composites) {
- this.uri = domainURI;
- this.composites = composites;
- // this.runtimeClassLoader = runtimeClassLoader;
- this.applicationClassLoader = applicationClassLoader;
- this.domainURI = domainURI;
- this.contributionURLs = new ArrayList<String>();
- if (contributionLocation != null && !"/".equals(contributionLocation)) {
- this.contributionURLs.add(contributionLocation);
- }
- this.composites = composites;
-
- init();
-
- this.componentManager = new DefaultSCADomainComponentManager(this);
-
- }
-
- /**
- * A hack to create an aggregated composite
- * @param classLoader
- * @param composites
- * @return
- */
- private String createDeploymentComposite(ClassLoader classLoader, String composites[]) {
- try {
- StringBuffer xml =
- new StringBuffer("<sca:composite xmlns:sca=\"http://www.osoa.org/xmlns/sca/1.0\"")
- .append(" targetNamespace=\"http://tuscany.apache.org/xmlns/sca/1.0\" name=\"aggregated\">\n");
- XMLInputFactory factory = XMLInputFactory.newInstance();
- for (int i = 0; i < composites.length; i++) {
- URL url = classLoader.getResource(composites[i]);
- if (url == null) {
- continue;
- }
- String location = NodeImpl.getContributionURL(url, composites[i]).toString();
- if (!contributionURLs.contains(location)) {
- contributionURLs.add(location);
- }
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- XMLStreamReader reader = factory.createXMLStreamReader(connection.getInputStream());
- reader.nextTag();
-
- assert Constants.COMPOSITE_QNAME.equals(reader.getName());
- String ns = reader.getAttributeValue(null, "targetNamespace");
- if (ns == null) {
- ns = XMLConstants.NULL_NS_URI;
- }
- String name = reader.getAttributeValue(null, "name");
- reader.close();
- if (XMLConstants.NULL_NS_URI.equals(ns)) {
- xml.append("<sca:include name=\"").append(name).append("\"/>\n");
- } else {
- xml.append("<sca:include xmlns:ns").append(i).append("=\"").append(ns).append("\"");
- xml.append(" name=\"").append("ns").append(i).append(":").append(name).append("\"/>\n");
- }
- }
- xml.append("</sca:composite>");
- // System.out.println(xml.toString());
- return xml.toString();
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public void init() {
- SCANodeFactory factory = SCANodeFactory.newInstance();
-
- List<SCAContribution> contributions = new ArrayList<SCAContribution>();
-
- if (composites != null && composites.length > 1) {
- // Create an aggregated composite that includes all the composites as Node API only takes one composite
- String content = createDeploymentComposite(applicationClassLoader, composites);
- // Create SCA contributions
- for (String location : contributionURLs) {
- contributions.add(new SCAContribution(location, location));
- }
- node =
- factory.createSCANode("http://tuscany.apache.org/xmlns/sca/1.0/aggregated", content, contributions
- .toArray(new SCAContribution[contributions.size()]));
- } else {
- for (String location : contributionURLs) {
- contributions.add(new SCAContribution(location, location));
- }
- String composite = (composites != null && composites.length >= 1) ? composites[0] : null;
- if (!contributions.isEmpty()) {
- node =
- factory.createSCANode(composite, contributions.toArray(new SCAContribution[contributions.size()]));
- } else {
- node = factory.createSCANodeFromClassLoader(composite, applicationClassLoader);
- }
- }
- client = (SCAClient)node;
- compositeActivator = ((NodeImpl)node).getCompositeActivator();
- components = new HashMap<String, Component>();
-
- setDefaultPort();
-
- node.start();
-
- getComponents(compositeActivator.getDomainComposite());
- }
-
- private void setDefaultPort() {
- URI uri = URI.create(domainURI);
- if (uri.getPort() > -1) {
- RuntimeBootStrapper rt = ((NodeImpl)node).getRuntime();
- ServletHostExtensionPoint sh = rt.getExtensionPointRegistry().getExtensionPoint(ServletHostExtensionPoint.class);
- if (sh != null && sh.getServletHosts() != null && !sh.getServletHosts().isEmpty()) {
- sh.getServletHosts().get(0).setDefaultPort(uri.getPort());
- }
- }
- }
-
- private void getComponents(Composite composite) {
- for (Component c : composite.getComponents()) {
- components.put(c.getName(), c);
- }
- for (Composite cp : composite.getIncludes()) {
- getComponents(cp);
- }
- }
-
- @Override
- public void close() {
- super.close();
- node.stop();
- node = null;
- client = null;
- components.clear();
- compositeActivator = null;
- applicationClassLoader = null;
- componentManager = null;
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- return (R)client.cast(target);
- }
-
- @Override
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- return client.getService(businessInterface, serviceName);
- }
-
- @Override
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
- return client.getServiceReference(businessInterface, name);
- }
-
- @Override
- public String getURI() {
- return uri;
- }
-
- @Override
- public ComponentManager getComponentManager() {
- return componentManager;
- }
-
- public Set<String> getComponentNames() {
- return components.keySet();
- /*
- Set<String> componentNames = new HashSet<String>();
- for (Contribution contribution : contributions) {
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof Composite) {
- for (Component component : ((Composite)artifact.getModel()).getComponents()) {
- componentNames.add(component.getName());
- }
- }
- }
- }
- return componentNames;
- */
- }
-
- public Component getComponent(String componentName) {
- return components.get(componentName);
- /*
- for (Contribution contribution : contributions) {
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof Composite) {
- for (Component component : ((Composite)artifact.getModel()).getComponents()) {
- if (component.getName().equals(componentName)) {
- return component;
- }
- }
- }
- }
- }
- return null;
- */
- }
-
- public void startComponent(String componentName) throws ActivationException {
- Component component = getComponent(componentName);
- if (component == null) {
- throw new IllegalArgumentException("no component: " + componentName);
- }
- compositeActivator.start(component);
- }
-
- public void stopComponent(String componentName) throws ActivationException {
- Component component = getComponent(componentName);
- if (component == null) {
- throw new IllegalArgumentException("no component: " + componentName);
- }
- compositeActivator.stop(component);
- }
-}
-
-class DefaultSCADomainComponentManager implements ComponentManager {
-
- protected DefaultSCADomain scaDomain;
- protected List<ComponentListener> listeners = new CopyOnWriteArrayList<ComponentListener>();
-
- public DefaultSCADomainComponentManager(DefaultSCADomain scaDomain) {
- this.scaDomain = scaDomain;
- }
-
- public void addComponentListener(ComponentListener listener) {
- this.listeners.add(listener);
- }
-
- public void removeComponentListener(ComponentListener listener) {
- this.listeners.remove(listener);
- }
-
- public Set<String> getComponentNames() {
- return scaDomain.getComponentNames();
- }
-
- public Component getComponent(String componentName) {
- return scaDomain.getComponent(componentName);
- }
-
- public void startComponent(String componentName) throws ActivationException {
- scaDomain.startComponent(componentName);
- }
-
- public void stopComponent(String componentName) throws ActivationException {
- scaDomain.stopComponent(componentName);
- }
-
- public void notifyComponentStarted(String componentName) {
- for (ComponentListener listener : listeners) {
- try {
- listener.componentStarted(componentName);
- } catch (Exception e) {
- e.printStackTrace(); // TODO: log
- }
- }
- }
-
- public void notifyComponentStopped(String componentName) {
- for (ComponentListener listener : listeners) {
- try {
- listener.componentStopped(componentName);
- } catch (Exception e) {
- e.printStackTrace(); // TODO: log
- }
- }
- }
-
- public boolean isComponentStarted(String componentName) {
- RuntimeComponentImpl runtimeComponent = (RuntimeComponentImpl)getComponent(componentName);
- return runtimeComponent.isStarted();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
deleted file mode 100644
index 519e76d0ae..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomain.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.context.ServiceReferenceImpl;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.node.impl.RuntimeBootStrapper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * An SCA domain facade implementation.
- *
- * @version $Rev$ $Date$
- */
-public class EmbeddedSCADomain extends SCADomain {
-
- private String uri;
- private Composite domainComposite;
- private RuntimeBootStrapper runtime;
- private ComponentManagerImpl componentManager = new ComponentManagerImpl(this);
-
- /**
- * Constructs a new domain facade.
- *
- * @param runtimeClassLoader
- * @param domainURI
- */
- public EmbeddedSCADomain(ClassLoader runtimeClassLoader,
- String domainURI) {
- this.uri = domainURI;
-
- // Create a runtime
- runtime = new RuntimeBootStrapper(runtimeClassLoader);
- }
-
- public void start() throws ActivationException {
-
- // Start the runtime
- runtime.start();
-
- // Create an in-memory domain level composite
- AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
- domainComposite = assemblyFactory.createComposite();
- domainComposite.setName(new QName(Constants.SCA10_NS, "domain"));
- domainComposite.setURI(uri);
-
- getCompositeActivator().setDomainComposite(domainComposite);
-
- }
-
- public void stop() throws ActivationException {
-
- // Stop the runtime
- runtime.stop();
-
- // Cleanup
- domainComposite = null;
- }
-
- public void buildComposite(Composite composite) throws CompositeBuilderException {
- runtime.buildComposite(composite);
- }
-
- public ContributionService getContributionService() {
- return runtime.getContributionService();
- }
-
- public CompositeBuilder getCompositeBuilder() {
- return runtime.getCompositeBuilder();
- }
-
- public CompositeActivator getCompositeActivator() {
- return runtime.getCompositeActivator();
- }
-
- public Composite getDomainComposite() {
- return domainComposite;
- }
-
- @Override
- public ComponentManager getComponentManager() {
- return componentManager;
- }
-
- @Override
- public void close() {
- super.close();
- }
-
- @Override
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- return (R)runtime.getProxyFactory().cast(target);
- }
-
- @Override
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
- if (serviceReference == null) {
- throw new ServiceRuntimeException("Service not found: " + serviceName);
- }
- return serviceReference.getService();
- }
-
- private <B> ServiceReference<B> createServiceReference(Class<B> businessInterface, String targetURI) {
- try {
- AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
- Composite composite = assemblyFactory.createComposite();
- composite.setName(new QName(Constants.SCA10_TUSCANY_NS, "default"));
- RuntimeComponent component = (RuntimeComponent)assemblyFactory.createComponent();
- component.setName("default");
- component.setURI("default");
- runtime.getCompositeActivator().configureComponentContext(component);
- composite.getComponents().add(component);
- RuntimeComponentReference reference = (RuntimeComponentReference)assemblyFactory.createComponentReference();
- reference.setName("default");
- ModelFactoryExtensionPoint factories =
- runtime.getExtensionPointRegistry().getExtensionPoint(ModelFactoryExtensionPoint.class);
- JavaInterfaceFactory javaInterfaceFactory = factories.getFactory(JavaInterfaceFactory.class);
- InterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterfaceFactory.createJavaInterface(businessInterface));
- reference.setInterfaceContract(interfaceContract);
- component.getReferences().add(reference);
- reference.setComponent(component);
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- SCABinding binding = scaBindingFactory.createSCABinding();
- binding.setURI(targetURI);
- reference.getBindings().add(binding);
- return new ServiceReferenceImpl<B>(businessInterface, component, reference, binding, runtime
- .getProxyFactory(), runtime.getCompositeActivator());
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
- @Override
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
-
- // Extract the component name
- String componentName;
- String serviceName;
- int i = name.indexOf('/');
- if (i != -1) {
- componentName = name.substring(0, i);
- serviceName = name.substring(i + 1);
-
- } else {
- componentName = name;
- serviceName = null;
- }
-
- // Lookup the component in the domain
- Component component = componentManager.getComponent(componentName);
- if (component == null) {
- // The component is not local in the partition, try to create a remote service ref
- return createServiceReference(businessInterface, name);
- }
- RuntimeComponentContext componentContext = null;
-
- // If the component is a composite, then we need to find the
- // non-composite component that provides the requested service
- if (component.getImplementation() instanceof Composite) {
- for (ComponentService componentService : component.getServices()) {
- if (serviceName == null || serviceName.equals(componentService.getName())) {
- CompositeService compositeService = (CompositeService)componentService.getService();
- if (compositeService != null) {
- if (serviceName != null) {
- serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName;
- }
- componentContext =
- ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
- return componentContext.createSelfReference(businessInterface, compositeService
- .getPromotedService());
- }
- break;
- }
- }
- // No matching service is found
- throw new ServiceRuntimeException("Composite service not found: " + name);
- } else {
- componentContext = ((RuntimeComponent)component).getComponentContext();
- if (serviceName != null) {
- return componentContext.createSelfReference(businessInterface, serviceName);
- } else {
- return componentContext.createSelfReference(businessInterface);
- }
- }
-
- }
-
- @Override
- public String getURI() {
- return uri;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
deleted file mode 100644
index d59f1544e5..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/HotUpdatableSCADomain.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * An SCADomain that starts a Tuscany runtime supporting multiple
- * SCA contribution jars. All contribution jars found in a repository
- * directory will be contributed to the SCA domain. Any changes to the
- * contributions in that repository will be automatically detected and
- * the SCADomain updated accordingly.
- *
- * TODO: find how to properly add/remove contributions and start/activate the SCADomain
- * TODO: support contributions that are folders as well as jar's
- * TODO: needs to restart the entire SCADomain when a contribution changes
- * as the domain classpath includes all the contribution jar's, would
- * be nice to find a way to avoid this
- * TODO: hot update requires copying contribution jars to a temp location
- * to avoid the classpath lock preventing updating the contribution
- * jars, would be nice to find a way to avoid that
- *
- * @version $Rev$ $Date$
- */
-public class HotUpdatableSCADomain extends SCADomain {
- private static final Logger logger = Logger.getLogger(HotUpdatableSCADomain.class.getName());
- protected String domainURI;
- protected File contributionRepository;
-
- protected EmbeddedSCADomain scaDomain;
-
- protected boolean hotUpdateActive;
- protected Thread hotUpdateThread;
- protected int hotUpdateInterval; // milliseconds, 0 = hotupdate disabled
-
- protected HashMap<URL, Long> existingContributions; // value is last modified time
- protected ClassLoader originalCCL;
-
- protected static final String REPOSITORY_FOLDER = "sca-contributions";
-
- public HotUpdatableSCADomain(String domainURI, File contributionRepository, int hotupdateInterval) {
- this.domainURI = domainURI;
- this.contributionRepository = contributionRepository;
- this.hotUpdateInterval = hotupdateInterval;
- this.originalCCL = Thread.currentThread().getContextClassLoader();
- start();
- }
-
- protected void start() {
- try {
- initEmbeddedSCADomain();
- activateHotUpdate();
- for (URL url : existingContributions.keySet()) {
- File f = new File(url.toURI());
- logger.info("added contribution: " + f.getName());
- }
- } catch (ActivationException e) {
- throw new ServiceRuntimeException(e);
- } catch (URISyntaxException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- @Override
- public void close() {
- try {
- hotUpdateActive = false;
- scaDomain.stop();
- } catch (ActivationException e) {
- throw new ServiceRuntimeException(e);
- }
- Thread.currentThread().setContextClassLoader(originalCCL);
- super.close();
- }
-
-
- protected SCADomain initEmbeddedSCADomain() throws ActivationException {
-
- URL[] contributionJars = getContributionJarURLs(contributionRepository);
-
- this.existingContributions = getLastModified(contributionJars);
-
- if (hotUpdateInterval > 0) {
- contributionJars = copyContributionsToTemp(contributionJars);
- }
-
- // Using the CCL as the parent exposes Tuscany to the contributions, want to do this?
- URLClassLoader cl = new URLClassLoader(contributionJars, originalCCL);
- Thread.currentThread().setContextClassLoader(cl);
-
- scaDomain = new EmbeddedSCADomain(cl, domainURI);
-
- scaDomain.start();
-
- initContributions(scaDomain, cl, contributionJars);
-
- return scaDomain;
- }
-
- protected URL[] getContributionJarURLs(File repositoryDir) {
-
- String[] jars = repositoryDir.list(new FilenameFilter() {
- public boolean accept(File dir, String name) {
- return name.endsWith(".jar");
- }});
-
- List<URL> contributionJars = new ArrayList<URL>();
- if (jars != null) {
- for (String jar : jars) {
- try {
- contributionJars.add(new File(repositoryDir, jar).toURL());
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- return contributionJars.toArray(new URL[contributionJars.size()]);
- }
-
- /**
- * TODO: No idea what the 'correct' way to add/contribute and activate/start things to an scaDomain is
- * but this seems to work. Doesn't seem to start <service>s or <reference>s which are outside of
- * a <component> so something is missing/wrong. Also this doesn't seem to be picking up composites
- * located in META-INF/deployables or specified in the sca-deployables.xml. Maybe the EmbeddedSCADomain
- * and ContributionService APIs should make all this easier?
- */
- protected void initContributions(EmbeddedSCADomain scaDomain, ClassLoader cl, URL[] contributionJars) {
- Contribution contribution = null;
- ContributionService contributionService = scaDomain.getContributionService();
- for (URL jar : contributionJars) {
- InputStream is = null;
- try {
- is = jar.openStream();
- contribution = contributionService.contribute(jar.toString(), jar, is);
- } catch (Exception e) {
- System.err.println("exception adding contribution: " + jar);
- e.printStackTrace();
- }
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- // ignore
- }
- }
- }
-
- if (contribution != null ) {
- try {
-
- for (Composite composite : contribution.getDeployables()) {
- scaDomain.getDomainComposite().getIncludes().add(composite);
- scaDomain.getCompositeBuilder().build(composite);
- scaDomain.getCompositeActivator().activate(composite);
- }
-
- for (Composite composite : contribution.getDeployables()) {
- scaDomain.getCompositeActivator().start(composite);
- }
-
- } catch (ActivationException e) {
- throw new RuntimeException(e);
- } catch (CompositeBuilderException e) {
- throw new RuntimeException(e);
- }
- }
-
- }
-
- /**
- * Copies Files to a temp location returning the URLs of the new temp files.
- * For hot update to work need to be able to delete/update the contribution jar's
- * but as they're in the classpath the URLClassLoader has an open lock on the jar's
- * so you can't update them. This solution copies each contribution to a temp
- * location for use on the classpath, nicer would be a ClassLoder impl that doesn't
- * lock the jar's.
- */
- protected URL[] copyContributionsToTemp(URL[] contributionJars) {
- try {
-
- URL[] newURLs = new URL[contributionJars.length];
- File tempDir = new File(System.getProperty("java.io.tmpdir"));
- for (int i=0; i<contributionJars.length; i++) {
- File fin = new File(contributionJars[i].toURI());
- File fout = File.createTempFile("tuscany", fin.getName(), tempDir);
- fout.deleteOnExit();
- FileHelper.copyFile(fin, fout);
- fout.setLastModified(System.currentTimeMillis());
- newURLs[i] = fout.toURL();
- }
- return newURLs;
-
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Returns the last modified times of the files pointed to by the URLs
- */
- protected HashMap<URL, Long> getLastModified(URL[] contrabutions) {
- try {
-
- HashMap<URL, Long> contributionLastUpdates = new HashMap<URL, Long>();
- for (URL url: contrabutions) {
- File f = new File(url.toURI());
- contributionLastUpdates.put(url, new Long(f.lastModified()));
- }
- return contributionLastUpdates;
-
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- }
- }
-
- protected void activateHotUpdate() {
- if (hotUpdateInterval == 0) {
- return; // hotUpdateInterval of 0 disables hotupdate
- }
-
- Runnable runable = new Runnable() {
- public void run() {
- logger.info("Tuscany contribution hotupdate running");
- while (hotUpdateActive) {
- try {
- Thread.sleep(hotUpdateInterval);
- } catch (InterruptedException e) {
- }
- if (hotUpdateActive) {
- checkForUpdates();
- }
- }
- logger.info("Tuscany contribution hotupdate stopped");
- }
- };
- hotUpdateThread = new Thread(runable, "TuscanyHotUpdate");
- hotUpdateActive = true;
- hotUpdateThread.start();
- }
-
-
- /**
- * Checks if any of the contributions have been updated and if so restarts the SCADomain
- * TODO: Ideally just the altered contribution would be restarted but thats not possible
- * as the ClassLoader used by the SCADomain includes the old contribution so need
- * to restart the entire domain to use a new ClassLoader. Should there be separate
- * ClassLoader per contribution? But then have all the issues with sharing classes
- * across contributions.
- */
- protected void checkForUpdates() {
- URL[] currentContributions = getContributionJarURLs(contributionRepository);
-
- if (areContributionsAltered(currentContributions)) {
- try {
- scaDomain.stop();
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- initEmbeddedSCADomain();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
- protected boolean areContributionsAltered(URL[] currentContrabutions) {
- try {
-
- List addedContributions = getAddedContributions(currentContrabutions);
- List removedContributions = getRemovedContributions(currentContrabutions);
- List updatedContributions = getUpdatedContributions(currentContrabutions);
-
- return (addedContributions.size() > 0 || removedContributions.size() > 0 || updatedContributions.size() > 0);
-
- } catch (URISyntaxException e) {
- throw new RuntimeException(e);
- }
- }
-
- protected List<URL> getUpdatedContributions(URL[] currentContrabutions) throws URISyntaxException {
- List<URL> urls = new ArrayList<URL>();
- for (URL url : currentContrabutions) {
- if (existingContributions.containsKey(url)) {
- File curentFile = new File(url.toURI());
- if (curentFile.lastModified() != existingContributions.get(url)) {
- urls.add(url);
- logger.info("updated contribution: " + curentFile.getName());
- }
- }
- }
- return urls;
- }
-
- protected List getRemovedContributions(URL[] currentContrabutions) throws URISyntaxException {
- List<URL> currentUrls = Arrays.asList(currentContrabutions);
- List<URL> urls = new ArrayList<URL>();
- for (URL url : existingContributions.keySet()) {
- if (!currentUrls.contains(url)) {
- urls.add(url);
- }
- }
- for (URL url : urls) {
- logger.info("removed contributions: " + new File(url.toURI()).getName());
- }
- return urls;
- }
-
- protected List getAddedContributions(URL[] currentContrabutions) throws URISyntaxException {
- List<URL> urls = new ArrayList<URL>();
- for (URL url : currentContrabutions) {
- if (!existingContributions.containsKey(url)) {
- urls.add(url);
- logger.info("added contribution: " + new File(url.toURI()).getName());
- }
- }
- return urls;
- }
-
- @Override
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- throw new UnsupportedOperationException("not implemented");
- }
-
- @Override
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- return scaDomain.getService(businessInterface, serviceName);
- }
-
- @Override
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
- return scaDomain.getServiceReference(businessInterface, referenceName);
- }
-
- @Override
- public String getURI() {
- return domainURI;
- }
-
- @Override
- public ComponentManager getComponentManager(){
- return scaDomain.getComponentManager();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
deleted file mode 100644
index 34a54e21ad..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class ReallySmallRuntime {
- private static final Logger logger = Logger.getLogger(ReallySmallRuntime.class.getName());
- private List<ModuleActivator> modules;
- private ExtensionPointRegistry registry;
-
- private ClassLoader classLoader;
- private AssemblyFactory assemblyFactory;
- private ContributionService contributionService;
- private CompositeActivator compositeActivator;
- private CompositeBuilder compositeBuilder;
- // private DomainBuilder domainBuilder;
- private WorkScheduler workScheduler;
- private ScopeRegistry scopeRegistry;
- private ProxyFactory proxyFactory;
- private List<SCADefinitions> policyDefinitions;
- private ModelResolver policyDefinitionsResolver;
- private Monitor monitor;
-
- public ReallySmallRuntime(ClassLoader classLoader) {
- this.classLoader = classLoader;
-
- // Create our extension point registry
- registry = new DefaultExtensionPointRegistry();
- }
-
- public void start() throws ActivationException {
- long start = System.currentTimeMillis();
-
-
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
-
- // Get work scheduler
- workScheduler = utilities.getUtility(WorkScheduler.class);
-
- // Create an interface contract mapper
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- // Get factory extension point
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Get Message factory
- MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
-
- // Get proxy factory
- ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- proxyFactory = new ExtensibleProxyFactory(proxyFactories);
-
- // Create model factories
- assemblyFactory = new RuntimeAssemblyFactory();
- factories.addFactory(assemblyFactory);
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- factories.addFactory(policyFactory);
-
- // Load the runtime modules
- modules = loadModules(registry);
-
- // Start the runtime modules
- startModules(registry, modules);
-
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
- factories.addFactory(intentAttachPointTypeFactory);
- ContributionFactory contributionFactory = factories.getFactory(ContributionFactory.class);
-
- // Create a monitor
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
-
- if (monitorFactory != null){
- monitor = monitorFactory.createMonitor();
- } else {
- monitorFactory = new DefaultMonitorFactoryImpl();
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- //logger.fine("No MonitorFactory is found on the classpath.");
- }
-
- // Create a contribution service
- policyDefinitions = new ArrayList<SCADefinitions>();
- policyDefinitionsResolver = new DefaultModelResolver();
- contributionService = ReallySmallRuntimeBuilder.createContributionService(classLoader,
- registry,
- contributionFactory,
- assemblyFactory,
- policyFactory,
- mapper,
- policyDefinitions,
- policyDefinitionsResolver,
- monitor);
-
- // Create the ScopeRegistry
- scopeRegistry = ReallySmallRuntimeBuilder.createScopeRegistry(registry);
-
- // Create a composite activator
- compositeActivator = ReallySmallRuntimeBuilder.createCompositeActivator(registry,
- assemblyFactory,
- messageFactory,
- scaBindingFactory,
- mapper,
- proxyFactory,
- scopeRegistry,
- workScheduler);
-
- // Load the definitions.xml
- loadSCADefinitions();
-
- if (logger.isLoggable(Level.FINE)) {
- long end = System.currentTimeMillis();
- logger.fine("The tuscany runtime is started in " + (end - start) + " ms.");
- }
- }
-
- public void stop() throws ActivationException {
- long start = System.currentTimeMillis();
-
- // Stop the runtime modules
- stopModules(registry, modules);
-
- // Stop and destroy the work manager
- workScheduler.destroy();
-
- // Cleanup
- modules = null;
- registry = null;
- assemblyFactory = null;
- contributionService = null;
- compositeActivator = null;
- workScheduler = null;
- scopeRegistry = null;
-
- if (logger.isLoggable(Level.FINE)) {
- long end = System.currentTimeMillis();
- logger.fine("The tuscany runtime is stopped in " + (end - start) + " ms.");
- }
- }
-
- public void buildComposite(Composite composite) throws CompositeBuilderException {
- //Get factory extension point
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory intentAttachPointTypeFactory = factories.getFactory(IntentAttachPointTypeFactory.class);
- EndpointFactory endpointFactory = factories.getFactory(EndpointFactory.class);
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
- TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
-
- //Create a composite builder
- SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
- for ( SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions) ) {
- SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
- }
- compositeBuilder = ReallySmallRuntimeBuilder.createCompositeBuilder(monitor,
- assemblyFactory,
- scaBindingFactory,
- endpointFactory,
- intentAttachPointTypeFactory,
- documentBuilderFactory,
- transformerFactory,
- mapper,
- aggregatedDefinitions);
- compositeBuilder.build(composite);
-
- }
-
- public ContributionService getContributionService() {
- return contributionService;
- }
-
- public CompositeActivator getCompositeActivator() {
- return compositeActivator;
- }
-
- public CompositeBuilder getCompositeBuilder() {
- return compositeBuilder;
- }
-
- public AssemblyFactory getAssemblyFactory() {
- return assemblyFactory;
- }
-
- private void loadSCADefinitions() throws ActivationException {
- try {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<SCADefinitions> definitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
- SCADefinitionsProviderExtensionPoint scaDefnProviders = registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
-
- SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
- SCADefinitions aSCADefn = null;
- for ( SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders() ) {
- aSCADefn = aProvider.getSCADefinition();
- SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
- }
-
- policyDefinitions.add(systemSCADefinitions);
-
- //we cannot expect that providers will add the intents and policysets into the resolver
- //so we do this here explicitly
- for ( Intent intent : systemSCADefinitions.getPolicyIntents() ) {
- policyDefinitionsResolver.addModel(intent);
- }
-
- for ( PolicySet policySet : systemSCADefinitions.getPolicySets() ) {
- policyDefinitionsResolver.addModel(policySet);
- }
-
- for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes() ) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- for ( IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes() ) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- //now that all system sca definitions have been read, lets resolve them right away
- definitionsProcessor.resolve(systemSCADefinitions,
- policyDefinitionsResolver);
- } catch ( Exception e ) {
- throw new ActivationException(e);
- }
- }
-
- @SuppressWarnings("unchecked")
- private List<ModuleActivator> loadModules(ExtensionPointRegistry registry) throws ActivationException {
-
- // Load and instantiate the modules found on the classpath (or any registered ClassLoaders)
- modules = new ArrayList<ModuleActivator>();
- try {
- Set<ServiceDeclaration> moduleActivators =
- ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
- Set<String> moduleClasses = new HashSet<String>();
- for (ServiceDeclaration moduleDeclarator : moduleActivators) {
- if (moduleClasses.contains(moduleDeclarator.getClassName())) {
- continue;
- }
- moduleClasses.add(moduleDeclarator.getClassName());
- Class<?> moduleClass = moduleDeclarator.loadClass();
- ModuleActivator module = (ModuleActivator)moduleClass.newInstance();
- modules.add(module);
- }
- } catch (IOException e) {
- throw new ActivationException(e);
- } catch (ClassNotFoundException e) {
- throw new ActivationException(e);
- } catch (InstantiationException e) {
- throw new ActivationException(e);
- } catch (IllegalAccessException e) {
- throw new ActivationException(e);
- }
-
- return modules;
- }
-
- private void startModules(ExtensionPointRegistry registry, List<ModuleActivator> modules)
- throws ActivationException {
- boolean debug = logger.isLoggable(Level.FINE);
- // Start all the extension modules
- for (ModuleActivator module : modules) {
- long start = 0L;
- if (debug) {
- logger.fine(module.getClass().getName() + " is starting.");
- start = System.currentTimeMillis();
- }
- try {
- module.start(registry);
- if (debug) {
- long end = System.currentTimeMillis();
- logger.fine(module.getClass().getName() + " is started in " + (end - start) + " ms.");
- }
- } catch (Throwable e) {
- logger.log(Level.WARNING, "Exception starting module " + module.getClass().getName() + " :" + e.getMessage());
- logger.log(Level.FINE, "Exception starting module " + module.getClass().getName(), e);
- }
- }
- }
-
- private void stopModules(final ExtensionPointRegistry registry, List<ModuleActivator> modules) {
- boolean debug = logger.isLoggable(Level.FINE);
- for (ModuleActivator module : modules) {
- long start = 0L;
- if (debug) {
- logger.fine(module.getClass().getName() + " is stopping.");
- start = System.currentTimeMillis();
- }
- module.stop(registry);
- if (debug) {
- long end = System.currentTimeMillis();
- logger.fine(module.getClass().getName() + " is stopped in " + (end - start) + " ms.");
- }
- }
- }
-
- /**
- * @return the proxyFactory
- */
- public ProxyFactory getProxyFactory() {
- return proxyFactory;
- }
-
- /**
- * @return the registry
- */
- public ExtensionPointRegistry getExtensionPointRegistry() {
- return registry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
deleted file mode 100644
index 0f5aedfd75..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
-import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
-import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ConversationalScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
-import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class ReallySmallRuntimeBuilder {
-
- // private static final Logger logger = Logger.getLogger(ReallySmallRuntimeBuilder.class.getName());
-
- public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
- AssemblyFactory assemblyFactory,
- MessageFactory messageFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper mapper,
- ProxyFactory proxyFactory,
- ScopeRegistry scopeRegistry,
- WorkScheduler workScheduler) {
-
- // Create a wire post processor extension point
- RuntimeWireProcessorExtensionPoint wireProcessors =
- registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
- RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
-
- // Retrieve the processors extension point
- StAXArtifactProcessorExtensionPoint processors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- // Create a provider factory extension point
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- // Create a endpoint resolver factory extension point
- EndpointResolverFactoryExtensionPoint endpointResolverFactories =
- registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
-
- JavaInterfaceFactory javaInterfaceFactory =
- registry.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
- RequestContextFactory requestContextFactory =
- registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
-
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- ConversationManager conversationManager = utilities.getUtility(ConversationManager.class);
-
- // Create the composite activator
- CompositeActivator compositeActivator =
- new CompositeActivatorImpl(assemblyFactory, messageFactory, javaInterfaceFactory, scaBindingFactory,
- mapper, scopeRegistry, workScheduler, wireProcessor, requestContextFactory,
- proxyFactory, providerFactories, endpointResolverFactories, processors, conversationManager);
-
- return compositeActivator;
- }
-
- public static CompositeBuilder createCompositeBuilder(Monitor monitor,
- AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- EndpointFactory endpointFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions) {
-
-
- return new CompositeBuilderImpl(assemblyFactory,
- endpointFactory,
- scaBindingFactory,
- intentAttachPointTypeFactory,
- documentBuilderFactory,
- transformerFactory,
- interfaceContractMapper,
- policyDefinitions,
- monitor);
- }
-
-
- /**
- * Create the contribution service used by this domain.
- *
- * @throws ActivationException
- */
- public static ContributionService createContributionService(ClassLoader classLoader,
- ExtensionPointRegistry registry,
- ContributionFactory contributionFactory,
- AssemblyFactory assemblyFactory,
- PolicyFactory policyFactory,
- InterfaceContractMapper mapper,
- List<SCADefinitions> policyDefinitions,
- ModelResolver policyDefinitionResolver,
- Monitor monitor)
- throws ActivationException {
-
- // Get the model factory extension point
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Create a new XML input factory
- // Allow privileged access to factory. Requires RuntimePermission in security policy file.
- XMLInputFactory inputFactory = AccessController.doPrivileged(new PrivilegedAction<XMLInputFactory>() {
- public XMLInputFactory run() {
- return XMLInputFactory.newInstance();
- }
- });
- modelFactories.addFactory(inputFactory);
-
- // Create a validation XML schema extension point
- ValidationSchemaExtensionPoint schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
-
- // Create a validating XML input factory
- XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
- modelFactories.addFactory(validatingInputFactory);
-
- // Create StAX artifact processor extension point
- StAXArtifactProcessorExtensionPoint staxProcessors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- // Create and register StAX processors for SCA assembly XML
- // Allow privileged access to factory. Requires RuntimePermission in security policy file.
- XMLOutputFactory outputFactory = AccessController.doPrivileged(new PrivilegedAction<XMLOutputFactory>() {
- public XMLOutputFactory run() {
- return XMLOutputFactory.newInstance();
- }
- });
- ExtensibleStAXArtifactProcessor staxProcessor =
- new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- // Create URL artifact processor extension point
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-
- // Create and register document processors for SCA assembly XML
- documentProcessors.getProcessor(Composite.class);
- DocumentBuilderFactory documentBuilderFactory = AccessController.doPrivileged(new PrivilegedAction<DocumentBuilderFactory>() {
- public DocumentBuilderFactory run() {
- return DocumentBuilderFactory.newInstance();
- }
- });
- documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory, documentBuilderFactory, policyDefinitions, monitor));
-
- // Create Model Resolver extension point
- ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
-
- // Create contribution package processor extension point
- TypeDescriber describer = new PackageTypeDescriberImpl();
- PackageProcessor packageProcessor =
- new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer, monitor);
-
- // Create contribution listener
- ExtensibleContributionListener contributionListener =
- new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
-
- // Create a contribution repository
- ContributionRepository repository;
- try {
- repository = new ContributionRepositoryImpl("target", inputFactory, monitor);
- } catch (IOException e) {
- throw new ActivationException(e);
- }
-
- ExtensibleURLArtifactProcessor documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, monitor);
-
- // Create the contribution service
- ContributionService contributionService =
- new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
- contributionListener, policyDefinitionResolver, modelResolvers, modelFactories,
- assemblyFactory, contributionFactory, inputFactory, policyDefinitions, registry, monitor);
- return contributionService;
- }
-
- public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
- ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
- ScopeContainerFactory[] factories =
- new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
- new RequestScopeContainerFactory(),
- new ConversationalScopeContainerFactory(null),
- // new HttpSessionScopeContainer(monitor)
- };
- for (ScopeContainerFactory f : factories) {
- scopeRegistry.register(f);
- }
-
- //FIXME Pass the scope container differently as it's not an extension point
- registry.addExtensionPoint(scopeRegistry);
-
- return scopeRegistry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java
deleted file mode 100644
index 5f38c0c063..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentListener.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.management;
-
-import java.util.EventListener;
-
-/**
- * Component Listener interface.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentListener extends EventListener {
-
- void componentStarted(String componentName);
- void componentStopped(String componentName);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java b/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java
deleted file mode 100644
index 4acb270810..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/management/ComponentManager.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.management;
-
-import java.util.Set;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-
-/**
- * Component Manager interface.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentManager {
-
- Set<String> getComponentNames();
-
- Component getComponent(String componentName);
-
- boolean isComponentStarted(String componentName);
-
- void startComponent(String componentName) throws ActivationException;
-
- void stopComponent(String componentName) throws ActivationException;
-
- void addComponentListener(ComponentListener listener);
-
- void removeComponentListener(ComponentListener listener);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
deleted file mode 100644
index 9252b114a1..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-import org.osoa.sca.ServiceReference;
-
-
-
-/**
- * Test creation of an SCADomainBean and invocation of a service.
- *
- * @version $Rev$ $Date$
- */
-public class SCADomainBeanTestCase extends TestCase {
-
- private SCADomainBean domain;
-
- @Override
- protected void setUp() throws Exception {
- domain = new SCADomainBean();
- domain.setDeployableComposites("test.composite");
- }
-
- public void testInvoke() throws Exception {
- ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
- assertNotNull(serviceReference);
- TestService service = serviceReference.getService();
- String result = service.ping("Bob");
- assertEquals("Hello Bob", result);
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
deleted file mode 100644
index c52c16d8e1..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.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.host.embedded;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-import org.osoa.sca.ServiceReference;
-
-
-
-/**
- * Test SCADomain.newInstance and invocation of a service.
- *
- * @version $Rev$ $Date$
- */
-public class SCADomainTestCase extends TestCase {
-
- private SCADomain domain;
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("test.composite");
- }
-
- public void testInvoke() throws Exception {
- ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
- assertNotNull(serviceReference);
- TestService service = serviceReference.getService();
- String result = service.ping("Bob");
- assertEquals("Hello Bob", result);
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainZipsTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainZipsTestCaseFIXME.java
deleted file mode 100644
index 8b0bd5fd73..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainZipsTestCaseFIXME.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.host.embedded;
-
-import junit.framework.TestCase;
-import sample.Helloworld;
-
-
-
-/**
- * Test SCADomain.newInstance and invocation of a service.
- *
- * @version $Rev: 608205 $ $Date: 2008-01-02 20:29:05 +0000 (Wed, 02 Jan 2008) $
- */
-public class SCADomainZipsTestCaseFIXME extends TestCase {
-
- private SCADomain domain;
-
- @Override
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance("myDomain", "src/test/resources/helloworld.jar", "META-INF/sca-deployables/Helloworld.composite" );
- }
-
- public void testInvoke() throws Exception {
- Helloworld service = domain.getService(Helloworld.class, "HelloworldComponent");
- assertEquals("Hello Petra", service.sayHello("Petra"));
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
deleted file mode 100644
index fd5398c8e6..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.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.host.embedded.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-
-
-/**
- * Test creation of DefaultSCADomain.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultSCADomainTestCase extends TestCase {
- private DefaultSCADomain domain;
-
- @Override
- protected void setUp() throws Exception {
- domain = new DefaultSCADomain(getClass().getClassLoader(), getClass().getClassLoader(),
- "http://localhost", "./target/test-classes", "test.composite");
- }
-
- public void testStart() throws Exception {
- TestService service = domain.getService(TestService.class, "TestServiceComponent");
- assertNotNull(service);
- }
-
- public void testComponentManager() throws Exception {
- ComponentManager componentManager = domain.getComponentManager();
- assertEquals(1, componentManager.getComponentNames().size());
- assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
- assertNotNull(componentManager.getComponent("TestServiceComponent"));
-
- assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
- componentManager.stopComponent("TestServiceComponent");
- assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
deleted file mode 100644
index 2a59635a19..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.impl;
-
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
-import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-
-/**
- * Test creation of an EmbeddedSCADomain and invocation of a service.
- *
- * @version $Rev$ $Date$
- */
-public class EmbeddedSCADomainTestCase extends TestCase {
- private EmbeddedSCADomain domain;
-
- @Override
- protected void setUp() throws Exception {
-
- // Create a test embedded SCA domain
- domain = new EmbeddedSCADomain(getClass().getClassLoader(), "http://localhost");
- }
-
- public void testDomain() throws Exception {
- // Start the domain
- domain.start();
-
- // Determine my class loader and my test SCA contribution location
- ClassLoader myClassLoader = getClass().getClassLoader();
- String url = myClassLoader.getResource("test.txt").toString();
- url = url.substring(0, url.length()-8);
-
- // Contribute the SCA contribution
- TestModelResolver myResolver = new TestModelResolver(myClassLoader);
- ContributionService contributionService = domain.getContributionService();
- Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
- assertNotNull(contribution);
-
- // Decide which SCA composite I want to deploy
- Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
-
- // Add the deployable composite to the domain
- domain.getDomainComposite().getIncludes().add(myComposite);
-
-
- domain.buildComposite(myComposite);
-
- // Start the composite
- domain.getCompositeActivator().activate(myComposite);
- domain.getCompositeActivator().start(myComposite);
-
- // At this point the domain contains my contribution, my composite and
- // it's started, my application code can start using it
-
- // Get the TestServiceComponent service
- TestService service = domain.getService(TestService.class, "TestServiceComponent");
-
- // Invoke the service
- String result = service.ping("Bob");
- assertEquals("Hello Bob", result);
-
- // Stop my composite
- domain.getCompositeActivator().stop(myComposite);
- domain.getCompositeActivator().deactivate(myComposite);
-
- // Remove my composite
- domain.getDomainComposite().getIncludes().remove(myComposite);
-
- // Remove my contribution
- contributionService.remove("http://test/contribution");
-
- // Stop the domain
- domain.stop();
- }
-
- public void testComponentManager() throws Exception {
- // Start the domain
- domain.start();
-
- // Determine my class loader and my test SCA contribution location
- ClassLoader myClassLoader = getClass().getClassLoader();
- String url = myClassLoader.getResource("test.txt").toString();
- url = url.substring(0, url.length()-8);
-
- // Contribute the SCA contribution
- TestModelResolver myResolver = new TestModelResolver(myClassLoader);
- ContributionService contributionService = domain.getContributionService();
- Contribution contribution = contributionService.contribute("http://test/contribution", new URL(url), myResolver, false);
- assertNotNull(contribution);
-
- // Decide which SCA composite I want to deploy
- Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
-
- // Add the deployable composite to the domain
- domain.getDomainComposite().getIncludes().add(myComposite);
-
- domain.buildComposite(myComposite);
-
- // Start the composite
- domain.getCompositeActivator().activate(myComposite);
- domain.getCompositeActivator().start(myComposite);
-
- // At this point the domain contains my contribution, my composite and
- // it's started, my application code can start using it
-
- ComponentManager componentManager = domain.getComponentManager();
- assertEquals(1, componentManager.getComponentNames().size());
- assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
-
- Component component = componentManager.getComponent("TestServiceComponent");
- assertNotNull(component);
- assertEquals("TestServiceComponent", component.getName());
-
- MyComponentListener cl = new MyComponentListener();
- componentManager.addComponentListener(cl);
-
- assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
-
- assertFalse(cl.stopCalled);
- componentManager.stopComponent("TestServiceComponent");
- assertTrue(cl.stopCalled);
- assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
-
- assertFalse(cl.startCalled);
- componentManager.startComponent("TestServiceComponent");
- assertTrue(cl.startCalled);
- assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
-
- // Stop my composite
- domain.getCompositeActivator().stop(myComposite);
- domain.getCompositeActivator().deactivate(myComposite);
-
- // Remove my composite
- domain.getDomainComposite().getIncludes().remove(myComposite);
-
- // Remove my contribution
- contributionService.remove("http://test/contribution");
-
- // Stop the domain
- domain.stop();
- }
-
- class MyComponentListener implements ComponentListener {
- boolean startCalled;
- boolean stopCalled;
-
- public void componentStarted(String componentName) {
- startCalled = true;
- }
-
- public void componentStopped(String componentName) {
- stopCalled = true;
- }
-
- }
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
deleted file mode 100644
index 1cfe5ed5d8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.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.host.embedded.impl;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * A test model resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
- private WeakReference<ClassLoader> classLoader;
-
- private Map<QName, Composite> composites = new HashMap<QName, Composite>();
-
- public TestModelResolver(ClassLoader classLoader) {
- this.classLoader = new WeakReference<ClassLoader>(classLoader);
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else if (unresolved instanceof ClassReference) {
-
- // Load a class on demand
- ClassReference classReference = (ClassReference)unresolved;
- Class<?> clazz;
- try {
- clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
- } catch (ClassNotFoundException e) {
-
- // Return the unresolved object
- return unresolved;
- }
-
- // Store a new ClassReference wrapping the loaded class
- resolved = new ClassReference(clazz);
- map.put(resolved, resolved);
-
- // Return the resolved ClassReference
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- if (resolved instanceof Composite) {
- Composite composite = (Composite)resolved;
- composites.put(composite.getName(), composite);
- }
- }
-
- public Object removeModel(Object resolved) {
- if (resolved instanceof Composite) {
- Composite composite = (Composite)resolved;
- composites.remove(composite.getName());
- }
- return map.remove(resolved);
- }
-
- public Composite getComposite(QName qname) {
- return composites.get(qname);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
deleted file mode 100644
index 86e0cb6a8a..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.test.extension;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * Default factory for the test implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultTestImplementationFactory implements TestImplementationFactory {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- public DefaultTestImplementationFactory(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory) {
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- }
-
- public TestImplementation createTestImplementation() {
- return new TestImplementationImpl(assemblyFactory, javaFactory);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
deleted file mode 100644
index d9f1228307..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.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.host.embedded.test.extension;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * The model representing a test implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface TestImplementation extends Implementation {
-
- /**
- * Returns the greeting string that can be configured on test implementations.
- *
- * @return the greeting string that can be configured on test implementations
- */
- String getGreeting();
-
- /**
- * Sets the greeting string that can be configured on test implementations.
- *
- * @param greeting the greeting string that can be configured on test implementations
- */
- void setGreeting(String greeting);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
deleted file mode 100644
index 9200d850bb..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.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.host.embedded.test.extension;
-
-
-/**
- * A factory for the test implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface TestImplementationFactory {
-
- /**
- * Creates a new test implementation.
- *
- * @return
- */
- TestImplementation createTestImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
deleted file mode 100644
index 4adec91151..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.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.host.embedded.test.extension;
-
-/**
- * Service interface for test component implementations.
- *
- * @version $Rev$ $Date$
- */
-public interface TestService {
-
- String ping(String name);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
deleted file mode 100644
index 083b01167f..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.embedded.test.extension.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * The model representing a test implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class TestImplementationImpl implements TestImplementation {
-
- private Service testService;
- private String greeting;
-
- /**
- * Constructs a new test implementation.
- */
- public TestImplementationImpl(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory) {
-
- // Test implementations always provide a single service exposing
- // the TestService interface, and have no references and properties
- testService = assemblyFactory.createService();
- testService.setName("Test");
- JavaInterface javaInterface;
- try {
- javaInterface = javaFactory.createJavaInterface(TestService.class);
- } catch (InvalidInterfaceException e) {
- throw new IllegalArgumentException(e);
- }
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterface);
- testService.setInterfaceContract(interfaceContract);
- }
-
- public String getGreeting() {
- return greeting;
- }
-
- public void setGreeting(String greeting) {
- this.greeting = greeting;
- }
-
- public ConstrainingType getConstrainingType() {
- // The test implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- // The test implementation does not support properties
- return Collections.emptyList();
- }
-
- public List<Service> getServices() {
- // The test implementation provides a single fixed Test service
- return Collections.singletonList(testService);
- }
-
- public List<Reference> getReferences() {
- // The test implementation does not support properties
- return Collections.emptyList();
- }
-
- public String getURI() {
- // The test implementation does not have a URI
- return null;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The test implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- // The test implementation does not have a URI
- }
-
- public boolean isUnresolved() {
- // The test implementation is always resolved
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- // The test implementation is always resolved
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
deleted file mode 100644
index 73feffad50..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.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.host.embedded.test.extension.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
-
-
-
-/**
- * Implements a StAX artifact processor for test implementations.
- *
- * @version $Rev$ $Date$
- */
-public class TestImplementationProcessor implements StAXArtifactProcessor<TestImplementation> {
- private static final QName IMPLEMENTATION_TEST = new QName("http://test/extension", "implementation.test");
-
- private TestImplementationFactory testFactory;
-
- public TestImplementationProcessor(TestImplementationFactory testFactory) {
- this.testFactory = testFactory;
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_TEST;
- }
-
- public Class<TestImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return TestImplementation.class;
- }
-
- public TestImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.test> element
-
- // Read the message attribute.
- String message = reader.getAttributeValue(null, "greeting");
-
- // Create and initialize the test implementation model
- TestImplementation implementation = testFactory.createTestImplementation();
- implementation.setGreeting(message);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_TEST.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(TestImplementation impl, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public void write(TestImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- writer.writeStartElement(IMPLEMENTATION_TEST.getNamespaceURI(), IMPLEMENTATION_TEST.getLocalPart());
-
- if (implementation.getGreeting() != null) {
- writer.writeAttribute("greeting", implementation.getGreeting());
- }
-
- writer.writeEndElement();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
deleted file mode 100644
index f6f077e99b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.test.extension.module;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.embedded.test.extension.DefaultTestImplementationFactory;
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
-import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationProcessor;
-import org.apache.tuscany.sca.host.embedded.test.extension.provider.TestImplementationProviderFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-
-
-
-/**
- * Implements a module activator for the test implementation extension module.
- *
- * @version $Rev$ $Date$
- */
-public class TestModuleActivator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry registry) {
-
- // Create the test implementation factory
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- TestImplementationFactory testFactory = new DefaultTestImplementationFactory(assemblyFactory, javaFactory);
- modelFactories.addFactory(testFactory);
-
- // Add the test implementation extension to the StAXArtifactProcessor
- // extension point
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- TestImplementationProcessor implementationArtifactProcessor = new TestImplementationProcessor(testFactory);
- processors.addArtifactProcessor(implementationArtifactProcessor);
-
- // Add the test provider factory to the ProviderFactory extension point
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- providerFactories.addProviderFactory(new TestImplementationProviderFactory());
- }
-
- public void stop(ExtensionPointRegistry registry) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
deleted file mode 100644
index 1d27e08fee..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.embedded.test.extension.provider;
-
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-
-/**
- * Implementation provider for test implementations.
- *
- * @version $Rev$ $Date$
- */
-public class TestImplementationProvider implements ImplementationProvider {
-
- private RuntimeComponent component;
- private TestImplementation implementation;
-
- /**
- * Constructs a new test implementation provider.
- */
- public TestImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
- this.component = component;
- this.implementation = implementation;
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- TestInvoker invoker = new TestInvoker(operation, implementation.getGreeting());
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- System.out.println("Starting " + component.getName());
- }
-
- public void stop() {
- System.out.println("Stopping " + component.getName());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
deleted file mode 100644
index 15d3618fdd..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.embedded.test.extension.provider;
-
-import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * The model representing a test implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class TestImplementationProviderFactory implements ImplementationProviderFactory<TestImplementation> {
-
- /**
- * Constructs a new test implementation provider factory.
- */
- public TestImplementationProviderFactory() {
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
- return new TestImplementationProvider(component, implementation);
- }
-
- public Class<TestImplementation> getModelType() {
- return TestImplementation.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
deleted file mode 100644
index d49179dec0..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.embedded.test.extension.provider;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-
-/**
- * Implements an invoker for test component implementations.
- *
- * The target invoker is responsible for handling operation invocations.
- *
- * @version $Rev$ $Date$
- */
-public class TestInvoker implements Invoker {
- private Operation operation;
- private String greeting;
-
- public TestInvoker(Operation operation, String greeting) {
- this.operation = operation;
- this.greeting = greeting;
- }
-
- public Message invoke(Message msg) {
- Object[] args = msg.getBody();
- if (operation.getName().equals("ping")) {
- msg.setBody(greeting + " " + args[0]);
- } else {
- msg.setFaultBody(new Exception("Operation " + operation.getName() + " is not supported"));
- }
- return msg;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/sample/Helloworld.java b/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/sample/Helloworld.java
deleted file mode 100644
index 386426df73..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/java/sample/Helloworld.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 sample;
-
-import org.osoa.sca.annotations.Remotable;
-
-@Remotable
-public interface Helloworld {
-
- String sayHello(String name);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 7e2e11e4cc..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.host.embedded.test.extension.module.TestModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.jar b/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.jar
deleted file mode 100644
index 0e022a3e2c..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.jar
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.zip b/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.zip
deleted file mode 100644
index 0e022a3e2c..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/helloworld.zip
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.composite b/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.composite
deleted file mode 100644
index bd7c5fab79..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.composite
+++ /dev/null
@@ -1,30 +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"
- targetNamespace="http://test"
- xmlns:se="http://test"
- xmlns:e="http://test/extension"
- name="test">
-
- <component name="TestServiceComponent">
- <e:implementation.test greeting="Hello" />
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.txt b/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.txt
deleted file mode 100644
index 287f9b1f65..0000000000
--- a/branches/sca-java-1.5.1/modules/host-embedded/src/test/resources/test.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License. \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/host-http/LICENSE b/branches/sca-java-1.5.1/modules/host-http/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/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-java-1.5.1/modules/host-http/NOTICE b/branches/sca-java-1.5.1/modules/host-http/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-http/pom.xml b/branches/sca-java-1.5.1/modules/host-http/pom.xml
deleted file mode 100644
index 9fd7ae0389..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/pom.xml
+++ /dev/null
@@ -1,65 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-http</artifactId>
- <name>Apache Tuscany SCA HTTP Servlet Host Extension Point</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.http</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.http*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.java
deleted file mode 100644
index 3de0b9f5a7..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultResourceServlet.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.host.http;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLDecoder;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * A minimal implementation of a Servlet that serves documents in a document root
- * directory.
- *
- * A Servlet host implementation is not required to use this implementation and can map
- * the URI and document root to a more complete and more efficient implementation of
- * a resource Servlet, for example the Tomcat or Jetty default Servlets.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultResourceServlet extends HttpServlet implements Servlet {
- private static final long serialVersionUID = 2865466417329430610L;
-
- private String documentRoot;
-
- /**
- * Constructs a new ResourceServlet
- * @param documentRoot the document root
- */
- public DefaultResourceServlet(String documentRoot) {
- this.documentRoot = documentRoot;
- }
-
- /**
- * Returns the document root.
- * @return the document root
- */
- public String getDocumentRoot() {
- return documentRoot;
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
-
- // Determine the resource path
- String path = URLDecoder.decode(request.getRequestURI().substring(request.getServletPath().length()), "UTF-8");
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- URL url = new URL(documentRoot + '/' + path);
-
- // Write the resource
- InputStream is = url.openStream();
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.java
deleted file mode 100644
index 5e6de0b29b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/DefaultServletHostExtensionPoint.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.host.http;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Default implementation of a Servlet host extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultServletHostExtensionPoint implements ServletHostExtensionPoint {
-
- private List<ServletHost> servletHosts = new ArrayList<ServletHost>();
-
- public void addServletHost(ServletHost servletHost) {
- servletHosts.add(servletHost);
- }
-
- public void removeServletHost(ServletHost servletHost) {
- servletHosts.remove(servletHost);
- }
-
- public List<ServletHost> getServletHosts() {
- return servletHosts;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
deleted file mode 100644
index ed1fac1b50..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ExtensibleServletHost.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.http;
-
-import java.net.URL;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-
-/**
- * Default implementation of an extensible Servlet host.
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleServletHost implements ServletHost {
-
- private ServletHostExtensionPoint servletHosts;
-
- public ExtensibleServletHost(ServletHostExtensionPoint servletHosts) {
- this.servletHosts = servletHosts;
- }
-
- public void setDefaultPort(int port) {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- for (ServletHost servletHost: servletHosts.getServletHosts()) {
- servletHost.setDefaultPort(port);
- }
- }
-
- private ServletHost getDefaultServletHost() {
- return servletHosts.getServletHosts().get(0);
- }
-
- public int getDefaultPort() {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- return getDefaultServletHost().getDefaultPort();
- }
-
- public void addServletMapping(String uri, Servlet servlet) throws ServletMappingException {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- getDefaultServletHost().addServletMapping(uri, servlet);
- }
-
- public void addServletMapping(String uri, Servlet servlet, SecurityContext securityContext) throws ServletMappingException {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- getDefaultServletHost().addServletMapping(uri, servlet, securityContext);
- }
-
- public Servlet getServletMapping(String uri) throws ServletMappingException {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- return getDefaultServletHost().getServletMapping(uri);
- }
-
- public Servlet removeServletMapping(String uri) throws ServletMappingException {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- return getDefaultServletHost().removeServletMapping(uri);
- }
-
- public RequestDispatcher getRequestDispatcher(String uri) throws ServletMappingException {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- return getDefaultServletHost().getRequestDispatcher(uri);
- }
-
- public String getContextPath() {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- // TODO implement selection of the correct Servlet host based on the mapping
- // For now just select the first one
- return getDefaultServletHost().getContextPath();
- }
-
- public URL getURLMapping(String uri) {
- if (servletHosts.getServletHosts().isEmpty()) {
- throw new ServletMappingException("No servlet host available");
- }
-
- return getDefaultServletHost().getURLMapping(uri);
- }
-
- public void setContextPath(String path) {
- getDefaultServletHost().setContextPath(path);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/SecurityContext.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/SecurityContext.java
deleted file mode 100644
index f290bb3e59..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/SecurityContext.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.http;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * A class to store policy context to enable Security QoS to
- * HTTP binding
- */
-public class SecurityContext {
- private boolean isSSLEnabled = false;
- private Properties sslProperties;
-
- private boolean isAuthenticationEnabled = false;
- private List<UserContext> users = new ArrayList<UserContext>();
-
- public boolean isSSLEnabled() {
- return isSSLEnabled;
- }
-
- public void setSSLEnabled(boolean value) {
- this.isSSLEnabled = value;
- }
-
- public Properties getSSLProperties() {
- return sslProperties;
- }
-
- public void setSSLProperties(Properties sslProperties) {
- this.sslProperties = sslProperties;
- }
-
- public boolean isAuthenticationEnabled() {
- return this.isAuthenticationEnabled;
- }
-
- public void setAuthenticationEnabled(boolean value) {
- this.isAuthenticationEnabled = value;
- }
-
- public List<UserContext> getUsers() {
- return this.users;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
deleted file mode 100644
index 041880916b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHost.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.http;
-
-import java.net.URL;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-
-/**
- * Interface implemented by host environments that allow Servlets to be
- * registered.
- * <p/>
- * This interface allows a system service to register a Servlet
- * to handle inbound requests.
- *
- * @version $Rev$ $Date$
- */
-public interface ServletHost {
-
- /**
- * Sets the default port for the server.
- *
- * @param port the default port
- */
- void setDefaultPort(int port);
-
- /**
- * Returns the default port for the server.
- *
- * @return the default port
- */
- int getDefaultPort();
-
- /**
- * Add a mapping for an instance of a Servlet. This requests that the
- * Servlet container direct all requests to the designated mapping to the
- * supplied Servlet instance.
- *
- * @param uri the URI-mapping for the Servlet
- * @param servlet the Servlet that should be invoked
- * @throws ServletMappingException
- */
- void addServletMapping(String uri, Servlet servlet) throws ServletMappingException;
-
- /**
- * Add a mapping for an instance of a Servlet. This requests that the
- * Servlet container direct all requests to the designated mapping to the
- * supplied Servlet instance. SecurityContext can be passed to enable
- * QoS services such as Confidentiality (SSL) and Authentication/Authorization
- *
- * @param uri the URI-mapping for the Servlet
- * @param servlet the Servlet that should be invoked
- * @param securityContext the SecurityContext to enable QoS services
- * @throws ServletMappingException
- */
- void addServletMapping(String uri, Servlet servlet, SecurityContext securityContext) throws ServletMappingException;
-
- /**
- * Remove a Servlet mapping. This directs the Servlet container not to direct
- * any more requests to a previously registered Servlet.
- *
- * @param uri the URI-mapping for the Servlet
- * @return the Servlet that was registered to the mapping, null if nothing
- * was registered to the mapping
- * @throws ServletMappingException
- */
- Servlet removeServletMapping(String uri) throws ServletMappingException;
-
- /**
- * Returns the Servlet mapped to the given URI.
- *
- * @param uri the URI-mapping for the Servlet
- * @return the Servlet registered with the mapping
- * @throws ServletMappingException
- */
- Servlet getServletMapping(String uri) throws ServletMappingException;
-
- /**
- * Returns a Servlet request dispatcher for the Servlet mapped to the specified URI.
- *
- * @param uri the URI mapped to a Servlet
- * @return a RequestDispatcher that can be used to dispatch requests to
- * that Servlet
- * @throws ServletMappingException
- */
- RequestDispatcher getRequestDispatcher(String uri) throws ServletMappingException;
-
- /**
- * Returns the portion of the request URI that indicates the context of the request
- *
- * @return a String specifying the portion of the request URI that indicates the context of the request
- */
- String getContextPath();
-
- /**
- * Sets the portion of the request URI that indicates the context of the request
- *
- * @param path the context path
- */
- void setContextPath(String path);
-
- /**
- * Returns the complete URL mapped to the specified URI.
- * @return the URL mapped to the specified URI
- */
- URL getURLMapping(String uri);
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.java
deleted file mode 100644
index fbd085ba2b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletHostExtensionPoint.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.host.http;
-
-import java.util.List;
-
-/**
- * An extension point for Servlet hosts.
- *
- * @version $Rev$ $Date$
- */
-public interface ServletHostExtensionPoint {
-
- /**
- * Adds a Servlet host extension.
- *
- * @param servletHost
- */
- void addServletHost(ServletHost servletHost);
-
- /**
- * Removes a Servlet host extension.
- *
- * @param servletHost
- */
- void removeServletHost(ServletHost servletHost);
-
- /**
- * Returns a list of Servlet host extensions.
- *
- * @return
- */
- List<ServletHost> getServletHosts();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.java
deleted file mode 100644
index ae66c44c3e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/ServletMappingException.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.host.http;
-
-/**
- * Indicates an exception while registering a Servlet mapping.
- *
- * @version $Rev$ $Date$
- */
-public class ServletMappingException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public ServletMappingException() {
- super();
- }
-
- public ServletMappingException(String message) {
- super(message);
- }
-
- public ServletMappingException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ServletMappingException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/UserContext.java b/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/UserContext.java
deleted file mode 100644
index 4a19eda81d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/java/org/apache/tuscany/sca/host/http/UserContext.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.host.http;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Model class used to define list of users and it's roles
- *
- * These info is used to configure authentication/authorization
- * in embedded http servers
- *
- * @version $Rev$ $Date$
- */
-public class UserContext {
- private String username;
- private String password;
- private List<String> roles = new ArrayList<String>();
-
-
- public UserContext() {
-
- }
-
- public UserContext(String username, String password) {
- this.username = username;
- this.password = password;
- }
-
- public String getUsername() {
- return this.username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return this.password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public List<String> getRoles() {
- return this.roles;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint b/branches/sca-java-1.5.1/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint
deleted file mode 100644
index 44f4550b40..0000000000
--- a/branches/sca-java-1.5.1/modules/host-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.http.ServletHostExtensionPoint
+++ /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.host.http.DefaultServletHostExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/LICENSE b/branches/sca-java-1.5.1/modules/host-jetty/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/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-java-1.5.1/modules/host-jetty/NOTICE b/branches/sca-java-1.5.1/modules/host-jetty/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/pom.xml b/branches/sca-java-1.5.1/modules/host-jetty/pom.xml
deleted file mode 100644
index 26a6518342..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-jetty</artifactId>
- <name>Apache Tuscany SCA Jetty Servlet Host Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.7</version>
- <exclusions>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api-2.5</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.jetty</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.http.jetty*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java b/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java
deleted file mode 100644
index 4f5bfb3c62..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyDefaultServlet.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.http.jetty;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.resource.Resource;
-import org.mortbay.resource.URLResource;
-
-/**
- * Customizes the Jetty default Servlet.
- *
- * @version $Rev$ $Date$
- */
-public class JettyDefaultServlet extends DefaultServlet {
- private static final long serialVersionUID = 7000218247190209353L;
-
- private String documentRoot;
- private String servletPath;
-
- public JettyDefaultServlet(String servletPath, String documentRoot) {
- this.servletPath = servletPath + '/';
- this.documentRoot = documentRoot;
- }
-
- @Override
- public Resource getResource(String pathInContext) {
- if (pathInContext.startsWith(servletPath)) {
- if (pathInContext.length() > servletPath.length()) {
- pathInContext = pathInContext.substring(servletPath.length());
- } else {
- pathInContext = "";
- }
- } else {
- if ((pathInContext + "/").equals(servletPath)) {
- pathInContext = "";
- }
- }
-
- try {
- URL url = new URL(documentRoot + "/" + pathInContext);
- return new URLResource(url, url.openConnection()) {
- private static final long serialVersionUID = 8560952113883507717L;
-
- @Override
- public File getFile() throws IOException {
- return null;
- }
-
- };
- } catch (MalformedURLException e) {
- return null;
- } catch (IOException e) {
- return null;
- }
- }
-
- @Override
- public String getInitParameter(String name) {
- if ("resourceBase".equals(name)) {
- return documentRoot;
- } else if ("redirectWelcome".equals(name)) {
- return "true";
- } else {
- return super.getInitParameter(name);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java b/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java
deleted file mode 100644
index 1ecf1bca1b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyLogger.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.jetty;
-
-import org.mortbay.log.Logger;
-
-/**
- * Replaces Jetty's logging mechanism
- *
- * @version $Rev$ $Date$
- */
-public class JettyLogger implements Logger {
-
- private boolean debugEnabled;
-
- public boolean isDebugEnabled() {
- return debugEnabled;
- }
-
- public void setDebugEnabled(boolean debugEnabled) {
- this.debugEnabled = debugEnabled;
- }
-
- public void info(String msg, Object arg0, Object arg1) {
- if (debugEnabled) {
- System.err.println(":INFO: " + format(msg, arg0, arg1));
- }
- }
-
- public void debug(String msg, Throwable th) {
- if (debugEnabled) {
- System.err.println(":DEBUG: " + msg);
- th.printStackTrace();
- }
- }
-
- public void debug(String msg, Object arg0, Object arg1) {
- if (debugEnabled) {
- System.err.println(":DEBUG: " + format(msg, arg0, arg1));
- }
- }
-
- public void warn(String msg, Object arg0, Object arg1) {
- if (debugEnabled) {
- System.err.println(":WARN: " + format(msg, arg0, arg1));
- }
- }
-
- public void warn(String msg, Throwable th) {
- if (debugEnabled) {
- System.err.println(":WARN: " + msg);
- th.printStackTrace();
- }
- }
-
- public Logger getLogger(String name) {
- return this;
- }
-
- private String format(String msg, Object arg0, Object arg1) {
- int i0 = msg.indexOf("{}");
- int i1 = i0 < 0 ? -1 : msg.indexOf("{}", i0 + 2);
- if (arg1 != null && i1 >= 0) {
- msg = msg.substring(0, i1) + arg1 + msg.substring(i1 + 2);
- }
- if (arg0 != null && i0 >= 0) {
- msg = msg.substring(0, i0) + arg0 + msg.substring(i0 + 2);
- }
- return msg;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java b/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
deleted file mode 100644
index 6e165cd219..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
+++ /dev/null
@@ -1,512 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.jetty;
-
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.security.AccessController;
-import java.security.KeyStore;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.logging.Logger;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
-import org.apache.tuscany.sca.host.http.SecurityContext;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-import org.apache.tuscany.sca.work.WorkScheduler;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.ContextHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.security.SslSocketConnector;
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.jetty.servlet.ServletHandler;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.servlet.ServletMapping;
-import org.mortbay.jetty.servlet.SessionHandler;
-import org.mortbay.thread.ThreadPool;
-
-/**
- * Implements an HTTP transport service using Jetty.
- *
- * @version $Rev$ $Date$
- */
-public class JettyServer implements ServletHost {
- private static final Logger logger = Logger.getLogger(JettyServer.class.getName());
-
- private final Object joinLock = new Object();
- private String trustStore;
- private String trustStorePassword;
- private String keyStore;
- private String keyStorePassword;
-
- private String keyStoreType;
- private String trustStoreType;
-
-
- private boolean sendServerVersion;
- private WorkScheduler workScheduler;
- private int defaultPort = 8080;
- private int defaultSSLPort = 443;
-
- /**
- * Represents a port and the server that serves it.
- */
- private class Port {
- private Server server;
- private ServletHandler servletHandler;
-
- private Port(Server server, ServletHandler servletHandler) {
- this.server = server;
- this.servletHandler = servletHandler;
- }
-
- public Server getServer() {
- return server;
- }
-
- public ServletHandler getServletHandler() {
- return servletHandler;
- }
- }
-
- private Map<Integer, Port> ports = new HashMap<Integer, Port>();
-
- private String contextPath = "/";
-
- static {
- // Hack to replace the static Jetty logger
- System.setProperty("org.mortbay.log.class", JettyLogger.class.getName());
- }
-
- public JettyServer(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- trustStore = System.getProperty("javax.net.ssl.trustStore");
- trustStorePassword = System.getProperty("javax.net.ssl.trustStorePassword");
- keyStore = System.getProperty("javax.net.ssl.keyStore");
- keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
-
- keyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
- trustStoreType = System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
- return null;
- }
- });
- }
-
- public void setDefaultPort(int port) {
- defaultPort = port;
- }
-
- public int getDefaultPort() {
- return defaultPort;
- }
-
- public void setSendServerVersion(boolean sendServerVersion) {
- this.sendServerVersion = sendServerVersion;
- }
-
- /**
- * Stop all the started servers.
- */
- public void stop() {
- synchronized (joinLock) {
- joinLock.notifyAll();
- }
- try {
- Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
- for (Entry<Integer, Port> entry: entries) {
- Port port = entry.getValue();
- port.getServer().stop();
- ports.remove(entry.getKey());
- }
- } catch (Exception e) {
- throw new ServletMappingException(e);
- }
- }
-
- private void configureSSL(SslSocketConnector connector, SecurityContext securityContext) {
- connector.setProtocol("TLS");
-
- if (securityContext != null) {
- keyStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
- keyStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStore");
- keyStorePassword = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStorePassword");
-
- trustStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
- trustStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStore");
- trustStorePassword = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStorePassword");
- }
- connector.setKeystore(keyStore);
- connector.setKeyPassword(keyStorePassword);
- connector.setKeystoreType(keyStoreType);
-
- connector.setTruststore(trustStore);
- connector.setTrustPassword(trustStorePassword);
- connector.setTruststoreType(trustStoreType);
-
- connector.setPassword(keyStorePassword);
- if (trustStore != null) {
- connector.setNeedClientAuth(true);
- }
-
- }
-
- public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
- addServletMapping(suri, servlet, null);
- }
-
- public void addServletMapping(String suri, Servlet servlet, final SecurityContext securityContext) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = null;
- if(securityContext != null && securityContext.isSSLEnabled()) {
- scheme = "https";
- } else {
- scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- }
-
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- if ("http".equals(scheme)) {
- portNumber = defaultPort;
- } else {
- portNumber = defaultPort;
- }
- }
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
-
- // Create and start a new server
- try {
- Server server = new Server();
- server.setThreadPool(new WorkSchedulerThreadPool());
- if ("https".equals(scheme)) {
-// Connector httpConnector = new SelectChannelConnector();
-// httpConnector.setPort(portNumber);
- SslSocketConnector sslConnector = new SslSocketConnector();
- sslConnector.setPort(portNumber);
- configureSSL(sslConnector, securityContext);
- server.setConnectors(new Connector[] {sslConnector});
- } else {
- SelectChannelConnector selectConnector = new SelectChannelConnector();
- selectConnector.setPort(portNumber);
- server.setConnectors(new Connector[] {selectConnector});
- }
-
- ContextHandler contextHandler = new ContextHandler();
- //contextHandler.setContextPath(contextPath);
- contextHandler.setContextPath("/");
- server.setHandler(contextHandler);
-
- SessionHandler sessionHandler = new SessionHandler();
- ServletHandler servletHandler = new ServletHandler();
- sessionHandler.addHandler(servletHandler);
-
- contextHandler.setHandler(sessionHandler);
-
- server.setStopAtShutdown(true);
- server.setSendServerVersion(sendServerVersion);
- server.start();
-
- // Keep track of the new server and Servlet handler
- port = new Port(server, servletHandler);
- ports.put(portNumber, port);
-
- } catch (Exception e) {
- throw new ServletMappingException(e);
- }
- }
-
- // Register the Servlet mapping
- ServletHandler servletHandler = port.getServletHandler();
- ServletHolder holder;
- if (servlet instanceof DefaultResourceServlet) {
-
- // Optimize the handling of resource requests, use the Jetty default Servlet
- // instead of our default resource Servlet
- String servletPath = uri.getPath();
- if (servletPath.endsWith("*")) {
- servletPath = servletPath.substring(0, servletPath.length()-1);
- }
- if (servletPath.endsWith("/")) {
- servletPath = servletPath.substring(0, servletPath.length()-1);
- }
- if (!servletPath.startsWith("/")) {
- servletPath = '/' + servletPath;
- }
-
- DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet;
- DefaultServlet defaultServlet = new JettyDefaultServlet(servletPath, resourceServlet.getDocumentRoot());
- holder = new ServletHolder(defaultServlet);
-
- } else {
- holder = new ServletHolder(servlet);
- }
- servletHandler.addServlet(holder);
-
- ServletMapping mapping = new ServletMapping();
- mapping.setServletName(holder.getName());
- String path = uri.getPath();
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- mapping.setPathSpec(path);
- servletHandler.addServletMapping(mapping);
-
- // Compute the complete URL
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
- URL addedURL;
- try {
- addedURL = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- logger.info("Added Servlet mapping: " + addedURL);
- }
-
- public URL getURLMapping(String suri) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPort;
- }
-
- // Get the host
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
-
- // Construct the URL
- String path = uri.getPath();
-
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
-
- URL url;
- try {
- url = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- return url;
- }
-
- public Servlet getServletMapping(String suri) throws ServletMappingException {
-
- if (suri == null){
- return null;
- }
-
- URI uri = URI.create(suri);
-
- // Get the URI port
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPort;
- }
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
- return null;
- }
-
- // Remove the Servlet mapping for the given Servlet
- ServletHandler servletHandler = port.getServletHandler();
- Servlet servlet = null;
- List<ServletMapping> mappings =
- new ArrayList<ServletMapping>(Arrays.asList(servletHandler.getServletMappings()));
- String path = uri.getPath();
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- for (ServletMapping mapping : mappings) {
- if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
- try {
- servlet = servletHandler.getServlet(mapping.getServletName()).getServlet();
- } catch (ServletException e) {
- throw new IllegalStateException(e);
- }
- break;
- }
- }
- return servlet;
- }
-
- public Servlet removeServletMapping(String suri) {
- URI uri = URI.create(suri);
-
- // Get the URI port
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPort;
- }
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
- throw new IllegalStateException("No servlet registered at this URI: " + suri);
- }
-
- // Remove the Servlet mapping for the given Servlet
- ServletHandler servletHandler = port.getServletHandler();
- Servlet removedServlet = null;
- List<ServletMapping> mappings =
- new ArrayList<ServletMapping>(Arrays.asList(servletHandler.getServletMappings()));
- String path = uri.getPath();
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- for (ServletMapping mapping : mappings) {
- if (Arrays.asList(mapping.getPathSpecs()).contains(path)) {
- try {
- removedServlet = servletHandler.getServlet(mapping.getServletName()).getServlet();
- } catch (ServletException e) {
- throw new IllegalStateException(e);
- }
- mappings.remove(mapping);
- logger.info("Removed Servlet mapping: " + path);
- break;
- }
- }
- if (removedServlet != null) {
- servletHandler.setServletMappings(mappings.toArray(new ServletMapping[mappings.size()]));
-
- // Stop the port if there are no servlet mappings on it anymore
- if (mappings.size() == 0) {
- try {
- port.getServer().stop();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- ports.remove(portNumber);
- }
-
- } else {
- logger.warning("Trying to Remove servlet mapping: " + path + " where mapping is not registered");
- }
-
- return removedServlet;
- }
-
- public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
- //FIXME implement this later
- return null;
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public void setContextPath(String path) {
- this.contextPath = path;
- }
-
- /**
- * A wrapper to enable use of a WorkScheduler with Jetty
- */
- private class WorkSchedulerThreadPool implements ThreadPool {
-
- public boolean dispatch(Runnable work) {
- workScheduler.scheduleWork(work);
- return true;
- }
-
- public void join() throws InterruptedException {
- synchronized (joinLock) {
- joinLock.wait();
- }
- }
-
- public int getThreads() {
- throw new UnsupportedOperationException();
- }
-
- public int getIdleThreads() {
- throw new UnsupportedOperationException();
- }
-
- public boolean isLowOnThreads() {
- return false;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.java
deleted file mode 100644
index 884c8a4cce..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/module/JettyRuntimeModuleActivator.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.http.jetty.module;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.http.jetty.JettyServer;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JettyRuntimeModuleActivator implements ModuleActivator {
- private static final Logger logger = Logger.getLogger(JettyRuntimeModuleActivator.class.getName());
-
- private JettyServer server;
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- // Register a Jetty Servlet host
- ServletHostExtensionPoint servletHosts =
- extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
-
- if (servletHosts.getServletHosts().size() < 1) {
- UtilityExtensionPoint utilities = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class);
- final WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
- // Allow privileged access to start MBeans. Requires MBeanPermission in security policy.
- try {
- server = AccessController.doPrivileged(new PrivilegedAction<JettyServer>() {
- public JettyServer run() {
- return new JettyServer(workScheduler);
- }
- });
- servletHosts.addServletHost(server);
- } catch (Exception e) {
- logger.log(Level.WARNING, "Exception creating JettyServer", e);
- }
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- // Allow privileged access to stop MBeans. Requires MBeanPermission in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- if (server != null) {
- server.stop();
- }
- return null;
- }
- });
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index f61708de90..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.http.jetty.module.JettyRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java b/branches/sca-java-1.5.1/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
deleted file mode 100644
index 020dd4af0e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/test/java/org/apache/tuscany/sca/http/jetty/JettyServerTestCase.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.jetty;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.ConnectException;
-import java.net.Socket;
-import java.net.URL;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
-import org.apache.tuscany.sca.work.NotificationListener;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JettyServerTestCase extends TestCase {
-
- private static final String REQUEST1_HEADER =
- "GET / HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST1_CONTENT = "";
- private static final String REQUEST1 =
- REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
-
- private static final String REQUEST2_HEADER =
- "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST2_CONTENT = "";
- private static final String REQUEST2 =
- REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
-
- private static final int HTTP_PORT = 8085;
-
- private WorkScheduler workScheduler = new WorkScheduler() {
-
- public <T extends Runnable> void scheduleWork(T work) {
- Thread thread = new Thread(work);
- thread.start();
- }
-
- public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
- scheduleWork(work);
- }
-
- public void destroy() {
- }
- };
-
- /**
- * Verifies requests are properly routed according to the Servlet mapping
- */
- public void testRegisterServletMapping() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- service.stop();
- assertTrue(servlet.invoked);
- }
-
- public void testRegisterServletMappingSSL() throws Exception {
- System.setProperty("javax.net.ssl.keyStore", "target/test-classes/tuscany.keyStore");
- System.setProperty("javax.net.ssl.keyStorePassword", "apache");
- System.setProperty("jetty.ssl.password", "apache");
- JettyServer service = new JettyServer(workScheduler);
- TestServlet servlet = new TestServlet();
- try {
- service.addServletMapping("https://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- } finally {
- System.clearProperty("javax.net.ssl.keyStore");
- System.clearProperty("javax.net.ssl.keyStorePassword");
- System.clearProperty("jetty.ssl.password");
- }
- System.setProperty("javax.net.ssl.trustStore", "target/test-classes/tuscany.keyStore");
- System.setProperty("javax.net.ssl.trustStorePassword", "apache");
- URL url = new URL("https://127.0.0.1:8085/foo");
- HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
- conn.setHostnameVerifier(new HostnameVerifier() {
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }}
- );
-
- conn.connect();
- read(conn.getInputStream());
-
- service.stop();
- assertTrue(servlet.invoked);
-
- }
-
- /**
- * Verifies that Servlets can be registered with multiple ports
- */
- public void testRegisterMultiplePorts() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
- TestServlet servlet2 = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + (HTTP_PORT + 1) + "/", servlet2);
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT + 1);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
-
- service.stop();
- assertTrue(servlet.invoked);
- assertTrue(servlet2.invoked);
- }
-
- public void testUnregisterMapping() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- TestServlet servlet = new TestServlet();
- String uri = "http://127.0.0.1:" + HTTP_PORT + "/foo";
- service.addServletMapping(uri, servlet);
- service.removeServletMapping(uri);
- try {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- fail("Server still bound to port");
- } catch (ConnectException e) {
- }
- service.stop();
- assertFalse(servlet.invoked);
- }
-
- public void testRequestSession() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- service.stop();
- assertTrue(servlet.invoked);
- assertNotNull(servlet.sessionId);
- }
-
- public void testRestart() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- service.stop();
- service.stop();
- }
-
- public void testNoMappings() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
- Exception ex = null;
- try {
- new Socket("127.0.0.1", HTTP_PORT);
- } catch (ConnectException e) {
- ex = e;
- }
- assertNotNull(ex);
- service.stop();
- }
-
- public void testResourceServlet() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
-
- String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
- documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
- DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
- TestResourceServlet servlet = new TestResourceServlet(resourceServlet);
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", servlet);
-
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST2.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
-
- service.stop();
- }
-
- public void testDefaultServlet() throws Exception {
- JettyServer service = new JettyServer(workScheduler);
-
- String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
- documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
- DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", resourceServlet);
-
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST2.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
-
- service.stop();
- }
-
- private static String read(Socket socket) throws IOException {
- InputStream is = socket.getInputStream();
- return read(is);
- }
-
- private static String read(InputStream is) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-
- private class TestServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- boolean invoked;
- String sessionId;
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- invoked = true;
- sessionId = req.getSession().getId();
- OutputStream writer = resp.getOutputStream();
- try {
- writer.write("result".getBytes());
- } finally {
- writer.close();
- }
- }
-
- }
-
- private class TestResourceServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- private HttpServlet delegate;
-
- public TestResourceServlet(HttpServlet delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public void init() throws ServletException {
- super.init();
- delegate.init();
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init();
- delegate.init(config);
- }
-
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- delegate.service(req, resp);
- }
-
- @Override
- public void destroy() {
- super.destroy();
- delegate.destroy();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/content/test.html b/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/content/test.html
deleted file mode 100644
index f4b79d7f01..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/content/test.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<body><p>hello</body>
-</html> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/tuscany.keyStore b/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/tuscany.keyStore
deleted file mode 100644
index 7ea23f7ff4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jetty/src/test/resources/tuscany.keyStore
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/LICENSE b/branches/sca-java-1.5.1/modules/host-jms-asf/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/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-java-1.5.1/modules/host-jms-asf/NOTICE b/branches/sca-java-1.5.1/modules/host-jms-asf/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/pom.xml b/branches/sca-java-1.5.1/modules/host-jms-asf/pom.xml
deleted file mode 100644
index 13f22623fa..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/pom.xml
+++ /dev/null
@@ -1,88 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-jms-asf</artifactId>
- <name>Apache Tuscany SCA JMS Host Extension Point default implementation</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jms</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.http</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.http*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java b/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java
deleted file mode 100644
index 77c121bedc..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ASFListener.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.jms.asf;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl;
-import org.apache.tuscany.sca.host.jms.JMSServiceListener;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * Implementation of the JMS service binding provider.
- *
- * @version $Rev: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $
- */
-public class ASFListener implements JMSServiceListener {
- private static final Logger logger = Logger.getLogger(ASFListener.class.getName());
-
- private MessageListener listener;
- private String serviceName;
- private boolean isCallbackService;
- private JMSBinding jmsBinding;
- private WorkScheduler workScheduler;
-
- private JMSResourceFactory jmsResourceFactory;
- private MessageConsumer consumer;
- private boolean running;
-
- private Destination destination;
-
- public ASFListener(MessageListener listener, String serviceName, boolean isCallbackService, JMSBinding jmsBinding, WorkScheduler workScheduler, JMSResourceFactory rf) {
- this.listener = listener;
- this.serviceName = serviceName;
- this.isCallbackService = isCallbackService;
- this.jmsBinding = jmsBinding;
- this.workScheduler = workScheduler;
- this.jmsResourceFactory = rf;
- }
-
- public void start() {
- this.running = true;
-
- try {
- registerListerner();
- } catch (Exception e) {
- throw new JMSBindingException("Error starting JMSServiceBinding", e);
- }
- }
-
- public void stop() {
- this.running = false;
- try {
- consumer.close();
- jmsResourceFactory.closeConnection();
- jmsResourceFactory.closeResponseConnection();
- } catch (Exception e) {
- // if using an embedded broker then when shutting down Tuscany the broker may get closed
- // before this stop method is called. I can't see how to detect that so for now just
- // ignore the exception if the message is that the transport is already disposed
- if (!"Transport disposed.".equals(e.getMessage())) {
- throw new JMSBindingException("Error stopping JMSServiceBinding", e);
- }
- }
- }
-
- private void registerListerner() throws NamingException, JMSException {
-
- Session session = jmsResourceFactory.createSession();
- destination = lookupDestinationQueue();
- if (destination == null) {
- destination = session.createTemporaryQueue();
- }
-
- if (jmsBinding.getJMSSelector() != null) {
- consumer = session.createConsumer(destination, jmsBinding.getJMSSelector());
- } else {
- consumer = session.createConsumer(destination);
- }
-
- try {
-
- consumer.setMessageListener(listener);
- jmsResourceFactory.startConnection();
-
- } catch (javax.jms.JMSException e) {
-
- // setMessageListener not allowed in JEE container so use Tuscany threads
-
- jmsResourceFactory.startConnection();
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- try {
- while (running) {
- final Message msg = consumer.receive();
- workScheduler.scheduleWork(new Runnable() {
- public void run() {
- try {
- listener.onMessage(msg);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- });
- }
- logger.log(Level.INFO, "JMS " + (isCallbackService ? "callback service" : "service")
- + " '"
- + serviceName
- + "' listening on destination "
- + ((destination instanceof Queue) ? ((Queue)destination).getQueueName() : ((Topic)destination).getTopicName()));
- }
-
- /**
- * Looks up the Destination Queue for the JMS Binding.
- * <p>
- * What happens in the look up will depend on the create mode specified for the JMS Binding:
- * <ul>
- * <li>always - the JMS queue is always created. It is an error if the queue already exists
- * <li>ifnotexist - the JMS queue is created if it does not exist. It is not an error if the queue already exists
- * <li>never - the JMS queue is never created. It is an error if the queue does not exist
- * </ul>
- * See the SCA JMS Binding specification for more information.
- * <p>
- *
- * @return The Destination queue.
- * @throws NamingException Failed to lookup JMS queue
- * @throws JMSBindingException Failed to lookup JMS Queue. Probable cause is that the JMS queue's current existence/non-existence is not
- * compatible with the create mode specified on the binding
- */
- private Destination lookupDestinationQueue() throws NamingException, JMSBindingException {
-
- if (isCallbackService && (jmsBinding.getDestinationName() == null)) {
- // if its a callback service returning null indicates to use a temporary queue
- return null;
- }
-
- Destination destination = jmsResourceFactory.lookupDestination(jmsBinding.getDestinationName());
-
- String qCreateMode = jmsBinding.getDestinationCreate();
- if (qCreateMode.equals(JMSBindingConstants.CREATE_ALWAYS)) {
- // In this mode, the queue must not already exist as we are creating it
- if (destination != null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " already exists but has create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
-
- // Create the queue
- destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_IF_NOT_EXIST)) {
- // In this mode, the queue may nor may not exist. It will be created if it does not exist
- if (destination == null) {
- destination = jmsResourceFactory.createDestination(jmsBinding.getDestinationName());
- }
-
- } else if (qCreateMode.equals(JMSBindingConstants.CREATE_NEVER)) {
- // In this mode, the queue must have already been created.
- if (destination == null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " not found but create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
- }
-
- // Make sure we ended up with a queue
- if (destination == null) {
- throw new JMSBindingException("JMS Destination " + jmsBinding.getDestinationName()
- + " not found with create mode of \""
- + qCreateMode
- + "\" while registering service "
- + serviceName
- + " listener");
- }
-
- return destination;
- }
-
- public String getDestinationName() {
- try {
- if (destination instanceof Queue) {
- return ((Queue)destination).getQueueName();
- } else if (destination instanceof Topic) {
- return ((Topic)destination).getTopicName();
- } else {
- return null;
- }
- } catch (JMSException e) {
- throw new JMSBindingException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSHostExtensionPointImpl.java b/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSHostExtensionPointImpl.java
deleted file mode 100644
index 140a53254e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSHostExtensionPointImpl.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.host.jms.asf;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerFactory;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-public class JMSHostExtensionPointImpl implements JMSHostExtensionPoint {
-
- private JMSServiceListenerFactory jmsServiceListenerFactory;
-
- public JMSHostExtensionPointImpl(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
- this.jmsServiceListenerFactory = new JMSServiceListenerFactoryImpl(workScheduler);
- }
-
- public JMSServiceListenerFactory getJMSServiceListenerFactory() {
- return jmsServiceListenerFactory;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java b/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.java
deleted file mode 100644
index 16cfb545e2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/JMSServiceListenerFactoryImpl.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.host.jms.asf;
-
-import javax.jms.MessageListener;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException;
-import org.apache.tuscany.sca.binding.jms.provider.JMSBindingServiceBindingProvider;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.host.jms.JMSServiceListener;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerDetails;
-import org.apache.tuscany.sca.host.jms.JMSServiceListenerFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-public class JMSServiceListenerFactoryImpl implements JMSServiceListenerFactory {
-
- private WorkScheduler workScheduler;
-
- public JMSServiceListenerFactoryImpl(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- }
-
- public JMSServiceListener createJMSServiceListener(JMSServiceListenerDetails jmsSLD) {
- try {
-
- JMSResourceFactory rf = ((JMSBindingServiceBindingProvider)jmsSLD).getResourceFactory();
-
- MessageListener listener = new ServiceInvoker(jmsSLD.getJmsBinding(), jmsSLD.getService(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
- RuntimeComponentService service = jmsSLD.getService();
-
- return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
-
- } catch (NamingException e) {
- throw new JMSBindingException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java b/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java
deleted file mode 100644
index 45c47c7129..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/java/org/apache/tuscany/sca/host/jms/asf/ServiceInvoker.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.jms.asf;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.naming.NamingException;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessor;
-import org.apache.tuscany.sca.binding.jms.provider.JMSMessageProcessorUtil;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
-import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactoryImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * TODO RRB experiement
- * Listener for the JMSBinding.
- *
- * @version $Rev: 721811 $ $Date: 2008-11-30 13:46:51 +0000 (Sun, 30 Nov 2008) $
- */
-public class ServiceInvoker implements MessageListener {
-
- private static final Logger logger = Logger.getLogger(ServiceInvoker.class.getName());
-
- private JMSBinding jmsBinding;
- private Binding targetBinding;
- private JMSResourceFactory jmsResourceFactory;
- private RuntimeComponentService service;
- private MessageFactory messageFactory;
-
- public ServiceInvoker(JMSBinding jmsBinding, RuntimeComponentService service, Binding targetBinding, MessageFactory messageFactory, JMSResourceFactory rf) throws NamingException {
- this.jmsBinding = jmsBinding;
- this.jmsResourceFactory = rf;
- this.service = service;
- this.targetBinding = targetBinding;
- this.messageFactory = messageFactory;
-
- }
-
- public void onMessage(Message requestJMSMsg) {
- logger.log(Level.FINE, "JMS service '" + service.getName() + "' received message " + requestJMSMsg);
- try {
- invokeService(requestJMSMsg);
- } catch (Throwable e) {
- logger.log(Level.SEVERE, "Exception send fault response '" + service.getName(), e);
- }
- }
-
- protected void invokeService(Message requestJMSMsg) throws JMSException, InvocationTargetException {
-
- // create the tuscany message
- org.apache.tuscany.sca.invocation.Message tuscanyMsg = messageFactory.createMessage();
-
- // populate the message context with JMS binding information
- JMSBindingContext context = new JMSBindingContext();
- tuscanyMsg.setBindingContext(context);
-
- context.setJmsMsg(requestJMSMsg);
- context.setJmsResourceFactory(jmsResourceFactory);
- context.setReplyToDestination(requestJMSMsg.getJMSReplyTo());
-
- // set the message body
- tuscanyMsg.setBody(requestJMSMsg);
-
- // call the runtime wire - the response is handled by the
- // transport interceptor
- service.getRuntimeWire(targetBinding).invoke(tuscanyMsg);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint b/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint
deleted file mode 100644
index f366f27e91..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms-asf/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.jms.JMSHostExtensionPoint
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.host.jms.asf.JMSHostExtensionPointImpl
-
diff --git a/branches/sca-java-1.5.1/modules/host-jms/LICENSE b/branches/sca-java-1.5.1/modules/host-jms/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/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-java-1.5.1/modules/host-jms/NOTICE b/branches/sca-java-1.5.1/modules/host-jms/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-jms/pom.xml b/branches/sca-java-1.5.1/modules/host-jms/pom.xml
deleted file mode 100644
index 024fb4a0b8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/pom.xml
+++ /dev/null
@@ -1,77 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-jms</artifactId>
- <name>Apache Tuscany SCA JMS Host Extension Point</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jms</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <scope>provided</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.http</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.http*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSHostExtensionPoint.java
deleted file mode 100644
index 86ea6a6ae6..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSHostExtensionPoint.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.host.jms;
-
-
-public interface JMSHostExtensionPoint {
-
- JMSServiceListenerFactory getJMSServiceListenerFactory();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListener.java b/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListener.java
deleted file mode 100644
index 27013d8a3d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListener.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.host.jms;
-
-public interface JMSServiceListener {
-
- void start();
-
- void stop();
-
- String getDestinationName();
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerDetails.java b/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerDetails.java
deleted file mode 100644
index 4dc5214525..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerDetails.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.host.jms;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.binding.jms.impl.JMSBinding;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-public interface JMSServiceListenerDetails {
-
- JMSBinding getJmsBinding();
-
- Binding getTargetBinding();
-
- RuntimeComponentService getService();
-
- RuntimeComponent getComponent();
-
- MessageFactory getMessageFactory();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerFactory.java b/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerFactory.java
deleted file mode 100644
index a71df420b5..0000000000
--- a/branches/sca-java-1.5.1/modules/host-jms/src/main/java/org/apache/tuscany/sca/host/jms/JMSServiceListenerFactory.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.host.jms;
-
-
-public interface JMSServiceListenerFactory {
-
- JMSServiceListener createJMSServiceListener(JMSServiceListenerDetails jmsServiceBindingProvider);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/LICENSE b/branches/sca-java-1.5.1/modules/host-rmi/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/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-java-1.5.1/modules/host-rmi/NOTICE b/branches/sca-java-1.5.1/modules/host-rmi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/pom.xml b/branches/sca-java-1.5.1/modules/host-rmi/pom.xml
deleted file mode 100644
index f639ed56eb..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/pom.xml
+++ /dev/null
@@ -1,57 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-rmi</artifactId>
- <name>Apache Tuscany SCA RMI Host Extension Point</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.rmi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.rmi*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java
deleted file mode 100644
index 8985c508fc..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHost.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.rmi;
-
-import java.rmi.AlreadyBoundException;
-import java.rmi.NotBoundException;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.rmi.registry.LocateRegistry;
-import java.rmi.registry.Registry;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * Default implementation of a RMI host.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultRMIHost implements RMIHost {
-
- //map of RMI registries started and running
- private Map<String, Registry> rmiRegistries;
-
- public DefaultRMIHost() {
- rmiRegistries = new ConcurrentHashMap<String, Registry>();
- /*
- * if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }
- */
- }
-
- public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException {
- Registry registry;
- try {
- registry = rmiRegistries.get(Integer.toString(port));
- if (registry == null) {
- try {
- registry = LocateRegistry.getRegistry(port);
- registry.list();
- } catch (RemoteException e) {
- registry = LocateRegistry.createRegistry(port);
- }
- rmiRegistries.put(Integer.toString(port), registry);
- }
- registry.bind(serviceName, serviceObject);
- } catch (AlreadyBoundException e) {
- throw new RMIHostException(e);
- } catch (RemoteException e) {
- RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
- rmiExec.setStackTrace(e.getStackTrace());
- throw rmiExec;
- }
-
- }
-
- public void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException {
- registerService(serviceName, RMI_DEFAULT_PORT, serviceObject);
- }
-
- public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException {
- Registry registry;
-
- try {
- registry = rmiRegistries.get(Integer.toString(port));
- if (registry == null) {
- registry = LocateRegistry.getRegistry(port);
- rmiRegistries.put(Integer.toString(port), registry);
- }
- registry.unbind(serviceName);
- } catch (RemoteException e) {
- RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
- rmiExec.setStackTrace(e.getStackTrace());
- throw rmiExec;
- } catch (NotBoundException e) {
- throw new RMIHostException(e.getMessage());
- }
- }
-
- public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException {
- unregisterService(serviceName, RMI_DEFAULT_PORT);
-
- }
-
- public Remote findService(String host, String port, String svcName) throws RMIHostException,
- RMIHostRuntimeException {
- Registry registry;
- Remote remoteService = null;
- host = (host == null || host.length() <= 0) ? "localhost" : host;
- int portNumber = (port == null || port.length() <= 0) ? RMI_DEFAULT_PORT : Integer.decode(port);
-
- try {
- // Requires permission java.net.SocketPermission "host:port", "connect,accept,resolve"
- // in security policy.
- registry = LocateRegistry.getRegistry(host, portNumber);
-
- if (registry != null) {
- remoteService = registry.lookup(svcName);
- }
- } catch (RemoteException e) {
- RMIHostRuntimeException rmiExec = new RMIHostRuntimeException(e.getMessage());
- rmiExec.setStackTrace(e.getStackTrace());
- throw rmiExec;
- } catch (NotBoundException e) {
- throw new RMIHostException(e.getMessage());
- }
- return remoteService;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.java
deleted file mode 100644
index 3ac086a2ee..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/DefaultRMIHostExtensionPoint.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.host.rmi;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Default implementation of an RMI host extension point.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultRMIHostExtensionPoint implements RMIHostExtensionPoint {
-
- private List<RMIHost> rmiHosts = new ArrayList<RMIHost>();
-
- public DefaultRMIHostExtensionPoint() {
- addRMIHost(new DefaultRMIHost());
- }
-
- public void addRMIHost(RMIHost rmiHost) {
- rmiHosts.add(rmiHost);
- }
-
- public void removeRMIHost(RMIHost rmiHost) {
- rmiHosts.remove(rmiHost);
- }
-
- public List<RMIHost> getRMIHosts() {
- return rmiHosts;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
deleted file mode 100644
index 32fe6c2deb..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/ExtensibleRMIHost.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.rmi;
-
-import java.rmi.Remote;
-
-
-/**
- * Default implementation of an extensible RMI host.
- *
- * @version $Rev$ $Date$
- */
-public class ExtensibleRMIHost implements RMIHost {
-
- private RMIHostExtensionPoint rmiHosts;
-
- public ExtensibleRMIHost(RMIHostExtensionPoint rmiHosts) {
- this.rmiHosts = rmiHosts;
- }
-
- public void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
- if (rmiHosts.getRMIHosts().isEmpty()) {
- throw new RMIHostException("No RMI host available");
- }
- rmiHosts.getRMIHosts().get(0).registerService(serviceName, port, serviceObject);
- }
-
- public Remote findService(String host, String port, String svcName) throws RMIHostException, RMIHostRuntimeException {
- if (rmiHosts.getRMIHosts().isEmpty()) {
- throw new RMIHostException("No RMI host available");
- }
- return rmiHosts.getRMIHosts().get(0).findService(host, port, svcName);
- }
-
- public void registerService(String serviceName, Remote serviceObject) throws RMIHostException, RMIHostRuntimeException {
- if (rmiHosts.getRMIHosts().isEmpty()) {
- throw new RMIHostException("No RMI host available");
- }
- rmiHosts.getRMIHosts().get(0).registerService(serviceName, serviceObject);
- }
-
- public void unregisterService(String serviceName) throws RMIHostException, RMIHostRuntimeException {
- if (rmiHosts.getRMIHosts().isEmpty()) {
- throw new RMIHostException("No RMI host available");
- }
- rmiHosts.getRMIHosts().get(0).unregisterService(serviceName);
- }
-
- public void unregisterService(String serviceName, int port) throws RMIHostException, RMIHostRuntimeException {
- if (rmiHosts.getRMIHosts().isEmpty()) {
- throw new RMIHostException("No RMI host available");
- }
- rmiHosts.getRMIHosts().get(0).unregisterService(serviceName, port);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
deleted file mode 100644
index 59377de22a..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHost.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.rmi;
-
-import java.rmi.Remote;
-
-/**
- * RMI Service hosting interface to be implemented by host environments that allows SCA Components
- * to register RMI Services to handle inbound service requests over RMI to SCA Components
- *
- * @version $Rev$ $Date$
- */
-public interface RMIHost {
- int RMI_DEFAULT_PORT = 1099;
-
- /**
- * Register an RMI service with the given name and port
- *
- * @param serviceName against which the server is to be registered
- * @param port the port against which the server is to be registered
- * @param serviceObject the server object to be registered
- * @throws RMIHostException
- * @throws RMIHostRuntimeException
- */
- void registerService(String serviceName, int port, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException;
-
- /**
- * Register an RMI service with the given name and default port (1099)
- *
- * @param serviceName serviceName against which the server is to be registered
- * @param serviceObject the server object to be registered
- * @throws RMIHostException
- * @throws RMIHostRuntimeException
- */
- void registerService(String serviceName, Remote serviceObject) throws RMIHostException,
- RMIHostRuntimeException;
-
- /**
- * Unregister a service registered under the given service name and port number
- *
- * @param serviceName serviceName against which the server is to be registered
- * @param port the port against which the server is to be registered
- * @throws RMIHostException
- * @throws RMIHostRuntimeException
- */
- void unregisterService(String serviceName, int port) throws RMIHostException,
- RMIHostRuntimeException;
-
- /**
- * Unregister a service registered under the given service name and default port number (1099)
- *
- * @param serviceName the name of the service that has to be unregistered
- * @throws RMIHostException
- * @throws RMIHostRuntimeException
- */
- void unregisterService(String serviceName) throws RMIHostException,
- RMIHostRuntimeException;
-
-
- /**
- * find a remote service hosted on the given host, port and service name
- *
- * @param host the name of the host on which the RMI service to be unregistered is running
- * @param port the port against which the server is to be unregistered is running
- * @param svcName serviceName against which the server is to be unregistered is running
- * @return the RMI server object
- * @throws RMIHostException
- * @throws RMIHostRuntimeException
- */
- Remote findService(String host, String port, String svcName) throws RMIHostException,
- RMIHostRuntimeException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.java
deleted file mode 100644
index 959eb72f6e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostException.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.host.rmi;
-
-
-/**
- * This exception will relate to situations where the end applicaition's input is the cause of the exception
- *
- * @version $Rev: 486986 $ $Date: 2006-12-14 11:48:28 +0530 (Thu, 14 Dec 2006) $
- */
-public class RMIHostException extends RuntimeException {
-
- private static final long serialVersionUID = 3378300080918544410L;
-
- public RMIHostException() {
- }
-
- public RMIHostException(String message) {
- super(message);
- }
-
- public RMIHostException(Throwable e) {
- super(e);
- }
-
- public RMIHostException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.java
deleted file mode 100644
index 40d6013940..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostExtensionPoint.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.host.rmi;
-
-import java.util.List;
-
-/**
- * An extension point for RMI hosts.
- *
- * @version $Rev$ $Date$
- */
-public interface RMIHostExtensionPoint {
-
- /**
- * Adds a Servlet host extension.
- *
- * @param rmiHost
- */
- void addRMIHost(RMIHost rmiHost);
-
- /**
- * Removes a Servlet host extension.
- *
- * @param rmiHost
- */
- void removeRMIHost(RMIHost rmiHost);
-
- /**
- * Returns a list of Servlet host extensions.
- *
- * @return
- */
- List<RMIHost> getRMIHosts();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java b/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.java
deleted file mode 100644
index 998287f998..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/java/org/apache/tuscany/sca/host/rmi/RMIHostRuntimeException.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.host.rmi;
-
-
-/**
- * This exception relates to cases where there is a problem with the
- * Host runtime
- *
- * @version $Rev$ $Date$
- */
-public class RMIHostRuntimeException extends RuntimeException {
-
- private static final long serialVersionUID = -2639598547028423686L;
-
- public RMIHostRuntimeException() {
- }
-
- public RMIHostRuntimeException(String message) {
- super(message);
- }
-
- public RMIHostRuntimeException(Throwable e) {
- super(e);
- }
-
- public RMIHostRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint b/branches/sca-java-1.5.1/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint
deleted file mode 100644
index 014c5391b8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/main/resources/META-INF/services/org.apache.tuscany.sca.host.rmi.RMIHostExtensionPoint
+++ /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.host.rmi.DefaultRMIHostExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java b/branches/sca-java-1.5.1/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java
deleted file mode 100644
index 04d4d0f3cb..0000000000
--- a/branches/sca-java-1.5.1/modules/host-rmi/src/test/java/org/apache/tuscany/sca/host/rmi/RMIHostImplTestCase.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.host.rmi;
-
-import java.io.Serializable;
-import java.rmi.Remote;
-
-import junit.framework.TestCase;
-
-/**
- * Test cases for the RMI Host.
- *
- * @version $Rev$ $Date$
- */
-public class RMIHostImplTestCase extends TestCase {
-
- public void testInit() {
- new DefaultRMIHost();
- }
-
- public void testFindServiceBadHost() throws RMIHostRuntimeException, RMIHostException {
- try {
- new DefaultRMIHost().findService(null, "9994", "$BAD$");
- fail();
- } catch (RMIHostRuntimeException e) {
- // expected
- }
- }
-
- public void testRegisterService1() throws RMIHostRuntimeException, RMIHostException {
- DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("foo1", 9996, new MockRemote());
- host.unregisterService("foo1", 9996);
- }
-
- public void testExistingRegistry() throws RMIHostRuntimeException, RMIHostException {
- DefaultRMIHost host1 = new DefaultRMIHost();
- host1.registerService("foo1", 9995, new MockRemote());
- DefaultRMIHost host2 = new DefaultRMIHost();
- host2.registerService("foo2", 9995, new MockRemote());
- host2.unregisterService("foo1", 9995);
- host2.unregisterService("foo2", 9995);
- }
-
- public void testRegisterService2() throws RMIHostRuntimeException, RMIHostException {
- DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("bar1", 9999, new MockRemote());
- host.unregisterService("bar1", 9999);
- }
-
- public void testRegisterServiceAlreadyBound() throws RMIHostRuntimeException, RMIHostException {
- DefaultRMIHost host = new DefaultRMIHost();
- host.registerService("bar2", 9997, new MockRemote());
- try {
- host.registerService("bar2", 9997, new MockRemote());
- } catch (RMIHostException e) {
- // expected
- host.unregisterService("bar2", 9997);
- }
- }
-
- public void testUnRegisterService() throws RMIHostRuntimeException, RMIHostException {
- DefaultRMIHost host = new DefaultRMIHost();
- try {
- host.unregisterService("bar3", 9998);
- fail();
- } catch (RMIHostRuntimeException e) {
- // expected
- }
- }
-
- private static class MockRemote implements Remote, Serializable {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/LICENSE b/branches/sca-java-1.5.1/modules/host-tomcat/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/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-java-1.5.1/modules/host-tomcat/NOTICE b/branches/sca-java-1.5.1/modules/host-tomcat/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/pom.xml b/branches/sca-java-1.5.1/modules/host-tomcat/pom.xml
deleted file mode 100644
index 4ad2b7a586..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/pom.xml
+++ /dev/null
@@ -1,87 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-host-tomcat</artifactId>
- <name>Apache Tuscany SCA Tomcat Servlet Host Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>catalina</artifactId>
- <version>6.0.14</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>coyote</artifactId>
- <version>6.0.14</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.tomcat</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.http.tomcat*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java
deleted file mode 100644
index a0b384d554..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/ServletWrapper.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.tomcat;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.catalina.core.StandardWrapper;
-
-/**
- * A Servlet wrapper.
- *
- * @version $Rev$ $Date$
- */
-public class ServletWrapper extends StandardWrapper {
- private static final long serialVersionUID = 1L;
-
- private final Servlet servlet;
-
- public ServletWrapper(Servlet servlet) {
- this.servlet = servlet;
- }
-
- @Override
- public synchronized Servlet loadServlet() {
- return servlet;
- }
-
- @Override
- public Servlet getServlet() {
- return servlet;
- }
-
- public void initServlet() throws ServletException {
- servlet.init(facade);
- }
-
- public void destroyServlet() {
- servlet.destroy();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.java
deleted file mode 100644
index 5d9b65503a..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatDefaultServlet.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.http.tomcat;
-
-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.Hashtable;
-
-import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
-import javax.naming.directory.BasicAttributes;
-import javax.naming.directory.DirContext;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.catalina.servlets.DefaultServlet;
-import org.apache.naming.resources.FileDirContext;
-import org.apache.naming.resources.ProxyDirContext;
-import org.apache.naming.resources.Resource;
-
-/**
- * DefaultServlet implementation for Tomcat.
- *
- * @version $Rev$ $Date$
- */
-public class TomcatDefaultServlet extends DefaultServlet {
- private static final long serialVersionUID = -7503581551326796573L;
-
- private String documentRoot;
- private ProxyDirContext proxyDirContext;
-
- public TomcatDefaultServlet(String servletPath, String documentRoot) {
- this.documentRoot = documentRoot;
-
- DirContext dirContext;
- URI uri = URI.create(documentRoot);
- if (!"file".equals(uri.getScheme())) {
-
- dirContext = new FileDirContext() {
- @Override
- public Attributes getAttributes(String name) throws NamingException {
- return new BasicAttributes();
- }
-
- @Override
- public Object lookup(String name) throws NamingException {
-
- try {
- final URL url = new URL(TomcatDefaultServlet.this.documentRoot + name);
- return new Resource() {
- @Override
- public InputStream streamContent() throws IOException {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- return connection.getInputStream();
- }
- };
- } catch (MalformedURLException e) {
- throw new NamingException(e.toString());
- }
- }
- };
-
- } else {
- dirContext = new FileDirContext();
- ((FileDirContext)dirContext).setDocBase(uri.getPath());
- }
- proxyDirContext = new ProxyDirContext(new Hashtable(), dirContext);
- resources = proxyDirContext;
- }
-
- @Override
- public void init() throws ServletException {
- super.init();
- resources = proxyDirContext;
- }
-
- @Override
- public void init(ServletConfig servletConfig) throws ServletException {
- super.init(servletConfig);
- resources = proxyDirContext;
- }
-
- @Override
- protected String getRelativePath(HttpServletRequest request) {
- String path = request.getPathInfo();
- if (path == null || path.length() == 0) {
- path = "/";
- }
- return path;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatPolicyBaseRealm.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatPolicyBaseRealm.java
deleted file mode 100644
index 93f49197f2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatPolicyBaseRealm.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.http.tomcat;
-
-import java.security.Principal;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.catalina.realm.RealmBase;
-import org.apache.tuscany.sca.host.http.UserContext;
-
-public class TomcatPolicyBaseRealm extends RealmBase {
- private static final String REALM_NAME = "Tuscany Realm";
-
- private Map<String, UserContext> userMap = new HashMap<String, UserContext>();
-
- public TomcatPolicyBaseRealm(List<UserContext> users) {
- for(UserContext userContext : users) {
- userMap.put(userContext.getUsername(), userContext);
- }
- }
-
- @Override
- protected String getName() {
- return REALM_NAME;
- }
-
- @Override
- protected String getPassword(String username) {
- UserContext userContext = userMap.get(username);
-
- if (userContext != null) {
- return userContext.getPassword();
- }
-
- return null;
- }
-
- @Override
- protected Principal getPrincipal(String username) {
- UserContext userContext = userMap.get(username);
-
- if (userContext != null) {
- Principal principal = new TuscanyPrincipal(userContext.getUsername());
- return principal;
- }
-
- return null;
- }
-
- @Override
- public boolean hasRole(java.security.Principal principal, java.lang.String role) {
- UserContext userContext = userMap.get(principal.getName());
-
- if (userContext != null) {
- if (userContext.getRoles().contains(role)) {
- return true;
- }
- }
-
- return false;
- }
-
-
- class TuscanyPrincipal implements java.security.Principal {
- private final String username;
-
- TuscanyPrincipal(String username) {
- this.username = username;
- }
-
- public String getName() {
- return this.username;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
deleted file mode 100644
index b93747c51c..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/TomcatServer.java
+++ /dev/null
@@ -1,692 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.tomcat;
-
-import java.beans.PropertyChangeListener;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.security.AccessController;
-import java.security.KeyStore;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-import java.util.concurrent.Executor;
-import java.util.logging.Logger;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-
-import org.apache.catalina.Container;
-import org.apache.catalina.Context;
-import org.apache.catalina.Lifecycle;
-import org.apache.catalina.LifecycleException;
-import org.apache.catalina.Loader;
-import org.apache.catalina.connector.Connector;
-import org.apache.catalina.core.StandardContext;
-import org.apache.catalina.core.StandardEngine;
-import org.apache.catalina.core.StandardHost;
-import org.apache.catalina.startup.ContextConfig;
-import org.apache.coyote.http11.Http11Protocol;
-import org.apache.tomcat.util.buf.MessageBytes;
-import org.apache.tomcat.util.http.mapper.MappingData;
-import org.apache.tomcat.util.net.JIoEndpoint;
-import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
-import org.apache.tuscany.sca.host.http.SecurityContext;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * A Tomcat based implementation of ServletHost.
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("deprecation")
-public class TomcatServer implements ServletHost {
- private static final Logger logger = Logger.getLogger(TomcatServer.class.getName());
-
- private int defaultPortNumber = 8080;
- private int defaultSSLPortNumber = 443;
-
- private final class TuscanyLoader implements Loader {
- private final ClassLoader tccl;
- private boolean delegate;
- private boolean reloadable;
- private Container container;
- private List<String> repos = new ArrayList<String>();
- private List<PropertyChangeListener> listeners = new ArrayList<PropertyChangeListener>();
-
- private TuscanyLoader(ClassLoader tccl) {
- this.tccl = tccl;
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- listeners.add(listener);
- }
-
- public void addRepository(String repository) {
- repos.add(repository);
- }
-
- public void backgroundProcess() {
- }
-
- public String[] findRepositories() {
- return repos.toArray(new String[repos.size()]);
- }
-
- public Container getContainer() {
- return container;
- }
-
- public boolean getDelegate() {
- return delegate;
- }
-
- public String getInfo() {
- return "Tuscany Loader for Embedded Tomcat";
- }
-
- public boolean getReloadable() {
- return reloadable;
- }
-
- public boolean modified() {
- return false;
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- listeners.remove(listener);
- }
-
- public void setContainer(Container container) {
- this.container = container;
- }
-
- public void setDelegate(boolean delegate) {
- this.delegate = delegate;
- }
-
- public void setReloadable(boolean reloadable) {
- this.reloadable = reloadable;
- }
-
- public ClassLoader getClassLoader() {
- return tccl;
- }
- }
-
- /**
- * Represents a port and the server that serves it.
- */
- private class Port {
- private StandardEngine engine;
- private StandardHost host;
- private Connector connector;
-
- private Port(StandardEngine engine, StandardHost host, Connector connector) {
- this.engine = engine;
- this.host = host;
- this.connector = connector;
- }
-
- public StandardEngine getEngine() {
- return engine;
- }
-
- public StandardHost getHost() {
- return host;
- }
-
- public Connector getConnector() {
- return connector;
- }
- }
-
- private Map<Integer, Port> ports = new HashMap<Integer, Port>();
-
- private WorkScheduler workScheduler;
-
- private String contextPath = "/";
-
- /**
- * Constructs a new embedded Tomcat server.
- *
- * @param workScheduler the WorkScheduler to use to process requests.
- */
- public TomcatServer(WorkScheduler workScheduler) {
- this.workScheduler = workScheduler;
- }
-
- public void setDefaultPort(int port) {
- defaultPortNumber = port;
- }
-
- public int getDefaultPort() {
- return defaultPortNumber;
- }
-
- /**
- * Stop all the started servers.
- */
- public void stop() throws ServletMappingException {
- if (!ports.isEmpty()) {
- try {
- Set<Entry<Integer, Port>> entries = new HashSet<Entry<Integer, Port>>(ports.entrySet());
- for (Entry<Integer, Port> entry : entries) {
- Port port = entry.getValue();
- port.getConnector().stop();
- port.getEngine().stop();
- ports.remove(entry.getKey());
- }
- } catch (Exception e) {
- throw new ServletMappingException(e);
- }
- }
- }
-
- public void addServletMapping(String suri, Servlet servlet) {
- addServletMapping(suri, servlet, null);
- }
-
- public void addServletMapping(String suri, Servlet servlet, final SecurityContext securityContext) {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = null;
- if(securityContext != null && securityContext.isSSLEnabled()) {
- scheme = "https";
- } else {
- scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- }
-
- int tmpPortNumber = uri.getPort();
- if (tmpPortNumber == -1) {
- if ("http".equals(scheme)) {
- tmpPortNumber = defaultPortNumber;
- } else {
- tmpPortNumber = defaultPortNumber;
- }
- }
-
- final int portNumber = tmpPortNumber;
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
-
- // Create an engine
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- final StandardEngine engine = AccessController.doPrivileged(new PrivilegedAction<StandardEngine>() {
- public StandardEngine run() {
- return new StandardEngine();
- }
- });
-
- engine.setBaseDir("");
- engine.setDefaultHost("localhost");
- engine.setName("engine/" + portNumber);
-
- // Create a host
- final StandardHost host = new StandardHost();
- host.setAppBase("");
- host.setName("localhost");
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- engine.addChild(host);
- return null;
- }
- });
-
- // Create the root context
- StandardContext context = new StandardContext();
- final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- context.setLoader(new TuscanyLoader(tccl));
- // context.setParentClassLoader(tccl.getParent());
- context.setDocBase("");
- context.setPath("");
- ContextConfig config = new ContextConfig();
- ((Lifecycle)context).addLifecycleListener(config);
- host.addChild(context);
-
- // Install an HTTP connector
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws LifecycleException {
- engine.start();
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- // throw (LifecycleException)e.getException();
- throw new ServletMappingException(e);
- }
- Connector connector;
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- try {
- final String protocol = scheme;
- connector = AccessController.doPrivileged(new PrivilegedExceptionAction<CustomConnector>() {
- public CustomConnector run() throws Exception {
- CustomConnector customConnector = new CustomConnector();
- customConnector.setPort(portNumber);
- customConnector.setContainer(engine);
-
- if ("https".equalsIgnoreCase(protocol)) {
- configureSSL(customConnector, securityContext);
- ((Http11Protocol) customConnector.getProtocolHandler()).setSSLEnabled(true);
- }
- customConnector.initialize();
- customConnector.start();
- return customConnector;
- }
-
- private void configureSSL(CustomConnector customConnector, SecurityContext securityContext) {
- String keyStoreType;
- String keyStore;
- String keyStorePass;
-
- String trustStoreType;
- String trustStore;
- String trustStorePass;
-
- if(securityContext == null) {
- keyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
- keyStore = System.getProperty("javax.net.ssl.keyStore");
- keyStorePass = System.getProperty("javax.net.ssl.keyStorePassword");
-
- trustStoreType = System.getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
- trustStore = System.getProperty("javax.net.ssl.trustStore");
- trustStorePass = System.getProperty("javax.net.ssl.trustStorePassword");
- } else {
- keyStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
- keyStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStore");
- keyStorePass = securityContext.getSSLProperties().getProperty("javax.net.ssl.keyStorePassword");
-
- trustStoreType = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStoreType", KeyStore.getDefaultType());
- trustStore = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStore");
- trustStorePass = securityContext.getSSLProperties().getProperty("javax.net.ssl.trustStorePassword");
- }
-
- customConnector.setProperty("protocol", "TLS");
-
- customConnector.setProperty("keytype", keyStoreType);
- customConnector.setProperty("keystore", keyStore);
- customConnector.setProperty("keypass", keyStorePass);
-
- customConnector.setProperty("trusttype", trustStoreType);
- customConnector.setProperty("truststore", trustStore);
- customConnector.setProperty("trustpass", trustStorePass);
-
- customConnector.setProperty("clientauth", "false");
- customConnector.setProtocol("HTTP/1.1");
- customConnector.setScheme(protocol);
- customConnector.setProperty("backlog", "10");
- customConnector.setSecure(true);
- }
- });
- } catch (Exception e) {
- throw new ServletMappingException(e);
- }
- // Keep track of the running server
- port = new Port(engine, host, connector);
- ports.put(portNumber, port);
- }
-
- // Register the Servlet mapping
- String path = uri.getPath();
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- ServletWrapper wrapper;
- if (servlet instanceof DefaultResourceServlet) {
- String defaultServletPath = path;
-
- // Optimize the handling of resource requests, use the Tomcat default Servlet
- // instead of our default resource Servlet
- if (defaultServletPath.endsWith("*")) {
- defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1);
- }
- if (defaultServletPath.endsWith("/")) {
- defaultServletPath = defaultServletPath.substring(0, defaultServletPath.length() - 1);
- }
- DefaultResourceServlet resourceServlet = (DefaultResourceServlet)servlet;
- TomcatDefaultServlet defaultServlet =
- new TomcatDefaultServlet(defaultServletPath, resourceServlet.getDocumentRoot());
- wrapper = new ServletWrapper(defaultServlet);
-
- } else {
- wrapper = new ServletWrapper(servlet);
- }
- Context context = port.getHost().map(path);
- wrapper.setName(path);
- wrapper.addMapping(path);
- context.addChild(wrapper);
- context.addServletMapping(path, path);
- port.getConnector().getMapper().addWrapper("localhost", "", path, wrapper);
-
- // Initialize the Servlet
- try {
- wrapper.initServlet();
- } catch (ServletException e) {
- throw new ServletMappingException(e);
- }
-
- // Compute the complete URL
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
- URL addedURL;
- try {
- addedURL = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- logger.info("Added Servlet mapping: " + addedURL);
- }
-
- public URL getURLMapping(String suri) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPortNumber;
- }
-
- // Get the host
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
-
- // Construct the URL
- String path = uri.getPath();
-
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (!path.startsWith(contextPath)) {
- path = contextPath + path;
- }
- URL url;
- try {
- url = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- return url;
- }
-
- public Servlet getServletMapping(String suri) throws ServletMappingException {
-
- if (suri == null) {
- return null;
- }
-
- URI uri = URI.create(suri);
-
- // Get the URI port
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPortNumber;
- }
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
- return null;
- }
-
- String mapping = uri.getPath();
-
- if (!mapping.startsWith("/")) {
- mapping = '/' + mapping;
- }
-
- if (!mapping.startsWith(contextPath)) {
- mapping = contextPath + mapping;
- }
-
- final Context context = port.getHost().map(mapping);
- final MappingData md = new MappingData();
- final MessageBytes mb = MessageBytes.newInstance();
- mb.setString(mapping);
- try {
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- context.getMapper().map(mb, md);
- return null;
- }
- });
- } catch (Exception e) {
- return null;
- }
- if (md.wrapper instanceof ServletWrapper) {
- ServletWrapper servletWrapper = (ServletWrapper)md.wrapper;
- return servletWrapper.getServlet();
- } else {
- return null;
- }
- }
-
- public Servlet removeServletMapping(String suri) {
- URI uri = URI.create(suri);
-
- // Get the URI port
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPortNumber;
- }
-
- // Get the port object associated with the given port number
- Port port = ports.get(portNumber);
- if (port == null) {
- throw new IllegalStateException("No servlet registered at this URI: " + suri);
- }
-
- String mapping = uri.getPath();
-
- if (!mapping.startsWith("/")) {
- mapping = '/' + mapping;
- }
-
- if (!mapping.startsWith(contextPath)) {
- mapping = contextPath + mapping;
- }
-
- final Context context = port.getHost().map(mapping);
- final MappingData md = new MappingData();
- final MessageBytes mb = MessageBytes.newInstance();
- mb.setString(mapping);
- try {
- // Allow privileged access to read properties. Requires PropertiesPermission read in
- // security policy.
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- context.getMapper().map(mb, md);
- return null;
- }
- });
- } catch (Exception e) {
- return null;
- }
- if (md.wrapper instanceof ServletWrapper) {
- ServletWrapper servletWrapper = (ServletWrapper)md.wrapper;
-
- port.getConnector().getMapper().removeWrapper("localhost", "", mapping);
-
- try {
- context.removeServletMapping(mapping);
- } catch (NegativeArraySizeException e) {
- // JIRA TUSCANY-1599
- // FIXME Looks like a bug in Tomcat when removing the last
- // Servlet in the list, catch the exception for now as it doesn't
- // seem harmful, will find a better solution for the next release
- }
- context.removeChild(servletWrapper);
- try {
- servletWrapper.destroyServlet();
- } catch (Exception ex) {
- // Hack to handle destruction of Servlets without Servlet context
- }
-
- logger.info("Removed Servlet mapping: " + suri);
-
- // Stop the port if there's no servlets on it anymore
- String[] contextNames = port.getConnector().getMapper().getContextNames();
- if (contextNames == null || contextNames.length == 0) {
- try {
- port.getConnector().stop();
- port.getEngine().stop();
- ports.remove(portNumber);
- } catch (LifecycleException e) {
- throw new IllegalStateException(e);
- }
- }
-
- return servletWrapper.getServlet();
- } else {
- logger.warning("Trying to Remove servlet mapping: " + mapping + " where mapping is not registered");
- return null;
- }
- }
-
- public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
- //FIXME implement this later
- return null;
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- /**
- * A custom connector that uses our WorkScheduler to schedule
- * worker threads.
- */
- private class CustomConnector extends Connector {
-
- private class CustomHttpProtocolHandler extends Http11Protocol {
-
- /**
- * An Executor wrapping our WorkScheduler
- */
- private class WorkSchedulerExecutor implements Executor {
- public void execute(Runnable command) {
- workScheduler.scheduleWork(command);
- }
- }
-
- /**
- * A custom Endpoint that waits for its acceptor thread to
- * terminate before stopping.
- */
- private class CustomEndpoint extends JIoEndpoint {
- private Thread acceptorThread;
-
- private class CustomAcceptor extends Acceptor {
- CustomAcceptor() {
- super();
- }
- }
-
- @Override
- public void start() throws Exception {
- if (!initialized)
- init();
- if (!running) {
- running = true;
- paused = false;
- acceptorThread = new Thread(new CustomAcceptor(), getName() + "-Acceptor-" + 0);
- acceptorThread.setPriority(threadPriority);
- acceptorThread.setDaemon(daemon);
- acceptorThread.start();
- }
- }
-
- @Override
- public void stop() {
- super.stop();
- try {
- acceptorThread.join();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public int getCurrentThreadsBusy() {
- return 0;
- }
- }
-
- CustomHttpProtocolHandler() {
- endpoint = new CustomEndpoint();
- endpoint.setExecutor(new WorkSchedulerExecutor());
- }
- }
-
- CustomConnector() throws Exception {
- protocolHandler = new CustomHttpProtocolHandler();
- }
- }
-
- public void setContextPath(String path) {
- this.contextPath = path;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java
deleted file mode 100644
index 070dffdce6..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/java/org/apache/tuscany/sca/http/tomcat/module/TomcatRuntimeModuleActivator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.http.tomcat.module;
-
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.http.tomcat.TomcatServer;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TomcatRuntimeModuleActivator implements ModuleActivator {
-
- private TomcatServer server;
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- // Register a Tomcat Servlet host
- ServletHostExtensionPoint servletHosts =
- extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
-
- if (servletHosts.getServletHosts().size() < 1) {
- UtilityExtensionPoint utilities = extensionPointRegistry.getExtensionPoint(UtilityExtensionPoint.class);
- final WorkScheduler workScheduler = utilities.getUtility(WorkScheduler.class);
- // Allow privileged access to start MBeans. Requires MBeanPermission in security policy.
- server = AccessController.doPrivileged(new PrivilegedAction<TomcatServer>() {
- public TomcatServer run() {
- return new TomcatServer(workScheduler);
- }
- });
- servletHosts.addServletHost(server);
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- // Allow privileged access to stop MBeans. Requires MBeanPermission in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- if (server != null) {
- server.stop();
- }
- return null;
- }
- });
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index f0f4e17507..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.http.tomcat.module.TomcatRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java b/branches/sca-java-1.5.1/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
deleted file mode 100644
index afbec52cd9..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/java/org/apache/tuscany/sca/http/tomcat/TomcatServerTestCase.java
+++ /dev/null
@@ -1,353 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.http.tomcat;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.Socket;
-import java.net.URL;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSession;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.http.DefaultResourceServlet;
-import org.apache.tuscany.sca.work.NotificationListener;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TomcatServerTestCase extends TestCase {
-
- private static final String REQUEST1_HEADER =
- "GET /foo HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST1_CONTENT = "";
- private static final String REQUEST1 =
- REQUEST1_HEADER + REQUEST1_CONTENT.getBytes().length + "\n\n" + REQUEST1_CONTENT;
-
- private static final String REQUEST2_HEADER =
- "GET /webcontent/test.html HTTP/1.0\n" + "Host: localhost\n"
- + "Content-Type: text/xml\n"
- + "Connection: close\n"
- + "Content-Length: ";
- private static final String REQUEST2_CONTENT = "";
- private static final String REQUEST2 =
- REQUEST2_HEADER + REQUEST2_CONTENT.getBytes().length + "\n\n" + REQUEST2_CONTENT;
-
- private static final int HTTP_PORT = 8085;
-
- private WorkScheduler workScheduler = new WorkScheduler() {
-
- public <T extends Runnable> void scheduleWork(T work) {
- Thread thread = new Thread(work);
- thread.start();
- }
-
- public <T extends Runnable> void scheduleWork(T work, NotificationListener<T> listener) {
- scheduleWork(work);
- }
-
- public void destroy() {
- }
- };
-
- /**
- * Verifies requests are properly routed according to the Servlet mapping
- */
- public void testRegisterServletMapping() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- service.stop();
- assertTrue(servlet.invoked);
- }
-
- /**
- * Verifies requests are properly routed according to the Servlet mapping
- */
- public void testRegisterServletMappingSSL() throws Exception {
- System.setProperty("javax.net.ssl.keyStore", "target/test-classes/tuscany.keyStore");
- System.setProperty("javax.net.ssl.keyStorePassword", "apache");
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- try {
- service.addServletMapping("https://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- } finally {
- System.clearProperty("javax.net.ssl.keyStore");
- System.clearProperty("javax.net.ssl.keyStorePassword");
- }
- System.setProperty("javax.net.ssl.trustStore", "target/test-classes/tuscany.keyStore");
- System.setProperty("javax.net.ssl.trustStorePassword", "apache");
- URL url = new URL("https://127.0.0.1:8085/foo");
- HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
- conn.setHostnameVerifier(new HostnameVerifier() {
- public boolean verify(String hostname, SSLSession session) {
- return true;
- }}
- );
-
- conn.connect();
- read(conn.getInputStream());
-
- service.stop();
- assertTrue(servlet.invoked);
-
- }
- /**
- * Verifies that Servlets can be registered with multiple ports
- */
- public void testRegisterMultiplePorts() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/", servlet);
- TestServlet servlet2 = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + (HTTP_PORT + 1) + "/", servlet2);
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT + 1);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
-
- service.stop();
- assertTrue(servlet.invoked);
- assertTrue(servlet2.invoked);
- }
-
- public void testUnregisterMapping() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo");
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- service.stop();
- assertFalse(servlet.invoked);
-
- }
-
- public void testRegisterUnregisterMapping() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
- assertTrue(servlet.invoked);
- service.removeServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo");
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
- servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- }
- assertTrue(servlet.invoked);
- service.stop();
- }
-
- public void testRequestSession() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- TestServlet servlet = new TestServlet();
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/foo", servlet);
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- read(client);
- service.stop();
- assertTrue(servlet.invoked);
- assertNotNull(servlet.sessionId);
- }
-
- public void testRestart() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- service.stop();
- service.stop();
- }
-
- public void testNoMappings() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
- Exception ex = null;
- try {
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST1.getBytes());
- os.flush();
- } catch (Exception e) {
- ex = e;
- }
- assertNotNull(ex);
- service.stop();
- }
-
- public void testResourceServlet() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
-
- String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
- documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
- DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
- TestResourceServlet servlet = new TestResourceServlet(resourceServlet);
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", servlet);
-
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST2.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
-
- service.stop();
- }
-
- public void testDefaultServlet() throws Exception {
- TomcatServer service = new TomcatServer(workScheduler);
-
- String documentRoot = getClass().getClassLoader().getResource("content/test.html").toString();
- documentRoot = documentRoot.substring(0, documentRoot.lastIndexOf('/'));
- DefaultResourceServlet resourceServlet = new DefaultResourceServlet(documentRoot);
- service.addServletMapping("http://127.0.0.1:" + HTTP_PORT + "/webcontent/*", resourceServlet);
-
- Socket client = new Socket("127.0.0.1", HTTP_PORT);
- OutputStream os = client.getOutputStream();
- os.write(REQUEST2.getBytes());
- os.flush();
-
- String document = read(client);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
-
- service.stop();
- }
-
- private static String read(Socket socket) throws IOException {
- InputStream is = socket.getInputStream();
- return read(is);
- }
-
- private static String read(InputStream is) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
- private class TestServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- boolean invoked;
- String sessionId;
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- invoked = true;
- sessionId = req.getSession().getId();
- OutputStream writer = resp.getOutputStream();
- try {
- writer.write("result".getBytes());
- } finally {
- writer.close();
- }
- }
-
- }
-
- private class TestResourceServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
- private HttpServlet delegate;
-
- public TestResourceServlet(HttpServlet delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public void init() throws ServletException {
- super.init();
- delegate.init();
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- super.init();
- delegate.init(config);
- }
-
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- delegate.service(req, resp);
- }
-
- @Override
- public void destroy() {
- super.destroy();
- delegate.destroy();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/content/test.html b/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/content/test.html
deleted file mode 100644
index f4b79d7f01..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/content/test.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<body><p>hello</body>
-</html> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/tuscany.keyStore b/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/tuscany.keyStore
deleted file mode 100644
index 7ea23f7ff4..0000000000
--- a/branches/sca-java-1.5.1/modules/host-tomcat/src/test/resources/tuscany.keyStore
+++ /dev/null
Binary files differ
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/LICENSE b/branches/sca-java-1.5.1/modules/host-webapp/LICENSE
deleted file mode 100644
index 1ae723e052..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/LICENSE
+++ /dev/null
@@ -1,241 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-===============================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-===============================================================================
-The module host-webapp includes files under the following license:
-
-Permission to copy, display and distribute the Service Component Architecture Specification and/or
-portions thereof, without modification, in any medium without fee or royalty is hereby granted, provided
-that you include the following on ALL copies of the Service Component Architecture Specification, or
-portions thereof, that you make:
-
-1. A link or URL to the Service Component Architecture Specification at this location:
- http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
-
-2. The full text of the copyright notice as shown in the Service Component Architecture Specification.
-
-BEA, Cape Clear, IBM, Interface21, IONA, Oracle, Primeton, Progress Software, Red Hat, Rogue Wave,
-SAP, Siemens, Software AG., Sun, Sybase, TIBCO (collectively, the "Authors") agree to grant you a
-royalty-free license, under reasonable, non-discriminatory terms and conditions to patents that they deem
-necessary to implement the Service Component Architecture Specification.
-THE Service Component Architecture SPECIFICATION IS PROVIDED "AS IS," AND THE
-AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
-REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS CONTENTS,
-INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE, NON-INFRINGEMENT OR TITLE.
-THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL
-OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR
-DISTRIBUTION OF THE Service Components Architecture SPECIFICATION.
-The name and trademarks of the Authors may NOT be used in any manner, including advertising or
-publicity pertaining to the Service Component Architecture Specification or its contents without specific,
-
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/NOTICE b/branches/sca-java-1.5.1/modules/host-webapp/NOTICE
deleted file mode 100644
index d989435591..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/NOTICE
+++ /dev/null
@@ -1,12 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product also includes software under the Service Component Architecture specification license
-(see the LICENSE file contained in this distribution) with the following copyright
-
-(c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA
-Technologies, Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens
-AG., Software AG., Sun Microsystems, Inc., Sybase Inc., TIBCO Software Inc., 2005, 2008. All rights reserved.
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/pom.xml b/branches/sca-java-1.5.1/modules/host-webapp/pom.xml
deleted file mode 100644
index 5da05ce1f8..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/pom.xml
+++ /dev/null
@@ -1,101 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-host-webapp</artifactId>
- <name>Apache Tuscany SCA Webapp Host</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>avalon-framework</groupId>
- <artifactId>avalon-framework</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jsp_2.1_spec</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.host.webapp</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.host.webapp*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java
deleted file mode 100644
index d7ff73e31f..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/HotUpdateContextListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.webapp;
-
-import java.io.File;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-
-import org.apache.tuscany.sca.host.embedded.impl.HotUpdatableSCADomain;
-
-/**
- * A WebApp ContextListener that starts a Tuscany runtime supporting multiple
- * SCA contribution jars. All contribution jars found in the repository
- * directory named "sca-contributions" will be contributed to the SCA
- * domain. Any changes to the contributions in the repository will be
- * automatically detected and the SCADomain updated accordingly.
- *
- * @version $Rev$ $Date$
- */
-public class HotUpdateContextListener extends TuscanyContextListener {
-
- public static final String REPOSITORY_FOLDER_NAME = "sca-contributions";
-
- @Override
- public void contextInitialized(ServletContextEvent event) {
- ServletContext servletContext = event.getServletContext();
-
- // TODO better domaiURI, maybe based on webapp name?
- String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
-
- File repository = new File(servletContext.getRealPath(REPOSITORY_FOLDER_NAME));
- HotUpdatableSCADomain scaDomain = new HotUpdatableSCADomain(domainURI, repository, 2000);
-
- servletContext.setAttribute(SCADomainHelper.SCA_DOMAIN_ATTRIBUTE, scaDomain);
-
- super.contextInitialized(event);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.java
deleted file mode 100644
index 2dbd7e9aa1..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/SCADomainHelper.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.host.webapp;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.servlet.ServletContext;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * Utility class to initialize the SCADomian associated with a webapp
- *
- * @version $Rev$ $Date$
- * @deprecated Not necessary anymore with TuscanyServletFilter
- */
-@Deprecated
-public class SCADomainHelper {
-
- static final String SCA_DOMAIN_ATTRIBUTE = "org.apache.tuscany.sca.SCADomain";
-
- /**
- * Initializes the SCADomian associated with a webapp context. If a SCADomain
- * doesn't exist already then one is create based on the webapp config.
- */
- static SCADomain initSCADomain(ServletContext servletContext) {
- SCADomain scaDomain = (SCADomain)servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE);
-
- String domainURI = "http://localhost/" + servletContext.getServletContextName().replace(' ', '.');
- String contributionRoot = null;
-
- try {
- URL rootURL = servletContext.getResource("/");
- if (rootURL.getProtocol().equals("jndi")) {
- //this is Tomcat case, we should use getRealPath
- File warRootFile = new File(servletContext.getRealPath("/"));
- contributionRoot = warRootFile.toURL().toString();
- } else {
- //this is Jetty case
- contributionRoot = rootURL.toString();
- }
- } catch(MalformedURLException mf) {
- //ignore, pass null
- }
-
-
- if (scaDomain == null) {
- scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
- servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
- }
- return scaDomain;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java
deleted file mode 100644
index 593073b068..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyContextListener.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.webapp;
-
-import java.util.Enumeration;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-import javax.servlet.ServletException;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * A ServletContextListener to create and close the SCADomain
- * when the webapp is initialized or destroyed.
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyContextListener implements ServletContextListener {
-
- public void contextInitialized(ServletContextEvent event) {
- final ServletContext servletContext = event.getServletContext();
- try {
- WebAppServletHost.getInstance().init(new ServletConfig() {
- public String getInitParameter(String name) {
- return servletContext.getInitParameter(name);
- }
-
- public Enumeration getInitParameterNames() {
- return servletContext.getInitParameterNames();
- }
-
- public ServletContext getServletContext() {
- return servletContext;
- }
-
- public String getServletName() {
- return null;
- }
- });
- } catch (ServletException e) {
- throw new RuntimeException(e);
- }
- }
-
- public void contextDestroyed(ServletContextEvent event) {
- ServletContext servletContext = event.getServletContext();
- SCADomain scaDomain = (SCADomain) servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
- if (scaDomain != null) {
- scaDomain.close();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.java
deleted file mode 100644
index 559fef73cc..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServlet.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.host.webapp;
-
-import java.io.IOException;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * A Servlet that forwards requests to the Servlets registered with the Tuscany
- * ServletHost.
- *
- * @version $Rev$ $Date$
- * @deprecated Not needed anymore, TuscanyServletFilter is sufficient
- */
-@Deprecated
-public class TuscanyServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
- private transient WebAppServletHost servletHost;
-
- @Override
- public void init(ServletConfig config) throws ServletException {
- ServletContext servletContext = config.getServletContext();
- SCADomainHelper.initSCADomain(servletContext);
-
- // TODO: must be a better way to get this than using a static
- servletHost = WebAppServletHost.getInstance();
- servletHost.init(config);
- }
-
- @Override
- public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
- String path = ((HttpServletRequest)req).getPathInfo();
- RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
- if (dispatcher == null) {
- throw new IllegalStateException("No servlet registered for path: " + path);
- }
-
- dispatcher.forward(req, res);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.java
deleted file mode 100644
index 2395ba0c66..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/TuscanyServletFilter.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.host.webapp;
-
-import java.io.IOException;
-import java.util.Enumeration;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * A Servlet filter that forwards service requests to the Servlets registered with
- * the Tuscany ServletHost.
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyServletFilter implements Filter {
- private static final long serialVersionUID = 1L;
- //private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
-
- private WebAppServletHost servletHost;
-
- public void init(final FilterConfig config) throws ServletException {
- // TODO: must be a better way to get this than using a static
- servletHost = WebAppServletHost.getInstance();
-
- // Initialize the Servlet host
- servletHost.init(new ServletConfig() {
- public String getInitParameter(String name) {
- return config.getInitParameter(name);
- }
-
- public Enumeration getInitParameterNames() {
- return config.getInitParameterNames();
- }
-
- public ServletContext getServletContext() {
- return config.getServletContext();
- }
-
- public String getServletName() {
- return config.getFilterName();
- }
- });
- }
-
- public void destroy() {
- WebAppServletHost.getInstance().destroy();
- servletHost = null;
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
- throws IOException, ServletException {
-
- // Get the Servlet path
- HttpServletRequest httpRequest = (HttpServletRequest)request;
- String path = httpRequest.getPathInfo();
- if (path == null) {
- path = httpRequest.getServletPath();
- }
- if (path == null) {
- path = "/";
- }
-
- // Get a request dispatcher for the Servlet mapped to that path
- RequestDispatcher dispatcher = servletHost.getRequestDispatcher(path);
- if (dispatcher != null) {
-
- // Let the dispatcher forward the request to the Servlet
- dispatcher.forward(request, response);
-
- } else {
-
- // Proceed down the filter chain
- chain.doFilter(request, response);
-
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.java
deleted file mode 100644
index c10e5e7b5a..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppModuleActivator.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.host.webapp;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-
-/**
- * Activates the webapp host by registering the webapp ServletHost impl
- *
- * @version $Rev$ $Date$
- */
-public class WebAppModuleActivator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry extensionPointRegistry) {
-
- ServletHostExtensionPoint servletHosts =
- extensionPointRegistry.getExtensionPoint(ServletHostExtensionPoint.class);
-
- List<ServletHost> hosts = servletHosts.getServletHosts();
- if (isRunningInWebapp()) {
- if (hosts.size() > 0) {
- hosts.removeAll(hosts);
- }
- servletHosts.addServletHost(WebAppServletHost.getInstance());
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- // as we know we are running in a webapp remove all of the servlet
- // hosts. There will just be one - see start method
- ServletHostExtensionPoint servletHosts =
- registry.getExtensionPoint(ServletHostExtensionPoint.class);
- List<ServletHost> hosts = servletHosts.getServletHosts();
- hosts.clear();
- }
-
- /**
- * TODO: this seems a bit of a hacky way to find if its running in a webapp
- * is there a better way?
- */
- private boolean isRunningInWebapp() {
- for (StackTraceElement ste : new Exception().getStackTrace()) {
- if (ste.getClassName().equals(WebSCADomain.class.getName())) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.java
deleted file mode 100644
index f14dfac58b..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppRequestDispatcher.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.host.webapp;
-
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-/**
- * A Servlet request dispatcher that can be used to delegate requests to a
- * Servlet registered with the Webapp Servlet host.
- *
- * @version $Rev$ $Date$
- */
-class WebAppRequestDispatcher implements RequestDispatcher {
- private String servletPath;
- private Servlet servlet;
-
- public WebAppRequestDispatcher(String mapping, Servlet servlet) {
- if (mapping.endsWith("*")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- if (mapping.endsWith("/")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- this.servletPath = mapping;
- this.servlet = servlet;
- }
-
- /**
- * Returns a request wrapper which will return the correct Servlet path
- * and path info.
- *
- * @param request
- * @return
- */
- private HttpServletRequest createRequestWrapper(ServletRequest request) {
- HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
-
- @Override
- public String getServletPath() {
- return servletPath;
- }
-
- @Override
- public String getPathInfo() {
- String path = super.getServletPath();
- if (path.length() == 0) {
- path = super.getPathInfo();
- }
-
- // TODO: another context path hack, revisit when context path is sorted out
- path = fiddlePath(path, servletPath);
-
- return path;
- }
- };
- return requestWrapper;
- }
-
- /**
- * Remove any path suffix thats part of the Servlet context path
- */
- protected String fiddlePath(String path, String servletPath) {
- StringTokenizer st = new StringTokenizer(path, "/");
- if (st.countTokens() == 1) {
- return path;
- }
- String root = "";
- while (st.hasMoreTokens()){
- String s = st.nextToken();
- if (servletPath.endsWith((root + "/" + s))) {
- root += "/" + s;
- } else {
- break;
- }
- }
- String fiddlePath = path.substring(root.length());
- return fiddlePath;
- }
-
- public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-
- public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-}
-
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
deleted file mode 100644
index 045cae4e75..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebAppServletHost.java
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.webapp;
-
-import java.beans.Introspector;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.host.http.SecurityContext;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-
-/**
- * ServletHost implementation for use in a webapp environment.
- *
- * FIXME: using a static singleton seems a big hack but how should it be shared?
- * Need some way for TuscanyServlet to pull it out.
- *
- * @version $Rev$ $Date$
- */
-public class WebAppServletHost implements ServletHost {
- private static final Logger logger = Logger.getLogger(WebAppServletHost.class.getName());
-
- public static final String SCA_DOMAIN_ATTRIBUTE = "org.apache.tuscany.sca.SCADomain";
-
- private static WebAppServletHost instance = null;
-
- private Map<String, Servlet> servlets;
- private SCADomain scaDomain;
- private String contextPath = "/";
- private int defaultPortNumber = 8080;
- private String contributionRoot;
-
- private ServletContext servletContext;
-
- private WebAppServletHost() {
- servlets = new HashMap<String, Servlet>();
- }
-
- public void setDefaultPort(int port) {
- defaultPortNumber = port;
- }
-
- public int getDefaultPort() {
- return defaultPortNumber;
- }
-
- public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
- addServletMapping(suri, servlet, null);
- }
-
- public void addServletMapping(String suri, Servlet servlet, SecurityContext securityContext) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- servlets.put(suri, servlet);
-
- logger.info("Added Servlet mapping: " + suri);
- }
-
- public Servlet removeServletMapping(String suri) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- return servlets.remove(suri);
- }
-
- public Servlet getServletMapping(String suri) throws ServletMappingException {
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- return servlet;
- }
-
- public URL getURLMapping(String suri) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPortNumber;
- }
-
- // Get the host
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
-
- // Construct the URL
- String path = uri.getPath();
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (contextPath != null && !path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- URL url;
- try {
- url = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- return url;
- }
-
- public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
-
- // Make sure that the path starts with a /
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- suri = contextPath + suri;
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- if (servlet != null) {
- return new WebAppRequestDispatcher(suri, servlet);
- }
-
- for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
- String servletPath = entry.getKey();
- if (servletPath.endsWith("*")) {
- servletPath = servletPath.substring(0, servletPath.length() - 1);
- if (suri.startsWith(servletPath)) {
- // entry key is contextPath/servletPath, WebAppRequestDispatcher only wants servletPath
- return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
- } else {
- if ((suri + "/").startsWith(servletPath)) {
- return new WebAppRequestDispatcher(entry.getKey().substring(contextPath.length()), entry.getValue());
- }
- }
- }
- }
-
- // No Servlet found
- return null;
- }
-
- public static WebAppServletHost getInstance() {
- if (instance == null){
- instance = new WebAppServletHost();
- }
- return instance;
- }
-
- public void init(ServletConfig config) throws ServletException {
-
- servletContext = config.getServletContext();
- if (servletContext.getAttribute(SCA_DOMAIN_ATTRIBUTE) == null) {
- initContextPath(config);
- String domainURI = "http://localhost/" + contextPath;
- contributionRoot = getContributionRoot(servletContext);
- // logger.info("Contribution: " + contributionRoot);
- System.setProperty(SCADomain.class.getName(), WebSCADomain.class.getName());
- this.scaDomain = SCADomain.newInstance(domainURI, contributionRoot);
- servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, scaDomain);
- }
-
- // Initialize the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.init(config);
- }
-
- }
-
- protected String getContributionRoot(ServletContext servletContext) {
- String contributionRoot = null;
- try {
-
- InitialContext ic = new InitialContext();
- URL repoURL = (URL)ic.lookup("java:comp/env/url/contributions");
-
- contributionRoot = repoURL.toString();
-
- } catch (NamingException e) {
-
- // ignore exception and use default location
-
- try {
-
- String root = servletContext.getInitParameter("contributionRoot");
- if (root == null || root.length() < 1) {
- root = "/";
- }
- URL rootURL = servletContext.getResource(root);
- if (rootURL.getProtocol().equals("jndi")) {
- //this is Tomcat case, we should use getRealPath
- File warRootFile = new File(servletContext.getRealPath(root));
- contributionRoot = warRootFile.toURL().toString();
- } else {
- //this is Jetty case
- contributionRoot = rootURL.toString();
- }
-
- } catch (MalformedURLException mf) {
- //ignore, pass null
- }
- }
-
- return contributionRoot;
- }
-
- /**
- * Initializes the contextPath
- * The 2.5 Servlet API has a getter for this, for pre 2.5 Servlet
- * containers use an init parameter.
- */
- @SuppressWarnings("unchecked")
- public void initContextPath(ServletConfig config) {
-
- if (Collections.list(config.getInitParameterNames()).contains("contextPath")) {
- contextPath = config.getInitParameter("contextPath");
- } else {
- // The getContextPath() is introduced since Servlet 2.5
- ServletContext context = config.getServletContext();
- try {
- // Try to get the method anyway since some ServletContext impl has this method even before 2.5
- Method m = context.getClass().getMethod("getContextPath", new Class[] {});
- contextPath = (String)m.invoke(context, new Object[] {});
- } catch (Exception e) {
- logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
- throw new IllegalStateException("'contextPath' init parameter must be set for pre-2.5 servlet container");
- }
- }
-
- logger.info("ContextPath: " + contextPath);
- }
-
- void destroy() {
-
- // Destroy the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.destroy();
- }
-
- // Close the SCA domain
- if (scaDomain != null) {
- scaDomain.close();
- if (scaDomain instanceof WebSCADomain) {
- ((WebSCADomain)scaDomain).destroy();
- }
- servletContext.setAttribute(SCA_DOMAIN_ATTRIBUTE, null);
- scaDomain = null;
- }
-
- servletContext = null;
- instance = null;
- servlets.clear();
- LogFactory.release(this.getClass().getClassLoader());
- Introspector.flushCaches();
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public void setContextPath(String path) {
- // if (!contextPath.equals(path)) {
- // throw new IllegalArgumentException("invalid context path for webapp, existing context path: " + contextPath + " new contextPath: " + path);
- // }
- }
-
- /**
- * TODO: How context paths work is still up in the air so for now
- * this hacks in a path that gets some samples working
- * can't use setContextPath as NodeImpl calls that later
- */
- public void setContextPath2(String path) {
- if (path != null && path.length() > 0) {
- this.contextPath = path;
- }
- }
-
- public String getContributionRoot() {
- return contributionRoot;
- }
-
- public void setAttribute(String name, Object value) {
- servletContext.setAttribute(name, value);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
deleted file mode 100644
index be35733220..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/WebSCADomain.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.webapp;
-
-import org.apache.tuscany.sca.host.embedded.impl.DefaultSCADomain;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WebSCADomain extends DefaultSCADomain {
-
- /**
- * @param runtimeClassLoader
- * @param applicationClassLoader
- * @param domainURI
- * @param contributionLocation
- * @param composites
- */
- public WebSCADomain(ClassLoader runtimeClassLoader,
- ClassLoader applicationClassLoader,
- String domainURI,
- String contributionLocation,
- String... composites) {
- super(runtimeClassLoader, applicationClassLoader, domainURI, contributionLocation, composites);
- }
-
- @Override
- public void close() {
- // Disable the close() as a hack to keep the WebSCADomain open
- }
-
- public void destroy() {
- super.close();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.java
deleted file mode 100644
index 6e1b187a48..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTEI.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.host.webapp.jsp;
-
-import javax.servlet.jsp.tagext.TagData;
-import javax.servlet.jsp.tagext.TagExtraInfo;
-import javax.servlet.jsp.tagext.VariableInfo;
-
-/**
- * TagExtraInfo class for the SCA reference tags
- * <sca:reference name="service" type="test.MyService" scope="1" />
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceTEI extends TagExtraInfo {
-
- @Override
- public VariableInfo[] getVariableInfo(TagData data) {
- VariableInfo info1
- = new VariableInfo(
- data.getAttributeString("name"),
- data.getAttributeString("type"),
- true,
- VariableInfo.AT_END);
- VariableInfo[] info = { info1 } ;
- return info;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java b/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java
deleted file mode 100644
index b7eb93222e..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/java/org/apache/tuscany/sca/host/webapp/jsp/ReferenceTag.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.host.webapp.jsp;
-
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-import javax.servlet.jsp.tagext.TagSupport;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.host.webapp.WebAppServletHost;
-import org.osoa.sca.ComponentContext;
-
-/**
- * Tag to handle SCA references
- * <sca:reference name="service" type="test.MyService" scope="1" />
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceTag extends TagSupport {
- private static final long serialVersionUID = 1L;
-
- protected String name;
- protected String type;
- protected Integer scope = PageContext.PAGE_SCOPE;
-
- @Override
- public int doStartTag() throws JspException {
- return SKIP_BODY;
- }
-
- @Override
- public int doEndTag() throws JspException {
-
- try {
- WebAppServletHost.getInstance().init(pageContext.getServletConfig());
- } catch (ServletException e) {
- throw new JspException("Exception initializing Tuscany webapp: " + e, e);
- }
-
- ServletContext servletContext = pageContext.getServletContext();
- ComponentContext componentContext = (ComponentContext)servletContext.getAttribute("org.osoa.sca.ComponentContext");
- SCADomain scaDomain = null;
- if (componentContext == null) {
- scaDomain = (SCADomain)servletContext.getAttribute(WebAppServletHost.SCA_DOMAIN_ATTRIBUTE);
- if (scaDomain == null) {
- throw new JspException("SCADomain is null. Check Tuscany configuration in web.xml");
- }
- }
-
- Class<?> typeClass;
- try {
- typeClass = Class.forName(type, true, Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException e) {
- throw new JspException("Reference '" + name + "' type class not found: " + type);
- }
-
- Object o;
- try {
- if (componentContext != null) {
- o = componentContext.getService(typeClass, name);
- } else {
- o = scaDomain.getService(typeClass, name);
- }
- } catch (Exception e) {
- throw new JspException("Exception getting service for reference'" + name + "': " + e, e);
- }
- if (o == null) {
- throw new JspException("Reference '" + name + "' not found");
- }
-
- pageContext.setAttribute(name, o, scope);
-
- return EVAL_PAGE;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public Integer getScope() {
- return scope;
- }
-
- public void setScope(Integer scope) {
- this.scope = scope;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/sca.tld b/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/sca.tld
deleted file mode 100644
index 21d0ca5d8d..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/sca.tld
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version = '1.0' encoding = 'ISO-8859-1'?>
-<!--
-(c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA
-Technologies, Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens
-AG., Software AG., Sun Microsystems, Inc., Sybase Inc., TIBCO Software Inc., 2005, 2008. All rights reserved.
-
-see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- -->
-
-<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
-
- <tlib-version>1.0</tlib-version>
- <short-name>SCA-JSP</short-name>
- <uri>http://www.osoa.org/sca/sca_jsp.tld</uri>
- <description>A tag library for integrating sca components with jsp</description>
-
- <tag>
-
- <name>reference</name>
-
- <tag-class>org.apache.tuscany.sca.host.webapp.jsp.ReferenceTag</tag-class>
- <tei-class>org.apache.tuscany.sca.host.webapp.jsp.ReferenceTEI</tei-class>
-
- <attribute>
- <name>name</name>
- <required>true</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
-
- <attribute>
- <name>type</name>
- <required>true</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.String</type>
- </attribute>
-
- <attribute>
- <name>scope</name>
- <required>false</required>
- <rtexprvalue>false</rtexprvalue>
- <type>java.lang.Integer</type>
- </attribute>
-
- <body-content>empty</body-content>
-
- </tag>
-
-</taglib>
diff --git a/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 51ff397bf2..0000000000
--- a/branches/sca-java-1.5.1/modules/host-webapp/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.host.webapp.WebAppModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/LICENSE b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/LICENSE
deleted file mode 100644
index baba9ca048..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/LICENSE
+++ /dev/null
@@ -1,251 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-===============================================================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-=================================================================================================================
-
-This module implementation-script temporarily includes one file under the following BSD license:
-
- Copyright (c) 2006, Sun Microsystems, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- - Neither the name of the Sun Microsystems, Inc. nor the names of
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
-=================================================================================================================
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/NOTICE b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/NOTICE
deleted file mode 100644
index a5023c910d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/NOTICE
+++ /dev/null
@@ -1,17 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-Unless otherwise indicated, all distribution made available by the Apache Software Foundation
-is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
-A copy of the AL is provided with this distribution as the LICENSE file present in the
-root directory, and is also available at http://www.apache.org/licenses/.
-
-This product also includes software under the BSD license
-(see the LICENSE file contained in this distribution), with
-the following copyright:
-
-Copyright (c) 2006, Sun Microsystems, Inc.
-All rights reserved.
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/pom.xml b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/pom.xml
deleted file mode 100644
index 0400a978b4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/pom.xml
+++ /dev/null
@@ -1,450 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-bpel-ode</artifactId>
- <name>Apache Tuscany SCA BPEL ODE Implementation Extension</name>
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-bpel</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-sdo</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sdo</groupId>
- <artifactId>tuscany-sdo-impl</artifactId>
- <version>1.1.1</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>backport-util-concurrent</groupId>
- <artifactId>backport-util-concurrent</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- <!-- ODE Jars -->
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-epr</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-store</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-dao</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-dao</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-dao-jpa</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
- <version>1.1.1</version>
- <type>zip</type>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-runtime</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-api</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-scheduler-simple</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-utils</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-compiler</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-schemas</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-bpel-obj</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-jacob</artifactId>
- <version>1.1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-jacob-ap</artifactId>
- <version>1.1.1</version>
- </dependency>
-
- <!-- ODE Dependencies -->
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.1</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-kernel</artifactId>
- <version>1.2-beta</version>
- <exclusions>
- <exclusion>
- <groupId>mx4j</groupId>
- <artifactId>mx4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xpp3</groupId>
- <artifactId>xpp3</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xstream</groupId>
- <artifactId>xstream</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-transaction</artifactId>
- <version>1.2-beta</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_2.1_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>ognl</groupId>
- <artifactId>ognl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-connector</artifactId>
- <version>1.2-beta</version>
- <exclusions>
- <exclusion>
- <groupId>xmlbeans</groupId>
- <artifactId>xbean</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.3.1.4</version>
- </dependency>
- <dependency>
- <groupId>tranql</groupId>
- <artifactId>tranql-connector</artifactId>
- <version>1.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-all</artifactId>
- <version>0.9.7-incubating</version>
- <exclusions>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-lib</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-kernel</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-kernel-5</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-jdbc</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-jdbc-5</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-persistence-jdbc</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.openjpa</groupId>
- <artifactId>openjpa-xmlstore</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.serp</groupId>
- <artifactId>serp</artifactId>
- <version>1.12.0</version>
- </dependency>
- <dependency>
- <groupId>jaxen</groupId>
- <artifactId>jaxen</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>xom</groupId>
- <artifactId>xom</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>xalan</groupId>
- <artifactId>xalan</artifactId>
- <version>2.7.0</version>
- </dependency>
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- <version>2.8.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>2.3.0</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>8.7</version>
- <!--version>9.0.0.2</version-->
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-dom</artifactId>
- <version>8.7</version>
- <!--version>9.0.0.2</version-->
- </dependency>
- <dependency>
- <groupId>net.sf.saxon</groupId>
- <artifactId>saxon-xpath</artifactId>
- <version>8.7</version>
- <!--version>9.0.0.2</version-->
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.13</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <!-- http://jira.codehaus.org/browse/SUREFIRE-322 -->
- <version>2.3.1</version>
- <configuration>
- <useFile>false</useFile>
- <trimStackTrace>false</trimStackTrace>
- <useSystemClassLoader>true</useSystemClassLoader>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.ode</groupId>
- <artifactId>ode-dao-jpa-ojpa-derby</artifactId>
- <version>1.1.1</version>
- <type>zip</type>
- <overWrite>true</overWrite>
- <outputDirectory>${project.build.directory}/test-classes/</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.bpel.ode</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.bpel.ode*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java
deleted file mode 100644
index a1fc51403b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/BPELODEDeployFile.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.Reference;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.io.IOException;
-import java.io.FileOutputStream;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import java.util.List;
-
-/**
- * A class that handles the deploy.xml file required for each BPEL process by the ODE runtime
- *
- * An explanation of the structure of the ODE deploy file:
- *
- * <deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03"
- * xmlns:tns="http://helloworld"
- * xmlns:tus="http://tuscany.apache.org">
- *
- * <process name="tns:HelloWorld">
- * <active>true</active>
- * <provide partnerLink="helloPartnerLink">
- * <service name="tus:helloPartnerLink" port="HelloWorld"/>
- * </provide>
- * <invoke partnerLink="greetingsPartnerLink">
- * <service name="tus:greetingsPartnerLink" port="Greetings"/>
- * </invoke>
- * </process>
- * </deploy>
- *
- * For SCA purposes:
- *
- * a) Each partner link in the BPEL process is declared using either a <provide.../>
- * (for a service) or using a <invoke.../> (for a reference).
- *
- * b) Each <provide/> and <invoke/> must use the partnerLink name, as declared in the
- * BPEL process.
- *
- * c) The <provide/> and <invoke/> elements each have a single child <service/> element.
- * The <service/> elements have name and port attributes. The NAME attribute MUST be set
- * to the same name as the partnerLink and MUST be prefixed by a prefix which references
- * the namespace "http://tuscany.apache.org" ("tus" in the example above).
- * The port attribute can be set to any name (it must be present but it is not actually
- * used for anything significant).
- *
- * When SCA loads a BPEL process to the ODE server, this file is read by the ODE server to
- * characterize the process. When SCA interacts with ODE at later points - either when a
- * service is being invoked or the process invokes a reference - it is the service @name
- * attribute that identifies the service or reference involved.
- *
- * @version
- */
-public class BPELODEDeployFile {
- private final Log __log = LogFactory.getLog(getClass());
-
- static final String DEPLOY_ELEMENT_START = "<deploy xmlns=\"http://www.apache.org/ode/schemas/dd/2007/03\"";
- static final String DEPLOY_ENDELEMENT = "</deploy>";
- static final String PROCESS_NAMESPACE_DECL = "xmlns:tns=";
- static final String SERVICE_NAMESPACE = "xmlns:tus=\"http://tuscany.apache.org\"";
- static final String PROCESS_ELEMENT_START = "<process name=\"tns:";
- static final String PROCESS_ELEMENT_END = "\">";
- static final String PROCESS_ENDELEMENT = "</process>";
- static final String ACTIVE_ELEMENT = "<active>true</active>";
- static final String PROVIDE_ELEMENT_START = "<provide partnerLink=\"";
- static final String PROVIDE_ELEMENT_END = "\">";
- static final String PROVIDE_ENDELEMENT = "</provide>";
- static final String SERVICE_ELEMENT_START = "<service name=\"tus:";
- static final String SERVICE_ELEMENT_PORT = "\" port=\"";
- static final String SERVICE_ELEMENT_END = "Port\"/>";
- static final String INVOKE_ELEMENT_START = "<invoke partnerLink=\"";
- static final String INVOKE_ELEMENT_END = "\">";
- static final String INVOKE_ENDELEMENT = "</invoke>";
-
- static final String DEPLOY_FILENAME = "deploy.xml";
-
- private BPELImplementation implementation;
-
- /**
- * Constructor - requires a BPELImplementation as a parameter
- * The ODE deploy.xml file is for this supplied BPELImplementation
- * @param theImplementation
- */
- public BPELODEDeployFile( BPELImplementation theImplementation ) {
-
- implementation = theImplementation;
-
- } // end BPELODEDeployFile constructor
-
- /**
- * Writes the deploy file into the same directory as the BPEL process file, with the name
- * "deploy.xml"
- */
- public void writeDeployfile() throws IOException {
-
- File theDirectory = getDirectory();
-
- File deployFile = new File( theDirectory, DEPLOY_FILENAME );
- new FileOutputStream( deployFile );
- //if( !deployFile.canWrite() ) throw new IOException( "Unable to write to deploy file" +
- // deployFile.getPath() );
-
- // Create a stream for the data and write the data to the file
- PrintStream theStream = new PrintStream( new FileOutputStream( deployFile ) );
- try {
- constructDeployXML( theStream );
- if( theStream.checkError() ) throw new IOException();
- } catch (Exception e) {
- throw new IOException( "Unable to write data to deploy file" +
- deployFile.getPath() );
- } finally {
- theStream.close();
- } // end try
-
- } // end writeDeployFile
-
- /**
- * Creates the deploy.xml data and writes it to a supplied PrintStream
- * @param stream
- */
- public void constructDeployXML( PrintStream stream ) {
-
- // <deploy + namespace...
- stream.println( DEPLOY_ELEMENT_START );
- // namespace of the BPEL process
- QName process = implementation.getProcess();
- String processNamespace = process.getNamespaceURI();
- stream.println( PROCESS_NAMESPACE_DECL + "\"" + processNamespace + "\"" );
- // namespace for the service name elements
- stream.println( SERVICE_NAMESPACE + ">" );
-
- // <process> element
- stream.println( PROCESS_ELEMENT_START + process.getLocalPart() +
- PROCESS_ELEMENT_END );
-
- // <active/> element
- stream.println( ACTIVE_ELEMENT );
-
- ComponentType componentType = implementation.getComponentType();
- List<Service> theServices = componentType.getServices();
- // Loop over the <provide/> elements - one per service
- for ( Service service : theServices ) {
- String serviceName = service.getName();
- // Provide element...
- stream.println( PROVIDE_ELEMENT_START + serviceName + PROVIDE_ELEMENT_END );
- // Child service element...
- stream.println( SERVICE_ELEMENT_START + serviceName +
- SERVICE_ELEMENT_PORT + serviceName + SERVICE_ELEMENT_END );
- stream.println( PROVIDE_ENDELEMENT );
- } // end for
-
- // Loop over the <invoke/> elements - one per reference
- List<Reference> theReferences = componentType.getReferences();
- for ( Reference reference : theReferences ) {
- String referenceName = reference.getName();
- stream.println( INVOKE_ELEMENT_START + referenceName + INVOKE_ELEMENT_END );
- // Child service element...
- stream.println( SERVICE_ELEMENT_START + referenceName +
- SERVICE_ELEMENT_PORT + referenceName + SERVICE_ELEMENT_END );
- stream.println( INVOKE_ENDELEMENT );
-
- } // end for
-
- // </process> element
- stream.println( PROCESS_ENDELEMENT );
-
- // </deploy>
- stream.println( DEPLOY_ENDELEMENT );
-
- } // end constructDeployXML
-
- /**
- * Gets the directory containing the BPEL process
- * @return
- */
- private File getDirectory() {
- File theDir = getBPELFile().getParentFile();
- return theDir;
- } // end getDirectory
-
- /**
- * Gets the File containing the BPEL process definition
- * @return - the File object containing the BPEL process
- */
- private File getBPELFile() {
- try {
- File theProcess = new File(URI.create(implementation.getProcessDefinition().getLocation()));
- return theProcess;
- } catch( Exception e ) {
- if(__log.isDebugEnabled()) {
- __log.debug("Exception converting BPEL file URL to an URI: " + e );
- }
- } // end try
- return null;
- } // end getBPELFile
-
-
-
-} // end class BPELODEDeployFile
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
deleted file mode 100644
index 84c40defd9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServer.java
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import javax.transaction.TransactionManager;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.dao.BpelDAOConnectionFactoryJDBC;
-import org.apache.ode.bpel.engine.BpelServerImpl;
-import org.apache.ode.bpel.engine.CountLRUDehydrationPolicy;
-import org.apache.ode.bpel.iapi.ProcessConf;
-import org.apache.ode.bpel.iapi.ProcessStore;
-import org.apache.ode.bpel.iapi.ProcessStoreEvent;
-import org.apache.ode.bpel.iapi.ProcessStoreListener;
-import org.apache.ode.bpel.iapi.Scheduler;
-import org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl;
-import org.apache.ode.il.config.OdeConfigProperties;
-import org.apache.ode.il.dbutil.Database;
-import org.apache.ode.scheduler.simple.JdbcDelegate;
-import org.apache.ode.scheduler.simple.SimpleScheduler;
-import org.apache.ode.store.ProcessStoreImpl;
-import org.apache.ode.utils.GUID;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-//-------------- Added by Mike Edwards 16/05/2008
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-//-------------- End of Mike Edwards additions
-
-/**
- * Embedded ODE process server
- *
- * @version $Rev$ $Date$
- */
-public class EmbeddedODEServer {
- protected final Log __log = LogFactory.getLog(getClass());
-
- private boolean _initialized;
-
- private OdeConfigProperties _config;
-
- private TransactionManager _txMgr;
-
- private Database _db;
-
- private File _workRoot;
-
- private BpelDAOConnectionFactoryJDBC _daoCF;
-
- private BpelServerImpl _bpelServer;
-
- private Scheduler _scheduler;
-
- protected ExecutorService _executorService;
-
- private Map<QName, RuntimeComponent> tuscanyRuntimeComponents = new ConcurrentHashMap<QName, RuntimeComponent>();
-
- public EmbeddedODEServer(TransactionManager txMgr) {
- _txMgr = txMgr;
- }
-
- public void init() throws ODEInitializationException {
- Properties p = System.getProperties();
- p.put("derby.system.home", "target");
-
- Properties confProps = new Properties();
- confProps.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=false)");
- _config = new OdeConfigProperties(confProps, "ode-sca");
-
- // Setting work root as the directory containing our database (wherever in the classpath)
- URL dbLocation = getClass().getClassLoader().getResource("jpadb");
- if (dbLocation == null)
- throw new ODEInitializationException("Couldn't find database in the classpath");
- _workRoot = new File(dbLocation.getFile()).getParentFile();
-
- initTxMgr();
- initPersistence();
- initBpelServer();
-
- try {
- _bpelServer.start();
- } catch (Exception ex) {
- String errmsg = "An error occured during the ODE BPEL server startup.";
- __log.error(errmsg, ex);
- throw new ODEInitializationException(errmsg, ex);
- }
-
- __log.info("ODE BPEL server started.");
- _initialized = true;
- }
-
- private void initTxMgr() {
- if(_txMgr == null) {
- try {
- GeronimoTxFactory txFactory = new GeronimoTxFactory();
- _txMgr = txFactory.getTransactionManager();
- } catch (Exception e) {
- __log.fatal("Couldn't initialize a transaction manager using Geronimo's transaction factory.", e);
- throw new ODEInitializationException("Couldn't initialize a transaction manager using " + "Geronimo's transaction factory.", e);
- }
- }
- }
-
- private void initPersistence() {
- _db = new Database(_config);
- _db.setTransactionManager(_txMgr);
- _db.setWorkRoot(_workRoot);
-
- try {
- _db.start();
- _daoCF = _db.createDaoCF();
- } catch (Exception ex) {
- String errmsg = "Error while configuring ODE persistence.";
- __log.error(errmsg, ex);
- throw new ODEInitializationException(errmsg, ex);
- }
- }
-
- private void initBpelServer() {
- if (__log.isDebugEnabled()) {
- __log.debug("ODE initializing");
- }
-
- //FIXME: externalize the configuration for ThreadPoolMaxSize
- _executorService = Executors.newCachedThreadPool();
-
- _bpelServer = new BpelServerImpl();
- _scheduler = createScheduler();
- _scheduler.setJobProcessor(_bpelServer);
-
- _bpelServer.setDaoConnectionFactory(_daoCF);
- _bpelServer.setInMemDaoConnectionFactory(new BpelDAOConnectionFactoryImpl(_scheduler));
- // _bpelServer.setEndpointReferenceContext(new EndpointReferenceContextImpl(this));
- _bpelServer.setMessageExchangeContext(new ODEMessageExchangeContext(this));
- _bpelServer.setBindingContext(new ODEBindingContext());
- _bpelServer.setScheduler(_scheduler);
- if (_config.isDehydrationEnabled()) {
- CountLRUDehydrationPolicy dehy = new CountLRUDehydrationPolicy();
- _bpelServer.setDehydrationPolicy(dehy);
- }
-
- _bpelServer.init();
- } // end InitBpelServer
-
- public void stop() throws ODEShutdownException {
- if(_bpelServer != null) {
- try {
- __log.debug("Stopping BPEL Embedded server");
- _bpelServer.shutdown();
- _bpelServer = null;
- } catch (Exception ex) {
- __log.debug("Error stopping BPEL server");
- }
- }
-
- if(_scheduler != null) {
- try {
- __log.debug("Stopping scheduler");
- _scheduler.shutdown();
- _scheduler = null;
- } catch (Exception ex) {
- __log.debug("Error stopping scheduler");
- }
- }
-
- if(_daoCF != null) {
- try {
- __log.debug("Stopping DAO");
- _daoCF.shutdown();
- _daoCF = null;
- } catch (Exception ex) {
- __log.debug("Error stopping DAO");
- }
- }
-
- if(_db != null) {
- try {
- __log.debug("Stopping DB");
- _db.shutdown();
- _db = null;
- } catch (Exception ex) {
- __log.debug("Error stopping DB");
- }
- }
-
- if(_txMgr != null) {
- try {
- __log.debug("Stopping Transaction Manager");
- _txMgr = null;
- } catch (Exception ex) {
- __log.debug("Error stopping Transaction Manager");
- }
- }
- }
-
- protected Scheduler createScheduler() {
- SimpleScheduler scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_db.getDataSource()));
- scheduler.setTransactionManager(_txMgr);
-
- return scheduler;
- }
-
- public boolean isInitialized() {
- return _initialized;
- }
-
- public BpelServerImpl getBpelServer() {
- return _bpelServer;
- }
-
- public Scheduler getScheduler() {
- return _scheduler;
- }
-
- public ExecutorService getExecutor() {
- return _executorService;
- }
-
- // Updated by Mike Edwards, 23/05/2008
- public void deploy(ODEDeployment d, BPELImplementation implementation) {
- try {
- TuscanyProcessConfImpl processConf = new TuscanyProcessConfImpl( implementation );
- _bpelServer.register(processConf);
- System.out.println("Completed calling new Process deployment code...");
- } catch (Exception ex) {
- String errMsg = ">>> DEPLOY: Unexpected exception: " + ex.getMessage();
- __log.debug(errMsg, ex);
- throw new ODEDeploymentException(errMsg,ex);
- }
- }
-
- public void undeploy(ODEDeployment d) {
- //TODO
- }
-
- public void registerTuscanyRuntimeComponent(QName processName,RuntimeComponent componentContext) {
- tuscanyRuntimeComponents.put(processName, componentContext);
- }
-
- public RuntimeComponent getTuscanyRuntimeComponent(QName processName) {
- return tuscanyRuntimeComponents.get(processName);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java
deleted file mode 100644
index 11af0f8b50..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/GeronimoTxFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Geronimo transaction factory
- *
- * @version $Rev$ $Date$
- */
-public class GeronimoTxFactory {
- private static final Log __log = LogFactory.getLog(GeronimoTxFactory.class);
-
- /* Public no-arg constructor is required */
- public GeronimoTxFactory() {
- }
-
- public TransactionManager getTransactionManager() {
- __log.info("Using embedded Geronimo transaction manager");
- try {
- Object obj = new org.apache.geronimo.transaction.manager.GeronimoTransactionManager();
- return (TransactionManager) obj;
- } catch (Exception except) {
- throw new IllegalStateException("Unable to instantiate Geronimo Transaction Manager", except);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java
deleted file mode 100644
index 3f2db7b244..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEBindingContext.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.iapi.BindingContext;
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.ode.bpel.iapi.EndpointReference;
-import org.apache.ode.bpel.iapi.PartnerRoleChannel;
-
-/**
- * Binding Context information
- *
- * @version $Rev$ $Date$
- */
-public class ODEBindingContext implements BindingContext {
- protected final Log __log = LogFactory.getLog(getClass());
-
- public ODEBindingContext() {
-
- }
-
- public EndpointReference activateMyRoleEndpoint(QName pid, Endpoint endpoint) {
- // This will be needed when we support callBacks
- if (__log.isDebugEnabled()) {
- __log.debug("Activating MyRole Endpoint : " + pid + " - " + endpoint.serviceName);
- }
-
- QName processName = getProcessName(pid);
-
- return new TuscanyEPR(processName, endpoint);
- }
-
- public void deactivateMyRoleEndpoint(Endpoint endpoint) {
- if (__log.isDebugEnabled()) {
- __log.debug("Deactivate MyRole Endpoint : " + endpoint.serviceName);
- }
-
- }
-
- public PartnerRoleChannel createPartnerRoleChannel(QName pid, PortType portType, Endpoint endpoint) {
- if (__log.isDebugEnabled()) {
- __log.debug("Create PartnerRole channel : " + pid + " - " + portType.getQName() + " - "+ endpoint.serviceName);
- }
-
- QName processName = getProcessName(pid);
- return new TuscanyPRC(processName, pid, portType, endpoint);
- }
-
- /**
- * Helper method to retrieve the BPEL process name from a processID (where processID have version concatenated to it)
- * @param pid
- * @return QName the BPEL process name
- */
- private static QName getProcessName(QName pid) {
- String processName = pid.getLocalPart().substring(0, pid.getLocalPart().lastIndexOf("-"));
- return new QName(pid.getNamespaceURI(), processName);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.java
deleted file mode 100644
index a6428f6984..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeployment.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.implementation.bpel.ode;
-
-import java.io.File;
-
-/**
- * Deployment information
- *
- * @version $Rev$ $Date$
- */
-public class ODEDeployment {
- /** The directory containing the deploy.xml and artifacts. */
- public File deployDir;
-
- /** If non-null the type of exception we expect to get when we deploy. */
- public Class expectedException = null;
-
- public ODEDeployment(File deployDir) {
- this.deployDir = deployDir;
- }
-
- @Override
- public String toString() {
- return "Deployment#" + deployDir;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.java
deleted file mode 100644
index b03f69d9aa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEDeploymentException.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.implementation.bpel.ode;
-
-/**
- * Thrown when ODE failed to shutdown.
- *
- * @version $Rev$ $Date$
- */
-public class ODEDeploymentException extends RuntimeException {
- private static final long serialVersionUID = -2869674556330744215L;
-
- public ODEDeploymentException(Throwable cause) {
- super(cause);
- }
-
- public ODEDeploymentException(String message) {
- super(message);
- }
-
- public ODEDeploymentException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java
deleted file mode 100644
index 6ce6a727af..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEExternalService.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import java.util.concurrent.Callable;
-
-import javax.wsdl.Part;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MessageExchange;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
-import org.apache.ode.bpel.iapi.Scheduler;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ServiceRuntimeException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Helper Class to handle invocation to Tuscany Component References
- *
- * @version $Rev$ $Date$
- */
-public class ODEExternalService {
- protected final Log __log = LogFactory.getLog(getClass());
-
- private EmbeddedODEServer _server;
- private Scheduler _sched;
-
- public ODEExternalService(EmbeddedODEServer server) {
- this._server = server;
- this._sched = _server.getScheduler();
- }
-
-
- public void invoke(final PartnerRoleMessageExchange partnerRoleMessageExchange) {
- boolean isTwoWay =
- partnerRoleMessageExchange.getMessageExchangePattern() == org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE;
-
- if (isTwoWay) {
- // Defer the invoke until the transaction commits.
- _sched.registerSynchronizer(new Scheduler.Synchronizer() {
- public void beforeCompletion() {
-
- }
-
- public void afterCompletion(boolean success) {
- // If the TX is rolled back, then we don't send the request.
- if (!success)
- return;
-
- // The invocation must happen in a separate thread, holding
- // on the afterCompletion
- // blocks other operations that could have been listed there
- // as well.
- _server.getExecutor().submit(new Callable<Object>() {
- public Object call() throws Exception {
- try {
- // do execution
- if(! (partnerRoleMessageExchange.getChannel() instanceof TuscanyPRC)) {
- throw new IllegalArgumentException("Channel should be an instance of TuscanyPRC");
- }
-
- TuscanyPRC channel = (TuscanyPRC) partnerRoleMessageExchange.getChannel();
- RuntimeComponent tuscanyRuntimeComponent = _server.getTuscanyRuntimeComponent(channel.getProcessName());
-
- // get the right reference based on the partner link name
- String referenceName = channel.getEndpoint().serviceName.getLocalPart();
- RuntimeComponentReference runtimeComponentReference = null;
-
- for (ComponentReference reference : tuscanyRuntimeComponent.getReferences()){
- if (reference.getName().equals(referenceName)){
- runtimeComponentReference = (RuntimeComponentReference)reference;
- break;
- }
- }
-
- if (runtimeComponentReference == null){
- throw new ServiceRuntimeException("Can't find component reference for partner link " + referenceName);
- }
-
- RuntimeWire runtimeWire =
- runtimeComponentReference.getRuntimeWire(runtimeComponentReference.getBindings().get(0));
-
- // convert operations
- Operation operation =
- findOperation(partnerRoleMessageExchange.getOperation().getName(), runtimeComponentReference);
-
- /*
- This is how a request looks like (payload is wrapped with extra info)
- <?xml version="1.0" encoding="UTF-8"?>
- <message>
- <parameters>
- <getGreetings xmlns="http://greetings">
- <message xmlns="http://helloworld">Luciano</message>
- </getGreetings>
- </parameters>
- </message>
- */
- Element msg = partnerRoleMessageExchange.getRequest().getMessage();
- if (msg != null) {
- String xml = DOMUtils.domToString(msg);
-
- String payload =
- DOMUtils.domToString(getPayload(partnerRoleMessageExchange.getRequest()));
-
- if(__log.isDebugEnabled()) {
- __log.debug("Starting invocation of SCA Reference");
- __log.debug(">>> Original message: " + xml);
- __log.debug(">>> Payload: " + payload);
- }
-
- Object[] args = new Object[] {getPayload(partnerRoleMessageExchange.getRequest())};
-
- Object result = null;
- boolean success = false;
-
- try {
- result = runtimeWire.invoke(operation, args);
- success = true;
- } catch (Exception e) {
- partnerRoleMessageExchange.replyWithFailure(MessageExchange.FailureType.OTHER,
- e.getMessage(),
- null);
- }
-
-
- if(__log.isDebugEnabled()) {
- __log.debug("SCA Reference invocation finished");
- __log.debug(">>> Result : " + DOMUtils.domToString((Element)result));
- }
-
- if (!success) {
- return null;
- }
-
- // two way invocation
- // process results based on type of message
- // invocation
-
- // Message response =
- // createResponseMessage(partnerRoleMessageExchange,
- // (Element) result);
- // partnerRoleMessageExchange.reply(response);
- replyTwoWayInvocation(partnerRoleMessageExchange.getMessageExchangeId(),
- operation,
- (Element)result);
- }
-
- } catch (Throwable t) {
- // some error
- String errmsg =
- "Error sending message (mex=" + partnerRoleMessageExchange + "): " + t.getMessage();
- __log.error(errmsg, t);
- /*replyWithFailure(partnerRoleMessageExchange.getMessageExchangeId(),
- MessageExchange.FailureType.COMMUNICATION_ERROR,
- errmsg,
- null);*/
- }
- return null;
- }
- });
-
- }
- });
- partnerRoleMessageExchange.replyAsync();
-
- } else {
- /** one-way case * */
- _server.getExecutor().submit(new Callable<Object>() {
- public Object call() throws Exception {
- // do reply
- // operationClient.execute(false);
- return null;
- }
- });
- partnerRoleMessageExchange.replyOneWayOk();
- }
- }
-
-
- /**
- * Find the SCA Reference operation
- *
- * @param operationName
- * @param runtimeComponentReference
- * @return
- */
- private Operation findOperation(String operationName, RuntimeComponentReference runtimeComponentReference) {
- Operation reseultOperation = null;
-
- for(Operation operation : runtimeComponentReference.getInterfaceContract().getInterface().getOperations()) {
- if (operationName.equalsIgnoreCase(operation.getName())) {
- reseultOperation = operation;
- break;
- }
- }
- return reseultOperation;
- }
-
- /**
- * Get paylod from a given ODEMessage
- * @param odeMessage
- * @return
- */
- private Element getPayload(Message odeMessage) {
- Element payload = null;
- Element parameters = odeMessage.getPart("parameters");
-
- if (parameters != null && parameters.hasChildNodes()) {
- payload = (Element)parameters.getFirstChild();
- }
-
- return payload;
- }
-
-
- private void replyTwoWayInvocation(final String odeMexId, final Operation operation, final Element result) {
- // ODE MEX needs to be invoked in a TX.
- try {
- _server.getScheduler().execIsolatedTransaction(new Callable<Void>() {
- public Void call() throws Exception {
- PartnerRoleMessageExchange odeMex = null;
- try {
- odeMex = (PartnerRoleMessageExchange)_server.getBpelServer().getEngine().getMessageExchange(odeMexId);
- if (odeMex != null) {
- Message response = createResponseMessage(odeMex, operation, (Element)result);
- odeMex.reply(response);
- }
- } catch (Exception ex) {
- String errmsg = "Unable to process response: " + ex.getMessage();
- if (odeMex != null) {
- odeMex.replyWithFailure(MessageExchange.FailureType.OTHER, errmsg, null);
- }
- }
-
- return null;
- }
- });
- } catch (Exception ex) {
- ex.printStackTrace();
- }
-
- }
-
- private Message createResponseMessage(PartnerRoleMessageExchange partnerRoleMessageExchange,
- Operation operation,
- Element invocationResult) {
- Document dom = DOMUtils.newDocument();
-
- String operationName = operation.getName();
- Part bpelOperationOutputPart =
- (Part)((WSDLInterface)operation.getInterface()).getPortType().getOperation(operationName, null, null)
- .getOutput().getMessage().getParts().values().iterator().next();
-
- Element contentMessage = dom.createElement("message");
- Element contentPart = dom.createElement(bpelOperationOutputPart.getName());
-
- contentPart.appendChild(dom.importNode(invocationResult, true));
- contentMessage.appendChild(contentPart);
- dom.appendChild(contentMessage);
-
- if(__log.isDebugEnabled()) {
- __log.debug("Creating result message:");
- __log.debug(">>>" + DOMUtils.domToString(dom.getDocumentElement()));
- }
-
- QName id = partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName();
- Message response = partnerRoleMessageExchange.createMessage(id);
- response.setMessage(dom.getDocumentElement());
-
- return response;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.java
deleted file mode 100644
index 2fa91e4e86..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEInitializationException.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.implementation.bpel.ode;
-
-/**
- * Thrown when ODE failed to initialize one if its needed resources.
- *
- * @version $Rev$ $Date$
- */
-public class ODEInitializationException extends RuntimeException {
- private static final long serialVersionUID = -2869674556330744215L;
-
- public ODEInitializationException(Throwable cause) {
- super(cause);
- }
-
- public ODEInitializationException(String message) {
- super(message);
- }
-
- public ODEInitializationException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java
deleted file mode 100644
index 1ec82390cf..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEMessageExchangeContext.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.iapi.BpelEngineException;
-import org.apache.ode.bpel.iapi.ContextException;
-import org.apache.ode.bpel.iapi.MessageExchangeContext;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.PartnerRoleMessageExchange;
-
-/**
- * Message Exchange Context information
- *
- * @version $Rev$ $Date$
- */
-public class ODEMessageExchangeContext implements MessageExchangeContext {
- private static final Log __log = LogFactory.getLog(ODEMessageExchangeContext.class);
-
- private EmbeddedODEServer _server;
-
- public ODEMessageExchangeContext(EmbeddedODEServer _server) {
- this._server = _server;
- }
-
- public void invokePartner(PartnerRoleMessageExchange partnerRoleMessageExchange) throws ContextException {
- if (__log.isDebugEnabled()) {
- __log.debug("Invoking a partner operation: " + partnerRoleMessageExchange.getOperationName());
- }
-
- ODEExternalService scaService = new ODEExternalService(_server);
- scaService.invoke(partnerRoleMessageExchange);
- }
-
- public void onAsyncReply(MyRoleMessageExchange myRoleMessageExchange) throws BpelEngineException {
- if (__log.isDebugEnabled()) {
- __log.debug("Processing an async reply from service " + myRoleMessageExchange.getServiceName());
- }
- }
- }
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.java
deleted file mode 100644
index a928379ba9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/ODEShutdownException.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.implementation.bpel.ode;
-
-/**
- * Thrown when ODE failed to shutdown.
- *
- * @version $Rev$ $Date$
- */
-public class ODEShutdownException extends RuntimeException {
- private static final long serialVersionUID = -2869674556330744215L;
-
- public ODEShutdownException(Throwable cause) {
- super(cause);
- }
-
- public ODEShutdownException(String message) {
- super(message);
- }
-
- public ODEShutdownException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java
deleted file mode 100644
index 328403e626..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyEPR.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import javax.xml.namespace.QName;
-
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.ode.bpel.iapi.EndpointReference;
-import org.apache.ode.utils.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * This should hold something that makes sense for Tuscany so that the
- * process has an address that makes sense from the outside world perspective
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyEPR implements EndpointReference {
- private final QName prcessName;
- private final Endpoint endpoint;
- private final Document doc = DOMUtils.newDocument();
-
- public TuscanyEPR(QName processName, Endpoint endpoint) {
- this.prcessName = processName;
- this.endpoint = endpoint;
-
- Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
- EndpointReference.SERVICE_REF_QNAME.getLocalPart());
- serviceref.setNodeValue(endpoint.serviceName + ":" + endpoint.portName);
- doc.appendChild(serviceref);
- }
-
- public Document toXML() {
- return doc;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java
deleted file mode 100644
index c2c16a24ca..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyPRC.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.ode.bpel.iapi.EndpointReference;
-import org.apache.ode.bpel.iapi.PartnerRoleChannel;
-import org.apache.ode.utils.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Tuscany Partner Role Channel for ODE Integration
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyPRC implements PartnerRoleChannel {
- private final QName processName;
- private final QName pid;
- private final PortType portType;
- private final Endpoint endpoint;
-
- public TuscanyPRC(QName processName, QName pid, PortType portType, Endpoint endpoint){
- this.processName = processName;
- this.pid = pid;
- this.portType = portType;
- this.endpoint = endpoint;
- }
-
- public QName getProcessName() {
- return this.processName;
- }
-
- public Endpoint getEndpoint() {
- return endpoint;
- }
-
- public void close() {
-
- }
-
- public EndpointReference getInitialEndpointReference() {
- final Document doc = DOMUtils.newDocument();
- Element serviceref = doc.createElementNS(EndpointReference.SERVICE_REF_QNAME.getNamespaceURI(),
- EndpointReference.SERVICE_REF_QNAME.getLocalPart());
- doc.appendChild(serviceref);
-
- return new EndpointReference() {
- public Document toXML() {
- return doc;
- }
- };
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java
deleted file mode 100644
index 22a86a9e0f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/TuscanyProcessConfImpl.java
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.compiler.BpelC;
-import org.apache.ode.bpel.evt.BpelEvent.TYPE;
-import org.apache.ode.bpel.iapi.Endpoint;
-import org.apache.ode.bpel.iapi.ProcessConf;
-import org.apache.ode.bpel.iapi.ProcessState;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * A Tuscany implementation of the ODE Process Conf
- *
- * @version $Rev$ $Date$
- */
-public class TuscanyProcessConfImpl implements ProcessConf {
- private final Log __log = LogFactory.getLog(getClass());
-
- private BPELImplementation implementation;
- private Map<String, Endpoint> invokeEndpoints = null;
- private Map<String, Endpoint> provideEndpoints = null;
- private Map<QName, Node> properties = null;
- private ProcessState processState;
- private Date deployDate;
-
- private final String TUSCANY_NAMESPACE = "http://tuscany.apache.org";
-
- /**
- * Constructor for the ProcessConf implementation
- * @param theImplementation the BPEL implementation for which this is the ProcessConf
- */
- public TuscanyProcessConfImpl( BPELImplementation theImplementation ) {
- //System.out.println("New TuscanyProcessConfImpl...");
- this.implementation = theImplementation;
-
- processState = ProcessState.ACTIVE;
- deployDate = new Date();
-
- // Compile the process
- compile( getBPELFile() );
- } // end TuscanyProcessConfImpl constructor
-
- /**
- * Returns the URI for the directory containing the BPEL process
- */
- public URI getBaseURI() {
- //System.out.println("getBaseURI called");
- File theDir = getDirectory();
- return theDir.toURI();
- }
-
- /**
- * Returns a String containing the (local) name of the file containing the BPEL process
- */
- public String getBpelDocument() {
- //System.out.println("getBPELDocument called");
- try {
- File processFile = new File(URI.create(implementation.getProcessDefinition().getLocation()));
- return getRelativePath( getDirectory(), processFile);
- } catch (Exception e) {
- if(__log.isWarnEnabled()) {
- __log.warn("Unable to resolve relative path of BPEL process" + implementation.getProcessDefinition().getLocation(), e );
- }
- return null;
- } // end try
- } // end getBpelDocument
-
- /**
- * Returns an InputStream containing the Compiled BPEL Process (CBP)
- */
- public InputStream getCBPInputStream() {
- //System.out.println("getCBPInputStream called");
- // Find the CBP file - it has the same name as the BPEL process and lives in the same
- // directory as the process file
- String cbpFileName = null;
- try {
- String fileName = getRelativePath( getDirectory(), getBPELFile() );
- cbpFileName = fileName.substring(0, fileName.lastIndexOf(".")) + ".cbp";
- } catch (Exception e ) {
- // IOException trying to fetch the BPEL file name
- if(__log.isDebugEnabled()) {
- __log.debug("Unable to calculate the file name for BPEL process: " +
- implementation.getProcessDefinition().getName(), e);
- return null;
- } // end if
- } // end try
- File cbpFile = new File( getDirectory(), cbpFileName );
- if( cbpFile.exists() ) {
- // Create an InputStream from the cbp file...
- try {
- return new FileInputStream( cbpFile );
- } catch ( Exception e ) {
- if(__log.isDebugEnabled()) {
- __log.debug("Unable to open the cbp file for BPEL process: " +
- implementation.getProcessDefinition().getName(), e);
- }
- } // end try
- } else {
- // Cannot find the cbp file
- if(__log.isWarnEnabled()){
- __log.warn("Cannot find the cbp file for process: " +
- implementation.getProcessDefinition().getName());
- }
- } // end if
- // TODO - need better exception handling if we can't open the cbp file for any reason
- return null;
- } // end getCBPInputStream
-
- /**
- * Return the WSDL Definition for a given PortType
- * @param portTypeName - the QName of the PortType
- */
- public Definition getDefinitionForPortType( QName portTypeName ) {
- //System.out.println("getDefinitionForPortType called for portType: " + portTypeName );
- // Find the named PortType in the list of WSDL interfaces associated with this BPEL Process
- Collection<WSDLInterface> theInterfaces = implementation.getProcessDefinition().getInterfaces();
- for( WSDLInterface wsdlInterface : theInterfaces ) {
- if ( wsdlInterface.getPortType().getQName().equals( portTypeName ) ) {
- // Extract and return the Definition associated with the WSDLDefinition...
- return wsdlInterface.getWsdlDefinition().getDefinition();
- } // end if
- } // end for
- return null;
- } // end getDefinitionforPortType
-
- /**
- * Returns a WSDL Definition for a given Service QName
- *
- * 22/05/2008 - it is very unclear what this service QName is really meant to be.
- * From the handling of the deploy.xml file by the current ODE code, it seems that the key link
- * is from the Service QName to the PartnerLink name (done in the deploy.xml file).
- *
- * The curious part about this is that the QName for the service is ONLY defined in deploy.xml file
- * and does not appear to relate to anything else, except for the QName of the PartnerLink
- *
- * The PartnerLink name is the same as the name of the SCA service (or reference) which in turn points
- * at the PartnerLinkType which in turn points at an (WSDL) interface definition.
- */
- public Definition getDefinitionForService(QName serviceQName ) {
- //System.out.println("getDefinitionForService called for Service: " + serviceQName );
- if(__log.isDebugEnabled()){
- __log.debug("getDefinitionforService called for service: " + serviceQName );
- }
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * Returns the date of deployment of the process
- * - for SCA returns the date at which this object was created
- */
- public Date getDeployDate() {
- //System.out.println("getDeployDate called");
- return deployDate;
- }
-
- /**
- * Returns userid of deployer
- * - always "SCA Tuscany" for Tuscany...
- */
- public String getDeployer() {
- //System.out.println("getDeployer called");
- return "SCA Tuscany";
- } // end getDeployer
-
- /**
- * Returns a list of the files in the directory containing the BPEL Process
- */
- public List<File> getFiles() {
- //System.out.println("getFiles called");
- File theDir = getDirectory();
- List<File> theFiles = Arrays.asList( (File[]) theDir.listFiles() );
- // TODO recurse into subdirectories
- return theFiles;
- } // end getFiles
-
- /**
- * Returns a Map containing all the "invoke endpoints" - for which read "SCA references"
- * The map is keyed by partnerLink name and holds Endpoint objects
- *
- * TODO deal with service callbacks on bidirectional services
- */
- public Map<String, Endpoint> getInvokeEndpoints() {
- //System.out.println("getInvokeEndpoints called");
- if( invokeEndpoints == null ) {
- invokeEndpoints = new HashMap<String, Endpoint>();
- // Get a collection of the references
- List<Reference> theReferences = implementation.getReferences();
- // Create an endpoint for each reference, using the reference name as the "service"
- // name, combined with http://tuscany.apache.org to make a QName
- for( Reference reference : theReferences ) {
- invokeEndpoints.put( reference.getName(),
- new Endpoint( new QName( TUSCANY_NAMESPACE, reference.getName() ), "ReferencePort"));
- } // end for
- } // end if
- return invokeEndpoints;
- } // end getInvokeEndpoints
-
- /**
- * Returns the name of the directory containing the BPEL files
- */
- public String getPackage() {
- //System.out.println("getPackage called");
- File theDir = getDirectory();
- return theDir.getName();
- } // end getPackage
-
- /**
- * Return the BPEL Process ID - which is the Process QName appended "-versionnumber"
- */
- public QName getProcessId() {
- //System.out.println("getProcessId called");
- QName processType = getType();
- QName processID = new QName( processType.getNamespaceURI(),
- processType.getLocalPart() + "-" + getVersion() );
- return processID;
- } // end getProcessID
-
- /**
- * TODO - What are properties?
- */
- public Map<QName, Node> getProperties() {
- //System.out.println("getProperties called");
- if ( properties == null ) {
- properties = new HashMap<QName, Node>();
- } // end if
- return properties;
- } // end getProperties
-
- /**
- * Returns a Map containing all the "provide endpoints" - for which read "SCA services"
- * The map is keyed by partnerLink name and holds Endpoint objects
- *
- * TODO deal with reference callbacks on bidirectional references
- */
- public Map<String, Endpoint> getProvideEndpoints() {
- //System.out.println("getProvideEndpoints called");
- if( provideEndpoints == null ) {
- provideEndpoints = new HashMap<String, Endpoint>();
- // Get a collection of the references
- List<Service> theServices = implementation.getServices();
- // Create an endpoint for each reference, using the reference name as the "service"
- // name, combined with http://tuscany.apache.org to make a QName
- for( Service service : theServices ) {
- provideEndpoints.put( service.getName(),
- new Endpoint( new QName( TUSCANY_NAMESPACE, service.getName() ), "ServicePort"));
- } // end for
- } // end if
- return provideEndpoints;
- } // end getProvideEndpoints
-
- /**
- * Return the process state
- */
- public ProcessState getState() {
- //System.out.println("getState called");
- return processState;
- }
-
- /**
- * Returns the QName of the BPEL process
- */
- public QName getType() {
- //System.out.println("getType called");
- return implementation.getProcess();
- }
-
- /**
- * Gets the process Version number
- * - current code does not have versions for BPEL processes and always returns "1"
- */
- public long getVersion() {
- //System.out.println("getVersion called");
- return 1;
- }
-
- /**
- * Returns true if the supplied event type is enabled for any of the scopes in the provided
- * List. These events are "ODE Execution Events" and there is a definition of them on this
- * page: http://ode.apache.org/user-guide.html#UserGuide-ProcessDeployment
- *
- * For the present Tuscany does not support manipulating the event enablement and always
- * returns that the event is not enabled
- * @param scopeNames - list of BPEL process Scope names
- * @param type - the event type
- */
- public boolean isEventEnabled(List<String> scopeNames, TYPE type) {
- //System.out.println("isEventEnabled called with scopeNames: " +
- // scopeNames + " and type: " + type );
- return false;
- } // end isEventEnabled
-
- /**
- * Returns whether the process is persisted in the store
- *
- * Returns false for SCA configuration
- * - returning true causes problems in communicating with the BPEL process
- */
- public boolean isTransient() {
- //System.out.println("isTransient called");
- return false;
- } // end isTransient
-
- /**
- * Compiles a BPEL process file into a compiled form CBP file in the main directory
- * (ie same directory as the BPEL process file)
- * @param bpelFile - the BPEL process file
- */
- private void compile( File bpelFile ) {
- // Set up the compiler
- BpelC compiler = BpelC.newBpelCompiler();
- // Provide a null set of initial properties for now
- Map<QName, Node> processProps = new HashMap<QName, Node>();
- Map<String, Object> compileProps = new HashMap<String, Object>();
- compileProps.put( BpelC.PROCESS_CUSTOM_PROPERTIES, processProps );
- compiler.setCompileProperties( compileProps );
- compiler.setBaseDirectory( getDirectory() );
-
- // Run the compiler and generate the CBP file into the given directory
- try {
- compiler.compile( bpelFile );
- } catch (IOException e) {
- if(__log.isDebugEnabled()) {
- __log.debug("Compile error in " + bpelFile, e);
- }
- // TODO - need better exception handling here
- } // end try
- } // end compile
-
- /**
- * Gets the directory containing the BPEL process
- * @return
- */
- private File getDirectory() {
- File theDir = getBPELFile().getParentFile();
- return theDir;
- } // end getDirectory
-
- /**
- * Gets the File containing the BPEL process definition
- * @return - the File object containing the BPEL process
- */
- private File getBPELFile() {
- try {
- File theProcess = new File(URI.create(implementation.getProcessDefinition().getLocation()));
- return theProcess;
- } catch( Exception e ) {
- if(__log.isDebugEnabled()) {
- __log.debug("Exception converting BPEL file URL to an URI: " + e );
- }
- } // end try
- return null;
- } // end getBPELFile
-
- /**
- * Gets the relative path of a file against a directory in its hierarchy
- * @param base - the base directory
- * @param path - the file
- * @return
- * @throws IOException
- */
- private String getRelativePath(File base, File path) throws IOException {
- String basePath = base.getCanonicalPath();
- String filePath = path.getCanonicalPath();
- if (!filePath.startsWith(basePath)) {
- throw new IOException("Invalid relative path: base=" + base + " path=" + path);
- }
- String relative = filePath.substring(basePath.length());
- if (relative.startsWith(File.separator)) {
- relative = relative.substring(1);
- }
- return relative;
- } // end getRelativePath
-
- //-----------------------------------------------------------------------------
- // other public APIs which ProcessConfImpl displays which are not in ProcessConf interface
-
- public List<String> getMexInterceptors(QName processId) {
- System.out.println("getMexInterceptors for processID: " + processId );
- return null;
- }
-
- public void setTransient(boolean t) {
- System.out.println("setTransient called with boolean: " + t );
- }
-
- public List<Element> getExtensionElement(QName arg0) {
- return Collections.emptyList();
- }
- // end of other public APIs
- //-----------------------------------------------------------------------------
-
-} // end class TuscanyProcessConfImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
deleted file mode 100644
index c644b6a965..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProvider.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode.provider;
-
-import java.io.File;
-import java.net.URI;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
-import org.apache.tuscany.sca.implementation.bpel.ode.ODEInitializationException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * BPEL Implementation provider
- *
- * @version $Rev$ $Date$
- */
-public class BPELImplementationProvider implements ImplementationProvider {
- private final Log __log = LogFactory.getLog(getClass());
-
- private RuntimeComponent component;
- private BPELImplementation implementation;
-
- private EmbeddedODEServer odeServer;
- private TransactionManager txMgr;
-
- /**
- * Constructs a new BPEL Implementation.
- */
- public BPELImplementationProvider(RuntimeComponent component,
- BPELImplementation implementation,
- EmbeddedODEServer odeServer,
- TransactionManager txMgr) {
- this.component = component;
- this.implementation = implementation;
- this.odeServer = odeServer;
- this.txMgr = txMgr;
-
- // Configure the service and reference interfaces to use a DOM databinding
- // as it's what ODE expects
- for (Service service: implementation.getServices()) {
- service.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
- for (Reference reference: implementation.getReferences()) {
- reference.getInterfaceContract().getInterface().resetDataBinding(DOMDataBinding.NAME);
- }
-
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- BPELInvoker invoker = new BPELInvoker(component, service, operation, odeServer, txMgr);
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- if(__log.isInfoEnabled()) {
- __log.info("Starting " + component.getName());
- }
-
- try {
- if (!odeServer.isInitialized()) {
- // start ode server
- odeServer.init();
- }
-
- URI deployURI = URI.create(this.implementation.getProcessDefinition().getLocation());
-
- File deploymentDir = new File(deployURI).getParentFile();
-
- if(__log.isInfoEnabled()) {
- __log.info(">>> Deploying : " + deploymentDir.toString());
- }
-
- // deploy the process
- if (odeServer.isInitialized()) {
- try {
- //txMgr.begin();
- odeServer.registerTuscanyRuntimeComponent(implementation.getProcess(), component);
- // Replaced by Mike Edwards 23/05/2008
- //odeServer.deploy(new ODEDeployment(deploymentDir));
- odeServer.deploy(new ODEDeployment(deploymentDir), implementation );
- //txMgr.commit();
- } catch (Exception e) {
- e.printStackTrace();
- //txMgr.rollback();
- }
- }
-
- } catch (ODEInitializationException inite) {
- throw new RuntimeException("BPEL Component Type Implementation : Error initializing embedded ODE server " + inite.getMessage(), inite);
- } catch(Exception e) {
- throw new RuntimeException("BPEl Component Type Implementation initialization failure : " + e.getMessage(), e);
- }
- }
-
- public void stop() {
- if(__log.isInfoEnabled()) {
- __log.info("Stopping " + component.getName());
- }
-
- if (odeServer.isInitialized()) {
- // start ode server
- odeServer.stop();
- }
-
- txMgr = null;
-
- if(__log.isInfoEnabled()) {
- __log.info("Stopped !!!");
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java
deleted file mode 100644
index c5d6555a24..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELImplementationProviderFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.ode.provider;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * BPEL Implementation provider factory
- *
- * We use the provider factory to instantiate a ODE server that is going to be injected in all BPEL components
- *
- * @version $Rev$ $Date$
- */
-public class BPELImplementationProviderFactory implements ImplementationProviderFactory<BPELImplementation> {
-
- private EmbeddedODEServer odeServer;
- private TransactionManager txMgr;
-
- /**
- * Default constructor receiving an extension point
- * @param extensionPoints
- */
- public BPELImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- GeronimoTxFactory txFactory = new GeronimoTxFactory();
- txMgr = txFactory.getTransactionManager();
- this.odeServer = new EmbeddedODEServer(txMgr);
- }
-
- /**
- * Creates a new BPEL Implementation and inject the EmbeddedODEServer
- */
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, BPELImplementation implementation) {
- return new BPELImplementationProvider(component, implementation, odeServer, txMgr);
- }
-
- public Class<BPELImplementation> getModelType() {
- return BPELImplementation.class;
- }
-
- @Destroy
- public void destroy() {
- txMgr = null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java
deleted file mode 100644
index f301082d59..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.ode.provider;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.concurrent.Future;
-
-import javax.transaction.SystemException;
-import javax.transaction.TransactionManager;
-import javax.wsdl.Part;
-import javax.xml.namespace.QName;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.MessageExchange.Status;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.GUID;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Implements a target invoker for BPEL component implementations.
- *
- * The target invoker is responsible for dispatching invocations to the particular
- * component implementation logic. In this example we are simply delegating the
- * CRUD operation invocations to the corresponding methods on our fake
- * resource manager.
- *
- * @version $Rev$ $Date$
- */
-public class BPELInvoker implements Invoker {
- protected final Log __log = LogFactory.getLog(getClass());
-
- private EmbeddedODEServer odeServer;
- private TransactionManager txMgr;
-
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Operation operation;
- private QName bpelServiceName;
- private String bpelOperationName;
- private Part bpelOperationInputPart;
- private Part bpelOperationOutputPart;
-
- public BPELInvoker(RuntimeComponent component, RuntimeComponentService service, Operation operation, EmbeddedODEServer odeServer, TransactionManager txMgr) {
- this.component = component;
- this.service = service;
- this.operation = operation;
- this.bpelOperationName = operation.getName();
- this.odeServer = odeServer;
- this.txMgr = txMgr;
-
- initializeInvocation();
- }
-
-
- private void initializeInvocation() {
-
- if(true){
- __log.debug("Initializing BPELInvoker");
- }
- Interface interfaze = operation.getInterface();
- if(interfaze instanceof WSDLInterface){
- WSDLInterface wsdlInterface = null;
- wsdlInterface = (WSDLInterface) interfaze;
-
- // The following commented out code is bogus and is replaced by what follows - Mike Edwards
- // Service serviceDefinition = (Service) wsdlInterface.getWsdlDefinition().getDefinition().getAllServices().values().iterator().next();
- // bpelServiceName = serviceDefinition.getQName();
- //
- // Fetch the service name from the service object
- bpelServiceName = new QName( "http://tuscany.apache.org", service.getName() );
- //System.out.println("Actual service QName: " + bpelServiceName );
-
- bpelOperationInputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getInput().getMessage().getParts().values().iterator().next();
- bpelOperationOutputPart = (Part) wsdlInterface.getPortType().getOperation(bpelOperationName,null,null).getOutput().getMessage().getParts().values().iterator().next();
- }
- }
-
- public Message invoke(Message msg) {
- try {
- Object[] args = msg.getBody();
- Object resp = doTheWork(args);
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setFaultBody(e.getCause());
- }
- return msg;
- }
-
- public Object doTheWork(Object[] args) throws InvocationTargetException {
- Element response = null;
-
- if(! (operation.getInterface() instanceof WSDLInterface)) {
- throw new InvocationTargetException(null,"Unsupported service contract");
- }
-
- if(true) {
- System.out.println("Invoking bpel component : " + bpelServiceName + "#" + bpelOperationName);
- }
-
- org.apache.ode.bpel.iapi.MyRoleMessageExchange mex = null;
- Future onhold = null;
-
- //Process the BPEL process invocation
- try {
- txMgr.begin();
- mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
- bpelServiceName,
- bpelOperationName);
-
- onhold = mex.invoke(createInvocationMessage(mex, args));
-
- txMgr.commit();
- } catch (Exception e) {
- try {
- txMgr.rollback();
- } catch (SystemException se) {
-
- }
- throw new InvocationTargetException(e, "Error invoking BPEL process : " + e.getMessage());
- }
-
-
- // Waiting until the reply is ready in case the engine needs to continue in a different thread
- if (onhold != null) {
- try {
- onhold.get();
- } catch (Exception e) {
- throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage());
- }
- }
-
- //Process the BPEL invocation response
- try {
- txMgr.begin();
- // Reloading the mex in the current transaction, otherwise we can't
- // be sure we have the "freshest" one.
- mex = (MyRoleMessageExchange)odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
-
- if(true) {
- Status status = mex.getStatus();
- Element invocationResponse = mex.getResponse().getMessage();
-
- System.out.println(">>>Invocation status:" + status.name());
- System.out.println(">>>Response:\n" + DOMUtils.domToString(invocationResponse));
- System.out.println(">>>Response:\n" + DOMUtils.domToString(invocationResponse));
- }
- //process the method invocation result
- response = processResponse(mex.getResponse().getMessage());
-
- txMgr.commit();
- // end of transaction two
- } catch (Exception e) {
- try {
- txMgr.rollback();
- } catch (SystemException se) {
-
- }
- throw new InvocationTargetException(e, "Error retrieving BPEL process invocation status : " + e.getMessage());
- }
-
-
- return response;
- }
-
- /**
- * Create BPEL Invocation message
- *
- * BPEL invocation message like :
- * <message>
- * <TestPart>
- * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">Hello</hello>
- * </TestPart>
- * </message>
- * @param args
- * @return
- */
- private org.apache.ode.bpel.iapi.Message createInvocationMessage(org.apache.ode.bpel.iapi.MyRoleMessageExchange mex, Object[] args) {
- Document dom = DOMUtils.newDocument();
-
- Element contentMessage = dom.createElement("message");
- Element contentPart = dom.createElement(bpelOperationInputPart.getName());
- Element payload = null;
-
- //TUSCANY-2321 - Properly handling Document or Element types
- if(args[0] instanceof Document) {
- payload = (Element) ((Document) args[0]).getFirstChild();
- } else {
- payload = (Element) args[0];
- }
-
- contentPart.appendChild(dom.importNode(payload, true));
- contentMessage.appendChild(contentPart);
- dom.appendChild(contentMessage);
-
- if(true) {
- System.out.println("Creating invocation message:");
- System.out.println(">> args.....: " + DOMUtils.domToString(payload));
- System.out.println(">> message..:" + DOMUtils.domToString(dom.getDocumentElement()));
- }
-
- org.apache.ode.bpel.iapi.Message request = mex.createMessage(new QName("", ""));
- request.setMessage(dom.getDocumentElement());
-
- return request;
- }
-
- /**
- * Process BPEL response
- *
- * <message>
- * <TestPart>
- * <hello xmlns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl">World</hello>
- * </TestPart>
- * </message>
- *
- * @param response
- * @return
- */
- private Element processResponse(Element response) {
- // return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName())).getFirstChild();
- return (Element) DOMUtils.findChildByName(response, new QName("",bpelOperationOutputPart.getName()));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 3bce8aa9ab..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.bpel.ode.provider.BPELImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.java
deleted file mode 100644
index 360df0b2c5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/java/org/apache/tuscany/sca/implementation/bpel/ode/EmbeddedODEServerTestCase.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.implementation.bpel.ode;
-
-import java.io.File;
-import java.io.StringReader;
-import java.net.URL;
-import java.util.concurrent.Future;
-
-import javax.transaction.TransactionManager;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.ode.bpel.iapi.Message;
-import org.apache.ode.bpel.iapi.MyRoleMessageExchange;
-import org.apache.ode.bpel.iapi.MessageExchange.Status;
-import org.apache.ode.utils.DOMUtils;
-import org.apache.ode.utils.GUID;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer;
-import org.apache.tuscany.sca.implementation.bpel.ode.GeronimoTxFactory;
-import org.apache.tuscany.sca.implementation.bpel.ode.ODEDeployment;
-import org.w3c.dom.Element;
-
-/**
- * Test to Deploy and Invoke a HelloWorld BPEL process using EmbeddedODEServer
- *
- * Major changes introduced to this testcase on 27/05/2008 associated with changes in the
- * implementation of EmbeddedODEServer which remove the need for the ODE deploy.xml file -
- * instead a Tuscany BPELImplementation object is passed to the EmbeddedODEServer and this is
- * introspected to get all the necessary information about the BPEL process
- *
- * @version $Rev$ $Date$
- */
-public class EmbeddedODEServerTestCase extends TestCase {
-
- private EmbeddedODEServer odeServer;
-
- private TransactionManager txMgr;
-
- @Override
- protected void setUp() throws Exception {
- // Set up the ODE BPEL server...
- GeronimoTxFactory txFactory = new GeronimoTxFactory();
- txMgr = txFactory.getTransactionManager();
-
- this.odeServer = new EmbeddedODEServer(txMgr);
- odeServer.init();
-
- } // end setUp
-
- @Override
- protected void tearDown() throws Exception {
- odeServer.stop();
- }
-
- public void testProcessInvocation() throws Exception {
- if (!odeServer.isInitialized()) {
- fail("Server did not start !");
- }
-// TODO - write effective testcase - made problematic by the need to supply a resolved
-// BPELImplementation
-/*
- URL deployURL = getClass().getClassLoader().getResource("helloworld/deploy.xml");
- File deploymentDir = new File(deployURL.toURI().getPath()).getParentFile();
- System.out.println("Deploying : " + deploymentDir.toString());
- System.out.println(deploymentDir);
-
- if (odeServer.isInitialized()) {
- try {
- txMgr.begin();
- odeServer.deploy(new ODEDeployment(deploymentDir), implementation);
- txMgr.commit();
- } catch (Exception e) {
- e.printStackTrace();
- txMgr.rollback();
- }
-
- // transaction one
- MyRoleMessageExchange mex = null;
- Future onhold = null;
- try {
- // invoke the process
- txMgr.begin();
- mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
- new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl", "HelloService"), "hello");
-
- Message request = mex.createMessage(new QName("", ""));
- request.setMessage(DOMUtils.stringToDOM("<message><TestPart><hello xmlns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl\">Hello</hello></TestPart></message>"));
- onhold = mex.invoke(request);
- txMgr.commit();
- } catch (Exception e) {
- e.printStackTrace();
- txMgr.rollback();
- }
- // - end of transaction one
-
- // Waiting until the reply is ready in case the engine needs to continue in a different thread
- if (onhold != null)
- onhold.get();
-
- // transaction two
- try {
- txMgr.begin();
- // Reloading the mex in the current transaction, otherwise we can't be sure we have
- // the "freshest" one.
- mex = (MyRoleMessageExchange) odeServer.getBpelServer().getEngine().getMessageExchange(mex.getMessageExchangeId());
-
- Status status = mex.getStatus();
- System.out.println("Status: " + status.name());
- Element response = mex.getResponse().getMessage();
- System.out.println("Response: " + DOMUtils.domToString(response));
- txMgr.commit();
- // end of transaction two
- } catch (Exception e) {
- e.printStackTrace();
- txMgr.rollback();
- } // end try
- } // end if
-*/
- } // end testProcessInvocation
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl
deleted file mode 100644
index bcd3ea6afa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/greetings.wsdl
+++ /dev/null
@@ -1,87 +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.
--->
-<wsdl:definitions name="greetings"
- targetNamespace="http://greetings"
- xmlns:tns="http://greetings"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://greetings" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters"/>
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
- </wsdl:message>
-
- <wsdl:portType name="Greetings">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
- </wsdl:operation>
- </wsdl:portType>
-
- <wsdl:binding name="GreetingsSoapBinding" type="tns:Greetings">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="GreetingsService">
- <wsdl:port name="GreetingsSoapPort" binding="tns:GreetingsSoapBinding">
- <wsdlsoap:address location="http://localhost:8085/GreetingsServiceComponent"/>
- </wsdl:port>
- </wsdl:service>
-
- <plnk:partnerLinkType name="GreetingsPartnerLinkType">
- <plnk:role name="Provider" portType="tns:Greetings"/>
- </plnk:partnerLinkType>
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel
deleted file mode 100644
index 8cf91adc2c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.bpel
+++ /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.
- -->
-<process name="HelloWorld"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
- xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
- expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
-
- <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
- namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
-
- <partnerLinks>
- <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
- </partnerLinks>
-
- <variables>
- <variable name="helloMessage" messageType="test:HelloMessage"/>
- <variable name="tmpVar" type="xsd:string"/>
- </variables>
-
- <sequence>
- <receive
- name="start"
- partnerLink="helloPartnerLink"
- portType="test:HelloPortType"
- operation="hello"
- variable="helloMessage"
- createInstance="yes"/>
-
- <assign name="assign1">
- <copy>
- <from variable="helloMessage" part="TestPart"/>
- <to variable="tmpVar"/>
- </copy>
- <copy>
- <from>concat($tmpVar,' World')</from>
- <to variable="helloMessage" part="TestPart"/>
- </copy>
- </assign>
- <reply name="end"
- partnerLink="helloPartnerLink"
- portType="test:HelloPortType"
- operation="hello"
- variable="helloMessage"/>
- </sequence>
-</process>
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl
deleted file mode 100644
index 1d71727b2d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/helloworld/helloworld.wsdl
+++ /dev/null
@@ -1,82 +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.
- -->
-
-<wsdl:definitions name="helloworld"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
-
- <wsdl:types>
- <schema elementFormDefault="qualified"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="hello">
- <complexType>
- <sequence>
- <element name="message" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="HelloMessage">
- <wsdl:part element="tns:hello" name="TestPart"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloPortType">
- <wsdl:operation name="hello">
- <wsdl:input message="tns:HelloMessage" name="TestIn"/>
- <wsdl:output message="tns:HelloMessage" name="TestOut"/>
- </wsdl:operation>
- </wsdl:portType>
-
-
- <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="hello">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="TestIn">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="TestOut">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloService">
- <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
- <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
- </wsdl:port>
- </wsdl:service>
-
- <plnk:partnerLinkType name="HelloPartnerLinkType">
- <plnk:role name="me" portType="tns:HelloPortType"/>
- <plnk:role name="you" portType="tns:HelloPortType"/>
- </plnk:partnerLinkType>
-</wsdl:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/log4j.properties b/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/log4j.properties
deleted file mode 100644
index 82b3c09723..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel-ode/src/test/resources/log4j.properties
+++ /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.
-#
-
-# Set root logger level to WARN and its only appender to CONSOLE
-log4j.rootLogger=OFF, CONSOLE
-
-# log4j properties to work with commandline tools.
-log4j.category.org.mortbay=OFF
-log4j.category.org.hibernate.type=OFF
-log4j.category.org.objectweb=OFF
-log4j.category.org.apache.ode.axis2=OFF
-log4j.category.org.apache.ode.bpel.engine=OFF
-log4j.category.org.apache.ode.daohib.bpel.CorrelatorDaoImpl=OFF
-log4j.category.org.apache.ode.bpel.epr=OFF
-log4j.category.org.apache.tuscany.sca.implementation.bpel=OFF
-log4j.category.org.apache.tuscany.sca.implementation.bpel.ode=OFF
-log4j.category.org.apache.tuscany.sca.implementation.bpel.ode.provider=OFF
-
-# Console appender
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=[%p] - %C{1}.%M(%L) | %m%n
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/LICENSE b/branches/sca-java-1.5.1/modules/implementation-bpel/LICENSE
deleted file mode 100644
index baba9ca048..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/LICENSE
+++ /dev/null
@@ -1,251 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-===============================================================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-=================================================================================================================
-
-This module implementation-script temporarily includes one file under the following BSD license:
-
- Copyright (c) 2006, Sun Microsystems, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- - Neither the name of the Sun Microsystems, Inc. nor the names of
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
-=================================================================================================================
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/NOTICE b/branches/sca-java-1.5.1/modules/implementation-bpel/NOTICE
deleted file mode 100644
index a5023c910d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/NOTICE
+++ /dev/null
@@ -1,17 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-Unless otherwise indicated, all distribution made available by the Apache Software Foundation
-is provided to you under the terms and conditions of the Apache License Version 2.0 ("AL").
-A copy of the AL is provided with this distribution as the LICENSE file present in the
-root directory, and is also available at http://www.apache.org/licenses/.
-
-This product also includes software under the BSD license
-(see the LICENSE file contained in this distribution), with
-the following copyright:
-
-Copyright (c) 2006, Sun Microsystems, Inc.
-All rights reserved.
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/pom.xml b/branches/sca-java-1.5.1/modules/implementation-bpel/pom.xml
deleted file mode 100644
index a34a6266af..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/pom.xml
+++ /dev/null
@@ -1,98 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-bpel</artifactId>
- <name>Apache Tuscany SCA BPEL Implementation Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.bpel</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.bpel*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.java
deleted file mode 100644
index 9f8f9c0e9a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELFactory.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.implementation.bpel;
-
-/**
- * A factory for the BPEL implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface BPELFactory {
-
- /**
- * Creates a new BPEL implementation.
- *
- * @return
- */
- BPELImplementation createBPELImplementation();
-
- /**
- * Creates a new BPEL Process Definition
- *
- * @return
- */
- BPELProcessDefinition createBPELProcessDefinition();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.java
deleted file mode 100644
index d54add5391..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementation.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.implementation.bpel;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-/**
- * The model representing the BPEL implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface BPELImplementation extends Implementation {
-
- /**
- * Get the BPEL process Name
- *
- * @return
- */
- QName getProcess();
-
- /**
- * Set the BPEL process Name
- *
- * @param processName process QName
- */
- void setProcess(QName processName);
-
- /**
- * Get the BPEL process definition
- *
- * @return
- */
- BPELProcessDefinition getProcessDefinition();
-
- /**
- * Set the BPEL process definition
- *
- * @param processDefinition
- */
- void setProcessDefinition(BPELProcessDefinition processDefinition);
-
- /**
- * Returns the componentType for this implementation.
- *
- * @return
- */
- public ComponentType getComponentType();
-
- /**
- * Sets the componentType for this implementation
- *
- * @param componentType the component type to set
- */
- public void setComponentType(ComponentType componentType);
-
- /**
- * Returns the model resolver that can be used to resolve WSDLs and XSDs
- * referenced by the BPEL process.
- *
- * @return
- */
- ModelResolver getModelResolver();
-
- /**
- * Sets the model resolver that can be used to resolve WSDLs and XSDs referenced
- * by the BPEL process.
- *
- * @param modelResolver
- */
- void setModelResolver(ModelResolver modelResolver);
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java
deleted file mode 100644
index a6518ed11b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/BPELProcessDefinition.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.implementation.bpel.xml.BPELImportElement;
-import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-
-/**
- * The model representing a BPEL process definition.
- *
- * @version $Rev$ $Date$
- */
-public interface BPELProcessDefinition extends Base {
-
- /**
- * Get the BPEL process Name
- *
- * @return
- */
- QName getName();
-
- /**
- * Set the BPEL process Name
- *
- * @param processName process QName
- */
- void setName(QName name);
-
- /**
- * Get BPEL process URI
- *
- * @return URI for the process
- */
- String getURI();
-
- /**
- * Set the BPEL process URI
- *
- * @param uri for the process
- */
- void setURI(String uri);
-
- /**
- * Get the URL for the process location
- *
- * @return
- */
- String getLocation();
-
- /**
- * Set the URL for the process location
- *
- * @param url
- */
- void setLocation(String location);
-
- /**
- * Return the list of PartnerLinks for this process
- *
- * @return
- */
- List<BPELPartnerLinkElement> getPartnerLinks();
-
- /**
- * Return the list of imports for this process
- *
- * @return
- */
- List<BPELImportElement> getImports();
-
- /**
- * Return the collection of associated port types
- *
- * @return
- */
- public List<PortType> getPortTypes() ;
-
- /**
- * Return the collection of associated WSDL interfaces
- * @return
- */
- public List<WSDLInterface> getInterfaces() ;
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELFactoryImpl.java
deleted file mode 100644
index ab53964fb3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELFactoryImpl.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.implementation.bpel.impl;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-
-/**
- * A factory for the BPEL implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class BPELFactoryImpl implements BPELFactory {
-
- public BPELFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
- }
-
- public BPELImplementation createBPELImplementation() {
- return new BPELImplementationImpl();
- }
-
- public BPELProcessDefinition createBPELProcessDefinition() {
- return new BPELProcessDefinitionImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.java
deleted file mode 100644
index f1c943e49c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationImpl.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.implementation.bpel.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-
-/**
- * The model representing a BPEL implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class BPELImplementationImpl extends ImplementationImpl implements BPELImplementation {
-
- private QName processName;
- private BPELProcessDefinition processDefinition;
- private ComponentType componentType;
- private ModelResolver modelResolver;
-
- public QName getProcess() {
- return processName;
- }
-
- public void setProcess(QName processName) {
- this.processName = processName;
- }
-
- public BPELProcessDefinition getProcessDefinition() {
- return this.processDefinition;
- }
-
- public void setProcessDefinition(BPELProcessDefinition processDefinition) {
- this.processDefinition = processDefinition;
- }
-
- @Override
- public String getURI() {
- // The BPEL implementation does not have a URI
- return null;
- }
-
- @Override
- public void setURI(String uri) {
- // The BPEL implementation does not have a URI
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The BPEL implementation does not support constrainingTypes
- return null;
- }
-
- @Override
- public List<Property> getProperties() {
- // The BPEL implementation does not support properties
- return Collections.emptyList();
- }
-
- public ComponentType getComponentType() {
- return componentType;
- }
-
- public void setComponentType(ComponentType componentType) {
- this.componentType = componentType;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
- @Override
- public List<Service> getServices() {
- return componentType.getServices();
- }
-
- @Override
- public List<Reference> getReferences() {
- return componentType.getReferences();
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(this.getProcess()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof BPELImplementation) {
- if (getProcess() != null) {
- return getProcess().equals(((BPELImplementation)obj).getProcess());
- } else {
- return ((BPELImplementation)obj).getProcess() == null;
- }
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.java
deleted file mode 100644
index 5ce4f91376..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELProcessDefinitionImpl.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.implementation.bpel.impl;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-import org.apache.tuscany.sca.implementation.bpel.xml.BPELImportElement;
-import org.apache.tuscany.sca.implementation.bpel.xml.BPELPartnerLinkElement;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-
-/**
- * The BPEL process definition implementation.
- *
- * @version $Rev$ $Date$
- */
-class BPELProcessDefinitionImpl implements BPELProcessDefinition {
- private QName name;
- private String uri;
- private String location;
- private boolean unresolved;
- private List<BPELPartnerLinkElement> partnerLinks = new ArrayList<BPELPartnerLinkElement>();
- private List<BPELImportElement> imports = new ArrayList<BPELImportElement>();
- private List<PortType> thePortTypes = new ArrayList<PortType>();
- private List<WSDLInterface> theInterfaces = new ArrayList<WSDLInterface>();
-
- public QName getName() {
- return name;
- }
-
- public void setName(QName name) {
- this.name = name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- public List<BPELPartnerLinkElement> getPartnerLinks() {
- return partnerLinks;
- }
-
- public List<BPELImportElement> getImports() {
- return imports;
- }
-
- public List<PortType> getPortTypes() {
- return thePortTypes;
- }
-
- public List<WSDLInterface> getInterfaces() {
- return theInterfaces;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof BPELProcessDefinition) {
- if (getName() != null) {
- return getName().equals(((BPELProcessDefinition)obj).getName());
- } else {
- return ((BPELProcessDefinition)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java
deleted file mode 100644
index 2dd2cd304a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentModelResolver.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.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;
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-
-/**
- * A Model Resolver for BPEL process models.
- *
- * @version $Rev$ $Date$
- */
-public class BPELDocumentModelResolver implements ModelResolver {
-
- private Contribution contribution;
- private Map<QName, BPELProcessDefinition> map = new HashMap<QName, BPELProcessDefinition>();
-
- public BPELDocumentModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- }
-
- public void addModel(Object resolved) {
- BPELProcessDefinition process = (BPELProcessDefinition)resolved;
- map.put(process.getName(), process);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(((BPELProcessDefinition)resolved).getName());
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a definition for the given namespace
- QName qname = ((BPELProcessDefinition)unresolved).getName();
- BPELProcessDefinition resolved = (BPELProcessDefinition) 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(BPELProcessDefinition.class, (BPELProcessDefinition)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- }
- return (T)unresolved;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java
deleted file mode 100644
index 1c5c1c2bba..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELDocumentProcessor.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.bpel.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-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.implementation.bpel.BPELFactory;
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
-import org.apache.tuscany.sca.interfacedef.wsdl.xml.BPELPartnerLinkTypeExt;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * BPEL document processor responsible for reading a BPEL file and producing necessary model info about it
- *
- * TODO: The namespaces for WS-BPEL include 2 versions - only the earlier BPEL 1.1 versions are
- * supported at present - the BPEL 2.0 namespaces also need support. This will require inspection
- * of both BPEL process files and of WSDL files for their BPEL namespaces
- * @version $Rev$ $Date$
- */
-public class BPELDocumentProcessor extends BaseStAXArtifactProcessor implements URLArtifactProcessor<BPELProcessDefinition> {
- public final static QName BPEL_PROCESS_DEFINITION = new QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/", "process");
- public final static QName BPEL_EXECUTABLE_DEFINITION = new QName("http://docs.oasis-open.org/wsbpel/2.0/process/executable", "process");
- private static final String SCA_BPEL_NS = "http://docs.oasis-open.org/ns/opencsa/sca-bpel/200801";
- private static final String BPEL_NS = "http://schemas.xmlsoap.org/ws/2004/03/business-process/";
- private static final String BPEL_PLINK_NS = "http://schemas.xmlsoap.org/ws/2004/03/partner-link/";
- private static final String WSDL_NS = "http://schemas.xmlsoap.org/wsdl/";
- private static final QName PROCESS_ELEMENT = new QName(BPEL_NS, "process");
- private static final QName PARTNERLINK_ELEMENT = new QName(BPEL_NS, "partnerLink");
- private static final QName ONEVENT_ELEMENT = new QName(BPEL_NS, "onEvent");
- private static final QName RECEIVE_ELEMENT = new QName(BPEL_NS, "receive");
- private static final QName ONMESSAGE_ELEMENT = new QName(BPEL_NS, "onMessage");
- private static final QName INVOKE_ELEMENT = new QName(BPEL_NS, "invoke");
- private static final QName IMPORT_ELEMENT = new QName(BPEL_NS, "import");
- private static final String LINKTYPE_NAME = "partnerLinkType";
- private static final QName LINKTYPE_ELEMENT = new QName(BPEL_PLINK_NS, LINKTYPE_NAME);
- public final static String NAME_ELEMENT = "name";
-
- private final static XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- private final BPELFactory factory;
- private WSDLFactory WSDLfactory;
- private Monitor monitor;
-
- public BPELDocumentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.factory = modelFactories.getFactory(BPELFactory.class);
- this.WSDLfactory = modelFactories.getFactory(WSDLFactory.class);
- this.monitor = monitor;
- }
-
- public String getArtifactType() {
- return "*.bpel";
- }
-
- public Class<BPELProcessDefinition> getModelType() {
- return BPELProcessDefinition.class;
- }
-
- public BPELProcessDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- BPELProcessDefinition processDefinition = null;
- try {
- // for now we are just using process name
- // and relying on componentType file for service definition
- // so it's OK to set resolved for now
- processDefinition = readProcessDefinition(artifactURL);
- processDefinition.setURI(artifactURI.toString());
- processDefinition.setUnresolved(false);
- } catch (Exception e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", artifactURL, ce);
- }
-
- return processDefinition;
- }
-
- public void resolve(BPELProcessDefinition model, ModelResolver resolver) throws ContributionResolveException {
- // FIXME - serious resolving needs to happen here
-
- // Step 1 is to resolve the WSDL files referenced from this BPEL process
- // - one complexity here is that the WSDL definitions hold BPEL extension elements for
- // the partnerLinkType declarations - and these must be used in later steps
- //
- // Step 2 is to take all the partnerLink definitions and establish the PortType being
- // used, by tracing through the related partnerLinkType declarations - the PortType is
- // effectively a definition of the interface used by the partnerLink.
- // - another consideration here is that each partnerLink can involve 2 interfaces, one
- // for the forward calls to the process, the other for calls from the process - depending
- // on whether the partnerLink is a reference or a service, one of these interfaces is a
- // callback interface.
-
- List<BPELImportElement> theImports = model.getImports();
- for (BPELImportElement theImport : theImports) {
-
- // Deal with WSDL imports
- if (theImport.getImportType().equals(WSDL_NS)) {
- String wsdlLocation = theImport.getLocation();
- String wsdlNamespace = theImport.getNamespace();
-
- // Resolve the WSDL definition
- WSDLDefinition proxy = WSDLfactory.createWSDLDefinition();
- proxy.setUnresolved(true);
- proxy.setNamespace(wsdlNamespace);
- if (wsdlLocation != null) {
- proxy.setLocation(URI.create(wsdlLocation));
- }
- WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy);
- if (resolved != null && !resolved.isUnresolved()) {
- theImport.setWSDLDefinition(resolved);
- } else {
- error("CannotResolveWSDLReference", resolver, wsdlLocation, wsdlNamespace);
- return;
- } // end if
- } // end if
- } // end for
-
- // Fetch the sets of partner links, port types and interfaces
- List<BPELPartnerLinkTypeElement> thePLinkTypes = getPartnerLinkTypes( theImports );
- Collection<WSDLInterface> theInterfaces = (Collection<WSDLInterface>)new ArrayList<WSDLInterface>();
- Collection<PortType> thePortTypes = getAllPortTypes( theImports, theInterfaces, resolver );
-
- // Store the Port Types and the Interfaces for later calculation of the component type...
- model.getPortTypes().addAll(thePortTypes);
- model.getInterfaces().addAll(theInterfaces);
-
- // Now, for each partnerLink in the BPEL process, find the related partnerLinkType
- // element
- List<BPELPartnerLinkElement> thePartnerLinks = model.getPartnerLinks();
- for (BPELPartnerLinkElement thePartnerLink : thePartnerLinks) {
- QName partnerLinkType = thePartnerLink.getPartnerLinkType();
- BPELPartnerLinkTypeElement pLinkType = findPartnerLinkType(partnerLinkType, thePLinkTypes);
- if (pLinkType == null) {
- error("PartnerLinkNoMatchingType", thePartnerLink, thePartnerLink.getName());
- } else
- thePartnerLink.setPartnerLinkType(pLinkType);
- } // end for
-
- } // end resolve
-
- /**
- * Retrieve all the Partner Link types defined in the imported WSDL files
- *
- * @param theImports
- */
- private List<BPELPartnerLinkTypeElement> getPartnerLinkTypes( List<BPELImportElement> theImports) throws ContributionResolveException {
-
- List<BPELPartnerLinkTypeElement> thePLinks = new ArrayList<BPELPartnerLinkTypeElement>();
-
- // We must find the partner link type elements from amongst the imported
- // WSDLs
- for (BPELImportElement theImport : theImports) {
- if (theImport.getImportType().equals(WSDL_NS)) {
-
- // Find all the WSDL definitions matching the imported namespace
- List<Definition> wsdlDefinitions = new ArrayList<Definition>();
- WSDLDefinition theWSDL = theImport.getWSDLDefinition();
- wsdlDefinitions.add(theWSDL.getDefinition());
- for (WSDLDefinition importedWSDL: theWSDL.getImportedDefinitions()) {
- wsdlDefinitions.add(importedWSDL.getDefinition());
- }
-
- // The BPEL partnerLinkType elements are extension elements within
- // the WSDL definitions
- for (Definition wsdlDefinition: wsdlDefinitions) {
- for (ExtensibilityElement theElement : (List<ExtensibilityElement>)wsdlDefinition.getExtensibilityElements()) {
- QName elementType = theElement.getElementType();
- if (elementType.equals(LINKTYPE_ELEMENT)) {
- BPELPartnerLinkTypeExt pLinkExt = (BPELPartnerLinkTypeExt)theElement;
-
- // Fetch the name of the partnerLinkType
- String name = pLinkExt.getName();
- QName qName = new QName(wsdlDefinition.getTargetNamespace(), name);
- BPELPartnerLinkTypeElement pLinkElement = new BPELPartnerLinkTypeElement(qName);
-
- // The partnerLinkType must have one and may have 2 role
- // child elements
- int count = 0;
- for (int i = 0; i < 2; i++) {
- if (pLinkExt.getRoleName(i) == null)
- continue;
- PortType pType = wsdlDefinition.getPortType(pLinkExt.getRolePortType(i));
- if (count == 0) {
- pLinkElement.setRole1(pLinkExt.getRoleName(i), pLinkExt.getRolePortType(i), pType);
- count++;
- } else if (count == 1) {
- pLinkElement.setRole2(pLinkExt.getRoleName(i), pLinkExt.getRolePortType(i), pType);
- count++;
- } else {
- break;
- } // end if
- } // end for
-
- if (count == 0) {
- error("PartnerLinkTypeNoRoles", theElement, pLinkElement.getName());
- throw new ContributionResolveException("partnerLinkType " + pLinkElement.getName() + " has no Roles defined");
- } else
- thePLinks.add(pLinkElement);
- } // end if
-
- } // end for
- }
- }
- } // end for
- return thePLinks;
- } // end getPartnerLinkTypes
-
- /**
- * Returns all the portTypes referenced by the process.
- *
- * @param theImports
- * @param theInterfaces
- * @param resolver
- * @return
- * @throws ContributionResolveException
- */
- private Collection<PortType> getAllPortTypes(List<BPELImportElement> theImports,
- Collection<WSDLInterface> theInterfaces, ModelResolver resolver) throws ContributionResolveException {
-
- Collection<PortType> thePortTypes = (Collection<PortType>)new ArrayList<PortType>();
- for (BPELImportElement theImport : theImports) {
- if (theImport.getImportType().equals(WSDL_NS)) {
-
- // Find all the WSDL definitions matching the imported namespace
- List<Definition> wsdlDefinitions = new ArrayList<Definition>();
- WSDLDefinition theWSDL = theImport.getWSDLDefinition();
- wsdlDefinitions.add(theWSDL.getDefinition());
- for (WSDLDefinition importedWSDL: theWSDL.getImportedDefinitions()) {
- wsdlDefinitions.add(importedWSDL.getDefinition());
- }
- for (Definition wsdlDefinition: wsdlDefinitions) {
-
- Collection<PortType> portTypes = (Collection<PortType>)wsdlDefinition.getPortTypes().values();
- thePortTypes.addAll(portTypes);
-
- // Create WSDLInterface elements for each PortType found
- for (PortType portType : portTypes) {
- WSDLObject<PortType> wsdlPortType = theWSDL.getWSDLObject(PortType.class, portType.getQName());
- WSDLInterface wsdlInterface;
- if (wsdlPortType != null) {
- // Introspect the WSDL portType and add the resulting
- // WSDLInterface to the resolver
- try {
- theWSDL.setDefinition(wsdlPortType.getDefinition());
- wsdlInterface = WSDLfactory.createWSDLInterface(wsdlPortType.getElement(), theWSDL, resolver);
- wsdlInterface.setWsdlDefinition(theWSDL);
- } catch (InvalidInterfaceException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- throw ce;
- } // end try
- resolver.addModel(wsdlInterface);
- theInterfaces.add(wsdlInterface);
- } // end if
- } // end for
- }
- }
- } // end for
-
- return thePortTypes;
- } // end getAllPortTypes
-
- /**
- * Finds a partnerLinkType definition within the WSDLs imported by the BPEL
- * process.
- *
- * @param partnerLinkTypeName - the name of the partnerLinkType
- * @param theImports a list of the WSDL import declarations
- * @return a BPELPartnerLinkTypeElement for the partnerLinkType or null if it cannot be
- * found
- */
- private BPELPartnerLinkTypeElement findPartnerLinkType( QName partnerLinkTypeName,
- List<BPELPartnerLinkTypeElement> thePLinkTypes) {
- // We must find the partner link type element from amongst the imported WSDLs
- for ( BPELPartnerLinkTypeElement thePLinkType : thePLinkTypes ){
- if( thePLinkType.getName().equals(partnerLinkTypeName) ) return thePLinkType;
- } // end for
- return null;
- } // end findPartnerLinkType
-
-
- /**
- * Read a process definition.
- *
- * @param doc
- * @return
- * @throws Exception
- */
- private BPELProcessDefinition readProcessDefinition(URL doc) throws Exception {
- BPELProcessDefinition processDefinition = factory.createBPELProcessDefinition();
- processDefinition.setUnresolved(true);
- processDefinition.setLocation(doc.toString());
-
- InputStream is = doc.openStream();
- XMLStreamReader reader = null;
- try {
- reader = inputFactory.createXMLStreamReader(is);
-
- /*
- * The principle here is to look for partnerLink elements, which
- * form either services or references. A partnerLink can be EITHER -
- * the algorithm for deciding is: 1) Explicit marking with
- * sca:reference or sca:service attribute 2) "first use" of the
- * partnerLink by specific BPEL activity elements: <onEvent../>,
- * <receive../> or <pick../> elements imply a service <invoke../>
- * implies a reference
- */
-
- // TODO - need to handle <scope../> elements as kind of "nested" processes
- // - and scopes introduce the possibility of partnerLinks with the
- // same name at different levels of scope.... (yuk!!)
- boolean completed = false;
- while (!completed) {
- switch (reader.next()) {
- case START_ELEMENT:
- QName qname = reader.getName();
- if (BPEL_PROCESS_DEFINITION.equals(qname) || BPEL_EXECUTABLE_DEFINITION.equals(qname)) {
- QName processName = new QName(getString(reader, org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE), getString(reader, NAME_ELEMENT));
- processDefinition.setName(processName);
- } else if (PARTNERLINK_ELEMENT.equals(qname)) {
- processDefinition.getPartnerLinks().add(processPartnerLinkElement(reader));
- } else if (ONEVENT_ELEMENT.equals(qname) || RECEIVE_ELEMENT.equals(qname) || ONMESSAGE_ELEMENT.equals(qname)) {
- processPartnerLinkAsService(reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks());
- } else if (INVOKE_ELEMENT.equals(qname)) {
- processPartnerLinkAsReference(reader.getAttributeValue(null, "partnerLink"), processDefinition.getPartnerLinks());
- } else if (IMPORT_ELEMENT.equals(qname)) {
- processDefinition.getImports().add(processImportElement(reader));
- } // end if
- break;
- case END_ELEMENT:
- if (PROCESS_ELEMENT.equals(reader.getName())) {
- completed = true;
- break;
- } // end if
- } // end switch
- } // end while
- } finally {
- if (reader != null)
- reader.close();
- is.close();
- } // end try
-
- return processDefinition;
- } // end readProcessDefinition
-
- /**
- * Processes a partnerLink element from the BPEL process and creates a
- * BPELPartnerLink object
- *
- * @param reader
- */
- private BPELPartnerLinkElement processPartnerLinkElement(XMLStreamReader reader) throws ContributionReadException {
- BPELPartnerLinkElement partnerLink = new BPELPartnerLinkElement(
- reader.getAttributeValue(null, "name"),
- getQNameValue(reader, reader.getAttributeValue(null, "partnerLinkType")),
- reader.getAttributeValue(null, "myRole"),
- reader.getAttributeValue(null, "partnerRole"));
-
- // See if there are any SCA extension attributes
- String scaService = reader.getAttributeValue(SCA_BPEL_NS, "service");
- String scaReference = reader.getAttributeValue(SCA_BPEL_NS, "reference");
- if ((scaService != null) && (scaReference != null)) {
- // It is incorrect to set both service & reference attributes
- error("PartnerLinkHasBothAttr", partnerLink, reader.getAttributeValue(null, "name"));
- throw new ContributionReadException("BPEL PartnerLink " + reader.getAttributeValue(null, "name") + " has both sca:reference and sca:service attributes set");
- }
-
- // Set the SCA type and the related name, if present
- if (scaService != null)
- partnerLink.setAsService(scaService);
- else if (scaReference != null)
- partnerLink.setAsReference(scaReference);
- return partnerLink;
-
- } // end processPartnerLinkElement
-
- /**
- * Processes an <import../> element from the BPEL process and creates a
- * BPELImportElement object
- *
- * @param reader
- */
- private BPELImportElement processImportElement(XMLStreamReader reader) {
- return (new BPELImportElement(reader.getAttributeValue(null, "location"),
- reader.getAttributeValue(null, "importType"),
- reader.getAttributeValue(null, "namespace")));
-
- } // end processImportElement
-
- /**
- * Mark a named partnerLink as a Service, unless it is already marked as a
- * Reference
- *
- * @param partnerLinkName
- * @param partnerLinks
- */
- private void processPartnerLinkAsService(String partnerLinkName, List<BPELPartnerLinkElement> partnerLinks) {
- BPELPartnerLinkElement partnerLink = findPartnerLinkByName(partnerLinks, partnerLinkName);
- if (partnerLink == null) {
- warning("ReferencePartnerLinkNotInList", partnerLinkName, partnerLinkName);
- } else {
- // Set the type of the partnerLink to "service" if not already
- // set...
- if (!partnerLink.isSCATyped())
- partnerLink.setAsService(partnerLinkName);
- } // endif
- } // end processPartnerLinkAsReference
-
- /**
- * Mark a named partnerLink as a Reference, unless it is already marked as a
- * Service
- *
- * @param partnerLinkName
- * @param partnerLinks
- */
- private void processPartnerLinkAsReference(String partnerLinkName, List<BPELPartnerLinkElement> partnerLinks) {
- BPELPartnerLinkElement partnerLink = findPartnerLinkByName(partnerLinks, partnerLinkName);
- if (partnerLink == null) {
- warning("ReferencePartnerLinkNotInList", partnerLinkName, partnerLinkName);
- } else {
- // Set the type of the partnerLink to "service" if not already
- // set...
- if (!partnerLink.isSCATyped())
- partnerLink.setAsReference(partnerLinkName);
- } // endif
- } // end processPartnerLinkAsReference
-
- /**
- * Finds a PartnerLink by name from a List of PartnerLinks returns null if
- * there is no partnerLink with a matching name - returns the PartnerLink
- * with a matching name
- *
- * @param partnerLinks
- * @param partnerLinkName
- */
- private BPELPartnerLinkElement findPartnerLinkByName(List<BPELPartnerLinkElement> partnerLinks, String partnerLinkName) {
- // Scan the list looking for a partner link with the supplied name
- Iterator<BPELPartnerLinkElement> it = partnerLinks.iterator();
- while (it.hasNext()) {
- BPELPartnerLinkElement thePartnerLink = it.next();
- if (thePartnerLink.getName().equals(partnerLinkName))
- return thePartnerLink;
- }
- return null;
- } // end method findPartnerLinkByName
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java
deleted file mode 100644
index d4c55dc699..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImplementationProcessor.java
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
-import org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Implements a StAX artifact processor for BPEL implementations.
- *
- * The artifact processor is responsible for processing <implementation.bpel>
- * elements in SCA assembly XML composite files and populating the BPEL
- * implementation model, resolving its references to other artifacts in the SCA
- * contribution, and optionally write the model back to SCA assembly XML.
- *
- * @version $Rev$ $Date$
- */
-public class BPELImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<BPELImplementation> {
- private static final String PROCESS = "process";
- private static final String IMPLEMENTATION_BPEL = "implementation.bpel";
- private static final QName IMPLEMENTATION_BPEL_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_BPEL);
-
- private AssemblyFactory assemblyFactory;
- private BPELFactory bpelFactory;
- private WSDLFactory wsdlFactory;
- private Monitor monitor;
-
- public BPELImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- this.bpelFactory = modelFactories.getFactory(BPELFactory.class);
- this.monitor = monitor;
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_BPEL_QNAME;
- }
-
- public Class<BPELImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return BPELImplementation.class;
- }
-
- public BPELImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert IMPLEMENTATION_BPEL_QNAME.equals(reader.getName());
-
- // Read an <implementation.bpel> element
- BPELImplementation implementation = null;
-
- // Read the process attribute.
- QName process = getAttributeValueNS(reader, PROCESS);
- if (process == null) {
- return implementation;
- }
-
- // Create and initialize the BPEL implementation model
- implementation = bpelFactory.createBPELImplementation();
- implementation.setProcess(process);
- implementation.setUnresolved(true);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_BPEL_QNAME.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(BPELImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- if( implementation != null && implementation.isUnresolved())
- {
- implementation.setModelResolver(resolver);
-
- BPELProcessDefinition processDefinition = resolveBPELProcessDefinition(implementation, resolver);
- if(processDefinition.isUnresolved()) {
- error("BPELProcessNotFound", implementation, processDefinition.getName());
- } else {
- implementation.setProcessDefinition(processDefinition);
-
- // Get the component type from the process definition
- generateComponentType( implementation );
-
- //resolve component type
- mergeComponentType(resolver, implementation);
-
- //set current implementation resolved
- implementation.setUnresolved(false);
- }
- }
-
- } // end resolve
-
- public void write( BPELImplementation bpelImplementation,
- XMLStreamWriter writer ) throws ContributionWriteException, XMLStreamException {
- //FIXME Deal with policy processing...
- // Write <implementation.bpel process="..."/>
- // policyProcessor.writePolicyPrefixes(bpelImplementation, writer);
- writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_BPEL);
- // policyProcessor.writePolicyAttributes(bpelImplementation, writer);
-
- if (bpelImplementation.getProcess() != null) {
- writer.writeAttribute(PROCESS, bpelImplementation.getProcess().toString() );
- }
-
- writer.writeEndElement();
-
- } // end write
-
- private BPELProcessDefinition resolveBPELProcessDefinition(BPELImplementation impl, ModelResolver resolver) throws ContributionResolveException {
- QName processName = impl.getProcess();
- BPELProcessDefinition processDefinition = this.bpelFactory.createBPELProcessDefinition();
- processDefinition.setName(processName);
- processDefinition.setUnresolved(true);
-
- return resolver.resolveModel(BPELProcessDefinition.class, processDefinition);
- } // end resolveBPELProcessDefinition
-
- /**
- * Calculates the component type of the supplied implementation and attaches it to the
- * implementation.
- *
- * @param impl
- * @throws ContributionResolveException
- */
- private void generateComponentType(BPELImplementation impl) throws ContributionResolveException {
-
- // Create a ComponentType and mark it unresolved
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- impl.setComponentType(componentType);
-
- // Each partner link in the process represents either a service or a
- // reference
- // - or both, in the sense of involving a callback
- BPELProcessDefinition theProcess = impl.getProcessDefinition();
- List<BPELPartnerLinkElement> partnerLinks = theProcess.getPartnerLinks();
-
- for (BPELPartnerLinkElement pLink : partnerLinks) {
-
- // check that the partner link has been designated as service or
- // reference in SCA terms
- if (pLink.isSCATyped()) {
- String scaName = pLink.getSCAName();
- if (pLink.querySCAType().equals("reference")) {
- componentType.getReferences().add(generateReference(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces()));
- } else {
- componentType.getServices().add(generateService(scaName, pLink.getMyRolePortType(), pLink.getPartnerRolePortType(), theProcess.getInterfaces()));
- } // end if
- } // end if
- } // end for
-
- } // end getComponentType
-
- /**
- * Create an SCA reference for a partnerLink
- * @param name - name of the reference
- * @param myRolePT - partner link type of myRole
- * @param partnerRolePT - partner link type of partnerRole
- * @param theInterfaces - list of WSDL interfaces associated with the BPEL process
- * @return
- */
- private Reference generateReference( String name, PortType myRolePT,
- PortType partnerRolePT, Collection<WSDLInterface> theInterfaces) throws ContributionResolveException {
-
- Reference reference = assemblyFactory.createReference();
- WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- // Establish whether there is just a call interface or a call + callback
- // interface
- PortType callPT = null;
- PortType callbackPT = null;
- if (myRolePT != null) {
- callPT = myRolePT;
- // If the 2 port types are not the same one, there is a callback...
- if (partnerRolePT != null) {
- if (!myRolePT.getQName().equals(partnerRolePT.getQName())) {
- callbackPT = partnerRolePT;
- } // end if
- } // end if
- } else if (partnerRolePT != null) {
- callPT = partnerRolePT;
- } // end if
-
- // No interfaces mean an error
- if (callPT == null && callbackPT == null) {
- error("MyRolePartnerRoleNull", theInterfaces);
- } // end if
-
- // Set the name of the reference to the supplied name and the
- // multiplicity of the reference
- // to 1..1
- // TODO: support other multiplicities
- reference.setName(name);
- reference.setMultiplicity(Multiplicity.ONE_ONE);
-
- if (callPT != null) {
- // Set the call interface and, if present, the callback interface
- WSDLInterface callInterface = null;
- for (WSDLInterface anInterface : theInterfaces) {
- if (anInterface.getPortType().getQName().equals(callPT.getQName()))
- callInterface = anInterface;
- } // end for
- if (callInterface == null) {
- error("NoInterfaceForPortType", theInterfaces, callPT.getQName().toString());
- } else
- reference.getInterfaceContract().setInterface(callInterface);
- }
-
- // There is a callback if the partner role is not null and if the
- // partner role port type
- // is not the same as the port type for my role
- if (callbackPT != null) {
- WSDLInterface callbackInterface = null;
- for (WSDLInterface anInterface : theInterfaces) {
- if (anInterface.getPortType().getQName().equals(callbackPT.getQName()))
- callbackInterface = anInterface;
- } // end for
- if (callbackInterface == null) {
- error("NoInterfaceForPortType", theInterfaces, callbackPT.getQName().toString());
- } else
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- } // end if
-
- return reference;
- } // end generateReference
-
- /**
- * Create an SCA service for a partnerLink
- * @param name - name of the reference
- * @param myRolePT - partner link type of myRole
- * @param partnerRolePT - partner link type of partnerRole
- * @param theInterfaces - list of WSDL interfaces associated with the BPEL process
- * @return
- */
- private Service generateService( String name, PortType myRolePT,
- PortType partnerRolePT, Collection<WSDLInterface> theInterfaces )
- throws ContributionResolveException {
- Service service = assemblyFactory.createService();
- WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- // Set the name of the service to the supplied name
- service.setName(name);
-
- // Establish whether there is just a call interface or a call + callback
- // interface
- PortType callPT = null;
- PortType callbackPT = null;
- if (myRolePT != null) {
- callPT = myRolePT;
- // If the 2 port types are not the same one, there is a callback...
- if (partnerRolePT != null) {
- if (!myRolePT.getQName().equals(partnerRolePT.getQName())) {
- callbackPT = partnerRolePT;
- } // end if
- } // end if
- } else if (partnerRolePT != null) {
- callPT = partnerRolePT;
- } // end if
-
- // No interfaces mean an error
- if (callPT == null && callbackPT == null) {
- error("MyRolePartnerRoleNull", theInterfaces);
- } // end if
-
- if (callPT != null) {
- // Set the call interface and, if present, the callback interface
- WSDLInterface callInterface = null;
- for (WSDLInterface anInterface : theInterfaces) {
- if (anInterface.getPortType().getQName().equals(callPT.getQName()))
- callInterface = anInterface;
- } // end for
- if (callInterface == null) {
- error("NoInterfaceForPortType", theInterfaces, callPT.getQName().toString());
- } else
- service.getInterfaceContract().setInterface(callInterface);
- } // end if
-
- // There is a callback if the partner role is not null and if the
- // partner role port type
- // is not the same as the port type for my role
- if (callbackPT != null) {
- WSDLInterface callbackInterface = null;
- for (WSDLInterface anInterface : theInterfaces) {
- if (anInterface.getPortType().getQName().equals(callbackPT.getQName()))
- callbackInterface = anInterface;
- } // end for
- if (callbackInterface == null) {
- error("NoInterfaceForPortType", theInterfaces, callbackPT.getQName().toString());
- } else
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- } // end if
-
- return service;
- } // end generateService
-
- /**
- * Merge the componentType from introspection and from external file
- *
- * Note the setting of the DataBinding for both Services and References to DOM, since this is
- * the data format expected by the ODE BPEL implementation code.
- *
- * @param resolver
- * @param impl
- */
- private void mergeComponentType(ModelResolver resolver, BPELImplementation impl) {
-
- // Load the component type from a component type file, if any
- ComponentType componentType = getComponentType(resolver, impl);
- if (componentType != null && !componentType.isUnresolved()) {
-
- // References...
- Map<String, Reference> refMap = new HashMap<String, Reference>();
- for (Reference reference : componentType.getReferences()) {
- refMap.put(reference.getName(), reference);
- } // end for
-
- // For the present, overwrite anything arising from the component
- // type sidefile if
- // equivalent services are defined in the implementation.
- // TODO - a more careful merge must be done, using the
- // implementation introspection data
- // as the master but adding any additional and non-conflicting
- // information from the
- // sidefile
- for (Reference ref : impl.getReferences()) {
- refMap.put(ref.getName(), ref);
- } // end for
-
- impl.getReferences().clear();
- impl.getReferences().addAll(refMap.values());
-
- // Services.....
- Map<String, Service> serviceMap = new HashMap<String, Service>();
- for (Service service : componentType.getServices()) {
- serviceMap.put(service.getName(), service);
- } // end for
-
- // For the present, overwrite anything arising from the component
- // type sidefile if
- // equivalent services are defined in the implementation.
- // TODO - a more careful merge must be done, using the
- // implementation introspection data
- // as the master but adding any additional and non-conflicting
- // information from the
- // sidefile
- for (Service svc : impl.getServices()) {
- serviceMap.put(svc.getName(), svc);
- } // end for
-
- impl.getServices().clear();
- impl.getServices().addAll(serviceMap.values());
-
- // Properties
- Map<String, Property> propMap = new HashMap<String, Property>();
- for (Property property : componentType.getProperties()) {
- propMap.put(property.getName(), property);
- } // end for
-
- // A simple overwrite of any equivalent properties from the
- // component type sidefile
- for (Property prop : impl.getProperties()) {
- propMap.put(prop.getName(), prop);
- }
- }
- }
-
-
- /**
- * Find the componentType side file based on the BPEL implementation artifact
- * @param resolver
- * @param impl
- * @return
- */
- private ComponentType getComponentType(ModelResolver resolver, BPELImplementation impl) {
- String bpelProcessURI = impl.getProcessDefinition().getURI().toString();
-
- // Get the component type definition contained in the componentType file, if any
- String componentTypeURI = bpelProcessURI.replace(".bpel", ".componentType");
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- componentType.setURI(componentTypeURI);
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (!componentType.isUnresolved()) {
- return componentType;
- }
- return null;
- } // end getComponentType
-
- /**
- * Returns a QName from its string representation in a named attribute of an XML element
- * supplied in an XMLStreamReader
- *
- * QName attributes of an XML element (such as BPEL process) is presented in one of
- * two alternative formats:
- * 1) In the form of a local name with a prefix, with the prefix referencing a namespace
- * URI declaration elsewhere in the composite (typically on the composite element)
- *
- * ie: nms:SomeName
- * xmlns:nms="http://example.com/somenamespace"
- *
- * 2) In the XML Namespaces recommendation format (see http://jclark.com/xml/xmlns.htm )
- * where the namespace URI and the local name are encoded into a single string, with the
- * namespace URI enclosed between a pair of braces {...}
- *
- * ie: {http://example.com/somenamespace}SomeName
- */
- private QName getAttributeValueNS(XMLStreamReader reader, String attribute) {
- String fullValue = reader.getAttributeValue(null, attribute);
- if (fullValue == null) {
- error("AttributeProcessMissing", reader);
- return null;
- }
-
- // Deal with the attribute in the XML Namespaces recommendation format
- // - trim off any leading/trailing spaces and check that the first
- // character is '{'
- if (fullValue.trim().charAt(0) == '{') {
- try {
- // Attempt conversion to a QName object
- QName theProcess = QName.valueOf(fullValue);
- return theProcess;
- } catch (IllegalArgumentException e) {
- // This exception happens if the attribute begins with '{' but
- // doesn't conform
- // to the XML Namespaces recommendation format
- error("AttributeWithoutNamespace", reader, attribute, fullValue);
- return null;
- }
- } // endif
-
- // Deal with the attribute in the local name + prefix format
- if (fullValue.indexOf(":") < 0) {
- error("AttributeWithoutPrefix", reader, attribute, fullValue);
- return null;
- }
- String prefix = fullValue.substring(0, fullValue.indexOf(":"));
- String name = fullValue.substring(fullValue.indexOf(":") + 1);
- String nsUri = reader.getNamespaceContext().getNamespaceURI(prefix);
- if (nsUri == null) {
- error("AttributeUnrecognizedNamespace", reader, attribute, fullValue);
- return null;
- }
- return new QName(nsUri, name, prefix);
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-bpel-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java
deleted file mode 100644
index bf0020323c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELImportElement.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.xml;
-
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-
-/**
- * Represents an <import.../> element in a BPEL process
- * - this has attributes:
- * location
- * importType
- * namespace
- *
- * @version $Rev$ $Date$
- */
-public class BPELImportElement {
-
- private String location;
- private String importType;
- private String namespace;
- private WSDLDefinition theWSDL = null;
-
- public BPELImportElement(String location, String importType, String namespace) {
- this.location = location;
- this.importType = importType;
- this.namespace = namespace;
- }
-
- public String getImportType() {
- return importType;
- }
-
- public String getLocation() {
- return location;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public void setWSDLDefinition(WSDLDefinition theDefinition) {
- theWSDL = theDefinition;
- }
-
- public WSDLDefinition getWSDLDefinition() {
- return theWSDL;
- }
-
-} // end class BPELImportElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
deleted file mode 100644
index b7f5d1d3f2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkElement.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.bpel.xml;
-
-import javax.xml.namespace.QName;
-
-import javax.wsdl.PortType;
-
-/**
- * Represents a <partnerLink.../> element in a BPEL process
- * - this has attributes:
- * name
- * partnerLinkType
- * myRole
- * partnerRole
- * - plus zero or more property elements as children
- *
- * The partnerlink may also be given an SCA Type - either of service or of reference - this must
- * generally be calculated and set on the partnerLink by inspecting the BPEL process
- *
- * @version $Rev$ $Date$
- */
-public class BPELPartnerLinkElement {
-
- private String REFERENCE_TYPE = "reference";
- private String SERVICE_TYPE = "service";
- private String name;
- private QName partnerLinkType;
- private BPELPartnerLinkTypeElement pLinkType = null;
- private String myRole;
- private String partnerRole;
- private String scaName; // Holds the SCA reference or service name
- private String scaType = null; // Holds the SCA type = null | service | reference
-
- public BPELPartnerLinkElement(String name,
- QName partnerLinkType,
- String myRole,
- String partnerRole ) {
- this.name = name;
- this.partnerLinkType = partnerLinkType;
- this.myRole = myRole;
- this.partnerRole = partnerRole;
-
- scaName = null;
- }
-
- public QName getPartnerLinkType() {
- return partnerLinkType;
- }
-
- public void setPartnerLinkType( BPELPartnerLinkTypeElement pLinkType ) {
- this.pLinkType = pLinkType;
- }
-
-
- public PortType getMyRolePortType() {
- return getRolePortType( myRole );
- }
-
- public PortType getPartnerRolePortType() {
- return getRolePortType( partnerRole );
- }
-
- private PortType getRolePortType( String theRole ) {
- if (theRole == null || theRole.length() == 0) {
- return null;
- } // end if
- if (theRole.equals(pLinkType.getRole1Name())) {
- return pLinkType.getRole1pType();
- } else if (theRole.equals(pLinkType.getRole2Name())) {
- return pLinkType.getRole2pType();
- } // end if
- return null;
- } // end getRolePortType
-
- public String getName() {
- return name;
- }
-
- public String getMyRole() {
- return myRole;
- }
-
- public String getPartnerRole() {
- return partnerRole;
- }
-
- public void setSCAName( String name ) {
- scaName = name;
- }
-
- public String getSCAName() {
- return scaName;
- }
-
- public boolean isSCATyped() {
- return ( !(scaType == null) );
- }
-
- public void setAsReference( String name ) {
- scaType = REFERENCE_TYPE;
- scaName = name;
- }
-
- public void setAsService( String name ) {
- scaType = SERVICE_TYPE;
- scaName = name;
- }
-
- public String querySCAType() {
- return scaType;
- }
-
-} // end class BPELPartnerLinkElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.java
deleted file mode 100644
index fdaf98a97f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/xml/BPELPartnerLinkTypeElement.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.implementation.bpel.xml;
-
- import javax.xml.namespace.QName;
-
- import javax.wsdl.extensions.ExtensibilityElement;
- import javax.wsdl.PortType;
-
-/**
- * Represents a <partnerLinkType.../> element related to a BPEL process
- * - this has attributes:
- * name
- * Role1 name
- * Role1 portType
- * Role2 name
- * Role2 portType
- *
- * - in the XML the 2 roles are child elements of the partnerLinkType element, but there
- * seems little point in reflecting this back into this model - it is simpler to include
- * both roles within the representation of the partnerLinkType itself
- *
- * @version $Rev$ $Date$
- */
-public class BPELPartnerLinkTypeElement implements ExtensibilityElement {
-
- private QName name;
- private String Role1name = null;
- private QName Role1porttype = null;
- private PortType Role1pType = null;
- private String Role2name = null;
- private QName Role2porttype = null;
- private PortType Role2pType = null;
- private QName elementType = null;
- private Boolean required = false;
-
- public BPELPartnerLinkTypeElement(QName name) {
- this.name = name;
- }
-
- public QName getName() {
- return name;
- }
-
- public void setRole1(String name, QName portType, PortType pType) {
- Role1name = name;
- Role1porttype = portType;
- Role1pType = pType;
- }
-
- public void setRole2(String name, QName portType, PortType pType) {
- Role2name = name;
- Role2porttype = portType;
- Role2pType = pType;
- }
-
- public String getRole1Name() {
- return Role1name;
- }
-
- public String getRole2Name() {
- return Role2name;
- }
-
- public QName getRole1PortType() {
- return Role1porttype;
- }
-
- public QName getRole2PortType() {
- return Role2porttype;
- }
-
- public PortType getRole1pType() {
- return Role1pType;
- }
-
- public PortType getRole2pType() {
- return Role2pType;
- }
-
- public QName getElementType() {
- return elementType;
- }
-
- public Boolean getRequired() {
- return required;
- }
-
- public void setElementType(QName elementType) {
- this.elementType = elementType;
- }
-
- public void setRequired(java.lang.Boolean required) {
- this.required = required;
- }
-
-} // end BPELPartnerLinkType
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 03ef3e3a7f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.bpel.xml.BPELImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index f6fd442f56..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.bpel.xml.BPELDocumentProcessor;type=.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 08930e29ff..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.implementation.bpel.xml.BPELDocumentModelResolver;model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
deleted file mode 100644
index 4276e938f1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
+++ /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.implementation.bpel.impl.BPELFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties
deleted file mode 100644
index b6d8bdc0f1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/main/resources/impl-bpel-validation-messages.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-CannotResolveWSDLReference = BPELDocumentProcessor:resolve - unable to resolve WSDL referenced by BPEL import WSDL location: {0} WSDLNamespace: {1}
-ContributionReadException = ContributionReadException occured due to :
-PartnerLinkNoMatchingType = PartnerLink {0} has no matching partner link type
-PartnerLinkTypeNoRoles = PartnerLinkType {0} has no Roles defined
-ContributionResolveException = ContributionResolveException occured due to :
-PartnerLinkHasBothAttr = BPEL PartnerLink {0} has both sca:reference and sca:service attributes set
-ReferencePartnerLinkNotInList = BPEL TypeLoader - element references partnerLink {0} not in the list
-MyRolePartnerRoleNull = Error: myRole and partnerRole port types are both null
-NoInterfaceForPortType = Interface not found for port type {0}
-AttributeProcessMissing = Attribute 'process' is missing.
-AttributeWithoutNamespace = Attribute {0} with value {1} in your composite should be of the form {namespaceURI}localname
-AttributeWithoutPrefix = Attribute {0} with value {1} in your composite should be prefixed (process=\"prefix:name\").
-AttributeUnrecognizedNamespace = Attribute {0} with value {1} in your composite has un unrecognized namespace prefix.
-BPELProcessNotFound = Can't find BPEL Process : {0} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
deleted file mode 100644
index e355b7adf9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.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.implementation.bpel;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BPELDocumentProcessorTestCase extends TestCase {
-
- protected static final String BPEL_PROCESS_FILE = "helloworld/helloworld.bpel";
-
- private URLArtifactProcessor<Object> documentProcessor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
- }
-
- public void testLoadBPELProcessDefinition() throws Exception {
- URI processURI = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE).toURI();
- URL processLocation = getClass().getClassLoader().getResource(BPEL_PROCESS_FILE);
- BPELProcessDefinition bpelProcessDefinition = (BPELProcessDefinition)documentProcessor.read(null, processURI, processLocation);
-
- assertNotNull(bpelProcessDefinition);
- assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), bpelProcessDefinition.getName());
- assertEquals(processLocation.toString(), bpelProcessDefinition.getLocation());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.java
deleted file mode 100644
index 9dd5306de1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELImplementationProcessorTestCase.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.implementation.bpel;
-
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BPELImplementationProcessorTestCase extends TestCase {
-
- protected static final QName IMPLEMENTATION_BPEL = new QName(Constants.SCA10_NS, "implementation.bpel");
-
- private static final String COMPOSITE =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
- + " <component name=\"BPELHelloWorldComponent\">"
- + " <implementation.bpel process=\"hns:HelloWorld\" />"
- + " </component>"
- + "</composite>";
-
- private static final String COMPOSITE_INVALID =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:hns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld\" targetNamespace=\"http://bpel\" name=\"bpel\">"
- + " <component name=\"BPELHelloWorldComponent\">"
- + " <implementation.bpel/>"
- + " </component>"
- + "</composite>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- BPELImplementation implementation = (BPELImplementation)composite.getComponents().get(0).getImplementation();
-
- assertNotNull(implementation);
- assertEquals(new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld", "HelloWorld"), implementation.getProcess());
- }
-
- /**
- * Test parsing invalid composite definition. Exception should be thrown
- * @throws Exception
- */
- public void testLoadInvalidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID));
- staxProcessor.read(reader);
- Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem();
- assertNotNull(problem);
- assertEquals("AttributeProcessMissing", problem.getMessageId());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel b/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
deleted file mode 100644
index 8cf91adc2c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.bpel
+++ /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.
- -->
-<process name="HelloWorld"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld"
- xmlns="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:test="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0"
- expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath2.0">
-
- <import location="helloworld.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"
- namespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"/>
-
- <partnerLinks>
- <partnerLink name="helloPartnerLink" partnerLinkType="test:HelloPartnerLinkType" myRole="me" />
- </partnerLinks>
-
- <variables>
- <variable name="helloMessage" messageType="test:HelloMessage"/>
- <variable name="tmpVar" type="xsd:string"/>
- </variables>
-
- <sequence>
- <receive
- name="start"
- partnerLink="helloPartnerLink"
- portType="test:HelloPortType"
- operation="hello"
- variable="helloMessage"
- createInstance="yes"/>
-
- <assign name="assign1">
- <copy>
- <from variable="helloMessage" part="TestPart"/>
- <to variable="tmpVar"/>
- </copy>
- <copy>
- <from>concat($tmpVar,' World')</from>
- <to variable="helloMessage" part="TestPart"/>
- </copy>
- </assign>
- <reply name="end"
- partnerLink="helloPartnerLink"
- portType="test:HelloPortType"
- operation="hello"
- variable="helloMessage"/>
- </sequence>
-</process>
diff --git a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl b/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
deleted file mode 100644
index 1d71727b2d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-bpel/src/test/resources/helloworld/helloworld.wsdl
+++ /dev/null
@@ -1,82 +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.
- -->
-
-<wsdl:definitions name="helloworld"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns="http://schemas.xmlsoap.org/wsdl/"
- xmlns:tns="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
- xmlns:plnk="http://schemas.xmlsoap.org/ws/2004/03/partner-link/">
-
- <wsdl:types>
- <schema elementFormDefault="qualified"
- targetNamespace="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl"
- xmlns="http://www.w3.org/2001/XMLSchema">
-
- <element name="hello">
- <complexType>
- <sequence>
- <element name="message" type="xsd:string"/>
- </sequence>
- </complexType>
- </element>
- </schema>
- </wsdl:types>
-
- <wsdl:message name="HelloMessage">
- <wsdl:part element="tns:hello" name="TestPart"/>
- </wsdl:message>
-
- <wsdl:portType name="HelloPortType">
- <wsdl:operation name="hello">
- <wsdl:input message="tns:HelloMessage" name="TestIn"/>
- <wsdl:output message="tns:HelloMessage" name="TestOut"/>
- </wsdl:operation>
- </wsdl:portType>
-
-
- <wsdl:binding name="HelloSoapBinding" type="tns:HelloPortType">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="hello">
- <wsdlsoap:operation soapAction=""/>
- <wsdl:input name="TestIn">
- <wsdlsoap:body use="literal"/>
- </wsdl:input>
- <wsdl:output name="TestOut">
- <wsdlsoap:body use="literal"/>
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloService">
- <wsdl:port name="HelloPort" binding="tns:HelloSoapBinding">
- <soap:address location="http://localhost:8085/ode/processes/helloWorld"/>
- </wsdl:port>
- </wsdl:service>
-
- <plnk:partnerLinkType name="HelloPartnerLinkType">
- <plnk:role name="me" portType="tns:HelloPortType"/>
- <plnk:role name="you" portType="tns:HelloPortType"/>
- </plnk:partnerLinkType>
-</wsdl:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/LICENSE b/branches/sca-java-1.5.1/modules/implementation-ejb/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/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-java-1.5.1/modules/implementation-ejb/NOTICE b/branches/sca-java-1.5.1/modules/implementation-ejb/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/pom.xml b/branches/sca-java-1.5.1/modules/implementation-ejb/pom.xml
deleted file mode 100644
index 12dc4d8688..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/pom.xml
+++ /dev/null
@@ -1,93 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-ejb</artifactId>
- <name>Apache Tuscany SCA EJB Session Bean Implementation Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-jee</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.ejb</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.ejb*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.java
deleted file mode 100644
index 0d3b05f0c9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementation.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.implementation.ejb;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-
-/**
- * The model representing an EJB implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface EJBImplementation extends Implementation {
-
- /**
- * Returns the EJB link URI.
- * @return the EJB link URI
- */
- String getEJBLink();
-
- /**
- * Sets the EJB link URI.
- * @param ejbLink the EJB link URI
- */
- void setEJBLink(String ejbLink);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.java
deleted file mode 100644
index bf9e13069b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/EJBImplementationFactory.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.implementation.ejb;
-
-
-/**
- * Factory for the EJB implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface EJBImplementationFactory {
-
- /**
- * Creates a new EJB implementation.
- * @return a new EJB implementation
- */
- EJBImplementation createEJBImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
deleted file mode 100644
index 050d0cf17a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationFactoryImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.ejb.impl;
-
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
-
-/**
- * Factory for the EJB implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class EJBImplementationFactoryImpl implements EJBImplementationFactory {
-
- public EJBImplementationFactoryImpl() {
- }
-
- public EJBImplementation createEJBImplementation() {
- return new EJBImplementationImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
deleted file mode 100644
index 8bcff6eb70..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/impl/EJBImplementationImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.ejb.impl;
-
-import org.apache.tuscany.sca.assembly.Component;
-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.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * The model representing an EJB implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class EJBImplementationImpl extends ImplementationImpl implements EJBImplementation, ComponentPreProcessor {
-
- private String ejbLink;
-
- /**
- * Constructs a new EJB implementation.
- */
- EJBImplementationImpl() {
- super();
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The EJB implementation does not support constrainingTypes
- return null;
- }
-
- public String getEJBLink() {
- return ejbLink;
- }
-
- @Override
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The EJB implementation does not support constrainingTypes
- }
-
- public void setEJBLink(String ejbLink) {
- this.ejbLink = ejbLink;
- }
-
- /**
- * Use preProcess to add any references and properties dynamically
- */
- public void preProcess(Component component) {
- if (!(component instanceof RuntimeComponent)) {
- return;
- }
- RuntimeComponent rtc = (RuntimeComponent) component;
-
- for (Reference reference : rtc.getReferences()) {
- if (getReference(reference.getName()) == null) {
- getReferences().add(createReference(reference));
- }
- }
-
- for (Property property : rtc.getProperties()) {
- if (getProperty(property.getName()) == null) {
- getProperties().add(createProperty(property));
- }
- }
-
- for(Service service : rtc.getServices()) {
- if (getService(service.getName()) == null) {
- getServices().add(createService(service));
- }
- }
- }
-
- protected Reference getReference(String name) {
- for (Reference reference : getReferences()) {
- if (reference.getName().equals(name)) {
- return reference;
- }
- }
- return null;
- }
-
- protected Reference createReference(Reference reference) {
- Reference newReference;
- try {
- newReference = (Reference)reference.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newReference;
- }
-
- protected Property getProperty(String name) {
- for (Property property : getProperties()) {
- if (property.getName().equals(name)) {
- return property;
- }
- }
- return null;
- }
-
- protected Property createProperty(Property property) {
- Property newProperty;
- try {
- newProperty = (Property)property.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newProperty;
- }
-
- protected Service getService(String name) {
- for (Service service : getServices()) {
- if (service.getName().equals(name)) {
- return service;
- }
- }
- return null;
- }
-
- protected Service createService(Service service) {
- Service newService;
- try {
- newService = (Service)service.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newService;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
deleted file mode 100644
index cfbad6c0f2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/java/org/apache/tuscany/sca/implementation/ejb/xml/EJBImplementationProcessor.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.ejb.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.net.URI;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.EjbInfo;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
-import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
-import org.apache.tuscany.sca.contribution.jee.impl.EjbModuleInfoImpl;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-
-/**
- * Implements a StAX artifact processor for EJB implementations.
- *
- * @version $Rev$ $Date$
- */
-public class EJBImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<EJBImplementation> {
- private static final QName IMPLEMENTATION_EJB = new QName(Constants.SCA10_NS, "implementation.ejb");
- private static final Logger logger = Logger.getLogger(EJBImplementationProcessor.class.getName());
-
- private AssemblyFactory assemblyFactory;
- private EJBImplementationFactory implementationFactory;
- private Monitor monitor;
- private JavaEEExtension jeeExtension;
- private JavaEEOptionalExtension jeeOptionalExtension;
- private JavaImplementationFactory javaImplementationFactory;
- private JavaInterfaceFactory javaInterfaceFactory;
-
- public EJBImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.implementationFactory = modelFactories.getFactory(EJBImplementationFactory.class);
- this.jeeExtension = modelFactories.getFactory(JavaEEExtension.class);
- this.jeeOptionalExtension = modelFactories.getFactory(JavaEEOptionalExtension.class);
- this.monitor = monitor;
-
- this.javaImplementationFactory = new DefaultJavaImplementationFactory();
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- javaImplementationFactory.addClassVisitor(new ReferenceProcessor(assemblyFactory, javaInterfaceFactory));
- javaImplementationFactory.addClassVisitor(new PropertyProcessor(assemblyFactory));
- javaImplementationFactory.addClassVisitor(new ServiceProcessor(assemblyFactory, javaInterfaceFactory));
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-ejb-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_EJB;
- }
-
- public Class<EJBImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return EJBImplementation.class;
- }
-
- public EJBImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.ejb> element
- EJBImplementation implementation = implementationFactory.createEJBImplementation();
- implementation.setUnresolved(true);
-
- // Read the ejb-link attribute
- String ejbLink = getString(reader, "ejb-link");
- if (ejbLink != null) {
- implementation.setEJBLink(ejbLink);
-
- // Set the URI of the component type
- //implementation.setURI(ejbLink.replace('#', '/'));
- int hashPosition = ejbLink.indexOf('#');
- if (hashPosition >= 0) {
- implementation.setURI(ejbLink.substring(hashPosition + 1));
- } else {
- implementation.setURI(ejbLink);
- }
- } else {
- error("EJBLinkAttributeMissing", reader);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_EJB.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(EJBImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the component type
- String uri = implementation.getURI();
- String ejbLink = implementation.getEJBLink();
- if (ejbLink != null) {
- String module = ejbLink.indexOf('#') != -1 ? ejbLink.substring(0, ejbLink.indexOf('#')) : "";
- String beanName = ejbLink.indexOf('#') != -1 ? ejbLink.substring(ejbLink.indexOf('#')+1) : ejbLink;
- EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
- ejbModuleInfo.setUri(URI.create(module));
- ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo);
-
- if(jeeExtension != null) {
- ComponentType ct = jeeExtension.createImplementationEjbComponentType(ejbModuleInfo, beanName);
- // TODO - SL - TUSCANY-2944 - these new JEE processors are causing problems with existing contributions
- // ct is null if there is no EJBInfo
- if (ct != null){
- implementation.getServices().addAll(ct.getServices());
- }
- }
-
- if(jeeOptionalExtension != null) {
- ComponentType ct = jeeOptionalExtension.createImplementationEjbComponentType(ejbModuleInfo, beanName);
- // TODO - SL - TUSCANY-2944 - these new JEE processors are causing problems with existing contributions
- // ct is null if there is no EJBInfo
- if (ct != null){
- implementation.getReferences().addAll(ct.getReferences());
- implementation.getProperties().addAll(ct.getProperties());
- }
- }
-
- EjbInfo ejbInfo = ejbModuleInfo.getEjbInfo(uri);
- if (ejbInfo == null) {
- // FIXME:
- logger.severe("EJB " + uri + " is not found in the module");
- // throw new ContributionResolveException("EJB " + uri + " is not found in the module");
- } else {
- // Introspection of bean class
- Class<?> beanClass = ejbInfo.beanClass;
- try {
- JavaImplementation ji = javaImplementationFactory.createJavaImplementation(beanClass);
- implementation.getReferences().addAll(ji.getReferences());
- implementation.getProperties().addAll(ji.getProperties());
- implementation.getServices().addAll(ji.getServices());
- } catch (IntrospectionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- // Process componentType side file
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setURI(uri + ".componentType");
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (!componentType.isUnresolved()) {
-
- // Initialize the implementation's services, references and properties
- implementation.getServices().addAll(componentType.getServices());
- implementation.getReferences().addAll(componentType.getReferences());
- implementation.getProperties().addAll(componentType.getProperties());
- }
- }
-
- implementation.setUnresolved(false);
- }
-
- public void write(EJBImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.ejb>
- writeStart(writer, IMPLEMENTATION_EJB.getNamespaceURI(), IMPLEMENTATION_EJB.getLocalPart(),
- new XAttr("ejb-link", implementation.getEJBLink()));
-
- writeEnd(writer);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index ae6db609a2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.ejb.xml.EJBImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.ejb,model=org.apache.tuscany.sca.implementation.ejb.EJBImplementation,factory=org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
deleted file mode 100644
index fb828707a6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.ejb.EJBImplementationFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.ejb.impl.EJBImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
deleted file mode 100644
index 4eaf2b9007..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/main/resources/impl-ejb-validation-messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-EJBLinkAttributeMissing = Reading implementation.ejb - ejb-link attribute missing \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
deleted file mode 100644
index b692ab3f5a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/ReadTestCase.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.ejb.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.implementation.ejb.EJBImplementation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading Node implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestEJB.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
-
- assertTrue(((EJBImplementation) composite.getComponents().get(0).getImplementation()).getEJBLink().equals("module.jar#TestEJB"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.java
deleted file mode 100644
index 8ba43dd635..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/java/org/apache/tuscany/sca/implementation/ejb/xml/WriteTestCase.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.implementation.ejb.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestEJB.composite");
- Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- assertTrue(bos.toString().contains("module.jar#TestEJB"));
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite b/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
deleted file mode 100644
index 0c1368c4dd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-ejb/src/test/resources/org/apache/tuscany/sca/implementation/ejb/xml/TestEJB.composite
+++ /dev/null
@@ -1,29 +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"
- targetNamespace="http://sample/ejb"
- xmlns:sc="http://sample/composite"
- name="TestEJB">
-
- <component name="TestEJB">
- <implementation.ejb ejb-link="module.jar#TestEJB"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-java-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/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-java-1.5.1/modules/implementation-java-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-java-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-java-runtime/pom.xml
deleted file mode 100644
index 34c30a92a8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/pom.xml
+++ /dev/null
@@ -1,81 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <name>Apache Tuscany SCA Java Implementation Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.java*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.java
deleted file mode 100644
index ac8af3ed64..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactory.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.implementation.java.context;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-
-/**
- * Interface for a factory that returns an injected component instance.
- * This is used by a Component implementation to create new instances of
- * application implementation objects as determined by the component scope's
- * lifecycle.
- * <p/>
- * The implementation of this interface may be supplied by the user,
- * may be generated during deployment, or may be dynamic.
- *
- * @version $Rev$ $Date$
- * @param <T> Type of the instance generated by the factory.
- */
-public interface InstanceFactory<T> {
- /**
- * Creates a new instance of the component.
- * All injected values must be set but any @Init methods must not have been invoked.
- *
- * @return A wrapper for the created component instance.
- */
- InstanceWrapper<T> newInstance();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.java
deleted file mode 100644
index a93710d266..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/InstanceFactoryProvider.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.implementation.java.context;
-
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface InstanceFactoryProvider<T> {
- /**
- * Return the implementation class.
- *
- * @return the implementation class.
- */
- Class<T> getImplementationClass();
-
- /**
- * Sets an object factory for an injection site
- *
- * @param element the injection site name
- * @param objectFactory the object factory
- */
- void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory);
-
- /**
- * Create an instance factory that can be used to create component instances.
- *
- * @return a new instance factory
- */
- InstanceFactory<T> createFactory();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.java
deleted file mode 100644
index b5d3254fa0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceFactory.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.implementation.java.context;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.Injector;
-import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReflectiveInstanceFactory<T> implements InstanceFactory<T> {
- private final Constructor<T> ctr;
- private final ObjectFactory<?>[] ctrArgs;
- private final Injector<T>[] injectors;
- private final EventInvoker<T> initInvoker;
- private final EventInvoker<T> destroyInvoker;
-
- public ReflectiveInstanceFactory(Constructor<T> ctr,
- ObjectFactory<?>[] ctrArgs,
- Injector<T>[] injectors,
- EventInvoker<T> initInvoker,
- EventInvoker<T> destroyInvoker) {
- this.ctr = ctr;
- this.ctrArgs = ctrArgs;
- this.injectors = injectors;
- this.initInvoker = initInvoker;
- this.destroyInvoker = destroyInvoker;
- }
-
- public InstanceWrapper<T> newInstance() {
- T instance;
- try {
- if (ctrArgs != null) {
- Object[] args = new Object[ctrArgs.length];
- for (int i = 0; i < args.length; i++) {
- args[i] = ctrArgs[i].getInstance();
- }
- instance = ctr.newInstance(args);
- } else {
- instance = ctr.newInstance();
- }
- } catch (InstantiationException e) {
- String name = ctr.getDeclaringClass().getName();
- throw new AssertionError("Class is not instantiable [" + name + "]");
- } catch (IllegalAccessException e) {
- String name = ctr.getName();
- throw new AssertionError("Constructor is not accessible [" + name + "]");
- } catch (
- InvocationTargetException e) {
- String name = ctr.getName();
- throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
- }
-
- if (injectors != null) {
- for (Injector<T> injector : injectors) {
- //FIXME Injectors should never be null
- if (injector != null)
- injector.inject(instance);
- }
- }
-
- return new ReflectiveInstanceWrapper<T>(instance, initInvoker, destroyInvoker);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.java
deleted file mode 100644
index 5285caa481..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapper.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.implementation.java.context;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetInitializationException;
-import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReflectiveInstanceWrapper<T> implements InstanceWrapper<T> {
- private final EventInvoker<T> initInvoker;
- private final EventInvoker<T> destroyInvoker;
- private final T instance;
-
- public ReflectiveInstanceWrapper(T instance, EventInvoker<T> initInvoker, EventInvoker<T> destroyInvoker) {
- this.instance = instance;
- this.initInvoker = initInvoker;
- this.destroyInvoker = destroyInvoker;
- }
-
- public T getInstance() {
- return instance;
- }
-
- public void start() throws TargetInitializationException {
- if (initInvoker != null) {
- initInvoker.invokeEvent(instance);
- }
- }
-
-
- public void stop() throws TargetDestructionException {
- if (destroyInvoker != null) {
- destroyInvoker.invokeEvent(instance);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java
deleted file mode 100644
index 2513c63e38..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ArrayMultiplicityObjectFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.lang.reflect.Array;
-import java.util.List;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>Array</code>
- * containing object instances
- *
- * @version $Rev$ $Date$
- */
-public class ArrayMultiplicityObjectFactory implements ObjectFactory<Object> {
-
- private ObjectFactory[] factories;
-
- private Class interfaceType;
-
- public ArrayMultiplicityObjectFactory(Class interfaceType, List<ObjectFactory<?>> factories) {
- assert interfaceType != null : "Interface type was null";
- assert factories != null : "Object factories were null";
- this.interfaceType = interfaceType;
- this.factories = factories.toArray(new ObjectFactory[factories.size()]);
- }
-
- public Object getInstance() throws ObjectCreationException {
- Object array = Array.newInstance(interfaceType, factories.length);
- for (int i = 0; i < factories.length; i++) {
- Array.set(array, i, factories[i].getInstance());
- }
- return array;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java
deleted file mode 100644
index d8eef18c74..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ContextInjector.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-
-/**
- * Implementations inject a pre-configured context type (interface) on an instance.
- *
- * @version $Rev$ $Date$
- */
-public interface ContextInjector<S, T> extends Injector<T> {
-
- void setContext(S context) throws ObjectCreationException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
deleted file mode 100644
index ffce7ce467..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ConversationIDObjectFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ThreadMessageContext;
-
-/**
- * Object Factory that is used to retrieve the ConversationID from the
- * Message on the ThreadMessageContext.
- *
- * @version $Rev$ $Date$
- */
-public class ConversationIDObjectFactory implements ObjectFactory {
-
- public ConversationIDObjectFactory() {
- }
-
- public Object getInstance() {
- return ThreadMessageContext.getMessageContext().getFrom().getReferenceParameters().getConversationID();
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.java
deleted file mode 100644
index dd454be7c5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjector.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.implementation.java.injection;
-
-import java.lang.reflect.Field;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Injects a value created by an {@link org.apache.tuscany.sca.core.factory.ObjectFactory} on a given field
- *
- * @version $Rev$ $Date$
- */
-public class FieldInjector<T> implements Injector<T> {
-
- private final Field field;
-
- private final ObjectFactory<?> objectFactory;
-
- /**
- * Create an injector and have it use the given <code>ObjectFactory</code> to inject a value on the instance using
- * the reflected <code>Field</code>
- */
- public FieldInjector(Field pField, ObjectFactory<?> objectFactory) {
- field = pField;
- // Allow privileged access to set accessibility. Requires ReflectPermission
- // in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- field.setAccessible(true); // ignore Java accessibility
- return null;
- }
- });
-
- this.objectFactory = objectFactory;
- }
-
- /**
- * Inject a new value on the given instance
- */
- public void inject(T instance) throws ObjectCreationException {
- try {
- field.set(instance, objectFactory.getInstance());
- } catch (IllegalAccessException e) {
- throw new ObjectCreationException("Field is not accessible [" + field + "]", e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.java
deleted file mode 100644
index 4a8c8f31b8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InjectionRuntimeException.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.implementation.java.injection;
-
-
-/**
- * Root unchecked exception for the injection package
- *
- * @version $Rev$ $Date$
- */
-public abstract class InjectionRuntimeException extends RuntimeException {
-
- public InjectionRuntimeException() {
- super();
- }
-
- public InjectionRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InjectionRuntimeException(String message) {
- super(message);
- }
-
- public InjectionRuntimeException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.java
deleted file mode 100644
index 4d062859b9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/Injector.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.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-
-/**
- * Implementations inject a pre-configured value on an instance
- *
- * @version $Rev$ $Date$
- */
-public interface Injector<T> {
-
- /**
- * Inject a value on the given instance
- */
- void inject(T instance) throws ObjectCreationException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.java
deleted file mode 100644
index 5aeebcca36..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/InvalidAccessorException.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.implementation.java.injection;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InvalidAccessorException extends InjectionRuntimeException {
- private static final long serialVersionUID = 9196299279363310978L;
-
- public InvalidAccessorException() {
- super();
- }
-
- public InvalidAccessorException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidAccessorException(String message) {
- super(message);
- }
-
- public InvalidAccessorException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
deleted file mode 100644
index eefe82f1d9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactory.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.impl.DOMHelper;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaPropertyValueObjectFactory implements PropertyValueFactory {
- private Mediator mediator = null;
- private boolean isSimpleType;
-
- public JavaPropertyValueObjectFactory(Mediator mediator) {
- this.mediator = mediator;
- }
-
- public JavaPropertyValueObjectFactory(ExtensionPointRegistry registry) {
- this.mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- }
-
- public ObjectFactory createValueFactory(Property property, Object propertyValue, JavaElementImpl javaElement) {
- isSimpleType = isSimpleType(property);
- Document doc = (Document)propertyValue;
- Class javaType = JavaIntrospectionHelper.getBaseType(javaElement.getType(), javaElement.getGenericType());
- Element rootElement = doc.getDocumentElement();
- if (property.isMany()) {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- List<String> values = getSimplePropertyValues(value, javaType);
- if ( javaElement.getType().isArray() ) {
- return new ArrayObjectFactoryImpl(property, values, isSimpleType, javaType);
- } else {
- return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
- }
- } else {
- if ( javaElement.getType().isArray() ) {
- return new ArrayObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
- } else {
- return new ListObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
- }
- }
- } else {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
- } else {
- List<Node> nodes = getComplexPropertyValues(doc);
- Object value = null;
- if (!nodes.isEmpty()) {
- value = nodes.get(0);
- }
- return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
- }
-
- }
- }
-
- public ObjectFactory createValueFactory(Property property, Object propertyValue, Class javaType) {
- isSimpleType = isSimpleType(property);
- Document doc = (Document)propertyValue;
- Element rootElement = doc.getDocumentElement();
- if (property.isMany()) {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- List<String> values = getSimplePropertyValues(value, javaType);
- return new ListObjectFactoryImpl(property, values, isSimpleType, javaType);
- } else {
- return new ListObjectFactoryImpl(property, getComplexPropertyValues(doc), isSimpleType, javaType);
- }
- } else {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
- } else {
- List<Node> nodes = getComplexPropertyValues(doc);
- Object value = null;
- if (!nodes.isEmpty()) {
- value = nodes.get(0);
- }
- return new ObjectFactoryImpl(property, value, isSimpleType, javaType);
- }
-
- }
- }
-
- private boolean isSimpleType(Property property) {
- if (property.getXSDType() != null) {
- return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
- } else {
- if (property instanceof Document) {
- Document doc = (Document)property;
- Element element = doc.getDocumentElement();
- if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0).getNodeType() == Element.TEXT_NODE) {
- return true;
- }
- }
- }
- return false;
- }
-
- private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
- List<String> propValues = new ArrayList<String>();
- StringTokenizer st = null;
- if (javaType.getName().equals("java.lang.String")) {
- st = new StringTokenizer(concatenatedValue, "\"");
- } else {
- st = new StringTokenizer(concatenatedValue);
- }
- String aToken = null;
- while (st.hasMoreTokens()) {
- aToken = st.nextToken();
- if (aToken.trim().length() > 0) {
- propValues.add(aToken);
- }
- }
- return propValues;
- }
-
- private List<Node> getComplexPropertyValues(Document document) {
- Element rootElement = document.getDocumentElement();
- List<Node> propValues = new ArrayList<Node>();
- NodeList nodes = rootElement.getChildNodes();
- for (int count = 0; count < nodes.getLength(); ++count) {
- if (nodes.item(count).getNodeType() == Document.ELEMENT_NODE) {
- propValues.add(DOMHelper.promote(nodes.item(count)));
- }
- }
- return propValues;
- }
-
- public abstract class ObjectFactoryImplBase implements ObjectFactory {
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- protected Property property;
- protected Object propertyValue;
- protected Class javaType;
- protected DataType<XMLType> sourceDataType;
- protected DataType<?> targetDataType;
- boolean isSimpleType;
-
- public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- this.isSimpleType = isSimpleType;
- this.property = property;
- this.propertyValue = propertyValue;
- this.javaType = javaType;
- sourceDataType = new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class, new XMLType(null, this.property
- .getXSDType()));
- TypeInfo typeInfo = null;
- if (this.property.getXSDType() != null) {
- if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
- typeInfo = new TypeInfo(property.getXSDType(), true, null);
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
-
- XMLType xmlType = new XMLType(typeInfo);
- String dataBinding = null; // (String)property.getExtensions().get(DataBinding.class.getName());
- if (dataBinding != null) {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- } else {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- mediator.getDataBindings().introspectType(targetDataType, null);
- }
- }
- }
-
- public class ObjectFactoryImpl extends ObjectFactoryImplBase {
- public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- super(property, propertyValue, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public Object getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- try {
- return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
- } catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + propertyValue, ex);
- } catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + propertyValue, ex);
- }
- } else {
- return mediator.mediate(propertyValue, sourceDataType, targetDataType, null);
- // return null;
- }
- }
- }
-
- public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
- public ListObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
- super(property, propertyValues, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public List<?> getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- List<Object> values = new ArrayList<Object>();
- for (String aValue : (List<String>)propertyValue) {
- try {
- values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
- } catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
- + " from value list of " + propertyValue, ex);
- } catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
- + " from value list of " + propertyValue, ex);
- }
- }
- return values;
- } else {
- List instances = new ArrayList();
- for (Node aValue : (List<Node>)propertyValue) {
- instances.add(mediator.mediate(aValue, sourceDataType, targetDataType, null));
- }
- return instances;
- }
- }
- }
-
- public class ArrayObjectFactoryImpl extends ObjectFactoryImplBase {
- public ArrayObjectFactoryImpl(Property property, List<?> propertyValues, boolean isSimpleType, Class javaType) {
- super(property, propertyValues, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public Object getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- int count = 0;
- Object values = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
- for (String aValue : (List<String>)propertyValue) {
- try {
- Array.set(values, count++, simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
- } catch (NumberFormatException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
- + " from value list of " + propertyValue, ex);
- } catch (IllegalArgumentException ex) {
- throw new ObjectCreationException("Failed to create instance for property "
- + property.getName() + " with value " + aValue
- + " from value list of " + propertyValue, ex);
- }
- }
- return values;
- } else {
- Object instances = Array.newInstance(javaType, ((List<Object>)propertyValue).size());
- int count = 0;
- for (Node aValue : (List<Node>)propertyValue) {
- Array.set(instances, count++, mediator.mediate(aValue, sourceDataType, targetDataType, null));
- }
- return instances;
- }
- }
- }
-
- /**
- * This method will create an instance of the value for the specified Property.
- *
- * @param property The Property from which to retrieve the property value
- * @param type The type of the property value being retrieved from the Property
- * @param <B> Type type of the property value being looked up
- *
- * @return the value for the Property
- */
- public <B> B createPropertyValue(ComponentProperty property, Class<B> type)
- {
- ObjectFactory<B> factory = this.createValueFactory(property, property.getValue(), type);
- return factory.getInstance();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
deleted file mode 100644
index 9f587f58de..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ListMultiplicityObjectFactory.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Resolves targets configured in a multiplicity by delegating to object factories and returning an <code>List</code>
- * containing object instances
- *
- * @version $Rev$ $Date$
- */
-public class ListMultiplicityObjectFactory implements ObjectFactory<List> {
-
- private ObjectFactory[] factories;
-
- public ListMultiplicityObjectFactory(List<ObjectFactory<?>> factories) {
- assert factories != null : "Object factories were null";
- this.factories = factories.toArray(new ObjectFactory[factories.size()]);
- }
-
- public List getInstance() throws ObjectCreationException {
- List<Object> list = new ArrayList<Object>();
- for (ObjectFactory factory : factories) {
- list.add(factory.getInstance());
- }
- return list;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java
deleted file mode 100644
index baf9eb9cc1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjector.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Injects a value created by an {@link org.apache.tuscany.sca.core.factory.ObjectFactory} using a given method
- *
- * @version $Rev$ $Date$
- */
-public class MethodInjector<T> implements Injector<T> {
- private final Method method;
- private final ObjectFactory<?> objectFactory;
-
- public MethodInjector(Method aMethod, ObjectFactory<?> objectFactory) {
- assert aMethod != null;
- assert objectFactory != null;
- this.method = aMethod;
- // Allow privileged access to set accessibility. Requires ReflectPermission in security
- // policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- method.setAccessible(true);
- return null;
- }
- });
- this.objectFactory = objectFactory;
- }
-
- public void inject(T instance) throws ObjectCreationException {
- try {
- method.invoke(instance, objectFactory.getInstance());
- } catch (IllegalAccessException e) {
- throw new ObjectCreationException("Method is not accessible [" + method + "]", e);
- } catch (IllegalArgumentException e) {
- throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
- } catch (InvocationTargetException e) {
- throw new ObjectCreationException("Exception thrown by setter: " + method.getName(), e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.java
deleted file mode 100644
index ca9c08fe63..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactory.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.implementation.java.injection;
-
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.context.RequestContextImpl;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.osoa.sca.RequestContext;
-
-/**
- * Creates instances of
- * {@link org.apache.tuscany.sca.core.context.RequestContextImpl} for
- * injection on component implementation instances
- *
- * @version $Rev$ $Date$
- */
-public class RequestContextObjectFactory implements ObjectFactory<RequestContext> {
- private RequestContextFactory factory;
- private ProxyFactory proxyFactory;
-
- public RequestContextObjectFactory(RequestContextFactory factory) {
- this(factory, null);
- }
-
- public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) {
- this.factory = factory;
- this.proxyFactory = proxyFactory;
- }
-
- public RequestContext getInstance() throws ObjectCreationException {
- if (factory != null) {
- return factory.createRequestContext();
- } else {
- return new RequestContextImpl(proxyFactory);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.java
deleted file mode 100644
index 70c368a0e6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceHost.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.implementation.java.injection;
-
-/**
- * Interface implemented by host environments that allow for resolution of component implementation resources, e.g.
- * items bound in a JNDI tree.
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceHost {
-
- /**
- * Resolve a resource matching the given type
- *
- * @param type the type of the resources
- * @throws ResourceResolutionException if an error is encountered during resolution
- */
- <T> T resolveResource(Class<T> type) throws ResourceResolutionException;
-
- /**
- * Resolve a resource matching the given type and name
- *
- * @param type the type of the resources
- * @param mappedName the mapped name of the resource
- * @throws ResourceResolutionException if an error is encountered during resolution
- */
- <T> T resolveResource(Class<T> type, String mappedName) throws ResourceResolutionException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.java
deleted file mode 100644
index 17450f43cb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceNotFoundException.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.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-
-/**
- * Denotes an exception thrown when a runtime resource is not found
- *
- * @version $Rev$ $Date$
- */
-public class ResourceNotFoundException extends ObjectCreationException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public ResourceNotFoundException() {
- super();
- }
-
- public ResourceNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ResourceNotFoundException(String message) {
- super(message);
- }
-
- public ResourceNotFoundException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
deleted file mode 100644
index 5d4d999453..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactory.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Resolves a runtime resource to be injected on a field or method of a Java component type marked with {@link
- * javax.annotation.Resource}. If the mapped name of the resource is an absolute URI such as
- * <code>sca://localhost</code> or <code>jndi://localhost</code> the host container namespace is searched; otherwise the
- * URI is assumed to be relative and the parent composite is searched. If a mapped name is not provided, i.e. resolution
- * is by type, the parent composite is first searched followed by the host namespace.
- *
- * @version $Rev$ $Date$
- */
-public class ResourceObjectFactory<T> implements ObjectFactory<T> {
-
- private Class<T> type;
- private String mappedName;
- private ResourceHost host;
- private boolean optional;
-
- /**
- * Instantiates a factory that resolves resources by type
- *
- * @param type the type of the resource to inject
- * @param optional true if an error should be thrown if the resource is not found
- * @param host the runtime resource provider
- */
- public ResourceObjectFactory(Class<T> type, boolean optional, ResourceHost host) {
- this(type, null, optional, host);
- }
-
- /**
- * Instantiates a factory that resolves resources by mapped name
- *
- * @param type the type of the resource to inject
- * @param mappedName the resource name
- * @param optional true if an error should be thrown if the resource is not found
- * @param host the runtime resource provider
- */
- public ResourceObjectFactory(Class<T> type, String mappedName, boolean optional, ResourceHost host) {
- this.type = type;
- this.host = host;
- this.mappedName = mappedName;
- this.optional = optional;
- }
-
- @SuppressWarnings({"unchecked"})
- public T getInstance() throws ObjectCreationException {
- try {
- T resource;
- if (mappedName == null) {
- resource = host.resolveResource(type);
- if (!optional && resource == null) {
- throw new ResourceNotFoundException("Resource not found: " + type.getName());
- }
- } else {
- resource = host.resolveResource(type, mappedName);
- if (!optional && resource == null) {
- throw new ResourceNotFoundException("Resource not found: " + mappedName);
- }
- }
- return resource;
- } catch (ResourceResolutionException e) {
- throw new ObjectCreationException(e);
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.java
deleted file mode 100644
index f94b24762a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/injection/ResourceResolutionException.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.implementation.java.injection;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class ResourceResolutionException extends Exception {
- private static final long serialVersionUID = 13421352711315479L;
-
- public ResourceResolutionException() {
- super();
- }
-
- public ResourceResolutionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ResourceResolutionException(String message) {
- super(message);
- }
-
- public ResourceResolutionException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java
deleted file mode 100644
index 25c09231c5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvocationException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import org.apache.tuscany.sca.implementation.java.injection.InjectionRuntimeException;
-
-/**
- * Denotes an error when invoking an event on an object
- *
- * @version $Rev$ $Date$
- */
-public class EventInvocationException extends InjectionRuntimeException {
- private static final long serialVersionUID = 1480018831708211581L;
-
- public EventInvocationException() {
- super();
- }
-
- public EventInvocationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public EventInvocationException(String message) {
- super(message);
- }
-
- public EventInvocationException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java
deleted file mode 100644
index e6ebb5abc3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/EventInvoker.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-/**
- * Performs an invocation on an instance
- *
- * @version $Rev$ $Date$
- */
-public interface EventInvoker<T> {
-
- /**
- * Performs the invocation on a given instance
- *
- * @throws EventInvocationException
- */
- void invokeEvent(T instance) throws EventInvocationException;
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.java
deleted file mode 100644
index 135fde09ff..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/InvalidConversationSequenceException.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.implementation.java.invocation;
-
-import org.apache.tuscany.sca.core.invocation.TargetInvocationException;
-
-/**
- * Denotes an unknown operation sequence in a conversation
- *
- * @version $Rev$ $Date$
- */
-public class InvalidConversationSequenceException extends TargetInvocationException {
- private static final long serialVersionUID = -5744028391493899147L;
-
- public InvalidConversationSequenceException() {
- super();
- }
-
- public InvalidConversationSequenceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidConversationSequenceException(String message) {
- super(message);
- }
-
- public InvalidConversationSequenceException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
deleted file mode 100644
index ef4e67d79a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaCallbackRuntimeWireProcessor.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.invocation.CallbackInterfaceInterceptor;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaCallbackRuntimeWireProcessor implements RuntimeWireProcessor {
- private static final Logger logger = Logger.getLogger(JavaCallbackRuntimeWireProcessor.class.getName());
- private InterfaceContractMapper interfaceContractMapper;
- private JavaInterfaceFactory javaInterfaceFactory;
-
- /**
- * @param interfaceContractMapper
- * @param javaInterfaceFactory
- */
- public JavaCallbackRuntimeWireProcessor(InterfaceContractMapper interfaceContractMapper,
- JavaInterfaceFactory javaInterfaceFactory) {
- super();
- this.interfaceContractMapper = interfaceContractMapper;
- this.javaInterfaceFactory = javaInterfaceFactory;
- }
-
- public void process(RuntimeWire wire) {
- addCallbackInterfaceInterceptors(wire);
- }
-
- private void addCallbackInterfaceInterceptors(RuntimeWire wire) {
- Contract contract = wire.getSource().getContract();
- if (!(contract instanceof RuntimeComponentReference)) {
- return;
- }
- RuntimeComponent component = wire.getSource().getComponent();
- Implementation implementation = component.getImplementation();
- if (!(implementation instanceof JavaImplementation)) {
- return;
- }
- JavaImplementation javaImpl = (JavaImplementation)implementation;
- EndpointReference callbackEndpoint = wire.getSource().getCallbackEndpoint();
- if (callbackEndpoint != null) {
- Interface iface = callbackEndpoint.getContract().getInterfaceContract().getInterface();
- if (!supportsCallbackInterface(iface, javaImpl)) {
- // callback to this impl is not possible, so ensure a callback object is set
- for (InvocationChain chain : wire.getInvocationChains()) {
- chain.addInterceptor(Phase.REFERENCE, new CallbackInterfaceInterceptor());
- }
- }
- }
- }
-
- private boolean supportsCallbackInterface(Interface iface, JavaImplementation impl) {
- if (iface instanceof JavaInterface) {
- Class<?> ifaceClass = ((JavaInterface)iface).getJavaClass();
- if (ifaceClass.isAssignableFrom(impl.getJavaClass())) {
- return true;
- }
- }
- try {
- Interface implType = javaInterfaceFactory.createJavaInterface(impl.getJavaClass());
- // Ignore the remotable/conversational testing
- implType.setRemotable(iface.isRemotable());
- implType.setConversational(iface.isConversational());
- return interfaceContractMapper.isCompatible(iface, implType);
- } catch (InvalidInterfaceException e) {
- logger.log(Level.WARNING, e.getMessage(), e);
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.java
deleted file mode 100644
index 2903cc6fc8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextFactory.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.implementation.java.invocation;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.osoa.sca.ComponentContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaComponentContextFactory implements ObjectFactory<ComponentContext> {
- private final JavaComponentContextProvider component;
-
-
- public JavaComponentContextFactory(JavaComponentContextProvider component) {
- this.component = component;
- }
-
-
- public ComponentContext getInstance() throws ObjectCreationException {
- return component.getComponent().getComponentContext();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
deleted file mode 100644
index 29e02da648..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentContextProvider.java
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.context.ComponentContextFactory;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.context.ComponentContextImpl;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.CallableReferenceObjectFactory;
-import org.apache.tuscany.sca.core.invocation.CallbackReferenceObjectFactory;
-import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.WireObjectFactory;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.ConversationID;
-
-/**
- * The runtime instantiation of Java component implementations
- *
- * @version $Rev$ $Date$
- */
-public class JavaComponentContextProvider {
- private JavaPropertyValueObjectFactory propertyValueFactory;
- private DataBindingExtensionPoint dataBindingRegistry;
- private RuntimeComponent component;
- private JavaInstanceFactoryProvider<?> instanceFactoryProvider;
- private ProxyFactory proxyFactory;
-
- public JavaComponentContextProvider(RuntimeComponent component,
- JavaInstanceFactoryProvider configuration,
- DataBindingExtensionPoint dataBindingExtensionPoint,
- PropertyValueFactory propertyValueObjectFactory,
- ComponentContextFactory componentContextFactory,
- RequestContextFactory requestContextFactory) {
- super();
- this.instanceFactoryProvider = configuration;
- this.proxyFactory = configuration.getProxyFactory();
- // if (componentContextFactory != null) {
- // this.componentContext = componentContextFactory.createComponentContext(component, requestContextFactory);
- // } else {
- // this.componentContext = new ComponentContextImpl(this, requestContextFactory, this.proxyService);
- // }
- this.component = component;
- this.dataBindingRegistry = dataBindingExtensionPoint;
- this.propertyValueFactory = (JavaPropertyValueObjectFactory) propertyValueObjectFactory;
- }
-
- InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
- return instanceFactoryProvider.createFactory().newInstance();
- }
-
- void configureProperties(List<ComponentProperty> definedProperties) {
- for (ComponentProperty p : definedProperties) {
- configureProperty(p);
- }
- }
-
- private void configureProperty(ComponentProperty configuredProperty) {
- JavaElementImpl element =
- instanceFactoryProvider.getImplementation().getPropertyMembers().get(configuredProperty.getName());
-
- if (element != null && configuredProperty.getValue() != null) {
- if (!(element.getAnchor() instanceof Constructor)) {
- if(element.getElementType() == ElementType.FIELD) {
- // Field field = (Field)element.getAnchor();
- instanceFactoryProvider.getInjectionSites().add(element);
- /*
- if(Modifier.isPublic(field.getModifiers())) {
- instanceFactoryProvider.getInjectionSites().add(element);
- } else if(field.getAnnotation(org.osoa.sca.annotations.Property.class) != null) {
- instanceFactoryProvider.getInjectionSites().add(element);
- }
- */
- } else {
- instanceFactoryProvider.getInjectionSites().add(element);
- }
- }
-
- //Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- ObjectFactory<?> propertyObjectFactory =
- createPropertyValueFactory(configuredProperty, configuredProperty.getValue(), element);
- instanceFactoryProvider.setObjectFactory(element, propertyObjectFactory);
-
- JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
- for(JavaElementImpl p: constructor.getParameters()){
- if(element.getName().equals(p.getName())) {
- instanceFactoryProvider.setObjectFactory(p, propertyObjectFactory);
- }
- }
- }
- }
-
- void start() {
- if (!instanceFactoryProvider.getImplementation().getCallbackMembers().isEmpty()) {
- Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
- for (ComponentService service : component.getServices()) {
-
- RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
- if (callbackReference != null) {
- List<RuntimeWire> wires = callbackReference.getRuntimeWires();
- if (!wires.isEmpty()) {
- callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(),
- wires);
- }
- }
- }
-
- for (Map.Entry<String, Collection<JavaElementImpl>> entry : instanceFactoryProvider.getImplementation()
- .getCallbackMembers().entrySet()) {
- List<RuntimeWire> wires = callbackWires.get(entry.getKey());
- if (wires == null) {
- // this can happen when there are no client wires to a
- // component that has a callback
- continue;
- }
- for(JavaElementImpl element : entry.getValue()) {
- Class<?> businessInterface = element.getType();
- ObjectFactory<?> factory = null;
- if (CallableReference.class.isAssignableFrom(element.getType())) {
- businessInterface =
- JavaIntrospectionHelper.getBusinessInterface(element.getType(), element.getGenericType());
- factory =
- new CallbackReferenceObjectFactory(businessInterface, proxyFactory, wires);
- } else {
- factory = new CallbackWireObjectFactory(businessInterface, proxyFactory, wires);
- }
- if (!(element.getAnchor() instanceof Constructor)) {
- instanceFactoryProvider.getInjectionSites().add(element);
- }
- instanceFactoryProvider.setObjectFactory(element, factory);
- }
- }
- }
- for (Reference ref : instanceFactoryProvider.getImplementation().getReferences()) {
- JavaElementImpl element =
- instanceFactoryProvider.getImplementation().getReferenceMembers().get(ref.getName());
- if (element != null) {
- if (!(element.getAnchor() instanceof Constructor)) {
- if(element.getElementType() == ElementType.FIELD) {
- Field field = (Field)element.getAnchor();
- if(Modifier.isPublic(field.getModifiers())) {
- instanceFactoryProvider.getInjectionSites().add(element);
- } else if(field.getAnnotation(org.osoa.sca.annotations.Reference.class) != null) {
- instanceFactoryProvider.getInjectionSites().add(element);
- }
- } else {
- instanceFactoryProvider.getInjectionSites().add(element);
- }
- }
- ComponentReference componentReference = null;
- List<RuntimeWire> wireList = null;
- for (ComponentReference reference : component.getReferences()) {
- if (reference.getName().equals(ref.getName())) {
- wireList = ((RuntimeComponentReference)reference).getRuntimeWires();
- componentReference = reference;
- break;
- }
- }
- if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
- List<ObjectFactory<?>> factories = new ArrayList<ObjectFactory<?>>();
- Class<?> baseType =
- JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- for (int i = 0; i < wireList.size(); i++) {
- ObjectFactory<?> factory = null;
- if (CallableReference.class.isAssignableFrom(baseType)) {
- Type callableRefType = JavaIntrospectionHelper.getParameterType(element.getGenericType());
- // Type businessType = JavaIntrospectionHelper.getParameterType(callableRefType);
- Class<?> businessInterface =
- JavaIntrospectionHelper.getBusinessInterface(baseType, callableRefType);
- factory =
- new CallableReferenceObjectFactory(businessInterface, component,
- (RuntimeComponentReference)wireList.get(i)
- .getSource().getContract(), wireList.get(i)
- .getSource().getBinding());
- } else {
- factory = createObjectFactory(baseType, wireList.get(i));
- }
- factories.add(factory);
- }
- instanceFactoryProvider.setObjectFactories(element, factories);
- JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
- for(JavaElementImpl p: constructor.getParameters()){
- if(element.getName().equals(p.getName())) {
- instanceFactoryProvider.setObjectFactories(p, factories);
- }
- }
- } else {
- if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
- throw new IllegalStateException("Required reference is missing: " + ref.getName());
- }
- if (wireList != null && !wireList.isEmpty()) {
- ObjectFactory<?> factory = null;
- if (CallableReference.class.isAssignableFrom(element.getType())) {
- Class<?> businessInterface =
- JavaIntrospectionHelper.getBusinessInterface(element.getType(), element
- .getGenericType());
- factory =
- new CallableReferenceObjectFactory(businessInterface, component,
- (RuntimeComponentReference)componentReference, null);
- } else {
- factory = createObjectFactory(element.getType(), wireList.get(0));
- }
- instanceFactoryProvider.setObjectFactory(element, factory);
- JavaConstructorImpl constructor = instanceFactoryProvider.getImplementation().getConstructor();
- for(JavaElementImpl p: constructor.getParameters()){
- if(element.getName().equals(p.getName())) {
- instanceFactoryProvider.setObjectFactory(p, factory);
- }
- }
- }
- }
- }
- }
-
- // We need to set the PropertyValueFactory on the ComponentContextImpl
- // so the ComponentContext can "de-marshal" the property type to a value
- // when the getProperty() method is called
- ComponentContextImpl ccImpl = (ComponentContextImpl)component.getComponentContext();
- ccImpl.setPropertyValueFactory(propertyValueFactory);
-
- //setUpPolicyHandlers();
- }
-
- void addResourceFactory(String name, ObjectFactory<?> factory) {
- JavaResourceImpl resource = instanceFactoryProvider.getImplementation().getResources().get(name);
-
- if (resource != null && !(resource.getElement().getAnchor() instanceof Constructor)) {
- instanceFactoryProvider.getInjectionSites().add(resource.getElement());
- }
-
- instanceFactoryProvider.setObjectFactory(resource.getElement(), factory);
- }
-
- void addConversationIDFactories(List<Member> names) {
- ObjectFactory<String> factory = new ConversationIDObjectFactory();
- for (Member name : names) {
- if (name instanceof Field) {
- JavaElementImpl element = new JavaElementImpl((Field)name);
- element.setClassifer(ConversationID.class);
- instanceFactoryProvider.setObjectFactory(element, factory);
- } else if (name instanceof Method) {
- JavaElementImpl element = new JavaElementImpl((Method)name, 0);
- element.setName(JavaIntrospectionHelper.toPropertyName(name.getName()));
- element.setClassifer(ConversationID.class);
- instanceFactoryProvider.setObjectFactory(element, factory);
- } else {
- throw new InvalidAccessorException("Member must be a field or method: " + name.getName());
- }
- }
- }
-
- Object createInstance() throws ObjectCreationException {
- return createInstanceWrapper().getInstance();
- }
-
- JavaInstanceFactoryProvider<?> getInstanceFactoryProvider() {
- return instanceFactoryProvider;
- }
-
- void stop() {
- //cleanUpPolicyHandlers();
- }
-
- Invoker createInvoker(Operation operation) throws NoSuchMethodException {
- Class<?> implClass = instanceFactoryProvider.getImplementationClass();
-
- Method method = JavaInterfaceUtil.findMethod(implClass, operation);
- return new JavaImplementationInvoker(operation, method, component);
- }
-
- private static class OptimizedObjectFactory<T> implements ObjectFactory<T> {
- private ScopeContainer scopeContainer;
-
- public OptimizedObjectFactory(ScopeContainer scopeContainer) {
- super();
- this.scopeContainer = scopeContainer;
- }
-
- public T getInstance() throws ObjectCreationException {
- try {
- return (T)scopeContainer.getWrapper(null).getInstance();
- } catch (TargetResolutionException e) {
- throw new ObjectCreationException(e);
- }
- }
-
- }
-
- private <B> ObjectFactory<B> createObjectFactory(Class<B> interfaze, RuntimeWire wire) {
- // FIXME: [rfeng] Disable the optimization for new as it needs more discussions
- /*
- boolean conversational = wire.getSource().getInterfaceContract().getInterface().isConversational();
- Binding binding = wire.getSource().getBinding();
- // Check if it's wireable binding for optimization
- if (!conversational && binding instanceof OptimizableBinding) {
- OptimizableBinding optimizableBinding = (OptimizableBinding)binding;
- Component component = optimizableBinding.getTargetComponent();
- if (component != null) {
- Implementation implementation = component.getImplementation();
- // Check if the target component is java component
- if (implementation instanceof JavaImplementation) {
- JavaImplementation javaImplementation = (JavaImplementation)implementation;
- if (interfaze.isAssignableFrom(javaImplementation.getJavaClass())) {
- ScopedRuntimeComponent scopedComponent = (ScopedRuntimeComponent)component;
- ScopeContainer scopeContainer = scopedComponent.getScopeContainer();
- Scope scope = scopeContainer.getScope();
- if (scope == Scope.COMPOSITE || scope == Scope.STATELESS || scope == Scope.SYSTEM) {
- boolean optimizable = true;
- for (InvocationChain chain : wire.getInvocationChains()) {
- if (chain.getHeadInvoker() != chain.getTailInvoker()) {
- optimizable = false;
- break;
- }
- }
- if (optimizable) {
- return new OptimizedObjectFactory<B>(scopeContainer);
- }
- }
- }
- }
- }
- }
- */
- return new WireObjectFactory<B>(interfaze, wire, proxyFactory);
- }
-
- private ObjectFactory<?> createPropertyValueFactory(ComponentProperty property,
- Object propertyValue,
- JavaElementImpl javaElement) {
- return propertyValueFactory.createValueFactory(property, propertyValue, javaElement);
- }
-
- /**
- * @return the component
- */
- RuntimeComponent getComponent() {
- return component;
- }
-
- /*private void setUpPolicyHandlers() {
- for (PolicyHandler policyHandler : policyHandlers.values()) {
- policyHandler.setUp(component.getImplementation());
- }
- }
-
- private void cleanUpPolicyHandlers() {
- for (PolicyHandler policyHandler : policyHandlers.values() ) {
- policyHandler.cleanUp(this);
- }
- }*/
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.java
deleted file mode 100644
index 4a5ad98e5b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaComponentNameFactory.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.implementation.java.invocation;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaComponentNameFactory implements ObjectFactory<String> {
- private final JavaComponentContextProvider componentContextProvider;
-
-
- public JavaComponentNameFactory(JavaComponentContextProvider component) {
- this.componentContextProvider = component;
- }
-
-
- public String getInstance() throws ObjectCreationException {
- String uri = componentContextProvider.getComponent().getURI();
- return uri.substring(uri.lastIndexOf('/')+1);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
deleted file mode 100644
index e7f419286d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationInvoker.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.ws.Holder;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * Responsible for synchronously dispatching an invocation to a Java component
- * implementation instance
- *
- * @version $Rev$ $Date$
- */
-public class JavaImplementationInvoker implements Invoker, DataExchangeSemantics {
- protected Operation operation;
- protected Method method;
- protected boolean allowsPBR;
-
- @SuppressWarnings("unchecked")
- protected final ScopeContainer scopeContainer;
-
- public JavaImplementationInvoker(Operation operation, Method method, RuntimeComponent component) {
- assert method != null : "Operation method cannot be null";
- this.method = method;
- this.operation = operation;
- this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
- this.allowsPBR = ((JavaImplementation)component.getImplementation()).isAllowsPassByReference(method);
- }
-
- public JavaImplementationInvoker(Operation operation, RuntimeComponent component) {
- // used if the method can't be computed statically in advance
- this.operation = operation;
- this.scopeContainer = ((ScopedRuntimeComponent)component).getScopeContainer();
- }
-
- @SuppressWarnings("unchecked")
- public Message invoke(Message msg) {
- Operation op = msg.getOperation();
- if (op == null) {
- op = this.operation;
- }
- ConversationSequence sequence = op.getConversationSequence();
- Object payload = msg.getBody();
-
- Object contextId = null;
-
- EndpointReference from = msg.getFrom();
- ReferenceParameters parameters = null;
- if (from != null) {
- parameters = from.getReferenceParameters();
- }
- // check what sort of context is required
- if (scopeContainer != null) {
- Scope scope = scopeContainer.getScope();
- if (scope == Scope.REQUEST) {
- contextId = Thread.currentThread();
- } else if (scope == Scope.CONVERSATION && parameters != null) {
- contextId = parameters.getConversationID();
- }
- }
-
- try {
- // The following call might create a new conversation, as a result, the msg.getConversationID() might
- // return a new value
- InstanceWrapper wrapper = scopeContainer.getWrapper(contextId);
-
- // detects whether the scope container has created a conversation Id. This will
- // happen in the case that the component has conversational scope but only the
- // callback interface is conversational. Or in the callback case if the service interface
- // is conversational and the callback interface isn't. If we are in this situation we need
- // to get the contextId of this component and remove it after we have invoked the method on
- // it. It is possible that the component instance will not go away when it is removed below
- // because a callback conversation will still be holding a reference to it
- boolean removeTemporaryConversationalComponentAfterCall = false;
- if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
- contextId = parameters.getConversationID();
- removeTemporaryConversationalComponentAfterCall = true;
- }
-
- Object instance = wrapper.getInstance();
-
- // If the method couldn't be computed statically, or the instance being
- // invoked is a user-specified callback object that doesn't implement
- // the service interface from which the reflective method was obtained,
- // compute the method object dynamically for this invocation.
- Method imethod = method;
- if (imethod == null || !imethod.getDeclaringClass().isInstance(instance)) {
- try {
- imethod = JavaInterfaceUtil.findMethod(instance.getClass(), op);
- } catch (NoSuchMethodException e) {
- throw new IllegalArgumentException("Callback object does not provide method " + e.getMessage());
- }
- }
-
- int argumentHolderCount = 0;
-
- // Holder pattern. Any payload parameters <T> which are should be in holders are placed in Holder<T>.
- // Only check Holder for remotable interfaces
- if (imethod != null && operation.getInterface().isRemotable()) {
- List<DataType> inputTypes = operation.getInputType().getLogical();
- for (int i = 0, size = inputTypes.size(); i < size; i++) {
- if (ParameterMode.IN != operation.getParameterModes().get(i)) {
- // Promote array params from [<T>] to [Holder<T>]
- Object[] payloadArray = (Object[])payload;
- for (int j = 0; payloadArray != null && j < payloadArray.length; j++) {
- Object item = payloadArray[j];
- payloadArray[j] = new Holder(item);
- }
- argumentHolderCount++;
- }
- }
- }
-
- Object ret;
- if (payload != null && !payload.getClass().isArray()) {
- ret = imethod.invoke(instance, payload);
- } else {
- ret = imethod.invoke(instance, (Object[])payload);
- }
-
- scopeContainer.returnWrapper(wrapper, contextId);
-
- if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
- // if end conversation, or we have the special case where a conversational
- // object was created to service the stateless half of a stateful component
- scopeContainer.remove(contextId);
- parameters.setConversationID(null);
- }
-
- if (argumentHolderCount > 0) {
- // Holder pattern. Any payload Holder<T> types are returned as the message body.
- List returnArgs = new ArrayList<Object>();
- if (imethod != null) {
- for (int i = 0, size = operation.getParameterModes().size(); i < size; i++) {
- // System.out.println( "JavaImplementationInvoker.invoke return parameter " + i + " type=" + parameter.getClass().getName() );
- if (ParameterMode.IN != operation.getParameterModes().get(i)) {
- // Demote array params from Holder<T> to <T>.
- Object[] payloadArray = (Object[])payload;
- for (int j = 0; j < payloadArray.length; j++) {
- Holder<Object> item = (Holder<Object>)payloadArray[j];
- payloadArray[j] = item.value;
- returnArgs.add(payloadArray[j]);
- }
- }
- }
- }
- // Although payload items are returned in a list, currently only support 1 return type.
- if (returnArgs.size() == 1) {
- Object value = returnArgs.get(0);
- msg.setBody(value);
- } else {
- msg.setBody(returnArgs.toArray());
- }
- } else {
- msg.setBody(ret);
- }
- } catch (InvocationTargetException e) {
- Throwable cause = e.getTargetException();
- boolean isChecked = false;
- for (DataType<?> d : operation.getFaultTypes()) {
- if (d.getPhysical().isInstance(cause)) {
- isChecked = true;
- msg.setFaultBody(cause);
- break;
- }
- }
-
- if (sequence != ConversationSequence.CONVERSATION_NONE) {
- try {
- // // If the exception is not a business exception then end the conversation
- // boolean businessException = false;
- //
- // for (DataType dataType : operation.getFaultTypes()){
- // if ((dataType.getPhysical() == e.getCause().getClass()) &&
- // (contextId != null) ){
- // businessException = true;
- // break;
- // }
- // }
-
- if (!isChecked && contextId != null) {
- scopeContainer.remove(contextId);
- parameters.setConversationID(null);
- }
- } catch (Exception ex) {
- // TODO - sure what the best course of action is here. We have
- // a system exception in the middle of a business exception
- }
- }
- if (!isChecked) {
- if (cause instanceof RuntimeException) {
- throw (RuntimeException)cause;
- }
- if (cause instanceof Error) {
- throw (Error)cause;
- } else {
- throw new ServiceRuntimeException(cause.getMessage(), cause);
- }
- }
-
- } catch (Exception e) {
- msg.setFaultBody(e);
- }
- return msg;
- }
-
- public boolean allowsPassByReference() {
- return allowsPBR;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
deleted file mode 100644
index 10825ca4b6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProvider.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.context.ComponentContextFactory;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.apache.tuscany.sca.implementation.java.injection.RequestContextObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.ResourceHost;
-import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaImplementationProvider implements ScopedImplementationProvider {
- private JavaImplementation implementation;
- private JavaComponentContextProvider componentContextProvider;
- private RequestContextFactory requestContextFactory;
-
- public JavaImplementationProvider(RuntimeComponent component,
- JavaImplementation implementation,
- ProxyFactory proxyService,
- DataBindingExtensionPoint dataBindingRegistry,
- PropertyValueFactory propertyValueObjectFactory,
- ComponentContextFactory componentContextFactory,
- RequestContextFactory requestContextFactory,
- List<PolicyHandlerTuple> policyHandlerClassNames) {
- super();
- this.implementation = implementation;
- this.requestContextFactory = requestContextFactory;
- this.implementation.setPolicyHandlerClassNames(policyHandlerClassNames);
-
- try {
- JavaInstanceFactoryProvider configuration = new JavaInstanceFactoryProvider(implementation);
- configuration.setProxyFactory(proxyService);
- componentContextProvider =
- new JavaComponentContextProvider(component,
- configuration,
- dataBindingRegistry,
- propertyValueObjectFactory,
- componentContextFactory,
- requestContextFactory);
-
- Scope scope = getScope();
-
- if (scope == Scope.SYSTEM || scope == Scope.COMPOSITE) {
- // Nothing
- } else {
- // Check for conversational contract if conversational scope
- if (scope == Scope.CONVERSATION) {
- boolean hasConversationalContract = false;
- for (Service serviceDef : implementation.getServices()) {
- if (serviceDef.getInterfaceContract().getInterface().isConversational()) {
- hasConversationalContract = true;
- break;
- }
- }
- if (!hasConversationalContract) {
- String name = implementation.getJavaClass().getName();
- throw new NoConversationalContractException(name);
- }
- }
- }
-
- if (implementation.getConversationIDMembers().size() > 0) {
- componentContextProvider.addConversationIDFactories(implementation.getConversationIDMembers());
- }
-
- componentContextProvider.configureProperties(component.getProperties());
- handleResources(implementation, proxyService);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
-
- }
-
- private void handleResources(JavaImplementation componentType, ProxyFactory proxyService) {
- for (JavaResourceImpl resource : componentType.getResources().values()) {
- String name = resource.getName();
-
- ObjectFactory<?> objectFactory =
- (ObjectFactory<?>)componentContextProvider.getInstanceFactoryProvider().getFactories().get(resource.getElement());
- if (objectFactory == null) {
- Class<?> type = resource.getElement().getType();
- if (ComponentContext.class.equals(type)) {
- objectFactory = new JavaComponentContextFactory(componentContextProvider);
- } else if (RequestContext.class.equals(type)) {
- objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyService);
- } else if (String.class.equals(type)) {
- objectFactory = new JavaComponentNameFactory(componentContextProvider);
- } else {
- boolean optional = resource.isOptional();
- String mappedName = resource.getMappedName();
- objectFactory = createResourceObjectFactory(type, mappedName, optional, null);
- }
- }
- componentContextProvider.addResourceFactory(name, objectFactory);
- }
- }
-
- private <T> ResourceObjectFactory<T> createResourceObjectFactory(Class<T> type,
- String mappedName,
- boolean optional,
- ResourceHost host) {
- return new ResourceObjectFactory<T>(type, mappedName, optional, host);
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- try {
- return componentContextProvider.createInvoker(operation);
- } catch (NoSuchMethodException e) {
- // It's possible that the instance being invoked is a user-specified
- // callback object that isn't an instance of the component implementation
- // class. As an attempt to deal with this, look up a method object from
- // the service interface. This isn't foolproof, as it's possible that
- // the service interface isn't a Java interface, or that the callback
- // object has the right method signature without implementing the
- // callback interface. There is code in JavaImplementationInvoker
- // to deal with these possibilities.
- Interface iface = service.getInterfaceContract().getInterface();
- if (iface instanceof JavaInterface) {
- try {
- Method method = JavaInterfaceUtil.findMethod(((JavaInterface)iface).getJavaClass(), operation);
- return new JavaImplementationInvoker(operation, method, componentContextProvider.getComponent());
- } catch (NoSuchMethodException e1) {
- throw new IllegalArgumentException(e1);
- }
- } else {
- return new JavaImplementationInvoker(operation, componentContextProvider.getComponent());
- }
- }
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public Scope getScope() {
- return new Scope(implementation.getJavaScope().getScope());
- }
-
- public void start() {
- componentContextProvider.start();
- }
-
- public void stop() {
- componentContextProvider.stop();
- }
-
- public InstanceWrapper createInstanceWrapper() {
- return componentContextProvider.createInstanceWrapper();
- }
-
- public boolean isEagerInit() {
- return implementation.isEagerInit();
- }
-
- public long getMaxAge() {
- return implementation.getMaxAge();
- }
-
- public long getMaxIdleTime() {
- return implementation.getMaxIdleTime();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
deleted file mode 100644
index a97d21e1e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaImplementationProviderFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.context.ComponentContextFactory;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaImplementationProviderFactory implements ImplementationProviderFactory<JavaImplementation> {
- private PropertyValueFactory propertyValueObjectFactory;
- private DataBindingExtensionPoint dataBindingRegistry;
- private ProxyFactory proxyService;
- private ComponentContextFactory componentContextFactory;
- private RequestContextFactory requestContextFactory;
- private List<PolicyHandlerTuple> policyHandlerClassNames = null;
-
- public JavaImplementationProviderFactory(ProxyFactory proxyService,
- DataBindingExtensionPoint dataBindingRegistry,
- PropertyValueFactory propertyValueObjectFactory,
- ComponentContextFactory componentContextFactory,
- RequestContextFactory requestContextFactory,
- List<PolicyHandlerTuple> policyHandlerClassNames) {
- super();
- this.proxyService = proxyService;
- this.dataBindingRegistry = dataBindingRegistry;
- this.propertyValueObjectFactory = propertyValueObjectFactory;
- this.componentContextFactory = componentContextFactory;
- this.requestContextFactory = requestContextFactory;
- this.policyHandlerClassNames = policyHandlerClassNames;
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- JavaImplementation implementation) {
- return new JavaImplementationProvider(component,
- implementation,
- proxyService,
- dataBindingRegistry,
- propertyValueObjectFactory,
- componentContextFactory,
- requestContextFactory,
- policyHandlerClassNames);
- }
-
- public Class<JavaImplementation> getModelType() {
- return JavaImplementation.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
deleted file mode 100644
index 95a9f63688..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaInstanceFactoryProvider.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.context.InstanceFactory;
-import org.apache.tuscany.sca.implementation.java.context.InstanceFactoryProvider;
-import org.apache.tuscany.sca.implementation.java.context.ReflectiveInstanceFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
-import org.apache.tuscany.sca.implementation.java.injection.Injector;
-import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
-import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-
-/**
- * Encapsulates configuration for a Java-based atomic component
- *
- * @version $Rev$ $Date$
- */
-public class JavaInstanceFactoryProvider<T> implements InstanceFactoryProvider<T> {
- private JavaImplementation definition;
- private ProxyFactory proxyService;
-
- private final List<JavaElementImpl> injectionSites;
- private final EventInvoker<T> initInvoker;
- private final EventInvoker<T> destroyInvoker;
- private final Map<JavaElementImpl, Object> factories = new HashMap<JavaElementImpl, Object>();
-
- public JavaInstanceFactoryProvider(JavaImplementation definition) {
- this.definition = definition;
- this.initInvoker = definition.getInitMethod() == null ? null : new MethodEventInvoker<T>(definition
- .getInitMethod());
- this.destroyInvoker = definition.getDestroyMethod() == null ? null : new MethodEventInvoker<T>(definition
- .getDestroyMethod());
- injectionSites = new ArrayList<JavaElementImpl>();
- }
-
- ProxyFactory getProxyFactory() {
- return proxyService;
- }
-
- void setProxyFactory(ProxyFactory proxyService) {
- this.proxyService = proxyService;
- }
-
- /**
- * @return the definition
- */
- JavaImplementation getImplementation() {
- return definition;
- }
-
- @SuppressWarnings("unchecked")
- public InstanceFactory<T> createFactory() {
- ObjectFactory<?>[] initArgs = getConstructorArgs();
- Injector<T>[] injectors = getInjectors();
- return new ReflectiveInstanceFactory<T>((Constructor<T>)definition.getConstructor().getConstructor(),
- initArgs, injectors, initInvoker, destroyInvoker);
- }
-
- private ObjectFactory<?>[] getConstructorArgs() {
- JavaConstructorImpl<?> constructor = definition.getConstructor();
- ObjectFactory<?>[] initArgs = new ObjectFactory<?>[constructor.getParameters().length];
- for (int i = 0; i < initArgs.length; i++) {
- ObjectFactory<?> factory = (ObjectFactory<?>)factories.get(constructor.getParameters()[i]);
- assert factory != null;
- initArgs[i] = factory;
- }
- return initArgs;
- }
-
- @SuppressWarnings("unchecked")
- private Injector<T>[] getInjectors() {
- // work around JDK1.5 issue with allocating generic arrays
- @SuppressWarnings("unchecked")
- Injector<T>[] injectors = new Injector[injectionSites.size()];
-
- int i = 0;
- for (JavaElementImpl element : injectionSites) {
- Object obj = factories.get(element);
- if (obj != null) {
- if (obj instanceof ObjectFactory) {
- ObjectFactory<?> factory = (ObjectFactory<?>)obj;
- Member member = (Member)element.getAnchor();
- if (element.getElementType() == ElementType.FIELD) {
- injectors[i++] = new FieldInjector<T>((Field)member, factory);
- } else if (element.getElementType() == ElementType.PARAMETER && member instanceof Method) {
- injectors[i++] = new MethodInjector<T>((Method)member, factory);
- } else if (member instanceof Constructor) {
- // Ignore
- } else {
- throw new AssertionError(String.valueOf(element));
- }
- } else {
- injectors[i++] = createMultiplicityInjector(element, (List<ObjectFactory<?>>)obj);
- }
- }
- }
- return injectors;
- }
-
- private Injector<T> createMultiplicityInjector(JavaElementImpl element, List<ObjectFactory<?>> factories) {
- Class<?> interfaceType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
-
- if (element.getAnchor() instanceof Field) {
- Field field = (Field)element.getAnchor();
- if (field.getType().isArray()) {
- return new FieldInjector<T>(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
- } else {
- return new FieldInjector<T>(field, new ListMultiplicityObjectFactory(factories));
- }
- } else if (element.getAnchor() instanceof Method) {
- Method method = (Method)element.getAnchor();
- if (method.getParameterTypes()[0].isArray()) {
- return new MethodInjector<T>(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
- } else {
- return new MethodInjector<T>(method, new ListMultiplicityObjectFactory(factories));
- }
- } else {
- throw new InvalidAccessorException("Member must be a field or method: " + element.getName());
- }
- }
-
- @SuppressWarnings("unchecked")
- public Class<T> getImplementationClass() {
- return (Class<T>)definition.getJavaClass();
- }
-
- public void setObjectFactory(JavaElementImpl element, ObjectFactory<?> objectFactory) {
- factories.put(element, objectFactory);
- }
-
- public void setObjectFactories(JavaElementImpl element, List<ObjectFactory<?>> objectFactory) {
- factories.put(element, objectFactory);
- }
-
- /**
- * @return the injectionSites
- */
- List<JavaElementImpl> getInjectionSites() {
- return injectionSites;
- }
-
- /**
- * @return the factories
- */
- Map<JavaElementImpl, Object> getFactories() {
- return factories;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
deleted file mode 100644
index ee3507ef80..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/JavaPolicyHandlingRuntimeWireProcessor.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerUtils;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-
-/**
- * Processor to inject policy handling interceptor whenever PolicySets are specified in a Java Implementation
- *
- * @version $Rev$ $Date$
- */
-public class JavaPolicyHandlingRuntimeWireProcessor implements RuntimeWireProcessor {
- private static final Logger logger = Logger.getLogger(JavaPolicyHandlingRuntimeWireProcessor.class.getName());
-
- public JavaPolicyHandlingRuntimeWireProcessor() {
- super();
- }
-
- public void process(RuntimeWire wire) {
- /*Contract contract = wire.getSource().getContract();
- if (!(contract instanceof RuntimeComponentReference)) {
- return;
- }*/
-
- RuntimeComponent component = wire.getTarget().getComponent();
- if (component != null && component.getImplementation() instanceof JavaImplementation) {
- JavaImplementation javaImpl = (JavaImplementation)component.getImplementation();
- if (javaImpl instanceof PolicySetAttachPoint) {
- PolicyHandler policyHandler = null;
- List<PolicyHandler> implPolicyHandlers = new ArrayList<PolicyHandler>();
- PolicySetAttachPoint policiedImpl = (PolicySetAttachPoint)javaImpl;
-
- try {
- //for ( PolicySet policySet : policiedImpl.getPolicySets() ) {
- for (PolicySet policySet : component.getPolicySets()) {
- policyHandler =
- PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl.getPolicyHandlerClassNames());
- if (policyHandler != null) {
- policyHandler.setUp(javaImpl);
- implPolicyHandlers.add(policyHandler);
- } else {
- //FIXME: to be removed after the PolicyHandler story has crystalized..
- //maybe replace with exception then...
- logger.warning("No PolicyHandler registered for PolicySet - " + policySet.getName());
- }
- }
-
- List<PolicyHandler> applicablePolicyHandlers = null;
- for (InvocationChain chain : wire.getInvocationChains()) {
- applicablePolicyHandlers = new ArrayList<PolicyHandler>();
- if (javaImpl instanceof OperationsConfigurator) {
- String operationName = chain.getTargetOperation().getName();
- OperationsConfigurator opConfigurator = (OperationsConfigurator)component;
- for (ConfiguredOperation confOp : opConfigurator.getConfiguredOperations()) {
- if (confOp.getName().equals(operationName)) {
- for (PolicySet policySet : confOp.getPolicySets()) {
- policyHandler =
- PolicyHandlerUtils.findPolicyHandler(policySet, javaImpl
- .getPolicyHandlerClassNames());
- if (policyHandler != null) {
- policyHandler.setUp(javaImpl);
- applicablePolicyHandlers.add(policyHandler);
- } else {
- logger.warning("No PolicyHandler registered for " + policySet);
- }
- }
- break;
- }
- }
-
- //if no policies have been specified at the operation level then simply
- //apply whatever is specified for the implementation level
- if (applicablePolicyHandlers.isEmpty()) {
- applicablePolicyHandlers = implPolicyHandlers;
- }
- }
-
- if (!applicablePolicyHandlers.isEmpty()) {
- String phase =
- (wire.getSource().getContract() instanceof ComponentReference) ? Phase.REFERENCE_POLICY
- : Phase.SERVICE_POLICY;
-
- chain.addInterceptor(Phase.IMPLEMENTATION_POLICY, new PolicyHandlingInterceptor(chain.getTargetOperation(),
- applicablePolicyHandlers));
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.java
deleted file mode 100644
index 515a7c8a43..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/MethodEventInvoker.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.implementation.java.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-
-/**
- * Performs an wire on a method of a given instance
- *
- * @version $Rev$ $Date$
- */
-public class MethodEventInvoker<T> implements EventInvoker<T> {
- private final Method method;
-
- /**
- * Instantiates an invoker for the given method
- */
- public MethodEventInvoker(Method method) {
- assert method != null;
- this.method = method;
- }
-
- public void invokeEvent(T instance) throws EventInvocationException {
- try {
- method.invoke(instance, (Object[]) null);
- } catch (IllegalArgumentException e) {
- String name = method.getName();
- throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
- } catch (IllegalAccessException e) {
- String name = method.getName();
- throw new EventInvocationException("Method is not accessible [" + name + "]");
- } catch (InvocationTargetException e) {
- String name = method.getName();
- throw new EventInvocationException("Exception thrown by event method [" + name + "]", e.getCause());
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java
deleted file mode 100644
index a7b175cf9b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/NoConversationalContractException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.invocation;
-
-
-/**
- * Raised when a component has conversational scope but no conversational contract
- *
- * @version $Rev: 487877 $ $Date: 2006-12-16 15:32:16 -0500 (Sat, 16 Dec 2006) $
- */
-public class NoConversationalContractException extends Exception {
-
- private static final long serialVersionUID = -1157790036638157539L;
-
- public NoConversationalContractException(String message) {
- super(message);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.java
deleted file mode 100644
index 8c85b46c65..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/invocation/PolicyHandlingInterceptor.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.implementation.java.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-/**
- * An interceptor to invoke policy handlers before and after the invocation of operations on
- * an implementation.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyHandlingInterceptor implements Interceptor {
- private Invoker next;
- private List<PolicyHandler> policyHandlers = null;
- private Operation targetOperation = null;
-
- public PolicyHandlingInterceptor(Operation targetOperation, List<PolicyHandler> policyHandlers) {
- this.policyHandlers = policyHandlers;
- this.targetOperation = targetOperation;
- }
-
- public Message invoke(Message msg) {
- try {
- applyPreInvocationPolicies(targetOperation, msg);
- msg = next.invoke(msg);
- } finally {
- applyPostInvocationPolices(targetOperation, msg);
- }
- return msg;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- private void applyPreInvocationPolicies(Object... context) {
- for (PolicyHandler policyHandler : policyHandlers) {
- policyHandler.beforeInvoke(context);
- }
- }
-
- private void applyPostInvocationPolices(Object... context) {
- for ( int count = policyHandlers.size() - 1 ; count >= 0 ; --count) {
- policyHandlers.get(count).afterInvoke(context);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
deleted file mode 100644
index 63e41bae7b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/java/org/apache/tuscany/sca/implementation/java/module/JavaRuntimeModuleActivator.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.module;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.context.ComponentContextFactory;
-import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
-import org.apache.tuscany.sca.context.PropertyValueFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.CglibProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.implementation.java.invocation.JavaCallbackRuntimeWireProcessor;
-import org.apache.tuscany.sca.implementation.java.invocation.JavaImplementationProviderFactory;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerDefinitionsLoader;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaRuntimeModuleActivator implements ModuleActivator {
-
- private static final Logger logger = Logger.getLogger(JavaRuntimeModuleActivator.class.getName());
-
- public JavaRuntimeModuleActivator() {
- }
-
- public void start(ExtensionPointRegistry registry) {
-
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
-
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
-
- ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- try {
- proxyFactories.setClassProxyFactory(new CglibProxyFactory(messageFactory, interfaceContractMapper));
- } catch (NoClassDefFoundError e) {
- logger.warning("Class proxys not supported due to NoClassDefFoundError:" + e.getMessage());
- }
-
- JavaInterfaceFactory javaFactory = factories.getFactory(JavaInterfaceFactory.class);
-
- DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class);
- PropertyValueFactory factory = utilities.getUtility(PropertyValueFactory.class);
-
- ContextFactoryExtensionPoint contextFactories = registry.getExtensionPoint(ContextFactoryExtensionPoint.class);
- ComponentContextFactory componentContextFactory = contextFactories.getFactory(ComponentContextFactory.class);
- RequestContextFactory requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
-
- List<PolicyHandlerTuple> policyHandlerClassNames = null;
- policyHandlerClassNames = PolicyHandlerDefinitionsLoader.loadPolicyHandlerClassnames();
-
- ProxyFactory proxyFactory = new ExtensibleProxyFactory(proxyFactories);
-
- JavaImplementationProviderFactory javaImplementationProviderFactory =
- new JavaImplementationProviderFactory(proxyFactory, dataBindings, factory, componentContextFactory,
- requestContextFactory, policyHandlerClassNames);
-
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- providerFactories.addProviderFactory(javaImplementationProviderFactory);
-
- RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
- registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
- if (wireProcessorExtensionPoint != null) {
- wireProcessorExtensionPoint.addWireProcessor(new JavaCallbackRuntimeWireProcessor(interfaceContractMapper,
- javaFactory));
- //wireProcessorExtensionPoint.addWireProcessor(new JavaPolicyHandlingRuntimeWireProcessor());
- }
- }
-
- public void stop(ExtensionPointRegistry registry) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory
deleted file mode 100644
index f2feb6156a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.context.PropertyValueFactory
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 0871ddf4be..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.implementation.java.module.JavaRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java
deleted file mode 100644
index ba8da101c6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/MultiplicityTestCase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.context;
-
-import junit.framework.TestCase;
-
-
-/**
- * Tests wires that are configured with a multiplicity
- *
- * @version $Rev$ $Date$
- */
-public class MultiplicityTestCase extends TestCase {
-
- public void testMultiplicity() throws Exception {
- // TODO implement
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java
deleted file mode 100644
index 628a308c86..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/context/ReflectiveInstanceWrapperTestCase.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.context;
-
-import static org.easymock.EasyMock.createMock;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetInitializationException;
-import org.apache.tuscany.sca.implementation.java.invocation.EventInvoker;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReflectiveInstanceWrapperTestCase extends TestCase {
- private ReflectiveInstanceWrapper<Object> wrapper;
- private Object instance;
- private EventInvoker<Object> initInvoker;
- private EventInvoker<Object> destroyInvoker;
-
- public void testWithNoCallbacks() {
- wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, null);
- try {
- wrapper.start();
- } catch (TargetInitializationException e) {
- fail();
- }
- try {
- wrapper.stop();
- } catch (TargetDestructionException e) {
- fail();
- }
- }
-
- public void testWithStartCallback() {
- initInvoker.invokeEvent(instance);
- EasyMock.replay(initInvoker);
- wrapper = new ReflectiveInstanceWrapper<Object>(instance, initInvoker, null);
- try {
- wrapper.start();
- } catch (TargetInitializationException e) {
- fail();
- }
- EasyMock.verify(initInvoker);
- }
-
- public void testWithStopCallback() {
- destroyInvoker.invokeEvent(instance);
- EasyMock.replay(destroyInvoker);
- wrapper = new ReflectiveInstanceWrapper<Object>(instance, null, destroyInvoker);
- try {
- wrapper.stop();
- } catch (TargetDestructionException e) {
- fail();
- }
- EasyMock.verify(destroyInvoker);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void setUp() throws Exception {
- super.setUp();
- instance = new Object();
- initInvoker = createMock(EventInvoker.class);
- destroyInvoker = createMock(EventInvoker.class);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java
deleted file mode 100644
index 29dcfa8169..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/CallbackWireObjectFactoryTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import static org.easymock.EasyMock.createMock;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CallbackWireObjectFactoryTestCase extends TestCase {
-
- @SuppressWarnings({"unchecked"})
- public void testCreateInstance() throws Exception {
- ProxyFactory service = createMock(ProxyFactory.class);
- Foo foo = new Foo() {
- };
- EasyMock.expect(service.createCallbackProxy(EasyMock.eq(Foo.class), EasyMock.isA(List.class))).andReturn(foo);
- EasyMock.replay(service);
- List<RuntimeWire> wires = new ArrayList<RuntimeWire>();
- CallbackWireObjectFactory factory = new CallbackWireObjectFactory(Foo.class, service, wires);
- assertEquals(foo, factory.getInstance());
- EasyMock.verify(service);
- }
-
- private interface Foo {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.java
deleted file mode 100644
index cc852cc677..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/FieldInjectorTestCase.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.implementation.java.injection;
-
-import java.lang.reflect.Field;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FieldInjectorTestCase extends TestCase {
-
- protected Field protectedField;
-
- public void testIllegalAccess() throws Exception {
- FieldInjector<Foo> injector = new FieldInjector<Foo>(protectedField, new SingletonObjectFactory<String>("foo"));
- Foo foo = new Foo();
- injector.inject(foo);
- assertEquals("foo", foo.hidden);
- }
-
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- protectedField = Foo.class.getDeclaredField("hidden");
- }
-
- private class Foo {
- private String hidden;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java
deleted file mode 100644
index d502462688..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/JavaPropertyValueObjectFactoryTestCase.java
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * This test case will test the JavaPropertyValueObjectFactory.
- *
- * @version $Rev$ $Date$
- */
-public class JavaPropertyValueObjectFactoryTestCase {
-
- /**
- * The factory we should use for testing.
- */
- private static JavaPropertyValueObjectFactory factory;
-
- /**
- * The assembly factory used to create Properties.
- */
- private static AssemblyFactory assemblyFactory;
-
- /**
- * Test Setup.
- */
- @BeforeClass
- public static void setup() {
- // Create the factory
- Mediator mediator = EasyMock.createNiceMock(Mediator.class);
- DataBindingExtensionPoint dpep = new DefaultDataBindingExtensionPoint();
- EasyMock.expect(mediator.getDataBindings()).andReturn(dpep).anyTimes();
- EasyMock.replay(mediator);
- factory = new JavaPropertyValueObjectFactory(mediator);
-
- // Create the AssemblyFactory we should use
- assemblyFactory = new DefaultAssemblyFactory();
- }
-
- /**
- * A test that will attempt to inject positive, negative and zero into an
- * int property.
- */
- @Test
- public void testIntegerInjectionValid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedType = Integer.TYPE;
-
- for (int i = -5; i <= 5; i++) {
- params.propertyValue = Integer.toString(i);
- params.expectedValueFromFactory = i;
- doInjection(params);
- }
- }
-
- /**
- * A test that will attempt to inject positive, negative and zero into an
- * int property using a JavaElement.
- */
- @Test
- public void testIntegerInjectionValidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedJavaElement = new JavaElementImpl(int.class);
-
- for (int i = -5; i <= 5; i++) {
- params.propertyValue = Integer.toString(i);
- params.expectedValueFromFactory = i;
- doInjection(params);
- }
- }
-
- /**
- * A test that will attempt to inject multiple int values into an
- * int property.
- */
- @Test
- public void testIntegerArrayInjectionValid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.isMany = true;
- params.expectedType = int.class;
- params.propertyValue = "1 2 3 4 5";
- params.expectedValueFromFactory = Arrays.asList(1, 2, 3, 4, 5);
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject multiple int values into an
- * int property using a JavaElement.
- */
- @Test
- public void testIntegerArrayInjectionValidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.isMany = true;
- params.expectedJavaElement = new JavaElementImpl(int[].class);
- params.propertyValue = "1 2 3 4 5";
- int[] expected = { 1, 2, 3, 4, 5 };
- params.expectedValueFromFactory = expected;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject a non-number into an
- * int property.
- */
- @Test
- public void testIntegerInjectionBadNumberInvalid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedType = Integer.TYPE;
- params.propertyValue = "a";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject a non-number into an
- * int property using a JavaElement.
- */
- @Test
- public void testIntegerInjectionBadNumberInvalidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedJavaElement = new JavaElementImpl(Integer.TYPE);
- params.propertyValue = "a";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject multiple int values into an
- * int property where one of the property values is not a number.
- * The injection should throw ObjectCreationException
- */
- @Test
- public void testIntegerArrayInjectionBadNumberInvalid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.isMany = true;
- params.expectedType = int.class;
- params.propertyValue = "1 2 aa 4 5";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject multiple int values into an
- * int property using a JavaElement where one of the property
- * values is not a number.
- * The injection should throw ObjectCreationException
- */
- @Test
- public void testIntegerArrayInjectionBadNumberInvalidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.isMany = true;
- params.expectedJavaElement = new JavaElementImpl(int[].class);
- params.propertyValue = "1 2 aa 4 5";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject an empty string into an int property.
- * The injection should throw ObjectCreationException
- */
- @Test
- public void testIntegerInjectionEmptyStringInvalid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedType = Integer.TYPE;
- params.propertyValue = "";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject an empty string into an int property
- * using a JavaElement.
- * The injection should throw ObjectCreationException
- */
- @Test
- public void testIntegerInjectionEmptyStringInvalidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "intField";
- params.xsdType = SimpleTypeMapperImpl.XSD_INT;
- params.expectedJavaElement = new JavaElementImpl(Integer.TYPE);
- params.propertyValue = "";
- params.exceptionExpected = true;
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject a String into a String
- * property.
- */
- @Test
- public void testStringInjectionValid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "StringField";
- params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
- params.expectedType = String.class;
-
- params.propertyValue = "Some Test String";
- params.expectedValueFromFactory = "Some Test String";
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject a String into a String
- * property using a JavaElement.
- */
- @Test
- public void testStringInjectionValidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "StringField";
- params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
- params.expectedJavaElement = new JavaElementImpl(String.class);
-
- params.propertyValue = "Some Test String";
- params.expectedValueFromFactory = "Some Test String";
- doInjection(params);
- }
-
- /**
- * This class defines all the parameters for the Property Injection test.
- */
- private class InjectionTestParams {
- // Input parameters for the test
- public boolean isMany = false;
- public String propertyName;
- public String propertyValue;
- public QName xsdType;
-
- // Expected result for test
- public Object expectedValueFromFactory;
- public Class<?> expectedType;
- public JavaElementImpl expectedJavaElement;
- public boolean exceptionExpected = false;
- }
-
- /**
- * A test that will attempt to inject multiple String values into an
- * String property.
- */
- @Test
- public void testStringArrayInjectionValid() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "StringField";
- params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
- params.isMany = true;
- params.expectedType = String.class;
- params.propertyValue = "\"String1\" \"String2\" \"String3\" \"String4\" \"String5\"";
- params.expectedValueFromFactory = Arrays.asList(
- "String1", "String2", "String3", "String4", "String5");
- doInjection(params);
- }
-
- /**
- * A test that will attempt to inject multiple String values into an
- * String property using a JavaElement.
- */
- @Test
- public void testStringArrayInjectionValidWithJavaElement() {
- InjectionTestParams params = new InjectionTestParams();
- params.propertyName = "StringField";
- params.xsdType = SimpleTypeMapperImpl.XSD_STRING;
- params.isMany = true;
- params.expectedJavaElement = new JavaElementImpl(String.class);
- params.propertyValue = "\"String1\" \"String2\" \"String3\" \"String4\" \"String5\"";
- params.expectedValueFromFactory = Arrays.asList(
- "String1", "String2", "String3", "String4", "String5");
- doInjection(params);
- }
-
- /**
- * Utility method for testing creating properties with the
- * JavaPropertyValueObjectFactory.
- *
- * @param testParams The parameters for the test
- */
- private void doInjection(final InjectionTestParams testParams) {
- // Create the property
- Property prop = assemblyFactory.createProperty();
- prop.setMany(testParams.isMany);
- prop.setName(testParams.propertyName);
- prop.setXSDType(testParams.xsdType);
-
- // Mock up the XML that will contain the Property details
- Document doc = EasyMock.createNiceMock(Document.class);
- Element rootElement = EasyMock.createMock(Element.class);
- EasyMock.expect(doc.getDocumentElement()).andReturn(rootElement);
- NodeList nodeList = EasyMock.createMock(NodeList.class);
- EasyMock.expect(rootElement.getChildNodes()).andReturn(nodeList).anyTimes();
- EasyMock.expect(nodeList.getLength()).andReturn(1);
- Node node = EasyMock.createMock(Node.class);
- EasyMock.expect(nodeList.item(0)).andReturn(node);
- EasyMock.expect(node.getTextContent()).andReturn(testParams.propertyValue);
- EasyMock.replay(doc, rootElement, nodeList, node);
-
- // Create a factory either using the Class or JavaElementImpl constructor
- ObjectFactory<?> objectFactory;
- if (testParams.expectedJavaElement != null) {
- objectFactory = factory.createValueFactory(prop, doc, testParams.expectedJavaElement);
- } else {
- objectFactory = factory.createValueFactory(prop, doc, testParams.expectedType);
- }
- Assert.assertNotNull(objectFactory);
-
- // Lets test the factory
- try {
- // Create a new instance with the factory
- Object value = objectFactory.getInstance();
-
- // Did we expect an exception to be thrown?
- if (testParams.exceptionExpected) {
- Assert.fail("Test should have thrown ObjectCreationException");
- }
-
- // Make sure the result is of the correct type
- if (testParams.expectedValueFromFactory instanceof Collection<?>) {
- // Make sure the Collections contain the same type
- Assert.assertTrue(value instanceof Collection<?>);
- Iterator<?> iter1 = ((Collection<?>) testParams.expectedValueFromFactory).iterator();
- Iterator<?> iter2 = ((Collection<?>) value).iterator();
- Assert.assertEquals(iter1.next().getClass(), iter2.next().getClass());
- } else {
- Assert.assertEquals(testParams.expectedValueFromFactory.getClass(), value.getClass());
- }
-
- // Validate the result
- Assert.assertNotNull(value);
- if (testParams.expectedValueFromFactory.getClass().isArray()) {
- Assert.assertTrue(compareArrays(testParams.expectedValueFromFactory, value));
- } else {
- Assert.assertEquals(testParams.expectedValueFromFactory, value);
- }
- } catch (ObjectCreationException ex) {
- // Is this an expected exception?
- if (testParams.exceptionExpected) {
- // Make sure the exception error message contains the property name
- Assert.assertTrue(ex.toString().indexOf(testParams.propertyName) != -1);
-
- // Make sure the exception error message contains the property value
- if (testParams.propertyValue != null) {
- if (testParams.isMany) {
- // FIXME: No simple way to do this for multi-value properties
- } else {
- Assert.assertTrue(ex.toString().indexOf(testParams.propertyValue) != -1);
- }
- }
- } else {
- // Test failure. We were not expecting an exception
- ex.printStackTrace();
- Assert.fail("Unexpected exception " + ex);
- }
- }
- }
-
- /**
- * Compares two Objects that are actually arrays to make sure that they are
- * equal.
- *
- * @param array1 The first array
- * @param array2 The second array
- * @return True if they are equal. False if they are not
- */
- private boolean compareArrays(final Object array1, final Object array2) {
- // Check for primitive array types
- if (array1 instanceof boolean[]) {
- return Arrays.equals((boolean[]) array1, (boolean[]) array2);
- }
- if (array1 instanceof byte[]) {
- return Arrays.equals((byte[]) array1, (byte[]) array2);
- }
- if (array1 instanceof char[]) {
- return Arrays.equals((char[]) array1, (char[]) array2);
- }
- if (array1 instanceof double[]) {
- return Arrays.equals((double[]) array1, (double[]) array2);
- }
- if (array1 instanceof float[]) {
- return Arrays.equals((float[]) array1, (float[]) array2);
- }
- if (array1 instanceof int[]) {
- return Arrays.equals((int[]) array1, (int[]) array2);
- }
- if (array1 instanceof long[]) {
- return Arrays.equals((long[]) array1, (long[]) array2);
- }
- if (array1 instanceof short[]) {
- return Arrays.equals((short[]) array1, (short[]) array2);
- }
-
- // Not a primitive so must be an Object[]
- return Arrays.equals((Object[]) array1, (Object[]) array2);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java
deleted file mode 100644
index 4de0a4e8c7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodEventInvokerTestCase.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.implementation.java.invocation.EventInvocationException;
-import org.apache.tuscany.sca.implementation.java.invocation.MethodEventInvoker;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MethodEventInvokerTestCase extends TestCase {
- private Method privateMethod;
- private Method exceptionMethod;
-
- public void testIllegalAccess() throws Exception {
- MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(privateMethod);
- try {
- injector.invokeEvent(new Foo());
- fail();
- } catch (EventInvocationException e) {
- // expected
- }
- }
-
- public void testException() throws Exception {
- MethodEventInvoker<MethodEventInvokerTestCase.Foo> injector = new MethodEventInvoker<Foo>(exceptionMethod);
- try {
- injector.invokeEvent(new Foo());
- fail();
- } catch (RuntimeException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- privateMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("hidden");
- exceptionMethod = MethodEventInvokerTestCase.Foo.class.getDeclaredMethod("exception");
-
- }
-
- public class Foo {
-
- public void foo() {
- }
-
- private void hidden() {
- }
-
- public void exception() {
- throw new RuntimeException();
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.java
deleted file mode 100644
index 214779ed3f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/MethodInjectorTestCase.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.implementation.java.injection;
-
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class MethodInjectorTestCase extends TestCase {
- private Method fooMethod;
- private Method privateMethod;
- private Method exceptionMethod;
-
- public void testIllegalArgument() throws Exception {
- ObjectFactory<Object> factory = new SingletonObjectFactory<Object>(new Object());
- MethodInjector<Foo> injector = new MethodInjector<Foo>(fooMethod, factory);
- try {
- injector.inject(new Foo());
- fail();
- } catch (ObjectCreationException e) {
- // expected
- }
- }
-
- public void testException() throws Exception {
- ObjectFactory<Object> factory = new SingletonObjectFactory<Object>("foo");
- MethodInjector<Foo> injector = new MethodInjector<Foo>(exceptionMethod, factory);
- try {
- injector.inject(new Foo());
- fail();
- } catch (RuntimeException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- fooMethod = Foo.class.getMethod("foo", String.class);
- privateMethod = Foo.class.getDeclaredMethod("hidden", String.class);
- exceptionMethod = Foo.class.getDeclaredMethod("exception", String.class);
-
- }
-
- private class Foo {
-
- public void foo(String bar) {
- }
-
- private void hidden(String bar) {
- }
-
- public void exception(String bar) {
- throw new RuntimeException();
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.java
deleted file mode 100644
index c470b8cf3d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/RequestContextObjectFactoryTestCase.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.implementation.java.injection;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class RequestContextObjectFactoryTestCase extends TestCase {
-
- public void testInstanceCreate() {
- RequestContextObjectFactory factory = new RequestContextObjectFactory(null);
- assertNotNull(factory.getInstance());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java
deleted file mode 100644
index ed7a0e7d03..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/ResourceObjectFactoryTestCase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ResourceObjectFactoryTestCase extends TestCase {
-
- public void testResolveFromHostByType() throws Exception {
- ResourceHost host = EasyMock.createMock(ResourceHost.class);
- EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn("foo");
- EasyMock.replay(host);
- ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
- assertEquals("foo", factory.getInstance());
- EasyMock.verify(host);
- }
-
- public void testResolveFromHostByName() throws Exception {
- ResourceHost host = EasyMock.createMock(ResourceHost.class);
- EasyMock.expect(host.resolveResource(EasyMock.eq(String.class),
- EasyMock.eq("sca://localhost/bar"))).andReturn("foo");
- EasyMock.replay(host);
- ResourceObjectFactory<String> factory =
- new ResourceObjectFactory<String>(String.class, "sca://localhost/bar", false, host);
- assertEquals("foo", factory.getInstance());
- EasyMock.verify(host);
- }
-
-
- public void testResolveFromParentThenResolveFromHostNotFound() throws Exception {
- ResourceHost host = EasyMock.createMock(ResourceHost.class);
- EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
- EasyMock.replay(host);
- ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
- assertNull(factory.getInstance());
- EasyMock.verify(host);
- }
-
- public void testResolveByTypeNotFound() throws Exception {
-// ResourceHost host = EasyMock.createMock(ResourceHost.class);
-// EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
-// EasyMock.replay(host);
-//
-// RuntimeWire wire = EasyMock.createMock(RuntimeWire.class);
-// EasyMock.expect(wire.getTargetInstance()).andReturn(null);
-// EasyMock.replay(wire);
-//
-// ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, false, host);
-// try {
-// factory.getInstance();
-// fail();
-// } catch (ResourceNotFoundException e) {
-// //expected
-// }
-// EasyMock.verify(host);
- }
-
- public void testResolveByTypeNotFoundOptional() throws Exception {
- ResourceHost host = EasyMock.createMock(ResourceHost.class);
- EasyMock.expect(host.resolveResource(EasyMock.eq(String.class))).andReturn(null);
- EasyMock.replay(host);
- ResourceObjectFactory<String> factory = new ResourceObjectFactory<String>(String.class, true, host);
- assertNull(factory.getInstance());
- EasyMock.verify(host);
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java
deleted file mode 100644
index c1650c3a83..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactory.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Implementation of ObjectFactory that returns a single instance, typically an immutable type.
- *
- * @version $Rev$ $Date$
- */
-public class SingletonObjectFactory<T> implements ObjectFactory<T> {
- private final T instance;
-
- public SingletonObjectFactory(T instance) {
- this.instance = instance;
- }
-
- public T getInstance() {
- return instance;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java
deleted file mode 100644
index 40ad1b1e95..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/SingletonObjectFactoryTestCase.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SingletonObjectFactoryTestCase extends TestCase {
-
- public void testSingleton() throws Exception {
- Object o = new Object();
- SingletonObjectFactory<Object> factory = new SingletonObjectFactory<Object>(o);
- assertEquals(o, factory.getInstance());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java
deleted file mode 100644
index de371e09bb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactory.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.injection;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * Creates new instances of a Java class
- *
- * @version $Rev$ $Date$
- * @see org.apache.tuscany.sca.implementation.java.injection.Injector
- */
-public class TestObjectFactory<T> implements ObjectFactory<T> {
-
- private final Constructor<T> ctr;
- private ObjectFactory[] initializerFactories;
-
- /**
- * Creates the object factory
- *
- * @param ctr the constructor to use when instantiating a new object
- */
- public TestObjectFactory(Constructor<T> ctr) {
- assert ctr != null;
- this.ctr = ctr;
- initializerFactories = new ObjectFactory[ctr.getParameterTypes().length];
- }
-
- /**
- * Creates the object factory
- *
- * @param ctr the constructor to use when instantiating a new object
- * @param factories an ordered list of <code>ObjectFactory</code>s to use for returning constructor parameters
- */
- public TestObjectFactory(Constructor<T> ctr, List<ObjectFactory> factories) {
- assert ctr != null;
- int params = ctr.getParameterTypes().length;
- assert params == factories.size();
- this.ctr = ctr;
- initializerFactories = new ObjectFactory[params];
- int i = 0;
- for (ObjectFactory factory : factories) {
- initializerFactories[i] = factory;
- i++;
- }
- }
-
- /**
- * Returns the ordered array of <code>ObjectFactory</code>s use in creating constructor parameters
- */
- public ObjectFactory[] getInitializerFactories() {
- return initializerFactories;
- }
-
- /**
- * Sets an <code>ObjectFactory</code>s to use in creating constructor parameter
- *
- * @param pos the constructor parameter position
- * @param factory the object factory
- */
- public void setInitializerFactory(int pos, ObjectFactory factory) {
- assert pos < initializerFactories.length;
- initializerFactories[pos] = factory;
- }
-
- /**
- * Creates a new instance of an object
- */
- public T getInstance() throws ObjectCreationException {
- int size = initializerFactories.length;
- Object[] initargs = new Object[size];
- // create the constructor arg array
- for (int i = 0; i < size; i++) {
- ObjectFactory<?> objectFactory = initializerFactories[i];
- if (objectFactory == null) {
- // this can happen if a reference is optional
- initargs[i] = null;
- } else {
- initargs[i] = objectFactory.getInstance();
- }
- }
- try {
- ctr.setAccessible(true);
- return ctr.newInstance(initargs);
- } catch (IllegalArgumentException e) {
- String name = ctr.getName();
- throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
- } catch (InstantiationException e) {
- String name = ctr.getDeclaringClass().getName();
- throw new AssertionError("Class is not instantiable [" + name + "]");
- } catch (IllegalAccessException e) {
- String name = ctr.getName();
- throw new AssertionError("Constructor is not accessible [" + name + "]");
- } catch (InvocationTargetException e) {
- String name = ctr.getName();
- throw new ObjectCreationException("Exception thrown by constructor: " + name, e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.java
deleted file mode 100644
index 1fb7abb917..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/injection/TestObjectFactoryTestCase.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.implementation.java.injection;
-
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TestObjectFactoryTestCase extends TestCase {
-
- private Constructor<Foo> ctor;
-
- public void testConstructorInjection() throws Exception {
- List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
- initializers.add(new SingletonObjectFactory<String>("foo"));
- TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor, initializers);
- Foo foo = factory.getInstance();
- assertEquals("foo", foo.foo);
- }
-
- /**
- * Verifies null parameters can be passed to a constructor. This is valid when a reference is optional during
- * constructor injection
- */
- public void testConstructorInjectionOptionalParam() throws Exception {
- List<ObjectFactory> initializers = new ArrayList<ObjectFactory>();
- initializers.add(null);
- TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor, initializers);
- Foo foo = factory.getInstance();
- assertNull(foo.foo);
- }
-
- public void testConstructorInitializerInjection() throws Exception {
- TestObjectFactory<Foo> factory = new TestObjectFactory<Foo>(ctor);
- factory.setInitializerFactory(0, new SingletonObjectFactory<String>("foo"));
- Foo foo = factory.getInstance();
- assertEquals("foo", foo.foo);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- ctor = Foo.class.getConstructor(String.class);
- }
-
- private static class Foo {
-
- private String foo;
-
- public Foo(String foo) {
- this.foo = foo;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java
deleted file mode 100644
index e993cdd382..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean1.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.util;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Bean1 extends SuperBean {
-
- public static final int ALL_BEAN1_FIELDS = 6 + ALL_SUPER_FIELDS;
- public static final int ALL_BEAN1_PUBLIC_PROTECTED_FIELDS = 5 + ALL_SUPER_PUBLIC_PROTECTED_FIELDS;
- public static final int ALL_BEAN1_METHODS = 4 + ALL_SUPER_METHODS - 1;
- public String field3;
- protected String field2;
- private String field1;
-
- public void setMethod1(String param) {
- }
-
- public void setMethod1(int param) {
- }
-
- @Override
- public void override(String param) throws Exception {
- }
-
-
- public void noOverride(String param) throws Exception {
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.java
deleted file mode 100644
index 82264c77c9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Bean2.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.implementation.java.util;
-
-import java.util.List;
-
-import junit.framework.AssertionFailedError;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Bean2 {
-
- private List methodList;
- private List fieldList;
-
- public List getMethodList() {
- return methodList;
- }
-
- public void setMethodList(List list) {
- methodList = list;
- }
-
- public List getfieldList() {
- return fieldList;
- }
-
- public void setfieldList(List list) {
- throw new AssertionFailedError("setter inadvertantly called");
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java
deleted file mode 100644
index a5e12d181c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/Entry.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.util;
-
-/**
- * Implementations are used in wiring tests
- *
- * @version $Rev$ $Date$
- */
-public interface Entry {
-
- String getString();
-
- void setString(String val);
-}
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
deleted file mode 100644
index ed6bf7ddc4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/JavaIntrospectionHelperTestCase.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.util;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaIntrospectionHelperTestCase extends TestCase {
-
- private List testNoGenericsList;
- private List<String> testList;
- private Map<String, Bean1> testMap;
- private Entry[] testArray;
- private String[] testStringArray;
-
- public JavaIntrospectionHelperTestCase() {
- super();
- }
-
- public JavaIntrospectionHelperTestCase(String arg0) {
- super(arg0);
- }
-
- public void testBean1AllPublicProtectedFields() throws Exception {
- Set<Field> beanFields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(Bean1.class, true);
- assertEquals(4, beanFields.size()); //Bean1.ALL_BEAN1_PUBLIC_PROTECTED_FIELDS
- }
-
- public void testGetSuperAllMethods() throws Exception {
- Set<Method> superBeanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(SuperBean.class, true);
- assertEquals(SuperBean.ALL_SUPER_METHODS, superBeanMethods.size());
- }
-
- public void testGetBean1AllMethods() throws Exception {
- Set<Method> beanMethods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
- assertEquals(Bean1.ALL_BEAN1_METHODS, beanMethods.size());
- }
-
- public void testOverrideMethod() throws Exception {
- Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
- boolean invoked = false;
- for (Method method : beanFields) {
- if (method.getName().equals("override")) {
- method.invoke(new Bean1(), "foo");
- invoked = true;
- }
- }
- if (!invoked) {
- throw new Exception("Override never invoked");
- }
- }
-
- public void testNoOverrideMethod() throws Exception {
- Set<Method> beanFields = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(Bean1.class, true);
- boolean found = false;
- for (Method method : beanFields) {
- if (method.getName().equals("noOverride") && method.getParameterTypes().length == 0) {
- found = true;
- }
- }
- if (!found) {
- throw new Exception("No override not found");
- }
- }
-
- public void testDefaultConstructor() throws Exception {
- Constructor ctr = JavaIntrospectionHelper.getDefaultConstructor(Bean2.class);
- assertEquals(ctr, Bean2.class.getConstructor());
- assertTrue(Bean2.class == ctr.newInstance((Object[]) null).getClass());
- }
-
-
- public void testGetAllInterfaces() {
- Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Z.class);
- assertEquals(2, interfaces.size());
- assertTrue(interfaces.contains(W.class));
- assertTrue(interfaces.contains(W2.class));
- }
-
-
- public void testGetAllInterfacesObject() {
- Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(Object.class);
- assertEquals(0, interfaces.size());
- }
-
- public void testGetAllInterfacesNoInterfaces() {
- Set<Class> interfaces = JavaIntrospectionHelper.getAllInterfaces(NoInterface.class);
- assertEquals(0, interfaces.size());
- }
-
- /**
- * Tests generics introspection capabilities
- */
- public void testGenerics() throws Exception {
-
- List classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testList").getGenericType());
- assertEquals(1, classes.size());
- assertEquals(String.class, classes.get(0));
-
- classes =
- JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testNoGenericsList").getGenericType());
- assertEquals(0, classes.size());
-
- classes = JavaIntrospectionHelper.getGenerics(getClass().getDeclaredField("testMap").getGenericType());
- assertEquals(2, classes.size());
- assertEquals(String.class, classes.get(0));
- assertEquals(Bean1.class, classes.get(1));
-
- classes = JavaIntrospectionHelper
- .getGenerics(getClass().getDeclaredMethod("fooMethod", Map.class).getGenericParameterTypes()[0]);
- assertEquals(2, classes.size());
- assertEquals(String.class, classes.get(0));
- assertEquals(Bean1.class, classes.get(1));
-
- classes = JavaIntrospectionHelper
- .getGenerics(getClass().getDeclaredMethod("fooMethod", List.class).getGenericParameterTypes()[0]);
- assertEquals(1, classes.size());
- assertEquals(String.class, classes.get(0));
-
- }
-
- private void fooMethod(List<String> foo) {
-
- }
-
- private void fooMethod(Map<String, Bean1> foo) {
-
- }
-
- public void setTestArray(Entry[] array) {
- }
-
- private interface W {
-
- }
-
- private interface W2 {
-
- }
-
- private class X implements W {
-
- }
-
- private class Y extends X implements W, W2 {
-
- }
-
- private class Z extends Y {
-
- }
-
- private class NoInterface {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java b/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java
deleted file mode 100644
index 408cedb8be..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-runtime/src/test/java/org/apache/tuscany/sca/implementation/java/util/SuperBean.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.util;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SuperBean {
-
- public static final int ALL_SUPER_FIELDS = 6;
- public static final int ALL_SUPER_PUBLIC_PROTECTED_FIELDS = 5;
- public static final int ALL_SUPER_METHODS = 4;
- public String superField2;
-
- protected String superField3;
-
- private String superField1;
-
- public void setSuperMethod1(String param) {
- }
-
- public void setSuperMethod1(int param) {
- }
-
- public void override(String param) throws Exception {
- throw new Exception("Override not handled");
- }
-
- public void noOverride() throws Exception {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/LICENSE b/branches/sca-java-1.5.1/modules/implementation-java-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-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-java-1.5.1/modules/implementation-java-xml/NOTICE b/branches/sca-java-1.5.1/modules/implementation-java-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/pom.xml b/branches/sca-java-1.5.1/modules/implementation-java-xml/pom.xml
deleted file mode 100644
index d772acf2e7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/pom.xml
+++ /dev/null
@@ -1,112 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-java-xml</artifactId>
- <name>Apache Tuscany SCA Java Implementation XML Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>${version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>${version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml-ws</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions-xml</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.java.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.java
deleted file mode 100644
index ecbf0c4c78..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationConstants.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.implementation.java.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Constants for the Java Implementation.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaImplementationConstants {
-
- String IMPLEMENTATION_JAVA = "implementation.java";
- QName IMPLEMENTATION_JAVA_QNAME = new QName(Constants.SCA10_NS, "implementation.java");
- String CLASS = "class";
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
deleted file mode 100644
index 7445209672..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-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.xml.ConfiguredOperationProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaImplementationProcessor implements StAXArtifactProcessor<JavaImplementation>,
- JavaImplementationConstants {
-
- private AssemblyFactory assemblyFactory;
- private PolicyFactory policyFactory;
- private ExtensionFactory extensionFactory;
- private JavaImplementationFactory javaFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private IntentAttachPointTypeFactory intentAttachPointTypeFactory;
- private ConfiguredOperationProcessor configuredOperationProcessor;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- public JavaImplementationProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.javaFactory = modelFactories.getFactory(JavaImplementationFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.intentAttachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- this.monitor = monitor;
- this.configuredOperationProcessor = new ConfiguredOperationProcessor(modelFactories, this.monitor);
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-javaxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public JavaImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.java>
- JavaImplementation javaImplementation = javaFactory.createJavaImplementation();
-
- /*if ( javaImplementation instanceof PolicySetAttachPoint ) {
- IntentAttachPointType implType = intentAttachPointTypeFactory.createImplementationType();
- implType.setName(getArtifactType());
- implType.setUnresolved(true);
- ((PolicySetAttachPoint)javaImplementation).setType(implType);
- }*/
-
- javaImplementation.setUnresolved(true);
- javaImplementation.setName(reader.getAttributeValue(null, CLASS));
-
- // Read policies
- policyProcessor.readPolicies(javaImplementation, reader);
-
- // Handle extended attributes
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
- (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- javaImplementation.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
-
-
-
- // read operation elements if exists or skip unto end element
- int event;
- ConfiguredOperation confOp = null;
- while (reader.hasNext()) {
- event = reader.next();
- switch ( event ) {
- case START_ELEMENT : {
- if ( Constants.OPERATION_QNAME.equals(reader.getName()) ) {
- confOp = configuredOperationProcessor.read(reader);
- if ( confOp != null ) {
- ((OperationsConfigurator)javaImplementation).getConfiguredOperations().add(confOp);
- }
- }
- }
- break;
- }
-
- if (event == END_ELEMENT && IMPLEMENTATION_JAVA_QNAME.equals(reader.getName())) {
- break;
- }
- }
- return javaImplementation;
- }
-
- public void write(JavaImplementation javaImplementation, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
-
- // Write an <implementation.java>
- writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_JAVA);
- policyProcessor.writePolicyAttributes(javaImplementation, writer);
-
- if (javaImplementation.getName() != null) {
- writer.writeAttribute(CLASS, javaImplementation.getName());
- }
-
- // Write extended attributes
- for(Extension extension : javaImplementation.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- writer.writeEndElement();
- }
-
- public void resolve(JavaImplementation javaImplementation, ModelResolver resolver)
- throws ContributionResolveException {
-
- ClassReference classReference = new ClassReference(javaImplementation.getName());
- classReference = resolver.resolveModel(ClassReference.class, classReference);
- Class javaClass = classReference.getJavaClass();
- if (javaClass == null) {
- error("ClassNotFoundException", resolver, javaImplementation.getName());
- //throw new ContributionResolveException(new ClassNotFoundException(javaImplementation.getName()));
- return;
- }
-
- javaImplementation.setJavaClass(javaClass);
-
- try {
- javaFactory.createJavaImplementation(javaImplementation, javaImplementation.getJavaClass());
- } catch (IntrospectionException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", javaFactory, ce);
- //throw ce;
- return;
- }
-
- javaImplementation.setUnresolved(false);
- mergeComponentType(resolver, javaImplementation);
-
- // FIXME the introspector should always create at least one service
- if (javaImplementation.getServices().isEmpty()) {
- javaImplementation.getServices().add(assemblyFactory.createService());
- }
- }
-
- private JavaElementImpl getMemeber(JavaImplementation impl, String name, Class<?> type) {
- String setter = JavaIntrospectionHelper.toSetter(name);
- try {
- Method method = impl.getJavaClass().getDeclaredMethod(setter, type);
- int mod = method.getModifiers();
- if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
- return new JavaElementImpl(method, 0);
- }
- } catch (NoSuchMethodException e) {
- Field field;
- try {
- field = impl.getJavaClass().getDeclaredField(name);
- int mod = field.getModifiers();
- if ((Modifier.isPublic(mod) || Modifier.isProtected(mod)) && (!Modifier.isStatic(mod))) {
- return new JavaElementImpl(field);
- }
- } catch (NoSuchFieldException e1) {
- // Ignore
- }
- }
- return null;
- }
-
- /**
- * Merge the componentType from introspection and external file
- * @param resolver
- * @param impl
- */
- private void mergeComponentType(ModelResolver resolver, JavaImplementation impl) {
- // FIXME: Need to clarify how to merge
- ComponentType componentType = getComponentType(resolver, impl);
- if (componentType != null && !componentType.isUnresolved()) {
- Map<String, Reference> refMap = new HashMap<String, Reference>();
- for (Reference ref : impl.getReferences()) {
- refMap.put(ref.getName(), ref);
- }
- for (Reference reference : componentType.getReferences()) {
- refMap.put(reference.getName(), reference);
- }
- impl.getReferences().clear();
- impl.getReferences().addAll(refMap.values());
-
- // Try to match references by type
- Map<String, JavaElementImpl> refMembers = impl.getReferenceMembers();
- for (Reference ref : impl.getReferences()) {
- if (ref.getInterfaceContract() != null) {
- Interface i = ref.getInterfaceContract().getInterface();
- if (i instanceof JavaInterface) {
- Class<?> type = ((JavaInterface)i).getJavaClass();
- if (!refMembers.containsKey(ref.getName())) {
- JavaElementImpl e = getMemeber(impl, ref.getName(), type);
- if (e != null) {
- refMembers.put(ref.getName(), e);
- }
- }
- }
- }
- }
-
- Map<String, Service> serviceMap = new HashMap<String, Service>();
- for (Service svc : impl.getServices()) {
- serviceMap.put(svc.getName(), svc);
- }
- for (Service service : componentType.getServices()) {
- serviceMap.put(service.getName(), service);
- }
- impl.getServices().clear();
- impl.getServices().addAll(serviceMap.values());
-
- Map<String, Property> propMap = new HashMap<String, Property>();
- for (Property prop : impl.getProperties()) {
- propMap.put(prop.getName(), prop);
- }
- for (Property property : componentType.getProperties()) {
- propMap.put(property.getName(), property);
- }
- impl.getProperties().clear();
- impl.getProperties().addAll(propMap.values());
-
- if (componentType.getConstrainingType() != null) {
- impl.setConstrainingType(componentType.getConstrainingType());
- }
- }
- }
-
- private ComponentType getComponentType(ModelResolver resolver, JavaImplementation impl) {
- String className = impl.getJavaClass().getName();
- String componentTypeURI = className.replace('.', '/') + ".componentType";
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- componentType.setURI(componentTypeURI);
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (!componentType.isUnresolved()) {
- return componentType;
- }
- return null;
- }
-
- public QName getArtifactType() {
- return IMPLEMENTATION_JAVA_QNAME;
- }
-
- public Class<JavaImplementation> getModelType() {
- return JavaImplementation.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index ff43eebcfc..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.java.xml.JavaImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.java,model=org.apache.tuscany.sca.implementation.java.JavaImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties
deleted file mode 100644
index 210b715da8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/main/resources/impl-javaxml-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ClassNotFoundException = Class Not Found Exception: {0}
-ContributionResolveException = Contribution Resolve Exception occured due to:
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddService.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddService.java
deleted file mode 100644
index 9c22177684..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * Interface for the Add Service.
- *
- * @version $Rev$ $Date$
- */
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.java
deleted file mode 100644
index 3f28d740a7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/AddServiceImpl.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 calculator;
-
-import org.osoa.sca.annotations.EagerInit;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * An implementation of the Add service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@EagerInit
-public class AddServiceImpl implements AddService {
-
- public double add(double n1, double n2) {
- return n1 + n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.java
deleted file mode 100644
index e0cf23dc17..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorService.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 calculator;
-
-/**
- * The Calculator service interface.
- *
- * @version $Rev$ $Date$
- */
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
deleted file mode 100644
index c1fceb575d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/CalculatorServiceImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * An implementation of the Calculator service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-public class CalculatorServiceImpl implements CalculatorService {
-
- private AddService addService;
- private SubtractService subtractService;
- private MultiplyService multiplyService;
- private DivideService divideService;
-
- @Reference
- public void setAddService(AddService addService) {
- this.addService = addService;
- }
-
- @Reference
- public void setSubtractService(SubtractService subtractService) {
- this.subtractService = subtractService;
- }
-
- @Reference
- public void setDivideService(DivideService divideService) {
- this.divideService = divideService;
- }
-
- @Reference
- public void setMultiplyService(MultiplyService multiplyService) {
- this.multiplyService = multiplyService;
- }
-
- public double add(double n1, double n2) {
- return addService.add(n1, n2);
- }
-
- public double subtract(double n1, double n2) {
- return subtractService.subtract(n1, n2);
- }
-
- public double multiply(double n1, double n2) {
- return multiplyService.multiply(n1, n2);
- }
-
- public double divide(double n1, double n2) {
- return divideService.divide(n1, n2);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideService.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
deleted file mode 100644
index 9599c86292..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * Interface for the Divide Service.
- *
- * @version $Rev$ $Date$
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
deleted file mode 100644
index e1f35f99b5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/DivideServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Scope;
-
-/**
- * An implementation of the Divide service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-public class DivideServiceImpl implements DivideService {
-
- public double divide(double n1, double n2) {
- return n1 / n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
deleted file mode 100644
index 7a3d06c15e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * Interface for the Multiply Service.
- *
- * @version $Rev$ $Date$
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
deleted file mode 100644
index d621407908..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/MultiplyServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Scope;
-
-/**
- * An implementation of the Multiply service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-public class MultiplyServiceImpl implements MultiplyService {
-
- public double multiply(double n1, double n2) {
- return n1 * n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
deleted file mode 100644
index 21af91f392..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-/**
- * Interface for the Subtract Service.
- *
- * @version $Rev$ $Date$
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
deleted file mode 100644
index 4fed0a8c6a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/calculator/SubtractServiceImpl.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package calculator;
-
-import org.osoa.sca.annotations.Scope;
-
-/**
- * An implementation of the subtract service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-public class SubtractServiceImpl implements SubtractService {
-
- public double subtract(double n1, double n2) {
- return n1 - n2;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
deleted file mode 100644
index e5912906f5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.xml;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Test reading Java implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private URLArtifactProcessor<SCADefinitions> policyDefinitionsProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- policyDefinitionsProcessor = documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
-
- }
-
- public void fixmeTestPolicyIntents() throws Exception {
- ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
-
- URL url = getClass().getResource("definitions.xml");
- URI uri = URI.create("definitions.xml");
- SCADefinitions scaDefns = policyDefinitionsProcessor.read(null, uri, url);
-
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- staxProcessor.resolve(scaDefns, resolver);
- staxProcessor.resolve(composite, resolver);
-
- compositeBuilder.build(composite);
-
- //intents are computed and aggregate intents from ancestor elements
- assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(), 3);
- assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents().size(), 3);
-
- //assertEquals(((OperationsConfigurator)composite.getComponents().get(0)).getConfiguredOperations().isEmpty(), true);
- //assertEquals(((OperationsConfigurator)composite.getComponents().get(5)).getConfiguredOperations().isEmpty(), false);
-
-
- //test for proper aggregation of policy intents on implementation elements
- for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getRequiredIntents() ) {
- String intentName = intent.getName().getLocalPart();
- if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_2") ||
- intentName.equals("tuscanyIntent_3")) ) {
- fail();
- }
- }
-
- for ( Intent intent : ((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents() ) {
- String intentName = intent.getName().getLocalPart();
- if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
- intentName.equals("tuscanyIntent_5")) ) {
- fail();
- }
- }
-
- //test for proper aggregation of policy intents and policysets on operations of implementation
- OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
- assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 4);
- for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
- String intentName = intent.getName().getLocalPart();
- if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
- intentName.equals("tuscanyIntent_5") || intentName.equals("tuscanyIntent_6") ) ) {
- fail();
- }
- }
-
- opConf = (OperationsConfigurator)composite.getComponents().get(6);
- assertEquals(opConf.getConfiguredOperations().get(0).getRequiredIntents().size(), 3);
- for ( Intent intent : opConf.getConfiguredOperations().get(0).getRequiredIntents()) {
- String intentName = intent.getName().getLocalPart();
- if ( !(intentName.equals("tuscanyIntent_1") || intentName.equals("tuscanyIntent_4") ||
- intentName.equals("tuscanyIntent_6.qualified2") ) ) {
- fail();
- }
- }
- }
-
- public void testPolicySets() throws Exception {
- ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
-
- URL url = getClass().getResource("definitions_with_policysets.xml");
- URI uri = URI.create("definitions_with_policysets.xml");
- SCADefinitions policyDefinitions = policyDefinitionsProcessor.read(null, uri, url);
-
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- for ( Component component : composite.getComponents() ) {
- for ( PolicySet policySet : policyDefinitions.getPolicySets() ) {
- component.getApplicablePolicySets().add(policySet);
- }
- }
-
- staxProcessor.resolve(policyDefinitions, resolver);
- staxProcessor.resolve(composite, resolver);
-
- compositeBuilder.build(composite);
-
- //test for determination of policysets for implementation
- assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getPolicySets().size(), 1);
- for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getPolicySets() ) {
- String policySetName = policySet.getName().getLocalPart();
- if ( !(policySetName.equals("tuscanyPolicySet_1")) ) {
- fail();
- }
- }
-
- assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getPolicySets().size(), 2);
- for ( PolicySet policySet : ((PolicySetAttachPoint)composite.getComponents().get(5).getImplementation()).getPolicySets() ) {
- String policySetName = policySet.getName().getLocalPart();
- if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")) ) {
- fail();
- }
- }
-
- //test for computation of policysets on operations of implementation
- OperationsConfigurator opConf = (OperationsConfigurator)composite.getComponents().get(5);
- assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 3);
- for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
- String policySetName = policySet.getName().getLocalPart();
- if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
- || policySetName.equals("tuscanyPolicySet_3")) ) {
- fail();
- }
- }
-
- opConf = (OperationsConfigurator)composite.getComponents().get(6);
- assertEquals(opConf.getConfiguredOperations().get(0).getPolicySets().size(), 4);
- for ( PolicySet policySet : opConf.getConfiguredOperations().get(0).getPolicySets() ) {
- String policySetName = policySet.getName().getLocalPart();
- if ( !(policySetName.equals("tuscanyPolicySet_1") || policySetName.equals("tuscanyPolicySet_2")
- || policySetName.equals("tuscanyPolicySet_3")
- || policySetName.equals("tuscanyPolicySet_4")) ) {
- fail();
- }
- }
- //new PrintUtil(System.out).print(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.java
deleted file mode 100644
index 27e3579c35..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/TestModelResolver.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.implementation.java.xml;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * A default implementation of an artifact resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- private WeakReference<ClassLoader> classLoader;
-
- public TestModelResolver(ClassLoader classLoader) {
- this.classLoader = new WeakReference<ClassLoader>(classLoader);
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else if (unresolved instanceof ClassReference) {
-
- // Load a class on demand
- ClassReference classReference = (ClassReference)unresolved;
- Class clazz;
- try {
- clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
- } catch (ClassNotFoundException e) {
-
- // Return the unresolved object
- return unresolved;
- }
-
- // Store a new ClassReference wrapping the loaded class
- resolved = new ClassReference(clazz);
- map.put(resolved, resolved);
-
- // Return the resolved ClassReference
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.java
deleted file mode 100644
index 2ec09dae7a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/WriteTestCase.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.implementation.java.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test writing Java implementations.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private StAXArtifactProcessor<Object> staxProcessor;
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- // outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- System.out.println(new String(bos.toByteArray()));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
deleted file mode 100644
index c6a077ffa6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/Calculator.composite
+++ /dev/null
@@ -1,66 +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://sample.calculator"
- requires="cns:tuscanyIntent_1"
- targetNamespace="http://sample.calculator"
- xmlns:cns="http://test"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.java interface="calculator.CalculatorService"/>
- </service>
-
- <component name="CalculatorServiceComponent" requires="cns:tuscanyIntent_2">
- <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_3" />
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
- <component name="AnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
- <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_5">
- <operation name="add" requires="cns:tuscanyIntent_6"/>
- </implementation.java>
- </component>
-
- <component name="YetAnotherCalculatorServiceComponent" requires="cns:tuscanyIntent_4">
- <implementation.java class="calculator.CalculatorServiceImpl" requires="cns:tuscanyIntent_6.qualified1">
- <operation name="add" requires="cns:tuscanyIntent_6.qualified2" policySets="cns:tuscanyPolicySet_4"/>
- </implementation.java>
- </component>
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
deleted file mode 100644
index cddc134c2c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions.xml
+++ /dev/null
@@ -1,100 +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:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_2"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_3"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_4"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
-<sca:intent name="tuscanyIntent_5"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_6"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_7"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_8"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <!-- qualified intents -->
- <sca:intent name="tuscanyIntent_1.qualified" />
- <sca:intent name="tuscanyIntent_2.qualified" />
- <sca:intent name="tuscanyIntent_6.qualified1" />
- <sca:intent name="tuscanyIntent_6.qualified2" />
-
- <sca:policySet name="tuscanyPolicySet_4"
- provides="tuscanyIntent_6"
- appliesTo="/sca:composite/sca:component"
- xmlns="http://test"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
- <sca:qualifier name="qualified2">
- <wsp:Policy>
- <!-- policy expression and policy subject for "qualified2" alternative" -->
- </wsp:Policy>
- </sca:qualifier>
- </sca:intentMap>
- </sca:policySet>
-</sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml b/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
deleted file mode 100644
index 9147133d5d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java-xml/src/test/resources/org/apache/tuscany/sca/implementation/java/xml/definitions_with_policysets.xml
+++ /dev/null
@@ -1,133 +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:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_2"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_3"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_4"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
-<sca:intent name="tuscanyIntent_5"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_6"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_7"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:intent name="tuscanyIntent_8"
- constrains="sca:binding sca:implementation.java">
- <sca:description>
- Sample Intent
- </sca:description>
- </sca:intent>
-
- <sca:policySet name="tuscanyPolicySet_1"
- provides="tuscanyIntent_1 tuscanyIntent_2 tuscanyIntent_3"
- appliesTo="/sca:composite/sca:component"
- xmlns="http://test"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- </sca:policySet>
-
- <sca:policySet name="tuscanyPolicySet_2"
- provides="tuscanyIntent_4 tuscanyIntent_5"
- appliesTo="/sca:composite/sca:component"
- xmlns="http://test"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- </sca:policySet>
-
- <sca:policySet name="tuscanyPolicySet_3"
- provides="tuscanyIntent_6"
- appliesTo="/sca:composite/sca:component"
- xmlns="http://test"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <sca:intentMap provides="tuscanyIntent_6" default="qualified1">
- <sca:qualifier name="qualified1">
- <wsp:Policy>
- <!-- policy expression and policy subject for "qualified1" alternative -->
- </wsp:Policy>
- </sca:qualifier>
- <sca:qualifier name="qualifed2">
- <wsp:Policy>
- <!-- policy expression and policy subject for "qualified2" alternative" -->
- </wsp:Policy>
- </sca:qualifier>
- </sca:intentMap>
- </sca:policySet>
-
- <sca:policySet name="tuscanyPolicySet_4"
- provides="tuscanyIntent_6"
- appliesTo="/sca:composite/sca:component"
- xmlns="http://test"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <sca:intentMap provides="tuscanyIntent_6" default="qualified2">
- <sca:qualifier name="qualified2">
- <wsp:Policy>
- <!-- policy expression and policy subject for "qualified2" alternative" -->
- </wsp:Policy>
- </sca:qualifier>
- </sca:intentMap>
- </sca:policySet>
-
- <!-- qualified intents -->
- <sca:intent name="tuscanyIntent_1.qualified" />
- <sca:intent name="tuscanyIntent_2.qualified" />
- <sca:intent name="tuscanyIntent_6.qualified1" />
- <sca:intent name="tuscanyIntent_6.qualified2" />
-</sca:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/LICENSE b/branches/sca-java-1.5.1/modules/implementation-java/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/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-java-1.5.1/modules/implementation-java/NOTICE b/branches/sca-java-1.5.1/modules/implementation-java/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/pom.xml b/branches/sca-java-1.5.1/modules/implementation-java/pom.xml
deleted file mode 100644
index e3a1d67b7e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/pom.xml
+++ /dev/null
@@ -1,84 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-java</artifactId>
- <name>Apache Tuscany SCA Java Implementation Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.jws</groupId>
- <artifactId>jsr181-api</artifactId>
- <version>1.0-MR1</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <repository>
- <id>java.net</id>
- <name>java.net Maven 1.x Repository</name>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
- </repositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.java*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.java
deleted file mode 100644
index c8b7c072ac..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/BaseJavaImplementation.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.implementation.java;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * Represents a Java implementation.
- *
- * @version $Rev$ $Date$
- */
-public interface BaseJavaImplementation extends Implementation, Extensible {
-
- /**
- * Returns the name of the Java implementation class.
- *
- * @return the name of the Java implementation class
- */
- String getName();
-
- /**
- * Sets the name of the Java implementation class.
- *
- * @param className the name of the Java implementation class
- */
- void setName(String className);
-
- /**
- * Returns the Java implementation class.
- *
- * @return the Java implementation class
- */
- Class<?> getJavaClass();
-
- /**
- * Sets the Java implementation class.
- *
- * @param javaClass the Java implementation class
- */
- void setJavaClass(Class<?> javaClass);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.java
deleted file mode 100644
index e44ebd7c91..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/DefaultJavaImplementationFactory.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.implementation.java;
-
-/**
- * A factory for the Java model.
- *
- * @version $Rev$ $Date$
- */
-import org.apache.tuscany.sca.implementation.java.impl.JavaImplementationFactoryImpl;
-
-public class DefaultJavaImplementationFactory extends JavaImplementationFactoryImpl implements JavaImplementationFactory {
-
- public DefaultJavaImplementationFactory() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java
deleted file mode 100644
index 2198a632c0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/IntrospectionException.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java;
-
-import java.lang.reflect.Member;
-
-/**
- * Denotes a problem processing annotations on a POJO implementation
- *
- * @version $Rev$ $Date$
- */
-public class IntrospectionException extends Exception {
- private static final long serialVersionUID = -361025119035104470L;
- private Member member;
-
- public IntrospectionException() {
- }
-
- public IntrospectionException(String message) {
- super(message);
- }
-
- public IntrospectionException(String message, Member member) {
- super(message);
- this.member = member;
- }
-
- public IntrospectionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public IntrospectionException(Throwable cause) {
- super(cause);
- }
-
- public Member getMember() {
- return member;
- }
-
- public void setMember(Member member) {
- this.member = member;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
deleted file mode 100644
index 2ad7edbd6f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.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.implementation.java;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-
-/**
- * Represents a Java implementation.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaImplementation extends BaseJavaImplementation {
-
- /**
- * Returns the constructor used to instantiate implementation instances.
- *
- * @return the constructor used to instantiate implementation instances
- */
- JavaConstructorImpl<?> getConstructor();
-
- /**
- * Sets the constructor used to instantiate implementation instances
- *
- * @param definition the constructor used to instantiate implementation instances
- */
- void setConstructor(JavaConstructorImpl<?> definition);
-
- /**
- * Returns the component initializer method.
- *
- * @return the component initializer method
- */
- Method getInitMethod();
-
- /**
- * Sets the component initializer method.
- *
- * @param initMethod the component initializer method
- */
- void setInitMethod(Method initMethod);
-
- /**
- * Returns the component destructor method.
- *
- * @return the component destructor method
- */
- Method getDestroyMethod();
-
- /**
- * Sets the component destructor method.
- *
- * @param destroyMethod the component destructor method
- */
- void setDestroyMethod(Method destroyMethod);
-
- /**
- * Returns the resources injected into this implementation.
- *
- * @return
- */
- Map<String, JavaResourceImpl> getResources();
-
- /**
- * Returns the Java member used to inject a conversation ID.
- *
- * @return
- */
- List<Member> getConversationIDMembers();
-
- /**
- * Sets the Java member used to inject a conversation ID.
- *
- * @param conversationIDMember
- */
- void addConversationIDMember(Member conversationIDMember);
-
- /**
- * Returns true if AllowsPassReference is set.
- *
- * @return true if AllowsPassByReference is set
- */
- boolean isAllowsPassByReference();
-
- /**
- * @param allowsPassByReference the allowsPassByReference to set
- */
- void setAllowsPassByReference(boolean allowsPassByReference);
-
- /**
- * @return the allowsPassByReferenceMethods
- */
- List<Method> getAllowsPassByReferenceMethods();
-
- /**
- * @param method
- * @return
- */
- boolean isAllowsPassByReference(Method method);
-
- /**
- * @return the constructors
- */
- Map<Constructor, JavaConstructorImpl> getConstructors();
-
- /**
- * @return the eagerInit
- */
- boolean isEagerInit();
-
- /**
- * @param eagerInit the eagerInit to set
- */
- void setEagerInit(boolean eagerInit);
-
- /**
- * @return the callbacks
- */
- Map<String, Collection<JavaElementImpl>> getCallbackMembers();
-
- /**
- * @return the properties
- */
- Map<String, JavaElementImpl> getPropertyMembers();
-
- /**
- * @return the references
- */
- Map<String, JavaElementImpl> getReferenceMembers();
-
- /**
- * @return the scope
- */
- JavaScopeImpl getJavaScope();
-
- /**
- * @param scope the scope to set
- */
- void setJavaScope(JavaScopeImpl scope);
-
- /**
- * @return the maxAge
- */
- long getMaxAge();
-
- /**
- * @param maxAge the maxAge to set
- */
- void setMaxAge(long maxAge);
-
- /**
- * @return the maxIdleTime
- */
- long getMaxIdleTime();
-
- /**
- * @param maxIdleTime the maxIdleTime to set
- */
- void setMaxIdleTime(long maxIdleTime);
-
- /**
- * @return the map of a policy handler class names
- */
- List<PolicyHandlerTuple> getPolicyHandlerClassNames();
-
- /**
- * @param policyHandlerClassNames Map of policyhandler class names
- */
- void setPolicyHandlerClassNames(List<PolicyHandlerTuple> policyHandlerClassNames);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java
deleted file mode 100644
index 8228c80372..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementationFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-
-
-/**
- * Factory for the Java model
- *
- * @version $Rev$ $Date$
- */
-public interface JavaImplementationFactory {
-
- /**
- * Creates a new Java implementation model.
- *
- * @return
- */
- JavaImplementation createJavaImplementation();
-
- /**
- * Creates a new Java implementation model from an implementation class.
- *
- * @param implementationClass The implementation class to introspect.
- * @return
- */
- JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException;
-
- /**
- * Creates the contents of a Java implementation model from an implementation class.
- *
- * @param implementationClass The implementation class to introspect.
- * @return
- */
- void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException;
-
- /**
- * Registers the given visitor.
- *
- * @param visitor
- */
- void addClassVisitor(JavaClassVisitor visitor);
-
- /**
- * Deregisters the given visitor.
- */
- void removeClassVisitor(JavaClassVisitor visitor);
-
- /**
- * Returns the list of visitors.
- *
- * @return
- */
- List<JavaClassVisitor> getClassVisitors();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java
deleted file mode 100644
index 97773879fa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/BaseJavaImplementationImpl.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.impl;
-
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.implementation.java.BaseJavaImplementation;
-
-/**
- * Represents a Java implementation.
- *
- * @version $Rev$ $Date$
- */
-abstract class BaseJavaImplementationImpl extends ImplementationImpl implements BaseJavaImplementation {
-
- private String className;
- private Class<?> javaClass;
-
- protected BaseJavaImplementationImpl() {
- }
-
- public String getName() {
- if (isUnresolved()) {
- return className;
- } else if (javaClass != null) {
- return javaClass.getName();
- } else {
- return null;
- }
- }
-
- public void setName(String className) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.className = className;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-
- public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
- if (this.className == null) {
- this.className = javaClass.getName();
- }
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof BaseJavaImplementation) {
- if (getName() != null) {
- return getName().equals(((BaseJavaImplementation)obj).getName());
- } else {
- return ((BaseJavaImplementation)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java
deleted file mode 100644
index 0bcec3c78f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaClassIntrospectorImpl.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-
-/**
- * An extensible Java class introspector implementation.
- *
- * @version $Rev$ $Date$
- */
-public class JavaClassIntrospectorImpl {
-
- private List<JavaClassVisitor> visitors;
-
- public JavaClassIntrospectorImpl(List<JavaClassVisitor> visitors) {
- this.visitors = visitors;
- }
-
- /**
- * JSR-250 PFD recommends the following guidelines for how annotations
- * interact with inheritance in order to keep the resulting complexity in
- * control:
- * <ol>
- * <li>Class-level annotations only affect the class they annotate and
- * their members, that is, its methods and fields. They never affect a
- * member declared by a superclass, even if it is not hidden or overridden
- * by the class in question.
- * <li>In addition to affecting the annotated class, class-level
- * annotations may act as a shorthand for member-level annotations. If a
- * member carries a specific member-level annotation, any annotations of the
- * same type implied by a class-level annotation are ignored. In other
- * words, explicit member-level annotations have priority over member-level
- * annotations implied by a class-level annotation.
- * <li>The interfaces implemented by a class never contribute annotations
- * to the class itself or any of its members.
- * <li>Members inherited from a superclass and which are not hidden or
- * overridden maintain the annotations they had in the class that declared
- * them, including member-level annotations implied by class-level ones.
- * <li>Member-level annotations on a hidden or overridden member are always
- * ignored.
- * </ol>
- */
- public void introspectClass(JavaImplementation type, Class<?> clazz)
- throws IntrospectionException {
- for (JavaClassVisitor extension : visitors) {
- extension.visitClass(clazz, type);
- }
-
- for (Constructor<?> constructor : clazz.getConstructors()) {
- for (JavaClassVisitor extension : visitors) {
- extension.visitConstructor(constructor, type);
- // Assuming the visitClass or visitConstructor will populate the
- // type.getConstructors
- JavaConstructorImpl<?> definition = type.getConstructors().get(constructor);
- if (definition != null) {
- for (JavaParameterImpl p : definition.getParameters()) {
- extension.visitConstructorParameter(p, type);
- }
- }
- }
- }
-
- Set<Field> fields = JavaIntrospectionHelper.getAllPublicAndProtectedFields(clazz, true);
- for (Field field : fields) {
- for (JavaClassVisitor extension : visitors) {
- extension.visitField(field, type);
- }
- }
-
- // Check if any private fields have illegal annotations that should be raised as errors
- Set<Field> privateFields = JavaIntrospectionHelper.getPrivateFields(clazz);
- for (Field field : privateFields) {
- for (JavaClassVisitor processor : visitors) {
- processor.visitField(field, type);
- }
- }
-
- Set<Method> methods = JavaIntrospectionHelper.getAllUniquePublicProtectedMethods(clazz, true);
- for (Method method : methods) {
- for (JavaClassVisitor processor : visitors) {
- processor.visitMethod(method, type);
- }
- }
-
- // Check if any private methods have illegal annotations that should be raised as errors
- Set<Method> privateMethods = JavaIntrospectionHelper.getPrivateMethods(clazz);
- for (Method method : privateMethods) {
- for (JavaClassVisitor processor : visitors) {
- processor.visitMethod(method, type);
- }
- }
-
- Class superClass = clazz.getSuperclass();
- if (superClass != null) {
- visitSuperClass(superClass, type);
- }
-
- for (JavaClassVisitor extension : visitors) {
- extension.visitEnd(clazz, type);
- }
- }
-
- private void visitSuperClass(Class<?> clazz, JavaImplementation type) throws IntrospectionException {
- if (!Object.class.equals(clazz)) {
- for (JavaClassVisitor extension : visitors) {
- extension.visitSuperClass(clazz, type);
- }
- clazz = clazz.getSuperclass();
- if (clazz != null) {
- visitSuperClass(clazz, type);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java
deleted file mode 100644
index c0b04b4b4e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaConstructorImpl.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.impl;
-
-import java.lang.reflect.Constructor;
-
-/**
- * Hold injection information for the constructor used to instantiate a
- * component implementation instance
- *
- * @version $Rev$ $Date$
- */
-public class JavaConstructorImpl<T> {
-
- private Constructor<T> constructor;
- private JavaParameterImpl[] parameters;
-
- public JavaConstructorImpl(Constructor<T> constructor) {
- this.constructor = constructor;
- int size = constructor.getParameterTypes().length;
- parameters = new JavaParameterImpl[size];
- for (int i = 0; i < size; i++) {
- parameters[i] = new JavaParameterImpl(constructor, i);
- }
- }
-
- public Constructor<T> getConstructor() {
- return constructor;
- }
-
- /**
- * @return the parameters
- */
- public JavaParameterImpl[] getParameters() {
- return parameters;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
deleted file mode 100644
index 2365298f71..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaElementImpl.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.java.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-
-/**
- * This class represents a java element such as a Package, Class, Constructor,
- * Field, Method or Parameter.
- *
- * @version $Rev$ $Date$
- */
-public class JavaElementImpl {
- private AnnotatedElement anchor;
- private ElementType elementType;
- private Class<?> type;
- private Type genericType;
- private int index = -1;
- private String name;
- private Class<? extends Annotation> classifer;
-
- public JavaElementImpl(Package pkg) {
- this.anchor = pkg;
- this.elementType = ElementType.PACKAGE;
- this.name = pkg.getName();
- }
-
- public JavaElementImpl(Class<?> cls) {
- this.anchor = cls;
- this.elementType = ElementType.TYPE;
- this.type = cls;
- this.genericType = cls;
- this.name = cls.getName();
- }
-
- public JavaElementImpl(Field field) {
- this.anchor = field;
- this.elementType = ElementType.FIELD;
- this.type = field.getType();
- this.genericType = field.getGenericType();
- this.name = field.getName();
- }
-
- public JavaElementImpl(Constructor<?> constructor, int index) {
- this.anchor = constructor;
- this.elementType = ElementType.PARAMETER;
- this.type = constructor.getParameterTypes()[index];
- this.genericType = constructor.getGenericParameterTypes()[index];
- this.index = index;
- this.name = "";
- }
-
- public JavaElementImpl(Method method, int index) {
- this.anchor = method;
- this.elementType = ElementType.PARAMETER;
- this.type = method.getParameterTypes()[index];
- this.genericType = method.getGenericParameterTypes()[index];
- this.index = index;
- this.name = "";
- }
-
- /**
- * For testing purpose
- *
- * @param name
- * @param type
- * @param classifer TODO
- * @param elementType
- */
- public JavaElementImpl(String name, Class<?> type, Class<? extends Annotation> classifer) {
- super();
- this.type = type;
- this.name = name;
- this.classifer = classifer;
- }
-
- /**
- * @return the anchor
- */
- public AnnotatedElement getAnchor() {
- return anchor;
- }
-
- /**
- * @return the elementType
- */
- public ElementType getElementType() {
- return elementType;
- }
-
- /**
- * @return the genericType
- */
- public Type getGenericType() {
- return genericType;
- }
-
- /**
- * @return the index
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * @return the type
- */
- public Class<?> getType() {
- return type;
- }
-
- public Annotation[] getAnnotations() {
- if (elementType == ElementType.PARAMETER) {
- if (anchor instanceof Method) {
- // We only care about the method-level annotations
- return ((Method)anchor).getAnnotations();
- }
- if (anchor instanceof Constructor) {
- return ((Constructor)anchor).getParameterAnnotations()[index];
- }
- }
- return anchor.getAnnotations();
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
- for (Annotation a : getAnnotations()) {
- if (a.annotationType() == annotationType) {
- return annotationType.cast(a);
- }
- }
- return null;
- }
-
- @Override
- public String toString() {
- return anchor.toString() + (elementType == ElementType.PARAMETER ? "[" + index + "]" : "");
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((anchor == null) ? 0 : anchor.hashCode());
- result = PRIME * result + index;
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final JavaElementImpl other = (JavaElementImpl)obj;
- if (anchor == null) {
- if (other.anchor != null) {
- return false;
- }
- } else if (!anchor.equals(other.anchor)) {
- return false;
- }
- if (index != other.index) {
- return false;
- }
- return true;
- }
-
- /**
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the name to set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the classifier
- */
- public Class<? extends Annotation> getClassifer() {
- return classifer;
- }
-
- /**
- * @param classifer the classifier to set
- */
- public void setClassifer(Class<? extends Annotation> classifer) {
- this.classifer = classifer;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java
deleted file mode 100644
index 46594e0f50..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.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.implementation.java.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationIDProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ScopeProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A module activator for the Java implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class JavaImplementationActivator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry registry) {
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- JavaInterfaceFactory javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
-
- BaseJavaClassVisitor[] extensions =
- new BaseJavaClassVisitor[] {new ConstructorProcessor(assemblyFactory),
- new AllowsPassByReferenceProcessor(assemblyFactory),
- new ComponentNameProcessor(assemblyFactory),
- new ContextProcessor(assemblyFactory),
- new ConversationIDProcessor(assemblyFactory),
- new ConversationProcessor(assemblyFactory),
- new DestroyProcessor(assemblyFactory), new EagerInitProcessor(assemblyFactory),
- new InitProcessor(assemblyFactory), new PropertyProcessor(assemblyFactory),
- new ReferenceProcessor(assemblyFactory, javaFactory),
- new ResourceProcessor(assemblyFactory), new ScopeProcessor(assemblyFactory),
- new ServiceProcessor(assemblyFactory, javaFactory),
- new HeuristicPojoProcessor(assemblyFactory, javaFactory),
- new PolicyProcessor(assemblyFactory, policyFactory)};
-
- JavaImplementationFactory javaImplementationFactory = modelFactories.getFactory(JavaImplementationFactory.class);
- for (JavaClassVisitor extension : extensions) {
- javaImplementationFactory.addClassVisitor(extension);
- }
-
- }
-
- public void stop(ExtensionPointRegistry registry) {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.java
deleted file mode 100644
index 7d8c673e3f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationFactoryImpl.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.implementation.java.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-
-/**
- * A factory for the Java model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class JavaImplementationFactoryImpl implements JavaImplementationFactory {
-
- private List<JavaClassVisitor> visitors = new ArrayList<JavaClassVisitor>();
- private JavaClassIntrospectorImpl introspector;
-
- public JavaImplementationFactoryImpl() {
- introspector = new JavaClassIntrospectorImpl(visitors);
- }
-
- public JavaImplementation createJavaImplementation() {
- JavaImplementation javaImplementation = new JavaImplementationImpl();
- return javaImplementation;
- }
-
- public JavaImplementation createJavaImplementation(Class<?> implementationClass) throws IntrospectionException {
- JavaImplementation javaImplementation = createJavaImplementation();
- introspector.introspectClass(javaImplementation, implementationClass);
- return javaImplementation;
- }
-
- public void createJavaImplementation(JavaImplementation javaImplementation, Class<?> implementationClass) throws IntrospectionException {
- introspector.introspectClass(javaImplementation, implementationClass);
- }
-
- public void addClassVisitor(JavaClassVisitor visitor) {
- for (JavaClassVisitor tmpVisitor : visitors){
- if (tmpVisitor.getClass() == visitor.getClass()){
- // trying to add a duplicate visitor so
- // ignore it
- return;
- }
- }
- visitors.add(visitor);
- }
-
- public void removeClassVisitor(JavaClassVisitor visitor) {
- visitors.remove(visitor);
- }
-
- public List<JavaClassVisitor> getClassVisitors() {
- return visitors;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
deleted file mode 100644
index 375896cf26..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.policy.util.PolicyHandlerTuple;
-
-/**
- * A component type specialization for POJO implementations
- *
- * @version $Rev$ $Date$
- */
-public class JavaImplementationImpl extends BaseJavaImplementationImpl implements JavaImplementation {
- private JavaConstructorImpl<?> constructorDefinition;
- private Map<Constructor, JavaConstructorImpl> constructors = new HashMap<Constructor, JavaConstructorImpl>();
- private Method initMethod;
- private Method destroyMethod;
- private final Map<String, JavaResourceImpl> resources = new HashMap<String, JavaResourceImpl>();
- private final Map<String, JavaElementImpl> propertyMembers = new HashMap<String, JavaElementImpl>();
- private final Map<String, JavaElementImpl> referenceMembers = new HashMap<String, JavaElementImpl>();
- private final Map<String, Collection<JavaElementImpl>> callbackMembers = new HashMap<String, Collection<JavaElementImpl>>();
- private List<Member> conversationIDMember = new ArrayList<Member>();
- private boolean eagerInit;
- private boolean allowsPassByReference;
- private List<Method> allowsPassByReferenceMethods = new ArrayList<Method>();
- private long maxAge = -1;
- private long maxIdleTime = -1;
- private JavaScopeImpl scope = JavaScopeImpl.STATELESS;
- private List<PolicyHandlerTuple> policyHandlerClassNames = null;
-
- protected JavaImplementationImpl() {
- super();
- }
-
- public JavaConstructorImpl<?> getConstructor() {
- return constructorDefinition;
- }
-
- public void setConstructor(JavaConstructorImpl<?> definition) {
- this.constructorDefinition = definition;
- }
-
- public Method getInitMethod() {
- return initMethod;
- }
-
- public void setInitMethod(Method initMethod) {
- this.initMethod = initMethod;
- }
-
- public Method getDestroyMethod() {
- return destroyMethod;
- }
-
- public void setDestroyMethod(Method destroyMethod) {
- this.destroyMethod = destroyMethod;
- }
-
- public Map<String, JavaResourceImpl> getResources() {
- return resources;
- }
-
- public List<Member> getConversationIDMembers() {
- return this.conversationIDMember;
- }
-
- public void addConversationIDMember(Member conversationIDMember) {
- this.conversationIDMember.add(conversationIDMember);
- }
-
- public boolean isAllowsPassByReference() {
- return allowsPassByReference;
- }
-
- public void setAllowsPassByReference(boolean allowsPassByReference) {
- this.allowsPassByReference = allowsPassByReference;
- }
-
- public List<Method> getAllowsPassByReferenceMethods() {
- return allowsPassByReferenceMethods;
- }
-
- public boolean isAllowsPassByReference(Method method) {
- return allowsPassByReference || allowsPassByReferenceMethods.contains(method);
- }
-
- public Map<Constructor, JavaConstructorImpl> getConstructors() {
- return constructors;
- }
-
- public boolean isEagerInit() {
- return eagerInit;
- }
-
- public void setEagerInit(boolean eagerInit) {
- this.eagerInit = eagerInit;
- }
-
- public Map<String, Collection<JavaElementImpl>> getCallbackMembers() {
- return callbackMembers;
- }
-
- public Map<String, JavaElementImpl> getPropertyMembers() {
- return propertyMembers;
- }
-
- public Map<String, JavaElementImpl> getReferenceMembers() {
- return referenceMembers;
- }
-
- public JavaScopeImpl getJavaScope() {
- return scope;
- }
-
- public void setJavaScope(JavaScopeImpl scope) {
- this.scope = scope;
- }
-
- public long getMaxAge() {
- return maxAge;
- }
-
- public void setMaxAge(long maxAge) {
- this.maxAge = maxAge;
- }
-
- public long getMaxIdleTime() {
- return maxIdleTime;
- }
-
- public void setMaxIdleTime(long maxIdleTime) {
- this.maxIdleTime = maxIdleTime;
- }
-
- public List<PolicyHandlerTuple> getPolicyHandlerClassNames() {
- return policyHandlerClassNames;
- }
-
- public void setPolicyHandlerClassNames(List<PolicyHandlerTuple> policyHandlerClassNames) {
- this.policyHandlerClassNames = policyHandlerClassNames;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.java
deleted file mode 100644
index c4c528f4f2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaParameterImpl.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.implementation.java.impl;
-
-import java.lang.reflect.Constructor;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaParameterImpl extends JavaElementImpl {
- /**
- * @param constructor
- * @param index
- */
- public JavaParameterImpl(Constructor<?> constructor, int index) {
- super(constructor, index);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java
deleted file mode 100644
index 1aca15ebb8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaResourceImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.impl;
-
-
-/**
- * A resource dependency declared by a Java component implementation
- *
- * @version $Rev$ $Date$
- */
-public class JavaResourceImpl {
- private JavaElementImpl element;
- private String mappedName;
- private boolean optional;
-
- public JavaResourceImpl(JavaElementImpl element) {
- this.element = element;
- }
-
- /**
- * The name of the resource
- *
- * @return the name of the resource
- */
- public String getName() {
- return element.getName();
- }
-
- /**
- * Returns the URI of the resource
- *
- * @return the URI of the resource
- */
- public String getMappedName() {
- return mappedName;
- }
-
- /**
- * Sets the resource URI
- */
- public void setMappedName(String mappedName) {
- this.mappedName = mappedName;
- }
-
- /**
- * If true, the resource is optional
- *
- * @return true if the resource is optional
- */
- public boolean isOptional() {
- return optional;
- }
-
- /**
- * Sets whether the resource is optional
- */
- public void setOptional(boolean optional) {
- this.optional = optional;
- }
-
- /**
- * @return the element
- */
- public JavaElementImpl getElement() {
- return element;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.java
deleted file mode 100644
index 85c2f73f75..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaScopeImpl.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.implementation.java.impl;
-
-/**
- * The default implementation scopes supported by assemblies.
- *
- * @version $Rev$ $Date$
- */
-public class JavaScopeImpl {
- public static final JavaScopeImpl STATELESS = new JavaScopeImpl("STATELESS");
- public static final JavaScopeImpl REQUEST = new JavaScopeImpl("REQUEST");
- public static final JavaScopeImpl SESSION = new JavaScopeImpl("SESSION");
- public static final JavaScopeImpl CONVERSATION = new JavaScopeImpl("CONVERSATION");
- public static final JavaScopeImpl COMPOSITE = new JavaScopeImpl("COMPOSITE");
- public static final JavaScopeImpl SYSTEM = new JavaScopeImpl("SYSTEM");
- public static final JavaScopeImpl UNDEFINED = new JavaScopeImpl("UNDEFINED");
-
- private String scope;
-
- public JavaScopeImpl(String scope) {
- this.scope = scope.toUpperCase().intern();
- }
-
- public String getScope() {
- return scope;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- final JavaScopeImpl scope1 = (JavaScopeImpl) o;
- return !(scope != null ? scope != scope1.scope.intern() : scope1.scope != null);
- }
-
- @Override
- public int hashCode() {
- return scope != null ? scope.hashCode() : 0;
- }
-
- @Override
- public String toString() {
- return scope;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java
deleted file mode 100644
index 4fa40dee4b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/JavaClassVisitor.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-
-/**
- * Implementations process class-level metadata, typically parsing annotations
- * and updating the corresponding <code>ComponentType</code>. A processor
- * may, for example, create a Property which is responsible for injecting a
- * complex type on a component implementation instance when it is instantiated.
- * <p/> Processors will receive callbacks as the implementation class is walked
- * while evaluating an assembly. It is the responsibility of the parser to
- * determine whether to perform an action during the callback.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaClassVisitor {
-
- /**
- * A callback received when the component implementation class is first
- * loaded
- *
- * @param clazz the component implementation class
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
-
- /**
- * A callback received as the component implementation class hierarchy is
- * evaluated
- *
- * @param clazz the superclass in the component implmentation's class
- * hierarchy
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
-
- /**
- * A callback received as the component implementation's public and
- * protected methods are evaluated
- *
- * @param method the current public or protected method being evaluated
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- void visitMethod(Method method, JavaImplementation type) throws IntrospectionException;
-
- /**
- * A callback received as the component implementation's constructor used
- * for instantiation by the runtime is evaluated. If an implementation
- * contains more than one constructor, the constructor passed to the
- * callback will be chosen according to the algorithm described in the SCA
- * Java Client and Implementation Model Specification.
- *
- * @param constructor the constructor used for instantiating component
- * implementation instances
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException;
-
- /**
- * @param parameter
- * @param type
- * @throws IntrospectionException
- */
- void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException;
-
- /**
- * A callback received as the component implementation's public and
- * protected fields are evaluated
- *
- * @param field the current public or protected field being evaluated
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- void visitField(Field field, JavaImplementation type) throws IntrospectionException;
-
- /**
- * The final callback received when all other callbacks during evaluation of
- * the component implementation have been issued
- *
- * @param clazz the component implementation class
- * @param type the incomplete component type associated with the
- * implementation class
- * @throws IntrospectionException if an error is encountered while processing
- * metadata
- */
- <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
deleted file mode 100644
index 9596fe0808..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessor.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-
-/**
- * Base class for ImplementationProcessors that handle annotations that add
- * Properties.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractPropertyProcessor<A extends Annotation> extends BaseJavaClassVisitor {
- private final Class<A> annotationClass;
-
- protected AbstractPropertyProcessor(AssemblyFactory assemblyFactory, Class<A> annotationClass) {
- super(assemblyFactory);
- this.annotationClass = annotationClass;
- }
-
- private boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
- if(prop==null) {
- return false;
- }
- List<Property> props = type.getProperties();
- for(int i=0;i<props.size();i++) {
- if(props.get(i).getName().equals(prop.getName())) {
- props.remove(i);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- A annotation = method.getAnnotation(annotationClass);
- if (annotation == null) {
- return;
- }
-
- if (!JavaIntrospectionHelper.isSetter(method)) {
- throw new IllegalPropertyException("Annotated method is not a setter: " + method, method);
- }
-
- String name = getName(annotation);
- if (name == null || "".equals(name)) {
- name = method.getName();
- if (name.startsWith("set")) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- }
- }
-
- Map<String, JavaElementImpl> properties = type.getPropertyMembers();
- JavaElementImpl prop = properties.get(name);
- // Setter override field
- if (prop != null && prop.getElementType() != ElementType.FIELD) {
- throw new DuplicatePropertyException(name);
- }
-
- removeProperty(prop, type);
-
- JavaElementImpl element = new JavaElementImpl(method, 0);
- Property property = createProperty(name, element);
-
- // add databinding available as annotations, as extensions
-
- initProperty(property, annotation);
- type.getProperties().add(property);
- properties.put(name, element);
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
-
- A annotation = field.getAnnotation(annotationClass);
- if (annotation == null) {
- return;
- }
-
- String name = getName(annotation);
- if (name == null) {
- name = "";
- }
- if ("".equals(name) || name.equals(field.getType().getName())) {
- name = field.getName();
- }
-
- Map<String, JavaElementImpl> properties = type.getPropertyMembers();
- JavaElementImpl prop = properties.get(name);
- // Setter override field
- if (prop != null && prop.getElementType() == ElementType.FIELD) {
- throw new DuplicatePropertyException(name);
- }
-
- if (prop == null) {
- JavaElementImpl element = new JavaElementImpl(field);
- Property property = createProperty(name, element);
- initProperty(property, annotation);
- type.getProperties().add(property);
- properties.put(name, element);
- }
- }
-
- @Override
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
- throws IntrospectionException {
-
- Map<String, JavaElementImpl> properties = type.getPropertyMembers();
- A annotation = parameter.getAnnotation(annotationClass);
- if (annotation != null) {
- String name = getName(annotation);
- if (name == null) {
- name = parameter.getType().getName();
- }
- if (!"".equals(name) && !"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
- throw new InvalidConstructorException("Mismatched property name: " + parameter);
- }
- if ("".equals(name) && "".equals(parameter.getName())) {
- throw new InvalidPropertyException("Missing property name: " + parameter);
- }
- if ("".equals(name)) {
- name = parameter.getName();
- }
-
- JavaElementImpl prop = properties.get(name);
- // Setter override field
- if (prop != null && prop.getElementType() != ElementType.FIELD) {
- throw new DuplicatePropertyException(name);
- }
- removeProperty(prop, type);
-
- parameter.setName(name);
- parameter.setClassifer(annotationClass);
- Property property = createProperty(name, parameter);
- initProperty(property, annotation);
- type.getProperties().add(property);
- properties.put(name, parameter);
- }
- }
-
- protected abstract String getName(A annotation);
-
- protected abstract void initProperty(Property property, A annotation) throws IntrospectionException;
-
- @SuppressWarnings("unchecked")
- protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException {
-
- Property property = assemblyFactory.createProperty();
- property.setName(name);
- Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- property.setXSDType(JavaXMLMapper.getXMLType(baseType));
-
- Class<?> javaType = element.getType();
- if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
- property.setMany(true);
- }
- return property;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.java
deleted file mode 100644
index 4a3ce0c343..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.osoa.sca.annotations.AllowsPassByReference;
-
-/**
- * Processes {@link AllowsPassByReference} on an implementation
- *
- * @version $Rev$ $Date$
- */
-public class AllowsPassByReferenceProcessor extends BaseJavaClassVisitor {
-
- public AllowsPassByReferenceProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- type.setAllowsPassByReference(clazz.isAnnotationPresent(AllowsPassByReference.class));
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- boolean pbr = method.isAnnotationPresent(AllowsPassByReference.class);
- if (pbr) {
- type.getAllowsPassByReferenceMethods().add(method);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.java
deleted file mode 100644
index c6e6b6e4d6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AmbiguousConstructorException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when constructor parameters cannot be unambiguously resolved to a property or reference
- *
- * @version $Rev$ $Date$
- */
-public class AmbiguousConstructorException extends IntrospectionException {
- private static final long serialVersionUID = 3662860753837091880L;
-
- public AmbiguousConstructorException(String message) {
- super(message);
- }
-
- public AmbiguousConstructorException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java
deleted file mode 100644
index bc6551d45d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/BaseJavaClassVisitor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-
-/**
- * A convenience class for annotation processors which alleviates the need to
- * implement unused callbacks
- *
- * @version $Rev$ $Date$
- */
-public abstract class BaseJavaClassVisitor implements JavaClassVisitor {
- protected AssemblyFactory assemblyFactory;
-
- protected BaseJavaClassVisitor(AssemblyFactory factory) {
- this.assemblyFactory = factory;
- }
-
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- }
-
- public <T> void visitSuperClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- }
-
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- }
-
- public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type) throws IntrospectionException {
- }
-
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- }
-
- public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- }
-
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type) throws IntrospectionException {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.java
deleted file mode 100644
index 556f0b77e9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ComponentNameProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.osoa.sca.annotations.ComponentName;
-
-/**
- * Processes {@link @ComponentName} annotations on a component implementation and adds
- * a {@link JavaMappedProperty} to the component type which will be used to
- * inject the appropriate component name.
- *
- * @version $Rev$ $Date$
- */
-public class ComponentNameProcessor extends BaseJavaClassVisitor {
-
- public ComponentNameProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- if (method.getAnnotation(ComponentName.class) == null) {
- return;
- }
- if (method.getParameterTypes().length != 1) {
- throw new IllegalContextException("ComponentName setter must have one parameter", method);
- }
- Class<?> paramType = method.getParameterTypes()[0];
- String name = JavaIntrospectionHelper.toPropertyName(method.getName());
- if (String.class.equals(paramType)) {
- JavaElementImpl element = new JavaElementImpl(method, 0);
- element.setName(name);
- element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- } else {
- throw new IllegalContextException(paramType.getName());
- }
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- if (field.getAnnotation(ComponentName.class) == null) {
- return;
- }
- Class<?> paramType = field.getType();
- if (String.class.equals(paramType)) {
- JavaElementImpl element = new JavaElementImpl(field);
- element.setClassifer(Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- } else {
- throw new IllegalContextException(paramType.getName());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.java
deleted file mode 100644
index 17e28479d3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-
-/**
- * Handles processing of a constructor decorated with
- * {@link org.osoa.sca.annotations.Constructor}
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("unchecked")
-public class ConstructorProcessor extends BaseJavaClassVisitor {
-
- public ConstructorProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- Constructor[] ctors = clazz.getConstructors();
- boolean found = false;
- for (Constructor constructor : ctors) {
- JavaConstructorImpl<?> definition = new JavaConstructorImpl(constructor);
- type.getConstructors().put(constructor, definition);
- if (constructor.getAnnotation(org.osoa.sca.annotations.Constructor.class) != null) {
- if (found) {
- throw new DuplicateConstructorException("Multiple constructors marked with @Constructor", constructor);
- }
- found = true;
- type.setConstructor(definition);
- }
- }
- }
-
- @Override
- public <T> void visitConstructor(Constructor<T> constructor, JavaImplementation type)
- throws IntrospectionException {
- org.osoa.sca.annotations.Constructor annotation = constructor
- .getAnnotation(org.osoa.sca.annotations.Constructor.class);
- if (annotation == null) {
- return;
- }
- JavaConstructorImpl<?> definition = type.getConstructor();
- if (definition == null) {
- definition = new JavaConstructorImpl(constructor);
- type.setConstructor(definition);
- }
- JavaParameterImpl[] parameters = definition.getParameters();
- String[] value = annotation.value();
- boolean isDefault = value.length == 0 || (value.length == 1 && "".equals(value[0]));
- if (!isDefault && value.length != parameters.length) {
- throw new InvalidConstructorException("Invalid Number of names in @Constructor");
- }
- for (int i = 0; i < parameters.length; i++) {
- parameters[i].setName(i < value.length ? value[i] : "");
- }
- type.setConstructor(definition);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.java
deleted file mode 100644
index 177ceaa57c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.annotations.Context;
-
-/**
- * Processes {@link @Context} annotations on a component implementation and adds
- * a {@link JavaMappedProperty} to the component type which will be used to
- * inject the appropriate context
- *
- * @version $Rev$ $Date$
- */
-public class ContextProcessor extends BaseJavaClassVisitor {
-
- public ContextProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- if (method.getAnnotation(Context.class) == null) {
- return;
- }
- if (method.getParameterTypes().length != 1) {
- throw new IllegalContextException("Context setter must have one parameter", method);
- }
- Class<?> paramType = method.getParameterTypes()[0];
- String name = JavaIntrospectionHelper.toPropertyName(method.getName());
- if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
- JavaElementImpl element = new JavaElementImpl(method, 0);
- element.setName(name);
- element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- } else {
- throw new UnknownContextTypeException(paramType.getName());
- }
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- if (field.getAnnotation(Context.class) == null) {
- return;
- }
- Class<?> paramType = field.getType();
- if (ComponentContext.class.equals(paramType) || RequestContext.class.equals(paramType)) {
- JavaElementImpl element = new JavaElementImpl(field);
- element.setClassifer(Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- } else {
- throw new UnknownContextTypeException(paramType.getName());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
deleted file mode 100644
index 985f8baa82..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessor.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.osoa.sca.annotations.ConversationID;
-
-/**
- * Processes {@link @ConversationID} annotations on a component implementation and adds
- * a {@link JavaMappedProperty} to the component type which will be used to
- * inject the appropriate conversationId
- *
- * @version $Rev$ $Date$
- */
-public class ConversationIDProcessor extends BaseJavaClassVisitor {
-
- public ConversationIDProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- if (method.getAnnotation(ConversationID.class) == null) {
- return;
- }
- if (method.getParameterTypes().length != 1) {
- throw new IllegalContextException("ConversationID setter must have one parameter", method);
- }
- String name = JavaIntrospectionHelper.toPropertyName(method.getName());
- JavaElementImpl element = new JavaElementImpl(method, 0);
- element.setName(name);
- element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- if (field.getAnnotation(ConversationID.class) == null) {
- return;
- }
- JavaElementImpl element = new JavaElementImpl(field);
- element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- JavaResourceImpl resource = new JavaResourceImpl(element);
- type.getResources().put(resource.getName(), resource);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.java
deleted file mode 100644
index efd04262dd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.osoa.sca.annotations.ConversationAttributes;
-import org.osoa.sca.annotations.ConversationID;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationProcessor extends BaseJavaClassVisitor {
- private static final String SECONDS = " SECONDS";
- private static final String MINUTES = " MINUTES";
- private static final String HOURS = " HOURS";
- private static final String DAYS = " DAYS";
- private static final String YEARS = " YEARS";
-
- public ConversationProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
-
- ConversationAttributes conversation = clazz.getAnnotation(ConversationAttributes.class);
- if (conversation == null) {
- return;
- }
- Scope scope = clazz.getAnnotation(Scope.class);
- if (scope == null) {
- // implicitly assume conversation
- type.setJavaScope(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION);
- } else if (conversation != null) {
- long maxAge;
- long maxIdleTime;
- String maxAgeVal = conversation.maxAge();
- String maxIdleTimeVal = conversation.maxIdleTime();
- try {
- if (maxAgeVal.length() > 0) {
- maxAge = convertTimeMillis(maxAgeVal);
- type.setMaxAge(maxAge);
- }
- } catch (NumberFormatException e) {
- throw new InvalidConversationalImplementation("Invalid maximum age", e);
- }
- try {
- if (maxIdleTimeVal.length() > 0) {
- maxIdleTime = convertTimeMillis(maxIdleTimeVal);
- type.setMaxIdleTime(maxIdleTime);
- }
- } catch (NumberFormatException e) {
- throw new InvalidConversationalImplementation("Invalid maximum idle time", e);
- }
- }
-
- }
-
- @Override
- public void visitMethod(Method method,
- JavaImplementation type) throws IntrospectionException {
- ConversationID conversationID = method.getAnnotation(ConversationID.class);
- if (conversationID == null) {
- return;
- }
- type.addConversationIDMember(method);
- }
-
- @Override
- public void visitField(Field field,
- JavaImplementation type) throws IntrospectionException {
- ConversationID conversationID = field.getAnnotation(ConversationID.class);
- if (conversationID == null) {
- return;
- }
- type.addConversationIDMember(field);
- }
-
- protected long convertTimeMillis(String expr) throws NumberFormatException {
- expr = expr.trim().toUpperCase();
- int i = expr.lastIndexOf(SECONDS);
- if (i >= 0) {
- String units = expr.substring(0, i);
- return Long.parseLong(units) * 1000;
- }
- i = expr.lastIndexOf(MINUTES);
- if (i >= 0) {
- String units = expr.substring(0, i);
- return Long.parseLong(units) * 60000;
- }
-
- i = expr.lastIndexOf(HOURS);
- if (i >= 0) {
- String units = expr.substring(0, i);
- return Long.parseLong(units) * 3600000;
- }
- i = expr.lastIndexOf(DAYS);
- if (i >= 0) {
- String units = expr.substring(0, i);
- return Long.parseLong(units) * 86400000;
- }
- i = expr.lastIndexOf(YEARS);
- if (i >= 0) {
- String units = expr.substring(0, i);
- return Long.parseLong(units) * 31556926000L;
- }
- return Long.parseLong(expr) * 1000; // assume seconds if no suffix
- // specified
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.java
deleted file mode 100644
index 50e4d46e97..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * Processes the {@link @Destroy} annotation on a component implementation and
- * updates the component type with the decorated destructor method
- *
- * @version $Rev$ $Date$
- */
-public class DestroyProcessor extends BaseJavaClassVisitor {
-
- public DestroyProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- Destroy annotation = method.getAnnotation(Destroy.class);
- if (annotation == null) {
- return;
- }
- if (method.getParameterTypes().length != 0) {
- throw new IllegalDestructorException("Destructor must not have argments", method);
- }
- if(!method.getReturnType().equals(void.class)) {
- throw new IllegalDestructorException("Destructor must return void.", method);
- }
- if (type.getDestroyMethod() != null) {
- throw new DuplicateDestructorException("More than one destructor found on implementation");
- }
- if (!Modifier.isPublic(method.getModifiers())) {
- throw new IllegalDestructorException("Destructor must be a public method. Invalid annotation @Destroy found on "+method);
- }
- type.setDestroyMethod(method);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.java
deleted file mode 100644
index 88a245cbf3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateConstructorException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when more than one component implementation constructor is annotated with {@link
- * org.osoa.sca.annotations.Constructor}
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateConstructorException extends IntrospectionException {
- private static final long serialVersionUID = -5926763756570552986L;
-
- public DuplicateConstructorException(String message) {
- super(message);
- }
-
- public DuplicateConstructorException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.java
deleted file mode 100644
index 9b834e7e87..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateDestructorException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when an implementation is annotated multiple times with {@link org.osoa.sca.annotations.Destroy}
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateDestructorException extends IntrospectionException {
- private static final long serialVersionUID = -7474912510114895203L;
-
- public DuplicateDestructorException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.java
deleted file mode 100644
index 4325faef26..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateInitException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when an implementation is annotated multiple times with {@link @org.osoa.sca.annotations.Init}
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateInitException extends IntrospectionException {
- private static final long serialVersionUID = -6282935288115512057L;
-
- public DuplicateInitException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java
deleted file mode 100644
index b9e1923e73..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicatePropertyException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when an implementation has more than one property injection site with the same name
- *
- * @version $Rev$ $Date$
- */
-public class DuplicatePropertyException extends IntrospectionException {
- private static final long serialVersionUID = 5536415875694904037L;
-
- public DuplicatePropertyException(String message) {
- super(message);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.java
deleted file mode 100644
index 300ad6817e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateReferenceException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when an implementation has more than one reference injection site with the same name
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateReferenceException extends IntrospectionException {
- private static final long serialVersionUID = 907910648213477158L;
-
- public DuplicateReferenceException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.java
deleted file mode 100644
index 2d177b3f76..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateResourceException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when an implementation has more than one resource injection site with the same name
- *
- * @version $Rev$ $Date$
- */
-public class DuplicateResourceException extends IntrospectionException {
-
- private static final long serialVersionUID = 1619276459330463299L;
-
- public DuplicateResourceException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java
deleted file mode 100644
index 5619275b82..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.osoa.sca.annotations.EagerInit;
-
-/**
- * Handles processing of {@link org.osoa.sca.annotations.EagerInit}
- *
- * @version $Rev$ $Date$
- */
-public class EagerInitProcessor extends BaseJavaClassVisitor {
-
- public EagerInitProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz,
- JavaImplementation type) throws IntrospectionException {
- super.visitClass(clazz, type);
- EagerInit annotation = clazz.getAnnotation(EagerInit.class);
- if (annotation == null) {
- Class<?> superClass = clazz.getSuperclass();
- while (!Object.class.equals(superClass)) {
- annotation = superClass.getAnnotation(EagerInit.class);
- if (annotation != null) {
- break;
- }
- superClass = superClass.getSuperclass();
- }
- if (annotation == null) {
- return;
- }
- }
- type.setEagerInit(true);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
deleted file mode 100644
index b7f6748ed2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessor.java
+++ /dev/null
@@ -1,615 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.toPropertyName;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jws.WebService;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Heuristically evaluates an un-annotated Java implementation type to determine
- * services, references, and properties according to the algorithm described in
- * the SCA Java Client and Implementation Model Specification <p/> TODO
- * Implement: <p/> When no service interface is annotated, need to calculate a
- * single service comprising all public methods that are not reference or
- * property injection sites. If that service can be exactly mapped to an
- * interface implemented by the class then the service interface will be defined
- * in terms of that interface.
- *
- * @version $Rev$ $Date$
- */
-public class HeuristicPojoProcessor extends BaseJavaClassVisitor {
- private JavaInterfaceFactory javaFactory;
-
- public HeuristicPojoProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- super(assemblyFactory);
- this.javaFactory = javaFactory;
- }
-
- @Override
- public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- List<org.apache.tuscany.sca.assembly.Service> services = type.getServices();
- if (services.isEmpty()) {
- // heuristically determine the service
- /**
- * The following is quoted from Java Specification 1.2.1.3. Introspecting services offered by a Java implementation
- * In the cases described below, the services offered by a Java implementation class may be determined
- * through introspection, eliding the need to specify them using @Service. The following algorithm is used
- * to determine how services are introspected from an implementation class:
- *
- * If the interfaces of the SCA services are not specified with the @Service annotation on the
- * implementation class, it is assumed that all implemented interfaces that have been annotated
- * as @Remotable are the service interfaces provided by the component. If none of the implemented
- * interfaces is remotable, then by default the implementation offers a single service whose type
- * is the implementation class.
- */
- Set<Class> interfaces = getAllInterfaces(clazz);
- for (Class<?> i : interfaces) {
- if (i.isAnnotationPresent(Remotable.class) || i.isAnnotationPresent(WebService.class)) {
- addService(type, i);
- }
- }
- if (services.isEmpty()) {
- // class is the interface
- addService(type, clazz);
- }
- }
- Set<Method> methods = getAllUniquePublicProtectedMethods(clazz, false);
- if (!type.getReferenceMembers().isEmpty() || !type.getPropertyMembers().isEmpty()) {
- // references and properties have been explicitly defined
- // if (type.getServices().isEmpty()) {
- // calculateServiceInterface(clazz, type, methods);
- // if (type.getServices().isEmpty()) {
- // throw new ServiceTypeNotFoundException(clazz.getName());
- // }
- // }
- evaluateConstructor(type, clazz);
- return;
- }
- calcPropRefs(methods, services, type, clazz);
- evaluateConstructor(type, clazz);
- }
-
- private void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
- try {
- org.apache.tuscany.sca.assembly.Service service = createService(clazz);
- type.getServices().add(service);
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- }
-
- private boolean isPublicSetter(Method method) {
- return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
- && method.getName().startsWith("set")
- && method.getReturnType() == void.class;
- }
-
- private boolean isProtectedSetter(Method method) {
- return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
- && method.getName().startsWith("set")
- && method.getReturnType() == void.class;
- }
-
- private <T> void calcPropRefs(Set<Method> methods,
- List<org.apache.tuscany.sca.assembly.Service> services,
- JavaImplementation type,
- Class<T> clazz) throws IntrospectionException {
- // heuristically determine the properties references
- // make a first pass through all public methods with one param
- Set<String> setters = new HashSet<String>();
- Set<String> others = new HashSet<String>();
- for (Method method : methods) {
- if (!isPublicSetter(method)) {
- continue;
- }
- if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
- // Add the property name as others
- others.add(toPropertyName(method.getName()));
- continue;
- }
- if (!isInServiceInterface(method, services)) {
- // Not part of the service interface
- String name = toPropertyName(method.getName());
- setters.add(name);
- // avoid duplicate property or ref names
- if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
- Class<?> param = method.getParameterTypes()[0];
- Type genericType = method.getGenericParameterTypes()[0];
- if (isReferenceType(param, genericType)) {
- type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
- } else {
- type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
- }
- }
- }
- }
- // second pass for protected methods with one param
- for (Method method : methods) {
- if (!isProtectedSetter(method)) {
- continue;
- }
- if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
- // Add the property name as others
- others.add(toPropertyName(method.getName()));
- continue;
- }
- Class<?> param = method.getParameterTypes()[0];
- String name = toPropertyName(method.getName());
- setters.add(name);
- // avoid duplicate property or ref names
- if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
- if (!type.getReferenceMembers().containsKey(name)) {
- type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
- }
- } else {
- if (!type.getPropertyMembers().containsKey(name)) {
- type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
- }
- }
- }
-
- // Public or protected fields unless there is a public or protected
- // setter method
- // for the same name
- Set<Field> fields = getAllPublicAndProtectedFields(clazz, false);
- for (Field field : fields) {
- if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
- continue;
- }
- if (setters.contains(field.getName()) || others.contains(field.getName())) {
- continue;
- }
- String name = field.getName();
- Class<?> paramType = field.getType();
- if (isReferenceType(paramType, field.getGenericType())) {
- if (!type.getReferenceMembers().containsKey(name)) {
- type.getReferences().add(createReference(name, paramType));
- type.getReferenceMembers().put(name, new JavaElementImpl(field));
- }
- } else {
- if (!type.getPropertyMembers().containsKey(name)) {
- type.getProperties().add(createProperty(name, paramType));
- type.getPropertyMembers().put(name, new JavaElementImpl(field));
- }
- }
- }
- }
-
- /**
- * Determines the constructor to use based on the component type's
- * references and properties
- *
- * @param type the component type
- * @param clazz the implementation class corresponding to the component type
- * @throws NoConstructorException if no suitable constructor is found
- * @throws AmbiguousConstructorException if the parameters of a constructor
- * cannot be unambiguously mapped to references and properties
- */
- @SuppressWarnings("unchecked")
- private <T> void evaluateConstructor(JavaImplementation type, Class<T> clazz) throws IntrospectionException {
- // determine constructor if one is not annotated
- JavaConstructorImpl<?> definition = type.getConstructor();
- Constructor constructor;
- boolean explict = false;
- if (definition != null && definition.getConstructor()
- .isAnnotationPresent(org.osoa.sca.annotations.Constructor.class)) {
- // the constructor was already defined explicitly
- return;
- } else if (definition != null) {
- explict = true;
- constructor = definition.getConstructor();
- } else {
- // no definition, heuristically determine constructor
- Constructor[] constructors = clazz.getConstructors();
- if (constructors.length == 0) {
- throw new NoConstructorException("No public constructor for class");
- } else if (constructors.length == 1) {
- // Only one constructor, take it
- constructor = constructors[0];
- } else {
- // FIXME multiple constructors, none yet done
- Constructor<T> selected = null;
- int sites = type.getPropertyMembers().size() + type.getReferenceMembers().size();
- for (Constructor<T> ctor : constructors) {
- if (ctor.getParameterTypes().length == 0) {
- selected = ctor;
- }
- if (ctor.getParameterTypes().length == sites) {
- // TODO finish
- // selected = constructor;
- // select constructor
- // break;
- }
- }
- if (selected == null) {
- throw new NoConstructorException();
- }
- constructor = selected;
- definition = type.getConstructors().get(selected);
- type.setConstructor(definition);
- // return;
- }
- definition = type.getConstructors().get(constructor);
- type.setConstructor(definition);
- }
- JavaParameterImpl[] parameters = definition.getParameters();
- if (parameters.length == 0) {
- return;
- }
- Map<String, JavaElementImpl> props = type.getPropertyMembers();
- Map<String, JavaElementImpl> refs = type.getReferenceMembers();
- Annotation[][] annotations = constructor.getParameterAnnotations();
- if (!explict) {
- // the constructor wasn't defined by an annotation, so check to see
- // if any of the params have an annotation
- // which we can impute as explicitly defining the constructor, e.g.
- // @Property, @Reference, or @Autowire
- explict = injectionAnnotationsPresent(annotations);
- }
- if (explict) {
- for (int i = 0; i < parameters.length; i++) {
- if (isAnnotated(parameters[i])) {
- continue;
- } else if (!findReferenceOrProperty(parameters[i], props, refs)) {
- throw new AmbiguousConstructorException(parameters[i].toString());
- }
- }
- } else {
- if (!areUnique(parameters)) {
- throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
- }
- if (!calcPropRefUniqueness(props.values(), refs.values())) {
- throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
- }
- if (!(props.isEmpty() && refs.isEmpty())) {
- calcParamNames(parameters, props, refs);
- } else {
- heuristicParamNames(type, parameters);
-
- }
- }
- }
-
- private void calcParamNames(JavaParameterImpl[] parameters,
- Map<String, JavaElementImpl> props,
- Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
- // the constructor param types must unambiguously match defined
- // reference or property types
- for (JavaParameterImpl param : parameters) {
- if (!findReferenceOrProperty(param, props, refs)) {
- throw new AmbiguousConstructorException(param.getName());
- }
- }
- }
-
- private void heuristicParamNames(JavaImplementation type, JavaParameterImpl[] parameters)
- throws IntrospectionException {
- // heuristically determine refs and props from the parameter types
- for (JavaParameterImpl p : parameters) {
- String name = p.getType().getSimpleName().toLowerCase();
- if (isReferenceType(p.getType(), p.getGenericType())) {
- type.getReferences().add(createReference(name, p.getType()));
- p.setClassifer(Reference.class);
- type.getReferenceMembers().put(name, p);
- } else {
- type.getProperties().add(createProperty(name, p.getType()));
- p.setClassifer(Property.class);
- type.getPropertyMembers().put(name, p);
- }
- p.setName(name);
- }
- }
-
- private static boolean areUnique(Class[] collection) {
- Set<Class> set = new HashSet<Class>(Arrays.asList(collection));
- return set.size() == collection.length;
- }
-
- /**
- * Returns true if the union of the given collections of properties and
- * references have unique Java types
- */
- private boolean calcPropRefUniqueness(Collection<JavaElementImpl> props, Collection<JavaElementImpl> refs) {
-
- Class[] classes = new Class[props.size() + refs.size()];
- int i = 0;
- for (JavaElementImpl property : props) {
- classes[i] = property.getType();
- i++;
- }
- for (JavaElementImpl reference : refs) {
- classes[i] = reference.getType();
- i++;
- }
- return areUnique(classes);
- }
-
- /**
- * Unambiguously finds the reference or property associated with the given
- * type
- *
- * @return the name of the reference or property if found, null if not
- * @throws AmbiguousConstructorException if the constructor parameter cannot
- * be resolved to a property or reference
- */
- private boolean findReferenceOrProperty(JavaParameterImpl parameter,
- Map<String, JavaElementImpl> props,
- Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
-
- boolean found = false;
- if (!"".equals(parameter.getName())) {
- // Match by name
- JavaElementImpl prop = props.get(parameter.getName());
- if (prop != null && prop.getType() == parameter.getType()) {
- parameter.setClassifer(Property.class);
- return true;
- }
- JavaElementImpl ref = refs.get(parameter.getName());
- if (ref != null && ref.getType() == parameter.getType()) {
- parameter.setClassifer(Reference.class);
- return true;
- }
- }
- for (JavaElementImpl property : props.values()) {
- if (property.getType() == parameter.getType()) {
- if (found) {
- throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
- (Member)parameter.getAnchor());
- }
- parameter.setClassifer(Property.class);
- parameter.setName(property.getName());
- found = true;
- // do not break since ambiguities must be checked, i.e. more
- // than one prop or ref of the same type
- }
- }
- for (JavaElementImpl reference : refs.values()) {
- if (reference.getType() == parameter.getType()) {
- if (found) {
- throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
- (Member)parameter.getAnchor());
- }
- parameter.setClassifer(Reference.class);
- parameter.setName(reference.getName());
- found = true;
- // do not break since ambiguities must be checked, i.e. more
- // than one prop or ref of the same type
- }
- }
- return found;
- }
-
- /**
- * Returns true if a given type is reference according to the SCA
- * specification rules for determining reference types The following rules
- * are used to determine whether an unannotated field or setter method is a
- * property or reference:
- * <ol>
- * <li>If its type is simple, then it is a property.
- * <li>If its type is complex, then if the type is an interface marked by
- *
- * @Remotable, then it is a reference; otherwise, it is a property.
- * <li>Otherwise, if the type associated with the member is an
- * array or a java.util.Collection, the basetype is the element
- * type of the array or the parameterized type of the
- * Collection; otherwise the basetype is the member type. If the
- * basetype is an interface with an
- * @Remotable or
- * @Service annotation then the member is defined as a reference. Otherwise,
- * it is defined as a property.
- * </ol>
- * <p>
- * The name of the reference or of the property is derived from the
- * name found on the setter method or on the field.
- */
- private boolean isReferenceType(Class<?> cls, Type genericType) {
- Class<?> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
- return baseType.isInterface() && baseType.isAnnotationPresent(Remotable.class);
- }
-
- /**
- * Returns true if the given operation is defined in the collection of
- * service interfaces
- */
- private boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
- for (org.apache.tuscany.sca.assembly.Service service : services) {
- Interface interface1 = service.getInterfaceContract().getInterface();
- if (interface1 instanceof JavaInterface) {
- Class<?> clazz = ((JavaInterface)interface1).getJavaClass();
- if (isMethodMatched(clazz, operation)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Test if the class declares a method which matches the signature of the
- * given method
- *
- * @param clazz
- * @param method
- * @return
- */
- private boolean isMethodMatched(Class<?> clazz, Method method) {
- if (method.getDeclaringClass() == clazz) {
- return true;
- }
- Method[] methods = clazz.getMethods();
- for (Method m : methods) {
- if (JavaIntrospectionHelper.exactMethodMatch(method, m)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Creates a mapped property.
- *
- * @param name the property name
- * @param paramType the property type
- */
- private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
- org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
- property.setName(name);
- property.setXSDType(JavaXMLMapper.getXMLType(paramType));
- return property;
- }
-
- private boolean isAnnotated(JavaParameterImpl parameter) {
- for (Annotation annotation : parameter.getAnnotations()) {
- Class<? extends Annotation> annotType = annotation.annotationType();
- if (annotType.equals(Property.class) || annotType.equals(Reference.class)
- || annotType.equals(Resource.class)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean areUnique(JavaParameterImpl[] parameters) {
- Set<Class> set = new HashSet<Class>(parameters.length);
- for (JavaParameterImpl p : parameters) {
- if (!set.add(p.getType())) {
- return false;
- }
- }
- return true;
- }
-
- public org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
- throws IntrospectionException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- reference.setName(name);
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
- try {
- JavaInterface callInterface = javaFactory.createJavaInterface(paramType);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- } catch (InvalidInterfaceException e1) {
- throw new IntrospectionException(e1);
- }
-
- // FIXME: This part seems to have already been taken care above!!
- try {
- processCallback(paramType, reference);
- } catch (InvalidServiceType e) {
- throw new IntrospectionException(e);
- }
- return reference;
- }
-
- public org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
- org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
- service.setName(interfaze.getSimpleName());
-
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
- service.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
-
- Interface javaInterface = service.getInterfaceContract().getInterface();
- javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
- service.getInterfaceContract().setInterface(javaInterface);
- return service;
- }
-
- public void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceType {
- Callback callback = interfaze.getAnnotation(Callback.class);
- if (callback != null && !Void.class.equals(callback.value())) {
- Class<?> callbackClass = callback.value();
- JavaInterface javaInterface;
- try {
- javaInterface = javaFactory.createJavaInterface(callbackClass);
- contract.getInterfaceContract().setCallbackInterface(javaInterface);
- } catch (InvalidInterfaceException e) {
- throw new InvalidServiceType("Invalid callback interface "+callbackClass, interfaze);
- }
- } else if (callback != null && Void.class.equals(callback.value())) {
- throw new InvalidServiceType("No callback interface specified on annotation", interfaze);
- }
- }
-
- public boolean injectionAnnotationsPresent(Annotation[][] annots) {
- for (Annotation[] annotations : annots) {
- for (Annotation annotation : annotations) {
- Class<? extends Annotation> annotType = annotation.annotationType();
- if (annotType.equals(Property.class) || annotType.equals(Reference.class)
- || annotType.equals(Resource.class)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.java
deleted file mode 100644
index 9fe2fcd468..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalCallbackReferenceException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal use of {@link org.osoa.sca.annotations.Callback} on a reference
- *
- * @version $Rev$ $Date$
- */
-public class IllegalCallbackReferenceException extends IntrospectionException {
- private static final long serialVersionUID = -8932525723147700591L;
-
- public IllegalCallbackReferenceException(String message) {
- super(message);
- }
-
- public IllegalCallbackReferenceException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.java
deleted file mode 100644
index f5696122df..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalContextException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Context}
- *
- * @version $Rev$ $Date$
- */
-public class IllegalContextException extends IntrospectionException {
- private static final long serialVersionUID = -6946383136750117008L;
-
- public IllegalContextException(String message) {
- super(message);
- }
-
- public IllegalContextException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.java
deleted file mode 100644
index 6a0d60c92f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalDestructorException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal signature for a method decorated with {@link org.osoa.sca.annotations.Destroy}
- *
- * @version $Rev$ $Date$
- */
-public class IllegalDestructorException extends IntrospectionException {
- private static final long serialVersionUID = 365719353107446326L;
-
- public IllegalDestructorException(String message) {
- super(message);
- }
-
- public IllegalDestructorException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.java
deleted file mode 100644
index 8f50852c2d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalInitException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal signature for a method decorated with {@link @org.osoa.sca.annotations.Init}
- *
- * @version $Rev$ $Date$
- */
-public class IllegalInitException extends IntrospectionException {
- private static final long serialVersionUID = -3690763271986854701L;
-
- public IllegalInitException(String message) {
- super(message);
- }
-
- public IllegalInitException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.java
deleted file mode 100644
index 54f7dfad1e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalPropertyException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal property definition in a component type
- *
- * @version $Rev$ $Date$
- */
-public class IllegalPropertyException extends IntrospectionException {
- private static final long serialVersionUID = -2836849110706758494L;
-
- public IllegalPropertyException(String message) {
- super(message);
- }
-
- public IllegalPropertyException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.java
deleted file mode 100644
index 25196c56e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalReferenceException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal reference definition in a component type
- *
- * @version $Rev$ $Date$
- */
-public class IllegalReferenceException extends IntrospectionException {
- private static final long serialVersionUID = 4612984122225271395L;
-
- public IllegalReferenceException(String message) {
- super(message);
- }
-
- public IllegalReferenceException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.java
deleted file mode 100644
index ccfbaf0043..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalResourceException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal resource definition in a component type
- *
- * @version $Rev$ $Date$
- */
-public class IllegalResourceException extends IntrospectionException {
- private static final long serialVersionUID = -1100936539412435579L;
-
- public IllegalResourceException(String message) {
- super(message);
- }
-
- public IllegalResourceException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.java
deleted file mode 100644
index e130f4221d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalServiceDefinitionException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an illegal use of the {@link @org.osoa.sca.annotations.Service} annotation
- *
- * @version $Rev$ $Date$
- */
-public class IllegalServiceDefinitionException extends IntrospectionException {
- private static final long serialVersionUID = -7151534258405092548L;
-
- public IllegalServiceDefinitionException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.java
deleted file mode 100644
index 583ccc86cd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessor.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.osoa.sca.annotations.Init;
-
-/**
- * Processes the {@link @Init} annotation on a component implementation and
- * updates the component type with the decorated initializer method
- *
- * @version $Rev$ $Date$
- */
-public class InitProcessor extends BaseJavaClassVisitor {
-
- public InitProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- Init annotation = method.getAnnotation(Init.class);
- if (annotation == null) {
- return;
- }
- if (method.getParameterTypes().length != 0) {
- throw new IllegalInitException("Initializer must not have argments", method);
- }
- if(!method.getReturnType().equals(void.class)) {
- throw new IllegalInitException("Initializer must return void.", method);
- }
- if (type.getInitMethod() != null) {
- throw new DuplicateInitException("More than one initializer found on implementaton");
- }
- if (!Modifier.isPublic(method.getModifiers())) {
- throw new IllegalInitException("Initializer must be a public method. Invalid annotation @Init found on "+method);
- }
- type.setInitMethod(method);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.java
deleted file mode 100644
index 91b97b2caf..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConstructorException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an invalid constructor definition, e.g. when the number of injection names specified in {@link
- * org.osoa.sca.annotations.Constructor} do not match the number of actual constructor parameters
- *
- * @version $Rev$ $Date$
- */
-public class InvalidConstructorException extends IntrospectionException {
- private static final long serialVersionUID = 1411492435210741512L;
-
- public InvalidConstructorException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
deleted file mode 100644
index a1e1d01ab3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidConversationalImplementation.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Raised when an implementation specifies improper conversational metadata
- *
- * @version $Rev$ $Date$
- */
-public class InvalidConversationalImplementation extends IntrospectionException {
- private static final long serialVersionUID = -5487291552769408149L;
-
- public InvalidConversationalImplementation(String message) {
- super(message);
- }
-
- public InvalidConversationalImplementation(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.java
deleted file mode 100644
index 976b4da120..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidPropertyException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an invalid usage of {@link org.osoa.sca.annotations.Property}
- *
- * @version $Rev$ $Date$
- */
-public class InvalidPropertyException extends IntrospectionException {
- private static final long serialVersionUID = -2682862652069727948L;
-
- public InvalidPropertyException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.java
deleted file mode 100644
index e77a6beb0d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidReferenceException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an invalid usage of {@link org.osoa.sca.annotations.Reference}
- *
- * @version $Rev$ $Date$
- */
-public class InvalidReferenceException extends IntrospectionException {
- private static final long serialVersionUID = -3285246635989254165L;
-
- public InvalidReferenceException(String message) {
- super(message);
- }
-
- public InvalidReferenceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidReferenceException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.java
deleted file mode 100644
index debb5cbacc..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidResourceException.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Member;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Denotes an invalid usage of {@link @org.apache.tuscany.api.annotation.Resource}
- *
- * @version $Rev$ $Date$
- */
-public class InvalidResourceException extends IntrospectionException {
- private static final long serialVersionUID = 511728001735534934L;
-
- public InvalidResourceException(String message) {
- super(message);
- }
-
- public InvalidResourceException(String message, Member member) {
- super(message, member);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
deleted file mode 100644
index 7147da55b4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InvalidServiceType.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when a service type specified by an {@link org.osoa.sca.annotations.Service} annotation is invalid, e.g. it is
- * not an interface
- *
- * @version $Rev$ $Date$
- */
-public class InvalidServiceType extends IntrospectionException {
- private static final long serialVersionUID = -1076466639416644386L;
- private Class<?> serviceType;
-
- public InvalidServiceType(String message) {
- super(message);
- }
-
- public InvalidServiceType(String message, Class<?> clazz) {
- super(message);
- this.serviceType = clazz;
- }
-
- /**
- * @return the serviceType
- */
- public Class<?> getServiceType() {
- return serviceType;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
deleted file mode 100644
index 6039bd91f8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaIntrospectionHelper.java
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.beans.Introspector;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.osoa.sca.CallableReference;
-
-/**
- * Implements various reflection-related operations
- *
- * @version $Rev$ $Date$
- */
-public final class JavaIntrospectionHelper {
- private static final Logger logger = Logger.getLogger(JavaIntrospectionHelper.class.getName());
- private static final Class[] EMPTY_CLASS_ARRY = new Class[0];
-
- /**
- * Hide the constructor
- */
- private JavaIntrospectionHelper() {
- }
-
- /**
- * Returns a collection of public, and protected fields declared by a class
- * or one of its supertypes
- */
- public static Set<Field> getAllPublicAndProtectedFields(Class clazz, boolean validating) {
- return getAllPublicAndProtectedFields(clazz, new HashSet<Field>(), validating);
- }
-
- private static void checkInvalidAnnotations(AnnotatedElement element) {
- for (Annotation a : element.getAnnotations()) {
- if (a.annotationType().getName().startsWith("org.osoa.sca.annotations.")) {
- logger.warning("Invalid annotation " + a + " is found on " + element);
- }
- }
- }
-
- /**
- * Recursively evaluates the type hierarchy to return all fields that are
- * public or protected
- */
- private static Set<Field> getAllPublicAndProtectedFields(Class clazz, Set<Field> fields, boolean validating) {
- if (clazz == null || clazz.isArray() || Object.class.equals(clazz)) {
- return fields;
- }
- fields = getAllPublicAndProtectedFields(clazz.getSuperclass(), fields, validating);
- Field[] declaredFields = clazz.getDeclaredFields();
- for (final Field field : declaredFields) {
- int modifiers = field.getModifiers();
- if ((Modifier.isPublic(modifiers) || Modifier.isProtected(modifiers)) && !Modifier.isStatic(modifiers)) {
- // Allow privileged access to set accessibility. Requires ReflectPermission
- // in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- field.setAccessible(true); // ignore Java accessibility
- return null;
- }
- });
- fields.add(field);
- } else {
- if (validating) {
- checkInvalidAnnotations(field);
- }
- }
- }
- return fields;
- }
-
- /**
- * Returns a collection of public and protected methods declared by a class
- * or one of its supertypes. Note that overridden methods will not be
- * returned in the collection (i.e. only the method override will be). <p/>
- * This method can potentially be expensive as reflection information is not
- * cached. It is assumed that this method will be used during a
- * configuration phase.
- */
- public static Set<Method> getAllUniquePublicProtectedMethods(Class clazz, boolean validating) {
- return getAllUniqueMethods(clazz, new HashSet<Method>(), validating);
- }
-
- /**
- * Recursively evaluates the type hierarchy to return all unique methods
- */
- private static Set<Method> getAllUniqueMethods(Class pClass, Set<Method> methods, boolean validating) {
- if (pClass == null || pClass.isArray() || Object.class.equals(pClass)) {
- return methods;
- }
- // we first evaluate methods of the subclass and then move to the parent
- Method[] declaredMethods = pClass.getDeclaredMethods();
- for (final Method declaredMethod : declaredMethods) {
- int modifiers = declaredMethod.getModifiers();
- if ((!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) || Modifier.isStatic(modifiers)) {
- if (validating) {
- checkInvalidAnnotations(declaredMethod);
- }
- continue;
- }
- if (methods.size() == 0) {
- methods.add(declaredMethod);
- } else {
- List<Method> temp = new ArrayList<Method>();
- boolean matched = false;
- for (Method method : methods) {
- // only add if not already in the set from a superclass (i.e.
- // the method is not overridden)
- if (exactMethodMatch(declaredMethod, method)) {
- matched = true;
- break;
- }
- }
- if (!matched) {
- // Allow privileged access to set accessibility. Requires ReflectPermission
- // in security policy.
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- declaredMethod.setAccessible(true);
- return null;
- }
- });
- temp.add(declaredMethod);
- }
- methods.addAll(temp);
- temp.clear();
- }
- }
- // evaluate class hierarchy - this is done last to track inherited
- // methods
- methods = getAllUniqueMethods(pClass.getSuperclass(), methods, validating);
- return methods;
- }
-
- /**
- * Finds the closest matching field with the given name, that is, a field of
- * the exact specified type or, alternately, of a supertype.
- *
- * @param name the name of the field
- * @param type the field type
- * @param fields the collection of fields to search
- * @return the matching field or null if not found
- */
- public static Field findClosestMatchingField(String name, Class type, Set<Field> fields) {
- Field candidate = null;
- for (Field field : fields) {
- if (field.getName().equals(name)) {
- if (field.getType().equals(type)) {
- return field; // exact match
- } else if (field.getType().isAssignableFrom(type) || (field.getType().isPrimitive() && primitiveAssignable(field
- .getType(),
- type))) {
- // We could have the situation where a field parameter is a
- // primitive and the demarshalled value is
- // an object counterpart (e.g. Integer and int)
- // @spec issue
- // either an interface or super class, so keep a reference
- // until
- // we know there are no closer types
- candidate = field;
- }
- }
- }
- if (candidate != null) {
- return candidate;
- } else {
- return null;
- }
- }
-
- /**
- * Finds the closest matching method with the given name, that is, a method
- * taking the exact parameter types or, alternately, parameter supertypes.
- *
- * @param name the name of the method
- * @param types the method parameter types
- * @param methods the collection of methods to search
- * @return the matching method or null if not found
- */
- public static Method findClosestMatchingMethod(String name, Class[] types, Set<Method> methods) {
- if (types == null) {
- types = EMPTY_CLASS_ARRY;
- }
- Method candidate = null;
- for (Method method : methods) {
- if (method.getName().equals(name) && method.getParameterTypes().length == types.length) {
- Class<?>[] params = method.getParameterTypes();
- boolean disqualify = false;
- boolean exactMatch = true;
- for (int i = 0; i < params.length; i++) {
- if (!params[i].equals(types[i]) && !params[i].isAssignableFrom(types[i])) {
- // no match
- disqualify = true;
- exactMatch = false;
- break;
- } else if (!params[i].equals(types[i]) && params[i].isAssignableFrom(types[i])) {
- // not exact match
- exactMatch = false;
- }
- }
- if (disqualify) {
- continue;
- } else if (exactMatch) {
- return method;
- } else {
- candidate = method;
- }
- }
- }
- if (candidate != null) {
- return candidate;
- } else {
- return null;
- }
- }
-
- /**
- * Determines if two methods "match" - that is, they have the same method
- * names and exact parameter types (one is not a supertype of the other)
- */
- public static boolean exactMethodMatch(Method method1, Method method2) {
- if (!method1.getName().equals(method2.getName())) {
- return false;
- }
- Class<?>[] types1 = method1.getParameterTypes();
- Class<?>[] types2 = method2.getParameterTypes();
- if (types1.length != types2.length) {
- return false;
- }
- boolean matched = true;
- for (int i = 0; i < types1.length; i++) {
- if (types1[i] != types2[i]) {
- matched = false;
- break;
- }
- }
- return matched;
- }
-
- public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws NoSuchMethodException {
- return clazz.getConstructor((Class[])null);
- }
-
- /**
- * Returns the simple name of a class - i.e. the class name devoid of its
- * package qualifier
- *
- * @param implClass the implementation class
- */
- public static String getBaseName(Class<?> implClass) {
- return implClass.getSimpleName();
- }
-
- public static boolean isImmutable(Class clazz) {
- return String.class == clazz || clazz.isPrimitive()
- || Number.class.isAssignableFrom(clazz)
- || Boolean.class.isAssignableFrom(clazz)
- || Character.class.isAssignableFrom(clazz)
- || Byte.class.isAssignableFrom(clazz);
- }
-
- /**
- * Takes a property name and converts it to a getter method name according
- * to JavaBean conventions. For example, property
- * <code>foo<code> is returned as <code>getFoo</code>
- */
- public static String toGetter(String name) {
- return "get" + name.toUpperCase().substring(0, 1) + name.substring(1);
- }
-
- /**
- * Takes a setter or getter method name and converts it to a property name
- * according to JavaBean conventions. For example, <code>setFoo(var)</code>
- * is returned as property <code>foo<code>
- */
- public static String toPropertyName(String name) {
- if (!name.startsWith("set")) {
- return name;
- }
- return Introspector.decapitalize(name.substring(3));
- }
-
- public static Class<?> getErasure(Type type) {
- if (type instanceof Class) {
- return (Class)type;
- } else if (type instanceof GenericArrayType) {
- // FIXME: How to deal with the []?
- GenericArrayType arrayType = (GenericArrayType)type;
- return getErasure(arrayType.getGenericComponentType());
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- return getErasure(pType.getRawType());
- } else if (type instanceof WildcardType) {
- WildcardType wType = (WildcardType)type;
- Type[] types = wType.getUpperBounds();
- return getErasure(types[0]);
- } else if (type instanceof TypeVariable) {
- TypeVariable var = (TypeVariable)type;
- Type[] types = var.getBounds();
- return getErasure(types[0]);
- }
- return null;
- }
-
- public static Class<?> getBaseType(Class<?> cls, Type genericType) {
- if (cls.isArray()) {
- return cls.getComponentType();
- } else if (Collection.class.isAssignableFrom(cls)) {
- if (genericType instanceof ParameterizedType) {
- // Collection<BaseType>
- ParameterizedType parameterizedType = (ParameterizedType)genericType;
- Type baseType = parameterizedType.getActualTypeArguments()[0];
- if (baseType instanceof GenericArrayType) {
- // Base is array
- return cls;
- } else {
- return getErasure(baseType);
- }
- } else {
- return cls;
- }
- } else {
- return cls;
- }
- }
-
- public static Type getParameterType(Type type) {
- if (type instanceof ParameterizedType) {
- // Collection<BaseType>
- ParameterizedType parameterizedType = (ParameterizedType)type;
- Type baseType = parameterizedType.getActualTypeArguments()[0];
- return baseType;
- } else {
- return Object.class;
- }
- }
-
- public static Class<?> getBusinessInterface(Class<?> cls, Type callableReferenceType) {
- if (CallableReference.class.isAssignableFrom(cls) && callableReferenceType instanceof ParameterizedType) {
- // Collection<BaseType>
- ParameterizedType parameterizedType = (ParameterizedType)callableReferenceType;
- Type baseType = parameterizedType.getActualTypeArguments()[0];
- if (baseType instanceof GenericArrayType) {
- // Base is array
- return cls;
- } else {
- return getErasure(baseType);
- }
- }
- return Object.class;
- }
-
- /**
- * Takes a property name and converts it to a setter method name according
- * to JavaBean conventions. For example, the property
- * <code>foo<code> is returned as <code>setFoo(var)</code>
- */
- public static String toSetter(String name) {
- return "set" + name.toUpperCase().substring(0, 1) + name.substring(1);
- }
-
- /**
- * Compares a two types, assuming one is a primitive, to determine if the
- * other is its object counterpart
- */
- private static boolean primitiveAssignable(Class memberType, Class param) {
- if (memberType == Integer.class) {
- return param == Integer.TYPE;
- } else if (memberType == Double.class) {
- return param == Double.TYPE;
- } else if (memberType == Float.class) {
- return param == Float.TYPE;
- } else if (memberType == Short.class) {
- return param == Short.TYPE;
- } else if (memberType == Character.class) {
- return param == Character.TYPE;
- } else if (memberType == Boolean.class) {
- return param == Boolean.TYPE;
- } else if (memberType == Byte.class) {
- return param == Byte.TYPE;
- } else if (param == Integer.class) {
- return memberType == Integer.TYPE;
- } else if (param == Double.class) {
- return memberType == Double.TYPE;
- } else if (param == Float.class) {
- return memberType == Float.TYPE;
- } else if (param == Short.class) {
- return memberType == Short.TYPE;
- } else if (param == Character.class) {
- return memberType == Character.TYPE;
- } else if (param == Boolean.class) {
- return memberType == Boolean.TYPE;
- } else if (param == Byte.class) {
- return memberType == Byte.TYPE;
- } else {
- return false;
- }
- }
-
- /**
- * Returns the generic types represented in the given type. Usage as
- * follows: <code>
- * JavaIntrospectionHelper.getGenerics(field.getGenericType());
- * <p/>
- * JavaIntrospectionHelper.getGenerics(m.getGenericParameterTypes()[0];); </code>
- *
- * @return the generic types in order of declaration or an empty array if
- * the type is not genericized
- */
- public static List<? extends Type> getGenerics(Type genericType) {
- List<Type> classes = new ArrayList<Type>();
- if (genericType instanceof ParameterizedType) {
- ParameterizedType ptype = (ParameterizedType)genericType;
- // get the type arguments
- Type[] targs = ptype.getActualTypeArguments();
- for (Type targ : targs) {
- classes.add(targ);
- }
- }
- return classes;
- }
-
- /**
- * Returns the generic type specified by the class at the given position as
- * in: <p/> <code> public class Foo<Bar,Baz>{ //.. }
- * <p/>
- * JavaIntrospectionHelper.introspectGeneric(Foo.class,1); <code>
- * <p/>
- * will return Baz.
- */
- public static Class introspectGeneric(Class<?> clazz, int pos) {
- assert clazz != null : "No class specified";
- Type type = clazz.getGenericSuperclass();
- if (type instanceof ParameterizedType) {
- Type[] args = ((ParameterizedType)type).getActualTypeArguments();
- if (args.length <= pos) {
- throw new IllegalArgumentException("Invalid index value for generic class " + clazz.getName());
- }
- return (Class)((ParameterizedType)type).getActualTypeArguments()[pos];
- } else {
- Type[] interfaces = clazz.getGenericInterfaces();
- for (Type itype : interfaces) {
- if (!(itype instanceof ParameterizedType)) {
- continue;
- }
- ParameterizedType interfaceType = (ParameterizedType)itype;
- return (Class)interfaceType.getActualTypeArguments()[0];
- }
- }
- return null;
- }
-
- /**
- * Returns the set of interfaces implemented by the given class and its
- * ancestors or a blank set if none
- */
- public static Set<Class> getAllInterfaces(Class clazz) {
- Set<Class> implemented = new HashSet<Class>();
- getAllInterfaces(clazz, implemented);
- return implemented;
- }
-
- private static void getAllInterfaces(Class clazz, Set<Class> implemented) {
- Class[] interfaces = clazz.getInterfaces();
- for (Class interfaze : interfaces) {
- implemented.add(interfaze);
- }
- Class<?> superClass = clazz.getSuperclass();
- // Object has no superclass so check for null
- if (superClass != null && !superClass.equals(Object.class)) {
- getAllInterfaces(superClass, implemented);
- }
- }
-
- public static boolean isSetter(Method method) {
- return (void.class == method.getReturnType() && method.getParameterTypes().length == 1 && method.getName()
- .startsWith("set"));
- }
-
- public static boolean isGetter(Method method) {
- return (void.class != method.getReturnType() && method.getParameterTypes().length == 0 && method.getName()
- .startsWith("get"));
- }
-
- private final static Map<Class, String> signatures = new HashMap<Class, String>();
- static {
- signatures.put(boolean.class, "Z");
- signatures.put(byte.class, "B");
- signatures.put(char.class, "C");
- signatures.put(short.class, "S");
- signatures.put(int.class, "I");
- signatures.put(long.class, "J");
- signatures.put(float.class, "F");
- signatures.put(double.class, "D");
- };
-
- public static String getSignature(Class<?> cls) {
- if (cls.isPrimitive()) {
- return signatures.get(cls);
- }
- if (cls.isArray()) {
- return "[" + getSignature(cls.getComponentType());
- }
- return "L" + cls.getName().replace('.', '/') + ";";
- }
-
- public static Class<?> getArrayType(Class<?> componentType, int dims) throws ClassNotFoundException {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < dims; i++) {
- buf.append('[');
- }
- buf.append(getSignature(componentType));
- return Class.forName(buf.toString(), false, componentType.getClassLoader());
- }
-
- public static Set<Method> getPrivateMethods(Class clazz) {
- Set<Method> methods = new HashSet<Method>();
- Method[] declaredMethods = clazz.getDeclaredMethods();
- for (final Method declaredMethod : declaredMethods) {
- int modifiers = declaredMethod.getModifiers();
- if(Modifier.isPrivate(modifiers)) {
- methods.add(declaredMethod);
- }
- }
-
- return methods;
- }
-
- public static Set<Field> getPrivateFields(Class clazz) {
- Set<Field> fields = new HashSet<Field>();
- Field[] declaredFields = clazz.getDeclaredFields();
- for (final Field declaredField : declaredFields) {
- int modifiers = declaredField.getModifiers();
- if(Modifier.isPrivate(modifiers)) {
- fields.add(declaredField);
- }
- }
-
- return fields;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.java
deleted file mode 100644
index 453cfa35fe..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/NoConstructorException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when a suitable constructor for a component implementation cannot be found
- *
- * @version $Rev$ $Date$
- */
-public class NoConstructorException extends IntrospectionException {
- private static final long serialVersionUID = 3086706387280694424L;
-
- public NoConstructorException() {
- }
-
- public NoConstructorException(String message) {
- super(message);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
deleted file mode 100644
index 954a3abbc8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessor.java
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Callback;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.osoa.sca.annotations.PolicySets;
-import org.osoa.sca.annotations.Requires;
-
-/**
- * Processes an {@link org.osoa.sca.annotations.Requires} annotation
- *
- * @version $Rev$ $Date$
- */
-public class PolicyProcessor extends BaseJavaClassVisitor {
-
- private PolicyFactory policyFactory;
-
- public PolicyProcessor(AssemblyFactory assemblyFactory, PolicyFactory policyFactory) {
- super(assemblyFactory);
- this.policyFactory = policyFactory;
- }
-
- private QName getQName(String intentName) {
- QName qname;
- if (intentName.startsWith("{")) {
- int i = intentName.indexOf('}');
- if (i != -1) {
- qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
- } else {
- qname = new QName("", intentName);
- }
- } else {
- qname = new QName("", intentName);
- }
- return qname;
- }
-
- /**
- * Read policy intents on the given interface or class
- * @param clazz
- * @param requiredIntents
- */
- private void readIntentsAndPolicySets(Class<?> clazz,
- List<Intent> requiredIntents,
- List<PolicySet> policySets) {
- Requires intentAnnotation = clazz.getAnnotation(Requires.class);
- if (intentAnnotation != null) {
- String[] intentNames = intentAnnotation.value();
- if (intentNames.length != 0) {
- for (String intentName : intentNames) {
-
- // Add each intent to the list
- Intent intent = policyFactory.createIntent();
- intent.setName(getQName(intentName));
- requiredIntents.add(intent);
- }
- }
- }
-
- PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
- if (policySetAnnotation != null) {
- String[] policySetNames = policySetAnnotation.value();
- if (policySetNames.length != 0) {
- for (String policySetName : policySetNames) {
-
- // Add each intent to the list
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(getQName(policySetName));
- policySets.add(policySet);
- }
- }
- }
- }
-
- private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
- //Requires intentAnnotation = method.getAnnotation(Requires.class);
- if (intentAnnotation != null) {
- String[] intentNames = intentAnnotation.value();
- if (intentNames.length != 0) {
- //Operation operation = assemblyFactory.createOperation();
- //operation.setName(method.getName());
- //operation.setUnresolved(true);
- for (String intentName : intentNames) {
-
- // Add each intent to the list, associated with the
- // operation corresponding to the annotated method
- Intent intent = policyFactory.createIntent();
- intent.setName(getQName(intentName));
- //intent.getOperations().add(operation);
- requiredIntents.add(intent);
- }
- }
- }
- }
-
- private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
- if (policySetAnnotation != null) {
- String[] policySetNames = policySetAnnotation.value();
- if (policySetNames.length != 0) {
- //Operation operation = assemblyFactory.createOperation();
- //operation.setName(method.getName());
- //operation.setUnresolved(true);
- for (String policySetName : policySetNames) {
- // Add each intent to the list, associated with the
- // operation corresponding to the annotated method
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(getQName(policySetName));
- //intent.getOperations().add(operation);
- policySets.add(policySet);
- }
- }
- }
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
-
- // Read intents on the Java implementation class
- if ( type instanceof PolicySetAttachPoint ) {
- readIntentsAndPolicySets(clazz,
- ((PolicySetAttachPoint)type).getRequiredIntents(),
- ((PolicySetAttachPoint)type).getPolicySets());
- }
-
- // Process annotations on the service interfaces
- //TODO This will have to move to a JavaInterface introspector later
- for (Service service: type.getServices()) {
- InterfaceContract interfaceContract = service.getInterfaceContract();
- if (interfaceContract instanceof JavaInterfaceContract) {
- JavaInterfaceContract javaInterfaceContract = (JavaInterfaceContract)interfaceContract;
-
- // Read intents on the service interface
- if (javaInterfaceContract.getInterface() != null) {
- JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
- if (javaInterface.getJavaClass() != null) {
- readIntentsAndPolicySets(javaInterface.getJavaClass(),
- service.getRequiredIntents(),
- service.getPolicySets());
-
- // Read intents on the service interface methods
- Method[] methods = javaInterface.getJavaClass().getMethods();
- ConfiguredOperation confOp = null;
- for (Method method: methods) {
- if ( method.getAnnotation(Requires.class) != null ||
- method.getAnnotation(PolicySets.class) != null ) {
- confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- confOp.setContractName(service.getName());
-
- service.getConfiguredOperations().add(confOp);
- readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
- readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
- }
- }
- }
-
- }
-
- // Read intents on the callback interface
- if (javaInterfaceContract.getCallbackInterface() != null) {
- JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
- if (javaCallbackInterface.getJavaClass() != null) {
- Callback callback = service.getCallback();
- if (callback == null) {
- callback = assemblyFactory.createCallback();
- service.setCallback(callback);
- }
- readIntentsAndPolicySets(javaCallbackInterface.getJavaClass(),
- callback.getRequiredIntents(),
- callback.getPolicySets());
-
- // Read intents on the callback interface methods
- Method[] methods = javaCallbackInterface.getJavaClass().getMethods();
- ConfiguredOperation confOp = null;
- for (Method method: methods) {
- confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- callback.getConfiguredOperations().add(confOp);
- readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
- readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
- }
- }
- }
- }
- }
- }
-
- private Reference getReference(Method method, JavaImplementation type) {
- //since the ReferenceProcessor is called ahead of the PolicyProcessor the type should have
- //picked up the reference setter method
- org.osoa.sca.annotations.Reference annotation =
- method.getAnnotation(org.osoa.sca.annotations.Reference.class);
- if (annotation != null) {
- if (JavaIntrospectionHelper.isSetter(method)) {
- String name = annotation.name();
- if ("".equals(name)) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- }
- return getReferenceByName(name, type);
- }
- }
- return null;
- }
-
- private Reference getReferenceByName(String name, JavaImplementation type) {
- for ( Reference reference : type.getReferences() ) {
- if ( reference.getName().equals(name) ) {
- return reference;
- }
- }
- return null;
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- org.osoa.sca.annotations.Reference annotation =
- field.getAnnotation( org.osoa.sca.annotations.Reference.class);
- if (annotation == null) {
- return;
- }
- String name = annotation.name();
- if ("".equals(name)) {
- name = field.getName();
- }
-
- Reference reference = null;
- if ( (reference = getReferenceByName(name, type)) != null ) {
- readIntents(field.getAnnotation(Requires.class), reference.getRequiredIntents());
- readPolicySets(field.getAnnotation(PolicySets.class), reference.getPolicySets());
- }
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- Reference reference = null;
- if ( (reference = getReference(method, type)) != null ) {
- readIntents(method.getAnnotation(Requires.class), reference.getRequiredIntents());
- readPolicySets(method.getAnnotation(PolicySets.class), reference.getPolicySets());
- } else {
- if ( type instanceof OperationsConfigurator ) {
- //Read the intents specified on the given implementation method
- if ( (method.getAnnotation(Requires.class) != null ||
- method.getAnnotation(PolicySets.class) != null ) &&
- (type instanceof PolicySetAttachPoint )) {
- ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
-
-
- readIntents(method.getAnnotation(Requires.class), confOp.getRequiredIntents());
- readPolicySets(method.getAnnotation(PolicySets.class), confOp.getPolicySets());
- }
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.java
deleted file mode 100644
index cf1b4a9830..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessor.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.osoa.sca.annotations.Property;
-
-/**
- * Processes an {@link @Property} annotation, updating the component type with
- * corresponding {@link JavaMappedProperty}
- *
- * @version $Rev$ $Date$
- */
-public class PropertyProcessor extends AbstractPropertyProcessor<Property> {
-
- public PropertyProcessor(AssemblyFactory assemblyFactory) {
- super(assemblyFactory, Property.class);
- }
-
- @Override
- protected String getName(Property annotation) {
- return annotation.name();
- }
-
- @Override
- protected void initProperty(org.apache.tuscany.sca.assembly.Property property, Property annotation) {
- property.setMustSupply(annotation.required());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.java
deleted file mode 100644
index a1f8a766ae..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessor.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.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * Processes an {@link @Reference} annotation, updating the component type with
- * corresponding {@link
- * org.apache.tuscany.spi.implementation.java.JavaMappedReference}
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceProcessor extends BaseJavaClassVisitor {
- private JavaInterfaceFactory javaFactory;
-
- public ReferenceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- super(assemblyFactory);
- this.javaFactory = javaFactory;
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- Reference annotation = method.getAnnotation(Reference.class);
- if (annotation == null) {
- return; // Not a reference annotation.
- }
- if (!JavaIntrospectionHelper.isSetter(method)) {
- throw new IllegalReferenceException("Annotated method is not a setter: " + method, method);
- }
- String name = annotation.name();
- if ("".equals(name)) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- }
- JavaElementImpl ref = type.getReferenceMembers().get(name);
- // Setter override field
- if (ref != null && ref.getElementType() != ElementType.FIELD) {
- throw new DuplicateReferenceException(name);
- }
- removeReference(ref, type);
-
- JavaElementImpl element = new JavaElementImpl(method, 0);
- org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
- type.getReferences().add(reference);
- type.getReferenceMembers().put(name, element);
- }
-
- private boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
- if (ref == null) {
- return false;
- }
- List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
- for (int i = 0; i < refs.size(); i++) {
- if (refs.get(i).getName().equals(ref.getName())) {
- refs.remove(i);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- Reference annotation = field.getAnnotation(Reference.class);
- if (annotation == null) {
- return;
- }
- String name = annotation.name();
- if ("".equals(name)) {
- name = field.getName();
- }
- JavaElementImpl ref = type.getReferenceMembers().get(name);
- if (ref != null && ref.getElementType() == ElementType.FIELD) {
- throw new DuplicateReferenceException(name);
- }
-
- // Setter method override field
- if (ref == null) {
- JavaElementImpl element = new JavaElementImpl(field);
- org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
- type.getReferences().add(reference);
- type.getReferenceMembers().put(name, element);
- }
- }
-
- @Override
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
- throws IntrospectionException {
- Reference refAnnotation = parameter.getAnnotation(Reference.class);
- if (refAnnotation == null) {
- return;
- }
- String paramName = parameter.getName();
- String name = getReferenceName(paramName, parameter.getIndex(), refAnnotation.name());
- JavaElementImpl ref = type.getReferenceMembers().get(name);
-
- // Setter override field
- if (ref != null && ref.getElementType() != ElementType.FIELD) {
- throw new DuplicateReferenceException(name);
- }
-
- removeReference(ref, type);
- org.apache.tuscany.sca.assembly.Reference reference = createReference(parameter, name);
- type.getReferences().add(reference);
- type.getReferenceMembers().put(name, parameter);
- parameter.setClassifer(Reference.class);
- parameter.setName(name);
- }
-
- private String getReferenceName(String paramName, int pos, String name) throws InvalidConstructorException {
- if ("".equals(name)) {
- name = paramName;
- }
- if ("".equals(name)) {
- return "_ref" + pos;
- }
- if (!"".equals(paramName) && !name.equals(paramName)) {
- throw new InvalidConstructorException("Mismatching names specified for reference parameter " + pos);
- } else {
- return name;
- }
- }
-
- private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name)
- throws IntrospectionException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- // reference.setMember((Member)element.getAnchor());
- boolean required = true;
- Reference ref = element.getAnnotation(Reference.class);
- if (ref != null) {
- required = ref.required();
- }
- // reference.setRequired(required);
- reference.setName(name);
- Class<?> rawType = element.getType();
- if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
- if (required) {
- reference.setMultiplicity(Multiplicity.ONE_N);
- } else {
- reference.setMultiplicity(Multiplicity.ZERO_N);
- }
- } else {
- if (required) {
- reference.setMultiplicity(Multiplicity.ONE_ONE);
- } else {
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- }
- }
- Type genericType = element.getGenericType();
- Class<?> baseType = getBaseType(rawType, genericType);
- if (CallableReference.class.isAssignableFrom(baseType)) {
- if (Collection.class.isAssignableFrom(rawType)) {
- genericType = JavaIntrospectionHelper.getParameterType(genericType);
- }
- baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
- }
- try {
- JavaInterface callInterface = javaFactory.createJavaInterface(baseType);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- return reference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.java
deleted file mode 100644
index 3d43e39ce8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/Resource.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.implementation.java.introspect.impl;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a resource should be provided to an implementation by the runtime.
- *
- * @version $Rev$ $Date$
- */
-@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Resource {
-
- /**
- * Denotes the name of the resource declared by the implementation.
- */
- String name() default "";
-
- /**
- * Denotes if the resource is optional
- */
- boolean optional() default false;
-
- /**
- * Denotes the default name of the resource provided by the runtime environment.
- */
- String mappedName() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
deleted file mode 100644
index e15f9a0d6a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-
-/**
- * Processes an {@link @Resource} annotation, updating the component type with
- * corresponding {@link org.apache.tuscany.spi.implementation.java.JavaResourceImpl}
- *
- * @version $Rev$ $Date$
- */
-public class ResourceProcessor extends BaseJavaClassVisitor {
-
- public ResourceProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = method
- .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- if (annotation == null) {
- return;
- }
- if (method.getParameterTypes().length != 1) {
- throw new IllegalResourceException("Resource setter must have one parameter", method);
- }
- String name = annotation.name();
- if (name.length() < 1) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- }
- if (type.getResources().get(name) != null) {
- throw new DuplicateResourceException(name);
- }
-
- String mappedName = annotation.mappedName();
- JavaResourceImpl resource = createResource(name, new JavaElementImpl(method, 0));
- resource.setOptional(annotation.optional());
- if (mappedName.length() > 0) {
- resource.setMappedName(mappedName);
- }
- type.getResources().put(resource.getName(), resource);
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
-
- org.apache.tuscany.sca.implementation.java.introspect.impl.Resource annotation = field
- .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- if (annotation == null) {
- return;
- }
- String name = annotation.name();
- if (name.length() < 1) {
- name = field.getName();
- }
- if (type.getResources().get(name) != null) {
- throw new DuplicateResourceException(name);
- }
-
- String mappedName = annotation.mappedName();
-
- JavaResourceImpl resource = createResource(name, new JavaElementImpl(field));
- resource.setOptional(annotation.optional());
- if (mappedName.length() > 0) {
- resource.setMappedName(mappedName);
- }
- type.getResources().put(resource.getName(), resource);
- }
-
- @SuppressWarnings("unchecked")
- public JavaResourceImpl createResource(String name, JavaElementImpl element) {
- element.setClassifer(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- element.setName(name);
- return new JavaResourceImpl(element);
- }
-
- @Override
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
- throws IntrospectionException {
- org.apache.tuscany.sca.implementation.java.introspect.impl.Resource resourceAnnotation = parameter
- .getAnnotation(org.apache.tuscany.sca.implementation.java.introspect.impl.Resource.class);
- if (resourceAnnotation != null) {
- String name = resourceAnnotation.name();
- if ("".equals(name)) {
- name = parameter.getName();
- }
- if ("".equals(name)) {
- throw new InvalidResourceException("Missing resource name", (Member)parameter.getAnchor());
- }
-
- if (!"".equals(parameter.getName()) && !name.equals(parameter.getName())) {
- throw new InvalidConstructorException("Mismatched resource name: " + parameter);
- }
-
- if (type.getResources().get(name) != null) {
- throw new DuplicateResourceException(name);
- }
-
- String mappedName = resourceAnnotation.mappedName();
-
- JavaResourceImpl resource = createResource(name, parameter);
- resource.setOptional(resourceAnnotation.optional());
- if (mappedName.length() > 0) {
- resource.setMappedName(mappedName);
- }
- type.getResources().put(resource.getName(), resource);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.java
deleted file mode 100644
index a3d3889d30..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessor.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
-
-/**
- * Processes the {@link JavaScopeImpl} annotation and updates the component type with the corresponding implmentation scope
- *
- * @version $Rev$ $Date$
- */
-public class ScopeProcessor extends BaseJavaClassVisitor {
-
- public ScopeProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz,
- JavaImplementation type)
- throws IntrospectionException {
- org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
- if (annotation == null) {
- type.setJavaScope(JavaScopeImpl.STATELESS);
- return;
- }
- String name = annotation.value();
- JavaScopeImpl scope;
- if ("COMPOSITE".equals(name)) {
- scope = JavaScopeImpl.COMPOSITE;
- } else if ("SESSION".equals(name)) {
- scope = JavaScopeImpl.SESSION;
- } else if ("CONVERSATION".equals(name)) {
- scope = JavaScopeImpl.CONVERSATION;
- } else if ("REQUEST".equals(name)) {
- scope = JavaScopeImpl.REQUEST;
- } else {
- scope = new JavaScopeImpl(name);
- }
- type.setJavaScope(scope);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
deleted file mode 100644
index 6854acdc2a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessor.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.jws.WebService;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Processes an {@link org.osoa.sca.annotations.Service} annotation and updates
- * the component type with corresponding {@link Service}s. Also processes
- * related {@link org.osoa.sca.annotations.Callback} annotations.
- *
- * @version $Rev$ $Date$
- */
-public class ServiceProcessor extends BaseJavaClassVisitor {
- private static final Logger logger = Logger.getLogger(ServiceProcessor.class.getName());
- private JavaInterfaceFactory javaFactory;
-
- public ServiceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- super(assemblyFactory);
- this.javaFactory = javaFactory;
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- org.osoa.sca.annotations.Service annotation = clazz.getAnnotation(org.osoa.sca.annotations.Service.class);
- if (annotation == null) {
- // scan interfaces for remotable
- Set<Class> interfaces = getAllInterfaces(clazz);
- for (Class<?> interfaze : interfaces) {
- if (interfaze.isAnnotationPresent(Remotable.class)
- || interfaze.isAnnotationPresent(WebService.class)
- || interfaze.isAnnotationPresent(Callback.class)
- ) {
- Service service;
- try {
- service = createService(interfaze);
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- type.getServices().add(service);
- }
- }
- return;
- }
- Class<?>[] interfaces = annotation.interfaces();
- if (interfaces.length == 0) {
- Class<?> interfaze = annotation.value();
- if (Void.class.equals(interfaze)) {
- //throw new IllegalServiceDefinitionException("No interfaces specified");
- logger.warning("Ignoring @Service annotation. No interfaces specified. class = "+clazz.getName());
- } else {
- interfaces = new Class<?>[1];
- interfaces[0] = interfaze;
- }
- }
- for (Class<?> interfaze : interfaces) {
- try {
- Service service = createService(interfaze);
- type.getServices().add(service);
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- }
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
-
- Callback annotation = method.getAnnotation(Callback.class);
- if (annotation == null) {
- return;
- }
- if(Modifier.isPrivate(method.getModifiers())) {
- throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+method, method);
- }
- if (method.getParameterTypes().length != 1) {
- throw new IllegalCallbackReferenceException("Setter must have one parameter", method);
- }
- JavaElementImpl element = new JavaElementImpl(method, 0);
- createCallback(type, element);
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
-
- Callback annotation = field.getAnnotation(Callback.class);
- if (annotation == null) {
- return;
- }
- if(Modifier.isPrivate(field.getModifiers())) {
- throw new IllegalCallbackReferenceException("Illegal annotation @Callback found on "+field, field);
- }
- JavaElementImpl element = new JavaElementImpl(field);
- createCallback(type, element);
- }
-
- /**
- * @param type
- * @param element
- * @throws IllegalCallbackReferenceException
- */
- private void createCallback(JavaImplementation type, JavaElementImpl element)
- throws IllegalCallbackReferenceException {
- Service callbackService = null;
- Class<?> callbackClass = element.getType();
- Type genericType = element.getGenericType();
- Class<?> baseType = callbackClass;
- if(CallableReference.class.isAssignableFrom(baseType)) {
- // @Callback protected CallableReference<MyCallback> callback;
- // The base type will be MyCallback
- baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
- }
- for (Service service : type.getServices()) {
- JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
- if (javaInterface != null && baseType == javaInterface.getJavaClass()) {
- callbackService = service;
- }
- }
- if (callbackService == null) {
- throw new IllegalCallbackReferenceException("Callback type does not match a service callback interface: " + type.getName() );
- }
- if(type.getCallbackMembers().get(baseType.getName()) == null) {
- type.getCallbackMembers().put(baseType.getName(), new ArrayList<JavaElementImpl>());
- }
- type.getCallbackMembers().get(baseType.getName()).add(element);
- }
-
- public Service createService(Class<?> interfaze) throws InvalidInterfaceException {
- Service service = assemblyFactory.createService();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- // create a relative URI
- service.setName(interfaze.getSimpleName());
-
- JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
- service.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- return service;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.java
deleted file mode 100644
index e1ca3ea565..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceTypeNotFoundException.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-
-/**
- * Thrown when a service interface cannot be determined based on a heuristic evaluation of an implementation
- *
- * @version $Rev$ $Date$
- */
-public class ServiceTypeNotFoundException extends IntrospectionException {
- private static final long serialVersionUID = -5124437274726947007L;
-
- public ServiceTypeNotFoundException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java b/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.java
deleted file mode 100644
index 57d224b2bf..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/UnknownContextTypeException.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.implementation.java.introspect.impl;
-
-/**
- * Thrown when a method or field marked with {@link org.osoa.sca.annotations.Context} takes an unknown type
- *
- * @version $Rev$ $Date$
- */
-public class UnknownContextTypeException extends IllegalContextException {
- private static final long serialVersionUID = 8125863714365422419L;
-
- public UnknownContextTypeException(String message) {
- super(message);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index df60d57cf9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.implementation.java.impl.JavaImplementationActivator
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
deleted file mode 100644
index dc9de12632..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.java.JavaImplementationFactory
+++ /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.implementation.java.DefaultJavaImplementationFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java
deleted file mode 100644
index fe93424d28..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractProcessorTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * Base class to simulate the processor sequences
- *
- * @version $Rev$ $Date$
- */
-public class AbstractProcessorTest extends TestCase {
- protected AssemblyFactory factory;
- protected JavaInterfaceFactory javaFactory;
- protected ConstructorProcessor constructorProcessor;
- private ReferenceProcessor referenceProcessor;
- private PropertyProcessor propertyProcessor;
- private ResourceProcessor resourceProcessor;
-
-
- protected AbstractProcessorTest() {
- factory = new DefaultAssemblyFactory();
- javaFactory = new DefaultJavaInterfaceFactory();
- referenceProcessor = new ReferenceProcessor(factory, javaFactory);
- propertyProcessor = new PropertyProcessor(factory);
- resourceProcessor = new ResourceProcessor(factory);
- constructorProcessor = new ConstructorProcessor(factory);
- referenceProcessor = new ReferenceProcessor(factory, javaFactory);
- propertyProcessor = new PropertyProcessor(factory);
- }
-
- protected <T> void visitConstructor(Constructor<T> constructor,
- JavaImplementation type) throws IntrospectionException {
- constructorProcessor.visitConstructor(constructor, type);
- JavaConstructorImpl<?> definition = type.getConstructor();
- if (definition == null) {
- definition = new JavaConstructorImpl<T>(constructor);
- type.getConstructors().put(constructor, definition);
- }
- JavaParameterImpl[] parameters = definition.getParameters();
- for (int i = 0; i < parameters.length; i++) {
- referenceProcessor.visitConstructorParameter(parameters[i], type);
- propertyProcessor.visitConstructorParameter(parameters[i], type);
- resourceProcessor.visitConstructorParameter(parameters[i], type);
- // monitorProcessor.visitConstructorParameter(parameters[i], type);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
deleted file mode 100644
index 5beb31f0f9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AbstractPropertyProcessorTestCase.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
-
-import java.lang.annotation.Retention;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class AbstractPropertyProcessorTestCase extends TestCase {
-
- private JavaClassVisitor extension;
- private JavaImplementationFactory javaImplementationFactory;
-
- public void testVisitMethod() throws Exception {
- Method method = Foo.class.getMethod("setBar", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- extension.visitMethod(method, type);
- Property prop = getProperty(type, "test");
- assertNotNull(prop);
- }
-
- public void testVisitNoParamsMethod() throws Exception {
- Method method = Foo.class.getMethod("setNoParamsBar");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- extension.visitMethod(method, type);
- fail();
- } catch (IllegalPropertyException e) {
- // expected
- }
- }
-
- public void testVisitNonVoidMethod() throws Exception {
- Method method = Foo.class.getMethod("setBadBar", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- extension.visitMethod(method, type);
- fail();
- } catch (IllegalPropertyException e) {
- // expected
- }
- }
-
- public void testDuplicateMethod() throws Exception {
- Method method = Foo.class.getMethod("setBar", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- extension.visitMethod(method, type);
- try {
- extension.visitMethod(method, type);
- fail();
- } catch (DuplicatePropertyException e) {
- // expected
- }
- }
-
- public void testVisitField() throws Exception {
- Field field = Foo.class.getDeclaredField("d");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- extension.visitField(field, type);
- Property prop = getProperty(type, "test");
- assertNotNull(prop);
- }
-
- public void testVisitConstructor() throws Exception {
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- JavaConstructorImpl<Foo> def = new JavaConstructorImpl<Foo>(ctor);
- JavaParameterImpl parameter = def.getParameters()[0];
- extension.visitConstructorParameter(parameter, type);
- assertEquals("test", def.getParameters()[0].getName());
- assertNotNull(getProperty(type, "test"));
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void setUp() throws Exception {
- super.setUp();
- extension = new TestProcessor();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- }
-
- @Retention(RUNTIME)
- private @interface Bar {
-
- }
-
- private class TestProcessor extends AbstractPropertyProcessor<Bar> {
-
- public TestProcessor() {
- super(new DefaultAssemblyFactory(), Bar.class);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected void initProperty(Property property, Bar annotation) {
- // property.setDefaultValueFactory(EasyMock.createMock(ObjectFactory.class));
- property.setName("test");
- }
-
- @Override
- protected String getName(Bar annotation) {
- return "test";
- }
- }
-
- private static class Foo {
-
- @Bar
- protected String d;
-
- public Foo(String a, @Bar
- String b) {
- }
-
- public Foo(@Bar
- String d) {
- this.d = d;
- }
-
- @Bar
- public void setBar(String d) {
- this.d = d;
- }
-
- @Bar
- public void setNoParamsBar() {
- }
-
- @Bar
- public String setBadBar(String d) {
- return null;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.java
deleted file mode 100644
index e5abb07760..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/AllowsPassByReferenceProcessorTestCase.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.AllowsPassByReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class AllowsPassByReferenceProcessorTestCase extends TestCase {
-
- JavaImplementation type;
- AllowsPassByReferenceProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public void testClassAnnotation() throws Exception {
- processor.visitClass(Foo.class, type);
- assertEquals(true, type.isAllowsPassByReference());
-
- processor.visitClass(Bar.class, type);
- assertEquals(false, type.isAllowsPassByReference());
-
- Method m1 = Bar.class.getMethod("m1", new Class[] {});
- processor.visitMethod(m1, type);
- assertTrue(type.isAllowsPassByReference(m1));
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- processor = new AllowsPassByReferenceProcessor(new DefaultAssemblyFactory());
- }
-
- @AllowsPassByReference
- private class Foo {
- }
-
- // no annotation
- private class Bar {
- @AllowsPassByReference
- public void m1() {
-
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
deleted file mode 100644
index fa1527fbe5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorProcessorTestCase.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
-
-import java.lang.reflect.Constructor;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConstructorProcessorTestCase extends TestCase {
- private ConstructorProcessor processor = new ConstructorProcessor(new DefaultAssemblyFactory());
-
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testDuplicateConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitClass(BadFoo.class, type);
- fail();
- } catch (DuplicateConstructorException e) {
- // expected
- }
- }
-
- public void testConstructorAnnotation() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor1 = Foo.class.getConstructor(String.class);
- processor.visitConstructor(ctor1, type);
- assertEquals("foo", type.getConstructor().getParameters()[0].getName());
- }
-
- public void testNoAnnotation() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<NoAnnotation> ctor1 = NoAnnotation.class.getConstructor();
- processor.visitConstructor(ctor1, type);
- assertNull(type.getConstructor());
- }
-
- public void testBadAnnotation() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadAnnotation> ctor1 = BadAnnotation.class.getConstructor(String.class, Foo.class);
- try {
- processor.visitConstructor(ctor1, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- public void testMixedParameters() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Mixed> ctor1 = Mixed.class.getConstructor(String.class, String.class, String.class);
- processor.visitConstructor(ctor1, type);
-
- AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
- ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
- PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
- JavaParameterImpl[] parameters = type.getConstructor().getParameters();
- for (int i = 0; i < parameters.length; i++) {
- referenceProcessor.visitConstructorParameter(parameters[i], type);
- propertyProcessor.visitConstructorParameter(parameters[i], type);
- }
-
- assertEquals("_ref0", parameters[0].getName());
- assertEquals("foo", parameters[1].getName());
- assertEquals("bar", parameters[2].getName());
- }
-
- private static class BadFoo {
-
- @org.osoa.sca.annotations.Constructor("foo")
- public BadFoo(String foo) {
-
- }
-
- @org.osoa.sca.annotations.Constructor( {"foo", "bar"})
- public BadFoo(String foo, String bar) {
-
- }
- }
-
- private static class Foo {
- @org.osoa.sca.annotations.Constructor("foo")
- public Foo(String foo) {
-
- }
- }
-
- private static class NoAnnotation {
- public NoAnnotation() {
- }
- }
-
- private static class BadAnnotation {
- @org.osoa.sca.annotations.Constructor("foo")
- public BadAnnotation(String foo, Foo ref) {
- }
- }
-
- public static final class Mixed {
- @org.osoa.sca.annotations.Constructor
- public Mixed(@Reference
- String param1, @Property(name = "foo")
- String param2, @Reference(name = "bar")
- String param3) {
- }
- }
-
- public static final class Multiple {
- @org.osoa.sca.annotations.Constructor
- public Multiple(@Reference
- Collection<String> param1, @Property(name = "foo")
- String[] param2, @Reference(name = "bar", required = true)
- List<String> param3, @Property(name = "abc")
- Set<String> param4, @Reference(name = "xyz")
- String[] param5) {
- }
- }
-
- public void testMultiplicity() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Multiple> ctor1 = Multiple.class.getConstructor(Collection.class,
- String[].class,
- List.class,
- Set.class,
- String[].class);
- processor.visitConstructor(ctor1, type);
- AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
- ReferenceProcessor referenceProcessor = new ReferenceProcessor(assemblyFactory, javaFactory);
- PropertyProcessor propertyProcessor = new PropertyProcessor(assemblyFactory);
- JavaParameterImpl[] parameters = type.getConstructor().getParameters();
- for (int i = 0; i < parameters.length; i++) {
- referenceProcessor.visitConstructorParameter(parameters[i], type);
- propertyProcessor.visitConstructorParameter(parameters[i], type);
- }
-
- org.apache.tuscany.sca.assembly.Reference ref0 = getReference(type, "_ref0");
- assertNotNull(ref0);
- assertEquals(Multiplicity.ONE_N, ref0.getMultiplicity());
- org.apache.tuscany.sca.assembly.Reference ref1 = getReference(type, "bar");
- assertNotNull(ref1);
- assertEquals(Multiplicity.ONE_N, ref1.getMultiplicity());
- org.apache.tuscany.sca.assembly.Reference ref2 = getReference(type, "xyz");
- assertNotNull(ref2);
- assertEquals(Multiplicity.ONE_N, ref2.getMultiplicity());
- org.apache.tuscany.sca.assembly.Property prop1 = getProperty(type, "foo");
- assertNotNull(prop1);
- assertTrue(prop1.isMany());
- org.apache.tuscany.sca.assembly.Property prop2 = getProperty(type, "abc");
- assertNotNull(prop2);
- assertTrue(prop2.isMany());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
deleted file mode 100644
index 690869ccb8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorPropertyTestCase.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.Property;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConstructorPropertyTestCase extends AbstractProcessorTest {
-
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testProperty() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
- visitConstructor(ctor, type);
- org.apache.tuscany.sca.assembly.Property property = getProperty(type, "myProp");
- assertTrue(property.isMustSupply());
- assertEquals("myProp", property.getName());
- }
-
- public void testTwoPropertiesSameType() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
- visitConstructor(ctor, type);
- assertNotNull(getProperty(type, "myProp1"));
- assertNotNull(getProperty(type, "myProp2"));
- }
-
- public void testDuplicateProperty() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (DuplicatePropertyException e) {
- // expected
- }
- }
-
- public void testNoName() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidPropertyException e) {
- // expected
- }
- }
-
- public void testNamesOnConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
- visitConstructor(ctor, type);
- assertNotNull(getProperty(type, "myProp"));
- }
-
- public void testInvalidNumberOfNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- public void testNoMatchingNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
-// public void testMultiplicityRequired() throws Exception {
- // TODO multiplicity
-// }
-
- private static class Foo {
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Property(name = "myProp", required = true)String prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myProp")
- public Foo(@Property Integer prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Property(name = "myProp1")String prop1, @Property(name = "myProp2")String prop2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Property List prop) {
-
- }
- }
-
- private static class BadFoo {
-
- @org.osoa.sca.annotations.Constructor()
- public BadFoo(@Property(name = "myProp")String prop1, @Property(name = "myProp")String prop2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor()
- public BadFoo(@Property String prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myProp")
- public BadFoo(@Property Integer prop, @Property Integer prop2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
- public BadFoo(@Property List ref, @Property(name = "myOtherRef")List ref2) {
-
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
deleted file mode 100644
index 8c10df2146..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorReferenceTestCase.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConstructorReferenceTestCase extends AbstractProcessorTest {
-
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testReference() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
- visitConstructor(ctor, type);
- org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "myRef");
- assertEquals(Multiplicity.ONE_ONE, reference.getMultiplicity());
- assertEquals("myRef", reference.getName());
- }
-
- public void testTwoReferencesSameType() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
- visitConstructor(ctor, type);
- assertNotNull(getReference(type, "myRef1"));
- assertNotNull(getReference(type, "myRef2"));
- }
-
- public void testDuplicateProperty() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (DuplicateReferenceException e) {
- // expected
- }
- }
-
- public void testNoName() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<NoNameFoo> ctor = NoNameFoo.class.getConstructor(String.class);
- visitConstructor(ctor, type);
- assertNotNull(getReference(type, "_ref0"));
- }
-
- public void testNamesOnConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
- visitConstructor(ctor, type);
- assertNotNull(getReference(type, "myRef"));
- }
-
- public void testInvalidNumberOfNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(Integer.class, Integer.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- public void testNoMatchingNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(List.class, List.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
-// public void testMultiplicityRequired() throws Exception {
- // TODO multiplicity
-// }
-
- private static class Foo {
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Reference(name = "myRef", required = true)String prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Reference(name = "myRef1")String prop1, @Reference(name = "myRef2")String prop2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myRef")
- public Foo(@Reference Integer prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor()
- public Foo(@Reference List prop) {
-
- }
- }
-
- private static class NoNameFoo {
-
- @org.osoa.sca.annotations.Constructor
- public NoNameFoo(@Reference String prop) {
-
- }
- }
-
- private static class BadFoo {
-
- @org.osoa.sca.annotations.Constructor
- public BadFoo(@Reference(name = "myRef")String prop1, @Reference(name = "myRef")String prop2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor
- public BadFoo(@Reference String prop) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myRef")
- public BadFoo(@Reference Integer ref, @Reference Integer ref2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor({"myRef", "myRef2"})
- public BadFoo(@Reference List ref, @Reference(name = "myOtherRef")List ref2) {
-
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
deleted file mode 100644
index 365fb12afe..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConstructorResourceTestCase.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-import java.util.List;
-
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConstructorResourceTestCase extends AbstractProcessorTest {
-
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testResource() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
- visitConstructor(ctor, type);
- org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl resource = type.getResources().get("myResource");
- assertFalse(resource.isOptional());
- }
-
- public void testTwoResourcesSameType() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
- visitConstructor(ctor, type);
- assertNotNull(type.getResources().get("myResource1"));
- assertNotNull(type.getResources().get("myResource2"));
- }
-
- public void testDuplicateResource() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (DuplicateResourceException e) {
- // expected
- }
- }
-
- public void testNoName() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ConstructorResourceTestCase.BadFoo> ctor =
- ConstructorResourceTestCase.BadFoo.class.getConstructor(String.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidResourceException e) {
- // expected
- }
- }
-
- public void testNamesOnConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
- visitConstructor(ctor, type);
- assertNotNull(type.getResources().get("myResource"));
- }
-
- public void testInvalidNumberOfNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ConstructorResourceTestCase.BadFoo> ctor =
- ConstructorResourceTestCase.BadFoo.class.getConstructor(Integer.class, Integer.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- public void testNoMatchingNames() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ConstructorResourceTestCase.BadFoo> ctor =
- ConstructorResourceTestCase.BadFoo.class.getConstructor(List.class, List.class);
- try {
- visitConstructor(ctor, type);
- fail();
- } catch (InvalidConstructorException e) {
- // expected
- }
- }
-
- private static class Foo {
-
- @org.osoa.sca.annotations.Constructor
- public Foo(@Resource(name = "myResource") String resource) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myResource")
- public Foo(@Resource Integer resource) {
-
- }
-
- @org.osoa.sca.annotations.Constructor
- public Foo(@Resource(name = "myResource1") String res1, @Resource(name = "myResource2") String res2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor
- public Foo(@Resource List res) {
-
- }
- }
-
- private static class BadFoo {
-
- @org.osoa.sca.annotations.Constructor
- public BadFoo(@Resource(name = "myResource") String res1, @Resource(name = "myResource") String res2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor
- public BadFoo(@Resource String res) {
-
- }
-
- @org.osoa.sca.annotations.Constructor("myProp")
- public BadFoo(@Resource Integer res, @Resource Integer res2) {
-
- }
-
- @org.osoa.sca.annotations.Constructor({"myRes", "myRes2"})
- public BadFoo(@Resource List res, @Resource(name = "myOtherRes") List res2) {
-
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
deleted file mode 100644
index f77c9abad9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ContextProcessorTestCase.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.annotations.ComponentName;
-import org.osoa.sca.annotations.Context;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ContextProcessorTestCase extends TestCase {
- private ContextProcessor processor;
- private ComponentNameProcessor nameProcessor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public void testComponentContextMethod() throws Exception {
- Method method = Foo.class.getMethod("setContext", ComponentContext.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitMethod(method, type);
- assertNotNull(type.getResources().get("context"));
- }
-
- public void testComponentContextField() throws Exception {
- Field field = Foo.class.getDeclaredField("context");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitField(field, type);
- assertNotNull(type.getResources().get("context"));
- }
-
- public void testRequestContextMethod() throws Exception {
- Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitMethod(method, type);
- assertNotNull(type.getResources().get("requestContext"));
- }
-
- public void testRequestContextField() throws Exception {
- Field field = Foo.class.getDeclaredField("requestContext");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitField(field, type);
- assertNotNull(type.getResources().get("requestContext"));
- }
-
- public void testComponentNameMethod() throws Exception {
- Method method = Foo.class.getMethod("setName", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- nameProcessor.visitMethod(method, type);
- assertNotNull(type.getResources().get("name"));
- }
-
- public void testComponentNameField() throws Exception {
- Field field = Foo.class.getDeclaredField("name");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- nameProcessor.visitField(field, type);
- assertNotNull(type.getResources().get("name"));
- }
-
- public void testInvalidParamType() throws Exception {
- Method method = Foo.class.getMethod("setContext", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (UnknownContextTypeException e) {
- // expected
- }
- }
-
- public void testInvalidParamTypeField() throws Exception {
- Field field = Foo.class.getDeclaredField("badContext");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitField(field, type);
- fail();
- } catch (UnknownContextTypeException e) {
- // expected
- }
- }
-
-
- public void testInvalidParamNum() throws Exception {
- Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalContextException e) {
- // expected
- }
- }
-
- public void testInvalidNoParams() throws Exception {
- Method method = Foo.class.getMethod("setContext");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalContextException e) {
- // expected
- }
- }
-
- public void testNoContext() throws Exception {
- Method method = Foo.class.getMethod("noContext", ComponentContext.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitMethod(method, type);
- assertEquals(0, type.getResources().size());
- }
-
- public void testNoContextField() throws Exception {
- Field field = Foo.class.getDeclaredField("noContext");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitField(field, type);
- assertEquals(0, type.getResources().size());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- processor = new ContextProcessor(new DefaultAssemblyFactory());
- nameProcessor = new ComponentNameProcessor(new DefaultAssemblyFactory());
- }
-
- private class Foo {
- @Context
- protected ComponentContext context;
-
- @ComponentName
- protected String name;
-
- @Context
- protected Object badContext;
-
- protected ComponentContext noContext;
-
- @Context
- protected RequestContext requestContext;
-
- @Context
- public void setContext(ComponentContext context) {
-
- }
-
- @ComponentName
- public void setName(String name) {
-
- }
-
- @Context
- public void setContext(String context) {
-
- }
-
- @Context
- public void setContext(ComponentContext context, String string) {
-
- }
-
- @Context
- public void setContext() {
-
- }
-
- public void noContext(ComponentContext context) {
-
- }
-
- @Context
- public void setRequestContext(RequestContext requestContext) {
- this.requestContext = requestContext;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.java
deleted file mode 100644
index c6b2626e9c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationIDProcessorTestCase.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.ConversationID;
-
-/**
- * Test the ConversationIDProcessor
- *
- * @version $Rev$ $Date$
- */
-public class ConversationIDProcessorTestCase extends TestCase {
- private ConversationIDProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public void testConversationIDMethod() throws Exception {
- Method method = Foo.class.getMethod("setConversationID", String.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitMethod(method, type);
- assertNotNull(type.getResources().get("conversationID"));
- }
-
- public void testConversationIDField() throws Exception {
- Field field = Foo.class.getDeclaredField("cid");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitField(field, type);
- assertNotNull(type.getResources().get("cid"));
- }
-
- public void testConversationIDMethodNotString() throws Exception {
- Method method = Foo.class.getMethod("setConversationID", Long.class);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitMethod(method, type);
- assertNotNull(type.getResources().get("conversationID"));
- }
-
- public void testConversationIDFieldNotString() throws Exception {
- Field field = Foo.class.getDeclaredField("longCID");
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitField(field, type);
- assertNotNull(type.getResources().get("longCID"));
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- processor = new ConversationIDProcessor(new DefaultAssemblyFactory());
- }
-
- private class Foo {
-
- @ConversationID
- protected String cid;
-
- @ConversationID
- public void setConversationID(String cid) {
-
- }
-
- @ConversationID
- protected Long longCID;
-
- @ConversationID
- public void setConversationID(Long cid) {
-
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
deleted file mode 100644
index 4555736813..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConversationProcessorTestCase.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.ConversationAttributes;
-import org.osoa.sca.annotations.ConversationID;
-import org.osoa.sca.annotations.Scope;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationProcessorTestCase extends TestCase {
- private ConversationProcessor processor = new ConversationProcessor(new DefaultAssemblyFactory());
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testMaxIdleTime() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooMaxIdle.class, type);
- assertEquals(10000L, type.getMaxIdleTime());
- assertEquals(-1, type.getMaxAge());
- }
-
- public void testMaxAge() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooMaxAge.class, type);
- assertEquals(10000L, type.getMaxAge());
- assertEquals(-1, type.getMaxIdleTime());
- }
-
- public void testImplicitScope() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(ImplicitFooScope.class, type);
- assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
- }
-
- /* TUSCANY-1999 - apply conversation properties to all scopes
- public void testBadFooScope() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitClass(BadFooScope.class, type);
- fail();
- } catch (InvalidConversationalImplementation e) {
- // expected
- }
- }
- */
-
- public void testBadFooBoth() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(BadFooBoth.class, type);
- assertEquals(10000L, type.getMaxAge());
- assertEquals(10000L, type.getMaxIdleTime());
- }
-
- public void testJustConversation() throws Exception {
- // TODO do we want these semantics
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooJustConversation.class, type);
- assertEquals(org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
- assertEquals(-1, type.getMaxAge());
- assertEquals(-1, type.getMaxIdleTime());
- }
-
- public void testSetConversationIDField() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Field field = FooWithConversationIDField.class.getDeclaredField("conversationID");
- processor.visitField(field, type);
- assertNotNull(type.getConversationIDMembers());
- assertEquals(field, type.getConversationIDMembers().get(0));
- }
-
- public void testSetConversationIDMethod() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
- processor.visitMethod(method, type);
- assertNotNull(type.getConversationIDMembers());
- assertEquals(method, type.getConversationIDMembers().get(0));
- }
-
- @Scope("CONVERSATION")
- @ConversationAttributes(maxIdleTime = "10 seconds")
- private class FooMaxIdle {
- }
-
- @Scope("CONVERSATION")
- @ConversationAttributes(maxAge = "10 seconds")
- private class FooMaxAge {
- }
-
- @Scope("CONVERSATION")
- @ConversationAttributes(maxAge = "10 seconds", maxIdleTime = "10 seconds")
- private class BadFooBoth {
- }
-
- @ConversationAttributes(maxAge = "10 seconds")
- private class ImplicitFooScope {
- }
-
- @Scope("STATELESS")
- @ConversationAttributes(maxAge = "10 seconds")
- private class BadFooScope {
- }
-
- @ConversationAttributes
- private class FooJustConversation {
- }
-
- private class FooWithConversationIDField {
-
- @ConversationID
- String conversationID;
- }
-
- private class FooWithConversationIDMethod {
- @ConversationID
- void setConversationID(String conversationID) {
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
deleted file mode 100644
index aa2671071c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConvertTimeMillisTestCase.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConvertTimeMillisTestCase extends TestCase {
- private MockProcessor registy;
-
- public void testConvertSeconds() throws Exception {
- assertEquals(10000L, registy.convertTimeMillis("10 seconds"));
- assertEquals(10000L, registy.convertTimeMillis("10 SECONDS"));
- try {
- registy.convertTimeMillis("10seconds");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- public void testConvertMinutes() throws Exception {
- assertEquals(600000L, registy.convertTimeMillis("10 minutes"));
- assertEquals(600000L, registy.convertTimeMillis("10 MINUTES"));
- try {
- registy.convertTimeMillis("10minutes");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- public void testConvertHours() throws Exception {
- assertEquals(36000000L, registy.convertTimeMillis("10 hours"));
- assertEquals(36000000L, registy.convertTimeMillis("10 HOURS"));
- try {
- registy.convertTimeMillis("10hours");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- public void testConvertDays() throws Exception {
- assertEquals(864000000L, registy.convertTimeMillis("10 days"));
- assertEquals(864000000L, registy.convertTimeMillis("10 DAYS"));
- try {
- registy.convertTimeMillis("10days");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- public void testConvertYears() throws Exception {
- assertEquals(315569260000L, registy.convertTimeMillis("10 years"));
- assertEquals(315569260000L, registy.convertTimeMillis("10 YEARS"));
- try {
- registy.convertTimeMillis("10years");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- public void testConvertDefault() throws Exception {
- assertEquals(10000L, registy.convertTimeMillis("10 "));
- assertEquals(10000L, registy.convertTimeMillis("10"));
- }
-
- public void testInvalid() throws Exception {
- try {
- registy.convertTimeMillis("foo");
- fail();
- } catch (NumberFormatException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- registy = new MockProcessor();
- }
-
- private class MockProcessor extends ConversationProcessor {
-
- public MockProcessor() {
- super(new DefaultAssemblyFactory());
- }
-
- @Override
- protected long convertTimeMillis(String expr) throws NumberFormatException {
- return super.convertTimeMillis(expr);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
deleted file mode 100644
index ffc67325fa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DestroyProcessorTestCase.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.Destroy;
-
-/**
- * @version $Rev$ $Date$
- */
-public class DestroyProcessorTestCase extends TestCase {
-
- private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testDestroy() throws Exception {
- DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = Foo.class.getMethod("destroy");
- processor.visitMethod(method, type);
- assertNotNull(type.getDestroyMethod());
- }
-
- public void testBadDestroy() throws Exception {
- DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = Bar.class.getMethod("badDestroy", String.class);
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalDestructorException e) {
- // expected
- }
- }
-
- public void testTwoDestroy() throws Exception {
- DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = Bar.class.getMethod("destroy");
- Method method2 = Bar.class.getMethod("destroy2");
- processor.visitMethod(method, type);
- try {
- processor.visitMethod(method2, type);
- fail();
- } catch (DuplicateDestructorException e) {
- // expected
- }
- }
-
- public void testProtectedDestroy() throws Exception {
- DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = Bar.class.getDeclaredMethod("protectedDestroy");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalDestructorException e) {
- // expected
- }
- }
-
- public void testPrivateDestroy() throws Exception {
- DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = Bar.class.getDeclaredMethod("privateDestroy");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalDestructorException e) {
- // expected
- }
- }
-
- private class Foo {
-
- @Destroy
- public void destroy() {
- }
- }
-
-
- private class Bar {
-
- @Destroy
- public void destroy() {
- }
-
- @Destroy
- public void destroy2() {
- }
-
- @Destroy
- public void badDestroy(String foo) {
- }
-
- @Destroy
- protected void protectedDestroy(){
- }
-
- @Destroy
- private void privateDestroy(){
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.java
deleted file mode 100644
index 09bcc7ab6c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/EagerInitProcessorTestCase.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.implementation.java.introspect.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.EagerInit;
-
-/**
- * @version $Rev$ $Date$
- */
-public class EagerInitProcessorTestCase extends TestCase {
-
- private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- public void testNoLevel() throws IntrospectionException {
- EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(Level.class, type);
- }
-
- public void testSubclass() throws IntrospectionException {
- EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(SubClass.class, type);
- }
-
- @EagerInit
- private class Level {
- }
-
- private class SubClass extends Level {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java
deleted file mode 100644
index c7f340bd46..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.osoa.sca.annotations.Property;
-
-/**
- * @version $Rev$ $Date$
- */
-public class HeuristicAndPropertyTestCase extends TestCase {
-
- private PropertyProcessor propertyProcessor;
- private HeuristicPojoProcessor heuristicProcessor;
- private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
- private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- /**
- * Verifies the property and heuristic processors don't collide
- */
- @SuppressWarnings("unchecked")
- public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor ctor = Foo.class.getConstructor(String.class);
- type.setConstructor(new JavaConstructorImpl(ctor));
- propertyProcessor.visitConstructorParameter(type.getConstructor().getParameters()[0], type);
- heuristicProcessor.visitEnd(Foo.class, type);
- assertEquals(1, type.getProperties().size());
- assertEquals("foo", type.getProperties().get(0).getName());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- propertyProcessor = new PropertyProcessor(assemblyFactory);
- heuristicProcessor = new HeuristicPojoProcessor(assemblyFactory, new DefaultJavaInterfaceFactory());
- }
-
- public static class Foo {
- public Foo(@Property(name = "foo")
- String prop) {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
deleted file mode 100644
index e98a8fec1f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * @version $Rev$ $Date$
- */
-public class HeuristicConstructorTestCase extends AbstractProcessorTest {
-
- private AssemblyFactory factory;
- private JavaInterfaceFactory javaFactory;
- private HeuristicPojoProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public HeuristicConstructorTestCase() {
- factory = new DefaultAssemblyFactory();
- javaFactory = new DefaultJavaInterfaceFactory();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- processor = new HeuristicPojoProcessor(factory, javaFactory);
- }
-
- private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- for (Constructor<?> constructor : clazz.getConstructors()) {
- visitConstructor(constructor, type);
- }
- processor.visitEnd(clazz, type);
- }
-
- /**
- * Verifies a single constructor is chosen with a parameter as the type
- */
- public void testSingleConstructorWithParam() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
- prop.setName("foo");
- type.getProperties().add(prop);
- // Hack to add a property member
- JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
- type.getPropertyMembers().put("foo", element);
- visitEnd(Foo1.class, type);
- assertNotNull(type.getConstructor().getConstructor());
- assertEquals("foo", type.getConstructor().getParameters()[0].getName());
- }
-
- /**
- * Verifies a single constructor is chosen with a reference as the type
- */
- public void testSingleConstructorWithRef() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
- ref.setName("foo");
- type.getReferences().add(ref);
- type.getReferenceMembers().put("foo", new JavaElementImpl("foo", String.class, null));
- visitEnd(Foo1.class, type);
- assertNotNull(type.getConstructor().getConstructor());
- assertEquals("foo", type.getConstructor().getParameters()[0].getName());
- }
-
- /**
- * Verifies a single constructor is chosen with a property and a reference
- * as the type
- */
- public void testSingleConstructorWithPropRef() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
-
- org.apache.tuscany.sca.assembly.Property prop = factory.createProperty();
- prop.setName("foo");
- type.getProperties().add(prop);
- // Hack to add a property member
- JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
- type.getPropertyMembers().put("foo", element);
-
- org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
- type.getReferences().add(ref);
- type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
- visitEnd(Foo2.class, type);
- assertNotNull(type.getConstructor().getConstructor());
- assertEquals(2, type.getConstructor().getParameters().length);
- }
-
- public void testSingleConstructorResolvableParam() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo5.class, type);
- assertEquals(String.class, type.getPropertyMembers().get("string").getType());
- }
-
- public void testSingleConstructorResolvableRef() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo6.class, type);
- assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "ref"), Ref.class));
- }
-
- public void testSingleConstructorAmbiguousRef() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- org.apache.tuscany.sca.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
- type.getReferences().add(ref);
- type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
- org.apache.tuscany.sca.assembly.Reference ref2 = ModelHelper.createReference(factory, javaFactory, "ref2", Foo1.class);
- type.getReferences().add(ref2);
- type.getReferenceMembers().put("ref2", new JavaElementImpl("ref2", Foo1.class, null));
- try {
- visitEnd(Foo4.class, type);
- fail();
- } catch (AmbiguousConstructorException e) {
- // expected
- }
- }
-
- public void testConstructorPropertyAnnotatedParamsOnly() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo7.class, type);
- assertNotNull(getProperty(type, "myProp"));
- }
-
- public void testConstructorReferenceAnnotatedParamsOnly() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo8.class, type);
- assertNotNull(ModelHelper.getReference(type, "myRef"));
- }
-
- @SuppressWarnings("unchecked")
- public void testDefaultConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo3.class, type);
- assertNotNull(type.getConstructor().getConstructor());
- }
-
- public void testSameTypesButAnnotated() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo12.class, type);
- assertEquals(2, type.getProperties().size());
- assertNotNull(getProperty(type, "prop1"));
- assertNotNull(getProperty(type, "prop2"));
- }
-
- /**
- * Verifies processing executes with additional extension annotations
- */
- public void testRandomAnnotation() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo11.class, type);
- assertEquals(1, type.getProperties().size());
- assertNotNull(getProperty(type, "prop1"));
- }
-
- public void testPrivateConstructor() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- visitEnd(Foo14.class, type);
- fail();
- } catch (NoConstructorException e) {
- // expected
- }
- }
-
- public void testMultipleConstructors() throws Exception {
- // throw new UnsupportedOperationException("Finish heuristic multiple
- // constructors - Foo10");
- }
-
- public static class Foo1 {
- public Foo1(String val) {
- }
- }
-
- public static class Foo2 {
- public Foo2(String val, Foo1 ref) {
- }
- }
-
- public static class Foo3 {
- }
-
- public static class Foo4 {
- public Foo4(Foo1 ref) {
- }
- }
-
- public static class Prop {
-
- }
-
- @Remotable
- public static interface Ref {
-
- }
-
- public static class Foo5 {
- public Foo5(String val) {
- }
- }
-
- public static class Foo6 {
- public Foo6(Ref ref) {
- }
- }
-
- public static class Foo7 {
- public Foo7(@Property(name = "myProp")
- String prop) {
- }
- }
-
- public static class Foo8 {
- public Foo8(@Reference(name = "myRef")
- String ref) {
- }
- }
-
- public static class Foo9 {
- public Foo9(@Reference(name = "myRef")
- String ref) {
- }
- }
-
- public static class Foo10 {
-
- public Foo10() {
- }
-
- public Foo10(String prop) {
- }
-
- public Foo10(@Property(name = "prop1")
- String prop1, @Property(name = "prop2")
- String prop2) {
-
- }
- }
-
- public static class Foo11 {
-
- public Foo11(@Property(name = "prop1")
- String prop, @Baz
- String baz) {
- }
- }
-
- public static class Foo12 {
-
- public Foo12(@Property(name = "prop1")
- String prop, @Property(name = "prop2")
- String baz) {
- }
- }
-
- public @interface Baz {
-
- }
-
- public static class Foo13 {
- public Foo13(@Reference
- String foo) {
- }
- }
-
- public static final class Foo14 {
- private Foo14() {
- }
- }
-
- public static final class Foo15 {
- public Foo15(@Reference
- String param1, @Reference
- String param2) {
- }
- }
-
- public static final class Foo16 {
- public Foo16(@Reference
- String param1, @Property(name = "foo")
- String param2, @Reference(name = "bar")
- String param3) {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
deleted file mode 100644
index ff267cd938..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
+++ /dev/null
@@ -1,562 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-import java.util.Collection;
-import java.util.List;
-
-import javax.jws.WebService;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Remotable;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Verifies component type information is properly introspected from an unadorned
- * POJO according to the SCA Java Client and Implementation Model Specification
- *
- * @version $Rev$ $Date$
- */
-public class HeuristicPojoProcessorTestCase extends AbstractProcessorTest {
-
- private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public HeuristicPojoProcessorTestCase() {
- processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- }
-
- private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- for (Constructor<?> constructor : clazz.getConstructors()) {
- visitConstructor(constructor, type);
- }
- processor.visitEnd(clazz, type);
- }
-
- /**
- * Verifies a single service interface is computed when only one interface
- * is implemented
- */
- public void testSingleInterface() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
- processor.visitEnd(SingleInterfaceImpl.class, type);
- assertEquals(1, type.getServices().size());
- assertTrue(ModelHelper.matches(ModelHelper.getService(type, PropertyInterface.class.getSimpleName()),
- PropertyInterface.class));
- assertTrue(type.getProperties().isEmpty());
- assertTrue(type.getReferences().isEmpty());
- }
-
- /**
- * Verifies property and reference setters are computed
- */
- public void testPropertyReference() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor = SingleInterfaceWithPropertyReferenceImpl.class
- .getConstructor();
- type.setConstructor(new JavaConstructorImpl<SingleInterfaceWithPropertyReferenceImpl>(ctor));
- processor.visitEnd(SingleInterfaceWithPropertyReferenceImpl.class, type);
- assertEquals(1, type.getServices().size());
- assertTrue(ModelHelper
- .matches(ModelHelper.getService(type, Interface1.class.getSimpleName()), Interface1.class));
- assertEquals(1, type.getProperties().size());
- org.apache.tuscany.sca.assembly.Property prop = ModelHelper.getProperty(type, "property");
- assertNotNull(prop);
- assertEquals(ComplexProperty.class, type.getPropertyMembers().get("property").getType());
- assertEquals(1, type.getReferences().size());
- assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "reference"), Ref.class));
- }
-
- /**
- * Verifies that a property setter is not introspected if an analogous
- * operation is in the service interface
- */
- public void testPropertySetterInInterface() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
- processor.visitEnd(SingleInterfaceImpl.class, type);
- assertEquals(0, type.getProperties().size());
- }
-
- /**
- * Verifies that a reference setter is not introspected if an analogous
- * operation is in the service interface
- */
- public void testReferenceSetterInInterface() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<RefInterfaceImpl> ctor = RefInterfaceImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<RefInterfaceImpl>(ctor));
- processor.visitEnd(RefInterfaceImpl.class, type);
- assertEquals(0, type.getReferences().size());
- }
-
- /**
- * Verifies collection generic types or array types are introspected as
- * references according to specification rules
- */
- public void testReferenceCollectionType() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<ReferenceCollectionImpl>(ctor));
- processor.visitEnd(ReferenceCollectionImpl.class, type);
- assertEquals(1, type.getProperties().size());
- assertEquals(3, type.getReferences().size());
- }
-
- /**
- * Verifies collection generic types or array types are introspected as
- * properties according to specification rules
- */
- public void testPropertyCollectionType() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<PropertyCollectionImpl>(ctor));
- processor.visitEnd(PropertyCollectionImpl.class, type);
- assertEquals(0, type.getReferences().size());
- assertEquals(4, type.getProperties().size());
- }
-
- /**
- * Verifies references are calculated when the type marked with is
- *
- * @Remotable
- */
- public void testRemotableRef() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<RemotableRefImpl>(ctor));
- processor.visitEnd(RemotableRefImpl.class, type);
- assertEquals(2, type.getReferences().size());
- assertEquals(0, type.getProperties().size());
- }
-
- public void testParentInterface() throws IntrospectionException, NoSuchMethodException {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Child> ctor = Child.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<Child>(ctor));
- processor.visitEnd(Child.class, type);
- assertNotNull(ModelHelper.getService(type, Interface1.class.getSimpleName()));
- }
-
- /**
- * Verifies a service interface is calculated when only props and refs are
- * given
- */
- public void testExcludedPropertyAndReference() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
- ref.setName("reference");
- type.getReferences().add(ref);
- type.getReferenceMembers().put("reference", new JavaElementImpl("reference", Ref.class, null));
- org.apache.tuscany.sca.assembly.Reference ref2 = factory.createReference();
- ref2.setName("reference2");
- type.getReferences().add(ref2);
- type.getReferenceMembers().put("reference2", new JavaElementImpl("reference2", Ref.class, null));
- org.apache.tuscany.sca.assembly.Property prop1 = factory.createProperty();
- prop1.setName("string1");
- type.getProperties().add(prop1);
- type.getPropertyMembers().put("string1", new JavaElementImpl("string1", String.class, null));
- org.apache.tuscany.sca.assembly.Property prop2 = factory.createProperty();
- prop2.setName("string2");
- type.getProperties().add(prop2);
- type.getPropertyMembers().put("string2", new JavaElementImpl("string2", String.class, null));
- visitEnd(MockService.class, type);
- assertEquals(1, type.getServices().size());
- }
-
- public void testProtectedRemotableRefField() throws IntrospectionException, NoSuchMethodException {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefFieldImpl>(ctor));
- processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
- assertNotNull(ModelHelper.getReference(type, "otherRef"));
- }
-
- public void testProtectedRemotableRefMethod() throws IntrospectionException, NoSuchMethodException {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefMethodImpl>(ctor));
- processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
- assertNotNull(ModelHelper.getReference(type, "otherRef"));
- }
-
- public void testSetDataTypes() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor();
- type.setConstructor(new JavaConstructorImpl<PropertyIntTypeOnConstructor>(ctor));
- processor.visitEnd(PropertyIntTypeOnConstructor.class, type);
- org.apache.tuscany.sca.assembly.Property foo = ModelHelper.getProperty(type, "foo");
- assertEquals(int.class, type.getPropertyMembers().get("foo").getType());
- assertEquals(new QName(JavaXMLMapper.URI_2001_SCHEMA_XSD, "int"), foo.getXSDType());
- }
-
- /**
- * Errata for Java Component Implementation Specification v1.0 corrects the algorithm for determining
- * references of an unannotated POJO (section 1.2.7). This test makes sure that the earlier implementation
- * is corrected as per the errata. A notable difference is that the interfaces annotated with @Service
- * no longer result in references.
- */
- public void testUpdatedRule() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(SomeServiceImpl.class, type);
- assertEquals(12, type.getReferenceMembers().size());
- assertTrue(type.getReferenceMembers().containsKey("rri1"));
- assertTrue(type.getReferenceMembers().containsKey("rri2"));
- assertTrue(type.getReferenceMembers().containsKey("rri3"));
- assertTrue(type.getReferenceMembers().containsKey("rri4"));
-
- assertTrue(type.getReferenceMembers().containsKey("rria1"));
- assertTrue(type.getReferenceMembers().containsKey("rria2"));
- assertTrue(type.getReferenceMembers().containsKey("rria3"));
- assertTrue(type.getReferenceMembers().containsKey("rria4"));
-
- assertTrue(type.getReferenceMembers().containsKey("rric1"));
- assertTrue(type.getReferenceMembers().containsKey("rric2"));
- assertTrue(type.getReferenceMembers().containsKey("rric3"));
- assertTrue(type.getReferenceMembers().containsKey("rric4"));
-
- assertEquals(16, type.getPropertyMembers().size());
- assertTrue(type.getPropertyMembers().containsKey("pnri1"));
- assertTrue(type.getPropertyMembers().containsKey("pnri2"));
- assertTrue(type.getPropertyMembers().containsKey("pnri3"));
- assertTrue(type.getPropertyMembers().containsKey("pnri4"));
-
- assertTrue(type.getPropertyMembers().containsKey("pnria1"));
- assertTrue(type.getPropertyMembers().containsKey("pnria2"));
- assertTrue(type.getPropertyMembers().containsKey("pnria3"));
- assertTrue(type.getPropertyMembers().containsKey("pnria4"));
-
- assertTrue(type.getPropertyMembers().containsKey("pnric1"));
- assertTrue(type.getPropertyMembers().containsKey("pnric2"));
- assertTrue(type.getPropertyMembers().containsKey("pnric3"));
- assertTrue(type.getPropertyMembers().containsKey("pnric4"));
-
- assertTrue(type.getPropertyMembers().containsKey("gen1"));
- assertTrue(type.getPropertyMembers().containsKey("gen2"));
- assertTrue(type.getPropertyMembers().containsKey("gen3"));
- assertTrue(type.getPropertyMembers().containsKey("gen4"));
- }
-
- /**
- * Interfaces with "@WebService" annotation implemented by the class should result
- * in a Service in the same manner as an "@Remotable" annotation would.
- */
- public void testInterfaceWithWebServiceAnnotation() throws Exception{
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(SomeWebServiceImpl.class, type);
- assertEquals(1, type.getServices().size());
- assertEquals("SomeWebService", type.getServices().get(0).getName());
- }
-
- @Remotable
- private interface ReferenceRemotableInterface {
- void operation1(String param1);
- }
-
- @Service
- private interface PropertyNonRemotableInterface {
- void operation1(String param1);
- }
-
- @Remotable
- private interface SomeService {
- void serviceOperation1();
- }
-
- private static class SomeServiceImpl implements SomeService {
-
- public SomeServiceImpl() {
- }
-
- // References - interface with @Remotable
- public void setRri1(ReferenceRemotableInterface rri) {
- }
- protected void setRri2(ReferenceRemotableInterface rri) {
- }
- public ReferenceRemotableInterface rri3;
- protected ReferenceRemotableInterface rri4;
-
- // References - array of interface with @Remotable
- public void setRria1(ReferenceRemotableInterface[] rri) {
- }
- protected void setRria2(ReferenceRemotableInterface[] rri) {
- }
- public ReferenceRemotableInterface[] rria3;
- protected ReferenceRemotableInterface[] rria4;
-
- // References - parametrized Collection of interface with @Remotable
- public void setRric1(Collection<ReferenceRemotableInterface> rri) {
- }
- protected void setRric2(Collection<ReferenceRemotableInterface> rri) {
- }
- public Collection<ReferenceRemotableInterface> rric3;
- protected Collection<ReferenceRemotableInterface> rric4;
-
- // Properties - interface with @Service and without @Remotable
- public void setPnri1(PropertyNonRemotableInterface arg) {
- }
- protected void setPnri2(PropertyNonRemotableInterface arg) {
- }
- public PropertyNonRemotableInterface pnri3;
- protected PropertyNonRemotableInterface pnri4;
-
- // Properties - array of interface with @Service and without @Remotable
- public void setPnria1(PropertyNonRemotableInterface[] arg) {
- }
- protected void setPnria2(PropertyNonRemotableInterface[] arg) {
- }
- public PropertyNonRemotableInterface[] pnria3;
- protected PropertyNonRemotableInterface[] pnria4;
-
- // Properties - parametrized Collection of interface with @Service and without @Remotable
- public void setPnric1(Collection<PropertyNonRemotableInterface> arg) {
- }
- protected void setPnric2(Collection<PropertyNonRemotableInterface> arg) {
- }
- public Collection<PropertyNonRemotableInterface> pnric3;
- protected Collection<PropertyNonRemotableInterface> pnric4;
-
- // Properties - Non-parametrized Collection
- public void setGen1(Collection arg) {
- }
- protected void setGen2(Collection arg) {
- }
- public Collection gen3;
- protected Collection gen4;
-
- public void serviceOperation1() {
- }
- }
-
- private static class PropertyIntTypeOnConstructor {
- protected int foo;
-
- public PropertyIntTypeOnConstructor() {
- }
-
- public int getFoo() {
- return foo;
- }
- }
-
- @Remotable
- private interface PropertyInterface {
- void setString1(String val);
- }
-
- @Remotable
- private interface Interface1 {
- }
-
- private static class Parent implements Interface1 {
-
- }
-
- private static class Child extends Parent {
- public Child() {
- }
-
- }
-
- private static class SingleInterfaceImpl implements PropertyInterface {
- public SingleInterfaceImpl() {
- }
-
- public void setString1(String val) {
- }
-
- }
-
- private interface HeuristicServiceInterface {
- void fooOperation(String ref);
-
- void setInvalid1(); // No parameter
-
- void setInvalid2(String str, int i); // More than one parameter
-
- String setInvalid3(String str); // return should be void
- }
-
- public static class MockService implements PropertyInterface, RefInterface, HeuristicServiceInterface {
-
- @Property
- public void setString1(String val) {
- }
-
- @Property
- public void setString2(String val) {
- }
-
- @Reference
- public void setReference(Ref ref) {
- }
-
- @Reference
- public void setReference2(Ref ref) {
- }
-
- public void fooOperation(String ref) {
-
- }
-
- public void setInvalid1() {
- }
-
- public void setInvalid2(String str, int i) {
- }
-
- public String setInvalid3(String str) {
- return null;
- }
-
- }
-
- @Remotable
- private interface Ref {
- }
-
- private class ComplexProperty {
- }
-
- private interface RefInterface {
- void setReference(Ref ref);
- }
-
- private static class RefInterfaceImpl implements RefInterface {
- public RefInterfaceImpl() {
- }
-
- public void setReference(Ref ref) {
- }
- }
-
- private static class SingleInterfaceWithPropertyReferenceImpl implements Interface1 {
- public SingleInterfaceWithPropertyReferenceImpl() {
- }
-
- public void setReference(Ref ref) {
- }
-
- public void setProperty(ComplexProperty prop) {
- }
- }
-
- private static class ReferenceCollectionImpl implements Interface1 {
- public ReferenceCollectionImpl() {
- }
-
- public void setCollectionReference(Collection<Ref> ref) {
- }
-
- public void setNonGenericCollectionReference(Collection ref) {
- // [rfeng] By the SCA specification, this should be classified as property
- }
-
- public void setListReference(List<Ref> ref) {
- }
-
- public void setArrayReference(Ref[] ref) {
- }
- }
-
- private static class PropertyCollectionImpl implements Interface1 {
- public PropertyCollectionImpl() {
- }
-
- public void setCollectionProperty(Collection<ComplexProperty> prop) {
- }
-
- public void setCollectionProperty2(Collection<String> prop) {
- }
-
- public void setArrayProperty(ComplexProperty[] prop) {
- }
-
- public void setArrayProperty2(String[] prop) {
- }
- }
-
- @Remotable
- private interface RemotableRef {
- }
-
- private static class RemotableRefImpl implements Interface1 {
- protected RemotableRef otherRef;
-
- public RemotableRefImpl() {
- }
-
- public void setRef(RemotableRef ref) {
-
- }
- }
-
- private static class ProtectedRemotableRefFieldImpl implements Interface1 {
- protected RemotableRef otherRef;
-
- public ProtectedRemotableRefFieldImpl() {
- }
-
- public ProtectedRemotableRefFieldImpl(RemotableRef otherRef) {
- this.otherRef = otherRef;
- }
-
- }
-
- private static class ProtectedRemotableRefMethodImpl implements Interface1 {
- public ProtectedRemotableRefMethodImpl() {
- }
-
- protected void setOtherRef(RemotableRef otherRef) {
- }
-
- }
-
- @WebService
- private interface SomeWebService {
- void serviceOperation1();
- }
-
- @Service
- private static class SomeWebServiceImpl implements SomeWebService {
- public SomeWebServiceImpl() {
-
- }
-
- public void serviceOperation1() {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
deleted file mode 100644
index ed0527d3d7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-
-/**
- * Verifies constructors that have extensible annotation types, i.e. that have
- * parameters marked by annotations which are themselves processed by some other
- * implementation processor
- *
- * @version $Rev$ $Date$
- */
-public class HeutisticExtensibleConstructorTestCase extends AbstractProcessorTest {
-
- private org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- public HeutisticExtensibleConstructorTestCase() {
- processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- }
-
- private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- for (Constructor<?> constructor : clazz.getConstructors()) {
- visitConstructor(constructor, type);
- }
- processor.visitEnd(clazz, type);
- }
-
- /**
- * Verifies heuristic processing can be called prior to an extension
- * annotation processors being called.
- */
- public void testBarAnnotationProcessedFirst() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
- JavaConstructorImpl<Foo> definition = new JavaConstructorImpl<Foo>(ctor);
- type.setConstructor(definition);
- Property property = factory.createProperty();
- property.setName("myBar");
- definition.getParameters()[0].setName("myBar");
- type.getProperties().add(property);
- visitEnd(Foo.class, type);
- assertEquals(2, type.getProperties().size());
- }
-
- /**
- * Verifies heuristic processing can be called before an extension
- * annotation processors is called. <p/> For example, given:
- *
- * <pre>
- * Foo(@Bar String prop, @org.osoa.sca.annotations.Property(name = &quot;foo&quot;) String prop2)
- * </pre>
- *
- * <p/> Heuristic evaluation of
- * @Property can occur prior to another implementation processor evaluating
- * @Bar
- * @throws Exception
- */
- public void testBarAnnotationProcessedLast() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- visitEnd(Foo.class, type);
-
- // now simulate process the bar impl
- JavaConstructorImpl<?> definition = type.getConstructor();
- definition.getParameters()[0].setName("myBar");
- Property property = factory.createProperty();
- property.setName("myBar");
- type.getProperties().add(property);
-
- assertEquals(2, type.getProperties().size());
- assertEquals("foo", definition.getParameters()[1].getName());
- }
-
- /**
- * Verifies heuristic processing can be called before an extension
- * annotation processors is called with the extension parameter in a middle
- * position. Specifically, verifies that the heuristic processor updates
- * injection names and preserves their ordering.
- */
- public void testBarAnnotationProcessedFirstInMiddle() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
- JavaConstructorImpl<Foo2> definition = new JavaConstructorImpl<Foo2>(ctor);
- type.setConstructor(definition);
- // insert placeholder for first param, which would be done by a
- // processor
- definition.getParameters()[0].setName("");
- Property property = factory.createProperty();
- // Hack to add a property member
- JavaElementImpl element = new JavaElementImpl("myBar", String.class, null);
- type.getPropertyMembers().put("myBar", element);
- property.setName("myBar");
- definition.getParameters()[1].setName("myBar");
- type.getProperties().add(property);
- visitEnd(Foo2.class, type);
- assertEquals("baz", definition.getParameters()[0].getName());
- assertEquals(2, type.getProperties().size());
- assertEquals(1, type.getReferences().size());
- }
-
- public @interface Bar {
-
- }
-
- public static class Foo {
- public Foo(@Bar
- String prop, @org.osoa.sca.annotations.Property(name = "foo")
- String prop2) {
- }
- }
-
- public static class Foo2 {
- public Foo2(@org.osoa.sca.annotations.Reference(name = "baz")
- String prop1, @Bar
- String prop2, @org.osoa.sca.annotations.Property(name = "foo")
- String prop3) {
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
deleted file mode 100644
index 70c615ca24..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/InitProcessorTestCase.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.osoa.sca.annotations.Init;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InitProcessorTestCase extends TestCase {
-
- private JavaImplementationFactory javaImplementationFactory;
-
- public InitProcessorTestCase() {
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- }
-
- public void testInit() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Foo.class.getMethod("init");
- processor.visitMethod(method, type);
- assertNotNull(type.getInitMethod());
- }
-
- public void testBadInit() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Bar.class.getMethod("badInit", String.class);
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalInitException e) {
- // expected
- }
- }
-
- public void testTwoInit() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Bar.class.getMethod("init");
- Method method2 = InitProcessorTestCase.Bar.class.getMethod("init2");
- processor.visitMethod(method, type);
- try {
- processor.visitMethod(method2, type);
- fail();
- } catch (DuplicateInitException e) {
- // expected
- }
- }
-
- public void testProtectedInit() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("protectedInit");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalInitException e) {
- // expected
- }
- }
-
- public void testPrivateInit() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("privateInit");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalInitException e) {
- // expected
- }
- }
-
- public void testBadInit2() throws Exception {
- InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- Method method = InitProcessorTestCase.Bar.class.getDeclaredMethod("badInit2");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalInitException e) {
- // expected
- }
- }
-
- private class Foo {
- @Init
- public void init() {
- }
- }
-
-
- private class Bar {
- @Init
- public void init() {
- }
-
- @Init
- public void init2() {
- }
-
- @Init
- public void badInit(String foo) {
- }
-
- @Init
- public String badInit2() {
- return null;
- }
-
- @Init
- protected void protectedInit() {
- }
-
- @Init
- private void privateInit() {
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.java
deleted file mode 100644
index 388a1aae8b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JavaClassIntrospectorImplTestCase.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.implementation.java.introspect.impl;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaClassIntrospectorImplTestCase extends TestCase {
-
- public void testRegister() throws Exception {
- JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
- JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
- factory.addClassVisitor(extension);
- }
-
- public void testUnegister() throws Exception {
- JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
- JavaClassVisitor extension = EasyMock.createNiceMock(JavaClassVisitor.class);
- factory.addClassVisitor(extension);
- factory.removeClassVisitor(extension);
- }
-
- @SuppressWarnings("unchecked")
- public void testWalk() throws Exception {
- JavaImplementationFactory factory = new DefaultJavaImplementationFactory();
- JavaClassVisitor extension = EasyMock.createMock(JavaClassVisitor.class);
- extension.visitClass(EasyMock.eq(Bar.class), EasyMock.isA(JavaImplementation.class));
- extension.visitConstructor(EasyMock.isA(Constructor.class), EasyMock.isA(JavaImplementation.class));
- extension.visitMethod(EasyMock.isA(Method.class), EasyMock.isA(JavaImplementation.class));
- extension.visitField(EasyMock.isA(Field.class), EasyMock.isA(JavaImplementation.class));
- extension.visitSuperClass(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
- extension.visitEnd(EasyMock.isA(Class.class), EasyMock.isA(JavaImplementation.class));
-
- // mock.expects(once()).method("visitClass");
- // mock.expects(once()).method("visitMethod");
- // mock.expects(once()).method("visitField");
- // mock.expects(once()).method("visitConstructor");
- // mock.expects(once()).method("visitSuperClass");
- // mock.expects(once()).method("visitEnd");
- EasyMock.replay(extension);
- factory.addClassVisitor(extension);
- factory.createJavaImplementation(Bar.class);
- EasyMock.verify(extension);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- private class Baz {
-
- }
-
- private class Bar extends Baz {
-
- protected String bar;
-
- public Bar() {
- }
-
- public void bar() {
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.java
deleted file mode 100644
index aad6b96cf9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ModelHelper.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.implementation.java.introspect.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ModelHelper {
-
- public static Property getProperty(JavaImplementation type, String name) {
- for (Property prop : type.getProperties()) {
- if (prop.getName().equals(name)) {
- return prop;
- }
- }
- return null;
- }
-
- public static Reference getReference(JavaImplementation type, String name) {
- for (Reference ref : type.getReferences()) {
- if (ref.getName().equals(name)) {
- return ref;
- }
- }
- return null;
- }
-
- public static Service getService(JavaImplementation type, String name) {
- for (Service svc : type.getServices()) {
- if (svc.getName().equals(name)) {
- return svc;
- }
- }
- return null;
- }
-
- public static boolean matches(Contract contract, Class<?> type) {
- Interface interface1 = contract.getInterfaceContract().getInterface();
- if (interface1 instanceof JavaInterface) {
- return type == ((JavaInterface)interface1).getJavaClass();
- } else {
- return false;
- }
- }
-
- public static ComponentService createService(AssemblyFactory factory,
- JavaInterfaceFactory javaFactory, Class<?> type) {
- org.apache.tuscany.sca.assembly.ComponentService ref = factory.createComponentService();
- ref.setName(type.getSimpleName());
- JavaInterface i = javaFactory.createJavaInterface();
- i.setJavaClass(type);
- JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
- ic.setInterface(i);
- ref.setInterfaceContract(ic);
- return ref;
- }
-
- public static Reference createReference(AssemblyFactory factory,
- JavaInterfaceFactory javaFactory, String name, Class<?> type) {
- org.apache.tuscany.sca.assembly.Reference ref = factory.createReference();
- ref.setName(name);
- JavaInterface i = javaFactory.createJavaInterface();
- i.setJavaClass(type);
- JavaInterfaceContract ic = javaFactory.createJavaInterfaceContract();
- ic.setInterface(i);
- ref.setInterfaceContract(ic);
- return ref;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
deleted file mode 100644
index 4a625982b0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCase.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.osoa.sca.annotations.Requires;
-import org.osoa.sca.annotations.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyProcessorTestCase extends TestCase {
- private ServiceProcessor serviceProcessor;
- private PolicyProcessor policyProcessor;
- private PolicyJavaInterfaceVisitor visitor;
- private JavaImplementation type;
-
- // This actually is a test for PolicyJavaInterfaceProcessor. It will get
- // invoked via the call to ImplementationProcessorServiceImpl.createService in
- // ServiceProcessor. Of course ServiceProcessor class has to be working.
- public void stestSingleInterfaceWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
- serviceProcessor.visitClass(Service1.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service1.class, type);
- verifyIntents(Service1.class, type);
- }
-
- public void stestMultipleInterfacesWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
- serviceProcessor.visitClass(Service2.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service2.class, type);
- verifyIntents(Service2.class, type);
- }
-
- public void stestSingleInterfaceWithIntentsOnImplAtClassLevel() throws Exception {
- serviceProcessor.visitClass(Service3.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service3.class, type);
- verifyIntents(Service3.class, type);
- }
-
- public void stestMultipleInterfacesWithIntentsOnImplAtClassLevel() throws Exception {
- serviceProcessor.visitClass(Service4.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service4.class, type);
- verifyIntents(Service4.class, type);
- }
-
- public void stestSingleInterfaceWithIntentsOnInterfaceAtMethodLevel() throws Exception {
- serviceProcessor.visitClass(Service5.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service5.class, type);
- verifyIntents(Service5.class, type);
- }
-
- public void testSingleInterfaceWithIntentsOnServiceAndInterfaceAtImplAndInertfaceAndMethodLevel() throws Exception {
- serviceProcessor.visitClass(Service6.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service6.class, type);
- for (Method method : Service6.class.getDeclaredMethods()) {
- policyProcessor.visitMethod(method, type);
- }
- verifyIntents(Service6.class, type);
- }
-
- private void verifyIntents(Class serviceImplClass, JavaImplementation type) {
- if ( !(type instanceof PolicySetAttachPoint) ) {
- fail("No Intents on the service ");
- }
- Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
- if (serviceImplIntentAnnotation != null) {
- String[] serviceImplIntents = serviceImplIntentAnnotation.value();
- List<Intent> requiredIntents = ((PolicySetAttachPoint)type).getRequiredIntents();
- if (serviceImplIntents.length > 0) {
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on the service ");
- }
- Map<String, Intent> intentMap = new HashMap<String, Intent>();
- for (Intent intent : requiredIntents) {
- intentMap.put(intent.getName().getLocalPart(), intent);
- }
- for (String intent : serviceImplIntents) {
- assertTrue("ComponentType for Service class " + serviceImplClass.getName()
- + " did not contain Service Implementation intent "
- + intent, intentMap.containsKey(intent));
- }
- }
- }
-
- // This should match what was specified on @Service for a Service Implementation
- // If we use these to get the Service names and we get a null Service
- // name then it would seem that wrong values were put on the @Service annotation
- // or the wrong interfaces were specified on the implements list of the class
- // statement?
- Map<String, org.apache.tuscany.sca.assembly.Service> serviceMap = new HashMap<String, org.apache.tuscany.sca.assembly.Service>();
- for (org.apache.tuscany.sca.assembly.Service service: type.getServices()) {
- serviceMap.put(service.getName(), service);
- }
- for (Class interfaceClass : serviceImplClass.getInterfaces()) {
- Requires interfaceIntentAnnotation = (Requires)interfaceClass.getAnnotation(Requires.class);
- org.apache.tuscany.sca.assembly.Service service = serviceMap.get(interfaceClass.getSimpleName());
- if (service == null) {
- fail("No service defined for interface " + interfaceClass.getSimpleName()
- + " on Service Implementation "
- + serviceImplClass.getName());
- }
-
- if (interfaceIntentAnnotation != null) {
- String[] interfaceIntents = interfaceIntentAnnotation.value();
- List<Intent> requiredIntents = service.getInterfaceContract().getInterface().getRequiredIntents();
- if (interfaceIntents.length > 0) {
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on the service " + service.getName());
- }
- Map<String, Intent> intentMap = new HashMap<String, Intent>();
- for (Intent intent : requiredIntents) {
- intentMap.put(intent.getName().getLocalPart(), intent);
- }
- for (String intent : interfaceIntents) {
- assertTrue("Interface " + service.getName()
- + " did not contain Service Interface intent "
- + intent, intentMap.containsKey(intent));
- }
- }
- }
-
- for (Method method : interfaceClass.getDeclaredMethods()) {
- Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
-
- // Verify that each of the Intents on each of the Service
- // Interface Methods exist on their associated operation.
- if (methodIntentAnnotation != null) {
- String[] methodIntents = methodIntentAnnotation.value();
- if (methodIntents.length > 0) {
- List<Intent> requiredIntents = null;
- for ( ConfiguredOperation confOp : service.getConfiguredOperations() ) {
- if ( confOp.getName().equals(method.getName()) &&
- confOp.getContractName().equals(service.getName()) ) {
- requiredIntents = confOp.getRequiredIntents();
- }
- }
-
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on operation " + method.getName());
- }
- for (String intent : methodIntents) {
- boolean found = false;
- for (Intent requiredIntent: requiredIntents) {
- if (requiredIntent.getName().getLocalPart().equals(intent)) {
- found = true;
- break;
- }
- }
- assertTrue("Operation " + method.getName()
- + " did not contain Service Interface method intent "
- + intent, found);
- }
- }
- }
- }
-
- for (Method method : serviceImplClass.getDeclaredMethods()) {
- Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
-
- // Verify that each of the Intents on each of the Service
- // Implementation Methods exist on their associated
- // operation.
- if (methodIntentAnnotation != null) {
- String[] methodIntents = methodIntentAnnotation.value();
- if (methodIntents.length > 0) {
- List<Intent> requiredIntents = null;
- for ( ConfiguredOperation confOp : ((OperationsConfigurator)type).getConfiguredOperations() ) {
- if ( confOp.getName().equals(method.getName()) ) {
- requiredIntents = confOp.getRequiredIntents();
- }
- }
-
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on operation " + method.getName());
- }
-
- for (String intent : methodIntents) {
- boolean found = false;
- for (Intent requiredIntent: requiredIntents) {
- if (requiredIntent.getName().getLocalPart().equals(intent)) {
- found = true;
- break;
- }
- }
- assertTrue("Operation " + method.getName()
- + " did not contain Implementation method intent "
- + intent, found);
- }
- }
- }
- }
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- policyProcessor = new PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
- visitor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory());
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- }
-
- // @Remotable
- @Requires( {"transaction.global"})
- private interface Interface1 {
- int method1();
-
- int method2();
-
- int method3();
-
- int method4();
- }
-
- @Service(Interface1.class)
- private class Service1 implements Interface1 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
- }
-
- // @Remotable
- @Requires( {"transaction.local"})
- private interface Interface2 {
- int method5();
-
- int method6();
- }
-
- @Service(interfaces = {Interface1.class, Interface2.class})
- private class Service2 implements Interface1, Interface2 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
-
- public int method5() {
- return 0;
- }
-
- public int method6() {
- return 0;
- }
- }
-
- // @Remotable
- private interface Interface3 {
- int method1();
-
- int method2();
-
- int method3();
-
- int method4();
- }
-
- @Service(Interface3.class)
- @Requires( {"transaction.global"})
- private class Service3 implements Interface3 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
- }
-
- // @Remotable
- private interface Interface4 {
- int method5();
-
- int method6();
- }
-
- @Service(interfaces = {Interface3.class, Interface4.class})
- @Requires( {"transaction.local"})
- private class Service4 implements Interface3, Interface4 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
-
- public int method5() {
- return 0;
- }
-
- public int method6() {
- return 0;
- }
- }
-
- private interface Interface5 {
- @Requires( {"transaction.global"})
- int method1();
-
- @Requires( {"transaction.local"})
- int method2();
- }
-
- @Service(Interface5.class)
- private class Service5 implements Interface5 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
- }
-
- @Requires( {"transaction.global.Interface6"})
- private interface Interface6 {
- @Requires( {"transaction.global.Interface6.method1"})
- int method1();
-
- @Requires( {"transaction.local.Interface6.method2"})
- int method2();
- }
-
- @Service(Interface6.class)
- @Requires( {"transaction.global.Service6"})
- private class Service6 implements Interface6 {
- @Requires( {"transaction.global.Service6.method1"})
- public int method1() {
- return 0;
- }
-
- @Requires( {"transaction.global.Service6.method1"})
- public int method2() {
- return 0;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
deleted file mode 100644
index 8d5e816a08..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PropertyProcessorTestCase.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getProperty;
-
-import java.util.Collection;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.osoa.sca.annotations.Property;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PropertyProcessorTestCase extends TestCase {
-
- JavaImplementation type;
- PropertyProcessor processor;
-
- public void testMethodAnnotation() throws Exception {
- processor.visitMethod(Foo.class.getMethod("setFoo", String.class), type);
- assertNotNull(getProperty(type, "foo"));
- }
-
- public void testMethodRequired() throws Exception {
- processor.visitMethod(Foo.class.getMethod("setFooRequired", String.class), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "fooRequired");
- assertNotNull(prop);
- assertTrue(prop.isMustSupply());
- }
-
- public void testMethodName() throws Exception {
- processor.visitMethod(Foo.class.getMethod("setBarMethod", String.class), type);
- assertNotNull(getProperty(type, "bar"));
- }
-
- public void testFieldAnnotation() throws Exception {
- processor.visitField(Foo.class.getDeclaredField("baz"), type);
- assertNotNull(getProperty(type, "baz"));
- }
-
- public void testFieldRequired() throws Exception {
- processor.visitField(Foo.class.getDeclaredField("bazRequired"), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "bazRequired");
- assertNotNull(prop);
- assertTrue(prop.isMustSupply());
- }
-
- public void testFieldName() throws Exception {
- processor.visitField(Foo.class.getDeclaredField("bazField"), type);
- assertNotNull(getProperty(type, "theBaz"));
- }
-
- public void testDuplicateFields() throws Exception {
- processor.visitField(Bar.class.getDeclaredField("dup"), type);
- try {
- processor.visitField(Bar.class.getDeclaredField("baz"), type);
- fail();
- } catch (DuplicatePropertyException e) {
- // expected
- }
- }
-
- public void testDuplicateMethods() throws Exception {
- processor.visitMethod(Bar.class.getMethod("setDupMethod", String.class), type);
- try {
- processor.visitMethod(Bar.class.getMethod("setDupSomeMethod", String.class), type);
- fail();
- } catch (DuplicatePropertyException e) {
- // expected
- }
- }
-
- public void testInvalidProperty() throws Exception {
- try {
- processor.visitMethod(Bar.class.getMethod("badMethod"), type);
- fail();
- } catch (IllegalPropertyException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- processor = new PropertyProcessor(new DefaultAssemblyFactory());
- }
-
- private class Foo {
-
- @Property
- protected String baz;
- @Property(required = true)
- protected String bazRequired;
- @Property(name = "theBaz")
- protected String bazField;
-
- @Property
- public void setFoo(String string) {
- }
-
- @Property(required = true)
- public void setFooRequired(String string) {
- }
-
- @Property(name = "bar")
- public void setBarMethod(String string) {
- }
-
- }
-
- private class Bar {
-
- @Property
- protected String dup;
-
- @Property(name = "dup")
- protected String baz;
-
- @Property
- public void setDupMethod(String s) {
- }
-
- @Property(name = "dupMethod")
- public void setDupSomeMethod(String s) {
- }
-
- @Property
- public void badMethod() {
- }
-
- }
-
- private class Multiple {
- @Property
- protected List<String> refs1;
-
- @Property
- protected String[] refs2;
-
- @Property
- public void setRefs3(String[] refs) {
- }
-
- @Property
- public void setRefs4(Collection<String> refs) {
- }
-
- }
-
- private Class<?> getBaseType(JavaElementImpl element) {
- return JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- }
-
- public void testMultiplicityCollection() throws Exception {
- processor.visitField(Multiple.class.getDeclaredField("refs1"), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs1");
- assertNotNull(prop);
- assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
- assertTrue(prop.isMany());
- }
-
- public void testMultiplicityArray() throws Exception {
- processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs2");
- assertNotNull(prop);
- assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
- assertTrue(prop.isMany());
- }
-
- public void testMultiplicityArrayMethod() throws Exception {
- processor.visitMethod(Multiple.class.getMethod("setRefs3", String[].class), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs3");
- assertNotNull(prop);
- assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
- assertTrue(prop.isMany());
- }
-
- public void testMultiplicityCollectionMethod() throws Exception {
- processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
- org.apache.tuscany.sca.assembly.Property prop = getProperty(type, "refs4");
- assertNotNull(prop);
- assertSame(String.class, getBaseType(type.getPropertyMembers().get(prop.getName())));
- assertTrue(prop.isMany());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
deleted file mode 100644
index d68b1530f0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getReference;
-
-import java.util.Collection;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ReferenceProcessorTestCase extends TestCase {
-
- private JavaImplementation type;
- private ReferenceProcessor processor;
-
- public void testMethodAnnotation() throws Exception {
- processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFoo", Ref.class), type);
- org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "foo");
- assertNotNull(reference);
- assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
- }
-
- public void testMethodRequired() throws Exception {
- processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setFooRequired", Ref.class), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "fooRequired");
- assertNotNull(ref);
- assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
- }
-
- public void testMethodName() throws Exception {
- processor.visitMethod(ReferenceProcessorTestCase.Foo.class.getMethod("setBarMethod", Ref.class), type);
- assertNotNull(getReference(type, "bar"));
- }
-
- public void testFieldAnnotation() throws Exception {
- processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("baz"), type);
- org.apache.tuscany.sca.assembly.Reference reference = getReference(type, "baz");
- assertNotNull(reference);
- assertEquals(Ref.class, ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass());
- }
-
- public void testFieldRequired() throws Exception {
- processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazRequired"), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "bazRequired");
- assertNotNull(ref);
- assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
- }
-
- public void testFieldName() throws Exception {
- processor.visitField(ReferenceProcessorTestCase.Foo.class.getDeclaredField("bazField"), type);
- assertNotNull(getReference(type, "theBaz"));
- }
-
- public void testDuplicateFields() throws Exception {
- processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("dup"), type);
- try {
- processor.visitField(ReferenceProcessorTestCase.Bar.class.getDeclaredField("baz"), type);
- fail();
- } catch (DuplicateReferenceException e) {
- // expected
- }
- }
-
- public void testDuplicateMethods() throws Exception {
- processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("setDupMethod", Ref.class), type);
- try {
- processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("setDupSomeMethod", Ref.class), type);
- fail();
- } catch (DuplicateReferenceException e) {
- // expected
- }
- }
-
- public void testInvalidProperty() throws Exception {
- try {
- processor.visitMethod(ReferenceProcessorTestCase.Bar.class.getMethod("badMethod"), type);
- fail();
- } catch (IllegalReferenceException e) {
- // expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- processor = new ReferenceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- }
-
- private interface Ref {
- }
-
- private class Foo {
-
- @Reference
- protected Ref baz;
- @Reference(required = true)
- protected Ref bazRequired;
- @Reference(name = "theBaz")
- protected Ref bazField;
-
- @Reference
- public void setFoo(Ref ref) {
- }
-
- @Reference(required = true)
- public void setFooRequired(Ref ref) {
- }
-
- @Reference(name = "bar")
- public void setBarMethod(Ref ref) {
- }
-
- }
-
- private class Bar {
-
- @Reference
- protected Ref dup;
-
- @Reference(name = "dup")
- protected Ref baz;
-
- @Reference
- public void setDupMethod(Ref s) {
- }
-
- @Reference(name = "dupMethod")
- public void setDupSomeMethod(Ref s) {
- }
-
- @Reference
- public void badMethod() {
- }
-
- }
-
- private class Multiple {
- @Reference(required = true)
- protected List<Ref> refs1;
-
- @Reference(required = false)
- protected Ref[] refs2;
-
- @Reference(required = true)
- public void setRefs3(Ref[] refs) {
- }
-
- @Reference(required = false)
- public void setRefs4(Collection<Ref> refs) {
- }
-
- }
-
- public void testMultiplicity1ToN() throws Exception {
- processor.visitField(Multiple.class.getDeclaredField("refs1"), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs1");
- assertNotNull(ref);
- assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
- assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
- // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
- }
-
- public void testMultiplicityTo0ToN() throws Exception {
- processor.visitField(Multiple.class.getDeclaredField("refs2"), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs2");
- assertNotNull(ref);
- assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
- assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
- // assertFalse(ref.isMustSupply());
- }
-
- public void testMultiplicity1ToNMethod() throws Exception {
- processor.visitMethod(Multiple.class.getMethod("setRefs3", Ref[].class), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs3");
- assertNotNull(ref);
- assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
- assertEquals(Multiplicity.ONE_N, ref.getMultiplicity());
- // assertEquals(Multiplicity.ONE_ONE, ref.getMultiplicity());
- }
-
- public void testMultiplicity0ToNMethod() throws Exception {
- processor.visitMethod(Multiple.class.getMethod("setRefs4", Collection.class), type);
- org.apache.tuscany.sca.assembly.Reference ref = getReference(type, "refs4");
- assertNotNull(ref);
- assertSame(Ref.class, ((JavaInterface)ref.getInterfaceContract().getInterface()).getJavaClass());
- assertEquals(Multiplicity.ZERO_N, ref.getMultiplicity());
- // assertFalse(ref.isMustSupply());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
deleted file mode 100644
index 7bb8e15696..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ResourceProcessorTestCase.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ResourceProcessorTestCase extends TestCase {
-
- JavaImplementation type;
- ResourceProcessor processor = new ResourceProcessor(new DefaultAssemblyFactory());
-
- public void testVisitField() throws Exception {
- Field field = Foo.class.getDeclaredField("bar");
- processor.visitField(field, type);
- JavaResourceImpl resource = type.getResources().get("bar");
- assertFalse(resource.isOptional());
- assertNull(resource.getMappedName());
- assertEquals(field.getType(), resource.getElement().getType());
- }
-
- public void testVisitMethod() throws Exception {
- Method method = Foo.class.getMethod("setBar", Bar.class);
- processor.visitMethod(method, type);
- JavaResourceImpl resource = type.getResources().get("bar");
- assertFalse(resource.isOptional());
- assertNull(resource.getMappedName());
- assertEquals(method.getParameterTypes()[0], resource.getElement().getType());
- }
-
- public void testVisitNamedMethod() throws Exception {
- Method method = Foo.class.getMethod("setBar2", Bar.class);
- processor.visitMethod(method, type);
- JavaResourceImpl resource = type.getResources().get("someName");
- assertFalse(resource.isOptional());
- assertEquals("mapped", resource.getMappedName());
- }
-
- public void testVisitBadMethod() throws Exception {
- Method method = Foo.class.getMethod("setBad");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalResourceException e) {
- // expected
- }
- }
-
- public void testDuplicateResources() throws Exception {
- Field field = Foo.class.getDeclaredField("bar");
- processor.visitField(field, type);
- try {
- processor.visitField(field, type);
- fail();
- } catch (DuplicateResourceException e) {
- //expected
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- }
-
- private class Foo {
-
- @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
- protected Bar bar;
-
- @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(optional = true)
- protected Bar barNotRequired;
-
- @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
- public void setBar(Bar bar) {
- }
-
- @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource(name = "someName", mappedName = "mapped")
- public void setBar2(Bar bar) {
- }
-
- @org.apache.tuscany.sca.implementation.java.introspect.impl.Resource
- public void setBad() {
- }
-
- }
-
- private interface Bar {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java
deleted file mode 100644
index d7de4e522e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ScopeProcessorTestCase.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ScopeProcessorTestCase extends TestCase {
-
- Component parent;
- private JavaImplementationFactory javaImplementationFactory;
-
- public void testCompositeScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
-
- processor.visitClass(Composite.class, type);
- assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
- }
-
- public void testSessionScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(Session.class, type);
- assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
- }
-
- public void testConversationalScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(Conversation.class, type);
- assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
- }
-
- public void testRequestScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(Request.class, type);
- assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
- }
-
- public void testStatelessScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(Stateless.class, type);
- assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
- }
-
- public void testNoScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(None.class, type);
- assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- parent = EasyMock.createNiceMock(Component.class);
- }
-
- @org.osoa.sca.annotations.Scope("COMPOSITE")
- private class Composite {
- }
-
- @org.osoa.sca.annotations.Scope("SESSION")
- private class Session {
- }
-
- @org.osoa.sca.annotations.Scope("CONVERSATION")
- private class Conversation {
- }
-
- @org.osoa.sca.annotations.Scope("REQUEST")
- private class Request {
- }
-
- @org.osoa.sca.annotations.Scope("STATELESS")
- private class Stateless {
- }
-
- private class None {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
deleted file mode 100644
index 10f0500e4d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceCallbackTestCase.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.ModelHelper.getService;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ServiceCallbackTestCase extends TestCase {
- private ServiceProcessor processor;
- private JavaImplementationFactory javaImplementationFactory;
-
- @Override
- protected void setUp() throws Exception {
- processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- javaImplementationFactory = new DefaultJavaImplementationFactory();
- }
-
- public void testMethodCallbackInterface() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooImpl.class, type);
- org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
- assertNotNull(service);
- Method method = FooImpl.class.getMethod("setCallback", FooCallback.class);
- processor.visitMethod(method, type);
- assertEquals(method, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().getAnchor());
- }
-
- public void testFieldCallbackInterface() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooImpl.class, type);
- org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
- assertNotNull(service);
- Field field = FooImpl.class.getDeclaredField("callback");
- processor.visitField(field, type);
- assertEquals(field, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().getAnchor());
- }
-
- public void testFieldCallbackInterface1() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(FooImpl1.class, type);
- org.apache.tuscany.sca.assembly.Service service = getService(type, Foo.class.getSimpleName());
- assertNotNull(service);
- Field field1 = FooImpl1.class.getDeclaredField("callbackRef");
- processor.visitField(field1, type);
- assertEquals(field1, type.getCallbackMembers().get(FooCallback.class.getName()).iterator().next().getAnchor());
-
- }
-
- public void testMethodDoesNotMatchCallback() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(BadBarImpl.class, type);
- Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalCallbackReferenceException e) {
- // expected
- }
- }
-
- public void testNoParamCallback() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(BadBarImpl.class, type);
- Method method = BadBarImpl.class.getMethod("setNoParamCallback");
- try {
- processor.visitMethod(method, type);
- fail();
- } catch (IllegalCallbackReferenceException e) {
- // expected
- }
- }
-
- public void testFieldDoesNotMatchCallback() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- processor.visitClass(BadBarImpl.class, type);
- Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
- try {
- processor.visitField(field, type);
- fail();
- } catch (IllegalCallbackReferenceException e) {
- // expected
- }
- }
-
- public void testBadCallbackInterfaceAnnotation() throws Exception {
- JavaImplementation type = javaImplementationFactory.createJavaImplementation();
- try {
- processor.visitClass(BadFooImpl.class, type);
- fail();
- } catch (IntrospectionException e) {
- // expected
- assertTrue(e.getCause() instanceof InvalidCallbackException);
- }
- }
-
- @Callback(FooCallback.class)
- private interface Foo {
-
- }
-
- private interface FooCallback {
-
- }
-
- @Service(Foo.class)
- private static class FooImpl implements Foo {
-
- @Callback
- protected FooCallback callback;
-
- @Callback
- public void setCallback(FooCallback cb) {
-
- }
- }
-
- @Service(Foo.class)
- private static class FooImpl1 implements Foo {
- @Callback
- protected CallableReference<FooCallback> callbackRef;
- }
-
- private static class BadBarImpl implements Foo {
- @Callback
- protected String wrongInterfaceCallback;
-
- @Callback
- public void setWrongInterfaceCallback(String cb) {
-
- }
-
- @Callback
- public void setNoParamCallback() {
-
- }
-
- }
-
- @Callback
- private interface BadFoo {
-
- }
-
- @Service(BadFoo.class)
- private static class BadFooImpl implements BadFoo {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java
deleted file mode 100644
index aea90aa6eb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-java/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ServiceProcessorTestCase.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import javax.jws.WebService;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Remotable;
-import org.osoa.sca.annotations.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ServiceProcessorTestCase extends TestCase {
- private ServiceProcessor processor;
- private JavaImplementation type;
-
- public void testMultipleInterfaces() throws Exception {
- processor.visitClass(FooMultiple.class, type);
- assertEquals(2, type.getServices().size());
- org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, Baz.class.getSimpleName());
- assertEquals(Baz.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
- assertEquals(Bar.class, ((JavaInterface)service.getInterfaceContract().getCallbackInterface()).getJavaClass());
- assertNotNull(ModelHelper.getService(type, Bar.class.getSimpleName()));
- }
-
- public void testSingleInterfaces() throws Exception {
- processor.visitClass(FooSingle.class, type);
- assertEquals(1, type.getServices().size());
- assertNotNull(ModelHelper.getService(type, Baz.class.getSimpleName()));
- }
-
- public void testMultipleNoService() throws Exception {
- processor.visitClass(FooMultipleNoService.class, type);
- assertEquals(0, type.getServices().size());
- }
-
- /**
- * Verifies a service with a callback annotation is recognized
- */
- public void testMultipleWithCallbackAnnotation() throws Exception {
- processor.visitClass(FooMultipleWithCalback.class, type);
- assertEquals(1, type.getServices().size());
- }
-
-
- public void testMultipleWithWebServiceAnnotation() throws Exception {
- processor.visitClass(FooMultipleWithWebService.class, type);
- assertEquals(2, type.getServices().size());
- }
-
- public void testRemotableNoService() throws Exception {
- processor.visitClass(FooRemotableNoService.class, type);
- assertEquals(1, type.getServices().size());
- org.apache.tuscany.sca.assembly.Service service = ModelHelper.getService(type, BazRemotable.class.getSimpleName());
- assertEquals(BazRemotable.class, ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass());
- }
-
- public void testNonInterface() throws Exception {
- processor.visitClass(FooServiceUsingClassImpl.class, type);
- }
-
- public void testNoInterfaces() throws Exception {
- try {
- processor.visitClass(BadDefinition.class, type);
- } catch (IllegalServiceDefinitionException e) {
- //not expected
- fail();
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- }
-
- @Callback(Bar.class)
- private interface Baz {
- }
-
- private interface Bar {
- }
-
- private interface Bar2 {
- }
-
- @WebService
- private interface Bar3 {
- }
-
- @Remotable
- private interface BazRemotable {
- }
-
- @Service(interfaces = {Baz.class, Bar.class})
- private class FooMultiple implements Baz, Bar {
-
- }
-
- @Service(Baz.class)
- private class FooSingle implements Baz, Bar {
-
- }
-
- private class FooMultipleNoService implements Bar, Bar2 {
-
- }
-
- private class FooMultipleWithCalback implements Baz, Bar {
-
- }
-
- private class FooMultipleWithWebService implements BazRemotable, Bar3 {
- }
-
- private class FooRemotableNoService implements BazRemotable, Bar {
-
- }
-
- @Service(FooSingle.class)
- private class FooServiceUsingClassImpl extends FooSingle {
-
- }
-
-
- @Service()
- private class BadDefinition extends FooSingle {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/LICENSE b/branches/sca-java-1.5.1/modules/implementation-jee/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/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-java-1.5.1/modules/implementation-jee/NOTICE b/branches/sca-java-1.5.1/modules/implementation-jee/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/pom.xml b/branches/sca-java-1.5.1/modules/implementation-jee/pom.xml
deleted file mode 100644
index 0d99755c51..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/pom.xml
+++ /dev/null
@@ -1,97 +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.
--->
-
-<!-- $Rev$ $Date$ -->
-
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-jee</artifactId>
- <name>Apache Tuscany SCA JEE Implementation Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-jee</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-jee-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.jee</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.jee*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.java
deleted file mode 100644
index 779ac976ee..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementation.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.implementation.jee;
-
-import org.apache.tuscany.sca.assembly.Composite;
-
-/**
- * The model representing a JEE implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface JEEImplementation extends Composite {
-
- /**
- * Returns the archive.
- *
- * @return the archive
- */
- String getArchive();
-
- /**
- * Sets the archive.
- *
- * @param archive
- */
- void setArchive(String archive);
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementationFactory.java
deleted file mode 100644
index 331c53a596..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/JEEImplementationFactory.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.implementation.jee;
-
-/**
- * Factory for the JEE implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface JEEImplementationFactory {
-
- /**
- * Creates a new JEE implementation.
- *
- * @return a new JEE implementation
- */
- JEEImplementation createJEEImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationFactoryImpl.java
deleted file mode 100644
index b82571dc58..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationFactoryImpl.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.jee.impl;
-
-import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
-import org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory;
-
-/**
- * Factory for the JEE implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class JEEImplementationFactoryImpl implements JEEImplementationFactory {
-
- public JEEImplementationFactoryImpl() {
- }
-
- public JEEImplementation createJEEImplementation() {
- return new JEEImplementationImpl();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.java
deleted file mode 100644
index 39f3c12816..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/impl/JEEImplementationImpl.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.implementation.jee.impl;
-
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.impl.CompositeImpl;
-import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
-
-/**
- * The model representing a JEE implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class JEEImplementationImpl extends CompositeImpl implements JEEImplementation {
-
- private String archive;
-
- /**
- * Constructs a new JEE implementation.
- */
- JEEImplementationImpl() {
- super();
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The JEE implementation does not support constrainingTypes
- return null;
- }
-
- @Override
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The JEE implementation does not support constrainingTypes
- }
-
- public String getArchive() {
- return archive;
- }
-
- public void setArchive(String archive) {
- this.archive = archive;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
deleted file mode 100644
index 9059d2da26..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/java/org/apache/tuscany/sca/implementation/jee/xml/JEEImplementationProcessor.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.jee.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.net.URI;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.EjbModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.ExternalEarInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEApplicationInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
-import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
-import org.apache.tuscany.sca.contribution.jee.ModelObject;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.impl.EjbModuleInfoImpl;
-import org.apache.tuscany.sca.contribution.jee.impl.JavaEEApplicationInfoImpl;
-import org.apache.tuscany.sca.contribution.jee.impl.ModelObjectImpl;
-import org.apache.tuscany.sca.contribution.jee.impl.WebModuleInfoImpl;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
-import org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Implements a StAX artifact processor for JEE implementations.
- *
- * @version $Rev$ $Date$
- */
-public class JEEImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JEEImplementation> {
- private static final QName IMPLEMENTATION_JEE = new QName(Constants.SCA10_NS, "implementation.jee");
-
- private AssemblyFactory assemblyFactory;
- private PolicyFactory policyFactory;
- private JEEImplementationFactory implementationFactory;
- private JavaEEExtension jeeExtension;
- private JavaEEOptionalExtension jeeOptionalExtension;
- private Monitor monitor;
- private PolicyAttachPointProcessor policyProcessor;
-
- private StAXArtifactProcessorExtensionPoint artifactProcessors;
- private StAXArtifactProcessor<Composite> compositeProcessor;
-
- public JEEImplementationProcessor(ExtensionPointRegistry registry,
- Monitor monitor) {
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.implementationFactory = modelFactories.getFactory(JEEImplementationFactory.class);
- this.jeeExtension = modelFactories.getFactory(JavaEEExtension.class);
- this.jeeOptionalExtension = modelFactories.getFactory(JavaEEOptionalExtension.class);
- this.monitor = monitor;
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
-
- artifactProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- compositeProcessor = artifactProcessors.getProcessor(Composite.class);
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_JEE;
- }
-
- public Class<JEEImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return JEEImplementation.class;
- }
-
- public JEEImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.jee> element
- JEEImplementation implementation = implementationFactory.createJEEImplementation();
- implementation.setUnresolved(true);
-
- implementation.setName(IMPLEMENTATION_JEE);
-
- // Read the archive attribute
- String archive = getString(reader, "archive");
- if (archive != null) {
- implementation.setArchive(archive);
-
- // Set the URI of the component type
- implementation.setURI(archive);
- }
-
- // Read policies
- policyProcessor.readPolicies(implementation, reader);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_JEE.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(JEEImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
- // Resolve the component type
- String uri = implementation.getURI();
- String archive = implementation.getArchive();
- if (uri != null) {
- Object moduleInfo = null;
- ExternalEarInfo extEar = null;
- if(uri.equals("")) {
- if(moduleInfo == null) {
- WebModuleInfo unresolved = new WebModuleInfoImpl();
- unresolved.setUri(URI.create(archive));
- WebModuleInfo resolved = resolver.resolveModel(WebModuleInfo.class, unresolved);
- if(unresolved != resolved) {
- moduleInfo = resolved;
- }
- }
- if(moduleInfo == null) {
- EjbModuleInfo unresolved = new EjbModuleInfoImpl();
- unresolved.setUri(URI.create(archive));
- EjbModuleInfo resolved = resolver.resolveModel(EjbModuleInfo.class, unresolved);
- if(unresolved != resolved) {
- moduleInfo = resolved;
- }
- }
- if(moduleInfo == null) {
- JavaEEApplicationInfo unresolved = new JavaEEApplicationInfoImpl();
- unresolved.setUri(URI.create(archive));
- JavaEEApplicationInfo resolved = resolver.resolveModel(JavaEEApplicationInfo.class, unresolved);
- if(unresolved != resolved) {
- moduleInfo = resolved;
- }
- }
- } else if(uri.endsWith(".war")) {
- WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
- webModuleInfo.setUri(URI.create(archive));
- webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
- moduleInfo = webModuleInfo;
- } else if(uri.endsWith(".jar")) {
- EjbModuleInfo ejbModuleInfo = new EjbModuleInfoImpl();
- ejbModuleInfo.setUri(URI.create(archive));
- ejbModuleInfo = resolver.resolveModel(EjbModuleInfo.class, ejbModuleInfo);
- moduleInfo = ejbModuleInfo;
- } else if(uri.endsWith(".ear")) {
- final JavaEEApplicationInfo appInfo = new JavaEEApplicationInfoImpl();
- appInfo.setUri(URI.create(archive));
- ExternalEarInfo unresolved = new ExternalEarInfo() {
- public JavaEEApplicationInfo getAppInfo() {
- return appInfo;
- }
- public Composite getAppComposite() {
- return null;
- }};
-
- ExternalEarInfo resolved = resolver.resolveModel(ExternalEarInfo.class, unresolved);
- if(resolved != unresolved) {
- extEar = resolved;
- }
- moduleInfo = resolved.getAppInfo();
- }
-
- if(moduleInfo instanceof WebModuleInfo) {
- // Check for web composite
- ModelObject unresolved = new ModelObjectImpl();
- unresolved.setUri(URI.create("WEB-INF/web.composite"));
- ModelObject resolved = resolver.resolveModel(ModelObject.class, unresolved);
- if(resolved != unresolved) {
- // Found web composite so the war itself must have been the contribution
- Composite appComposite = (Composite)resolved.getObject();
- mergeCompositeInfo(appComposite, implementation);
- }
-
- // TODO: Obtain includeDefaults value from the composite
- boolean includeDefaults = false;
-
- if(includeDefaults || resolved == unresolved) {
- // there is either no application composite or we are ignoring it as the
- // war is nested inside another contribution
- if(jeeOptionalExtension != null) {
- jeeOptionalExtension.createImplementationJeeComposite((WebModuleInfo)moduleInfo, implementation);
- }
- // now resolve the implementation composite as a real composite.
- compositeProcessor.resolve((Composite)implementation, resolver);
- }
- } else if(moduleInfo instanceof EjbModuleInfo) {
- // Check for ejb-jar composite
- ModelObject unresolved = new ModelObjectImpl();
- unresolved.setUri(URI.create("META-INF/ejb-jar.composite"));
- ModelObject resolved = resolver.resolveModel(ModelObject.class, unresolved);
- if(resolved != unresolved) {
- // Found ejb-jar composite so the ejb jar itself must have been the contribution
- Composite appComposite = (Composite)resolved.getObject();
- mergeCompositeInfo(appComposite, implementation);
- }
-
- // TODO: Obtain includeDefaults value from the composite
- boolean includeDefaults = false;
-
- if(includeDefaults || resolved == unresolved) {
- if(jeeExtension != null) {
- jeeExtension.createImplementationJeeComposite((EjbModuleInfo)moduleInfo, implementation);
-
- }
- if(jeeOptionalExtension != null) {
- jeeOptionalExtension.createImplementationJeeComposite((EjbModuleInfo)moduleInfo, implementation);
- }
- // now resolve the implementation composite as a real composite.
- compositeProcessor.resolve((Composite)implementation, resolver);
- }
- } else if(moduleInfo instanceof JavaEEApplicationInfo) {
- // Check for application composite
- Composite appComposite = null;
- if(extEar != null) {
- appComposite = extEar.getAppComposite();
- } else {
- ModelObject unresolved = new ModelObjectImpl();
- unresolved.setUri(URI.create("META-INF/application.composite"));
- ModelObject resolved = resolver.resolveModel(ModelObject.class, unresolved);
- if(resolved != unresolved) {
- // Found application composite
- appComposite = (Composite)resolved.getObject();
- }
- }
-
- if(appComposite != null) {
- // Found application composite so copy it's details across into
- // the implementation (which is itself a composite)
- mergeCompositeInfo(appComposite, implementation);
- }
-
- // TODO: Obtain includeDefaults value from the composite
- boolean includeDefaults = false;
-
- if(includeDefaults || appComposite == null) {
- if(jeeExtension != null) {
- jeeExtension.createImplementationJeeComposite((JavaEEApplicationInfo)moduleInfo, implementation);
- }
- if(jeeOptionalExtension != null) {
- jeeOptionalExtension.createImplementationJeeComposite((JavaEEApplicationInfo)moduleInfo, implementation);
- }
- // now resolve the implementation composite as a real composite.
- compositeProcessor.resolve((Composite)implementation, resolver);
- }
- }
-
- // we could have resolved the whole implementation composite here except that
- // it messes up the resolvers associated with the
- }
- implementation.setUnresolved(false);
- }
-
- private void mergeCompositeInfo(Composite fromComposite, Composite intoComposite){
- intoComposite.getApplicablePolicySets().addAll(fromComposite.getApplicablePolicySets());
- intoComposite.getAttributeExtensions().addAll(fromComposite.getAttributeExtensions());
- intoComposite.setAutowire(fromComposite.getAutowire());
- intoComposite.getComponents().addAll(fromComposite.getComponents());
- intoComposite.setConstrainingType(fromComposite.getConstrainingType());
- intoComposite.getExtensions().addAll(fromComposite.getExtensions());
- intoComposite.setLocal(fromComposite.isLocal());
- intoComposite.getIncludes().addAll(fromComposite.getIncludes());
- intoComposite.setName(fromComposite.getName());
- intoComposite.getPolicySets().addAll(fromComposite.getPolicySets());
- intoComposite.getProperties().addAll(fromComposite.getProperties());
- intoComposite.getReferences().addAll(fromComposite.getReferences());
- intoComposite.getRequiredIntents().addAll(fromComposite.getRequiredIntents());
- intoComposite.getServices().addAll(fromComposite.getServices());
- intoComposite.setType(fromComposite.getType());
- intoComposite.setUnresolved(fromComposite.isUnresolved());
- intoComposite.setURI(fromComposite.getURI());
- intoComposite.getWires().addAll(fromComposite.getWires());
- }
-
- public void write(JEEImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.jee>
- writeStart(writer, IMPLEMENTATION_JEE.getNamespaceURI(), IMPLEMENTATION_JEE.getLocalPart(),
- new XAttr("archive", implementation.getArchive()));
-
- policyProcessor.writePolicyAttributes(implementation, writer);
- writeEnd(writer);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 06b5f2198b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# $Rev$ $Date$
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.jee.xml.JEEImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.jee,model=org.apache.tuscany.sca.implementation.jee.JEEImplementation,factory=org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory
deleted file mode 100644
index dcdfb7dfb5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.jee.JEEImplementationFactory
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# $Rev$ $Date$
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.jee.impl.JEEImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.java
deleted file mode 100644
index 471ce480a0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/ReadTestCase.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.implementation.jee.xml;
-
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.implementation.jee.impl.JEEImplementationImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Test reading JEE implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestJEE.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- JEEImplementationImpl implementation = (JEEImplementationImpl) composite.getComponents().get(0).getImplementation();
-
- assertTrue(implementation.getArchive().equals("myarchive.ear"));
- PolicySet policySet = implementation.getPolicySets().get(0);
- assertEquals(new QName("http://sample/test-policy", "allowRole1"), policySet.getName());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.java
deleted file mode 100644
index 1ec1e928d2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/org/apache/tuscany/sca/implementation/jee/xml/WriteTestCase.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.implementation.jee.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write JEE implementations.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestJEE.composite");
- Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- assertTrue(bos.toString().contains("archive=\"myarchive.ear\""));
- assertTrue(bos.toString().contains("allowRole1"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/Helloworld.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/Helloworld.java
deleted file mode 100644
index 2cb6886b31..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/Helloworld.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package test;
-
-public interface Helloworld {
-
- String getGreetings(String name);
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/MockImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/MockImplementationProviderFactory.java
deleted file mode 100644
index 5b9b2a890b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/java/test/MockImplementationProviderFactory.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 test;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.jee.JEEImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-public class MockImplementationProviderFactory implements ImplementationProviderFactory<JEEImplementation>{
-
- public MockImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
-
- }
-
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- JEEImplementation Implementation) {
- return null;
- }
-
- public Class<JEEImplementation> getModelType() {
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 0a7205ab61..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-test.MockImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.jee.JEEImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite b/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite
deleted file mode 100644
index edd694a5e2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-jee/src/test/resources/org/apache/tuscany/sca/implementation/jee/xml/TestJEE.composite
+++ /dev/null
@@ -1,32 +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.
--->
-
-<!-- $Rev$ $Date$ -->
-
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://sample/jee"
- xmlns:sc="http://sample/composite"
- xmlns:test="http://sample/test-policy"
- name="TestJEE">
-
- <component name="TestJEE">
- <implementation.jee archive="myarchive.ear" policySets="test:allowRole1"/>
- </component>
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-node-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/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-java-1.5.1/modules/implementation-node-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-node-runtime/NOTICE
deleted file mode 100644
index 94481d6cfa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2007 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-node-runtime/pom.xml
deleted file mode 100644
index b33d64b94a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/pom.xml
+++ /dev/null
@@ -1,103 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-node-runtime</artifactId>
- <name>Apache Tuscany SCA Node Implementation Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-launcher</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.node.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.node*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
deleted file mode 100644
index 8de2a3a3f9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationDaemonBootstrap.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.launcher;
-
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-
-/**
- * Bootstrap class for the SCA node daemon.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationDaemonBootstrap {
- private SCANode node;
-
- /**
- * A node wrappering an instance of a node daemon.
- */
- public static class NodeFacade implements SCANode {
- private ClassLoader threadContextClassLoader;
- private ClassLoader runtimeClassLoader;
- private SCANode daemon;
-
- private NodeFacade() {
- runtimeClassLoader = Thread.currentThread().getContextClassLoader();
- }
-
- public void start() {
- threadContextClassLoader = Thread.currentThread().getContextClassLoader();
- boolean started = false;
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- SCANodeFactory factory = SCANodeFactory.newInstance();
- daemon = factory.createSCANodeFromClassLoader("NodeDaemon.composite", threadContextClassLoader);
- started = true;
- } finally {
- if (!started) {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
- }
-
- public void stop() {
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- daemon.stop();
- } finally {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
- }
-
- /**
- * Constructs a new daemon bootstrap.
- */
- public NodeImplementationDaemonBootstrap() throws Exception {
- node = new NodeFacade();
- }
-
- /**
- * Returns the node representing the daemon.
- * @return
- */
- public SCANode getNode() {
- return node;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
deleted file mode 100644
index 0264574fb9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherBootstrap.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.launcher;
-
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-/**
- * Bootstrap class for standalone SCA nodes.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationLauncherBootstrap {
-
- private SCANode node;
-
- /**
- * A node facade.
- */
- public static class NodeFacade implements SCANode, SCAClient {
- private ClassLoader threadContextClassLoader;
- private ClassLoader runtimeClassLoader;
- private SCANode delegate;
-
- private NodeFacade(SCANode delegate) {
- runtimeClassLoader = Thread.currentThread().getContextClassLoader();
- this.delegate = delegate;
- }
-
- public void start() {
- threadContextClassLoader = Thread.currentThread().getContextClassLoader();
- boolean started = false;
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- delegate.start();
- started = true;
- } finally {
- if (!started) {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
- }
-
- public void stop() {
- try {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- delegate.stop();
- } finally {
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
- }
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- return (R)((SCAClient)delegate).cast(target);
- }
-
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- return (B)((SCAClient)delegate).getService(businessInterface, serviceName);
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName) {
- return (ServiceReference<B>)((SCAClient)delegate).getServiceReference(businessInterface, referenceName);
- }
- }
-
- /**
- * Bootstrap a new SCA node.
- *
- * @param configurationURI
- */
- public NodeImplementationLauncherBootstrap(String configurationURI) throws Exception {
- SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
- node = new NodeFacade(nodeFactory.createSCANodeFromURL(configurationURI));
- }
-
- /**
- * Bootstrap a new SCA node.
- *
- * @param configurationURI
- * @param contributionClassLoader
- */
- public NodeImplementationLauncherBootstrap(String compositeURI, ClassLoader contributionClassLoader) throws Exception {
- SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
- node = new NodeFacade(nodeFactory.createSCANodeFromClassLoader(compositeURI, contributionClassLoader));
- }
-
- /**
- * Bootstrap a new SCA node.
- *
- * @param compositeURI
- * @param uris
- * @param locations
- */
- public NodeImplementationLauncherBootstrap(String compositeURI, String[] uris, String[] locations) throws Exception {
- SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
- SCAContribution[] contributions = new SCAContribution[uris.length];
- for (int i = 0; i < uris.length; i++) {
- contributions[i] = new SCAContribution(uris[i], locations[i]);
- }
- node = new NodeFacade(nodeFactory.createSCANode(compositeURI, contributions));
- }
-
- /**
- * Bootstrap a new SCA node.
- *
- * @param compositeURI
- * @param uris
- * @param locations
- */
- public NodeImplementationLauncherBootstrap(String compositeURI, String compositeContent, String[] uris, String[] locations) throws Exception {
- SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
- SCAContribution[] contributions = new SCAContribution[uris.length];
- for (int i = 0; i < uris.length; i++) {
- contributions[i] = new SCAContribution(uris[i], locations[i]);
- }
- node = new NodeFacade(nodeFactory.createSCANode(compositeURI, compositeContent, contributions));
- }
-
- /**
- * Returns the SCA node.
- *
- * @return
- */
- public SCANode getNode() {
- return node;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.java
deleted file mode 100644
index 62a822a85e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/launcher/NodeImplementationLauncherUtil.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.implementation.node.launcher;
-
-/**
- * Utility methods for node implementation launchers.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationLauncherUtil {
-
- private static final String TUSCANY_DOMAIN = "TUSCANY_DOMAIN";
- private static final String DEFAULT_DOMAIN = "http://localhost:9990";
-
- /**
- * Determine the URI of a node configuration. The domain URI can be configured
- * using a TUSCANY_DOMAIN system property or environment variable.
- *
- * @param nodeName
- * @return
- */
- public static String nodeConfigurationURI(String nodeName) {
- String domain = System.getProperty(TUSCANY_DOMAIN);
- if (domain == null || domain.length() == 0) {
- domain = System.getenv(TUSCANY_DOMAIN);
- }
- if (domain == null || domain.length() ==0) {
- domain = DEFAULT_DOMAIN;
- }
- String nodeConfiguration = domain + "/node-config/" + nodeName;
- return nodeConfiguration;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.java
deleted file mode 100644
index 5895a8614d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationInvoker.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.implementation.node.provider;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Implements an invoker for node component implementations.
- *
- * @version $Rev$ $Date$
- */
-class NodeImplementationInvoker implements Invoker {
- private Composite composite;
-
- NodeImplementationInvoker(Composite composite) {
- this.composite = composite;
- }
-
- public Message invoke(Message msg) {
- //FIXME Implement later
- msg.setBody(composite);
- return msg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.java
deleted file mode 100644
index 6cdb18938e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProvider.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.implementation.node.provider;
-
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * An implementation provider for node component implementations.
- *
- * @version $Rev$ $Date$
- */
-class NodeImplementationProvider implements ImplementationProvider {
-
- private NodeImplementation implementation;
-
- /**
- * Constructs a new node implementation provider.
- *
- * @param component
- * @param implementation
- */
- NodeImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
- this.implementation = implementation;
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- NodeImplementationInvoker invoker = new NodeImplementationInvoker(implementation.getComposite());
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.java
deleted file mode 100644
index e2a3e4df92..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/provider/NodeImplementationProviderFactory.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.implementation.node.provider;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Factory for node component implementation providers.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationProviderFactory implements ImplementationProviderFactory<NodeImplementation> {
-
- /**
- * Constructs a new factory.
- *
- * @param extensionPoints
- */
- public NodeImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, NodeImplementation implementation) {
- return new NodeImplementationProvider(component, implementation);
- }
-
- public Class<NodeImplementation> getModelType() {
- return NodeImplementation.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java
deleted file mode 100644
index f6a601a3cd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppRequestDispatcher.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.webapp;
-
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-
-/**
- * A Servlet request dispatcher that can be used to delegate requests to a
- * Serlvet registered with the Webapp Servlet host.
- *
- * @version $Rev$ $Date$
- */
-class NodeWebAppRequestDispatcher implements RequestDispatcher {
- private String servletPath;
- private Servlet servlet;
-
- /**
- * Constructs a new request dispatcher.
- *
- * @param mapping
- * @param servlet
- */
- public NodeWebAppRequestDispatcher(String mapping, Servlet servlet) {
- if (mapping.endsWith("*")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- if (mapping.endsWith("/")) {
- mapping = mapping.substring(0, mapping.length()-1);
- }
- this.servletPath = mapping;
- this.servlet = servlet;
- }
-
- /**
- * Returns a request wrapper which will return the correct Servlet path
- * and path info.
- *
- * @param request
- * @return
- */
- private HttpServletRequest createRequestWrapper(ServletRequest request) {
- HttpServletRequest requestWrapper = new HttpServletRequestWrapper((HttpServletRequest)request) {
-
- @Override
- public String getServletPath() {
- return servletPath;
- }
-
- @Override
- public String getPathInfo() {
- String path = super.getServletPath();
- if (path.length() == 0) {
- path = super.getPathInfo();
- }
-
- // TODO: another context path hack, revisit when context path is sorted out
- path = fiddlePath(path, servletPath);
-
- return path;
- }
- };
- return requestWrapper;
- }
-
- /**
- * Remove any path suffix thats part of the Servlet context path.
- *
- * @param path
- * @param servletPath
- */
- private static String fiddlePath(String path, String servletPath) {
- StringTokenizer st = new StringTokenizer(path, "/");
- String root = "";
- while (st.hasMoreTokens()){
- String s = st.nextToken();
- if (servletPath.endsWith((root + "/" + s))) {
- root += "/" + s;
- } else {
- break;
- }
- }
- String fiddlePath = path.substring(root.length());
- return fiddlePath;
- }
-
- public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-
- public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
- servlet.service(createRequestWrapper(request), response);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java
deleted file mode 100644
index cefd99fe96..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/java/org/apache/tuscany/sca/implementation/node/webapp/NodeWebAppServletHost.java
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.webapp;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.InetAddress;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.RequestDispatcher;
-import javax.servlet.Servlet;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.SecurityContext;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.host.http.ServletMappingException;
-import org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherUtil;
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-
-/**
- * ServletHost implementation for use in a Webapp Node environment.
- *
- * @version $Rev$ $Date$
- */
-public class NodeWebAppServletHost implements ServletHost, Filter {
- private static final Logger logger = Logger.getLogger(NodeWebAppServletHost.class.getName());
-
- private static final NodeWebAppServletHost servletHost = new NodeWebAppServletHost();
-
- private Map<String, Servlet> servlets = new HashMap<String, Servlet>();
- private SCANode node;
-
- private String contextPath = "/";
- private int defaultPort = 8080;
-
- /**
- * Constructs a new NodeWebAppServletHost.
- */
- private NodeWebAppServletHost() {
- }
-
- /**
- * Returns the Servlet host for the current Web app.
- *
- * @return
- */
- public static NodeWebAppServletHost servletHost() {
- return servletHost;
- }
-
- /**
- * Initialize the Servlet host.
- *
- * @param filterConfig
- * @throws ServletException
- */
- public void init(final FilterConfig filterConfig) throws ServletException {
-
- // Create a Servlet config wrapping the given filter config
- ServletConfig servletConfig = servletConfig(filterConfig);
-
- // Get the Servlet context
- ServletContext servletContext = servletConfig.getServletContext();
-
- // Initialize the context path
- contextPath = contextPath(servletContext);
-
- // Derive the node name from the Webapp context path
- String nodeName = contextPath;
- if (nodeName.startsWith("/")) {
- nodeName = nodeName.substring(1);
- }
- if (nodeName.endsWith("/")) {
- nodeName = nodeName.substring(0, nodeName.length() - 1);
- }
-
- // Determine the node configuration URI
- String nodeConfiguration = NodeImplementationLauncherUtil.nodeConfigurationURI(nodeName);
-
- // Create the SCA node
- SCANodeFactory nodeFactory = SCANodeFactory.newInstance();
- node = nodeFactory.createSCANodeFromURL(nodeConfiguration);
-
- // Register the Servlet host
- ServletHostExtensionPoint servletHosts = servletHosts(node);
- servletHosts.getServletHosts().clear();
- servletHosts.addServletHost(servletHost);
-
- // Save the node in the Servlet context
- servletContext.setAttribute(SCAClient.class.getName(), node);
-
- // Start the node
- node.start();
-
- // Initialize the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.init(servletConfig);
- }
- }
-
- public void addServletMapping(String suri, Servlet servlet) throws ServletMappingException {
- addServletMapping(suri, servlet, null);
- }
-
- public void addServletMapping(String suri, Servlet servlet, SecurityContext securityContext) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- servlets.put(suri, servlet);
-
- logger.info("Added Servlet mapping: " + suri);
- }
-
- public Servlet removeServletMapping(String suri) throws ServletMappingException {
- URI pathURI = URI.create(suri);
-
- // Make sure that the path starts with a /
- suri = pathURI.getPath();
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // In a webapp just use the given path and ignore the host and port
- // as they are fixed by the Web container
- return servlets.remove(suri);
- }
-
- public Servlet getServletMapping(String suri) throws ServletMappingException {
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- if (!suri.startsWith(contextPath)) {
- suri = contextPath + suri;
- }
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- return servlet;
- }
-
- public URL getURLMapping(String suri) throws ServletMappingException {
- URI uri = URI.create(suri);
-
- // Get the URI scheme and port
- String scheme = uri.getScheme();
- if (scheme == null) {
- scheme = "http";
- }
- int portNumber = uri.getPort();
- if (portNumber == -1) {
- portNumber = defaultPort;
- }
-
- // Get the host
- String host;
- try {
- host = InetAddress.getLocalHost().getHostName();
- } catch (UnknownHostException e) {
- host = "localhost";
- }
-
- // Construct the URL
- String path = uri.getPath();
- if (!path.startsWith("/")) {
- path = '/' + path;
- }
-
- if (contextPath != null && !path.startsWith(contextPath)) {
- path = contextPath + path;
- }
-
- URL url;
- try {
- url = new URL(scheme, host, portNumber, path);
- } catch (MalformedURLException e) {
- throw new ServletMappingException(e);
- }
- return url;
- }
-
- public RequestDispatcher getRequestDispatcher(String suri) throws ServletMappingException {
-
- // Make sure that the path starts with a /
- if (!suri.startsWith("/")) {
- suri = '/' + suri;
- }
-
- suri = contextPath + suri;
-
- // Get the Servlet mapped to the given path
- Servlet servlet = servlets.get(suri);
- if (servlet != null) {
- return new NodeWebAppRequestDispatcher(suri, servlet);
- }
-
- for (Map.Entry<String, Servlet> entry : servlets.entrySet()) {
- String servletPath = entry.getKey();
- if (servletPath.endsWith("*")) {
- servletPath = servletPath.substring(0, servletPath.length() - 1);
- if (suri.startsWith(servletPath)) {
- return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
- } else {
- if ((suri + "/").startsWith(servletPath)) {
- return new NodeWebAppRequestDispatcher(entry.getKey(), entry.getValue());
- }
- }
- }
- }
-
- // No Servlet found
- return null;
- }
-
- /**
- * Destroy the Servlet host.
- *
- * @throws ServletException
- */
- public void destroy() {
-
- // Destroy the registered Servlets
- for (Servlet servlet : servlets.values()) {
- servlet.destroy();
- }
-
- // Stop the node
- if (node != null) {
- node.stop();
- }
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
- throws IOException, ServletException {
-
- // Get the Servlet path
- HttpServletRequest httpRequest = (HttpServletRequest)request;
- String path = httpRequest.getPathInfo();
- if (path == null) {
- path = httpRequest.getServletPath();
- }
- if (path == null) {
- path = "/";
- }
-
- // Get a request dispatcher for the Servlet mapped to that path
- RequestDispatcher dispatcher = getRequestDispatcher(path);
- if (dispatcher != null) {
-
- // Let the dispatcher forward the request to the Servlet
- dispatcher.forward(request, response);
-
- } else {
-
- // Proceed down the filter chain
- chain.doFilter(request, response);
- }
- }
-
- public void setDefaultPort(int port) {
- defaultPort = port;
- }
-
- public int getDefaultPort() {
- return defaultPort;
- }
-
- public String getContextPath() {
- return contextPath;
- }
-
- public void setContextPath(String path) {
- //this.contextPath = path;
- }
-
- /**
- * Initializes the contextPath
- * The 2.5 Servlet API has a getter for this, for pre 2.5 Servlet
- * containers use an init parameter.
- */
- private static String contextPath(ServletContext context) {
- String contextPath = "/";
-
- // The getContextPath() is introduced since Servlet 2.5
- Method m;
- try {
- // Try to get the method anyway since some ServletContext impl has this method even before 2.5
- m = context.getClass().getMethod("getContextPath", new Class[] {});
- contextPath = (String)m.invoke(context, new Object[] {});
- } catch (Exception e) {
- contextPath = context.getInitParameter("contextPath");
- if (contextPath == null) {
- logger.warning("Servlet level is: " + context.getMajorVersion() + "." + context.getMinorVersion());
- throw new IllegalStateException(
- "'contextPath' init parameter must be set for pre-2.5 servlet container");
- }
- }
-
- logger.info("ContextPath: " + contextPath);
- return contextPath;
- }
-
- /**
- * Returns the Servlet host extension point used by the given node.
- *
- * @return
- */
- private static ServletHostExtensionPoint servletHosts(SCANode node) {
- //FIXME Need a clean way to get the extension point registry
- // from the node
- ExtensionPointRegistry registry;
- try {
- registry = (ExtensionPointRegistry)node.getClass().getMethod("getExtensionPointRegistry").invoke(node);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class);
- return servletHosts;
- }
-
- /**
- * Returns a Servlet config wrapping a filter config.
- *
- * @param filterConfig
- * @return
- */
- private static ServletConfig servletConfig(final FilterConfig filterConfig) {
- ServletConfig servletConfig = new ServletConfig() {
- public String getInitParameter(String name) {
- return filterConfig.getInitParameter(name);
- }
-
- public Enumeration getInitParameterNames() {
- return filterConfig.getInitParameterNames();
- }
-
- public ServletContext getServletContext() {
- return filterConfig.getServletContext();
- }
-
- public String getServletName() {
- return filterConfig.getFilterName();
- }
- };
- return servletConfig;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 306b53be5b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.node.provider.NodeImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.node.NodeImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java
deleted file mode 100644
index 73475f49fe..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/java/org/apache/tuscany/sca/implementation/node/NodeImplementationTestCase.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.node;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-
-/**
- * Test case for node component implementations.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationTestCase extends TestCase {
-
- private SCANode node;
-
- @Override
- protected void setUp() throws Exception {
- node = SCANodeFactory.newInstance().createSCANodeFromClassLoader("TestNode.composite", null);
- }
-
- @Override
- protected void tearDown() throws Exception {
- node.stop();
- }
-
- public void testNode() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestComposite.composite b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestComposite.composite
deleted file mode 100644
index 55644c27e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestComposite.composite
+++ /dev/null
@@ -1,29 +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"
- targetNamespace="http://sample/composite"
- xmlns:sc="http://sample/composite"
- name="TestComposite">
-
- <component name="TestComponent">
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestNode.composite b/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestNode.composite
deleted file mode 100644
index d4dc62a42d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node-runtime/src/test/resources/TestNode.composite
+++ /dev/null
@@ -1,30 +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"
- targetNamespace="http://sample/node"
- xmlns:sc="http://sample/composite"
- name="TestNode">
-
- <component name="TestNode">
- <tuscany:implementation.node uri="TestNode" composite="sc:TestComposite"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/LICENSE b/branches/sca-java-1.5.1/modules/implementation-node/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/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-java-1.5.1/modules/implementation-node/NOTICE b/branches/sca-java-1.5.1/modules/implementation-node/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/pom.xml b/branches/sca-java-1.5.1/modules/implementation-node/pom.xml
deleted file mode 100644
index 4429320a6a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/pom.xml
+++ /dev/null
@@ -1,93 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-node</artifactId>
- <name>Apache Tuscany SCA Node Implementation Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.node</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.node*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java
deleted file mode 100644
index d4755f4071..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/ConfiguredNodeImplementation.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.node;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.contribution.Contribution;
-
-
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface ConfiguredNodeImplementation extends Implementation {
-
- /**
- * Returns the composite deployed to this node.
- * @return the composite deployed to this node
- */
- Composite getComposite();
-
- /**
- * Sets the composite deployed to this node.
- * @param composite the composite deployed to this node
- */
- void setComposite(Composite composite);
-
- /**
- * Returns the list of contributions deployed to this node.
- * @return the list of contributions deployed to this node
- */
- List<Contribution> getContributions();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.java
deleted file mode 100644
index 527698ea91..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementation.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.implementation.node;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface NodeImplementation extends Implementation {
-
- /**
- * Returns the composite deployed to this node.
- * @return the composite deployed to this node
- */
- Composite getComposite();
-
- /**
- * Sets the composite deployed to this node.
- * @param composite the composite deployed to this node
- */
- void setComposite(Composite composite);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.java
deleted file mode 100644
index 9c4fed689b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/NodeImplementationFactory.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.implementation.node;
-
-
-/**
- * Factory for the resource implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface NodeImplementationFactory {
-
- /**
- * Creates a new node implementation.
- * @return a new node implementation
- */
- NodeImplementation createNodeImplementation();
-
- /**
- * Creates a new configured node implementation.
- * @return a new configured node implementation
- */
- ConfiguredNodeImplementation createConfiguredNodeImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
deleted file mode 100644
index 33257a22e4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.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.implementation.node.builder.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.assembly.builder.impl.BaseConfigurationBuilderImpl;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * A composite builder that handles the configuration of composites assigned to
- * node components, from the default configuration from the node components.
- *
- * @version $Rev$ $Date$
- */
-public class NodeCompositeBuilderImpl extends BaseConfigurationBuilderImpl implements CompositeBuilder {
-
- @Deprecated
- public NodeCompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
- null, null,
- interfaceContractMapper, policyDefinitions, monitor);
- }
-
- public NodeCompositeBuilderImpl(AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions,
- Monitor monitor,
- Map<Binding, Binding> bindingMap) {
- super(assemblyFactory, scaBindingFactory,
- documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions, monitor, bindingMap);
- }
-
- public void build(Composite composite) throws CompositeBuilderException {
- configureNodeComponents(composite);
- }
-
- /**
- * Configure the node components in the given composite.
- *
- * @param composite
- * @throws CompositeBuilderException
- */
- private void configureNodeComponents(Composite composite) throws CompositeBuilderException {
-
- // Process each node component in the given composite
- for (Component component: composite.getComponents()) {
- Implementation implementation = component.getImplementation();
- if (implementation instanceof NodeImplementation) {
-
- // Get the application composite assigned to the node
- NodeImplementation nodeImplementation = (NodeImplementation)implementation;
- Composite applicationComposite = nodeImplementation.getComposite();
-
- // Get the default bindings configured on the node
- List<Binding> defaultBindings = new ArrayList<Binding>();
- for (ComponentService componentService: component.getServices()) {
- defaultBindings.addAll(componentService.getBindings());
- }
-
- // Configure services in the application composite assigned to
- // the node using the default bindings.
- configureBindingURIs(applicationComposite, defaultBindings);
- }
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java
deleted file mode 100644
index 1d183513b4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.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.implementation.node.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
-
-
-/**
- * The model representing a configured node implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class ConfiguredNodeImplementationImpl implements ConfiguredNodeImplementation {
-
- private String uri;
- private boolean unresolved;
- private Composite composite;
- private List<Contribution> contributions = new ArrayList<Contribution>();
-
- /**
- * Constructs a new node implementation.
- */
- ConfiguredNodeImplementationImpl() {
- }
-
- public ConstrainingType getConstrainingType() {
- // The node implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- // The node implementation does not support properties
- return Collections.emptyList();
- }
-
- public List<Service> getServices() {
- // The node implementation does not support services
- return Collections.emptyList();
- }
-
- public List<Reference> getReferences() {
- // The node implementation does not support properties
- return Collections.emptyList();
- }
-
- public String getURI() {
- return uri;
- }
-
- public Composite getComposite() {
- return composite;
- }
-
- public List<Contribution> getContributions() {
- return contributions;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The node implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setComposite(Composite composite) {
- this.composite = composite;
- }
-
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.java
deleted file mode 100644
index 94ea610314..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationFactoryImpl.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.implementation.node.impl;
-
-import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-
-/**
- * Factory for the resource implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationFactoryImpl implements NodeImplementationFactory {
-
- public NodeImplementationFactoryImpl() {
- }
-
- public NodeImplementation createNodeImplementation() {
- return new NodeImplementationImpl();
- }
-
- public ConfiguredNodeImplementation createConfiguredNodeImplementation() {
- return new ConfiguredNodeImplementationImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java
deleted file mode 100644
index 8f6315d969..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.node.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-
-
-/**
- * The model representing a node implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class NodeImplementationImpl implements NodeImplementation {
-
- private String uri;
- private boolean unresolved;
- private Composite composite;
-
- /**
- * Constructs a new node implementation.
- */
- NodeImplementationImpl() {
- }
-
- public ConstrainingType getConstrainingType() {
- // The node implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- // The node implementation does not support properties
- return Collections.emptyList();
- }
-
- public List<Service> getServices() {
- // The node implementation does not support services
- return Collections.emptyList();
- }
-
- public List<Reference> getReferences() {
- // The node implementation does not support properties
- return Collections.emptyList();
- }
-
- public String getURI() {
- return uri;
- }
-
- public Composite getComposite() {
- return composite;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The node implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setComposite(Composite composite) {
- this.composite = composite;
- }
-
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java
deleted file mode 100644
index e695340d45..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/ConfiguredNodeImplementationProcessor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.node.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Implements a StAX artifact processor for configured node implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ConfiguredNodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<ConfiguredNodeImplementation> {
-
- private static final String ATOM_NS = "http://www.w3.org/2005/Atom";
- private static final QName FEED_QNAME = new QName(ATOM_NS, "feed");
- private static final QName ENTRY_QNAME = new QName(ATOM_NS, "entry");
- private static final QName ID_QNAME = new QName(ATOM_NS, "id");
- private static final QName LINK_QNAME = new QName(ATOM_NS, "link");
- private static final String HREF = "href";
-
- private ContributionFactory contributionFactory;
- private AssemblyFactory assemblyFactory;
- private NodeImplementationFactory implementationFactory;
-
- public ConfiguredNodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
- }
-
- public QName getArtifactType() {
- return null;
- }
-
- public Class<ConfiguredNodeImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return ConfiguredNodeImplementation.class;
- }
-
- public ConfiguredNodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- ConfiguredNodeImplementation implementation = implementationFactory.createConfiguredNodeImplementation();
- implementation.setUnresolved(true);
-
- // Read a feed containing links to the composite and the contributions assigned to
- // the node
- Composite composite = null;
- Contribution contribution = null;
- boolean id = false;
- QName name = null;
-
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
-
- case START_ELEMENT:
- name = reader.getName();
-
- if (ENTRY_QNAME.equals(name)) {
-
- // Read an <entry>
- if (implementation.getComposite() == null) {
- composite = assemblyFactory.createComposite();
- } else {
- contribution = contributionFactory.createContribution();
- }
- } else if (ID_QNAME.equals(name)) {
-
- // Read an <id>
- id = true;
-
- } else if (LINK_QNAME.equals(name)) {
-
- // Read a <link>
- String href = getString(reader, HREF);
-
- if (composite != null) {
- composite.setURI(href);
- } else if (contribution != null) {
- contribution.setLocation(href);
- }
- }
- break;
-
- case XMLStreamConstants.CHARACTERS:
-
- // Read characters inside an <id> element
- if (id) {
- if (contribution != null) {
- contribution.setURI(reader.getText());
- }
- }
- break;
-
- case END_ELEMENT:
- name = reader.getName();
-
- // Clear current state when reading reaching end element
- if (ENTRY_QNAME.equals(name)) {
- if (composite != null) {
- implementation.setComposite(composite);
- } else if (contribution != null) {
- implementation.getContributions().add(contribution);
- }
-
- composite = null;
- contribution = null;
-
- } else if (ID_QNAME.equals(name)) {
- id = false;
-
- } else if (FEED_QNAME.equals(name)) {
-
- // We've reached the end of the feed
- return implementation;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- return implementation;
- }
-
- public void resolve(ConfiguredNodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the referenced composite
- Composite composite = implementation.getComposite();
- if (composite != null) {
- composite = resolver.resolveModel(Composite.class, composite);
- if (!composite.isUnresolved()) {
- implementation.setComposite(composite);
- }
- }
-
- // Resolve the referenced contributions
- List<Contribution> contributions = implementation.getContributions();
- for (int i = 0, n = contributions.size(); i < n; i++) {
- Contribution contribution = contributions.get(i);
- contribution = resolver.resolveModel(Contribution.class, contribution);
- if (!contribution.isUnresolved()) {
- contributions.set(i, contribution);
- }
- }
-
- implementation.setUnresolved(false);
- }
-
- public void write(ConfiguredNodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- //TODO Write the feed describing the node configuration
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java
deleted file mode 100644
index 201354f89c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/xml/NodeImplementationProcessor.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.node.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Implements a StAX artifact processor for node implementations.
- *
- * @version $Rev$ $Date$
- */
-public class NodeImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<NodeImplementation> {
- private static final QName IMPLEMENTATION_NODE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.node");
-
- private AssemblyFactory assemblyFactory;
- private NodeImplementationFactory implementationFactory;
-
- public NodeImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.implementationFactory = modelFactories.getFactory(NodeImplementationFactory.class);
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_NODE;
- }
-
- public Class<NodeImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return NodeImplementation.class;
- }
-
- public NodeImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.node> element
- NodeImplementation implementation = implementationFactory.createNodeImplementation();
- implementation.setUnresolved(false);
-
- // Read the composite attribute
- QName qname = getQName(reader, "composite");
- if (qname != null) {
- Composite composite = assemblyFactory.createComposite();
- composite.setName(qname);
- String uri = getString(reader, "uri");
- composite.setURI(uri);
- composite.setUnresolved(true);
- implementation.setComposite(composite);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_NODE.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(NodeImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
- // We do not need to resolve the referenced composites here
- // Nodes and application composites are not in the same composition tree
- }
-
- public void write(NodeImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.node>
- Composite composite = implementation.getComposite();
- QName qname;
- String uri;
- if (composite != null) {
- qname = composite.getName();
- uri = composite.getURI();
- } else {
- qname = null;
- uri = null;
- }
- writeStart(writer, IMPLEMENTATION_NODE.getNamespaceURI(), IMPLEMENTATION_NODE.getLocalPart(),
- new XAttr("composite", qname), new XAttr("uri", uri));
-
- writeEnd(writer);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 9378db0875..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.node.xml.NodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node,model=org.apache.tuscany.sca.implementation.node.NodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
-org.apache.tuscany.sca.implementation.node.xml.ConfiguredNodeImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.node.configured,model=org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation,factory=org.apache.tuscany.sca.implementation.node.NodeImplementationFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
deleted file mode 100644
index b8a63a3b16..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.node.NodeImplementationFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java b/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
deleted file mode 100644
index db31b3c17e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/builder/impl/CalculateBindingURITestCase.java
+++ /dev/null
@@ -1,603 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.builder.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.implementation.node.NodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.implementation.node.impl.NodeImplementationFactoryImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class CalculateBindingURITestCase extends TestCase {
- private static final Logger logger = Logger.getLogger(CalculateBindingURITestCase.class.getName());
- private AssemblyFactory assemblyFactory;
- private SCABindingFactory scaBindingFactory;
- private NodeImplementationFactory nodeImplementationFactory;
- private Monitor monitor;
- private CompositeBuilder configurationBuilder;
- private List<Binding> defaultBindings = new ArrayList<Binding>();
-
- @Override
- protected void setUp() throws Exception {
- assemblyFactory = new DefaultAssemblyFactory();
- scaBindingFactory = new TestBindingFactory();
- nodeImplementationFactory = new NodeImplementationFactoryImpl();
- monitor = new Monitor() {
- public void problem(Problem problem) {
- if (problem.getSeverity() == Severity.INFO) {
- logger.info(problem.toString());
- } else if (problem.getSeverity() == Severity.WARNING) {
- logger.warning(problem.toString());
- } else if (problem.getSeverity() == Severity.ERROR) {
- if (problem.getCause() != null) {
- logger.log(Level.SEVERE, problem.toString(), problem.getCause());
- } else {
- logger.severe(problem.toString());
- }
- }
- }
- public List<Problem> getProblems() {
- return null;
- }
-
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Exception cause) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, cause);
- }
-
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Object... messageParams) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, messageParams);
- }
- };
- configurationBuilder = new NodeCompositeBuilderImpl(assemblyFactory, scaBindingFactory, null, null, monitor);
- Binding defaultBinding = new TestBindingImpl();
- defaultBinding.setURI("http://myhost:8080/root");
- defaultBindings.add(defaultBinding);
- }
-
- /**
- * Create a composite containing a node component pointing to the
- * given application composite.
- *
- * @param composite
- * @return
- */
- private Composite nodeComposite(Composite composite) {
- Composite nodeComposite = assemblyFactory.createComposite();
- Component nodeComponent = assemblyFactory.createComponent();
- NodeImplementation nodeImplementation = nodeImplementationFactory.createNodeImplementation();
- nodeImplementation.setComposite(composite);
- nodeComponent.setImplementation(nodeImplementation);
- ComponentService nodeService = assemblyFactory.createComponentService();
- nodeService.getBindings().addAll(defaultBindings);
- nodeComponent.getServices().add(nodeService);
- nodeComposite.getComponents().add(nodeComponent);
- return nodeComposite;
- }
-
- @Override
- protected void tearDown() throws Exception {
- assemblyFactory = null;
- }
-
- /**
- * Test that URI are generated in accordance with the Assembly Specification section 1.7.2.1 as
- * follows. For the 3 parts that make up the URI;
- *
- * BaseURI / Component URI / Service Binding URI
- *
- * Test the following combinations for:
- *
- * NB. The short hand here, e.g. <service name="s1"> <binding.sca> <service name="s2"> means
- * two services appear where the first has the sca binding specified.
- *
- * component service bindings
- *
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca>
- * --> http://myhost:8080/root/c1
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca> <service name="s2">
- * --> http://myhost:8080/root/c1/s1
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
- * --> http://myhost:8080/root/c1/n
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
- * --> http://myhost:8080/root/c1/b
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
- * --> http://myhost:8080/b
- * http://myhost:8080/root / <component name="c1"> / <service name="s1"> <binding.sca uri="../../b"> <service name="s2">
- * --> http://myhost:8080/b
- *
- * top level composite service bindings
- *
- * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
- * --> http://myhost:8080/root
- * http://myhost:8080/root / null / <service name="s1"> <binding.sca> <service name="s2">
- * --> http://myhost:8080/root/s1
- * http://myhost:8080/root / null / <service name="s1"> <binding.sca name="n"> <service name="s2">
- * --> http://myhost:8080/root/n
- * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="b"> <service name="s2">
- * --> http://myhost:8080/root/b
- * http://myhost:8080/root / null / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
- * --> http://myhost:8080/b
- *
- * nested composite service bindings
- *
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca>
- * --> http://myhost:8080/root/c1/c2
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <service name="s2">
- * --> http://myhost:8080/root/c1/c2/s1
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="n"> <service name="s2">
- * --> http://myhost:8080/root/c1/c2/n
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="b"> <service name="s2">
- * --> http://myhost:8080/root/c1/c2/b
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca uri="http://myhost:8080/b"> <service name="s2">
- * --> http://myhost:8080/b
- *
- * binding name duplication errors
- *
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca> <binding.xyz>
- * --> Error
- * http://myhost:8080/root / <component name="c1"> implemented by composite with <component name="c2"> / <service name="s1"> <binding.sca name="b1"> <binding.xyz name="b1">
- * --> Error
- */
-
- private Composite createComponentServiceBinding() {
- Composite composite1 = assemblyFactory.createComposite();
- composite1.setName(new QName("http://foo", "C1"));
-
- Component c1 = assemblyFactory.createComponent();
- c1.setName("c1");
- composite1.getComponents().add(c1);
-
- ComponentService s1 = assemblyFactory.createComponentService();
- c1.getServices().add(s1);
- s1.setName("s1");
-
- ComponentService s2 = assemblyFactory.createComponentService();
- c1.getServices().add(s2);
- s2.setName("s2");
-
- Binding b1 = new TestBindingImpl();
- s1.getBindings().add(b1);
-
- Binding b2 = new TestBindingImpl();
- s2.getBindings().add(b2);
-
- return composite1;
- }
-
- private Composite createTopLevelCompositeServiceBinding(){
- Composite composite1 = assemblyFactory.createComposite();
- composite1.setName(new QName("http://foo", "C1"));
-
- CompositeService s1 = assemblyFactory.createCompositeService();
- s1.setName("s1");
- composite1.getServices().add(s1);
-
- Binding b1 = new TestBindingImpl();
- s1.getBindings().add(b1);
-
- CompositeService s2 = assemblyFactory.createCompositeService();
- s2.setName("s2");
- composite1.getServices().add(s2);
-
- Binding b2 = new TestBindingImpl();
- s2.getBindings().add(b2);
-
- return composite1;
- }
-
- private Composite createNestCompositeServiceBinding(){
- Composite composite1 = assemblyFactory.createComposite();
- composite1.setName(new QName("http://foo", "C1"));
-
- Component c1 = assemblyFactory.createComponent();
- c1.setName("c1");
- composite1.getComponents().add(c1);
-
- Composite composite2 = assemblyFactory.createComposite();
- c1.setImplementation(composite2);
- composite2.setName(new QName("http://foo", "C2"));
-
- Component c2 = assemblyFactory.createComponent();
- composite2.getComponents().add(c2);
- c2.setName("c2");
-
- ComponentService s1 = assemblyFactory.createComponentService();
- c2.getServices().add(s1);
- s1.setName("s1");
-
- ComponentService s2 = assemblyFactory.createComponentService();
- c2.getServices().add(s2);
- s2.setName("s2");
-
- Binding b1 = new TestBindingImpl();
- s1.getBindings().add(b1);
-
- Binding b2 = new TestBindingImpl();
- s2.getBindings().add(b2);
-
- return composite1;
- }
-
- // component service binding tests
-
- public void testComponentServiceSingleService() {
- Composite composite = createComponentServiceBinding();
- composite.getComponents().get(0).getServices().remove(1);
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testComponentServiceBindingDefault() {
- Composite composite = createComponentServiceBinding();
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/s1", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testComponentServiceBindingName() {
- Composite composite = createComponentServiceBinding();
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/n", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testComponentServiceBindingURIRelative() {
- Composite composite = createComponentServiceBinding();
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testComponentServiceBindingURIAbsolute() {
- Composite composite = createComponentServiceBinding();
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("http://myhost:8080/b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testComponentServiceBindingURIRelative2() {
- Composite composite = createComponentServiceBinding();
- Binding b = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("../../b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- // top level composite service binding tests
-
- public void testCompositeServiceSingleService() {
- Composite composite = createTopLevelCompositeServiceBinding();
- composite.getServices().remove(1);
- Binding b = composite.getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testCompositeServiceBindingDefault() {
- Composite composite = createTopLevelCompositeServiceBinding();
- Binding b = composite.getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/s1", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testCompositeServiceBindingName() {
- Composite composite = createTopLevelCompositeServiceBinding();
- Binding b = composite.getServices().get(0).getBindings().get(0);
- b.setName("n");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/n", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testCompositeServiceBindingURIRelative() {
- Composite composite = createTopLevelCompositeServiceBinding();
- Binding b = composite.getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testCompositeServiceBindingURIAbsolute() {
- Composite composite = createTopLevelCompositeServiceBinding();
- Binding b = composite.getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("http://myhost:8080/b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- // nested composite service binding tests
-
- public void testNestedCompositeServiceSingleService() {
- Composite composite = createNestCompositeServiceBinding();
- ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().remove(1);
- Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/c2", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testNestedCompositeServiceBindingDefault() {
- Composite composite = createNestCompositeServiceBinding();
- Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/c2/s1", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testNestedCompositeServiceBindingName() {
- Composite composite = createNestCompositeServiceBinding();
- Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/c2/n", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testNestedCompositeServiceBindingURIRelative() {
- Composite composite = createNestCompositeServiceBinding();
- Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/root/c1/c2/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- public void testNestedCompositeServiceBindingURIAbsolute() {
- Composite composite = createNestCompositeServiceBinding();
- Binding b = ((Composite)composite.getComponents().get(0).getImplementation()).getComponents().get(0).getServices().get(0).getBindings().get(0);
- b.setName("n");
- b.setURI("http://myhost:8080/b");
-
- try {
- configurationBuilder.build(nodeComposite(composite));
-
- assertEquals("http://myhost:8080/b", b.getURI());
- } catch(Exception ex){
- System.out.println(ex.toString());
- fail();
- }
- }
-
- // component service binding name error tests
-
- //FIXME Need to find a better way to test these error cases as
- // the composite builder now (intentionally) logs warnings instead of
- // throwing exceptions
- public void FIXMEtestComponentServiceBindingNameError1() {
- Composite composite = createComponentServiceBinding();
- Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- Binding b2 = new TestBindingImpl();
- composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
-
-
- try {
- configurationBuilder.build(nodeComposite(composite));
- fail();
- } catch(Exception ex){
- //System.out.println(ex.toString());
- }
- }
-
- //FIXME Need to find a better way to test these error cases as
- // the composite builder now (intentionally) logs warnings instead of
- // throwing exceptions
- public void FIXMEtestComponentServiceBindingNameError2() {
- Composite composite = createComponentServiceBinding();
- Binding b1 = composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- Binding b2 = new TestBindingImpl();
- composite.getComponents().get(0).getServices().get(0).getBindings().add(b2);
-
- b1.setName("b");
- b2.setName("b");
-
-
- try {
- configurationBuilder.build(nodeComposite(composite));
- fail();
- } catch(Exception ex){
- System.out.println(ex.toString());
- }
- }
-
-
- public class TestBindingFactory implements SCABindingFactory {
- public SCABinding createSCABinding() {
- return new TestBindingImpl();
- }
- }
-
- public class TestBindingImpl extends ExtensibleImpl implements SCABinding {
- private String name;
- private String uri;
- private boolean unresolved;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.java
deleted file mode 100644
index bc0c3b1507..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/ReadTestCase.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.implementation.node.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading Node implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestNode.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
deleted file mode 100644
index c5e6a40f89..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/test/java/org/apache/tuscany/sca/implementation/node/xml/WriteTestCase.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/writing Node implementations.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestNode.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite b/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite
deleted file mode 100644
index 55644c27e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestComposite.composite
+++ /dev/null
@@ -1,29 +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"
- targetNamespace="http://sample/composite"
- xmlns:sc="http://sample/composite"
- name="TestComposite">
-
- <component name="TestComponent">
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite b/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite
deleted file mode 100644
index 92787d3ac1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-node/src/test/resources/org/apache/tuscany/sca/implementation/node/xml/TestNode.composite
+++ /dev/null
@@ -1,64 +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"
- targetNamespace="http://sample/node"
- xmlns:sc="http://sample/composite"
- name="TestNode">
-
- <component name="TestNode">
- <tuscany:implementation.node composite="sc:TestComposite"/>
- <service name="Default">
- <binding.sca uri="http://localhost:8080"/>
- </service>
- </component>
-
- <component name="TestNode2">
- <tuscany:implementation.node.configured>
-
- <feed xmlns="http://www.w3.org/2005/Atom">
- <title type="text">Feed</title>
- <entry>
- <id>composite:store;http://store;store</id>
- <title type="text">store - http://store;store</title>
- <content type="text" />
- <link
- href="/resolved/composite/composite:store;http://store;store" />
- </entry>
- <entry>
- <id>assets</id>
- <title type="text">assets</title>
- <content type="text" />
- <link
- href="http://localhost:9990/files/tutorial-assets.jar" />
- </entry>
- <entry>
- <id>store</id>
- <title type="text">store</title>
- <content type="text" />
- <link
- href="http://localhost:9990/files/tutorial-store.jar" />
- </entry>
- </feed>
-
- </tuscany:implementation.node.configured>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/LICENSE b/branches/sca-java-1.5.1/modules/implementation-notification/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/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-java-1.5.1/modules/implementation-notification/NOTICE b/branches/sca-java-1.5.1/modules/implementation-notification/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/pom.xml b/branches/sca-java-1.5.1/modules/implementation-notification/pom.xml
deleted file mode 100644
index 1731b9f23a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/pom.xml
+++ /dev/null
@@ -1,110 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-notification</artifactId>
- <name>Apache Tuscany SCA Notification Implementation Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <!-- test dependencies -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.notification</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.notification*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.java
deleted file mode 100644
index 3f79ca71e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/DefaultNotificationImplementationFactory.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.implementation.notification;
-
-
-/**
- * A default factory for the Notification implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultNotificationImplementationFactory implements NotificationImplementationFactory {
-
- public NotificationImplementationImpl createNotificationImplementation() {
- return new NotificationImplementationImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.java
deleted file mode 100644
index f5889e9679..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/ImmutableMessage.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.implementation.notification;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ImmutableMessage implements Message {
-
- public <T> T getBody() {
- return null;
- }
-
- public EndpointReference getFrom() {
- return null;
- }
-
- public Object getMessageID() {
- return null;
- }
-
- public EndpointReference getTo() {
- return null;
- }
-
- public RuntimeWire getWire() {
- return null;
- }
-
- public boolean isFault() {
- return false;
- }
-
- public <T> void setBody(T arg0) {
- throw new UnsupportedOperationException();
- }
-
- public <T> void setFaultBody(T arg0) {
- throw new UnsupportedOperationException();
- }
-
- public void setFrom(EndpointReference arg0) {
- throw new UnsupportedOperationException();
- }
-
- public void setMessageID(Object arg0) {
- throw new UnsupportedOperationException();
- }
-
- public void setTo(EndpointReference arg0) {
- throw new UnsupportedOperationException();
- }
-
- public Operation getOperation() {
- return null;
- }
-
- public void setOperation(Operation op) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Message#getReplyTo()
- */
- public EndpointReference getReplyTo() {
- return null;
- }
-
-
- public List<Object> getHeaders() {
- return null;
- }
-
- public <T> T getBindingContext() {
- return null;
- }
-
- public <T> void setBindingContext(T bindingContext) {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.java
deleted file mode 100644
index a2e35c5cb6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentInvoker.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.implementation.notification;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-
-/**
- * Turns invoke into remote message fan-out
- *
- * @version $Rev$ $Date$
- */
-public class NotificationComponentInvoker implements Invoker {
-
- private static final Message RESPONSE = new ImmutableMessage();
- private List<InvocationChain> subscriberInvocationChains;
- private Operation operation;
- private RuntimeComponent component;
-
- public NotificationComponentInvoker(Operation operation, RuntimeComponent component) {
- this.subscriberInvocationChains = null;
- this.operation = operation;
- this.component = component;
- }
-
- public Message invoke(Message msg) {
- addSubscriberInvocationChains();
-
- // REVIEW Should this be done in separate thread(s)?
- // REVIEW Should separate copies of message be used?
- Object msgBody = msg.getBody();
-
- for (InvocationChain subscriberInvocationChain : subscriberInvocationChains) {
- Invoker chainInvoker = subscriberInvocationChain.getHeadInvoker();
- msg.setBody(msgBody);
- chainInvoker.invoke(msg);
- }
-
- return RESPONSE;
- }
-
- private void addSubscriberInvocationChains() {
- if (subscriberInvocationChains == null) {
- subscriberInvocationChains = new ArrayList<InvocationChain>();
- for (ComponentReference reference : component.getReferences()) {
- if (reference.getName().indexOf("$self$") >= 0) {
- continue;
- }
- RuntimeComponentReference rtCompRef = null;
- if (reference instanceof RuntimeComponentReference) {
- rtCompRef = (RuntimeComponentReference)reference;
- }
- else {
- throw new RuntimeException("Need a runtime component reference");
- }
- for(RuntimeWire wire : rtCompRef.getRuntimeWires()) {
- // This is much less efficient now !!
- List<InvocationChain> chains = wire.getInvocationChains();
- InvocationChain chain = getInvocationChain(chains, operation);
- subscriberInvocationChains.add(chain);
- }
- }
- }
- }
-
- private InvocationChain getInvocationChain(List<InvocationChain> chains, Operation operation) {
- InvocationChain chain = null;
- for (InvocationChain ch : chains) {
- if (ch.getTargetOperation().equals(operation)) {
- chain = ch;
- break;
- }
- }
- if (chain == null) {
- for (InvocationChain ch : chains) {
- if (ch.getTargetOperation().getName().equals(operation.getName())) {
- chain = ch;
- break;
- }
- }
- if (chain == null) {
- throw new RuntimeException("Can't find a compatible chain");
- }
- }
- return chain;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.java
deleted file mode 100644
index cea7038e9c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationFactory.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.implementation.notification;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface NotificationImplementationFactory {
-
- NotificationImplementationImpl createNotificationImplementation();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.java
deleted file mode 100644
index 594bec75b5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationImpl.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.implementation.notification;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-
-
-/**
- * Model object for a Notification implementation.
- *
- * @version $Rev$ $Date$
- */
-public class NotificationImplementationImpl extends ImplementationImpl implements Implementation {
-
- private String componentTypeName;
- private String implementationType;
- private ComponentType componentType;
-
-
- public NotificationImplementationImpl() {
- // Without this, the loader's resolve is not called
- setUnresolved(true);
- }
-
- public String getComponentTypeName() {
- return componentTypeName;
- }
-
- public void setComponentTypeName(String componentTypeName) {
- this.componentTypeName = componentTypeName;
- }
-
- public String getImplementationType() {
- return implementationType;
- }
-
- public void setImplementationType(String implementationType) {
- this.implementationType = implementationType;
- }
-
- public ComponentType getComponentType() {
- return componentType;
- }
-
- public void setComponentType(ComponentType componentType) {
- this.componentType = componentType;
- }
-
- @Override
- public List<Service> getServices() {
- return componentType.getServices();
- }
-
- @Override
- public List<Reference> getReferences() {
- return componentType.getReferences();
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getComponentTypeName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this)
- return true;
- else if (obj instanceof NotificationImplementationImpl &&
- getComponentTypeName().equals(((NotificationImplementationImpl)obj).getComponentTypeName()))
- return true;
- else
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.java
deleted file mode 100644
index c8b55c7caa..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProcessor.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.implementation.notification;
-
-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.ComponentType;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-
-/**
- * Loader for handling Notification <implementation.notification> elements.
- *
- * @version $Rev$ $Date$
- */
-public class NotificationImplementationProcessor implements StAXArtifactProcessor<NotificationImplementationImpl> {
-
- protected static final QName IMPLEMENTATION_NOTIFICATION =
- new QName(Constants.SCA10_TUSCANY_NS, "implementation.notification");
-
- private NotificationImplementationFactory implementationFactory;
-
- public NotificationImplementationProcessor(NotificationImplementationFactory implementationFactory) {
- this.implementationFactory = implementationFactory;
- }
-
- public QName getArtifactType() {
- return IMPLEMENTATION_NOTIFICATION;
- }
-
- public Class<NotificationImplementationImpl> getModelType() {
- return NotificationImplementationImpl.class;
- }
-
- public NotificationImplementationImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert IMPLEMENTATION_NOTIFICATION.equals(reader.getName());
- String componentTypeName = reader.getAttributeValue(null, "name");
- String implementationType = reader.getAttributeValue(null, "type");
-
- NotificationImplementationImpl implementation = implementationFactory.createNotificationImplementation();
- implementation.setComponentTypeName(componentTypeName);
- implementation.setImplementationType(implementationType);
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_NOTIFICATION.equals(reader.getName())) {
- break;
- }
- }
-
- ComponentType componentType = new DefaultAssemblyFactory().createComponentType();
- componentType.setURI(componentTypeName + ".componentType");
- componentType.setUnresolved(true);
- implementation.setComponentType(componentType);
-
- return implementation;
- }
-
- public void resolve(NotificationImplementationImpl impl, ModelResolver resolver) throws ContributionResolveException {
- ComponentType componentType = resolver.resolveModel(ComponentType.class, impl.getComponentType());
-
- if (componentType.isUnresolved()) {
- throw new ContributionResolveException("ComponentType still unresolved");
- }
- impl.setComponentType(componentType);
- impl.setUnresolved(false);
- }
-
- public void write(NotificationImplementationImpl model, XMLStreamWriter outputSource)
- throws ContributionWriteException, XMLStreamException {
-
- //FIXME Implement this method
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.java
deleted file mode 100644
index e9ea71c1d5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProvider.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.implementation.notification;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationImplementationProvider implements ImplementationProvider {
-
- private RuntimeComponent component;
-
- /**
- * Constructs a new Notification implementation provider.
- */
- public NotificationImplementationProvider(RuntimeComponent component, NotificationImplementationImpl implementation) {
- this.component = component;
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- NotificationComponentInvoker invoker = new NotificationComponentInvoker(operation, component);
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- for (ComponentService service : component.getServices()) {
- if (service.getService() != null) {
- InterfaceContract interfaceContract = service.getService().getInterfaceContract();
- if (interfaceContract instanceof WSDLInterfaceContract) {
- interfaceContract.getInterface().resetDataBinding("org.apache.axiom.om.OMElement");
- }
- }
- }
- }
-
- public void stop() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java
deleted file mode 100644
index 80785e36e7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationProviderFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.notification;
-
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationImplementationProviderFactory implements ImplementationProviderFactory<NotificationImplementationImpl> {
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- NotificationImplementationImpl implementation) {
- return new NotificationImplementationProvider(component, implementation);
- }
-
- public Class<NotificationImplementationImpl> getModelType() {
- return NotificationImplementationImpl.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.java
deleted file mode 100644
index 2795619208..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/java/org/apache/tuscany/sca/implementation/notification/NotificationModuleActivator.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.implementation.notification;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class NotificationModuleActivator implements ModuleActivator {
-
- private NotificationImplementationProcessor implementationLoader;
-
- public void start(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- implementationLoader = new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
- processors.addArtifactProcessor(implementationLoader);
-
- ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
- providerFactories.addProviderFactory(new NotificationImplementationProviderFactory());
- }
-
- public void stop(ExtensionPointRegistry registry) {
- StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- processors.removeArtifactProcessor(implementationLoader);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index f8f6975395..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.implementation.notification.NotificationModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java
deleted file mode 100644
index f9a20edccd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationComponentTestCase.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.notification;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.SCABinding;
-import org.apache.tuscany.sca.binding.sca.impl.SCABindingFactoryImpl;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.InvocationChain;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.easymock.EasyMock;
-
-/**
- *
- * @version $Rev$ $Date$
- *
- */
-public class NotificationComponentTestCase extends TestCase {
-
- public void testLocalNotificationComponent() throws Exception {
- try {
- Operation operation = EasyMock.createNiceMock(Operation.class);
- EasyMock.replay(operation);
-
- InvocationChain sub1Chain = EasyMock.createNiceMock(InvocationChain.class);
- EasyMock.expect(sub1Chain.getTargetOperation()).andReturn(operation);
- EasyMock.expect(sub1Chain.getHeadInvoker()).andReturn(new MockInterceptor());
- EasyMock.replay(sub1Chain);
- List<InvocationChain> sub1Chains = new ArrayList<InvocationChain>();
- sub1Chains.add(sub1Chain);
- SCABinding b1 = new SCABindingFactoryImpl().createSCABinding();
- EndpointReference epr1 = EasyMock.createNiceMock(EndpointReference.class);
- EasyMock.expect(epr1.getURI()).andReturn("wire1Target");
- EasyMock.expect(epr1.getBinding()).andReturn(b1);
- EasyMock.replay(epr1);
- RuntimeWire sub1Wire = EasyMock.createNiceMock(RuntimeWire.class);
- EasyMock.expect(sub1Wire.getInvocationChains()).andReturn(sub1Chains);
- EasyMock.expect(sub1Wire.getTarget()).andReturn(epr1).anyTimes();
- EasyMock.replay(sub1Wire);
- ArrayList<RuntimeWire> rtWires1 = new ArrayList<RuntimeWire>();
- rtWires1.add(sub1Wire);
- RuntimeComponentReference rtCompRef1 = EasyMock.createNiceMock(RuntimeComponentReference.class);
- EasyMock.expect(rtCompRef1.getName()).andReturn("sub1Reference");
- EasyMock.expect(rtCompRef1.getRuntimeWires()).andReturn(rtWires1);
- EasyMock.replay(rtCompRef1);
-
- InvocationChain sub2Chain = EasyMock.createNiceMock(InvocationChain.class);
- EasyMock.expect(sub2Chain.getTargetOperation()).andReturn(operation);
- EasyMock.expect(sub2Chain.getHeadInvoker()).andReturn(new MockInterceptor());
- EasyMock.replay(sub2Chain);
- List<InvocationChain> sub2Chains = new ArrayList<InvocationChain>();
- sub2Chains.add(sub2Chain);
- SCABinding b2 = new SCABindingFactoryImpl().createSCABinding();
- EndpointReference epr2 = EasyMock.createNiceMock(EndpointReference.class);
- EasyMock.expect(epr2.getURI()).andReturn("wire2Target");
- EasyMock.expect(epr2.getBinding()).andReturn(b2);
- EasyMock.replay(epr2);
- RuntimeWire sub2Wire = EasyMock.createNiceMock(RuntimeWire.class);
- EasyMock.expect(sub2Wire.getInvocationChains()).andReturn(sub2Chains);
- EasyMock.expect(sub2Wire.getTarget()).andReturn(epr2).anyTimes();
- EasyMock.replay(sub2Wire);
- ArrayList<RuntimeWire> rtWires2 = new ArrayList<RuntimeWire>();
- rtWires2.add(sub2Wire);
- RuntimeComponentReference rtCompRef2 = EasyMock.createNiceMock(RuntimeComponentReference.class);
- EasyMock.expect(rtCompRef2.getName()).andReturn("sub2Reference");
- EasyMock.expect(rtCompRef2.getRuntimeWires()).andReturn(rtWires2);
- EasyMock.replay(rtCompRef2);
-
- ArrayList<ComponentReference> references = new ArrayList<ComponentReference>();
- references.add(rtCompRef1);
- references.add(rtCompRef2);
- RuntimeComponent component = EasyMock.createNiceMock(RuntimeComponent.class);
- EasyMock.expect(component.getName()).andReturn("LocalNotificationComponentTest");
- EasyMock.expect(component.getReferences()).andReturn(references);
- EasyMock.replay(component);
-
- Invoker localNotificationInvoker = new NotificationComponentInvoker(operation, component);
-
- Message msg = EasyMock.createNiceMock(Message.class);
- EasyMock.expect(msg.getBody()).andReturn("msg").times(3); // once per sub int + once in notif target invoker
- EasyMock.replay(msg);
- localNotificationInvoker.invoke(msg);
- EasyMock.verify(msg);
- } catch(Throwable e) {
- e.printStackTrace();
- }
- }
-
- class MockInterceptor implements Interceptor {
-
- public Message invoke(Message msg) {
- Assert.assertEquals("msg", msg.getBody());
- return msg;
- }
-
- public void setNext(Invoker next) {
- throw new AssertionError();
- }
-
- public Interceptor getNext() {
- throw new AssertionError();
- }
-
- public boolean isOptimizable() {
- throw new AssertionError();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java b/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.java
deleted file mode 100644
index 89cbd3ec48..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/java/org/apache/tuscany/sca/implementation/notification/NotificationImplementationLoaderTestCase.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.implementation.notification;
-
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.easymock.EasyMock;
-
-/**
- *
- * @version $Rev$ $Date$
- *
- */
-public class NotificationImplementationLoaderTestCase extends TestCase {
-
- public void testRead() throws Exception {
- try {
- NotificationImplementationProcessor implementationLoader =
- new NotificationImplementationProcessor(new DefaultNotificationImplementationFactory());
-
- XMLStreamReader reader = EasyMock.createMock(XMLStreamReader.class);
- EasyMock.expect(reader.getName()).andReturn(NotificationImplementationProcessor.IMPLEMENTATION_NOTIFICATION).times(2);
- EasyMock.expect(reader.getAttributeValue(null, "name")).andReturn("TrafficAdvisoryNotificationTestCase");
- EasyMock.expect(reader.getAttributeValue(null, "type")).andReturn(null);
- EasyMock.expect(reader.hasNext()).andReturn(true);
- EasyMock.expect(reader.next()).andReturn(XMLStreamConstants.END_ELEMENT);
- EasyMock.replay(reader);
-
- Implementation impl = implementationLoader.read(reader);
- Assert.assertNotNull(impl);
- } catch(Throwable e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType b/branches/sca-java-1.5.1/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType
deleted file mode 100644
index 1fd952a0a8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-notification/src/test/resources/TrafficAdvisoryNotificationTestCase.componentType
+++ /dev/null
@@ -1,30 +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" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service name="TrafficAdvisoryNotificationService">
- <interface.java interface="org.apache.tuscany.sca.implementation.notification.TrafficAdvisory"/>
- </service>
-
- <reference name="TrafficAdvisoryNotificationReference"
- multiplicity="0..n">
- <interface.java interface="org.apache.tuscany.sca.implementation.notification.TrafficAdvisory"/>
- </reference>
-</componentType>
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/LICENSE b/branches/sca-java-1.5.1/modules/implementation-osgi/LICENSE
deleted file mode 100644
index 6b0b1270ff..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/LICENSE
+++ /dev/null
@@ -1,203 +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-java-1.5.1/modules/implementation-osgi/NOTICE b/branches/sca-java-1.5.1/modules/implementation-osgi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/pom.xml b/branches/sca-java-1.5.1/modules/implementation-osgi/pom.xml
deleted file mode 100644
index 12eedcc527..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/pom.xml
+++ /dev/null
@@ -1,164 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-osgi</artifactId>
- <name>Apache Tuscany SCA OSGi Implementation Extension</name>
-
- <packaging>jar</packaging>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.main</artifactId>
- <version>1.0.4</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-osgi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-osgi-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.osgi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.osgi*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.java
deleted file mode 100644
index 7bcb0a1da5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/OSGiImplementation.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.implementation.osgi;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- *
- * The model representing an OSGi implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface OSGiImplementation extends Implementation, Extensible {
-
- String getBundleSymbolicName();
-
- String getBundleVersion();
-
- String[] getImports();
-
- List<ComponentProperty> getReferenceProperties(String referenceName);
-
- List<ComponentProperty> getServiceProperties(String serviceName);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java
deleted file mode 100644
index 33c790585c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiAnnotations.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.context;
-
-
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Hashtable;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.impl.JavaScopeImpl;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.AllowsPassByReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConversationProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.HeuristicPojoProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osgi.framework.Bundle;
-
-
-/**
- * OSGi annotation processing
- * OSGi bundles are not introspected by OSGiImplementation when a component is created.
- * Instead if the list of implementation classes is specified in <implementation.osgi/>,
- * the classes are introspected when the bundle is resolved. The classes are loaded using
- * the bundle ClassLoader, and hence the delay in annotation processing is inevitable.
- * There is one other difference compared to implementation.java. While instances (and
- * the instance class) are associated with a component in Java, all Java annotations from
- * the component implementation class apply to all the component instances. In OSGi,
- * instances are associated with services, and a bundle can register multiple services.
- * Hence annotations from classes need to be stored separately so that the right ones
- * can be associated with the service instance.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiAnnotations {
-
- private Scope scope = Scope.COMPOSITE;
- private boolean isEagerInit;
-
- private String[] classList;
-
- private Bundle[] bundles;
-
- private RuntimeComponent runtimeComponent;
- private JavaPropertyValueObjectFactory propertyValueFactory;
- private ProxyFactory proxyFactory;
-
- private JavaImplementationFactory javaImplementationFactory;
- private JavaInterfaceFactory javaInterfaceFactory;
- private PolicyFactory policyFactory;
- private RequestContextFactory requestContextFactory;
-
- private Hashtable<Class<?>, JavaImplementation> javaAnnotationInfo =
- new Hashtable<Class<?>, JavaImplementation>();
- private Hashtable<JavaImplementation, OSGiPropertyInjector> propertyInjectors =
- new Hashtable<JavaImplementation, OSGiPropertyInjector>();
-
- private long maxAge = -1;
- private long maxIdleTime = -1;
-
- private boolean annotationsProcessed;
-
-
-
- public OSGiAnnotations(ModelFactoryExtensionPoint modelFactories,
- String[] classList,
- RuntimeComponent runtimeComponent,
- JavaPropertyValueObjectFactory propertyValueFactory,
- ProxyFactory proxyFactory,
- RequestContextFactory requestContextFactory,
- Bundle mainBundle,
- ArrayList<Bundle> dependentBundles) {
-
-
- this.classList = classList;
- this.runtimeComponent = runtimeComponent;
- this.propertyValueFactory = propertyValueFactory;
- this.proxyFactory = proxyFactory;
-
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- this.javaImplementationFactory = createJavaImplementationFactory(assemblyFactory);
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
-
- bundles = new Bundle[dependentBundles.size() + 1];
- bundles[0] = mainBundle;
- for (int i = 0; i < dependentBundles.size(); i++)
- bundles[i + 1] = dependentBundles.get(i);
-
- }
-
-
- public void processAnnotations() throws IntrospectionException {
-
- if (annotationsProcessed)
- return;
- annotationsProcessed = true;
- for (String className : classList) {
- for (Bundle bundle : bundles) {
- try {
- Class<?> clazz = bundle.loadClass(className);
-
- processAnnotations(clazz);
-
- break;
-
- } catch (ClassNotFoundException e) {
- }
- }
- }
- }
-
-
- public void injectProperties(Object instance) {
- JavaImplementation javaImpl = getAnnotationInfo(instance);
- if (javaImpl != null) {
- OSGiPropertyInjector injector = propertyInjectors.get(javaImpl);
- if (injector != null)
- injector.injectProperties(instance);
- }
- }
-
-
- public Scope getScope() {
- return scope;
- }
-
-
-
- public boolean isAllowsPassByReference(Object instance, Method method) {
-
- JavaImplementation javaImpl = getAnnotationInfo(instance);
- if (javaImpl == null) {
- return false;
- }
- if (javaImpl.isAllowsPassByReference()) {
- return true;
- }
- return javaImpl.isAllowsPassByReference(method);
- }
-
-
- public boolean isEagerInit() {
- return isEagerInit;
- }
-
- public long getMaxAge() {
- return maxAge;
- }
-
- public long getMaxIdleTime() {
- return maxIdleTime;
- }
-
- public Method getInitMethod(Object instance) {
- JavaImplementation javaImpl = getAnnotationInfo(instance);
- return javaImpl == null? null : javaImpl.getInitMethod();
- }
-
-
- public Method getDestroyMethod(Object instance) {
- JavaImplementation javaImpl = getAnnotationInfo(instance);
- return javaImpl == null? null : javaImpl.getDestroyMethod();
- }
-
-
- /*
- * Get the annotation corresponding to an instance
- *
- */
- private JavaImplementation getAnnotationInfo(final Object instance) {
-
- // The simplest case where the implementation class was listed under the
- // classes attribute of <implementation.osgi/>, or this is the second call
- // to this method for the implementation class.
- // Allow privileged access to get classloader. Requires getClassLoader in security policy.
- JavaImplementation javaImpl = AccessController.doPrivileged(new PrivilegedAction<JavaImplementation>() {
- public JavaImplementation run() {
- return javaAnnotationInfo.get(instance.getClass());
- }
- });
- if (javaImpl != null)
- return javaImpl;
-
- // Process annotations from the instance class.
- try {
- return processAnnotations(instance.getClass());
- } catch (IntrospectionException e) {
- // e.printStackTrace();
- }
-
- return null;
- }
-
-
- private JavaImplementation processAnnotations(Class<?> clazz)
- throws IntrospectionException {
-
- JavaImplementation javaImpl = javaImplementationFactory.createJavaImplementation(clazz);
-
- javaAnnotationInfo.put(clazz, javaImpl);
-
- OSGiPropertyInjector propertyInjector = new OSGiPropertyInjector(
- javaImpl, runtimeComponent, propertyValueFactory, proxyFactory, requestContextFactory);
-
- propertyInjectors.put(javaImpl, propertyInjector);
-
- if (javaImpl.isEagerInit())
- isEagerInit = true;
- if (javaImpl.getMaxAge() != -1)
- maxAge = javaImpl.getMaxAge();
- if (javaImpl.getMaxIdleTime() != -1)
- maxIdleTime = javaImpl.getMaxIdleTime();
- if (javaImpl.getJavaScope() != JavaScopeImpl.COMPOSITE)
- scope = new Scope(javaImpl.getJavaScope().getScope());
-
- return javaImpl;
- }
-
-
-
-
- private JavaImplementationFactory createJavaImplementationFactory(AssemblyFactory assemblyFactory) {
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- // Create the list of class visitors
- BaseJavaClassVisitor[] extensions =
- new BaseJavaClassVisitor[] {
- new ConstructorProcessor(assemblyFactory),
- new AllowsPassByReferenceProcessor(assemblyFactory),
- new ComponentNameProcessor(assemblyFactory),
- new ContextProcessor(assemblyFactory),
- new ConversationProcessor(assemblyFactory),
- new DestroyProcessor(assemblyFactory),
- new EagerInitProcessor(assemblyFactory),
- new InitProcessor(assemblyFactory),
- new PropertyProcessor(assemblyFactory),
- new ReferenceProcessor(assemblyFactory, javaInterfaceFactory),
- new ResourceProcessor(assemblyFactory),
- new OSGiScopeProcessor(assemblyFactory),
- new ServiceProcessor(assemblyFactory, javaInterfaceFactory),
- new HeuristicPojoProcessor(assemblyFactory, javaInterfaceFactory),
- new PolicyProcessor(assemblyFactory, policyFactory)};
- for (JavaClassVisitor extension : extensions) {
- javaImplementationFactory.addClassVisitor(extension);
- }
-
- return javaImplementationFactory;
- }
-
- private class OSGiScopeProcessor extends BaseJavaClassVisitor {
-
- public OSGiScopeProcessor(AssemblyFactory factory) {
- super(factory);
- }
-
- @Override
- public <T> void visitClass(Class<T> clazz,
- JavaImplementation type)
- throws IntrospectionException {
- org.osoa.sca.annotations.Scope annotation = clazz.getAnnotation(org.osoa.sca.annotations.Scope.class);
- if (annotation == null) {
- type.setJavaScope(JavaScopeImpl.COMPOSITE);
- return;
- }
- String name = annotation.value();
- JavaScopeImpl scope;
- if ("COMPOSITE".equals(name)) {
- scope = JavaScopeImpl.COMPOSITE;
- } else if ("SESSION".equals(name)) {
- scope = JavaScopeImpl.SESSION;
- } else if ("CONVERSATION".equals(name)) {
- scope = JavaScopeImpl.CONVERSATION;
- } else if ("REQUEST".equals(name)) {
- scope = JavaScopeImpl.REQUEST;
- } else {
- scope = new JavaScopeImpl(name);
- }
- type.setJavaScope(scope);
- }
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java
deleted file mode 100644
index 0264f0b102..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyInjector.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.context;
-
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.context.RequestContextImpl;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.CallbackWireObjectFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaResourceImpl;
-import org.apache.tuscany.sca.implementation.java.injection.ArrayMultiplicityObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.ConversationIDObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.FieldInjector;
-import org.apache.tuscany.sca.implementation.java.injection.Injector;
-import org.apache.tuscany.sca.implementation.java.injection.InvalidAccessorException;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.ListMultiplicityObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.MethodInjector;
-import org.apache.tuscany.sca.implementation.java.injection.ResourceObjectFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.annotations.ConversationID;
-
-
-/**
- * OSGi property injection support
- *
- * @version $Rev$ $Date$
- */
-public class OSGiPropertyInjector {
-
-
- private ArrayList<JavaElementImpl> injectionSites = new ArrayList<JavaElementImpl>();
- private Hashtable<JavaElementImpl, ObjectFactory> factories =
- new Hashtable<JavaElementImpl, ObjectFactory>();
-
- private Injector[] injectors;
-
- public OSGiPropertyInjector(
- JavaImplementation javaImpl,
- RuntimeComponent component,
- JavaPropertyValueObjectFactory propertyValueFactory,
- ProxyFactory proxyFactory,
- RequestContextFactory requestContextFactory) throws IntrospectionException {
-
- createInjectionSites(javaImpl, component, propertyValueFactory, proxyFactory, requestContextFactory);
-
- injectors = createInjectors();
-
- }
-
-
- @SuppressWarnings("unchecked")
- public void injectProperties(Object instance) {
-
- for (Injector injector : injectors) {
- injector.inject(instance);
- }
-
- }
-
-
- @SuppressWarnings("unchecked")
- private void createInjectionSites(
- JavaImplementation javaImpl,
- RuntimeComponent component,
- JavaPropertyValueObjectFactory propertyValueFactory,
- ProxyFactory proxyFactory,
- RequestContextFactory requestContextFactory)
- {
-
- List<ComponentProperty> componentProperties = component.getProperties();
- Map<String, JavaElementImpl> propertyMembers = javaImpl.getPropertyMembers();
-
- for (ComponentProperty prop : componentProperties) {
- JavaElementImpl element = propertyMembers.get(prop.getName());
-
- if (element != null && !(element.getAnchor() instanceof Constructor) && prop.getValue() != null) {
- Class propertyJavaType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue(), propertyJavaType);
-
- factories.put(element, objFactory);
- injectionSites.add(element);
- }
- }
-
- for (Member member : javaImpl.getConversationIDMembers()) {
- ObjectFactory<String> factory = new ConversationIDObjectFactory();
- if (member instanceof Field) {
- JavaElementImpl element = new JavaElementImpl((Field) member);
- element.setClassifer(ConversationID.class);
- injectionSites.add(element);
- factories.put(element, factory);
- } else if (member instanceof Method) {
- JavaElementImpl element = new JavaElementImpl((Method) member, 0);
- element.setName(JavaIntrospectionHelper.toPropertyName(member.getName()));
- element.setClassifer(ConversationID.class);
- injectionSites.add(element);
- factories.put(element, factory);
- } else {
- throw new InvalidAccessorException(
- "Member must be a field or method: " + member.getName());
- }
-
- }
-
- if (!javaImpl.getCallbackMembers().isEmpty()) {
- Map<String, List<RuntimeWire>> callbackWires = new HashMap<String, List<RuntimeWire>>();
- for (ComponentService service : component.getServices()) {
-
- RuntimeComponentReference callbackReference = (RuntimeComponentReference)service.getCallbackReference();
- if (callbackReference != null) {
- List<RuntimeWire> wires = callbackReference.getRuntimeWires();
- if (!wires.isEmpty()) {
- callbackWires.put(wires.get(0).getSource().getInterfaceContract().getInterface().toString(), wires);
- }
- }
- }
-
- for (Map.Entry<String, Collection<JavaElementImpl>> entry : javaImpl.getCallbackMembers()
- .entrySet()) {
- List<RuntimeWire> wires = callbackWires.get(entry.getKey());
- if (wires == null) {
- // this can happen when there are no client wires to a
- // component that has a callback
- continue;
- }
- for(JavaElementImpl element : entry.getValue()) {
- ObjectFactory<?> factory = new CallbackWireObjectFactory(element.getType(), proxyFactory, wires);
- if (!(element.getAnchor() instanceof Constructor)) {
- injectionSites.add(element);
- }
- factories.put(element, factory);
- }
- }
- }
-
- for (JavaResourceImpl resource : javaImpl.getResources().values()) {
-
- ObjectFactory<?> objectFactory;
- Class<?> type = resource.getElement().getType();
- if (ComponentContext.class.equals(type)) {
- objectFactory = new ComponentContextFactory(component);
-
- } else if (RequestContext.class.equals(type)) {
- objectFactory = new RequestContextObjectFactory(requestContextFactory, proxyFactory);
-
- } else {
- boolean optional = resource.isOptional();
- String mappedName = resource.getMappedName();
- objectFactory = new ResourceObjectFactory(type, mappedName, optional, null);
- }
- factories.put(resource.getElement(), objectFactory);
- if (!(resource.getElement().getAnchor() instanceof Constructor)) {
- injectionSites.add(resource.getElement());
- }
- }
-
-
- }
-
-
- @SuppressWarnings("unchecked")
- private Injector[] createInjectors() {
-
- Injector[] injectors = (Injector[])new Injector[injectionSites.size()];
-
- int i = 0;
- for (JavaElementImpl element : injectionSites) {
- Object obj = factories.get(element);
- if (obj != null) {
- if (obj instanceof ObjectFactory) {
- ObjectFactory<?> factory = (ObjectFactory<?>)obj;
- Member member = (Member)element.getAnchor();
- if (element.getElementType() == ElementType.FIELD) {
- injectors[i++] = new FieldInjector((Field)member, factory);
- } else if (element.getElementType() == ElementType.PARAMETER && member instanceof Method) {
- injectors[i++] = new MethodInjector((Method)member, factory);
- } else if (member instanceof Constructor) {
- // Ignore
- } else {
- throw new AssertionError(String.valueOf(element));
- }
- } else {
- injectors[i++] = createMultiplicityInjector(element, (List<ObjectFactory<?>>)obj);
- }
- }
- }
- return injectors;
- }
-
- @SuppressWarnings("unchecked")
- protected Injector createMultiplicityInjector(JavaElementImpl element, List<ObjectFactory<?>> factories) {
- Class<?> interfaceType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
-
- if (element.getAnchor() instanceof Field) {
- Field field = (Field)element.getAnchor();
- if (field.getType().isArray()) {
- return new FieldInjector(field, new ArrayMultiplicityObjectFactory(interfaceType, factories));
- } else {
- return new FieldInjector(field, new ListMultiplicityObjectFactory(factories));
- }
- } else if (element.getAnchor() instanceof Method) {
- Method method = (Method)element.getAnchor();
- if (method.getParameterTypes()[0].isArray()) {
- return new MethodInjector(method, new ArrayMultiplicityObjectFactory(interfaceType, factories));
- } else {
- return new MethodInjector(method, new ListMultiplicityObjectFactory(factories));
- }
- } else {
- throw new InvalidAccessorException("Member must be a field or method: " + element.getName());
- }
- }
-
- private static class ComponentContextFactory implements ObjectFactory {
-
- RuntimeComponent component;
-
- private ComponentContextFactory(RuntimeComponent component) {
- this.component = component;
- }
-
- public Object getInstance() throws ObjectCreationException {
- return component.getComponentContext();
- }
-
- }
-
-
- private static class RequestContextObjectFactory implements ObjectFactory {
-
- private RequestContextFactory factory;
- private ProxyFactory proxyFactory;
-
- public RequestContextObjectFactory(RequestContextFactory factory) {
- this(factory, null);
- }
-
- public RequestContextObjectFactory(RequestContextFactory factory, ProxyFactory proxyFactory) {
- this.factory = factory;
- this.proxyFactory = proxyFactory;
- }
-
- public RequestContext getInstance() throws ObjectCreationException {
- if (factory != null) {
- return factory.createRequestContext();
- } else {
- return new RequestContextImpl(proxyFactory);
- }
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java
deleted file mode 100644
index 38befa611b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/context/OSGiPropertyValueObjectFactory.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.context;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.databinding.SimpleTypeMapper;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.databinding.xml.DOMDataBinding;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- *
- * Process properties and create property values.
- *
- * This code has been copied from the Java implementation to avoid dependencies on the Java implementation.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiPropertyValueObjectFactory {
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- boolean isSimpleType;
-
-
- public OSGiPropertyValueObjectFactory() {
- }
-
- public OSGiPropertyValueObjectFactory(Mediator mediator) {
- }
-
- public ObjectFactory createValueFactory(Property property, Object propertyValue) {
-
- Class javaType = SimpleTypeMapperImpl.getJavaType(property.getXSDType());
- isSimpleType = isSimpleType(property);
- Document doc = (Document)propertyValue;
- Element rootElement = doc.getDocumentElement();
- if (property.isMany()) {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- List<String> values =
- getSimplePropertyValues(value, javaType);
- return new ListObjectFactoryImpl(property,
- values,
- isSimpleType,
- javaType);
- } else {
- return new ListObjectFactoryImpl(property,
- getComplexPropertyValues(doc),
- isSimpleType,
- javaType);
- }
- } else {
- if (isSimpleType) {
- String value = "";
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- } else {
- Object value = getComplexPropertyValues(doc).get(0);
- return new ObjectFactoryImpl(property,
- value,
- isSimpleType,
- javaType);
- }
-
- }
- }
-
- private boolean isSimpleType(Property property) {
- if (property.getXSDType() != null) {
- return SimpleTypeMapperImpl.isSimpleXSDType(property.getXSDType());
- } else {
- if (property instanceof Document) {
- Document doc = (Document)property;
- Element element = doc.getDocumentElement();
- if (element.getChildNodes().getLength() == 1 &&
- element.getChildNodes().item(0).getNodeType() == Node.TEXT_NODE) {
- return true;
- }
- }
- }
- return false;
- }
-
- private List<String> getSimplePropertyValues(String concatenatedValue, Class javaType) {
- List<String> propValues = new ArrayList<String>();
- StringTokenizer st = null;
- if ( javaType.getName().equals("java.lang.String")) {
- st = new StringTokenizer(concatenatedValue, "\"");
- } else {
- st = new StringTokenizer(concatenatedValue);
- }
- String aToken = null;
- while (st.hasMoreTokens()) {
- aToken = st.nextToken();
- if (aToken.trim().length() > 0) {
- propValues.add(aToken);
- }
- }
- return propValues;
- }
-
- private List<Node> getComplexPropertyValues(Document document) {
- Element rootElement = document.getDocumentElement();
- List<Node> propValues = new ArrayList<Node>();
- for (int count = 0 ; count < rootElement.getChildNodes().getLength() ; ++count) {
- if (rootElement.getChildNodes().item(count).getNodeType() == Node.ELEMENT_NODE) {
- propValues.add(rootElement.getChildNodes().item(count));
- }
- }
- return propValues;
- }
-
- public abstract class ObjectFactoryImplBase implements ObjectFactory {
- protected SimpleTypeMapper simpleTypeMapper = new SimpleTypeMapperImpl();
- protected Property property;
- protected Object propertyValue;
- protected Class javaType;
- protected DataType<XMLType> sourceDataType;
- protected DataType<?> targetDataType;
- boolean isSimpleType;
-
- public ObjectFactoryImplBase(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- this.isSimpleType = isSimpleType;
- this.property = property;
- this.propertyValue = propertyValue;
- this.javaType = javaType;
- sourceDataType =
- new DataTypeImpl<XMLType>(DOMDataBinding.NAME, Node.class,
- new XMLType(null, this.property.getXSDType()));
- TypeInfo typeInfo = null;
- if (this.property.getXSDType() != null) {
- if (SimpleTypeMapperImpl.isSimpleXSDType(this.property.getXSDType())) {
- typeInfo = new TypeInfo(property.getXSDType(), true, null);
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
- } else {
- typeInfo = new TypeInfo(property.getXSDType(), false, null);
- }
-
- XMLType xmlType = new XMLType(typeInfo);
- String dataBinding = null; //(String)property.getExtensions().get(DataBinding.class.getName());
- if (dataBinding != null) {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- } else {
- targetDataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- }
- }
- }
-
- public class ObjectFactoryImpl extends ObjectFactoryImplBase {
- public ObjectFactoryImpl(Property property, Object propertyValue, boolean isSimpleType, Class javaType) {
- super(property, propertyValue, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public Object getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- return simpleTypeMapper.toJavaObject(property.getXSDType(), (String)propertyValue, null);
- } else {
- return null;
- }
- }
- }
-
- public class ListObjectFactoryImpl extends ObjectFactoryImplBase {
- public ListObjectFactoryImpl(Property property, List<?>propertyValues, boolean isSimpleType, Class javaType) {
- super(property, propertyValues, isSimpleType, javaType);
- }
-
- @SuppressWarnings("unchecked")
- public List<?> getInstance() throws ObjectCreationException {
- if (isSimpleType) {
- List<Object> values = new ArrayList<Object>();
- for (String aValue : (List<String>)propertyValue) {
- values.add(simpleTypeMapper.toJavaObject(property.getXSDType(), aValue, null));
- }
- return values;
- } else {
- List instances = new ArrayList();
- for (Node aValue : (List<Node>)propertyValue) {
- instances.add(aValue);
- }
- return instances;
- }
- }
- }
-}
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
deleted file mode 100644
index fe3efd22cd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/impl/OSGiImplementationImpl.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.impl;
-
-
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
-
-
-/**
- * OSGi implementation
- * All attributes from <implementation.osgi> have getters in this class
- * This class implements OSGiImplementationInterface which is associated with OSGiImplementationProvider.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiImplementationImpl extends ImplementationImpl implements OSGiImplementation {
-
- private String bundleSymbolicName;
- private String bundleVersion;
-
- private String[] imports;
- private Hashtable<String, List<ComponentProperty>> referenceProperties;
- private Hashtable<String, List<ComponentProperty>> serviceProperties;
-
- private Hashtable<String, List<ComponentProperty>> referenceCallbackProperties;
- private Hashtable<String, List<ComponentProperty>> serviceCallbackProperties;
-
- private String[] classList;
-
- private ModelFactoryExtensionPoint modelFactories;
-
- private Object osgiBundle;
-
- public OSGiImplementationImpl(
- ModelFactoryExtensionPoint modelFactories,
- String bundleSymbolicName,
- String bundleVersion,
- String[] imports,
- String[] classList,
- Hashtable<String, List<ComponentProperty>> refProperties,
- Hashtable<String, List<ComponentProperty>> serviceProperties) {
-
- super();
- this.bundleSymbolicName = bundleSymbolicName;
- this.bundleVersion = bundleVersion;
- this.imports = imports;
- this.referenceProperties = refProperties;
- this.serviceProperties = serviceProperties;
- this.classList = classList;
- this.modelFactories = modelFactories;
- }
-
- public void setCallbackProperties(Hashtable<String, List<ComponentProperty>> refCallbackProperties,
- Hashtable<String, List<ComponentProperty>> serviceCallbackProperties) {
-
- this.referenceCallbackProperties = refCallbackProperties;
- this.serviceCallbackProperties = serviceCallbackProperties;
-
- }
-
-
- public String getBundleSymbolicName() {
- return bundleSymbolicName;
- }
-
- public String getBundleVersion() {
- return bundleVersion;
- }
-
- public String[] getImports() {
- return imports;
- }
-
- public String[] getClassList() {
- return classList;
- }
-
- public ModelFactoryExtensionPoint getModelFactories() {
- return modelFactories;
- }
-
- public List<ComponentProperty> getReferenceProperties(String referenceName) {
- return referenceProperties.get(referenceName);
- }
-
- public List<ComponentProperty> getServiceProperties(String serviceName) {
- return serviceProperties.get(serviceName);
- }
-
- public List<ComponentProperty> getReferenceCallbackProperties(String referenceName) {
- return referenceCallbackProperties.get(referenceName);
- }
-
- public List<ComponentProperty> getServiceCallbackProperties(String serviceName) {
- return serviceCallbackProperties.get(serviceName);
- }
-
- /**
- * Since OSGi implementation annotations may not be processed until much later, leave it to
- * the OSGi invoker to decide whether pass-by-reference is allowed.
- * @return
- */
- public boolean isAllowsPassByReference() {
- return true;
- }
-
- public Object getOSGiBundle() {
- return osgiBundle;
- }
-
- public void setOSGiBundle(Object osgiBundle) {
- this.osgiBundle = osgiBundle;
- }
-
- private boolean areEqual(Object obj1, Object obj2) {
- if (obj1 == obj2)
- return true;
- if (obj1 == null || obj2 == null)
- return false;
- return obj1.equals(obj2);
- }
-
- @Override
- public boolean equals(Object obj) {
-
- if (!(obj instanceof OSGiImplementationImpl))
- return super.equals(obj);
- OSGiImplementationImpl impl = (OSGiImplementationImpl)obj;
- if (!areEqual(bundleSymbolicName, impl.bundleSymbolicName))
- return false;
- if (!areEqual(bundleVersion, impl.bundleVersion))
- return false;
- if (!areEqual(serviceProperties, impl.serviceProperties))
- return false;
- if (!areEqual(serviceCallbackProperties, impl.serviceCallbackProperties))
- return false;
- if (!areEqual(referenceProperties, impl.referenceProperties))
- return false;
- if (!areEqual(referenceCallbackProperties, impl.referenceCallbackProperties))
- return false;
- return super.equals(obj);
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
deleted file mode 100644
index b49f94c1e0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
+++ /dev/null
@@ -1,1254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.runtime;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.core.invocation.JDKProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.core.scope.ScopedImplementationProvider;
-import org.apache.tuscany.sca.core.scope.ScopedRuntimeComponent;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
-import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
-import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.runtime.RuntimeWire;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.service.packageadmin.ExportedPackage;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * The runtime instantiation of OSGi component implementations
- *
- * @version $Rev$ $Date$
- */
-public class OSGiImplementationProvider implements ScopedImplementationProvider,
- FrameworkListener,
- BundleListener {
-
- private static final String COMPONENT_SERVICE_NAME = "component.service.name";
-
- // Maximum milliseconds to wait for a method to complete
- private static final long METHOD_TIMEOUT_MILLIS = 60000;
- // Maximum milliseconds to wait for services to be registered into OSGi service registry
- private static final long SERVICE_TIMEOUT_MILLIS = 300000;
-
- private OSGiImplementationImpl implementation;
- private OSGiAnnotations osgiAnnotations;
- private BundleContext bundleContext;
-
- private Hashtable<RuntimeWire, Reference> referenceWires = new Hashtable<RuntimeWire,Reference>();
- private Hashtable<RuntimeWire, ComponentReference> componentReferenceWires
- = new Hashtable<RuntimeWire,ComponentReference>();
- private HashSet<RuntimeWire> resolvedWires = new HashSet<RuntimeWire>();
- private boolean wiresResolved;
-
- private AtomicInteger startBundleEntryCount = new AtomicInteger();
- private AtomicInteger processAnnotationsEntryCount = new AtomicInteger();
-
- private JavaPropertyValueObjectFactory propertyValueFactory;
-
-
- private Hashtable<String, Object> componentProperties = new Hashtable<String, Object>();
- private RuntimeComponent runtimeComponent;
-
- private Bundle osgiBundle;
- private ArrayList<Bundle> dependentBundles = new ArrayList<Bundle>();
- private OSGiServiceListener osgiServiceListener;
- private PackageAdmin packageAdmin;
-
- private OSGiRuntime osgiRuntime;
-
- private ScopeRegistry scopeRegistry;
- private DataBindingExtensionPoint dataBindingRegistry;
-
- private boolean packagesRefreshed;
-
- private MessageFactory messageFactory;
- private InterfaceContractMapper mapper;
-
-
- public OSGiImplementationProvider(RuntimeComponent definition,
- OSGiImplementation impl,
- DataBindingExtensionPoint dataBindingRegistry,
- JavaPropertyValueObjectFactory propertyValueFactory,
- ProxyFactory proxyFactory,
- ScopeRegistry scopeRegistry,
- RequestContextFactory requestContextFactory,
- MessageFactory messageFactory,
- InterfaceContractMapper mapper) throws BundleException {
-
-
- this.implementation = (OSGiImplementationImpl)impl;
- this.runtimeComponent = definition;
- this.dataBindingRegistry = dataBindingRegistry;
- this.propertyValueFactory = propertyValueFactory;
- this.scopeRegistry = scopeRegistry;
- this.messageFactory = messageFactory;
- this.mapper = mapper;
-
- bundleContext = getBundleContext();
- osgiBundle = (Bundle)implementation.getOSGiBundle();
- bundleContext.addBundleListener(this);
- osgiServiceListener = new OSGiServiceListener(osgiBundle);
- bundleContext.addServiceListener(osgiServiceListener);
-
- // Install and start all dependent bundles
- String[] imports = implementation.getImports();
- for (int i = 0; i < imports.length; i++) {
- String location = imports[i].trim();
- if (location.length() > 0) {
- Bundle bundle = bundleContext.installBundle(location);
- dependentBundles.add(bundle);
- }
- }
-
-
- this.osgiAnnotations = new OSGiAnnotations(
- implementation.getModelFactories(),
- implementation.getClassList(),
- runtimeComponent,
- propertyValueFactory,
- proxyFactory,
- requestContextFactory,
- osgiBundle,
- dependentBundles);
-
-
- // PackageAdmin is used to resolve bundles
- org.osgi.framework.ServiceReference packageAdminReference =
- bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin");
- if (packageAdminReference != null) {
- packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminReference);
- bundleContext.addFrameworkListener(this);
- }
-
-
- }
-
- protected RuntimeComponent getRuntimeComponent() {
- return runtimeComponent;
- }
-
- protected OSGiImplementationImpl getImplementation() {
- return implementation;
- }
-
- // Create a property table from the list of properties
- // The source properties are properties read from <property/> elements
- // Create property values in the table of the appropriate class based
- // on the property type specified.
- private void processProperties(List<?> props, Hashtable<String, Object> propsTable) {
-
- if (props != null) {
- for (Object p : props) {
-
- Property prop = (Property)p;
- Class javaType = SimpleTypeMapperImpl.getJavaType(prop.getXSDType());
- ObjectFactory<?> objFactory = propertyValueFactory.createValueFactory(prop, prop.getValue(), javaType);
- Object value = objFactory.getInstance();
-
- propsTable.put(prop.getName(), value);
- }
- }
- }
-
-
- private BundleContext getBundleContext() throws BundleException {
-
- try {
- if (bundleContext == null) {
- osgiRuntime = OSGiRuntime.getRuntime();
- bundleContext = osgiRuntime .getBundleContext();
- }
- } catch (BundleException e) {
- throw e;
- } catch (Exception e) {
- throw new BundleException("Could not start OSGi runtime", e);
- }
-
-
- return bundleContext;
- }
-
-
- private String getOSGiFilter(Hashtable<String, Object> props) {
-
- String filter = "";
-
- if (props != null && props.size() > 0) {
- int propCount = 0;
- for (String propName : props.keySet()) {
- if (propName.equals("service.pid"))
- continue;
- filter = filter + "(" + propName + "=" + props.get(propName) + ")";
- propCount++;
- }
-
- if (propCount > 1) filter = "(&" + filter + ")";
- }
- else
- filter = null;
- return filter;
- }
-
- /*
- * Return a matching service registered by the specified bundle.
- * If <implementation.osgi /> has the attribute filter defined, return a service
- * reference that matches the filter. Otherwise, return a service which has a component
- * name equal to this component's name. If not found, return a service which no
- * component name set.
- *
- * Even though services registered by this bundle can be filtered using the
- * service listener, we use this method to filter all service references so that
- * the service matching functionality of OSGi can be directly used.
- */
- private org.osgi.framework.ServiceReference getOSGiServiceReference(
- String scaServiceName,
- String osgiServiceName, String filter)
- throws InvalidSyntaxException {
-
- String compServiceName = runtimeComponent.getName() + "/" + scaServiceName;
- if (filter != null && filter.length() > 0) {
- org.osgi.framework.ServiceReference[] references =
- bundleContext.getServiceReferences(osgiServiceName, filter);
-
-
- org.osgi.framework.ServiceReference reference = null;
- if (references != null) {
- for (org.osgi.framework.ServiceReference ref : references) {
- if (ref.getBundle() != osgiBundle)
- continue;
- Object compName = ref.getProperty(COMPONENT_SERVICE_NAME);
- if (compName == null && reference == null)
- reference = ref;
- if (scaServiceName == null || compServiceName.equals(compName)) {
- reference = ref;
- break;
- }
- }
- }
-
- return reference;
-
- }
-
- filter = scaServiceName == null? null :
- "(" + COMPONENT_SERVICE_NAME + "="+ compServiceName + ")";
-
- org.osgi.framework.ServiceReference[] references =
- bundleContext.getServiceReferences(osgiServiceName, filter);
-
- if (references != null) {
- for (org.osgi.framework.ServiceReference ref : references) {
- if (ref.getBundle() == osgiBundle) {
- return ref;
- }
- }
- }
-
- references = bundleContext.getServiceReferences(osgiServiceName, null);
-
- org.osgi.framework.ServiceReference reference = null;
-
- if (references != null) {
- for (org.osgi.framework.ServiceReference ref : references) {
-
- if (ref.getBundle() != osgiBundle)
- continue;
- Object compName = ref.getProperty(COMPONENT_SERVICE_NAME);
- if (compName == null && reference == null)
- reference = ref;
- if (compServiceName.equals(compName)) {
- reference = ref;
- break;
- }
- }
- }
-
- return reference;
- }
-
- /**
- * This method is used to avoid full synchronization of methods which should
- * be executed only once.
- *
- * entryCount=0: The count is incremented, and this thread executes the method. Returns true.
- *
- * entryCount=1: Another thread is already executing this method.
- * Wait for the thread to complete if doWait is true. Returns false.
- *
- * entryCount=2: The method has already been executed. Returns false.
- *
- * @param doWait If true, and another method is executing this method
- * wait for method execution to complete
- * @param entryCount Atomic integer used to ensure that the method is
- * executed only once
- * @return true if this thread has exclusive access to execute this method
- */
- private boolean enterMethod(boolean doWait, AtomicInteger entryCount) {
-
- if (entryCount.compareAndSet(0, 1)) {
- return true;
- }
- else {
- if (doWait) {
- synchronized (entryCount) {
- if (entryCount.get() != 2) {
- try {
- entryCount.wait(METHOD_TIMEOUT_MILLIS);
- } catch (InterruptedException e) {
- }
- }
- }
- }
- return false;
- }
- }
-
- /**
- * Called on method exit of methods which were entered after
- * enterMethod returned true. Increments entryCount, and wakes
- * up threads waiting for the method to complete.
- *
- * @param entryCount Atomic integer used for synchronization
- */
- private void exitMethod(AtomicInteger entryCount) {
- entryCount.compareAndSet(1, 2);
- synchronized (entryCount) {
- entryCount.notifyAll();
- }
- }
-
- protected Bundle startBundle(boolean doWait) throws ObjectCreationException {
-
- try {
-
- if (enterMethod(doWait, startBundleEntryCount)) {
-
- configurePropertiesUsingConfigAdmin();
-
- resolveBundle();
-
- processAnnotations(true);
-
-
- for (Bundle bundle : dependentBundles) {
- try {
- if (bundle.getState() != Bundle.ACTIVE && bundle.getState() != Bundle.STARTING) {
- bundle.start();
- }
- } catch (BundleException e) {
- if (bundle.getHeaders().get("Fragment-Host") == null)
- throw e;
- }
- }
-
- }
-
- if (osgiBundle.getState() != Bundle.ACTIVE && osgiBundle.getState() != Bundle.STARTING) {
-
-
- int retry = 0;
-
- while (retry++ < 10) {
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws BundleException {
- osgiBundle.start();
- return null;
- }
- });
- break;
- // } catch ( BundleException e) {
- } catch ( PrivilegedActionException e) {
- // It is possible that the thread "Refresh Packages" is in the process of
- // changing the state of this bundle.
- Thread.yield();
-
- if (retry == 10)
- throw e;
- }
- }
- }
-
- } catch (Exception e) {
- throw new ObjectCreationException(e);
- } finally {
- exitMethod(startBundleEntryCount);
- }
- return osgiBundle;
- }
-
-
- // This method is called by OSGiInstanceWrapper.getInstance to obtain the OSGi service reference
- // corresponding to the specified service. The properties used to filter the service should
- // be chosen based on whether this is a normal service or a callback.
- protected org.osgi.framework.ServiceReference getOSGiServiceReference(ComponentService service)
- throws ObjectCreationException {
-
- Hashtable<String, Object> props = new Hashtable<String, Object>();
- if (!service.isCallback())
- processProperties(implementation.getServiceProperties(service.getName()), props);
- else
- processProperties(implementation.getServiceCallbackProperties(service.getName()), props);
-
- String filter = getOSGiFilter(props);
- Interface serviceInterface = service.getInterfaceContract().getInterface();
- String scaServiceName = service.getName();
-
- return getOSGiServiceReference(serviceInterface, filter, scaServiceName);
-
- }
-
- protected org.osgi.framework.ServiceReference getOSGiServiceReference(
- EndpointReference from, Interface callbackInterface)
- throws ObjectCreationException {
-
- RuntimeWire refWire = null;
- String filter = null;
- for (RuntimeWire wire : referenceWires.keySet()) {
- if (wire.getSource() == from) {
- refWire = wire;
- break;
- }
- }
- if (refWire != null) {
- Hashtable<String, Object> props = new Hashtable<String, Object>();
- ComponentReference scaRef = componentReferenceWires.get(refWire);
- processProperties(implementation.getReferenceCallbackProperties(scaRef.getName()), props);
- filter = getOSGiFilter(props);
- }
-
- return getOSGiServiceReference(callbackInterface, filter, null);
- }
-
- private org.osgi.framework.ServiceReference getOSGiServiceReference(Interface serviceInterface,
- String filter, String scaServiceName)
- throws ObjectCreationException {
-
- try {
-
- String serviceInterfaceName = null;
-
- org.osgi.framework.ServiceReference osgiServiceReference = null;
-
- if (serviceInterface instanceof JavaInterface) {
- serviceInterfaceName = ((JavaInterface)serviceInterface).getJavaClass().getName();
-
- if ((osgiServiceReference = getOSGiServiceReference(
- scaServiceName,
- serviceInterfaceName, filter)) == null) {
-
- // The service listener for our bundle will notify us when the service is registered.
- synchronized (implementation) {
-
- // When declarative services are used, the component is started asynchronously
- // So this thread has to wait for the service to be registered by the component
- // activate method
- // For regular bundle activators, bundle.start activates the bundle synchronously
- // and hence the service would probably have been started by the bundle activator
- long startTime = System.currentTimeMillis();
- while ((osgiServiceReference = getOSGiServiceReference(
- scaServiceName,
- serviceInterfaceName, filter)) == null) {
-
- // Wait for the bundle to register the service
- implementation.wait(100);
- if (System.currentTimeMillis() - startTime > SERVICE_TIMEOUT_MILLIS)
- break;
- }
- }
-
- }
- }
-
- return osgiServiceReference;
-
- } catch (Exception e) {
- throw new ObjectCreationException(e);
- }
- }
-
-
- // Felix does not support bundle fragments. This is a temporary workaround.
- protected Bundle installDummyBundleWithoutFragments(Class<?> interfaceClass)
- throws Exception {
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- String EOL = System.getProperty("line.separator");
-
- String interfaceName = interfaceClass.getName();
- String packageName = getPackageName(interfaceClass);
- String bundleName = "dummy.sca." + packageName;
-
- String manifestStr = "Manifest-Version: 1.0" + EOL
- + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
- + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
- + "Bundle-Version: " + "1.0.0" + EOL
- + "Bundle-Localization: plugin" + EOL;
-
- ArrayList<String> dummyClasses = new ArrayList<String>();
-
- StringBuilder manifestBuf = new StringBuilder();
- manifestBuf.append(manifestStr);
- manifestBuf.append("Export-Package: " + packageName + EOL);
- String exportedInterfaces = interfaceName;
- Bundle existingBundle = getDummyHostBundle(packageName);
- String existingClasses;
- dummyClasses.add(interfaceClass.getName());
- for (Class<?> clazz : interfaceClass.getClasses()) {
- dummyClasses.add(clazz.getName());
- }
- if (existingBundle != null &&
- (existingClasses = (String)existingBundle.getHeaders().get("SCA-Dummy-Classes")) != null) {
- exportedInterfaces = exportedInterfaces + " " + existingClasses;
-
- StringTokenizer tokenizer = new StringTokenizer(existingClasses);
- while (tokenizer.hasMoreTokens()) {
- String className = tokenizer.nextToken();
- if (!dummyClasses.contains(className))
- dummyClasses.add(className);
- }
- }
-
- manifestBuf.append("SCA-Dummy-Classes: " + exportedInterfaces + EOL);
-
- ByteArrayInputStream manifestStream = new ByteArrayInputStream(
- manifestBuf.toString().getBytes());
- Manifest manifest = new Manifest();
- manifest.read(manifestStream);
-
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- for (int i = 0; i < dummyClasses.size(); i++) {
-
- String className = dummyClasses.get(i);
-
- Class clazz = interfaceClass.getClassLoader().loadClass(className);
- className = clazz.getName().replaceAll("\\.", "/") + ".class";
- ZipEntry ze = new ZipEntry(className);
- jarOut.putNextEntry(ze);
- InputStream stream = clazz.getResourceAsStream(clazz.getSimpleName() + ".class");
-
- byte[] bytes = new byte[stream.available()];
- stream.read(bytes);
- jarOut.write(bytes);
- stream.close();
- }
-
-
- jarOut.close();
- out.close();
-
- if (existingBundle != null) {
- existingBundle.stop();
- existingBundle.uninstall();
- }
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- Bundle bundle = bundleContext.installBundle("file://" + bundleName
- + ".jar", in);
-
- bundle.start();
-
- if (existingBundle != null && packageAdmin != null) {
- refreshPackages();
-
- }
-
- return bundle;
-
- }
-
- private Bundle getDummyHostBundle(String packageName) {
-
- if (packageAdmin == null)
- return null;
-
- ExportedPackage exp = packageAdmin.getExportedPackage(packageName);
- if (exp == null)
- return null;
- else
- return exp.getExportingBundle();
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- private Bundle installDummyBundle(Class<?> interfaceClass)
- throws Exception {
-
-
- if (!osgiRuntime.supportsBundleFragments()) {
- return installDummyBundleWithoutFragments(interfaceClass);
- }
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- String EOL = System.getProperty("line.separator");
- ArrayList<Class<?>> dummyClasses = new ArrayList<Class<?>>();
-
- String interfaceName = interfaceClass.getName();
- String packageName = getPackageName(interfaceClass);
- String bundleName = "dummy.sca." + interfaceName;
-
-
- String manifestStr = "Manifest-Version: 1.0" + EOL +
- "Bundle-ManifestVersion: 2" + EOL +
- "Bundle-Name: " + bundleName + EOL +
- "Bundle-SymbolicName: " + bundleName + EOL +
- "Bundle-Version: " + "1.0.0" + EOL +
- "Bundle-Localization: plugin" + EOL;
-
-
- StringBuilder manifestBuf = new StringBuilder();
- manifestBuf.append(manifestStr);
- manifestBuf.append("Export-Package: " + packageName + EOL);
- Bundle dummyHost = getDummyHostBundle(packageName);
- if (dummyHost != null)
- manifestBuf.append("Fragment-Host: " + dummyHost.getSymbolicName() + EOL);
-
- ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
- Manifest manifest = new Manifest();
- manifest.read(manifestStream);
-
- dummyClasses.add(interfaceClass);
- for (Class<?> clazz : interfaceClass.getClasses()) {
- dummyClasses.add(clazz);
- }
-
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- for (int i = 0; i < dummyClasses.size(); i++) {
-
- Class<?> clazz = dummyClasses.get(i);
- String className = clazz.getName();
- className = clazz.getName().replaceAll("\\.", "/") + ".class";
- ZipEntry ze = new ZipEntry(className);
- jarOut.putNextEntry(ze);
- InputStream stream = clazz.getResourceAsStream(clazz.getSimpleName() + ".class");
-
- byte[] bytes = new byte[stream.available()];
- stream.read(bytes);
- jarOut.write(bytes);
- stream.close();
- }
-
- jarOut.close();
- out.close();
-
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
-
- Bundle bundle = bundleContext.installBundle(
- "file://" + bundleName + ".jar",
- in);
-
- if (dummyHost == null)
- bundle.start();
-
- return bundle;
-
- }
-
-
-
- public InstanceWrapper<?> createInstanceWrapper() throws ObjectCreationException {
-
- return new OSGiInstanceWrapper<Object>(this, osgiAnnotations, bundleContext);
- }
-
-
-
- private void resolveWireCreateDummyBundles(final Class interfaceClass) throws Exception {
-
-
- try {
-
- osgiBundle.loadClass(interfaceClass.getName());
-
- } catch (ClassNotFoundException e) {
-
- // The interface used by the proxy is not in the source bundle
- // A dummy bundle needs to be installed to create the proxy
- // Allow privileged access to file system. Requires FileSystem permission in security
- // policy.
- Bundle dummyBundle = AccessController.doPrivileged(new PrivilegedExceptionAction<Bundle>() {
- public Bundle run() throws Exception {
- return installDummyBundle(interfaceClass);
- }
- });
-
- if (packageAdmin != null) {
-
- packageAdmin.resolveBundles(new Bundle[]{dummyBundle, osgiBundle});
-
- }
-
- }
- }
-
- /**
- * For OSGi->Java wires, create a proxy corresponding to the Java interfaces
- * and register the proxy with the OSGi registry, so that the source OSGi bundle can
- * locate the target Java instance from the registry like a regular OSGi service.
- *
- * For OSGi->OSGi wires, start the target OSGi bundle, so that references of the
- * target are resolved before the source OSGi bundle is started. If the reference
- * has properties specified, create a Proxy and register a service with highest
- * possible ranking. The Proxy should wire to the correct OSGi instance specified
- * in the SCA composite.
- *
- * The first phase determines whether a proxy should be installed. It also registers
- * a dummy bundle if necessary to resolve the bundle. When phase1 is completed on all
- * wires of the component, the bundle should be resolved. Phase2 registers the proxy service.
- */
- private boolean resolveWireResolveReferences(Bundle bundle, Class interfaceClass, RuntimeWire wire,
- boolean isOSGiToOSGiWire) throws Exception {
-
-
- // FIXME: At the moment injection of values into instances require an instance to be obtained
- // through the instance wrapper, and hence requires a proxy. When we do this processing here,
- // we don't yet know whether the target requires any property or callback injection. So it is
- // safer to create a proxy all the time.
- boolean createProxy = true;
-
- ComponentReference scaRef = componentReferenceWires.get(wire);
- Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
- processProperties(implementation.getReferenceProperties(scaRef.getName()), targetProperties);
-
-
- if (isOSGiToOSGiWire) {
-
- OSGiImplementationProvider implProvider = (OSGiImplementationProvider)wire.getTarget().getComponent().getImplementationProvider();
-
- // This is an OSGi->OSGi wire
- isOSGiToOSGiWire = true;
-
- // If the target component is stateless, use a proxy to create a new service each time
- if (!implProvider.getScope().equals(Scope.COMPOSITE)) createProxy = true;
-
- Interface interfaze = wire.getTarget().getInterfaceContract().getInterface();
-
- // If the target interface is remotable, create a proxy to support pass-by-value semantics
- // AllowsPassByReference is not detected until the target instance is obtained.
- if (interfaze.isRemotable())
- createProxy = true;
-
- // If any of the operations in the target interface is non-blocking, create a proxy
- List<Operation> ops = interfaze.getOperations();
- for (Operation op : ops) {
- if (op.isNonBlocking())
- createProxy = true;
- }
-
- // If properties are specified for the reference, create a proxy since rewiring may be required
- if (targetProperties.size() > 0) {
- createProxy = true;
- }
-
- // If properties are specified for the component, create a proxy for configuring
- // the component services.
- if (componentProperties.size() > 0) {
- createProxy = true;
- }
-
- // Since this is an OSGi->OSGi wire, start the target bundle before starting the
- // source bundle if there is no proxy. For direct wiring without a proxy, this ordering
- // is irrelevant in terms of class resolution, but the target needs to be started at some
- // point. But there is no opportunity later on to start the target OSGi bundle without a proxy.
- // When a Proxy is used, the target bundle needs to be resolved for the source bundle
- // to be resolved so that the interface is visible to the source. In this case the bundle
- // will be started when an instance is needed.
- if (!createProxy) {
- implProvider.startBundle(false);
- }
- else {
- implProvider.resolveBundle();
- }
- }
- else {
- createProxy = true;
- }
-
- return createProxy;
- }
-
-
- // Register proxy service
- private void resolveWireRegisterProxyService(final Bundle bundle, final Class interfaceClass, RuntimeWire wire) throws Exception {
-
- ComponentReference scaRef = componentReferenceWires.get(wire);
- Hashtable<String, Object> targetProperties = new Hashtable<String, Object>();
- processProperties(implementation.getReferenceProperties(scaRef.getName()), targetProperties);
- targetProperties.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
-
- if (targetProperties.get(COMPONENT_SERVICE_NAME) == null && wire.getTarget().getComponent() != null) {
- String compServiceName = wire.getTarget().getComponent().getName() + "/" +
- wire.getTarget().getContract().getName();
- targetProperties.put(COMPONENT_SERVICE_NAME, compServiceName);
- }
-
-
- JDKProxyFactory proxyService = new JDKProxyFactory(messageFactory, mapper);
-
- // Allow privileged access to load classes. Requires getClassLoader permission in security
- // policy.
- final Class<?> proxyInterface = AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
- public Class<?> run() throws Exception {
- return bundle.loadClass(interfaceClass.getName());
- }
- });
-
- final Object proxy = proxyService.createProxy(proxyInterface, wire);
- final Hashtable<String, Object> finalTargetProperties = targetProperties;
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws Exception {
- bundleContext.registerService(proxyInterface.getName(), proxy, finalTargetProperties);
- return null;
- }
- });
-
-
- }
-
-
- private void refreshPackages() {
-
- if (packageAdmin != null) {
- synchronized (this) {
- packagesRefreshed = false;
- packageAdmin.refreshPackages(null);
-
- if (!packagesRefreshed) {
- try {
- this.wait(2000);
- } catch (InterruptedException e) {
- // ignore
- }
- }
- packagesRefreshed = false;
- }
- }
- }
-
-
- private void resolveBundle() throws ObjectCreationException {
-
-
- try {
-
- if (!wiresResolved) {
- wiresResolved = true;
-
- if (!setReferencesAndProperties()) {
- wiresResolved = false;
- return;
- }
-
- int refPlusServices = referenceWires.size() + runtimeComponent.getServices().size();
- boolean[] createProxyService = new boolean[refPlusServices];
- Class<?>[] interfaceClasses = new Class<?>[refPlusServices] ;
- boolean[] isOSGiToOSGiWire = new boolean[refPlusServices];
- boolean[] wireResolved = new boolean[refPlusServices];
- int index = 0;
- for (RuntimeWire wire : referenceWires.keySet()) {
-
- Reference reference = referenceWires.get(wire);
-
- isOSGiToOSGiWire[index] = wire.getTarget().getComponent() != null &&
- wire.getTarget().getComponent().getImplementationProvider()
- instanceof OSGiImplementationProvider;
-
- Interface refInterface = reference.getInterfaceContract().getInterface();
- if (refInterface instanceof JavaInterface) {
- interfaceClasses[index] = ((JavaInterface)refInterface).getJavaClass();
-
- if (!isOSGiToOSGiWire[index])
- resolveWireCreateDummyBundles(interfaceClasses[index]);
-
- }
-
- if (!resolvedWires.contains(wire)) {
- resolvedWires.add(wire);
- }
- else
- wireResolved[index] = true;
-
- index++;
- }
- for (ComponentService service : runtimeComponent.getServices()) {
- Interface callbackInterface = service.getInterfaceContract().getCallbackInterface();
- if (callbackInterface instanceof JavaInterface) {
- interfaceClasses[index] = ((JavaInterface)callbackInterface).getJavaClass();
-
- resolveWireCreateDummyBundles(interfaceClasses[index]);
- }
-
- index++;
- }
-
- index = 0;
- for (RuntimeWire wire : referenceWires.keySet()) {
-
- if (!wireResolved[index]) {
- createProxyService[index] = resolveWireResolveReferences(osgiBundle,
- interfaceClasses[index],
- wire,
- isOSGiToOSGiWire[index]);
- }
- index++;
- }
-
- refreshPackages();
-
-
- index = 0;
- for (RuntimeWire wire : referenceWires.keySet()) {
-
- if (createProxyService[index] && !wireResolved[index])
- resolveWireRegisterProxyService(osgiBundle, interfaceClasses[index], wire);
- index++;
- }
- }
- else if (osgiBundle.getState() == Bundle.INSTALLED && packageAdmin != null) {
- packageAdmin.resolveBundles(new Bundle[] {osgiBundle});
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- throw new ObjectCreationException(e);
- }
- }
-
-
- @SuppressWarnings("unchecked")
- private void configurePropertiesUsingConfigAdmin() {
-
- try {
-
- if (componentProperties.size() == 0)
- return;
-
- org.osgi.framework.ServiceReference configAdminReference =
- bundleContext.getServiceReference("org.osgi.service.cm.ConfigurationAdmin");
- if (configAdminReference != null) {
-
- Object cm = bundleContext.getService(configAdminReference);
- Class cmClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.ConfigurationAdmin");
- Method getConfigMethod = cmClass.getMethod("getConfiguration", String.class, String.class);
-
-
- Class configClass = cm.getClass().getClassLoader().loadClass("org.osgi.service.cm.Configuration");
-
- Method getMethod = configClass.getMethod("getProperties");
- Method updateMethod = configClass.getMethod("update", Dictionary.class);
-
- List<Service> services = implementation.getServices();
- HashSet<String> pidsProcessed = new HashSet<String>();
-
- for (Service service : services) {
-
- List<ComponentProperty> serviceProps = implementation.getServiceProperties(service.getName());
- String pid = null;
-
- if (serviceProps != null) {
- for (ComponentProperty prop : serviceProps) {
- if (prop.getName().equals("service.pid")) {
- ObjectFactory objFactory = propertyValueFactory.createValueFactory(prop,
- prop.getValue(), String.class);
- pid = (String)objFactory.getInstance();
- }
- }
- }
- if (pid == null || pidsProcessed.contains(pid))
- continue;
-
-
-
-
- Object config = getConfigMethod.invoke(cm, pid, null);
- Dictionary props = (Dictionary) getMethod.invoke(config);
- if (props == null)
- props = new Hashtable<String, Object>();
- for (String propertyName : componentProperties.keySet()) {
-
- props.put(propertyName, componentProperties.get(propertyName));
- }
-
- updateMethod.invoke(config, props);
-
-
- }
-
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
-
-
- public boolean isOptimizable() {
- return false;
- }
-
- public Scope getScope() {
- return osgiAnnotations.getScope();
- }
-
- public boolean isEagerInit() {
- return osgiAnnotations.isEagerInit();
- }
-
- public long getMaxAge() {
- return osgiAnnotations.getMaxAge();
- }
-
- public long getMaxIdleTime() {
- return osgiAnnotations.getMaxIdleTime();
- }
-
- protected ScopeContainer<?> getScopeContainer() {
- startBundle(true);
- return ((ScopedRuntimeComponent)runtimeComponent).getScopeContainer();
- }
-
- public Invoker createTargetInvoker(RuntimeComponentService service, Operation operation) {
-
-
- Interface serviceInterface = operation.getInterface();
- boolean isRemotable = serviceInterface.isRemotable();
-
-
- Invoker invoker = new OSGiTargetInvoker(operation, this, service);
- if (isRemotable) {
- return new OSGiRemotableInvoker(osgiAnnotations, dataBindingRegistry, operation, this, service);
- } else {
- return invoker;
- }
-
- }
-
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- return createTargetInvoker(service, operation);
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- private boolean setReferencesAndProperties() {
-
- for (Reference ref: implementation.getReferences()) {
- List<RuntimeWire> wireList = null;
- ComponentReference compRef = null;
- for (ComponentReference cRef : runtimeComponent.getReferences()) {
- if (cRef.getName().equals(ref.getName())) {
-
- wireList = ((RuntimeComponentReference)cRef).getRuntimeWires();
-
- compRef = cRef;
- break;
- }
- }
-
- if (ref.getMultiplicity() == Multiplicity.ONE_N || ref.getMultiplicity() == Multiplicity.ZERO_N) {
- for (RuntimeWire wire : wireList) {
- referenceWires.put(wire, ref);
- componentReferenceWires.put(wire, compRef);
- }
-
- } else {
- if (wireList == null && ref.getMultiplicity() == Multiplicity.ONE_ONE) {
- throw new IllegalStateException("Required reference is missing: " + ref.getName());
- }
- if (wireList != null && !wireList.isEmpty()) {
- RuntimeWire wire = wireList.get(0);
- referenceWires.put(wire, ref);
- componentReferenceWires.put(wire, compRef);
- }
-
- }
-
- }
-
- processProperties(runtimeComponent.getProperties(), componentProperties);
-
- return true;
-
- }
-
- public void start() {
- setReferencesAndProperties();
- }
-
- public void processAnnotations(boolean doWait) throws IntrospectionException {
-
- if (!enterMethod(doWait, processAnnotationsEntryCount))
- return;
-
- try {
- osgiAnnotations.processAnnotations();
-
- Scope scope = osgiAnnotations.getScope();
- if (scope.equals(Scope.SYSTEM) || scope.equals(Scope.COMPOSITE)) {
- // Nothing
- } else {
-
- if (runtimeComponent instanceof ScopedRuntimeComponent) {
-
- ScopedRuntimeComponent component = (ScopedRuntimeComponent) runtimeComponent;
-
- ScopeContainer oldScopeContainer = component.getScopeContainer();
- component.setScopeContainer(null);
- ScopeContainer scopeContainer = scopeRegistry.getScopeContainer(runtimeComponent);
-
- if (oldScopeContainer != null && oldScopeContainer.getLifecycleState() == ScopeContainer.RUNNING) {
- scopeContainer.start();
- }
-
- component.setScopeContainer(scopeContainer);
- }
-
- }
- } finally {
- exitMethod(processAnnotationsEntryCount);
- }
- }
-
- public void stop() {
-
- if (osgiServiceListener != null)
- bundleContext.removeServiceListener(osgiServiceListener);
- }
-
-
-
- public void frameworkEvent(FrameworkEvent event) {
- if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
- synchronized (this) {
- packagesRefreshed = true;
- this.notifyAll();
- }
- }
-
- }
-
- public void bundleChanged(BundleEvent event) {
- if (event.getType() == BundleEvent.RESOLVED && event.getBundle() == osgiBundle) {
- try {
- processAnnotations(false);
- } catch (Throwable e) {
- e.printStackTrace();
- }
- }
- }
-
- private class OSGiServiceListener implements ServiceListener {
-
- private Bundle bundle;
-
- OSGiServiceListener(Bundle bundle) {
- this.bundle = bundle;
- }
-
- public void serviceChanged(org.osgi.framework.ServiceEvent event) {
-
-
- org.osgi.framework.ServiceReference reference = event.getServiceReference();
-
- if (event.getType() == ServiceEvent.REGISTERED && reference.getBundle() == bundle) {
-
- synchronized (implementation) {
-
- implementation.notifyAll();
- }
- }
-
- if (event.getType() == ServiceEvent.UNREGISTERING && reference.getBundle() == bundle) {
- // TODO: Process deregistering of OSGi services.
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java
deleted file mode 100644
index 1a13ef99f7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.runtime;
-
-
-import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osgi.framework.BundleException;
-
-
-/**
- * Builds a OSGi-based implementation provider from a component definition
- *
- * @version $Rev$ $Date$
- */
-public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementation> {
-
- private DataBindingExtensionPoint dataBindings;
- private JavaPropertyValueObjectFactory propertyFactory;
- private ProxyFactory proxyFactory;
- private ScopeRegistry scopeRegistry;
- private MessageFactory messageFactory;
- private InterfaceContractMapper mapper;
-
- private RequestContextFactory requestContextFactory;
-
- public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints ) {
-
- dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class);
- ProxyFactoryExtensionPoint proxyFactories = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- proxyFactory = new ExtensibleProxyFactory(proxyFactories);
- ContextFactoryExtensionPoint contextFactories = extensionPoints.getExtensionPoint(ContextFactoryExtensionPoint.class);
- requestContextFactory = contextFactories.getFactory(RequestContextFactory.class);
-
-
- // FIXME: Scope registry is not an extension point, and this usage is specific
- // to implementation.osgi since it needs to change scope after the component is
- // created. Do we need to find a better way?
- scopeRegistry = extensionPoints.getExtensionPoint(ScopeRegistry.class);
-
- Mediator mediator = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- propertyFactory = new JavaPropertyValueObjectFactory(mediator);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- messageFactory = modelFactories.getFactory(MessageFactory.class);
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- mapper = utilities.getUtility(InterfaceContractMapper.class);
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- OSGiImplementation implementation) {
-
- try {
-
- return new OSGiImplementationProvider(component,
- implementation,
- dataBindings,
- propertyFactory,
- proxyFactory,
- scopeRegistry,
- requestContextFactory,
- messageFactory,
- mapper
- );
-
- } catch (BundleException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- public Class<OSGiImplementation> getModelType() {
- return OSGiImplementation.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiInstanceWrapper.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiInstanceWrapper.java
deleted file mode 100644
index e775041592..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiInstanceWrapper.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.runtime;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.TargetDestructionException;
-import org.apache.tuscany.sca.core.scope.TargetInitializationException;
-import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-
-
-/**
- * InstanceWrapper for creating instances for OSGi components.
- * This class needs to implement InstanceWrapper since the wrapper is stored in
- * the scope container. But getInstance() is called on this wrapper only through the
- * OSGi target invoker. OSGiTargetInvoker always invokes getInstance for a specific
- * service since one OSGi SCA component can associate different objects with
- * different services (this is different from Java SCA components which always associate
- * a single component instance with multiple services).
- *
- * @version $Rev$ $Date$
- */
-public class OSGiInstanceWrapper<T> implements InstanceWrapper<T> {
- private static final Random RANDOM_NUMBER_GENERATOR = new Random();
-
- private OSGiAnnotations annotationProcessor;
- private OSGiImplementationProvider provider;
- private BundleContext bundleContext;
- private Hashtable<Object,InstanceInfo<T>> instanceInfoList =
- new Hashtable<Object,InstanceInfo<T>>();
-
- // Dummy bundles are used to create a new service object for scopes other than COMPOSITE
- private Bundle dummyReferenceBundle;
-
-
- public OSGiInstanceWrapper(OSGiImplementationProvider provider,
- OSGiAnnotations annotationProcessor,
- BundleContext bundleContext) {
-
- this.provider = provider;
- this.annotationProcessor = annotationProcessor;
- this.bundleContext = bundleContext;
- }
-
- public synchronized T getInstance(ComponentService service) throws TargetInitializationException {
-
- // If an instance corresponding to this service has already been created, return the instance.
- if (instanceInfoList.get(service) != null)
- return instanceInfoList.get(service).osgiInstance;
-
- // There is no strict relation between service and callback instances. The instance semantics
- // actually applies to the component instance in SCA. But for OSGi services, the callback
- // is just another OSGi service, and could correspond to any of the service instances in
- // the component. To implement the SCA scope semantics for callbacks, OSGi callbacks
- // should also be made on the service object which implements the callback. The following code
- // finds the first possible callback instance based on the interfaces implemented by the service
- // objects in this component. Note that the interfaces are checked by name rather than using
- // instanceof since the class seen by Tuscany could be from a different classloader from that
- // used by the bundle.
- if (service.isCallback()) {
- Iterator<InstanceInfo<T>> instances = instanceInfoList.values().iterator();
- while (instances.hasNext()) {
- InstanceInfo<T> instanceInfo = instances.next();
- Interface interfaze = service.getInterfaceContract().getInterface();
- if (interfaze instanceof JavaInterface && ((JavaInterface)interfaze).getJavaClass() != null) {
- String interfaceName = ((JavaInterface)interfaze).getJavaClass().getName();
- Class[] interfaces = instanceInfo.osgiInstance.getClass().getInterfaces();
- for (Class clazz : interfaces) {
- if (clazz.getName().equals(interfaceName)) {
- return instanceInfo.osgiInstance;
- }
- }
-
- }
-
- }
- }
-
- Bundle refBundle = provider.startBundle(true);
-
- // For scopes other than composite, the service object is obtained using a dummy reference
- // bundle to guarantee that a new instance is created each time. This combined with the Tuscany
- // scope container code guarantee SCA scope semantics for OSGi components as long as service
- // factories are used.
- if (!annotationProcessor.getScope().equals(Scope.COMPOSITE)) {
- refBundle = getDummyReferenceBundle();
- }
-
- InstanceInfo<T> instanceInfo = new InstanceInfo<T>();
-
- instanceInfo.refBundleContext = refBundle.getBundleContext();
-
- instanceInfo.osgiInstance = getInstanceObject(instanceInfo, service);
-
- try {
-
- if (!isInitialized(instanceInfo.osgiInstance)) {
-
- annotationProcessor.injectProperties(instanceInfo.osgiInstance);
- callLifecycleMethod(instanceInfo.osgiInstance, Init.class);
-
- instanceInfo.isFirstInstance = true;
- }
-
- instanceInfoList.put(service, instanceInfo);
-
- } catch (Exception e) {
- throw new TargetInitializationException(e);
- }
-
- return instanceInfo.osgiInstance;
- }
-
-
-
- // This method is provided purely to implement InstanceWrapper interface, and is never called.
- public T getInstance() {
-
- return null;
- }
-
- public void start() throws TargetInitializationException {
-
- if (provider.isEagerInit()) {
- List<ComponentService> services = provider.getRuntimeComponent().getServices();
- for (ComponentService service : services) {
- getInstance(service);
- }
- }
- }
-
- public synchronized void stop() throws TargetDestructionException {
-
- for (InstanceInfo<T> instanceInfo : instanceInfoList.values()) {
- if (instanceInfo.osgiInstance != null && instanceInfo.osgiServiceReference != null) {
-
- try {
-
- if (instanceInfo.isFirstInstance)
- callLifecycleMethod(instanceInfo.osgiInstance, Destroy.class);
-
- instanceInfo.refBundleContext.ungetService(instanceInfo.osgiServiceReference);
-
- instanceInfo.osgiInstance = null;
- instanceInfo.osgiServiceReference = null;
-
- } catch (Exception e) {
- throw new TargetDestructionException(e);
- }
- }
- }
- instanceInfoList.clear();
- if (dummyReferenceBundle != null) {
- try {
- dummyReferenceBundle.uninstall();
- } catch (BundleException e) {
- throw new TargetDestructionException(e);
- }
- dummyReferenceBundle = null;
- }
- }
-
- @SuppressWarnings("unchecked")
- private T getInstanceObject(InstanceInfo<T> instanceInfo, ComponentService service) {
-
- /**
- * Since implementation.osgi is not well integrated with the OSGi lifecycle
- * it is possible that the service is deactivated before the service instance
- * is obtained when using declarative services. Retry in this case.
- */
- int maxRetries = 10;
- for (int i = 0; i < maxRetries; i++) {
- instanceInfo.osgiServiceReference = provider.getOSGiServiceReference(service);
- if (instanceInfo.osgiServiceReference == null)
- return null;
- T obj = (T)instanceInfo.refBundleContext.getService(instanceInfo.osgiServiceReference);
- if (obj != null)
- return obj;
- }
- return null;
- }
-
- private Bundle getDummyReferenceBundle() throws TargetInitializationException {
-
- if (dummyReferenceBundle != null)
- return dummyReferenceBundle;
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- String EOL = System.getProperty("line.separator");
- String bundleName = "dummy.sca." + RANDOM_NUMBER_GENERATOR.nextInt();
-
-
- String manifestStr = "Manifest-Version: 1.0" + EOL +
- "Bundle-ManifestVersion: 2" + EOL +
- "Bundle-Name: " + bundleName + EOL +
- "Bundle-SymbolicName: " + bundleName + EOL +
- "Bundle-Version: " + "1.0.0" + EOL +
- "Bundle-Localization: plugin" + EOL;
-
-
- StringBuilder manifestBuf = new StringBuilder();
- manifestBuf.append(manifestStr);
-
- try {
- ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
- Manifest manifest = new Manifest();
- manifest.read(manifestStream);
-
-
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- jarOut.close();
- out.close();
-
-
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
-
- dummyReferenceBundle = bundleContext.installBundle("file://" + bundleName + ".jar", in);
-
- dummyReferenceBundle.start();
-
- } catch (Exception e) {
- throw new TargetInitializationException(e);
- }
-
- return dummyReferenceBundle;
-
- }
-
- private void callLifecycleMethod(Object instance,
- Class<? extends Annotation> annotationClass) throws Exception {
-
- Method method = null;
- if (annotationClass == Init.class) {
- method = annotationProcessor.getInitMethod(instance);
- } else if (annotationClass == Destroy.class) {
- method = annotationProcessor.getDestroyMethod(instance);
- }
-
- if (method != null) {
- method.setAccessible(true);
- method.invoke(instance);
- }
- }
-
- private boolean isInitialized(Object instance) {
- for (InstanceInfo<?> info : instanceInfoList.values()) {
- if (info.osgiInstance == instance)
- return true;
- }
- return false;
- }
-
- private static class InstanceInfo<T> {
- private T osgiInstance;
- private ServiceReference osgiServiceReference;
- private BundleContext refBundleContext;
- private boolean isFirstInstance;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRemotableInvoker.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRemotableInvoker.java
deleted file mode 100644
index deb44d26fb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiRemotableInvoker.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.osgi.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.IdentityHashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.databinding.DataBinding;
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.implementation.osgi.context.OSGiAnnotations;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * An interceptor to enforce pass-by-value semantics for remotable interfaces
- *
- * @version $Rev$ $Date$
- */
-public class OSGiRemotableInvoker extends OSGiTargetInvoker implements DataExchangeSemantics {
-
- private DataBindingExtensionPoint registry;
- private Operation operation;
- private OSGiAnnotations osgiAnnotations;
-
- /**
- * @param registry
- * @param operation
- * @param method
- * @param component
- */
- public OSGiRemotableInvoker(OSGiAnnotations osgiAnnotations,
- DataBindingExtensionPoint registry,
- Operation operation,
- OSGiImplementationProvider provider,
- RuntimeComponentService service) {
- super(operation, provider, service);
- this.osgiAnnotations = osgiAnnotations;
- this.registry = registry;
- this.operation = operation;
- }
-
- @Override
- public Object invokeMethod(Object targetObject, Method m, Message msg) throws InvocationTargetException {
-
- Object result;
- if (osgiAnnotations.isAllowsPassByReference(targetObject, m)) {
- result = super.invokeMethod(targetObject, m, msg);
- } else {
- Object obj = msg.getBody();
- msg.setBody(copy((Object[])obj));
-
- result = super.invokeMethod(targetObject, m, msg);
-
- if (operation.getOutputType() != null) {
- String dataBindingId = operation.getOutputType().getDataBinding();
- DataBinding dataBinding = registry.getDataBinding(dataBindingId);
- result = copy(result, operation.getOutputType(), dataBinding);
- }
- }
- return result;
- }
-
- public Object[] copy(Object[] args) {
- if (args == null) {
- return null;
- }
- Object[] copiedArgs = new Object[args.length];
- Map<Object, Object> map = new IdentityHashMap<Object, Object>();
- for (int i = 0; i < args.length; i++) {
- if (args[i] == null) {
- copiedArgs[i] = null;
- } else {
- Object copiedArg = map.get(args[i]);
- if (copiedArg != null) {
- copiedArgs[i] = copiedArg;
- } else {
- DataType dt = operation.getInputType().getLogical().get(i);
- String dataBindingId = dt.getDataBinding();
- DataBinding dataBinding = registry.getDataBinding(dataBindingId);
- copiedArg = copy(args[i], dt, dataBinding);
- map.put(args[i], copiedArg);
- copiedArgs[i] = copiedArg;
- }
- }
- }
- return copiedArgs;
- }
-
- public Object copy(Object arg, DataType dataType, DataBinding argDataBinding) {
- if (arg == null) {
- return null;
- }
- Object copiedArg;
- if (argDataBinding != null) {
- copiedArg = argDataBinding.copy(arg, dataType, operation);
- } else {
- copiedArg = arg;
- dataType = registry.introspectType(arg, operation);
- if (dataType != null) {
- DataBinding binding = registry.getDataBinding(dataType.getDataBinding());
- if (binding != null) {
- copiedArg = binding.copy(arg, dataType, operation);
- }
- }
- // FIXME: What to do if it's not recognized?
- }
- return copiedArg;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.PassByValueAware#allowsPassByReference()
- */
- public boolean allowsPassByReference() {
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java
deleted file mode 100644
index deb39a47cd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTargetInvoker.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.osgi.runtime;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.core.context.InstanceWrapper;
-import org.apache.tuscany.sca.core.invocation.TargetInvocationException;
-import org.apache.tuscany.sca.core.scope.Scope;
-import org.apache.tuscany.sca.core.scope.ScopeContainer;
-import org.apache.tuscany.sca.core.scope.TargetResolutionException;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.EndpointReference;
-import org.apache.tuscany.sca.runtime.ReferenceParameters;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Java->OSGi references use OSGiTargetInvoker to call methods from OSGi bundles
- * OSGi->Java references use JDKProxyService and invocation handler and do not use this class
- * OSGi->OSGi references go through OSGi reference mechanisms when a proxy is not used
- * When a proxy is used, this invoker is used to call methods from OSGi bundles
- * A proxy is used for OSGi->OSGi if
- * 1) target reference properties are specified OR
- * 2) there are one or more non-blocking methods in the target interface OR
- * 3) scope is not COMPOSITE
- *
- * @version $Rev$ $Date$
- */
-public class OSGiTargetInvoker<T> implements Invoker {
-
- private Operation operation;
- protected InstanceWrapper<T> target;
-
- private final OSGiImplementationProvider provider;
- private final RuntimeComponentService service;
-
- // Scope container is reset by the OSGi implementation provider if @Scope
- // annotation is used to modify the scope (default is composite)
- // Hence this field is initialized on the first invoke.
- private ScopeContainer scopeContainer;
-
- public OSGiTargetInvoker(
- Operation operation,
- OSGiImplementationProvider provider,
- RuntimeComponentService service) {
-
-
- this.operation = operation;
- this.service = service;
- this.provider = provider;
-
- }
-
- /**
- * Resolves the target service instance or returns a cached one
- */
- @SuppressWarnings("unchecked")
- protected InstanceWrapper getInstance(Object contextId)
- throws TargetResolutionException, TargetInvocationException {
-
- if (scopeContainer == null)
- scopeContainer = provider.getScopeContainer();
-
-
- return scopeContainer.getWrapper(contextId);
-
- }
-
- @SuppressWarnings("unchecked")
- private Object invokeTarget(Message msg) throws InvocationTargetException {
-
- if (scopeContainer == null)
- scopeContainer = provider.getScopeContainer();
-
-
- Operation op = msg.getOperation();
- if (op == null) {
- op = this.operation;
- }
- ConversationSequence sequence = op.getConversationSequence();
-
- Object contextId = null;
-
- EndpointReference from = msg.getFrom();
- ReferenceParameters parameters = null;
-
- if (from != null) {
- parameters = from.getReferenceParameters();
- }
- // check what sort of context is required
- if (scopeContainer != null) {
- Scope scope = scopeContainer.getScope();
- if (scope == Scope.REQUEST) {
- contextId = Thread.currentThread();
- } else if (scope == Scope.CONVERSATION && parameters != null) {
- contextId = parameters.getConversationID();
- }
- }
-
- try {
-
- OSGiInstanceWrapper wrapper = (OSGiInstanceWrapper)getInstance(contextId);
- Object instance;
-
-
- // detects whether the scope container has created a conversation Id. This will
- // happen in the case that the component has conversational scope but only the
- // callback interface is conversational. Or in the callback case if the service interface
- // is conversational and the callback interface isn't. If we are in this situation we need
- // to get the contextId of this component and remove it after we have invoked the method on
- // it. It is possible that the component instance will not go away when it is removed below
- // because a callback conversation will still be holding a reference to it
- boolean removeTemporaryConversationalComponentAfterCall = false;
- if (parameters != null && (contextId == null) && (parameters.getConversationID() != null)) {
- contextId = parameters.getConversationID();
- removeTemporaryConversationalComponentAfterCall = true;
- }
-
- instance = wrapper.getInstance(service);
-
- Method m = JavaInterfaceUtil.findMethod(instance.getClass(), operation);
-
- Object ret = invokeMethod(instance, m, msg);
-
- scopeContainer.returnWrapper(wrapper, contextId);
-
- if ((sequence == ConversationSequence.CONVERSATION_END) || (removeTemporaryConversationalComponentAfterCall)) {
- // if end conversation, or we have the special case where a conversational
- // object was created to service the stateless half of a stateful component
- scopeContainer.remove(contextId);
- parameters.setConversationID(null);
- }
-
- return ret;
- } catch (InvocationTargetException e) {
- throw e;
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
-
- protected Object invokeMethod(Object instance, Method m, Message msg) throws InvocationTargetException {
-
- try {
-
- Object payload = msg.getBody();
-
- if (payload != null && !payload.getClass().isArray()) {
- return m.invoke(instance, payload);
- } else {
- return m.invoke(instance, (Object[])payload);
- }
-
- } catch (InvocationTargetException e) {
- throw e;
- } catch (Exception e) {
- throw new InvocationTargetException(e);
- }
- }
-
- public Message invoke(Message msg) {
- try {
- // Object messageId = msg.getMessageID();
- // Message workContext = ThreadMessageContext.getMessageContext();
- // if (messageId != null) {
- // workContext.setCorrelationID(messageId);
- // }
- Object resp = invokeTarget(msg);
- msg.setBody(resp);
- } catch (InvocationTargetException e) {
- msg.setFaultBody(e.getCause());
- }
- return msg;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
deleted file mode 100644
index 20e999bca8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiImplementationProcessor.java
+++ /dev/null
@@ -1,550 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.osgi.xml;
-
-import static javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI;
-import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-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.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentType;
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.osgi.BundleReference;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.databinding.impl.SimpleTypeMapperImpl;
-import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.osgi.framework.Bundle;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- *
- * Process an <implementation.osgi/> element in a component definition. An instance of
- * OSGiImplementation is created.
- * Also associates the component type file with the implementation.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiImplementationProcessor implements StAXArtifactProcessor<OSGiImplementationImpl> {
-
- public static final QName IMPLEMENTATION_OSGI = new QName(Constants.SCA10_TUSCANY_NS, "implementation.osgi");
-
- private static final String BUNDLE_SYMBOLICNAME= "bundleSymbolicName";
- private static final String BUNDLE_VERSION = "bundleVersion";
- private static final String CLASSES = "classes";
- private static final String IMPORTS = "imports";
-
- private static final QName PROPERTIES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "properties");
- private static final QName PROPERTY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "property");
-
- private JavaInterfaceFactory javaInterfaceFactory;
- private AssemblyFactory assemblyFactory;
- private ModelFactoryExtensionPoint modelFactories;
- private Monitor monitor;
-
- private static final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
- static {
- domFactory.setNamespaceAware(true);
- }
-
- public OSGiImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- this.modelFactories = modelFactories;
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-osgi-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-osgi-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return IMPLEMENTATION_OSGI;
- }
-
- public Class<OSGiImplementationImpl> getModelType() {
- return OSGiImplementationImpl.class;
- }
-
- private String[] tokenize(String str) {
- StringTokenizer tokenizer = new StringTokenizer(str);
- String[] tokens = new String[tokenizer.countTokens()];
- for (int i= 0; i < tokens.length; i++) {
- tokens[i] = tokenizer.nextToken();
- }
-
- return tokens;
- }
-
- public OSGiImplementationImpl read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- assert IMPLEMENTATION_OSGI.equals(reader.getName());
-
- String bundleSymbolicName = reader.getAttributeValue(null, BUNDLE_SYMBOLICNAME);
- String bundleVersion = reader.getAttributeValue(null, BUNDLE_VERSION);
- String imports = reader.getAttributeValue(null, IMPORTS);
- String[] importList;
- if (imports != null)
- importList = tokenize(imports);
- else
- importList = new String[0];
- String classes = reader.getAttributeValue(null, CLASSES);
- String[] classList;
- if (classes != null)
- classList = tokenize(classes);
- else
- classList = new String[0];
-
- Hashtable<String, List<ComponentProperty>> refProperties =
- new Hashtable<String, List<ComponentProperty>>();
- Hashtable<String, List<ComponentProperty>> serviceProperties =
- new Hashtable<String, List<ComponentProperty>>();
- Hashtable<String, List<ComponentProperty>> refCallbackProperties =
- new Hashtable<String, List<ComponentProperty>>();
- Hashtable<String, List<ComponentProperty>> serviceCallbackProperties =
- new Hashtable<String, List<ComponentProperty>>();
-
- while (reader.hasNext()) {
-
- int next = reader.next();
- if (next == END_ELEMENT && IMPLEMENTATION_OSGI.equals(reader.getName())) {
- break;
- }
- else if (next == START_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
-
- // FIXME: This is temporary code which allows reference and service properties used
- // for filtering OSGi services to be specified in <implementation.osgi/>
- // This should really be provided in the component type file since these
- // properties are associated with an implementation rather than a configured
- // instance of an implementation.
- String refName = reader.getAttributeValue(null, "reference");
- String serviceName = reader.getAttributeValue(null, "service");
- String refCallbackName = reader.getAttributeValue(null, "referenceCallback");
- String serviceCallbackName = reader.getAttributeValue(null, "serviceCallback");
- List<ComponentProperty> props = readProperties(reader);
- if (refName != null)
- refProperties.put(refName, props);
- else if (serviceName != null)
- serviceProperties.put(serviceName, props);
- else if (refCallbackName != null)
- refCallbackProperties.put(refCallbackName, props);
- else if (serviceCallbackName != null)
- serviceCallbackProperties.put(serviceCallbackName, props);
- else {
- error("PropertyShouldSpecifySR", reader);
- //throw new ContributionReadException("Properties in implementation.osgi should specify service or reference");
- }
- }
-
- }
-
- OSGiImplementationImpl implementation = new OSGiImplementationImpl(
- modelFactories,
- bundleSymbolicName,
- bundleVersion,
- importList,
- classList,
- refProperties,
- serviceProperties);
- implementation.setCallbackProperties(refCallbackProperties, serviceCallbackProperties);
-
- implementation.setUnresolved(true);
-
- return implementation;
-
- }
-
-
- public void resolve(OSGiImplementationImpl impl, ModelResolver resolver) throws ContributionResolveException {
-
- try {
-
- if (impl == null || !impl.isUnresolved())
- return;
-
- impl.setUnresolved(false);
-
- BundleReference bundleReference = new BundleReference(impl.getBundleSymbolicName(), impl.getBundleVersion());
- BundleReference resolvedBundle = resolver.resolveModel(BundleReference.class, bundleReference);
- Bundle bundle = (Bundle)resolvedBundle.getBundle();
- if (bundle != null) {
- impl.setOSGiBundle(bundle);
- } else {
- error("CouldNotLocateOSGiBundle", impl, impl.getBundleSymbolicName());
- //throw new ContributionResolveException("Could not locate OSGi bundle " +
- //impl.getBundleSymbolicName());
- return;
- }
-
- String bundleName = resolvedBundle.getBundleRelativePath();
- String ctURI = bundleName.endsWith(".jar") || bundleName.endsWith(".JAR")?
- bundleName.substring(0, bundleName.lastIndexOf(".")) : bundleName;
- ctURI = ctURI.replaceAll("\\.", "/");
- ctURI = ctURI + ".componentType";
-
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setURI(ctURI);
- componentType.setUnresolved(true);
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (componentType.isUnresolved()) {
- error("MissingComponentTypeFile", impl, ctURI);
- //throw new ContributionResolveException("missing .componentType side file " + ctURI);
- return;
- }
-
- List<Service> services = componentType.getServices();
- for (Service service : services) {
- Interface interfaze = service.getInterfaceContract().getInterface();
- if (interfaze instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)interfaze;
- if (javaInterface.getJavaClass() == null) {
-
- javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
- }
- Class<?> callback = null;
- if (service.getInterfaceContract().getCallbackInterface() instanceof JavaInterface) {
- JavaInterface callbackInterface = (JavaInterface)service.getInterfaceContract().getCallbackInterface();
- if (callbackInterface.getJavaClass() == null) {
- callbackInterface.setJavaClass(getJavaClass(resolver, callbackInterface.getName()));
- }
- callback = callbackInterface.getJavaClass();
- }
-
- Service serv = createService(service, javaInterface.getJavaClass(), callback);
- impl.getServices().add(serv);
- }
- }
-
- List<Reference> references = componentType.getReferences();
- for (Reference reference : references) {
- Interface interfaze = reference.getInterfaceContract().getInterface();
- if (interfaze instanceof JavaInterface) {
- JavaInterface javaInterface = (JavaInterface)interfaze;
- if (javaInterface.getJavaClass() == null) {
- javaInterface.setJavaClass(getJavaClass(resolver, javaInterface.getName()));
- }
- Reference ref = createReference(reference, javaInterface.getJavaClass());
- impl.getReferences().add(ref);
- }
- else
- impl.getReferences().add(reference);
- }
-
- List<Property> properties = componentType.getProperties();
- for (Property property : properties) {
- impl.getProperties().add(property);
- }
- impl.setConstrainingType(componentType.getConstrainingType());
-
- } catch (InvalidInterfaceException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
-
- }
-
-
- private Class getJavaClass(ModelResolver resolver, String className) {
- ClassReference ref = new ClassReference(className);
- ref = resolver.resolveModel(ClassReference.class, ref);
- return ref.getJavaClass();
- }
-
- private Service createService(Service serv, Class<?> interfaze, Class<?> callbackInterfaze) throws InvalidInterfaceException {
- Service service = assemblyFactory.createService();
- JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
-
- // create a relative URI
- service.setName(serv.getName());
-
- JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(interfaze);
- service.getInterfaceContract().setInterface(callInterface);
-
- if (callbackInterfaze != null) {
- JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callbackInterfaze);
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- else if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- return service;
- }
-
- private Reference createReference(Reference ref, Class<?> clazz) throws InvalidInterfaceException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- JavaInterfaceContract interfaceContract = javaInterfaceFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- reference.setName(ref.getName());
- reference.setMultiplicity(ref.getMultiplicity());
-
- JavaInterface callInterface = javaInterfaceFactory.createJavaInterface(clazz);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaInterfaceFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
-
- return reference;
- }
-
- public void write(OSGiImplementationImpl model, XMLStreamWriter outputSource) throws ContributionWriteException, XMLStreamException {
-
- //FIXME Implement this method
- }
-
-
- private QName getQNameValue(XMLStreamReader reader, String value) {
- if (value != null) {
- int index = value.indexOf(':');
- String prefix = index == -1 ? "" : value.substring(0, index);
- String localName = index == -1 ? value : value.substring(index + 1);
- String ns = reader.getNamespaceContext().getNamespaceURI(prefix);
- if (ns == null) {
- ns = "";
- }
- return new QName(ns, localName, prefix);
- } else {
- return null;
- }
- }
-
- private void declareNamespace(Element element, String prefix, String ns) {
- String qname = null;
- if ("".equals(prefix)) {
- qname = "xmlns";
- } else {
- qname = "xmlns:" + prefix;
- }
- Node node = element;
- boolean declared = false;
- while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
- NamedNodeMap attrs = node.getAttributes();
- if (attrs == null) {
- break;
- }
- Node attr = attrs.getNamedItem(qname);
- if (attr != null) {
- declared = ns.equals(attr.getNodeValue());
- break;
- }
- node = node.getParentNode();
- }
- if (!declared) {
- org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
- attr.setValue(ns);
- element.setAttributeNodeNS(attr);
- }
- }
-
- 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);
- }
-
- private void loadElement(XMLStreamReader reader, Element root) throws XMLStreamException {
- Document document = root.getOwnerDocument();
- Node current = root;
- while (true) {
- switch (reader.next()) {
- case XMLStreamConstants.START_ELEMENT:
- QName name = reader.getName();
- Element child = createElement(document, name);
-
- // push the new element and make it the current one
- current.appendChild(child);
- current = child;
-
- declareNamespace(child, name.getPrefix(), name.getNamespaceURI());
-
- int count = reader.getNamespaceCount();
- for (int i = 0; i < count; i++) {
- String prefix = reader.getNamespacePrefix(i);
- String ns = reader.getNamespaceURI(i);
- declareNamespace(child, prefix, ns);
- }
-
- // add the attributes for this element
- count = reader.getAttributeCount();
- for (int i = 0; i < count; i++) {
- String ns = reader.getAttributeNamespace(i);
- String prefix = reader.getAttributePrefix(i);
- String localPart = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
- child.setAttributeNS(ns, localPart, value);
- declareNamespace(child, prefix, ns);
- }
-
- break;
- case XMLStreamConstants.CDATA:
- current.appendChild(document.createCDATASection(reader.getText()));
- break;
- case XMLStreamConstants.CHARACTERS:
- current.appendChild(document.createTextNode(reader.getText()));
- break;
- case XMLStreamConstants.END_ELEMENT:
- // if we are back at the root then we are done
- if (current == root) {
- return;
- }
-
- // pop the element off the stack
- current = current.getParentNode();
- }
- }
- }
-
- private Document readPropertyValue(XMLStreamReader reader, QName type)
- throws XMLStreamException, ParserConfigurationException {
-
- Document doc = domFactory.newDocumentBuilder().newDocument();
-
- // root element has no namespace and local name "value"
- Element root = doc.createElementNS(null, "value");
- if (type != null) {
- org.w3c.dom.Attr xsi = doc.createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, "xmlns:xsi");
- xsi.setValue(W3C_XML_SCHEMA_INSTANCE_NS_URI);
- root.setAttributeNodeNS(xsi);
-
- String prefix = type.getPrefix();
- if (prefix == null || prefix.length() == 0) {
- prefix = "ns";
- }
-
- declareNamespace(root, prefix, type.getNamespaceURI());
-
- org.w3c.dom.Attr xsiType = doc.createAttributeNS(W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:type");
- xsiType.setValue(prefix + ":" + type.getLocalPart());
- root.setAttributeNodeNS(xsiType);
- }
- doc.appendChild(root);
-
- loadElement(reader, root);
- return doc;
- }
-
- private void readProperty(ComponentProperty prop, XMLStreamReader reader)
- throws XMLStreamException, ContributionReadException {
-
-
- prop.setName(reader.getAttributeValue(null, "name"));
- String xsdType = reader.getAttributeValue(null, "type");
- if (xsdType != null)
- prop.setXSDType(getQNameValue(reader, xsdType));
- else
- prop.setXSDType(SimpleTypeMapperImpl.XSD_STRING);
-
- try {
- Document value = readPropertyValue(reader, prop.getXSDType());
- prop.setValue(value);
- } catch (ParserConfigurationException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", reader, ce);
- throw ce;
- }
- }
-
- private List<ComponentProperty> readProperties(XMLStreamReader reader)
- throws XMLStreamException, ContributionReadException {
-
- List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
-
- while (reader.hasNext()) {
-
- int next = reader.next();
- if (next == END_ELEMENT && PROPERTIES_QNAME.equals(reader.getName())) {
- break;
- }
- else if (next == START_ELEMENT && PROPERTY_QNAME.equals(reader.getName())) {
-
- ComponentProperty componentProperty = assemblyFactory.createComponentProperty();
- readProperty(componentProperty, reader);
- properties.add(componentProperty);
- }
- }
-
- return properties;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 9ecff71874..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.osgi.xml.OSGiImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.osgi,model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index c2cd957351..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.osgi.runtime.OSGiImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.osgi.OSGiImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties
deleted file mode 100644
index 2503be0b13..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/main/resources/impl-osgi-validation-messages.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionReadException = ContributionReadException occured due to:
-ContributionResolveException = ContributionResolveException occured due to:
-PropertyShouldSpecifySR = Properties in implementation.osgi should specify service or reference
-CouldNotLocateOSGiBundle = Could not locate OSGi bundle: {0}
-MissingComponentTypeFile = Missing .componentType side file: {0} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiPropertyTestCase.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiPropertyTestCase.java
deleted file mode 100644
index fb4cb4207a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiPropertyTestCase.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.implementation.osgi.runtime;
-
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestWithPropertyImpl;
-
-
-/**
- *
- * Test the execution of an OSGi implementation type
- *
- * @version $Rev$ $Date$
- */
-public class OSGiPropertyTestCase extends OSGiTestCase {
-
- @Override
- protected void setUp() throws Exception {
-
- className = OSGiTestWithPropertyImpl.class.getName();
- compositeName = "osgiproptest.composite";
-
- OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar",
- OSGiTestInterface.class,
- OSGiTestWithPropertyImpl.class);
-
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.java
deleted file mode 100644
index 6a6d80f15e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiTestCase.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.implementation.osgi.runtime;
-
-import java.lang.reflect.Proxy;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
-import org.apache.tuscany.sca.osgi.runtime.OSGiRuntime;
-
-
-/**
- *
- * Test the execution of an OSGi implementation type
- *
- * @version $Rev$ $Date$
- */
-public class OSGiTestCase extends TestCase {
-
- protected String className;
- protected String compositeName;
-
- protected void setUp() throws Exception {
-
- className = OSGiTestImpl.class.getName();
- compositeName = "osgitest.composite";
- OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
-
- }
-
-
- @Override
- protected void tearDown() throws Exception {
- OSGiRuntime.stop();
- }
-
- public void testOSGiComponent() throws Exception {
-
- SCADomain scaDomain = SCADomain.newInstance(compositeName);
- OSGiTestInterface testService = scaDomain.getService(OSGiTestInterface.class, "OSGiTestServiceComponent");
- assert(testService != null);
-
- assert(testService instanceof Proxy);
-
- String str = testService.testService();
-
- assertEquals(className, str);
-
- scaDomain.close();
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.java
deleted file mode 100644
index 93b4dee033..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestBundles.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.implementation.osgi.test;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.zip.ZipEntry;
-
-
-/**
- *
- * Utility class to create OSGi bundles
- *
- * @version $Rev$ $Date$
- */
-public class OSGiTestBundles {
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static void createBundle(String jarName,
- Class<?> interfaceClass, Class<?> implClass) throws Exception {
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
-
- String EOL = System.getProperty("line.separator");
-
- String packageName = getPackageName(interfaceClass);
- String bundleName = interfaceClass.getName();
-
- String manifestStr = "Manifest-Version: 1.0" + EOL
- + "Bundle-ManifestVersion: 2" + EOL + "Bundle-Name: "
- + bundleName + EOL + "Bundle-SymbolicName: " + bundleName + EOL
- + "Bundle-Version: " + "1.0.0" + EOL
- + "Bundle-Localization: plugin" + EOL;
-
- StringBuilder manifestBuf = new StringBuilder();
- manifestBuf.append(manifestStr);
- manifestBuf.append("Export-Package: " + packageName + EOL);
- manifestBuf.append("Import-Package: org.osgi.framework" + EOL);
- manifestBuf.append("Bundle-Activator: " + implClass.getName() + EOL);
-
- ByteArrayInputStream manifestStream = new ByteArrayInputStream(manifestBuf.toString().getBytes());
- Manifest manifest = new Manifest();
- manifest.read(manifestStream);
-
-
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- String interfaceClassName = interfaceClass.getName().replaceAll("\\.",
- "/")
- + ".class";
-
- URL url = interfaceClass.getClassLoader().getResource(
- interfaceClassName);
- String path = url.getPath();
-
- ZipEntry ze = new ZipEntry(interfaceClassName);
-
- jarOut.putNextEntry(ze);
- FileInputStream file = new FileInputStream(path);
- byte[] fileContents = new byte[file.available()];
- file.read(fileContents);
- jarOut.write(fileContents);
-
- String implClassName = implClass.getName().replaceAll("\\.",
- "/")
- + ".class";
-
- url = implClass.getClassLoader().getResource(implClassName);
- path = url.getPath();
-
- ze = new ZipEntry(implClassName);
-
- jarOut.putNextEntry(ze);
- file = new FileInputStream(path);
- fileContents = new byte[file.available()];
- file.read(fileContents);
- jarOut.write(fileContents);
-
- file.close();
-
- jarOut.close();
- out.close();
-
- FileOutputStream fileOut = new FileOutputStream(jarName);
- fileOut.write(out.toByteArray());
- fileOut.close();
-
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.java
deleted file mode 100644
index d412f6bd6a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestImpl.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.implementation.osgi.test;
-
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- *
- * Test class - Implementation of an OSGi service
- *
- * @version $Rev$ $Date$
- */
-public class OSGiTestImpl implements OSGiTestInterface, BundleActivator {
-
- public String testService() {
-
- return OSGiTestImpl.class.getName();
-
- }
-
- public void start(BundleContext bc) throws Exception {
-
- bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
-
- }
-
- public void stop(BundleContext bc) throws Exception {
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java
deleted file mode 100644
index feb9ce177e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestInterface.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.osgi.test;
-
-/**
- *
- * Test class - Interface for an OSGi service
- *
- * @version $Rev$ $Date$
- */
-public interface OSGiTestInterface {
-
- String testService() throws Exception ;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.java
deleted file mode 100644
index 630c1502d1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/test/OSGiTestWithPropertyImpl.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.implementation.osgi.test;
-
-import java.util.Hashtable;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osoa.sca.annotations.Property;
-
-/**
- *
- * Test class - Implementation of an OSGi service
- *
- * @version $Rev$ $Date$
- */
-public class OSGiTestWithPropertyImpl implements OSGiTestInterface, BundleActivator {
-
- @Property
- public double exchangeRate;
-
- private String currency;
-
- @Property
- public void setCurrency(String currency) {
- this.currency = currency;
- }
-
- public String testService() throws Exception {
-
- if (exchangeRate != 2.0)
- throw new Exception("Property exchangeRate not set correctly, expected 2.0, got " + exchangeRate);
- if (!"USD".equals(currency))
- throw new Exception("Property currency not set correctly, expected USD, got " + currency);
- return OSGiTestWithPropertyImpl.class.getName();
-
- }
-
- public void start(BundleContext bc) throws Exception {
-
- bc.registerService(OSGiTestInterface.class.getName(), this, new Hashtable<String, Object>());
-
- }
-
- public void stop(BundleContext bc) throws Exception {
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.java
deleted file mode 100644
index 1831587896..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/OSGiReadImplTestCase.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.implementation.osgi.xml;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestBundles;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestImpl;
-import org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading OSGi implementations.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiReadImplTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
-
- OSGiTestBundles.createBundle("target/test-classes/OSGiTestService.jar", OSGiTestInterface.class, OSGiTestImpl.class);
-
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- }
-
- public void testReadAndResolveComposite() throws Exception {
- InputStream is = getClass().getClassLoader().getResourceAsStream("osgitest.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- is = getClass().getClassLoader().getResourceAsStream("OSGiTestService.componentType");
- reader = inputFactory.createXMLStreamReader(is);
- ComponentType componentType = (ComponentType)staxProcessor.read(reader);
-
- ModelResolver resolver = new TestModelResolver(getClass().getClassLoader());
- staxProcessor.resolve(componentType, resolver);
- resolver.addModel(componentType);
-
- staxProcessor.resolve(composite, resolver);
-
- compositeBuilder.build(composite);
- }
-
- public void testReadOSGiImplementation() throws Exception {
-
- String str = "<?xml version=\"1.0\" encoding=\"ASCII\"?>" +
- "<implementation.osgi xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\" targetNamespace=\"http://osgi\" " +
- "bundleSymbolicName=\"OSGiTestService\" " +
- "bundleVersion=\"2.0.0\" " +
- "imports=\"import1.jar import2.jar\"" +
- "/>";
- ByteArrayInputStream is = new ByteArrayInputStream(str.getBytes());
-
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- reader.next();
-
- OSGiImplementationImpl osgiImpl = (OSGiImplementationImpl)staxProcessor.read(reader);
-
- assertEquals(osgiImpl.getBundleSymbolicName(), "OSGiTestService");
- assertEquals(osgiImpl.getBundleVersion(), "2.0.0");
- assertTrue(osgiImpl.getImports().length == 2);
- assertEquals(osgiImpl.getImports()[0], "import1.jar");
- assertEquals(osgiImpl.getImports()[1], "import2.jar");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java
deleted file mode 100644
index e1bbd97655..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/java/org/apache/tuscany/sca/implementation/osgi/xml/TestModelResolver.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.osgi.xml;
-
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.implementation.osgi.impl.OSGiImplementationImpl;
-
-
-/**
- * A default implementation of an artifact resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- private WeakReference<ClassLoader> classLoader;
-
- public TestModelResolver(ClassLoader classLoader) {
- this.classLoader = new WeakReference<ClassLoader>(classLoader);
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- if (unresolved instanceof OSGiImplementationImpl && !(resolved instanceof OSGiImplementationImpl)) {
-
- OSGiImplementationImpl impl = ((OSGiImplementationImpl)unresolved);
- ComponentType componentType = (ComponentType)resolved;
-
- List<Property> properties = componentType.getProperties();
- for (Property property : properties) {
- impl.getProperties().add(property);
- }
- impl.setUnresolved(false);
- return unresolved;
- }
-
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else if (unresolved instanceof ClassReference) {
-
- // Load a class on demand
- ClassReference classReference = (ClassReference)unresolved;
- Class clazz;
- try {
- clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
- } catch (ClassNotFoundException e) {
-
- // Return the unresolved object
- return unresolved;
- }
-
- // Store a new ClassReference wrapping the loaded class
- resolved = new ClassReference(clazz);
- map.put(resolved, resolved);
-
- // Return the resolved ClassReference
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType
deleted file mode 100644
index 254ce99d59..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/OSGiTestService.componentType
+++ /dev/null
@@ -1,28 +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.
--->
-<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service name="OSGiTestService">
- <interface.java interface="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"/>
- </service>
-
- <property name="currency" type="xsd:string" >GBP</property>
- <property name="exchangeRate" type="xsd:double" >1.0</property>
-
-</componentType>
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgiproptest.composite b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgiproptest.composite
deleted file mode 100644
index 0b31145407..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgiproptest.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"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="OSGiTestComposite">
-
- <component name="OSGiTestServiceComponent">
- <tuscany:implementation.osgi
- bundle="OSGiTestService"
- bundleSymbolicName="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"
- classes="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestWithPropertyImpl"
- />
-
- <property name="currency" type="xsd:string" >USD</property>
- <property name="exchangeRate" type="xsd:double" >2.0</property>
-
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgitest.composite b/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgitest.composite
deleted file mode 100644
index 5465eec8d9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-osgi/src/test/resources/osgitest.composite
+++ /dev/null
@@ -1,36 +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"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="OSGiTestComposite">
-
- <component name="OSGiTestServiceComponent">
- <tuscany:implementation.osgi
- bundle="OSGiTestService"
- bundleSymbolicName="org.apache.tuscany.sca.implementation.osgi.test.OSGiTestInterface"
- />
-
- <property name="currency" type="xsd:string" >USD</property>
- <property name="exchangeRate" type="xsd:double" >2.0</property>
-
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/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-java-1.5.1/modules/implementation-resource-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/pom.xml
deleted file mode 100644
index cac2c4ec79..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/pom.xml
+++ /dev/null
@@ -1,86 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-resource-runtime</artifactId>
- <name>Apache Tuscany SCA Resource Implementation Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-resource</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.resource.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.resource*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.java
deleted file mode 100644
index 582795625d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/GetResourceInvoker.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.implementation.resource.provider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * An invoker for a get resource operation.
- *
- * @version $Rev$ $Date$
- */
-class GetResourceInvoker implements Invoker {
- private String locationURL;
-
- GetResourceInvoker(String locationURL) {
- this.locationURL = locationURL;
- }
-
- public Message invoke(Message msg) {
-
- // Get the resource id from the request message
- String id = (String)((Object[])msg.getBody())[0];
- try {
-
- // Return an input stream for the resource
- URL url = new URL(locationURL +'/' + id);
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- InputStream is = connection.getInputStream();
- msg.setBody(is);
- } catch (MalformedURLException e) {
-
- // Report exception as a fault
- msg.setFaultBody(e);
- } catch (IOException e) {
-
- // Report exception as a fault
- msg.setFaultBody(e);
- }
- return msg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java
deleted file mode 100644
index a974f68a7e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.resource.provider;
-
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class ResourceImplementationProvider implements ImplementationProvider {
-
- private ResourceImplementation implementation;
-
- /**
- * Constructs a new resource implementation provider.
- */
- ResourceImplementationProvider(RuntimeComponent component, ResourceImplementation implementation) {
- this.implementation = implementation;
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- if ("get".equals(operation.getName())) {
-
- // Return an instance of our get resource invoker
- Invoker invoker = new GetResourceInvoker(implementation.getLocationURL().toString());
- return invoker;
-
- } else {
-
- // Return a dummy invoker that returns an "unsupported operation"
- // exception for now
- return new Invoker() {
- public Message invoke(Message msg) {
- msg.setFaultBody(new UnsupportedOperationException());
- return msg;
- }
- };
- }
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- }
-
- public void stop() {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java
deleted file mode 100644
index 47e70b5581..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/java/org/apache/tuscany/sca/implementation/resource/provider/ResourceImplementationProviderFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.resource.provider;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A factory for resource implementation providers.
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImplementationProviderFactory implements ImplementationProviderFactory<ResourceImplementation> {
-
- /**
- * Constructs a resource implementation.
- */
- public ResourceImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, ResourceImplementation implementation) {
- return new ResourceImplementationProvider(component, implementation);
- }
-
- public Class<ResourceImplementation> getModelType() {
- return ResourceImplementation.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 656d8c2751..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.resource.provider.ResourceImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.resource.ResourceImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.java
deleted file mode 100644
index 03f10e78e8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationTestCase.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.implementation.resource;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ResourceImplementationTestCase extends TestCase {
-
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("resource.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- public void testResource() throws Exception {
- Resource resource = scaDomain.getService(Resource.class, "ResourceServiceComponent");
- InputStream is = resource.get("test.html");
- String document = read(is);
- assertTrue(document.indexOf("<body><p>hello</body>") != -1);
- }
-
- /**
- * Read response stream from the given input stream.
- * @param is
- * @return
- * @throws IOException
- */
- private static String read(InputStream is) throws IOException {
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new InputStreamReader(is));
- StringBuffer sb = new StringBuffer();
- String str;
- while ((str = reader.readLine()) != null) {
- sb.append(str);
- }
- return sb.toString();
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/content/test.html b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/content/test.html
deleted file mode 100644
index f4b79d7f01..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/content/test.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<html>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<body><p>hello</body>
-</html> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/resource.composite b/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/resource.composite
deleted file mode 100644
index 4654056cd7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource-runtime/src/test/resources/resource.composite
+++ /dev/null
@@ -1,30 +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"
- targetNamespace="http://sample/resource"
- xmlns:sr="http://sample/resource"
- name="resource">
-
- <component name="ResourceServiceComponent">
- <tuscany:implementation.resource location="content"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/LICENSE b/branches/sca-java-1.5.1/modules/implementation-resource/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/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-java-1.5.1/modules/implementation-resource/NOTICE b/branches/sca-java-1.5.1/modules/implementation-resource/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/pom.xml b/branches/sca-java-1.5.1/modules/implementation-resource/pom.xml
deleted file mode 100644
index 1de484d706..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/pom.xml
+++ /dev/null
@@ -1,79 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-resource</artifactId>
- <name>Apache Tuscany SCA Resource Implementation Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.resource</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.resource*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java
deleted file mode 100644
index 68219de701..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/Resource.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.resource;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-
-/**
- * The service interface of resource implementations. This is not an API for application
- * developers. Application developers should use the data collection API to invoke
- * resource components.
- *
- * @version $Rev: 548609 $ $Date: 2007-06-18 23:31:03 -0700 (Mon, 18 Jun 2007) $
- */
-public interface Resource extends Collection<String, InputStream> {
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java
deleted file mode 100644
index be136ee792..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementation.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.resource;
-
-import java.net.URL;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceImplementation extends Implementation {
-
- /**
- * The URI of the resource inside its contribution.
- * @return the URI of the resource
- */
- String getLocation();
-
- /**
- * Sets the URI of the resource inside its contribution.
- * @param location the URI of the resource
- */
- void setLocation(String location);
-
- /**
- * Returns the URL of the resource.
- * @return the URL of the resource
- */
- URL getLocationURL();
-
- /**
- * Sets the URL of the resource.
- * @param url the URL of the resource
- */
- void setLocationURL(URL url);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.java
deleted file mode 100644
index 95ac452c66..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/ResourceImplementationFactory.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.implementation.resource;
-
-/**
- * Factory for the resource implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface ResourceImplementationFactory {
-
- /**
- * Creates a new resource implementation.
- * @return a new resource implementation
- */
- ResourceImplementation createResourceImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java
deleted file mode 100644
index d4db8772e4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationFactoryImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.resource.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-/**
- * Factory for the resource implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImplementationFactoryImpl implements ResourceImplementationFactory {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- public ResourceImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- }
-
- public ResourceImplementation createResourceImplementation() {
- return new ResourceImplementationImpl(assemblyFactory, javaFactory);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java
deleted file mode 100644
index 9cad0890a3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationImpl.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.resource.impl;
-
-import java.net.URL;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.resource.Resource;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class ResourceImplementationImpl implements ResourceImplementation {
-
- private Service resourceService;
-
- private String location;
- private URL url;
- private boolean unresolved;
-
- /**
- * Constructs a new resource implementation.
- */
- ResourceImplementationImpl(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory) {
-
- // Resource implementation always provide a single service exposing
- // the Resource interface, and have no references and properties
- resourceService = assemblyFactory.createService();
- resourceService.setName("Resource");
-
- // Create the Java interface contract for the Resource service
- JavaInterface javaInterface;
- try {
- javaInterface = javaFactory.createJavaInterface(Resource.class);
- } catch (InvalidInterfaceException e) {
- throw new IllegalArgumentException(e);
- }
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterface);
- resourceService.setInterfaceContract(interfaceContract);
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public URL getLocationURL() {
- return url;
- }
-
- public void setLocationURL(URL url) {
- this.url = url;
- }
-
- public ConstrainingType getConstrainingType() {
- // The resource implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- // The resource implementation does not support properties
- return Collections.emptyList();
- }
-
- public List<Service> getServices() {
- // The resource implementation does not support services
- return Collections.singletonList(resourceService);
- }
-
- public List<Reference> getReferences() {
- // The resource implementation does not support properties
- return Collections.emptyList();
- }
-
- public String getURI() {
- return location;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The resource implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- this.location = uri;
- }
-
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
deleted file mode 100644
index a8d399b11e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/java/org/apache/tuscany/sca/implementation/resource/impl/ResourceImplementationProcessor.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.resource.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementation;
-import org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-
-/**
- * Implements a StAX artifact processor for resource implementations.
- *
- * @version $Rev$ $Date$
- */
-public class ResourceImplementationProcessor implements StAXArtifactProcessor<ResourceImplementation> {
- private static final QName IMPLEMENTATION_RESOURCE = new QName(Constants.SCA10_TUSCANY_NS, "implementation.resource");
-
- private ContributionFactory contributionFactory;
- private ResourceImplementationFactory implementationFactory;
- private Monitor monitor;
-
- public ResourceImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- implementationFactory = modelFactories.getFactory(ResourceImplementationFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-resource-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-resource-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_RESOURCE;
- }
-
- public Class<ResourceImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return ResourceImplementation.class;
- }
-
- public ResourceImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.resource> element
-
- // Create and initialize the resource implementation model
- ResourceImplementation implementation = null;
-
- // Read the location attribute specifying the location of the resources
- String location = reader.getAttributeValue(null, "location");
- if (location != null) {
- implementation = implementationFactory.createResourceImplementation();
- implementation.setLocation(location);
- implementation.setUnresolved(true);
- } else {
- error("LocationAttributeMissing", reader);
- //throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_RESOURCE.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(ResourceImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- if (implementation == null)
- return;
-
- // Resolve the resource directory location
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(implementation.getLocation());
- Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
- if (resolved.getLocation() != null) {
- try {
- implementation.setLocationURL(new URL(resolved.getLocation()));
- implementation.setUnresolved(false);
- } catch (IOException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- error("CouldNotResolveLocation", resolver, implementation.getLocation());
- //throw new ContributionResolveException("Could not resolve implementation.resource location: " + implementation.getLocation());
- }
- }
-
- public void write(ResourceImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.resource>
- writer.writeStartElement(IMPLEMENTATION_RESOURCE.getNamespaceURI(), IMPLEMENTATION_RESOURCE.getLocalPart());
-
- if (implementation.getLocation() != null) {
- writer.writeAttribute("location", implementation.getLocation());
- }
-
- writer.writeEndElement();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index b5774c5c5b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.resource,model=org.apache.tuscany.sca.implementation.resource.ResourceImplementation,factory=org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
deleted file mode 100644
index f77f723c3e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.resource.ResourceImplementationFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.resource.impl.ResourceImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties
deleted file mode 100644
index 0e052aedc7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-resource/src/main/resources/impl-resource-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionResolveException = ContributionResolveException occurred due to:
-LocationAttributeMissing = Reading implementation.resource - location attribute missing
-CouldNotResolveLocation = Could not resolve implementation.resource location: {0}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/LICENSE b/branches/sca-java-1.5.1/modules/implementation-script/LICENSE
deleted file mode 100644
index 4b5ab74408..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/LICENSE
+++ /dev/null
@@ -1,251 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-===============================================================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-=================================================================================================================
-
-This module implementation-script temporarily includes one file under the following BSD license:
-
- Copyright (c) 2006, Sun Microsystems, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- - Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- - Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- - Neither the name of the Sun Microsystems, Inc. nor the names of
- contributors may be used to endorse or promote products derived from this
- software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGE.
-
-=================================================================================================================
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/NOTICE b/branches/sca-java-1.5.1/modules/implementation-script/NOTICE
deleted file mode 100644
index ecbcc6a660..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/NOTICE
+++ /dev/null
@@ -1,12 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product also includes software under the BSD license
-(see the LICENSE file contained in this distribution), with
-the following copyright:
-
-Copyright (c) 2006, Sun Microsystems, Inc.
-All rights reserved.
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/pom.xml b/branches/sca-java-1.5.1/modules/implementation-script/pom.xml
deleted file mode 100644
index 39f480603c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/pom.xml
+++ /dev/null
@@ -1,197 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-script</artifactId>
- <name>Apache Tuscany SCA Script Implementation Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extension-helper</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.bsf</groupId>
- <artifactId>bsf-all</artifactId>
- <version>3.0-beta2</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- <version>1.2.7</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
-<!-- TODO: big hack to add script engine dependencies till extension dependencies fixed -->
-
- <dependency>
- <groupId>rhino</groupId>
- <artifactId>js</artifactId>
- <version>1.6R7</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.jruby</groupId>
- <artifactId>jruby-complete</artifactId>
- <version>1.1.3</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>asm</groupId>
- <artifactId>asm</artifactId>
- </exclusion>
- <exclusion>
- <groupId>asm</groupId>
- <artifactId>asm-commons</artifactId>
- </exclusion>
- <exclusion>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.python</groupId>
- <artifactId>jython</artifactId>
- <version>2.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy-all-minimal</artifactId>
- <version>1.5.4</version>
- <scope>compile</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.script</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.script*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java b/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.java
deleted file mode 100644
index 87820c18ed..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementation.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.implementation.script;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.extension.helper.utils.ResourceHelper;
-
-/**
- * Represents a Script implementation.
- *
- * @version $Rev$ $Date$
- */
-public class ScriptImplementation {
-
- protected String scriptName;
- protected URL scriptURL;
- protected String scriptSrc;
- protected String scriptLanguage;
-
- public String getScript() {
- return scriptName;
- }
-
- public void setScript(String scriptName) {
- this.scriptName = scriptName;
- }
-
- public void setLanguage(String language) {
- this.scriptLanguage = language;
- }
-
- public void setElementText(String elementText) {
- scriptSrc = elementText;
- }
-
- public String getScriptLanguage() {
- if (scriptLanguage == null || scriptLanguage.length() < 1) {
- int i = scriptName.lastIndexOf('.');
- if (i > 0) {
- scriptLanguage = scriptName.substring(i + 1);
- }
- }
- return scriptLanguage;
- }
-
- public String getScriptSrc() {
- if (scriptSrc == null) {
- if (scriptName == null) {
- throw new IllegalArgumentException("script name is null and no inline source used");
- }
- if (scriptURL == null) {
- throw new RuntimeException("No script: " + scriptName);
- }
-
- scriptSrc = ResourceHelper.readResource(scriptURL);
- }
- return scriptSrc;
- }
-
- public void resolve(ModelResolver resolver) {
-
- if (scriptName != null) {
- //FIXME The contribution factory should be injected
- ContributionFactory contributionFactory = new DefaultContributionFactory();
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(scriptName);
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() != null) {
- try {
- scriptURL = new URL(artifact.getLocation());
- } catch (MalformedURLException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java b/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.java
deleted file mode 100644
index a7c4b9074f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptImplementationActivator.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.implementation.script;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.extension.helper.ImplementationActivator;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class ScriptImplementationActivator implements ImplementationActivator<ScriptImplementation> {
-
- // TODO: seems wrong to need PropertyValueObjectFactory, could it be on Property somehow?
- protected PropertyValueObjectFactory propertyFactory;
-
- public ScriptImplementationActivator(PropertyValueObjectFactory propertyFactory) {
- this.propertyFactory = propertyFactory;
- }
-
- public Class<ScriptImplementation> getImplementationClass() {
- return ScriptImplementation.class;
- }
-
- public InvokerFactory createInvokerFactory(RuntimeComponent rc, ComponentType ct, ScriptImplementation implementation) {
- return new ScriptInvokerFactory(rc, ct, implementation, propertyFactory);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java b/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java
deleted file mode 100644
index 2ccb414be8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvoker.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script;
-
-import javax.script.Invocable;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.bsf.xml.XMLHelper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * Perform the actual script invocation
- *
- * @version $Rev$ $Date$
- */
-public class ScriptInvoker implements Invoker {
-
- protected ScriptEngine scriptEngine;
- protected XMLHelper xmlHelper;
- protected Operation operation;
-
- public ScriptInvoker(ScriptEngine scriptEngine, XMLHelper xmlHelper, Operation operation) {
- this.scriptEngine = scriptEngine;
- this.xmlHelper = xmlHelper;
- this.operation = operation;
- }
-
- protected Object doInvoke(Object[] objects, Operation op) throws ScriptException {
- if (xmlHelper != null) {
- objects[0] = xmlHelper.toScriptXML((OMElement)objects[0]);
- }
-
- Operation oper = operation; // static setting
- if (oper.getName() == null) { // if no static setting
- oper = op; // use dynamic setting
- }
- Object response;
- try {
- response = ((Invocable)scriptEngine).invokeFunction(oper.getName(), objects);
- } catch (ScriptException e) {
- throw e;
- } catch (Exception e) {
- throw new ScriptException(e);
- }
-
- if (xmlHelper != null) {
- response = xmlHelper.toOMElement(response);
- }
-
- return response;
- }
-
- public Message invoke(Message msg) {
- try {
- Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation());
- msg.setBody(resp);
- } catch (ScriptException e) {
- msg.setFaultBody(e.getCause());
- }
- return msg;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java b/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
deleted file mode 100644
index e019129554..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/ScriptInvokerFactory.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script;
-
-import java.io.StringReader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import javax.script.Invocable;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.bsf.xml.XMLHelper;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentType;
-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.core.factory.ObjectCreationException;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.extension.helper.InvokerFactory;
-import org.apache.tuscany.sca.extension.helper.utils.PropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.script.engines.TuscanyJRubyScriptEngine;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class ScriptInvokerFactory implements InvokerFactory {
-
- protected ScriptEngine scriptEngine;
- protected XMLHelper xmlHelper;
-
- protected RuntimeComponent rc;
- protected ComponentType ct;
- protected ScriptImplementation implementation;
- protected PropertyValueObjectFactory propertyFactory;
-
-
- /**
- * @param rc
- * @param ct
- * @param implementation
- * @param propertyFactory
- */
- public ScriptInvokerFactory(RuntimeComponent rc,
- ComponentType ct,
- ScriptImplementation implementation,
- PropertyValueObjectFactory propertyFactory) {
- super();
- this.rc = rc;
- this.ct = ct;
- this.implementation = implementation;
- this.propertyFactory = propertyFactory;
- }
-
- public Invoker createInvoker(Operation operation) {
- init(rc, ct, implementation, propertyFactory);
- return new ScriptInvoker(scriptEngine, xmlHelper, operation);
- }
-
- protected synchronized void init(RuntimeComponent rc, ComponentType ct, ScriptImplementation implementation, PropertyValueObjectFactory propertyFactory) {
- if(scriptEngine!=null) {
- return;
- }
- try {
- scriptEngine = getScriptEngineByExtension(implementation.getScriptLanguage());
- if (scriptEngine == null) {
- throw new ObjectCreationException("no script engine found for language: " + implementation.getScriptLanguage());
- }
- if (!(scriptEngine instanceof Invocable)) {
- throw new ObjectCreationException("script engine does not support Invocable: " + scriptEngine);
- }
-
- for (Reference reference : ct.getReferences()) {
- scriptEngine.put(reference.getName(), createReferenceProxy(reference.getName(), rc));
- }
-
- for (Property property : ct.getProperties()) {
- ObjectFactory<?> propertyValueFactory = propertyFactory.createValueFactory(property);
- if ( propertyValueFactory != null) {
- scriptEngine.put(property.getName(), propertyValueFactory.getInstance());
- }
- }
-
- scriptEngine.eval(new StringReader(implementation.getScriptSrc()));
-
- } catch (ScriptException e) {
- throw new ObjectCreationException(e);
- }
-
- // set the databinding and XMLHelper for WSDL interfaces
- for (Service service : rc.getServices()) {
- InterfaceContract ic = service.getInterfaceContract();
- if ("org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract".equals(ic.getClass())) {
- // Set to use the Axiom data binding
- ic.getInterface().resetDataBinding(OMElement.class.getName());
- xmlHelper = XMLHelper.getArgHelper(scriptEngine);
- }
- }
- }
-
- /**
- * TODO: RuntimeComponent should provide a method like this
- */
- @SuppressWarnings("unchecked")
- protected Object createReferenceProxy(String name, RuntimeComponent component) {
- for (ComponentReference reference : component.getReferences()) {
- if (reference.getName().equals(name)) {
- Class iface = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
- return component.getComponentContext().getService(iface, name);
- }
- }
- throw new IllegalArgumentException("reference " + name + " not found on component: " + component);
- }
-
- /**
- * Hack for now to work around a problem with the JRuby script engine
- */
- protected ScriptEngine getScriptEngineByExtension(String scriptExtn) {
- if ("rb".equals(scriptExtn)) {
- return new TuscanyJRubyScriptEngine();
- } else {
- if ("py".equals(scriptExtn)) {
- pythonCachedir();
- }
- // Allow privileged access to run access classes. Requires RuntimePermission
- // for accessClassInPackage.sun.misc.
- ScriptEngineManager scriptEngineManager =
- AccessController.doPrivileged(new PrivilegedAction<ScriptEngineManager>() {
- public ScriptEngineManager run() {
- return new ScriptEngineManager();
- }
- });
- return scriptEngineManager.getEngineByExtension(scriptExtn);
- }
- }
-
- /**
- * If the Python home isn't set then let Tuscany suppress messages other than errors
- * See TUSCANY-1950
- */
- protected void pythonCachedir() {
- if (System.getProperty("python.home") == null) {
- System.setProperty("python.verbose", "error");
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java b/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
deleted file mode 100644
index 324246c32b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/java/org/apache/tuscany/sca/implementation/script/engines/TuscanyJRubyScriptEngine.java
+++ /dev/null
@@ -1,697 +0,0 @@
-/*
-* Copyright (c) 2006, Sun Microsystems, Inc.
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* - Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* - Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following disclaimer in the documentation
-* and/or other materials provided with the distribution.
-*
-* - Neither the name of the Sun Microsystems, Inc. nor the names of
-* contributors may be used to endorse or promote products derived from this
-* software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
-* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
-* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
-* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
-* DAMAGE.
-*/
-package org.apache.tuscany.sca.implementation.script.engines;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.Charset;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import javax.script.AbstractScriptEngine;
-import javax.script.Bindings;
-import javax.script.Compilable;
-import javax.script.CompiledScript;
-import javax.script.Invocable;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-
-import org.jruby.Ruby;
-import org.jruby.RubyException;
-import org.jruby.RubyIO;
-import org.jruby.RubyObject;
-import org.jruby.ast.Node;
-import org.jruby.exceptions.RaiseException;
-import org.jruby.internal.runtime.GlobalVariable;
-import org.jruby.internal.runtime.GlobalVariables;
-import org.jruby.internal.runtime.ReadonlyAccessor;
-import org.jruby.internal.runtime.ValueAccessor;
-import org.jruby.javasupport.Java;
-import org.jruby.javasupport.JavaEmbedUtils;
-import org.jruby.javasupport.JavaObject;
-import org.jruby.javasupport.JavaUtil;
-import org.jruby.runtime.Block;
-import org.jruby.runtime.IAccessor;
-import org.jruby.runtime.builtin.IRubyObject;
-import org.jruby.util.KCode;
-
-import com.sun.script.jruby.JRubyScriptEngineFactory;
-
-/**
- * This class is a copy of the class com.sun.script.ruby.JRubyScriptEngine with some minor modifications
- * to work around problems with Tuscany setting SCA properties and references as global variable in JRuby
- * Should only need it temporarily till a new BSF release fixes it.
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("unchecked")
-public class TuscanyJRubyScriptEngine extends AbstractScriptEngine
- implements Compilable, Invocable {
-
- // my factory, may be null
- private ScriptEngineFactory factory;
- private Ruby runtime;
-
- public TuscanyJRubyScriptEngine() {
- // Allow privileged access to ready properties. Requires PropertyPermission in security
- // policy.
- String rubyPath = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- return System.getProperty("com.sun.script.jruby.loadpath");
- }
- });
- init(rubyPath);
- }
-
- public TuscanyJRubyScriptEngine(String loadPath) {
- init(loadPath);
- }
-
- // my implementation for CompiledScript
- private class JRubyCompiledScript extends CompiledScript {
- // my compiled code
- private Node node;
-
- JRubyCompiledScript (Node node) {
- this.node = node;
- }
-
- public ScriptEngine getEngine() {
- return TuscanyJRubyScriptEngine.this;
- }
-
- public Object eval(ScriptContext ctx) throws ScriptException {
- return evalNode(node, ctx);
- }
- }
-
- // Compilable methods
- public CompiledScript compile(String script)
- throws ScriptException {
- Node node = compileScript(script, context);
- return new JRubyCompiledScript(node);
- }
-
- public CompiledScript compile (Reader reader)
- throws ScriptException {
- Node node = compileScript(reader, context);
- return new JRubyCompiledScript(node);
- }
-
- // Invocable methods
- public Object invokeFunction(String name, Object... args)
- throws ScriptException, NoSuchMethodException {
- return invokeImpl(null, name, args, Object.class);
- }
-
- public Object invokeMethod(Object obj, String name, Object... args)
- throws ScriptException, NoSuchMethodException {
- if (obj == null) {
- throw new IllegalArgumentException("script object is null");
- }
- return invokeImpl(obj, name, args, Object.class);
- }
-
- public Object getInterface(Object obj, Class clazz) {
- if (obj == null) {
- throw new IllegalArgumentException("script object is null");
- }
- return makeInterface(obj, clazz);
- }
-
- public Object getInterface(Class clazz) {
- return makeInterface(null, clazz);
- }
-
- private <T> T makeInterface(Object obj, Class<T> clazz) {
- if (clazz == null || !clazz.isInterface()) {
- throw new IllegalArgumentException("interface Class expected");
- }
- final Object thiz = obj;
- return (T) Proxy.newProxyInstance(
- clazz.getClassLoader(),
- new Class[] { clazz },
- new InvocationHandler() {
- public Object invoke(Object proxy, Method m, Object[] args)
- throws Throwable {
- return invokeImpl(thiz, m.getName(),
- args, m.getReturnType());
- }
- });
- }
-
- // ScriptEngine methods
- public synchronized Object eval(String str, ScriptContext ctx)
- throws ScriptException {
- Node node = compileScript(str, ctx);
- return evalNode(node, ctx);
- }
-
- public synchronized Object eval(Reader reader, ScriptContext ctx)
- throws ScriptException {
- Node node = compileScript(reader, ctx);
- return evalNode(node, ctx);
- }
-
- public ScriptEngineFactory getFactory() {
- synchronized (this) {
- if (factory == null) {
- factory = new JRubyScriptEngineFactory();
- }
- }
- return factory;
- }
-
- public Bindings createBindings() {
- return new SimpleBindings();
- }
-
- // package-private methods
- void setFactory(ScriptEngineFactory factory) {
- this.factory = factory;
- }
-
- // internals only below this point
-
- private Object rubyToJava(IRubyObject value) {
- return rubyToJava(value, Object.class);
- }
-
- private Object rubyToJava(IRubyObject value, Class type) {
- return JavaUtil.convertArgument(
- runtime,
- Java.ruby_to_java(value, value, Block.NULL_BLOCK),
- type);
- }
-
- private IRubyObject javaToRuby(Object value) {
- if (value instanceof IRubyObject) {
- return (IRubyObject) value;
- }
- IRubyObject result = JavaUtil.convertJavaToRuby(runtime, value);
- if (result instanceof JavaObject) {
- return runtime.getModule("JavaUtilities").callMethod(runtime.getCurrentContext(), "wrap", result);
- }
- return result;
- }
-
- private synchronized Node compileScript(String script, ScriptContext ctx)
- throws ScriptException {
- GlobalVariables oldGlobals = runtime.getGlobalVariables();
- try {
- setErrorWriter(ctx.getErrorWriter());
- setGlobalVariables(ctx);
- String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
- if (filename == null) {
- filename = "<unknown>";
- }
- return runtime.parseEval(script, filename, null, 0);
- } catch (RaiseException e) {
- RubyException re = e.getException();
- runtime.printError(re);
- throw new ScriptException(e);
- } catch (Exception e) {
- throw new ScriptException(e);
- } finally {
- if (oldGlobals != null) {
- setGlobalVariables(oldGlobals);
- }
- }
- }
-
- private synchronized Node compileScript(Reader reader, ScriptContext ctx)
- throws ScriptException {
- GlobalVariables oldGlobals = runtime.getGlobalVariables();
- try {
- setErrorWriter(ctx.getErrorWriter());
- setGlobalVariables(ctx);
- String filename = (String) ctx.getAttribute(ScriptEngine.FILENAME);
- if (filename == null) {
- filename = "<unknown>";
- String script = getRubyScript(reader);
- return runtime.parseEval(script, filename, null, 0);
- }
- InputStream inputStream = getRubyReader(filename);
- return runtime.parseFile(inputStream, filename, null);
- } catch (RaiseException e) {
- RubyException re = e.getException();
- runtime.printError(re);
- throw new ScriptException(e);
- } catch (Exception exp) {
- throw new ScriptException(exp);
- } finally {
- if (oldGlobals != null) {
- setGlobalVariables(oldGlobals);
- }
- }
- }
-
- private String getRubyScript(Reader reader) throws IOException {
- StringBuffer sb = new StringBuffer();
- char[] cbuf;
- while (true) {
- cbuf = new char[8*1024];
- int chars = reader.read(cbuf, 0, cbuf.length);
- if (chars < 0) {
- break;
- }
- sb.append(cbuf, 0, chars);
- }
- cbuf = null;
- return (new String(sb)).trim();
- }
-
- private InputStream getRubyReader(String filename) throws FileNotFoundException {
- File file = new File(filename);
- return new FileInputStream(file);
- }
-
- private void setGlobalVariables(final ScriptContext ctx) {
- ctx.setAttribute("context", ctx, ScriptContext.ENGINE_SCOPE);
- setGlobalVariables(new GlobalVariables(runtime) {
- GlobalVariables parent = runtime.getGlobalVariables();
-
- @Override
- public void define(String name, IAccessor accessor) {
- assert name != null;
- assert accessor != null;
- assert name.startsWith("$");
- synchronized (ctx) {
- Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
- engineScope.put(name, new GlobalVariable(accessor));
- }
- }
-
- @Override
- public void defineReadonly(String name, IAccessor accessor) {
- assert name != null;
- assert accessor != null;
- assert name.startsWith("$");
- synchronized (ctx) {
- Bindings engineScope = ctx.getBindings(ScriptContext.ENGINE_SCOPE);
- engineScope.put(name, new GlobalVariable(new
- ReadonlyAccessor(name, accessor)));
- }
- }
-
- @Override
- public boolean isDefined(String name) {
- assert name != null;
- assert name.startsWith("$");
- synchronized (ctx) {
- String modifiedName = name.substring(1);
- boolean defined = ctx.getAttributesScope(modifiedName) != -1;
- return defined ? true : parent.isDefined(name);
- }
- }
-
- @Override
- public void alias(String name, String oldName) {
- assert name != null;
- assert oldName != null;
- assert name.startsWith("$");
- assert oldName.startsWith("$");
-
- if (runtime.getSafeLevel() >= 4) {
- throw runtime.newSecurityError("Insecure: can't alias global variable");
- }
-
- synchronized (ctx) {
- int scope = ctx.getAttributesScope(name);
- if (scope == -1) {
- scope = ScriptContext.ENGINE_SCOPE;
- }
-
- IRubyObject value = get(oldName);
- ctx.setAttribute(name, rubyToJava(value), scope);
- }
- }
-
- @Override
- public IRubyObject get(String name) {
- assert name != null;
- assert name.startsWith("$");
-
- synchronized (ctx) {
- // skip '$' and try
- String modifiedName = name.substring(1);
- int scope = ctx.getAttributesScope(modifiedName);
- if (scope == -1) {
- return parent.get(name);
- }
-
- Object obj = ctx.getAttribute(modifiedName, scope);
- if (obj instanceof IAccessor) {
- return ((IAccessor)obj).getValue();
- } else {
- return javaToRuby(obj);
- }
- }
- }
-
- @Override
- public IRubyObject set(String name, IRubyObject value) {
- assert name != null;
- assert name.startsWith("$");
-
- if (runtime.getSafeLevel() >= 4) {
- throw runtime.newSecurityError("Insecure: can't change global variable value");
- }
-
- synchronized (ctx) {
- // skip '$' and try
- String modifiedName = name.substring(1);
- int scope = ctx.getAttributesScope(modifiedName);
- if (scope == -1) {
- scope = ScriptContext.ENGINE_SCOPE;
- }
- IRubyObject oldValue = get(name);
- Object obj = ctx.getAttribute(modifiedName, scope);
- if (obj instanceof IAccessor) {
- ((IAccessor)obj).setValue(value);
- } else {
- ctx.setAttribute(modifiedName, rubyToJava(value), scope);
- if ("KCODE".equals(modifiedName)) {
- setKCode((String)rubyToJava(value));
- } else if ("stdout".equals(modifiedName)) {
- equalOutputs((RubyObject)value);
- }
- }
- return oldValue;
- }
- }
-
- @Override
- public Set<String> getNames() {
- HashSet set = new HashSet();
- synchronized (ctx) {
- for (Object scope : ctx.getScopes()) {
- Bindings b = ctx.getBindings((Integer)scope);
- if (b != null) {
- for (Object key: b.keySet()) {
- set.add(key);
- }
- }
- }
- }
- for (Iterator<String> names = parent.getNames().iterator(); names.hasNext();) {
- set.add(names.next());
- }
- return Collections.unmodifiableSet(set);
- }
-
- @Override
- public IRubyObject getDefaultSeparator() {
- return parent.getDefaultSeparator();
- }
- });
- }
-
- private void setGlobalVariables(GlobalVariables globals) {
- runtime.setGlobalVariables(globals);
- }
-
- private synchronized Object evalNode(Node node, ScriptContext ctx)
- throws ScriptException {
- GlobalVariables oldGlobals = runtime.getGlobalVariables();
- try {
- setWriterOutputStream(ctx.getWriter());
- setErrorWriter(ctx.getErrorWriter());
- setGlobalVariables(ctx);
- return rubyToJava(runtime.runNormally(node, false));
- } catch (Exception exp) {
- throw new ScriptException(exp);
- } finally {
- try {
- JavaEmbedUtils.terminate(runtime);
- } catch (RaiseException e) {
- RubyException re = e.getException();
- runtime.printError(re);
- if (!runtime.fastGetClass("SystemExit").isInstance(re)) {
- throw new ScriptException(e);
- }
- } finally {
- if (oldGlobals != null) {
- setGlobalVariables(oldGlobals);
- }
- }
- }
- }
-
- private void init(final String loadPath) {
- AccessController.doPrivileged(new PrivilegedAction<Object>() {
- public Object run() {
- runtime = Ruby.newInstance();
- IAccessor d = new ValueAccessor(runtime.newString("<script>"));
- runtime.getGlobalVariables().define("$PROGRAM_NAME", d);
- runtime.getGlobalVariables().define("$0", d);
- String path = loadPath;
- if (path == null) {
- path = System.getProperty("java.class.path");
- }
- List list = Arrays.asList(path.split(File.pathSeparator));
- runtime.getLoadService().init(list);
- runtime.getLoadService().require("java");
- return null;
- }
- });
- }
-
- private synchronized Object invokeImpl(final Object obj, String method,
- Object[] args, Class returnType)
- throws ScriptException {
- if (method == null) {
- throw new NullPointerException("method name is null");
- }
- GlobalVariables oldGlobals = runtime.getGlobalVariables();
- try {
- setWriterOutputStream(context.getWriter());
- setErrorWriter(context.getErrorWriter());
- setGlobalVariables(context);
- IRubyObject rubyRecv = obj != null ?
- JavaUtil.convertJavaToRuby(runtime, obj) : runtime.getTopSelf();
-
- IRubyObject result;
- if (args != null && args.length > 0) {
- IRubyObject[] rubyArgs = JavaUtil.convertJavaArrayToRuby(runtime, args);
- // Create Ruby proxies for any input arguments that are not primitives.
- IRubyObject javaUtilities = runtime.getObject().getConstant("JavaUtilities");
- for (int i = 0; i < rubyArgs.length; i++) {
- IRubyObject tmp = rubyArgs[i];
- if (tmp instanceof JavaObject) {
- rubyArgs[i] = javaUtilities.callMethod(runtime.getCurrentContext(), "wrap", tmp);
- }
- }
- result = rubyRecv.callMethod(runtime.getCurrentContext(), method, rubyArgs);
- } else {
- result = rubyRecv.callMethod(runtime.getCurrentContext(), method);
- }
- return rubyToJava(result, returnType);
- } catch (Exception exp) {
- throw new ScriptException(exp);
- } finally {
- try {
- JavaEmbedUtils.terminate(runtime);
- } catch (RaiseException e) {
- RubyException re = e.getException();
- runtime.printError(re);
- if (!runtime.fastGetClass("SystemExit").isInstance(re)) {
- throw new ScriptException(e);
- }
- } finally {
- if (oldGlobals != null) {
- setGlobalVariables(oldGlobals);
- }
- }
- }
- }
-
- private void setKCode(String encoding) {
- KCode kcode = KCode.create(runtime, encoding);
- runtime.setKCode(kcode);
- }
-
- private void equalOutputs(RubyObject value) {
- runtime.getGlobalVariables().set("$>", value);
- runtime.getGlobalVariables().set("$defout", value);
- }
-
- private void setWriterOutputStream(Writer writer) {
- try {
- RubyIO dummy_io =
- new RubyIO(runtime, new PrintStream(new WriterOutputStream(new StringWriter())));
- runtime.getGlobalVariables().set("$stderr", dummy_io); //discard unwanted warnings
- RubyIO io =
- new RubyIO(runtime, new PrintStream(new WriterOutputStream(writer)));
- io.getOpenFile().getMainStream().setSync(true);
- runtime.defineGlobalConstant("STDOUT", io);
- runtime.getGlobalVariables().set("$>", io);
- runtime.getGlobalVariables().set("$stdout", io);
- runtime.getGlobalVariables().set("$defout", io);
- } catch (UnsupportedEncodingException exp) {
- throw new IllegalArgumentException(exp);
- }
- }
-
- private void setErrorWriter(Writer writer) {
- try {
- RubyIO dummy_io =
- new RubyIO(runtime, new PrintStream(new WriterOutputStream(new StringWriter())));
- runtime.getGlobalVariables().set("$stderr", dummy_io); //discard unwanted warnings
- RubyIO io =
- new RubyIO(runtime, new PrintStream(new WriterOutputStream(writer)));
- io.getOpenFile().getMainStream().setSync(true);
- runtime.defineGlobalConstant("STDERR", io);
- runtime.getGlobalVariables().set("$stderr", io);
- runtime.getGlobalVariables().set("$deferr", io);
- } catch (UnsupportedEncodingException exp) {
- throw new IllegalArgumentException(exp);
- }
- }
-
- private String getEncoding() {
- String enc = System.getProperty("sun.jnu.encoding");
- if (enc != null) {
- return enc;
- }
- return ((enc = System.getProperty("file.encoding")) == null) ? "UTF-8" : enc;
- }
-
- private class WriterOutputStream extends OutputStream {
-
- private Writer writer;
- private CharsetDecoder decoder;
-
- private WriterOutputStream(Writer writer) throws UnsupportedEncodingException {
- this(writer, getEncoding());
- }
-
- private WriterOutputStream(Writer writer, String enc) throws UnsupportedEncodingException {
- this.writer = writer;
- if (enc == null) {
- throw new UnsupportedEncodingException("encoding is " + enc);
- }
- try {
- decoder = Charset.forName(enc).newDecoder();
- } catch (Exception e) {
- throw new UnsupportedEncodingException("Unsupported: " + enc);
- }
- decoder.onMalformedInput(CodingErrorAction.REPLACE);
- decoder.onUnmappableCharacter(CodingErrorAction.REPLACE);
- }
-
- @Override
- public void close() throws IOException {
- synchronized(writer) {
- decoder = null;
- writer.close();
- }
- }
-
- @Override
- public void flush() throws IOException {
- synchronized(writer) {
- writer.flush();
- }
- }
-
- @Override
- public void write(int b) throws IOException {
- byte[] buffer = new byte[1];
- write(buffer, 0, 1);
- }
-
- @Override
- public void write(byte[] buffer) throws IOException {
- write(buffer, 0, buffer.length);
- }
-
- @Override
- public void write(byte[] buffer, int offset, int length) throws IOException {
- synchronized(writer) {
- if (offset < 0 || offset > buffer.length - length || length < 0) {
- throw new IndexOutOfBoundsException();
- }
- if (length == 0) {
- return;
- }
- ByteBuffer bytes = ByteBuffer.wrap(buffer, offset, length);
- CharBuffer chars = CharBuffer.allocate(length);
- convert(bytes, chars);
- char[] cbuf = new char[chars.length()];
- chars.get(cbuf, 0, chars.length());
- writer.write(cbuf);
- writer.flush();
- }
- }
-
- private void convert(ByteBuffer bytes, CharBuffer chars) throws IOException {
- decoder.reset();
- chars.clear();
- CoderResult result = decoder.decode(bytes, chars, true);
- if (result.isError() || result.isOverflow()) {
- throw new IOException(result.toString());
- } else if (result.isUnderflow()) {
- chars.flip();
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator b/branches/sca-java-1.5.1/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator
deleted file mode 100644
index c8152b606f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/main/resources/META-INF/services/org.apache.tuscany.sca.extension.helper.ImplementationActivator
+++ /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.
-# Implementation class for the ExtensionActivator
-org.apache.tuscany.sca.implementation.script.ScriptImplementationActivator
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java
deleted file mode 100644
index fc87f92ef1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/AbstractSCATestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractSCATestCase<T> extends TestCase {
-
- protected SCADomain domain;
- protected T service;
-
- @Override
- @SuppressWarnings("unchecked")
- protected void setUp() throws Exception {
- domain = SCADomain.newInstance(getCompositeName());
- service = (T) domain.getService(getServiceClass(), "ClientComponent");
- }
-
- protected abstract Class getServiceClass();
-
- @Override
- protected void tearDown() throws Exception {
- domain.close();
- }
-
- protected String getCompositeName() {
- String className = this.getClass().getName();
- return className.substring(0, className.length() - 8).replace('.', '/') + ".composite";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java
deleted file mode 100644
index 09239cd38f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/AbstractHelloWorldTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests.dynamic;
-
-import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
-
- public void testHello() throws Exception {
- assertEquals("Hello petra", service.sayHello("petra"));
- }
-
- @Override
- protected Class<HelloWorld> getServiceClass() {
- return HelloWorld.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.java
deleted file mode 100644
index 5781f4f2c9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/HelloWorld.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.implementation.script.itests.dynamic;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorld {
-
- String sayHello(String s);
- String sayHelloFrom(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.java
deleted file mode 100644
index e88e44c7c0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRefTestCase.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.implementation.script.itests.dynamic;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScriptDynamicRefTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java
deleted file mode 100644
index 331d5bcfd4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorldTestCase.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests.dynamic;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-
- public void testHelloFrom() throws Exception {
- System.out.println(service.sayHelloFrom("Venkat"));
- assertEquals("Hello petra from Tuscany", service.sayHelloFrom("petra"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
deleted file mode 100644
index 1af3a295a4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/AbstractHelloWorldTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests.helloworld;
-
-import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
-
- public void testCalculator() throws Exception {
- assertEquals("Hello petra", service.sayHello("petra"));
- }
-
- @Override
- protected Class<HelloWorld> getServiceClass() {
- return HelloWorld.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.java
deleted file mode 100644
index 6a4f10dbbb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorldTestCase.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.implementation.script.itests.helloworld;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.java
deleted file mode 100644
index f87cf104f3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorld.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.implementation.script.itests.helloworld;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorld {
-
- String sayHello(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.java
deleted file mode 100644
index 980864869f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/HelloWorldProxy.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.implementation.script.itests.helloworld;
-
-import org.osoa.sca.annotations.Reference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HelloWorldProxy implements HelloWorld {
-
- @Reference
- public HelloWorld delegate;
-
- public String sayHello(String s) {
- return delegate.sayHello(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.java
deleted file mode 100644
index ca4bd5ae6a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorldTestCase.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.implementation.script.itests.helloworld;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.java
deleted file mode 100644
index 93d1949c50..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorldTestCase.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.implementation.script.itests.helloworld;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScripInlineHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.java
deleted file mode 100644
index 46ed9abce6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorldTestCase.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.implementation.script.itests.helloworld;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.java
deleted file mode 100644
index d694515829..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorldTestCase.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.implementation.script.itests.helloworld;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
deleted file mode 100644
index e7375253a3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/AbstractHelloWorldTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests.properties;
-
-import org.apache.tuscany.sca.implementation.script.itests.AbstractSCATestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractHelloWorldTestCase extends AbstractSCATestCase<HelloWorld> {
-
- public void testCalculator() throws Exception {
- // assertEquals("Hello petra from Tuscany", service.sayHello("petra"));
- }
-
- @Override
- protected Class<HelloWorld> getServiceClass() {
- return HelloWorld.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.java
deleted file mode 100644
index f93edc76d1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorldTestCase.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.implementation.script.itests.properties;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class GroovyHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.java
deleted file mode 100644
index 910d22ec83..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorld.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.implementation.script.itests.properties;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface HelloWorld {
-
- String sayHello(String s);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.java
deleted file mode 100644
index 47cdc03e0e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/HelloWorldProxy.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.implementation.script.itests.properties;
-
-import org.osoa.sca.annotations.Reference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HelloWorldProxy implements HelloWorld {
-
- @Reference
- public HelloWorld delegate;
-
- public String sayHello(String s) {
- return delegate.sayHello(s);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.java
deleted file mode 100644
index 60c73359c0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorldTestCase.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.implementation.script.itests.properties;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JRubyHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.java
deleted file mode 100644
index cde96b4b9b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorldTestCase.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.implementation.script.itests.properties;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScriptHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.java
deleted file mode 100644
index 0e6be74e09..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorldTestCase.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.implementation.script.itests.properties;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JythonHelloWorldTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.java
deleted file mode 100644
index 6116581356..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReferenceTestCase.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.implementation.script.itests.references;
-
-import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class GroovyReferenceTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java
deleted file mode 100644
index dfcd37c46c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/HelloWorldTarget.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.script.itests.references;
-
-import org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HelloWorldTarget implements HelloWorld {
-
- public String sayHello(String s) {
- return "Hello " + s;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.java
deleted file mode 100644
index 83c2e99469..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReferenceTestCase.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.implementation.script.itests.references;
-
-import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JRubyReferenceTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.java
deleted file mode 100644
index 392e16411c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReferenceTestCase.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.implementation.script.itests.references;
-
-import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaScriptReferenceTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java b/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.java
deleted file mode 100644
index 8866ae6b70..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/java/org/apache/tuscany/sca/implementation/script/itests/references/JythonReferenceTestCase.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.implementation.script.itests.references;
-
-import org.apache.tuscany.sca.implementation.script.itests.helloworld.AbstractHelloWorldTestCase;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JythonReferenceTestCase extends AbstractHelloWorldTestCase {
- // super class does it all getting composite based on this class name
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite
deleted file mode 100644
index 77ba095988..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptDynamicRef.composite
+++ /dev/null
@@ -1,35 +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="JavaScriptHelloWorld">
-
- <component name="ClientComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js"/>
- <reference name="delegate" target="DelegateComponent">
- <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.dynamic.HelloWorld" />
- </reference>
- </component>
-
- <component name="DelegateComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite
deleted file mode 100644
index 4e71a4a3e6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/JavaScriptHelloWorld.composite
+++ /dev/null
@@ -1,30 +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"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- name="JavaScriptHelloWorld">
-
- <component name="ClientComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js"/>
- <property name="greeter" type="xsd:string">Tuscany</property>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js
deleted file mode 100644
index beee72314d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworld.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function sayHello(s) {
- return "Hello " + s;
-}
-
-function sayHelloFrom(s) {
- return "Hello " + s + " from " + greeter;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js
deleted file mode 100644
index 69a2f2e639..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/dynamic/helloworldProxy.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function sayHello(s) {
- return delegate.sayHello(s);
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite
deleted file mode 100644
index ce377e4ed3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/GroovyHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="GroovyHelloWorld">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite
deleted file mode 100644
index 4d32ed9f6b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JRubyHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JRubyHelloWorld">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite
deleted file mode 100644
index 7ddf517b96..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScripInlineHelloWorld.composite
+++ /dev/null
@@ -1,34 +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="JavaScriptHelloWorld">
-
- <component name="ClientComponent">
- <tuscany:implementation.script language="js">
-
- function sayHello(s) {
- return "Hello " + s;
- }
-
- </tuscany:implementation.script>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
deleted file mode 100644
index 13cb94d511..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JavaScriptHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JavaScriptHelloWorld">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite
deleted file mode 100644
index c641b82cd6..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/JythonHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JythonHelloWorld">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType
deleted file mode 100644
index bb0ddd002f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.componentType
+++ /dev/null
@@ -1,30 +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"
- xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <service name="HelloWorldService">
- <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
- </service>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy
deleted file mode 100644
index 9f89bd373e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.groovy
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-def sayHello(s) {
- return "Hello " + s
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js
deleted file mode 100644
index eac2ab283f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function sayHello(s) {
-
- return "Hello " + s;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
deleted file mode 100644
index f5dd0f8fcf..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.py
+++ /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.
-#
-
-def sayHello(s):
- return 'Hello ' + s \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb
deleted file mode 100644
index cd2d3bcaea..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/helloworld/helloworld.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-def sayHello(s)
- return "Hello " + s
-end \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite
deleted file mode 100644
index 26574c6266..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/GroovyHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="GroovyProperties">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite
deleted file mode 100644
index a3551cefc3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JRubyHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JRubyProperties">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent" />
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite
deleted file mode 100644
index f72c6e922f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JavaScriptHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JavaScriptProperties">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite
deleted file mode 100644
index bd754c8d2e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/JythonHelloWorld.composite
+++ /dev/null
@@ -1,33 +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="JythonProperties">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.properties.HelloWorldProxy"/>
- <reference name="delegate" target="HelloWorldComponent"></reference>
- </component>
-
- <component name="HelloWorldComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
deleted file mode 100644
index 06f261015e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.componentType
+++ /dev/null
@@ -1,32 +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"
- xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
- <service name="HelloWorldService">
- <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
- </service>
-
- <property name="greeter" type="xsd:string">Tuscany</property>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy
deleted file mode 100644
index a7eb446d37..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.groovy
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-def sayHello(s) {
- return "Hello " + s + " from " + greeter
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js
deleted file mode 100644
index 64df3ebbef..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function sayHello(s) {
-
- return "Hello " + s + " from " + greeter;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
deleted file mode 100644
index 868cfa9eeb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.py
+++ /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.
-#
-
-def sayHello(s):
- return 'Hello ' + s + ' from ' + greeter \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb
deleted file mode 100644
index 2844f8b8d9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/properties/helloworld.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-def sayHello(s)
- return "Hello " + s + " from " + $greeter
-end \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
deleted file mode 100644
index 175bb79104..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/GroovyReference.composite
+++ /dev/null
@@ -1,38 +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="GroovyReference">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="ReferenceComponent"></reference>
- </component>
-
- <component name="ReferenceComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy"/>
- <reference name="ref" target="TargetComponent" />
- </component>
-
- <component name="TargetComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
deleted file mode 100644
index 7581b633cc..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JRubyReference.composite
+++ /dev/null
@@ -1,38 +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="JRubyReference">
-
- <component name="ClientComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
- <reference name="delegate" target="ReferenceComponent"></reference>
- </component>
-
- <component name="ReferenceComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.rb"/>
- <reference name="ref" target="TargetComponent" />
- </component>
-
- <component name="TargetComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
deleted file mode 100644
index 91085b9eb2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JavaScriptReference.composite
+++ /dev/null
@@ -1,38 +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"/>
- <reference name="delegate" target="ReferenceComponent"></reference>
- </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-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
deleted file mode 100644
index 535164aae7..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/JythonReference.composite
+++ /dev/null
@@ -1,38 +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"/>
- <reference name="delegate" target="ReferenceComponent"></reference>
- </component>
-
- <component name="ReferenceComponent">
- <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.py"/>
- <reference name="ref" target="TargetComponent" />
- </component>
-
- <component name="TargetComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.componentType
deleted file mode 100644
index 3edd075126..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.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" xmlns:wsdli="http://www.w3.org/2006/01/wsdl-instance">
-
- <service name="HelloWorldService">
- <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
- </service>
-
- <reference name="ref">
- <interface.java interface="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorld" />
- </reference>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
deleted file mode 100644
index 5d2216d583..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.groovy
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-def sayHello(s) {
- return ref.sayHello(s)
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js
deleted file mode 100644
index ad0a932d26..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-function sayHello(s) {
- return ref.sayHello(s);
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
deleted file mode 100644
index aee8bf991d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.py
+++ /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.
-#
-
-def sayHello(s):
- return ref.sayHello(s)
diff --git a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb b/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb
deleted file mode 100644
index 87f0f56082..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-script/src/test/resources/org/apache/tuscany/sca/implementation/script/itests/references/reference.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-def sayHello(s)
- return $ref.sayHello(s)
-end \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/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-java-1.5.1/modules/implementation-spring-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/README b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/README
deleted file mode 100644
index e1b1f98fe0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/README
+++ /dev/null
@@ -1,9 +0,0 @@
-Note that the implementation spring modules have a different structure from other extensions.
-
-The aim is to have the Tuscany runtime embedded in a container with the Tuscany classes hidden
-from user applications and the Spring jar's packaged with the application. That means that the
-Tuscany code has no visibilty of the Spring classes and visa-versa. To implement that the
-implementation-spring module has no dependencies on Spring and the implementation-spring-runtime
-module has no dependencies on Tuscany (other than the sca-api), and reflection is used to call
-methods between the modules.
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/pom.xml
deleted file mode 100644
index 693f362afd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/pom.xml
+++ /dev/null
@@ -1,90 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-spring-runtime</artifactId>
- <name>Apache Tuscany SCA Spring Implementation Runtime Model</name>
-
- <dependencies>
-
- <!-- **************************************** -->
- <!-- * * -->
- <!-- * DONT ADD ANY TUSCANY DEPENDENCIES!!! * -->
- <!-- * * -->
- <!-- * See the README for details why not * -->
- <!-- * * -->
- <!-- * * -->
- <!-- **************************************** -->
-
- <!-- SCA API dependency -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- Spring dependencies... -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>2.5.5</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>2.5.5</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>2.5.5</version>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.spring.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.spring*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/SCANamespaceHandlerResolver.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/SCANamespaceHandlerResolver.java
deleted file mode 100644
index 52f0260d11..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/SCANamespaceHandlerResolver.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.namespace;
-
-import org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver;
-import org.springframework.beans.factory.xml.NamespaceHandler;
-
-/**
- * Overrides the default Spring namespace resolver to automatically register
- * {@link ScaNamespaceHandler} instead of requiring a value to be supplied in a
- * Spring configuration
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SCANamespaceHandlerResolver extends DefaultNamespaceHandlerResolver {
- private static final String SCA_NAMESPACE = "http://www.springframework.org/schema/sca";
-
- private ScaNamespaceHandler handler;
-
- public SCANamespaceHandlerResolver(ClassLoader classLoader) {
- super(classLoader);
- handler = new ScaNamespaceHandler(/*componentType*/);
- }
-
- public SCANamespaceHandlerResolver(String handlerMappingsLocation, ClassLoader classLoader) {
- super(classLoader, handlerMappingsLocation);
- handler = new ScaNamespaceHandler(/*componentType*/);
- }
-
- @Override
- public NamespaceHandler resolve(String namespaceUri) {
- if (SCA_NAMESPACE.equals(namespaceUri)) {
- return handler;
- }
- return super.resolve(namespaceUri);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaNamespaceHandler.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaNamespaceHandler.java
deleted file mode 100644
index a3af64ed0d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaNamespaceHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tuscany.sca.implementation.spring.namespace;
-
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
-
-/**
- * Handler for the &lt;sca:&gt; namespace in an application context
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class ScaNamespaceHandler extends NamespaceHandlerSupport {
-
- public ScaNamespaceHandler() {
- init();
- }
-
- public final void init() {
- registerBeanDefinitionParser("reference", new ScaReferenceBeanDefinitionParser());
- registerBeanDefinitionParser("service", new ScaServiceBeanDefinitionParser());
- registerBeanDefinitionParser("property", new ScaPropertyBeanDefinitionParser());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaPropertyBeanDefinitionParser.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaPropertyBeanDefinitionParser.java
deleted file mode 100644
index ce17477fca..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaPropertyBeanDefinitionParser.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tuscany.sca.implementation.spring.namespace;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Element;
-
-/**
- * Parser for the &lt;sca:reference&gt; element
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class ScaPropertyBeanDefinitionParser implements BeanDefinitionParser {
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- // do nothing, this is handled by Tuscany
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaReferenceBeanDefinitionParser.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaReferenceBeanDefinitionParser.java
deleted file mode 100644
index eca6f50f26..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaReferenceBeanDefinitionParser.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tuscany.sca.implementation.spring.namespace;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Element;
-
-/**
- * Parser for the &lt;sca:reference&gt; element
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class ScaReferenceBeanDefinitionParser implements BeanDefinitionParser {
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- // do nothing, this is handled by Tuscany
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaServiceBeanDefinitionParser.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaServiceBeanDefinitionParser.java
deleted file mode 100644
index 0e98277e78..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/namespace/ScaServiceBeanDefinitionParser.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2002-2006 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.tuscany.sca.implementation.spring.namespace;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Element;
-
-/**
- * Parser for the &lt;sca:service/&gt; element
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class ScaServiceBeanDefinitionParser implements BeanDefinitionParser {
-
- public BeanDefinition parse(Element element, ParserContext parserContext) {
- // do nothing, handled by Tuscany
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentNameAnnotationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentNameAnnotationProcessor.java
deleted file mode 100644
index 1197647b15..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentNameAnnotationProcessor.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.processor;
-
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.ref.Reference;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.osoa.sca.annotations.ComponentName;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.util.Assert;
-import org.springframework.util.ReflectionUtils;
-
-public class ComponentNameAnnotationProcessor implements BeanPostProcessor {
-
- private Class<? extends Annotation> componentNameAnnotationType = ComponentName.class;
-
- private String componentName;
-
- public ComponentNameAnnotationProcessor (String componentName) {
- this.componentName = componentName;
- }
-
- /**
- * Gets componentName annotation type.
- */
- protected Class<? extends Annotation> getComponentNameAnnotationType() {
- return this.componentNameAnnotationType;
- }
-
- /**
- * Sets componentName annotation type.
- */
- public void setComponentNameAnnotationType(Class<? extends Annotation> componentNameAnnotationType) {
- Assert.notNull(componentNameAnnotationType, "'componentNameAnnotationType' type must not be null.");
- this.componentNameAnnotationType = componentNameAnnotationType;
- }
-
- /**
- * This method is used to execute before a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- processAnnotation(bean);
- return bean;
- }
-
- /**
- * This method is used to execute after a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- /**
- * <p>Processes a beans fields for injection if it has a {@link Reference} annotation.</p>
- */
- protected void processAnnotation(final Object bean) {
-
- final Class<?> clazz = bean.getClass();
-
- ReflectionUtils.doWithFields(clazz, new ReflectionUtils.FieldCallback() {
- public void doWith(Field field) {
- Annotation annotation = field.getAnnotation(getComponentNameAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(field.getModifiers())) {
- throw new IllegalStateException("ComponentName annotation is not supported on static fields");
- }
-
- if (Modifier.isPrivate(field.getModifiers())) {
- throw new IllegalStateException("ComponentName annotation is not supported on private fields");
- }
-
- ReflectionUtils.makeAccessible(field);
-
- if (field.getType().getName().equals("java.lang.String")) {
- Object nameObj = componentName;
- if (nameObj != null)
- ReflectionUtils.setField(field, bean, nameObj);
- } else {
- throw new IllegalStateException("ComponentName annotation is supported only on java.lang.String field type.");
- }
- }
- }
- });
-
- ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() {
- public void doWith(Method method) {
- Annotation annotation = method.getAnnotation(getComponentNameAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(method.getModifiers())) {
- throw new IllegalStateException("ComponentName annotation is not supported on static methods");
- }
-
- if (Modifier.isPrivate(method.getModifiers())) {
- throw new IllegalStateException("ComponentName annotation is not supported on private methods");
- }
-
- if (method.getParameterTypes().length == 0) {
- throw new IllegalStateException("ComponentName annotation requires at least one argument: " + method);
- }
-
- PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
-
- if (pd.getPropertyType().getName().equals("java.lang.String")) {
- Object nameObj = componentName;
- if (nameObj != null) {
- try {
- pd.getWriteMethod().invoke(bean, new Object[] { nameObj });
- } catch (Throwable e) {
- throw new FatalBeanException("Problem injecting reference: " + e.getMessage(), e);
- }
- }
- } else {
- throw new IllegalStateException("ComponentName annotation is supported only on java.lang.String field type.");
- }
- }
- }
- });
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentStub.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentStub.java
deleted file mode 100644
index 72db91327c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ComponentStub.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.processor;
-
-import java.lang.reflect.Method;
-
-/**
- * This is the Spring runtime side stub for the corresponding Tuscany tie class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the ComponentTie class
- * in the implementation-spring module for what the tie does.
- */
-public class ComponentStub {
-
- private Object tie;
- private Method getService;
-
- public ComponentStub(Object tie) {
- this.tie = tie;
- Class<?> tieClass = tie.getClass();
- try {
- getService = tieClass.getMethod("getService", new Class<?>[]{Class.class, String.class});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object getService(Class<?> type, String name) {
- try {
-
- return getService.invoke(tie, type, name);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ConstructorAnnotationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ConstructorAnnotationProcessor.java
deleted file mode 100644
index 9c1b7a0b3d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ConstructorAnnotationProcessor.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.implementation.spring.processor;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.config.InstantiationAwareBeanPostProcessorAdapter;
-import org.springframework.util.Assert;
-
-public class ConstructorAnnotationProcessor extends InstantiationAwareBeanPostProcessorAdapter {
-
- private Class<? extends Annotation> constructorAnnotationType
- = org.osoa.sca.annotations.Constructor.class;
-
- private Class<? extends Annotation> autowiredAnnotationType = Autowired.class;
-
- public ConstructorAnnotationProcessor () {
- // Default constructor.
- }
-
- /**
- * Set the 'autowired' annotation type, to be used on constructors, fields,
- * setter methods and arbitrary config methods.
- */
- public void setAutowiredAnnotationType(Class<? extends Annotation> autowiredAnnotationType) {
- Assert.notNull(autowiredAnnotationType, "'autowiredAnnotationType' must not be null");
- this.autowiredAnnotationType = autowiredAnnotationType;
- }
-
- /**
- * Return the 'autowired' annotation type.
- */
- protected Class<? extends Annotation> getAutowiredAnnotationType() {
- return this.autowiredAnnotationType;
- }
-
- /**
- * Return the 'constructor' annotation type.
- */
- protected Class<? extends Annotation> getConstructorAnnotationType() {
- return this.constructorAnnotationType;
- }
-
- /**
- * Sets the 'constructor' annotation type.
- */
- public void setConstructorAnnotationType(Class<? extends Annotation> constructorAnnotationType) {
- Assert.notNull(constructorAnnotationType, "'constructorAnnotationType' type must not be null.");
- this.constructorAnnotationType = constructorAnnotationType;
- }
-
- /**
- * This method is used to execute before a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- /**
- * This method is used to execute after a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- public Constructor[] determineCandidateConstructors(Class beanClass, String beanName) throws BeansException {
- /*Constructor[] declaredConstructors = beanClass.getDeclaredConstructors();
- Method[] declaredMethods = beanClass.getDeclaredMethods();
- List candidates = new ArrayList(declaredConstructors.length);
-
- for (int i = 0; i < declaredMethods.length; i++) {
- Method method = declaredMethods[i];
- Annotation annotation = method.getAnnotation(getConstructorAnnotationType());
- if (annotation != null) {
- if (Modifier.isStatic(method.getModifiers())) {
- throw new IllegalStateException("Constructor annotation is not supported on static methods");
- }
-
- if (candidates.size() == 1) {
- throw new IllegalStateException("Only one method is allowed to have constructor annotation in a bean: " + method);
- }
-
- candidates.add(method);
- }
- }
-
- return (Constructor[]) candidates.toArray(new Constructor[candidates.size()]);*/
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/InitDestroyAnnotationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/InitDestroyAnnotationProcessor.java
deleted file mode 100644
index 0368f27caf..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/InitDestroyAnnotationProcessor.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.processor;
-
-import java.lang.annotation.Annotation;
-
-import org.osoa.sca.annotations.Destroy;
-import org.osoa.sca.annotations.Init;
-import org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor;
-
-public class InitDestroyAnnotationProcessor extends InitDestroyAnnotationBeanPostProcessor {
-
- private static final long serialVersionUID = 0;
-
- private Class<? extends Annotation> initAnnotationType = Init.class;
- private Class<? extends Annotation> destroyAnnotationType = Destroy.class;
-
- /**
- * Gets init annotation type.
- */
- protected Class<? extends Annotation> getInitAnnotationType() {
- return this.initAnnotationType;
- }
-
- /**
- * Sets init annotation type.
- */
- /*
- * public void setInitAnnotationType(Class<? extends Annotation>
- * initAnnotationType) { Assert.notNull(initAnnotationType,
- * "Init annotation type must not be null."); this.initAnnotationType =
- * initAnnotationType; }
- */
-
- /**
- * Gets destroy annotation type.
- */
- protected Class<? extends Annotation> getDestroyAnnotationType() {
- return this.destroyAnnotationType;
- }
-
- /**
- * Sets destroy annotation type.
- */
- /*
- * public void setDestroyAnnotationType(Class<? extends Annotation>
- * destroyAnnotationType) { Assert.notNull(destroyAnnotationType,
- * "Destroy annotation type must not be null."); this.destroyAnnotationType
- * = destroyAnnotationType; }
- */
-
- public InitDestroyAnnotationProcessor() {
- // Set the @Init annotation type
- setInitAnnotationType(initAnnotationType);
-
- // Set the @Destroy annotation type
- setDestroyAnnotationType(destroyAnnotationType);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java
deleted file mode 100644
index 5ddcf1ff51..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyAnnotationProcessor.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.processor;
-
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.osoa.sca.annotations.Property;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.util.Assert;
-import org.springframework.util.ReflectionUtils;
-
-public class PropertyAnnotationProcessor implements BeanPostProcessor {
-
- private Class<? extends Annotation> propertyAnnotationType = Property.class;
-
- private PropertyValueStub propertyValue;
-
- public PropertyAnnotationProcessor (PropertyValueStub propertyValue) {
- this.propertyValue = propertyValue;
- }
-
- /**
- * Gets property annotation type.
- */
- protected Class<? extends Annotation> getPropertyAnnotationType() {
- return this.propertyAnnotationType;
- }
-
- /**
- * Sets property annotation type.
- */
- public void setPropertyAnnotationType(Class<? extends Annotation> propertyAnnotationType) {
- Assert.notNull(propertyAnnotationType, "'propertyAnnotationType' type must not be null.");
- this.propertyAnnotationType = propertyAnnotationType;
- }
-
- /**
- * This method is used to execute before a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- processAnnotation(bean);
- return bean;
- }
-
- /**
- * This method is used to execute after a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- /**
- * <p>Processes a beans fields for injection if it has a {@link Property} annotation.</p>
- */
- protected void processAnnotation(final Object bean) {
-
- final Class<?> clazz = bean.getClass();
-
- ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() {
- public void doWith(Method method) {
-
- Property annotation = (Property) method.getAnnotation(getPropertyAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(method.getModifiers())) {
- throw new IllegalStateException("Property annotation is not supported on static methods");
- }
-
- if (Modifier.isPrivate(method.getModifiers())) {
- throw new IllegalStateException("Property annotation is not supported on private methods");
- }
-
- if (method.getParameterTypes().length == 0) {
- throw new IllegalStateException("Property annotation requires at least one argument: " + method);
- }
-
- PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
- if (pd != null) {
- String propName = annotation.name();
- if ("".equals(propName)) {
- injectProperty(bean, pd, propertyValue.getPropertyObj(pd.getPropertyType(), pd.getName()));
- } else {
- injectProperty(bean, pd, propertyValue.getPropertyObj(pd.getPropertyType(), propName));
- }
- }
- }
- }
- });
-
- ReflectionUtils.doWithFields(clazz, new ReflectionUtils.FieldCallback() {
- public void doWith(Field field) {
-
- Property annotation = (Property) field.getAnnotation(getPropertyAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(field.getModifiers())) {
- throw new IllegalStateException("Property annotation is not supported on static fields");
- }
-
- if (Modifier.isPrivate(field.getModifiers())) {
- throw new IllegalStateException("Property annotation is not supported on private fields");
- }
-
- ReflectionUtils.makeAccessible(field);
-
- Object propertyObj = null;
- String propName = annotation.name();
- if ("".equals(propName)) {
- propertyObj = propertyValue.getPropertyObj(field.getType(), field.getName());
- } else {
- propertyObj = propertyValue.getPropertyObj(field.getType(), propName);
- }
-
- if (propertyObj != null)
- ReflectionUtils.setField(field, bean, propertyObj);
- }
- }
- });
- }
-
- public void injectProperty(Object bean, PropertyDescriptor pd, Object propertyObj) {
-
- if (propertyObj != null) {
- try {
- pd.getWriteMethod().invoke(bean, new Object[] { propertyObj });
- } catch (Throwable e) {
- throw new FatalBeanException("Problem injecting property: " + e.getMessage(), e);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyValueStub.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyValueStub.java
deleted file mode 100644
index bc222e622c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/PropertyValueStub.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.implementation.spring.processor;
-
-import java.lang.reflect.Method;
-
-/**
- * This is the Spring runtime side stub for the corresponding Tuscany tie class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the PropertyValueTie class
- * in the implementation-spring module for what the tie does.
- */
-public class PropertyValueStub {
-
- private Object tie;
- private Method getPropertyObj;
-
- public PropertyValueStub(Object tie) {
- this.tie = tie;
- Class<?> tieClass = tie.getClass();
- try {
- getPropertyObj = tieClass.getMethod("getPropertyObj", new Class<?>[]{Class.class, String.class});
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object getPropertyObj(Class<?> propertyType, String name) {
- try {
-
- return getPropertyObj.invoke(tie, propertyType, name);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java
deleted file mode 100644
index 79095f2217..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/processor/ReferenceAnnotationProcessor.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.processor;
-
-import java.beans.PropertyDescriptor;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-import org.osoa.sca.annotations.Reference;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.FatalBeanException;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.util.Assert;
-import org.springframework.util.ReflectionUtils;
-
-public class ReferenceAnnotationProcessor implements BeanPostProcessor {
-
- private Class<? extends Annotation> referenceAnnotationType = Reference.class;
- private ComponentStub component;
-
- public ReferenceAnnotationProcessor (ComponentStub component) {
- this.component = component;
- }
-
- /**
- * Gets referece annotation type.
- */
- protected Class<? extends Annotation> getReferenceAnnotationType() {
- return this.referenceAnnotationType;
- }
-
- /**
- * Sets referece annotation type.
- */
- public void setReferenceAnnotationType(Class<? extends Annotation> referenceAnnotationType) {
- Assert.notNull(referenceAnnotationType, "'referenceAnnotationType' type must not be null.");
- this.referenceAnnotationType = referenceAnnotationType;
- }
-
- /**
- * This method is used to execute before a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessBeforeInitialization(Object bean, String beanName)
- throws BeansException {
- processAnnotation(bean);
- return bean;
- }
-
- /**
- * This method is used to execute after a bean's initialization callback.
- *
- * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
- */
- public Object postProcessAfterInitialization(Object bean, String beanName)
- throws BeansException {
- return bean;
- }
-
- /**
- * <p>Processes a beans fields for injection if it has a {@link Reference} annotation.</p>
- */
- protected void processAnnotation(final Object bean) {
-
- final Class<?> clazz = bean.getClass();
-
- ReflectionUtils.doWithMethods(clazz, new ReflectionUtils.MethodCallback() {
- public void doWith(Method method) {
-
- Reference annotation = (Reference) method.getAnnotation(getReferenceAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(method.getModifiers())) {
- throw new IllegalStateException("Reference annotation is not supported on static methods");
- }
-
- if (Modifier.isPrivate(method.getModifiers())) {
- throw new IllegalStateException("Reference annotation is not supported on private methods");
- }
-
- if (method.getParameterTypes().length == 0) {
- throw new IllegalStateException("Reference annotation requires at least one argument: " + method);
- }
-
- PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method);
- if (pd != null) {
- String refName = annotation.name();
- if ("".equals(refName)) {
- injectReference(bean, pd, pd.getName());
- } else {
- injectReference(bean, pd, refName);
- }
- }
- }
- }
- });
-
- ReflectionUtils.doWithFields(clazz, new ReflectionUtils.FieldCallback() {
- public void doWith(Field field) {
-
- Reference annotation = (Reference) field.getAnnotation(getReferenceAnnotationType());
-
- if (annotation != null) {
- if (Modifier.isStatic(field.getModifiers())) {
- throw new IllegalStateException("Reference annotation is not supported on static fields");
- }
-
- if (Modifier.isPrivate(field.getModifiers())) {
- throw new IllegalStateException("Reference annotation is not supported on private fields");
- }
-
- ReflectionUtils.makeAccessible(field);
-
- Object referenceObj = null;
- String refName = annotation.name();
- if ("".equals(refName)) {
- referenceObj = component.getService(field.getType(), field.getName());
- } else {
- referenceObj = component.getService(field.getType(), refName);
- }
-
- if (referenceObj != null)
- ReflectionUtils.setField(field, bean, referenceObj);
- }
- }
- });
- }
-
- /**
- * Processes a property descriptor to inject a service.
- */
- public void injectReference(Object bean, PropertyDescriptor pd, String name) {
-
- Object referenceObj = component.getService(pd.getPropertyType(), name);
-
- if (referenceObj != null) {
- try {
- pd.getWriteMethod().invoke(bean, new Object[] { referenceObj });
- } catch (Throwable e) {
- throw new FatalBeanException("Problem injecting reference: " + e.getMessage(), e);
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
deleted file mode 100644
index b93874a9f3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SCAParentApplicationContext.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.runtime.context;
-
-import java.io.IOException;
-import java.util.Locale;
-import java.util.Map;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.BeanFactory;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationEvent;
-import org.springframework.context.MessageSourceResolvable;
-import org.springframework.context.NoSuchMessageException;
-import org.springframework.core.io.Resource;
-
-/**
- * A Spring ParentApplicationContext for a given Spring Implementation
- *
- * The Parent application context is responsible for handling those entities within a Spring
- * application context that actually belong to SCA rather than to Spring. The principal things
- * are Properties and References. These may be present either through explicit <sca:property/>
- * and <sca:reference/> elements in the application context or they may be implicit through
- * unresolved Spring bean <property.../> elements. In either case, it is the Parent application
- * context that must provide Spring beans that correspond to the property or reference, as derived
- * from the SCA composite in which the Spring application context is an implementation.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-class SCAParentApplicationContext implements ApplicationContext {
-
- // The Spring implementation for which this is the parent application context
- private SpringImplementationStub implementation;
-
- private static final String[] EMPTY_ARRAY = new String[0];
-
- public SCAParentApplicationContext(SpringImplementationStub implementation) {
- this.implementation = implementation;
- } // end constructor
-
- public Object getBean(String name) throws BeansException {
- return getBean(name, (Class) null);
- }
-
- /**
- * Get a Bean for a reference or for a property.
- *
- * @param name - the name of the Bean required
- * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
- * @return Object - a Bean which matches the requested bean
- */
- public Object getBean(String name, Class requiredType) throws BeansException {
- return implementation.getBean(name, requiredType);
- } // end method getBean( String, Class )
-
- public Object getBean(String name, Object[] args) throws BeansException {
- return getBean(name, ((Class)null));
- }
-
- public boolean containsBean(String name) {
- // TODO
- System.out.println("Spring parent context - containsBean called for name: " + name);
- return false;
- }
-
- public boolean isSingleton(String name) throws NoSuchBeanDefinitionException {
- // TODO
- return false;
- }
-
- public boolean isTypeMatch(String name, Class targetType) throws NoSuchBeanDefinitionException {
- throw new UnsupportedOperationException();
- }
-
- public Class getType(String name) throws NoSuchBeanDefinitionException {
- return null;
- }
-
- public String[] getAliases(String name) throws NoSuchBeanDefinitionException {
- return EMPTY_ARRAY;
- }
-
- public ApplicationContext getParent() {
- return null;
- }
-
- public AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException {
- return null;
- }
-
- public String getId() {
- return this.toString();
- }
-
- public String getDisplayName() {
- return implementation.getURI();
- }
-
- public long getStartupDate() {
- return 0;
- }
-
- public boolean containsBeanDefinition(String beanName) {
- return false;
- }
-
- public int getBeanDefinitionCount() {
- return 0;
- }
-
- public String[] getBeanDefinitionNames() {
- return new String[0];
- }
-
- public String[] getBeanNamesForType(Class type) {
- return new String[0];
- }
-
- public String[] getBeanNamesForType(Class type, boolean includePrototypes, boolean includeFactoryBeans) {
- return new String[0];
- }
-
- public Map getBeansOfType(Class type) throws BeansException {
- return null;
- }
-
- public Map getBeansOfType(Class type, boolean includePrototypes, boolean includeFactoryBeans) throws BeansException {
- return null;
- }
-
- public boolean isPrototype(String theString) {
- return false;
- }
-
- public BeanFactory getParentBeanFactory() {
- return null;
- }
-
- public boolean containsLocalBean(String name) {
- return false;
- }
-
- public String getMessage(String code, Object[] args, String defaultMessage, Locale locale) {
- return null;
- }
-
- public String getMessage(String code, Object[] args, Locale locale) throws NoSuchMessageException {
- return null;
- }
-
- public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException {
- return null;
- }
-
- public void publishEvent(ApplicationEvent event) {
-
- }
-
- public Resource[] getResources(String locationPattern) throws IOException {
- return new Resource[0];
- }
-
- public Resource getResource(String location) {
- return null;
- }
-
- public ClassLoader getClassLoader() {
- // REVIEW: this is almost certainly flawed, but it's not clear how the SCA runtime's
- // resource loading mechanism is exposed right now.
- return this.getClass().getClassLoader();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
deleted file mode 100644
index 6e8f1e8df4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringContextTie.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.runtime.context;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tuscany.sca.implementation.spring.processor.ComponentNameAnnotationProcessor;
-import org.apache.tuscany.sca.implementation.spring.processor.ComponentStub;
-import org.apache.tuscany.sca.implementation.spring.processor.ConstructorAnnotationProcessor;
-import org.apache.tuscany.sca.implementation.spring.processor.InitDestroyAnnotationProcessor;
-import org.apache.tuscany.sca.implementation.spring.processor.PropertyAnnotationProcessor;
-import org.apache.tuscany.sca.implementation.spring.processor.PropertyValueStub;
-import org.apache.tuscany.sca.implementation.spring.processor.ReferenceAnnotationProcessor;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.beans.factory.config.ConstructorArgumentValues;
-import org.springframework.beans.factory.config.TypedStringValue;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.ManagedList;
-import org.springframework.beans.factory.xml.XmlBeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.AbstractApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-import org.springframework.context.support.GenericApplicationContext;
-import org.springframework.core.io.UrlResource;
-import org.springframework.core.SpringVersion;
-
-/**
- * This is the runtime side tie for the corresponding tuscany side stub class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the SpringContextStub class
- * in the implementation-spring module for what the stub does.
- */
-public class SpringContextTie {
-
- private AbstractApplicationContext springContext;
- private SpringImplementationStub implementation;
- private boolean isAnnotationSupported;
- private String versionSupported;
- private boolean isMultipleContextSupport;
-
- // TUSCANY-3128
- // extension of the generic application context just to force the classloader
- // on the bean factory to stay set to the contribution classloader
- // instead of being set back to the application classloader
- private class LocalGenericApplicationContext extends GenericApplicationContext{
-
- ClassLoader classloader = null;
-
- public LocalGenericApplicationContext(DefaultListableBeanFactory beanFactory,
- ApplicationContext parent,
- ClassLoader classloader) {
- super(beanFactory, parent);
- this.classloader = classloader;
- }
-
- @Override
- protected void postProcessBeanFactory(
- ConfigurableListableBeanFactory beanFactory) {
- beanFactory.setBeanClassLoader(classloader);
- }
- }
-
- public SpringContextTie(SpringImplementationStub implementation, URL resource, boolean annotationSupport, String versionSupported, boolean multipleContextSupport) throws Exception {
- this.implementation = implementation;
- this.isAnnotationSupported = annotationSupport;
- this.versionSupported = versionSupported;
- this.isMultipleContextSupport = multipleContextSupport;
- if (! this.versionSupported.equals("ANY")) {
- if ((SpringVersion.getVersion()!= null) && (! SpringVersion.getVersion().equals(versionSupported)))
- throw new RuntimeException("Unsupported version: Use only Spring Framework Version " + versionSupported);
- }
- SCAParentApplicationContext scaParentContext = new SCAParentApplicationContext(implementation);
- springContext = createApplicationContext(scaParentContext, resource);
- }
-
- public void start() {
- // Do refresh here to ensure that Spring Beans are not touched before
- // the SCA config process is complete...
- springContext.refresh();
- springContext.start();
- }
-
- public void close() {
- springContext.close();
- if (springContext instanceof GenericApplicationContext) {
- springContext.stop();
- }
- }
-
- /**
- * Create appropriate ApplicationContext by reading the bean definitions.
- */
- private AbstractApplicationContext createApplicationContext(SCAParentApplicationContext scaParentContext, URL resource) {
-
- XmlBeanFactory beanFactory = new XmlBeanFactory(new UrlResource(resource));
- beanFactory.setBeanClassLoader(implementation.getClassLoader());
- AbstractApplicationContext appContext = null;
-
- if (isMultipleContextSupport) {
- for (String bean : beanFactory.getBeanDefinitionNames()) {
- String beanClassName = (beanFactory.getType(bean)).getName();
- // Using FileSystemXmlApplicationContext is not supported, as the
- // SCA runtime does not support paths relative to current VM working directory.
- /*if (beanClassName.indexOf(".FileSystemXmlApplicationContext") != -1) {
- throw new RuntimeException("Usage of FileSystemXmlApplicationContext Bean is not supported");
- }*/
-
- if (beanClassName.indexOf(".ClassPathXmlApplicationContext") != -1) {
- BeanDefinition beanDef = beanFactory.getBeanDefinition(bean);
- String[] configLocations = null;
- List<ConstructorArgumentValues.ValueHolder> conArgs =
- beanDef.getConstructorArgumentValues().getGenericArgumentValues();
- for (ConstructorArgumentValues.ValueHolder conArg : conArgs) {
- if (conArg.getValue() instanceof TypedStringValue) {
- TypedStringValue value = (TypedStringValue) conArg.getValue();
- if (value.getValue().indexOf(".xml") != -1)
- configLocations = new String[]{value.getValue()};
- }
- if (conArg.getValue() instanceof ManagedList) {
- Iterator itml = ((ManagedList)conArg.getValue()).iterator();
- StringBuffer values = new StringBuffer();
- while (itml.hasNext()) {
- TypedStringValue next = (TypedStringValue)itml.next();
- if (next.getValue().indexOf(".xml") != -1) {
- values.append(implementation.getClassLoader().getResource(next.getValue()).toString());
- values.append("~");
- }
- }
- configLocations = (values.toString()).split("~");
- }
- }
-
- appContext = new ClassPathXmlApplicationContext(configLocations, true, scaParentContext);
- if (isAnnotationSupported)
- includeAnnotationProcessors(appContext.getBeanFactory());
- return appContext;
- }
- }
- }
-
- // use the generic application context as default
- if (isAnnotationSupported)
- {
- includeAnnotationProcessors(beanFactory);
- }
-
- appContext = new LocalGenericApplicationContext(beanFactory,
- scaParentContext,
- implementation.getClassLoader());
- return appContext;
- }
-
- public Object getBean(String id) throws BeansException {
- return springContext.getBean(id);
- }
-
- /**
- * Include BeanPostProcessor to deal with SCA Annotations in Spring Bean
- */
- private void includeAnnotationProcessors(ConfigurableListableBeanFactory beanFactory) {
-
- // Processor to deal with @Init and @Destroy SCA Annotations
- BeanPostProcessor initDestroyProcessor = new InitDestroyAnnotationProcessor();
- beanFactory.addBeanPostProcessor(initDestroyProcessor);
-
- // Processor to deal with @Reference SCA Annotations
- ComponentStub component = new ComponentStub(implementation.getComponentTie());
- BeanPostProcessor referenceProcessor = new ReferenceAnnotationProcessor(component);
- beanFactory.addBeanPostProcessor(referenceProcessor);
-
- // Processor to deal with @Property SCA Annotations
- PropertyValueStub pvs = new PropertyValueStub(implementation.getPropertyValueTie());
- BeanPostProcessor propertyProcessor = new PropertyAnnotationProcessor(pvs);
- beanFactory.addBeanPostProcessor(propertyProcessor);
-
- // Processor to deal with @ComponentName SCA Annotations
- BeanPostProcessor componentNameProcessor = new ComponentNameAnnotationProcessor(implementation.getComponentName());
- beanFactory.addBeanPostProcessor(componentNameProcessor);
-
- // Processor to deal with @Constructor SCA Annotations
- BeanPostProcessor constructorProcessor = new ConstructorAnnotationProcessor();
- beanFactory.addBeanPostProcessor(constructorProcessor);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
deleted file mode 100644
index b123be8b5c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/java/org/apache/tuscany/sca/implementation/spring/runtime/context/SpringImplementationStub.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.runtime.context;
-
-import java.lang.reflect.Method;
-
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-
-/**
- * This is the runtime side stub for the corresponding Tuscany-side stub class.
- * It enables the Spring code in the runtime module to invoke methods on a
- * Tuscany SpringImplementation without the Spring runtime module
- * needing to know about any Tuscany classes. See the SpringImplementationTie class
- * in the implementation-spring module for what the tie does.
- */
-public class SpringImplementationStub {
-
- Object tie;
- Method getURI;
- Method getBean;
- Method getComponentName;
- Method getComponentTie;
- Method getPropertyValueTie;
- Method getClassLoader;
-
- public SpringImplementationStub(Object tie) {
- this.tie = tie;
- Class<?> tieClass = tie.getClass();
- try {
- getURI = tieClass.getMethod("getURI", new Class<?>[]{});
- getBean = tieClass.getMethod("getBean", new Class<?>[]{String.class, Class.class});
- getComponentName = tieClass.getMethod("getComponentName");
- getComponentTie = tieClass.getMethod("getComponentTie");
- getPropertyValueTie = tieClass.getMethod("getPropertyValueTie");
- getClassLoader = tieClass.getMethod("getClassLoader");
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public String getURI() {
- try {
-
- return (String)getURI.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Get a Bean for a reference or for a property.
- *
- * @param name - the name of the Bean required
- * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
- * @return Object - a Bean which matches the requested bean
- */
- public Object getBean(String name, Class<?> requiredType) throws BeansException {
- try {
-
- Object bean = getBean.invoke(tie, new Object[] {name, requiredType});
- if (bean == null) {
- throw new NoSuchBeanDefinitionException("Unable to find Bean with name " + name);
- }
- return bean;
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public String getComponentName() {
- try {
-
- return (String)getComponentName.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object getComponentTie() {
- try {
-
- return getComponentTie.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public Object getPropertyValueTie() {
- try {
-
- return getPropertyValueTie.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- public ClassLoader getClassLoader() {
- try {
-
- return (ClassLoader) getClassLoader.invoke(tie);
-
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.handlers b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index 6d29e21024..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1 +0,0 @@
-http\://www.springframework.org/schema/sca=org.apache.tuscany.sca.implementation.spring.namespace.ScaNamespaceHandler
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.schemas b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.schemas
deleted file mode 100644
index 249cc21c13..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/META-INF/spring.schemas
+++ /dev/null
@@ -1 +0,0 @@
-http\://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd=org/springframework/sca/xml/spring-sca.xsd
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/spring-sca.xsd b/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
deleted file mode 100644
index 3ac14e3e58..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring-runtime/src/main/resources/org/springframework/sca/xml/spring-sca.xsd
+++ /dev/null
@@ -1,84 +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.
--->
-<xsd:schema xmlns="http://www.springframework.org/schema/sca" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- attributeFormDefault="unqualified" elementFormDefault="qualified"
- targetNamespace="http://www.springframework.org/schema/sca">
-
- <xsd:element name="reference">
- <xsd:complexType>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="default" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="property">
- <xsd:complexType>
- <xsd:attribute name="id" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="service">
- <xsd:complexType>
- <xsd:attribute name="name" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="type" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- <xsd:attribute name="target" use="required">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string" />
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/LICENSE b/branches/sca-java-1.5.1/modules/implementation-spring/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/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-java-1.5.1/modules/implementation-spring/NOTICE b/branches/sca-java-1.5.1/modules/implementation-spring/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/README b/branches/sca-java-1.5.1/modules/implementation-spring/README
deleted file mode 100644
index e1b1f98fe0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/README
+++ /dev/null
@@ -1,9 +0,0 @@
-Note that the implementation spring modules have a different structure from other extensions.
-
-The aim is to have the Tuscany runtime embedded in a container with the Tuscany classes hidden
-from user applications and the Spring jar's packaged with the application. That means that the
-Tuscany code has no visibilty of the Spring classes and visa-versa. To implement that the
-implementation-spring module has no dependencies on Spring and the implementation-spring-runtime
-module has no dependencies on Tuscany (other than the sca-api), and reflection is used to call
-methods between the modules.
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/pom.xml b/branches/sca-java-1.5.1/modules/implementation-spring/pom.xml
deleted file mode 100644
index bf9f1c354b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/pom.xml
+++ /dev/null
@@ -1,109 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-implementation-spring</artifactId>
- <name>Apache Tuscany SCA Spring Framework Implementation Extension</name>
-
- <dependencies>
- <!-- **************************************** -->
- <!-- * * -->
- <!-- * DONT ADD ANY SPRING DEPENDENCIES!!! * -->
- <!-- * * -->
- <!-- * See the README for details why not * -->
- <!-- * * -->
- <!-- * * -->
- <!-- **************************************** -->
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.spring</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.spring*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanElement.java
deleted file mode 100644
index 86902e5104..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringBeanElement.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a <bean> element in a Spring application-context
- * - this has id and className attributes
- * - plus zero or more property elements as children
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringBeanElement {
-
- private String id;
- private String className;
- private boolean innerBean = false;
- private List<SpringPropertyElement> properties = new ArrayList<SpringPropertyElement>();
- private List<SpringConstructorArgElement> constructorargs = new ArrayList<SpringConstructorArgElement>();
-
- public SpringBeanElement(String id, String className) {
- this.id = id;
- this.className = className;
- }
-
- public String getClassName() {
- return className;
- }
-
- public String getId() {
- return id;
- }
-
- public List<SpringPropertyElement> getProperties() {
- return properties;
- }
-
- public void addProperty(SpringPropertyElement property) {
- properties.add(property);
- }
-
- public List<SpringConstructorArgElement> getCustructorArgs() {
- return constructorargs;
- }
-
- public void addCustructorArgs(SpringConstructorArgElement args) {
- constructorargs.add(args);
- }
-
- public boolean isInnerBean() {
- return innerBean;
- }
-
- public void setInnerBean(boolean innerBean) {
- this.innerBean = innerBean;
- }
-
-} // end class SpringBeanElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringConstructorArgElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringConstructorArgElement.java
deleted file mode 100644
index b644a69c15..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringConstructorArgElement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a <constructor-arg> element in a Spring application-context
- * - this has ref attribute
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringConstructorArgElement {
-
- private String ref;
- private String type;
- private int autoIndex = -1;
- private int index = -1;
- private List<String> values = new ArrayList<String>();
-
- public SpringConstructorArgElement(String ref, String type) {
- this.ref = ref;
- this.type = type;
- }
-
- public String getType() {
- return this.type;
- }
-
- public String getRef() {
- return this.ref;
- }
-
- public void setRef(String ref) {
- this.ref = ref;
- }
-
- public int getIndex() {
- return this.index;
- }
-
- public void setIndex(int index) {
- this.index = index;
- }
-
- public int getAutoIndex() {
- return this.autoIndex;
- }
-
- public void setAutoIndex(int index) {
- this.autoIndex = index;
- }
-
- public List<String> getValues() {
- return this.values;
- }
-
- public void addValue(String value) {
- this.values.add(value);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
deleted file mode 100644
index bee0e462fc..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementation.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-import java.net.URL;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.assembly.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Represents a Spring implementation.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringImplementation extends ImplementationImpl implements Implementation, ComponentPreProcessor, Extensible {
-
- // The location attribute which points to the Spring application-context XML file
- private String location;
- // The application-context file as a Spring Resource
- private URL resource;
- private ComponentType componentType;
- // Mapping of Services to Beans
- private Hashtable<String, SpringBeanElement> serviceMap;
- // Mapping of property names to Java class
- private Hashtable<String, Class> propertyMap;
- // List of unresolved bean property references
- private Hashtable<String, Reference> unresolvedBeanRef;
-
- private ClassLoader classLoader;
-
- public SpringImplementation() {
- this.location = null;
- this.resource = null;
- setUnresolved(true);
- serviceMap = new Hashtable<String, SpringBeanElement>();
- propertyMap = new Hashtable<String, Class>();
- unresolvedBeanRef = new Hashtable<String, Reference>();
- } // end method SpringImplementation
-
- /* Returns the location attribute for this Spring implementation */
- public String getLocation() {
- return location;
- }
-
- /**
- * Sets the location attribute for this Spring implementation
- * location - a URI to the Spring application-context file
- */
- public void setLocation(String location) {
- this.location = location;
- return;
- }
-
- public void setResource(URL resource) {
- this.resource = resource;
- }
-
- public URL getResource() {
- return resource;
- }
-
- /*
- * Returns the componentType for this Spring implementation
- */
- public ComponentType getComponentType() {
- return componentType;
- }
-
- /*
- * Sets the componentType for this Spring implementation
- */
- public void setComponentType(ComponentType componentType) {
- this.componentType = componentType;
- }
-
- @Override
- public List<Service> getServices() {
- return componentType.getServices();
- }
-
- @Override
- public List<Reference> getReferences() {
- return componentType.getReferences();
- }
-
- @Override
- public List<Property> getProperties() {
- return componentType.getProperties();
- }
-
- /**
- * Returns the Spring Bean which implements a particular service
- * @param service the service
- * @return the bean which implements the service, as a SpringBeanElement
- */
- public SpringBeanElement getBeanFromService(Service service) {
- SpringBeanElement theBean = serviceMap.get(service.getName());
- return theBean;
- }
-
- /**
- * Sets the mapping from a service to the Spring Bean that implements the service
- * @param service the service
- * @param theBean a SpringBeanElement for the Bean implementing the service
- */
- public void setBeanForService(Service service, SpringBeanElement theBean) {
- serviceMap.put(service.getName(), theBean);
- }
-
- /**
- * Add a mapping from a SCA property name to a Java class for the property
- * @param propertyName
- * @param propertyClass
- */
- public void setPropertyClass(String propertyName, Class propertyClass) {
- if (propertyName == null || propertyClass == null)
- return;
- propertyMap.put(propertyName, propertyClass);
- return;
- } // end method setPropertyClass
-
- /**
- * Gets the Java Class for an SCA property
- * @param propertyName - the property name
- * @return - a Class object for the type of the property
- */
- public Class getPropertyClass(String propertyName) {
- return propertyMap.get(propertyName);
- } // end method getPropertyClass
-
- public void setUnresolvedBeanRef(String refName, Reference reference) {
- if (refName == null || reference == null)
- return;
- unresolvedBeanRef.put(refName, reference);
- return;
- } // end method setUnresolvedBeanRef
-
- public Reference getUnresolvedBeanRef(String refName) {
- return unresolvedBeanRef.get(refName);
- } // end method getUnresolvedBeanRef
-
-
- /**
- * Use preProcess to validate and map the references and properties dynamically
- */
- public void preProcess(Component component) {
- if (!(component instanceof RuntimeComponent))
- return;
-
- RuntimeComponent rtc = (RuntimeComponent) component;
-
- for (Reference reference : rtc.getReferences()) {
- if (unresolvedBeanRef.containsKey(reference.getName())) {
- Reference ref = unresolvedBeanRef.get(reference.getName());
- componentType.getReferences().add(
- createReference(reference, ref.getInterfaceContract()));
- unresolvedBeanRef.remove(reference.getName());
- }
- }
-
- for (Property property : rtc.getProperties()) {
- if (unresolvedBeanRef.containsKey(property.getName())) {
- componentType.getProperties().add(createProperty(property));
- this.setPropertyClass(property.getName(), property.getClass());
- unresolvedBeanRef.remove(property.getName());
- }
- }
- }
-
- protected Reference createReference(Reference reference, InterfaceContract interfaze) {
- Reference newReference;
- try {
- newReference = (Reference)reference.clone();
- if (newReference.getInterfaceContract() == null)
- newReference.setInterfaceContract(interfaze);
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newReference;
- }
-
- protected Property createProperty(Property property) {
- Property newProperty;
- try {
- newProperty = (Property)property.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newProperty;
- }
-
- public ClassLoader getClassLoader() {
- return classLoader;
- }
-
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationConstants.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationConstants.java
deleted file mode 100644
index 339e753c04..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringImplementationConstants.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring;
-
-import javax.xml.namespace.QName;
-
-/**
- * Constants used in Spring Application Context XML files.
- */
-public interface SpringImplementationConstants {
-
- String SCA_NS = "http://www.springframework.org/schema/sca";
- String SPRING_NS = "http://www.springframework.org/schema/beans";
-
- String PROPERTY = "property";
- QName SCAPROPERTY_ELEMENT = new QName(SCA_NS, PROPERTY);
- QName PROPERTY_ELEMENT = new QName(SPRING_NS, PROPERTY);
-
- String SERVICE = "service";
- QName SERVICE_ELEMENT = new QName(SCA_NS, SERVICE);
-
- String REFERENCE = "reference";
- QName REFERENCE_ELEMENT = new QName(SCA_NS, REFERENCE);
-
- String BEANS = "beans";
- QName BEANS_ELEMENT = new QName(SPRING_NS, BEANS);
-
- String IMPORT = "import";
- QName IMPORT_ELEMENT = new QName(SPRING_NS, IMPORT);
-
- String BEAN = "bean";
- QName BEAN_ELEMENT = new QName(SPRING_NS, BEAN);
-
- String CONSTRUCTORARG = "constructor-arg";
- QName CONSTRUCTORARG_ELEMENT = new QName(SPRING_NS, CONSTRUCTORARG);
-
- String LIST = "list";
- QName LIST_ELEMENT = new QName(SPRING_NS, LIST);
-
- String VALUE = "value";
- QName VALUE_ELEMENT = new QName(SPRING_NS, VALUE);
-
- String REF = "ref";
- QName REF_ELEMENT = new QName(SPRING_NS, REF);
-
- String APPLICATION_CONTEXT = "application-context.xml";
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyElement.java
deleted file mode 100644
index c6637d31c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringPropertyElement.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.implementation.spring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a <property> element in a Spring application-context
- * - this has name and ref attributes
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringPropertyElement {
-
- private String name;
- private String ref;
- private List<String> values = new ArrayList<String>();
-
- public SpringPropertyElement(String name, String ref) {
- this.name = name;
- this.ref = ref;
- }
-
- public String getName() {
- return name;
- }
-
- public String getRef() {
- return ref;
- }
-
- public void setRef(String ref) {
- this.ref = ref;
- }
-
- public List<String> getValues() {
- return this.values;
- }
-
- public void addValue(String value) {
- this.values.add(value);
- }
-
-} // end class SpringPropertyElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAPropertyElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAPropertyElement.java
deleted file mode 100644
index c666217777..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAPropertyElement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-/**
- * Represents an <sca:property> element in a Spring application-context
- * - this has name and type attributes
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringSCAPropertyElement {
-
- private String name;
- private String type;
-
- public SpringSCAPropertyElement(String name, String type) {
- this.name = name;
- this.type = type;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
-} // end class SpringPropertyElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAReferenceElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAReferenceElement.java
deleted file mode 100644
index 5b6206ef9b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAReferenceElement.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-/**
- * Represents a <sca:reference> element in a Spring application-context
- * - this has id and className attributes
- * - plus zero or more property elements as children
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringSCAReferenceElement {
-
- private String name;
- private String type;
-
- public SpringSCAReferenceElement(String name, String type) {
- this.name = name;
- this.type = type;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
-} // end class SpringSCAReferenceElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAServiceElement.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAServiceElement.java
deleted file mode 100644
index 774bc051d3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/SpringSCAServiceElement.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring;
-
-/**
- * Represents a <sca:service> element in a Spring application-context
- * - this has id and className attributes
- * - plus zero or more property elements as children
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringSCAServiceElement {
-
- private String name;
- private String type;
- private String target;
-
- public SpringSCAServiceElement(String name, String type, String target) {
- this.name = name;
- this.type = type;
- this.target = target;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public void setTarget(String target) {
- this.target = target;
- }
-
- public String getTarget() {
- return target;
- }
-
-} // end class SpringSCAServiceElement
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanIntrospector.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanIntrospector.java
deleted file mode 100644
index c74d4abed9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanIntrospector.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.introspect;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.JavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ComponentNameProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ConstructorProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ContextProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.DestroyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.EagerInitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.InitProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PolicyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.PropertyProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ReferenceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ResourceProcessor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.ServiceProcessor;
-import org.apache.tuscany.sca.implementation.spring.SpringConstructorArgElement;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Provides introspection functions for Spring beans
- * This version leans heavily on the implementation-java classes
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringBeanIntrospector {
-
- private JavaImplementationFactory javaImplementationFactory;
-
- /**
- * The constructor sets up the various visitor elements that will be used to introspect
- * the Spring bean and extract SCA information.
- *
- * @param assemblyFactory The Assembly Factory to use
- * @param javaFactory The Java Interface Factory to use
- * @param policyFactory The Policy Factory to use.
- */
- public SpringBeanIntrospector(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- PolicyFactory policyFactory,
- List<SpringConstructorArgElement> conArgs) {
-
- javaImplementationFactory = new DefaultJavaImplementationFactory();
-
- // Create the list of class visitors
- BaseJavaClassVisitor[] extensions =
- new BaseJavaClassVisitor[] {
- new ConstructorProcessor(assemblyFactory),
- new ComponentNameProcessor(assemblyFactory),
- new ContextProcessor(assemblyFactory),
- new DestroyProcessor(assemblyFactory),
- new EagerInitProcessor(assemblyFactory),
- new InitProcessor(assemblyFactory),
- new PropertyProcessor(assemblyFactory),
- new ReferenceProcessor(assemblyFactory, javaFactory),
- new ResourceProcessor(assemblyFactory),
- new ServiceProcessor(assemblyFactory, javaFactory),
- new SpringBeanPojoProcessor(assemblyFactory, javaFactory, conArgs),
- new PolicyProcessor(assemblyFactory, policyFactory)};
- for (JavaClassVisitor extension : extensions) {
- javaImplementationFactory.addClassVisitor(extension);
- }
-
- } // end constructor
-
- /**
- * Introspect a Spring Bean and extract the features important to SCA
- * @param beanClass the Spring Bean class to introspect
- * @param componentType the componentType that is filled in through the introspection
- * process (assumed empty on invocation, filled on return
- * @return a Map of property names to JavaElementImpl
- * @throws ContributionResolveException - if there was a problem resolving the
- * Spring Bean or its componentType
- *
- */
- public JavaImplementation introspectBean(Class<?> beanClass, ComponentType componentType) throws ContributionResolveException
- {
- if (componentType == null)
- throw new ContributionResolveException("Introspect Spring bean: supplied componentType is null");
-
- // Create a Java implementation ready for the introspection
- JavaImplementation javaImplementation = javaImplementationFactory.createJavaImplementation();
-
- try {
- // Introspect the bean...the results of the introspection are placed into the Java implementation
- javaImplementationFactory.createJavaImplementation(javaImplementation, beanClass);
-
- // Extract the services, references & properties found through introspection
- // put the services, references and properties into the component type
- componentType.getServices().addAll(javaImplementation.getServices());
- componentType.getReferences().addAll(javaImplementation.getReferences());
- componentType.getProperties().addAll(javaImplementation.getProperties());
-
- } catch (IntrospectionException e) {
- throw new ContributionResolveException(e);
- } // end try
-
- /* List<Service> services = javaImplementation.getServices();
- for (Service service : services) {
- String name = service.getName();
- System.out.println("Spring Bean: found service with name: " + name);
- } // end for */
-
- return javaImplementation;
-
- } // end method introspectBean
-
-} // end class SpringBeanIntrospector
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanPojoProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanPojoProcessor.java
deleted file mode 100644
index 732557e4ea..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringBeanPojoProcessor.java
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.introspect;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllInterfaces;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllPublicAndProtectedFields;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getAllUniquePublicProtectedMethods;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getPrivateFields;
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.toPropertyName;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Member;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jws.WebService;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Contract;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.AmbiguousConstructorException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.InvalidServiceType;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.NoConstructorException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.Resource;
-import org.apache.tuscany.sca.implementation.spring.SpringConstructorArgElement;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.osoa.sca.annotations.Callback;
-import org.osoa.sca.annotations.Context;
-import org.osoa.sca.annotations.Property;
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Heuristically evaluates an un-annotated Java implementation type to determine
- * services, references, and properties according to the algorithm described in
- * the SCA Java Client and Implementation Model Specification <p/> TODO
- * Implement: <p/> When no service interface is annotated, need to calculate a
- * single service comprising all public methods that are not reference or
- * property injection sites. If that service can be exactly mapped to an
- * interface implemented by the class then the service interface will be defined
- * in terms of that interface.
- *
- * @version $Rev: 689426 $ $Date: 2008-08-27 14:56:06 +0530 (Wed, 27 Aug 2008) $
- */
-public class SpringBeanPojoProcessor extends BaseJavaClassVisitor {
- private JavaInterfaceFactory javaFactory;
- private List<SpringConstructorArgElement> conArgs;
-
- public SpringBeanPojoProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory, List<SpringConstructorArgElement> conArgs) {
- super(assemblyFactory);
- this.javaFactory = javaFactory;
- this.conArgs = conArgs;
- }
-
- @Override
- public <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
- List<org.apache.tuscany.sca.assembly.Service> services = type.getServices();
- if (services.isEmpty()) {
- // heuristically determine the service
- /**
- * The following is quoted from Java Specification 1.2.1.3. Introspecting services offered by a Java implementation
- * In the cases described below, the services offered by a Java implementation class may be determined
- * through introspection, eliding the need to specify them using @Service. The following algorithm is used
- * to determine how services are introspected from an implementation class:
- *
- * If the interfaces of the SCA services are not specified with the @Service annotation on the
- * implementation class, it is assumed that all implemented interfaces that have been annotated
- * as @Remotable are the service interfaces provided by the component. If none of the implemented
- * interfaces is remotable, then by default the implementation offers a single service whose type
- * is the implementation class.
- */
- Set<Class> interfaces = getAllInterfaces(clazz);
- for (Class<?> i : interfaces) {
- if (i.isAnnotationPresent(Remotable.class) || i.isAnnotationPresent(WebService.class)) {
- addService(type, i);
- }
- }
- if (services.isEmpty()) {
- // class is the interface
- addService(type, clazz);
- }
- }
- Set<Method> methods = getAllUniquePublicProtectedMethods(clazz, false);
- if (!type.getReferenceMembers().isEmpty() || !type.getPropertyMembers().isEmpty()) {
- // references and properties have been explicitly defined
- // if (type.getServices().isEmpty()) {
- // calculateServiceInterface(clazz, type, methods);
- // if (type.getServices().isEmpty()) {
- // throw new ServiceTypeNotFoundException(clazz.getName());
- // }
- // }
- evaluateConstructor(type, clazz);
- return;
- }
- calcPropRefs(methods, services, type, clazz);
- evaluateConstructor(type, clazz);
- }
-
- private void addService(JavaImplementation type, Class<?> clazz) throws IntrospectionException {
- try {
- org.apache.tuscany.sca.assembly.Service service = createService(clazz);
- type.getServices().add(service);
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- }
-
- private boolean isPublicSetter(Method method) {
- return method.getParameterTypes().length == 1 && Modifier.isPublic(method.getModifiers())
- && method.getName().startsWith("set")
- && method.getReturnType() == void.class;
- }
-
- private boolean isProtectedSetter(Method method) {
- return method.getParameterTypes().length == 1 && Modifier.isProtected(method.getModifiers())
- && method.getName().startsWith("set")
- && method.getReturnType() == void.class;
- }
-
- private <T> void calcPropRefs(Set<Method> methods,
- List<org.apache.tuscany.sca.assembly.Service> services,
- JavaImplementation type,
- Class<T> clazz) throws IntrospectionException {
- // heuristically determine the properties references
- // make a first pass through all public methods with one param
- Set<String> setters = new HashSet<String>();
- Set<String> others = new HashSet<String>();
- for (Method method : methods) {
- if (!isPublicSetter(method)) {
- continue;
- }
- if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
- // Add the property name as others
- others.add(toPropertyName(method.getName()));
- continue;
- }
- if (!isInServiceInterface(method, services)) {
- // Not part of the service interface
- String name = toPropertyName(method.getName());
- setters.add(name);
- // avoid duplicate property or ref names
- if (!type.getPropertyMembers().containsKey(name) && !type.getReferenceMembers().containsKey(name)) {
- Class<?> param = method.getParameterTypes()[0];
- Type genericType = method.getGenericParameterTypes()[0];
- if (isReferenceType(param, genericType)) {
- type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
- } else {
- type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
- }
- }
- }
- }
- // second pass for protected methods with one param
- for (Method method : methods) {
- if (!isProtectedSetter(method)) {
- continue;
- }
- if (method.isAnnotationPresent(Callback.class) || method.isAnnotationPresent(Context.class)) {
- // Add the property name as others
- others.add(toPropertyName(method.getName()));
- continue;
- }
- Class<?> param = method.getParameterTypes()[0];
- String name = toPropertyName(method.getName());
- setters.add(name);
- // avoid duplicate property or ref names
- if (isReferenceType(param, method.getGenericParameterTypes()[0])) {
- if (!type.getReferenceMembers().containsKey(name)) {
- type.getReferences().add(createReference(name, param));
- type.getReferenceMembers().put(name, new JavaElementImpl(method, 0));
- }
- } else {
- if (!type.getPropertyMembers().containsKey(name)) {
- type.getProperties().add(createProperty(name, param));
- type.getPropertyMembers().put(name, new JavaElementImpl(method, 0));
- }
- }
- }
-
- // Public or protected fields unless there is a public or protected
- // setter method
- // for the same name
- Set<Field> fields = getAllPublicAndProtectedFields(clazz, false);
- for (Field field : fields) {
- if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
- continue;
- }
- if (setters.contains(field.getName()) || others.contains(field.getName())) {
- continue;
- }
- String name = field.getName();
- Class<?> paramType = field.getType();
- if (isReferenceType(paramType, field.getGenericType())) {
- if (!type.getReferenceMembers().containsKey(name)) {
- type.getReferences().add(createReference(name, paramType));
- type.getReferenceMembers().put(name, new JavaElementImpl(field));
- }
- } else {
- if (!type.getPropertyMembers().containsKey(name)) {
- type.getProperties().add(createProperty(name, paramType));
- type.getPropertyMembers().put(name, new JavaElementImpl(field));
- }
- }
- }
-
- // Private fields unless there is a public or protected
- // setter method for the same name
- Set<Field> privateFields = getPrivateFields(clazz);
- for (Field field : privateFields) {
- if (field.isAnnotationPresent(Callback.class) || field.isAnnotationPresent(Context.class)) {
- continue;
- }
- if (setters.contains(field.getName()) || others.contains(field.getName())) {
- continue;
- }
- String name = field.getName();
- Class<?> paramType = field.getType();
- if (isReferenceType(paramType, field.getGenericType())) {
- if (!type.getReferenceMembers().containsKey(name)) {
- type.getReferences().add(createReference(name, paramType));
- type.getReferenceMembers().put(name, new JavaElementImpl(field));
- }
- } else {
- if (!type.getPropertyMembers().containsKey(name)) {
- type.getProperties().add(createProperty(name, paramType));
- type.getPropertyMembers().put(name, new JavaElementImpl(field));
- }
- }
- }
- }
-
- /**
- * Determines the constructor to use based on the component type's
- * references and properties
- *
- * @param type the component type
- * @param clazz the implementation class corresponding to the component type
- * @throws NoConstructorException if no suitable constructor is found
- * @throws AmbiguousConstructorException if the parameters of a constructor
- * cannot be unambiguously mapped to references and properties
- */
- @SuppressWarnings("unchecked")
- private <T> void evaluateConstructor(JavaImplementation type, Class<T> clazz) throws IntrospectionException {
- // determine constructor if one is not annotated
- JavaConstructorImpl<?> definition = type.getConstructor();
- Map<String, JavaElementImpl> props = type.getPropertyMembers();
- Map<String, JavaElementImpl> refs = type.getReferenceMembers();
- Constructor constructor;
- boolean explict = false;
- if (definition != null && definition.getConstructor()
- .isAnnotationPresent(org.osoa.sca.annotations.Constructor.class)) {
- // the constructor was already defined explicitly
- return;
- } else if (definition != null) {
- explict = true;
- constructor = definition.getConstructor();
- } else {
- // no definition, heuristically determine constructor
- Constructor[] constructors = clazz.getConstructors();
- if (constructors.length == 0) {
- throw new NoConstructorException("No public constructor for class");
- } else if (constructors.length == 1) {
- // Only one constructor, take it
- constructor = constructors[0];
- } else {
- // multiple constructors scenario
- Constructor<T> selected = null;
- for (Constructor<T> ctor : constructors) {
- if (ctor.getParameterTypes().length == 0) {
- selected = ctor;
- } else if (ctor.getParameterTypes().length == conArgs.size()) {
- // we will find a constructor which has atleast one
- // reference or property as its parameter types.
- Class<?>[] parametersTypes = ctor.getParameterTypes();
- for (Class<?> pType: parametersTypes) {
- for (JavaElementImpl property : props.values()) {
- if (pType.equals(property.getType()))
- selected = ctor;
- }
- for (JavaElementImpl reference : refs.values()) {
- if (pType.equals(reference.getType()))
- selected = ctor;
- }
- }
- }
- }
- if (selected == null) {
- throw new NoConstructorException();
- }
- constructor = selected;
- }
- definition = type.getConstructors().get(constructor);
- type.setConstructor(definition);
- }
-
- JavaParameterImpl[] parameters = definition.getParameters();
- if (parameters.length == 0) {
- return;
- }
-
- Annotation[][] annotations = constructor.getParameterAnnotations();
- if (!explict) {
- // the constructor wasn't defined by an annotation, so check to see
- // if any of the params have an annotation
- // which we can impute as explicitly defining the constructor, e.g.
- // @Property, @Reference, or @Autowire
- explict = injectionAnnotationsPresent(annotations);
- }
- if (explict) {
- for (int i = 0; i < parameters.length; i++) {
- if (isAnnotated(parameters[i])) {
- continue;
- } else if (!findReferenceOrProperty(parameters[i], props, refs)) {
- throw new AmbiguousConstructorException(parameters[i].toString());
- }
- }
- } else {
- if (!areUnique(parameters)) {
- throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
- }
- if (!calcPropRefUniqueness(props.values(), refs.values())) {
- throw new AmbiguousConstructorException("Cannot resolve non-unique parameter types, use @Constructor");
- }
- if (!(props.isEmpty() && refs.isEmpty())) {
- calcParamNames(parameters, props, refs);
- } else {
- heuristicParamNames(type, parameters);
-
- }
- }
- }
-
- private void calcParamNames(JavaParameterImpl[] parameters,
- Map<String, JavaElementImpl> props,
- Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
- // the constructor param types must unambiguously match defined
- // reference or property types
- for (JavaParameterImpl param : parameters) {
- if (!findReferenceOrProperty(param, props, refs)) {
- throw new AmbiguousConstructorException(param.getName());
- }
- }
- }
-
- private void heuristicParamNames(JavaImplementation type, JavaParameterImpl[] parameters)
- throws IntrospectionException {
- // heuristically determine refs and props from the parameter types
- for (JavaParameterImpl p : parameters) {
- String name = p.getType().getSimpleName().toLowerCase();
- if (isReferenceType(p.getType(), p.getGenericType())) {
- type.getReferences().add(createReference(name, p.getType()));
- p.setClassifer(Reference.class);
- type.getReferenceMembers().put(name, p);
- } else {
- type.getProperties().add(createProperty(name, p.getType()));
- p.setClassifer(Property.class);
- type.getPropertyMembers().put(name, p);
- }
- p.setName(name);
- }
- }
-
- private static boolean areUnique(Class[] collection) {
- Set<Class> set = new HashSet<Class>(Arrays.asList(collection));
- return set.size() == collection.length;
- }
-
- /**
- * Returns true if the union of the given collections of properties and
- * references have unique Java types
- */
- private boolean calcPropRefUniqueness(Collection<JavaElementImpl> props, Collection<JavaElementImpl> refs) {
-
- Class[] classes = new Class[props.size() + refs.size()];
- int i = 0;
- for (JavaElementImpl property : props) {
- classes[i] = property.getType();
- i++;
- }
- for (JavaElementImpl reference : refs) {
- classes[i] = reference.getType();
- i++;
- }
- return areUnique(classes);
- }
-
- /**
- * Unambiguously finds the reference or property associated with the given
- * type
- *
- * @return the name of the reference or property if found, null if not
- * @throws AmbiguousConstructorException if the constructor parameter cannot
- * be resolved to a property or reference
- */
- private boolean findReferenceOrProperty(JavaParameterImpl parameter,
- Map<String, JavaElementImpl> props,
- Map<String, JavaElementImpl> refs) throws AmbiguousConstructorException {
-
- boolean found = false;
- if (!"".equals(parameter.getName())) {
- // Match by name
- JavaElementImpl prop = props.get(parameter.getName());
- if (prop != null && prop.getType() == parameter.getType()) {
- parameter.setClassifer(Property.class);
- return true;
- }
- JavaElementImpl ref = refs.get(parameter.getName());
- if (ref != null && ref.getType() == parameter.getType()) {
- parameter.setClassifer(Reference.class);
- return true;
- }
- }
- for (JavaElementImpl property : props.values()) {
- if (property.getType() == parameter.getType()) {
- if (found) {
- throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
- (Member)parameter.getAnchor());
- }
- parameter.setClassifer(Property.class);
- parameter.setName(property.getName());
- found = true;
- // do not break since ambiguities must be checked, i.e. more
- // than one prop or ref of the same type
- }
- }
- for (JavaElementImpl reference : refs.values()) {
- if (reference.getType() == parameter.getType()) {
- if (found) {
- throw new AmbiguousConstructorException("Ambiguous property or reference for constructor type",
- (Member)parameter.getAnchor());
- }
- parameter.setClassifer(Reference.class);
- parameter.setName(reference.getName());
- found = true;
- // do not break since ambiguities must be checked, i.e. more
- // than one prop or ref of the same type
- }
- }
- return found;
- }
-
- /**
- * Returns true if a given type is reference according to the SCA
- * specification rules for determining reference types The following rules
- * are used to determine whether an unannotated field or setter method is a
- * property or reference:
- * <ol>
- * <li>If its type is simple, then it is a property.
- * <li>If its type is complex, then if the type is an interface marked by
- *
- * @Remotable, then it is a reference; otherwise, it is a property.
- * <li>Otherwise, if the type associated with the member is an
- * array or a java.util.Collection, the basetype is the element
- * type of the array or the parameterized type of the
- * Collection; otherwise the basetype is the member type. If the
- * basetype is an interface with an
- * @Remotable or
- * @Service annotation then the member is defined as a reference. Otherwise,
- * it is defined as a property.
- * </ol>
- * <p>
- * The name of the reference or of the property is derived from the
- * name found on the setter method or on the field.
- */
- private boolean isReferenceType(Class<?> cls, Type genericType) {
- Class<?> baseType = JavaIntrospectionHelper.getBaseType(cls, genericType);
- return baseType.isInterface() && baseType.isAnnotationPresent(Remotable.class);
- }
-
- /**
- * Returns true if the given operation is defined in the collection of
- * service interfaces
- */
- private boolean isInServiceInterface(Method operation, List<org.apache.tuscany.sca.assembly.Service> services) {
- for (org.apache.tuscany.sca.assembly.Service service : services) {
- Interface interface1 = service.getInterfaceContract().getInterface();
- if (interface1 instanceof JavaInterface) {
- Class<?> clazz = ((JavaInterface)interface1).getJavaClass();
- if (isMethodMatched(clazz, operation)) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Test if the class declares a method which matches the signature of the
- * given method
- *
- * @param clazz
- * @param method
- * @return
- */
- private boolean isMethodMatched(Class<?> clazz, Method method) {
- if (method.getDeclaringClass() == clazz) {
- return true;
- }
- Method[] methods = clazz.getMethods();
- for (Method m : methods) {
- if (JavaIntrospectionHelper.exactMethodMatch(method, m)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Creates a mapped property.
- *
- * @param name the property name
- * @param paramType the property type
- */
- private org.apache.tuscany.sca.assembly.Property createProperty(String name, Class<?> paramType) {
- org.apache.tuscany.sca.assembly.Property property = assemblyFactory.createProperty();
- property.setName(name);
- property.setXSDType(JavaXMLMapper.getXMLType(paramType));
- return property;
- }
-
- private boolean isAnnotated(JavaParameterImpl parameter) {
- for (Annotation annotation : parameter.getAnnotations()) {
- Class<? extends Annotation> annotType = annotation.annotationType();
- if (annotType.equals(Property.class) || annotType.equals(Reference.class)
- || annotType.equals(Resource.class)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean areUnique(JavaParameterImpl[] parameters) {
- Set<Class> set = new HashSet<Class>(parameters.length);
- for (JavaParameterImpl p : parameters) {
- if (!set.add(p.getType())) {
- return false;
- }
- }
- return true;
- }
-
- public org.apache.tuscany.sca.assembly.Reference createReference(String name, Class<?> paramType)
- throws IntrospectionException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- reference.setName(name);
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
- try {
- JavaInterface callInterface = javaFactory.createJavaInterface(paramType);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- } catch (InvalidInterfaceException e1) {
- throw new IntrospectionException(e1);
- }
-
- // FIXME: This part seems to have already been taken care above!!
- try {
- processCallback(paramType, reference);
- } catch (InvalidServiceType e) {
- throw new IntrospectionException(e);
- }
- return reference;
- }
-
- public org.apache.tuscany.sca.assembly.Service createService(Class<?> interfaze) throws InvalidInterfaceException {
- org.apache.tuscany.sca.assembly.Service service = assemblyFactory.createService();
- service.setName(interfaze.getSimpleName());
-
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
- service.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
-
- Interface javaInterface = service.getInterfaceContract().getInterface();
- javaInterface.setRemotable(interfaze.getAnnotation(Remotable.class) != null);
- service.getInterfaceContract().setInterface(javaInterface);
- return service;
- }
-
- public void processCallback(Class<?> interfaze, Contract contract) throws InvalidServiceType {
- Callback callback = interfaze.getAnnotation(Callback.class);
- if (callback != null && !Void.class.equals(callback.value())) {
- Class<?> callbackClass = callback.value();
- JavaInterface javaInterface;
- try {
- javaInterface = javaFactory.createJavaInterface(callbackClass);
- contract.getInterfaceContract().setCallbackInterface(javaInterface);
- } catch (InvalidInterfaceException e) {
- throw new InvalidServiceType("Invalid callback interface "+callbackClass, interfaze);
- }
- } else if (callback != null && Void.class.equals(callback.value())) {
- throw new InvalidServiceType("No callback interface specified on annotation", interfaze);
- }
- }
-
- public boolean injectionAnnotationsPresent(Annotation[][] annots) {
- for (Annotation[] annotations : annots) {
- for (Annotation annotation : annotations) {
- Class<? extends Annotation> annotType = annotation.annotationType();
- if (annotType.equals(Property.class) || annotType.equals(Reference.class)
- || annotType.equals(Resource.class)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
deleted file mode 100644
index 54d42937db..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
+++ /dev/null
@@ -1,861 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.introspect;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-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.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaConstructorImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.spring.SpringBeanElement;
-import org.apache.tuscany.sca.implementation.spring.SpringConstructorArgElement;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementationConstants;
-import org.apache.tuscany.sca.implementation.spring.SpringPropertyElement;
-import org.apache.tuscany.sca.implementation.spring.SpringSCAPropertyElement;
-import org.apache.tuscany.sca.implementation.spring.SpringSCAReferenceElement;
-import org.apache.tuscany.sca.implementation.spring.SpringSCAServiceElement;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Introspects a Spring XML application-context configuration file to create <implementation-spring../>
- * component type information.
- *
- *
- * @version $Rev: 512919 $ $Date: 2007-02-28 19:32:56 +0000 (Wed, 28 Feb 2007) $
- */
-public class SpringXMLComponentTypeLoader {
- private XMLInputFactory xmlInputFactory;
- private ContributionFactory contributionFactory;
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
- private PolicyFactory policyFactory;
- private boolean isMultipleContextSupported;
-
- private SpringBeanIntrospector beanIntrospector;
-
- public SpringXMLComponentTypeLoader(ModelFactoryExtensionPoint factories,
- AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory,
- PolicyFactory policyFactory,
- boolean multipleContextSupport) {
- super();
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- this.policyFactory = policyFactory;
- this.contributionFactory = factories.getFactory(ContributionFactory.class);
- this.xmlInputFactory = factories.getFactory(XMLInputFactory.class);
- this.isMultipleContextSupported = multipleContextSupport;
- }
-
- protected Class<SpringImplementation> getImplementationClass() {
- return SpringImplementation.class;
- }
-
- /**
- * Base method which loads the component type from the application-context attached to the
- * Spring implementation
- *
- */
- public void load(SpringImplementation implementation, ModelResolver resolver) throws ContributionReadException {
- //System.out.println("Spring TypeLoader - load method start");
- ComponentType componentType = implementation.getComponentType();
- /* Check that there is a component type object already set */
- if (componentType == null) {
- throw new ContributionReadException("SpringXMLLoader load: implementation has no ComponentType object");
- }
- if (componentType.isUnresolved()) {
- /* Fetch the location of the application-context file from the implementation */
- loadFromXML(implementation, resolver);
- if (!componentType.isUnresolved())
- implementation.setUnresolved(false);
- } // end if
- //System.out.println("Spring TypeLoader - load method complete");
- } // end method load
-
-
- private Class<?> resolveClass(ModelResolver resolver, String className) throws ClassNotFoundException {
- ClassReference classReference = new ClassReference(className);
- classReference = resolver.resolveModel(ClassReference.class, classReference);
- if (classReference.isUnresolved()) {
- throw new ClassNotFoundException(className);
- }
- Class<?> javaClass = classReference.getJavaClass();
- return javaClass;
- }
-
- /**
- * Method which fills out the component type for a Spring implementation by reading the
- * Spring application-context.xml file.
- *
- * @param implementation SpringImplementation into which to load the component type information
- * @throws ContributionReadException Failed to read the contribution
- */
- private void loadFromXML(SpringImplementation implementation, ModelResolver resolver) throws ContributionReadException {
- XMLStreamReader reader;
- List<SpringBeanElement> beans = new ArrayList<SpringBeanElement>();
- List<SpringSCAServiceElement> services = new ArrayList<SpringSCAServiceElement>();
- List<SpringSCAReferenceElement> references = new ArrayList<SpringSCAReferenceElement>();
- List<SpringSCAPropertyElement> scaproperties = new ArrayList<SpringSCAPropertyElement>();
-
- URL resource;
-
- String contextPath = implementation.getLocation();
-
- try {
- resource = resolveLocation(resolver, contextPath);
- resource = getApplicationContextResource(resource);
-
- implementation.setClassLoader(new ContextClassLoader(resolver));
- implementation.setResource(resource);
- // The URI is used to uniquely identify the Implementation
- implementation.setURI(resource.toString());
- reader = xmlInputFactory.createXMLStreamReader(resource.openStream());
-
- // System.out.println("Spring TypeLoader - starting to read context file");
- readContextDefinition(resolver, reader, contextPath, beans, services, references, scaproperties);
-
- reader.close();
-
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- }
-
- /* At this point, the complete application-context.xml file has been read and its contents */
- /* stored in the lists of beans, services, references. These are now used to generate */
- /* the implied componentType for the application context */
- generateComponentType(implementation, resolver, beans, services, references, scaproperties);
-
- return;
- } // end method loadFromXML
-
-
- private URL resolveLocation(ModelResolver resolver, String contextPath) throws MalformedURLException,
- ContributionReadException {
- URL resource = null;
- URI uri = URI.create(contextPath);
- if (!uri.isAbsolute()) {
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setUnresolved(true);
- artifact.setURI(contextPath);
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (!artifact.isUnresolved()) {
- resource = new URL(artifact.getLocation());
- } else {
- throw new ContributionReadException("Location cannot be resloved: " + contextPath);
- }
- } else {
- resource = new URL(contextPath);
- }
- return resource;
- }
-
- /**
- * Method which returns the XMLStreamReader for the Spring application-context.xml file
- * specified in the location attribute
- */
- private XMLStreamReader getApplicationContextReader(ModelResolver resolver, String location) throws ContributionReadException {
-
- try {
- URL resource = getApplicationContextResource(resolveLocation(resolver, location));
- XMLStreamReader reader =
- xmlInputFactory.createXMLStreamReader(resource.openStream());
- return reader;
- } catch (IOException e) {
- throw new ContributionReadException(e);
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- }
- }
-
- /**
- * Method which reads the spring context definitions from Spring application-context.xml
- * file and identifies the defined beans, properties, services and references
- */
- private void readContextDefinition(ModelResolver resolver,
- XMLStreamReader reader,
- String contextPath,
- List<SpringBeanElement> beans,
- List<SpringSCAServiceElement> services,
- List<SpringSCAReferenceElement> references,
- List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {
-
- SpringBeanElement bean = null;
-
- try {
- boolean completed = false;
- while (!completed) {
- switch (reader.next()) {
- case START_ELEMENT:
- QName qname = reader.getName();
- //System.out.println("Spring TypeLoader - found element with name: " + qname.toString());
- if (SpringImplementationConstants.IMPORT_ELEMENT.equals(qname)) {
- //FIXME - put the sequence of code below which gets the ireader into a subsidiary method
- String location = reader.getAttributeValue(null, "resource");
- if (location != null) {
- // FIXME - need to find a right way of generating this path
- String resourcePath = contextPath.substring(0, contextPath.lastIndexOf("/")+1) + location;
- XMLStreamReader ireader = getApplicationContextReader(resolver, resourcePath);
- // Read the context definition for the identified imported resource
- readContextDefinition(resolver, ireader, contextPath, beans, services, references, scaproperties);
- }
- } else if (SpringImplementationConstants.SERVICE_ELEMENT.equals(qname)) {
- SpringSCAServiceElement service =
- new SpringSCAServiceElement(reader.getAttributeValue(null, "name"), reader
- .getAttributeValue(null, "type"), reader.getAttributeValue(null, "target"));
- services.add(service);
- } else if (SpringImplementationConstants.REFERENCE_ELEMENT.equals(qname)) {
- SpringSCAReferenceElement reference =
- new SpringSCAReferenceElement(reader.getAttributeValue(null, "name"), reader
- .getAttributeValue(null, "type"));
- references.add(reference);
- } else if (SpringImplementationConstants.SCAPROPERTY_ELEMENT.equals(qname)) {
- SpringSCAPropertyElement scaproperty =
- new SpringSCAPropertyElement(reader.getAttributeValue(null, "name"), reader
- .getAttributeValue(null, "type"));
- scaproperties.add(scaproperty);
- } else if (SpringImplementationConstants.BEAN_ELEMENT.equals(qname)) {
- bean = new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
- .getAttributeValue(null, "class"));
- beans.add(bean);
- // Read the <bean> element and its child elements
- readBeanDefinition(resolver, reader, contextPath, bean, beans, services, references, scaproperties);
- } // end if*/
- break;
- case END_ELEMENT:
- if (SpringImplementationConstants.BEANS_ELEMENT.equals(reader.getName())) {
- //System.out.println("Spring TypeLoader - finished read of context file");
- completed = true;
- break;
- } // end if
- } // end switch
- } // end while
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- }
- }
-
-
- /**
- * Method which reads the bean definitions from Spring application-context.xml file and identifies
- * the defined beans, properties, services and references
- */
- private void readBeanDefinition(ModelResolver resolver,
- XMLStreamReader reader,
- String contextPath,
- SpringBeanElement bean,
- List<SpringBeanElement> beans,
- List<SpringSCAServiceElement> services,
- List<SpringSCAReferenceElement> references,
- List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {
-
- SpringBeanElement innerbean = null;
- SpringPropertyElement property = null;
- SpringConstructorArgElement constructorArg = null;
- int autoConstructorIndex = -1;
-
- try {
- boolean completed = false;
- while (!completed) {
- switch (reader.next()) {
- case START_ELEMENT:
- QName qname = reader.getName();
- if (SpringImplementationConstants.BEAN_ELEMENT.equals(qname)) {
- innerbean = new SpringBeanElement(reader.getAttributeValue(null, "id"), reader
- .getAttributeValue(null, "class"));
- innerbean.setInnerBean(true);
- beans.add(innerbean);
- readBeanDefinition(resolver, reader, contextPath, innerbean, beans, services, references, scaproperties);
- } else if (SpringImplementationConstants.PROPERTY_ELEMENT.equals(qname)) {
- property = new SpringPropertyElement(reader.getAttributeValue(null, "name"), reader
- .getAttributeValue(null, "ref"));
- bean.addProperty(property);
- } else if (SpringImplementationConstants.CONSTRUCTORARG_ELEMENT.equals(qname)) {
- constructorArg = new SpringConstructorArgElement(reader.getAttributeValue(null, "ref"),
- reader.getAttributeValue(null, "type"));
- autoConstructorIndex++;
- constructorArg.setAutoIndex(autoConstructorIndex);
- if (reader.getAttributeValue(null, "index") != null)
- constructorArg.setIndex((new Integer(reader.getAttributeValue(null, "index"))).intValue());
- if (reader.getAttributeValue(null, "value") != null) {
- String value = reader.getAttributeValue(null, "value");
- constructorArg.addValue(value);
- if ((isMultipleContextSupported) && (value.indexOf(".xml") != -1)) {
- if (bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) {
- XMLStreamReader creader = getApplicationContextReader(resolver, value);
- // Read the context definition for the constructor-arg resources
- readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
- }
- }
- }
- bean.addCustructorArgs(constructorArg);
- } else if (SpringImplementationConstants.REF_ELEMENT.equals(qname)) {
- String ref = reader.getAttributeValue(null, "bean");
- // Check if the parent element is a property
- if (property != null) property.setRef(ref);
- // Check if the parent element is a constructor-arg
- if (constructorArg != null) constructorArg.setRef(ref);
- } else if (SpringImplementationConstants.VALUE_ELEMENT.equals(qname)) {
- String value = reader.getElementText();
- // Check if the parent element is a constructor-arg
- if (constructorArg != null) {
- constructorArg.addValue(value);
- // Identify the XML resource specified for the constructor-arg element
- if ((isMultipleContextSupported) && (value.indexOf(".xml") != -1)) {
- if (bean.getClassName().indexOf(".ClassPathXmlApplicationContext") != -1) {
- XMLStreamReader creader = getApplicationContextReader(resolver, value);
- // Read the context definition for the constructor-arg resources
- readContextDefinition(resolver, creader, contextPath, beans, services, references, scaproperties);
- }
- }
- }
- } // end if
- break;
- case END_ELEMENT:
- if (SpringImplementationConstants.BEAN_ELEMENT.equals(reader.getName())) {
- completed = true;
- break;
- } else if (SpringImplementationConstants.PROPERTY_ELEMENT.equals(reader.getName())) {
- property = null;
- } else if (SpringImplementationConstants.CONSTRUCTORARG_ELEMENT.equals(reader.getName())) {
- constructorArg = null;
- } // end if
- } // end switch
- } // end while
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- }
- }
-
- /**
- * Generates the Spring implementation component type from the configuration contained in the
- * lists of beans, services, references and scaproperties derived from the application context
- */
- private void generateComponentType(SpringImplementation implementation,
- ModelResolver resolver,
- List<SpringBeanElement> beans,
- List<SpringSCAServiceElement> services,
- List<SpringSCAReferenceElement> references,
- List<SpringSCAPropertyElement> scaproperties) throws ContributionReadException {
- /*
- * 1. Each sca:service becomes a service in the component type
- * 2. Each sca:reference becomes a reference in the component type
- * 3. Each sca:property becomes a property in the component type
- * 4. IF there are no explicit service elements, each bean becomes a service
- * 5. Each bean property which is a reference not pointing at another bean in the
- * application context becomes a reference unless it is pointing at one of the references
- * 6. Each bean property which is not a reference and which is not pointing
- * at another bean in the application context becomes a property in the component type
- */
-
- JavaImplementation javaImplementation = null;
- ComponentType componentType = implementation.getComponentType();
-
- try {
- // Deal with the services first....
- Iterator<SpringSCAServiceElement> its = services.iterator();
- while (its.hasNext()) {
- SpringSCAServiceElement serviceElement = its.next();
- Class<?> interfaze = resolveClass(resolver, serviceElement.getType());
- Service theService = createService(interfaze, serviceElement.getName());
- // Spring allows duplication of bean definitions in multiple context scenario,
- // in such cases, the latest bean definition overrides the older ones, hence
- // we will remove any older definition and use the latest.
- Service duplicate = null;
- for (Service service : componentType.getServices()) {
- if (service.getName().equals(theService.getName()))
- duplicate = service;
- }
- if (duplicate != null)
- componentType.getServices().remove(duplicate);
- componentType.getServices().add(theService);
- // Add this service to the Service / Bean map
- String beanName = serviceElement.getTarget();
- for (SpringBeanElement beanElement : beans) {
- if (beanName.equals(beanElement.getId())) {
- implementation.setBeanForService(theService, beanElement);
- }
- } // end for
- } // end while
-
- // Next handle the references
- Iterator<SpringSCAReferenceElement> itr = references.iterator();
- while (itr.hasNext()) {
- SpringSCAReferenceElement referenceElement = itr.next();
- Class<?> interfaze = resolveClass(resolver, referenceElement.getType());
- Reference theReference = createReference(interfaze, referenceElement.getName());
- // Override the older bean definition with the latest ones.
- Reference duplicate = null;
- for (Reference reference : componentType.getReferences()) {
- if (reference.getName().equals(theReference.getName()))
- duplicate = reference;
- }
- if (duplicate != null)
- componentType.getReferences().remove(duplicate);
- componentType.getReferences().add(theReference);
- } // end while
-
- // Next handle the properties
- Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
- while (itsp.hasNext()) {
- SpringSCAPropertyElement scaproperty = itsp.next();
- // Create a component type property if the SCA property element has a name
- // and a type declared...
- if (scaproperty.getType() != null && scaproperty.getName() != null) {
- Property theProperty = assemblyFactory.createProperty();
- theProperty.setName(scaproperty.getName());
- // Get the Java class and then an XSD element type for the property
- Class<?> propType = Class.forName(scaproperty.getType());
- theProperty.setXSDType(JavaXMLMapper.getXMLType(propType));
- // Override the older bean definition with the latest ones.
- Property duplicate = null;
- for (Property property : componentType.getProperties()) {
- if (property.getName().equals(theProperty.getName()))
- duplicate = property;
- }
- if (duplicate != null)
- componentType.getProperties().remove(duplicate);
- componentType.getProperties().add(theProperty);
- // Remember the Java Class (ie the type) for this property
- implementation.setPropertyClass(theProperty.getName(), propType);
- } // end if
- } // end while
-
- // Finally deal with the beans
- Iterator<SpringBeanElement> itb;
- // If there are no explicit service elements, then expose all the beans
- if (services.isEmpty()) {
- itb = beans.iterator();
- // Loop through all the beans found
- while (itb.hasNext()) {
- SpringBeanElement beanElement = itb.next();
- // If its a innerBean, ignore it
- if (beanElement.isInnerBean()) continue;
- // Load the Spring bean class
- Class<?> beanClass = resolveClass(resolver, beanElement.getClassName());
- // Introspect the bean
- beanIntrospector =
- new SpringBeanIntrospector(assemblyFactory, javaFactory, policyFactory, beanElement.getCustructorArgs());
- ComponentType beanComponentType = assemblyFactory.createComponentType();
- javaImplementation = beanIntrospector.introspectBean(beanClass, beanComponentType);
- // Set the service name as bean name
- for (Service componentService : beanComponentType.getServices())
- componentService.setName(beanElement.getId());
- // Get the service interface defined by this Spring Bean and add to
- // the component type of the Spring Assembly
- List<Service> beanServices = beanComponentType.getServices();
- componentType.getServices().addAll(beanServices);
- // Add these services to the Service / Bean map
- for (Service beanService : beanServices) {
- implementation.setBeanForService(beanService, beanElement);
- }
- } // end while
- } // end if
-
- itb = beans.iterator();
- while (itb.hasNext()) {
- SpringBeanElement beanElement = itb.next();
- // Ignore if the bean has no properties and constructor arguments
- if (beanElement.getProperties().isEmpty() && beanElement.getCustructorArgs().isEmpty())
- continue;
-
- Class<?> beanClass = resolveClass(resolver, beanElement.getClassName());
- // Introspect the bean
- beanIntrospector =
- new SpringBeanIntrospector(assemblyFactory, javaFactory, policyFactory, beanElement.getCustructorArgs());
- ComponentType beanComponentType = assemblyFactory.createComponentType();
- javaImplementation = beanIntrospector.introspectBean(beanClass, beanComponentType);
- Map<String, JavaElementImpl> propertyMap = javaImplementation.getPropertyMembers();
- JavaConstructorImpl constructor = javaImplementation.getConstructor();
- // Get the references by this Spring Bean and add the unresolved ones to
- // the component type of the Spring Assembly
- List<Reference> beanReferences = beanComponentType.getReferences();
- List<Property> beanProperties = beanComponentType.getProperties();
-
- Iterator<SpringPropertyElement> itp = beanElement.getProperties().iterator();
- while (itp.hasNext()) {
- SpringPropertyElement propertyElement = itp.next();
- if (propertyRefUnresolved(propertyElement.getRef(), beans, references, scaproperties)) {
- // This means an unresolved reference from the spring bean...
- for (Reference reference : beanReferences) {
- if (propertyElement.getName().equals(reference.getName())) {
- // The name of the reference in this case is the string in
- // the @ref attribute of the Spring property element, NOT the
- // name of the field in the Spring bean....
- reference.setName(propertyElement.getRef());
- componentType.getReferences().add(reference);
- } // end if
- } // end for
-
- // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
- for (Property scaproperty : beanProperties) {
- if (propertyElement.getName().equals(scaproperty.getName())) {
- // The name of the reference in this case is the string in
- // the @ref attribute of the Spring property element, NOT the
- // name of the field in the Spring bean....
- Class<?> interfaze = resolveClass(resolver, (propertyMap.get(propertyElement.getName()).getType()).getName());
- Reference theReference = createReference(interfaze, propertyElement.getRef());
- implementation.setUnresolvedBeanRef(propertyElement.getRef(), theReference);
- } // end if
- } // end for
- } // end if
- } // end while
-
- Iterator<SpringConstructorArgElement> itcr = beanElement.getCustructorArgs().iterator();
- while (itcr.hasNext()) {
- SpringConstructorArgElement conArgElement = itcr.next();
- if (propertyRefUnresolved(conArgElement.getRef(), beans, references, scaproperties)) {
- for (JavaParameterImpl parameter : constructor.getParameters()) {
- String paramType = parameter.getType().getName();
- Class<?> interfaze = resolveClass(resolver, paramType);
- // Create a component type reference/property if the constructor-arg element has a
- // type attribute OR index attribute declared...
- if ((conArgElement.getType() != null && paramType.equals(conArgElement.getType())) ||
- (conArgElement.getIndex() != -1 && (conArgElement.getIndex() == parameter.getIndex())))
- {
- if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Reference")) {
- Reference theReference = createReference(interfaze, conArgElement.getRef());
- componentType.getReferences().add(theReference);
- }
- if (parameter.getClassifer().getName().equals("org.osoa.sca.annotations.Property")) {
- // Store the unresolved references as unresolvedBeanRef in the Spring Implementation type
- // we might need to verify with the component definition later.
- Reference theReference = createReference(interfaze, conArgElement.getRef());
- implementation.setUnresolvedBeanRef(conArgElement.getRef(), theReference);
- }
- }
- } // end for
- } // end if
- } // end while
-
- } // end while
-
- } catch (ClassNotFoundException e) {
- // Means that either an interface class, property class or a bean was not found
- throw new ContributionReadException(e);
- } catch (InvalidInterfaceException e) {
- throw new ContributionReadException(e);
- } catch (ContributionResolveException e) {
-
- } // end try
-
- // If we get here, the Spring assembly component type is resolved
- componentType.setUnresolved(false);
- implementation.setComponentType(componentType);
- return;
- } // end method generateComponentType
-
- /*
- * Determines whether a reference attribute of a Spring property element is resolved either
- * by a bean in the application context or by an SCA reference element or by an SCA property
- * element
- * @param ref - a String containing the name of the reference - may be null
- * @param beans - a List of SpringBean elements
- * @param references - a List of SCA reference elements
- * @return true if the property is not resolved, false if it is resolved
- */
- private boolean propertyRefUnresolved(String ref,
- List<SpringBeanElement> beans,
- List<SpringSCAReferenceElement> references,
- List<SpringSCAPropertyElement> scaproperties) {
- boolean unresolved = true;
-
- if (ref != null) {
- // Scan over the beans looking for a match
- Iterator<SpringBeanElement> itb = beans.iterator();
- while (itb.hasNext()) {
- SpringBeanElement beanElement = itb.next();
- // Does the bean name match the ref?
- if (ref.equals(beanElement.getId())) {
- unresolved = false;
- break;
- } // end if
- } // end while
- // Scan over the SCA reference elements looking for a match
- if (unresolved) {
- Iterator<SpringSCAReferenceElement> itr = references.iterator();
- while (itr.hasNext()) {
- SpringSCAReferenceElement referenceElement = itr.next();
- if (ref.equals(referenceElement.getName())) {
- unresolved = false;
- break;
- } // end if
- } // end while
- } // end if
- // Scan over the SCA property elements looking for a match
- if (unresolved) {
- Iterator<SpringSCAPropertyElement> itsp = scaproperties.iterator();
- while (itsp.hasNext()) {
- SpringSCAPropertyElement propertyElement = itsp.next();
- if (ref.equals(propertyElement.getName())) {
- unresolved = false;
- break;
- } // end if
- } // end while
- } // end if
- } else {
- // In the case where ref = null, the property is not going to be a reference of any
- // kind and can be ignored
- unresolved = false;
- } // end if
-
- return unresolved;
-
- } // end method propertyRefUnresolved
-
- /**
- * Gets hold of the application-context.xml file as a Spring resource
- * @param locationAttr - the location attribute from the <implementation.spring../> element
- * @param cl - the ClassLoader for the Spring implementation
- */
- protected URL getApplicationContextResource(URL url)
- throws ContributionReadException {
- File manifestFile = null;
- File appXmlFile;
- File locationFile = null;
-
- if (url != null) {
- String path = url.getPath();
- locationFile = new File(path);
- } else {
- throw new ContributionReadException(
- "SpringXMLLoader getApplicationContextResource: " + "unable to find resource file "
- + url);
- }
-
- if (locationFile.isDirectory()) {
- try {
- manifestFile = new File(locationFile, "META-INF"+ File.separator +"MANIFEST.MF");
- if (manifestFile.exists()) {
- Manifest mf = new Manifest(new FileInputStream(manifestFile));
- Attributes mainAttrs = mf.getMainAttributes();
- String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- appXmlFile = new File(locationFile, appCtxPath);
- if (appXmlFile.exists()) {
- return appXmlFile.toURL();
- }
- }
- }
- // no manifest-specified Spring context, use default
- appXmlFile = new File(locationFile, "META-INF" + File.separator + "spring"
- + File.separator + SpringImplementationConstants.APPLICATION_CONTEXT);
- if (appXmlFile.exists()) {
- return appXmlFile.toURL();
- }
- } catch (IOException e) {
- throw new ContributionReadException("Error reading manifest inside the folder: ", e);
- }
- } else {
- if (locationFile.isFile() && locationFile.getName().endsWith(".jar")) {
- try {
- JarFile jf = new JarFile(locationFile);
- JarEntry je;
- Manifest mf = jf.getManifest();
- if (mf != null) {
- Attributes mainAttrs = mf.getMainAttributes();
- String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- je = jf.getJarEntry(appCtxPath);
- if (je != null) {
- // TODO return a Spring specific Resource type for jars
- return new URL("jar:" + locationFile.toURI().toURL() + "!/" + appCtxPath);
- }
- }
- }
- // Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
- je = jf.getJarEntry("META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
- if (je != null) {
- return new URL("jar:" + locationFile.toURI().toURL() + "!/" +
- "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
- }
- } catch (IOException e) {
- // TODO: create a more appropriate exception type
- throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
- + " IO exception reading context file.", e);
- }
- }
- else {
- if (locationFile.getName().endsWith(".xml")) {
- return url;
- }
- else {
- // Deal with the directory inside a jar file, in case the contribution itself is a JAR file.
- try {
- if (locationFile.getPath().indexOf(".jar") > 0) {
- String jarPath = url.getPath().substring(5, url.getPath().indexOf("!"));
- JarFile jf = new JarFile(jarPath);
- JarEntry je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2)
- + "/" + "META-INF" + "/" + "MANIFEST.MF");
- if (je != null) {
- Manifest mf = new Manifest(jf.getInputStream(je));
- Attributes mainAttrs = mf.getMainAttributes();
- String appCtxPath = mainAttrs.getValue("Spring-Context");
- if (appCtxPath != null) {
- je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" + appCtxPath);
- if (je != null) {
- return new URL("jar:" + url.getPath() + "/" + appCtxPath);
- }
- }
- }
- // Look for the default applicaiton-context.xml file, when MANIFEST.MF is absent.
- je = jf.getJarEntry(url.getPath().substring(url.getPath().indexOf("!/")+2) + "/" +
- "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
- if (je != null) {
- return new URL("jar:" + url.getPath() + "/" +
- "META-INF" + "/" + "spring" + "/" + SpringImplementationConstants.APPLICATION_CONTEXT);
- }
- }
- } catch (IOException e) {
- throw new ContributionReadException("Error reading manifest inside the jar folder: ", e);
- }
- }
- }
- }
-
- throw new ContributionReadException("SpringXMLLoader getApplicationContextResource: "
- + "META-INF/spring/" + SpringImplementationConstants.APPLICATION_CONTEXT + " not found");
- } // end method getApplicationContextResource
-
- /**
- * Creates a Service for the component type based on its name and Java interface
- */
- public Service createService(Class<?> interfaze, String name) throws InvalidInterfaceException {
- Service service = assemblyFactory.createService();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- // Set the name for the service
- service.setName(name);
-
- // Set the call interface and, if present, the callback interface
- JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
- service.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- return service;
- } // end method createService
-
- /**
- * Creates a Reference for the component type based on its name and Java interface
- */
- private org.apache.tuscany.sca.assembly.Reference createReference(Class<?> interfaze, String name)
- throws InvalidInterfaceException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- // Set the name of the reference to the supplied name and the multiplicity of the reference
- // to 1..1 - for Spring implementations, this is the only multiplicity supported
- reference.setName(name);
- reference.setMultiplicity(Multiplicity.ONE_ONE);
-
- // Set the call interface and, if present, the callback interface
- JavaInterface callInterface = javaFactory.createJavaInterface(interfaze);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
-
- return reference;
- }
-
- private class ContextClassLoader extends ClassLoader {
- public ContextClassLoader(ModelResolver resolver) {
- super();
- this.resolver = resolver;
- }
-
- private ModelResolver resolver;
-
- @Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
- return SpringXMLComponentTypeLoader.this.resolveClass(resolver, name);
- }
-
- @Override
- protected URL findResource(String name) {
- try {
- return resolveLocation(resolver, name);
- } catch (Exception e) {
- return null;
- }
- }
-
- @Override
- protected Enumeration<URL> findResources(String name) throws IOException {
- URL url = findResource(name);
- if (url != null) {
- return Collections.enumeration(Arrays.asList(url));
- } else {
- Collection<URL> urls = Collections.emptyList();
- return Collections.enumeration(urls);
- }
- }
- }
-} // end class SpringXMLComponentTypeLoader
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.java
deleted file mode 100644
index 2f245d7f06..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ComponentTie.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.implementation.spring.invocation;
-
-/**
- * This is the Tuscany side tie for the corresponding Spring runtime side stub class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the ComponentStub class
- * in the implementation-spring-runtime module for what the stub does.
- */
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-public class ComponentTie {
-
- private RuntimeComponent component;
-
- public ComponentTie(RuntimeComponent component) {
- this.component = component;
- }
-
- public Object getService(Class<?> type, String name) {
- return component.getComponentContext().getService(type, name);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java
deleted file mode 100644
index 4fdcb52241..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/ConfigurationPropertiesExtensionPoint.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-public interface ConfigurationPropertiesExtensionPoint {
-
- boolean isAnnotationSupported();
-
- boolean isMultipleContextSupported();
-
- String getSupportedVersion();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java
deleted file mode 100644
index 94b8e0eb36..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/DefaultConfigurationPropertiesExtensionPoint.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-public class DefaultConfigurationPropertiesExtensionPoint implements ConfigurationPropertiesExtensionPoint {
-
- // Contructor
- public DefaultConfigurationPropertiesExtensionPoint() {
-
- }
-
- // By default SCA annotations for implementation.spring
- // will be supproted for Tuscany.
- public boolean isAnnotationSupported() {
- return true;
- }
-
- // By default multiple application context implementation.spring
- // will be supproted for Tuscany.
- public boolean isMultipleContextSupported() {
- return true;
- }
-
- // By defauly all the Spring version are supported for
- // Tuscany.
- public String getSupportedVersion() {
-
- // Customize the code here for a limited version
- // support
- /*
- return "2.5.5";
- */
- return "ANY";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
deleted file mode 100644
index 743abaa79b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/PropertyValueTie.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * This is the Tuscany side tie for the corresponding Spring runtime side stub class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the PropertyValueStub class
- * in the implementation-spring-runtime module for what the stub does.
- */
-public class PropertyValueTie {
-
- private RuntimeComponent component;
- private JavaPropertyValueObjectFactory propertyFactory;
-
- public PropertyValueTie(RuntimeComponent component, JavaPropertyValueObjectFactory propertyFactory) {
- this.component = component;
- this.propertyFactory = propertyFactory;
- }
-
- public Object getPropertyObj(Class<?> type, String name) {
- List<ComponentProperty> props = component.getProperties();
- for (ComponentProperty prop : props) {
- if (prop.getName().equals(name)) {
- return propertyFactory.createValueFactory(prop, prop.getValue(), type).getInstance();
- }
- }
- return null; // property name not found
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
deleted file mode 100644
index 818bc4e102..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringContextStub.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.URL;
-
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * This is the Tuscany side stub for the corresponding runtime tie class.
- * It enables the Tuscany code to invoke methods on a Spring context without
- * needing to know about any Spring classes. See the SpringContextTie class
- * in the implementation-spring-runtime module for what the tie does.
- */
-public class SpringContextStub {
-
- private Object tie;
- private Method startMethod;
- private Method closeMethod;
- private Method getBeanMethod;
-
- public SpringContextStub(RuntimeComponent component,
- SpringImplementation implementation,
- ProxyFactory proxyService,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport,
- String versionSupported,
- boolean multipleContextSupport) {
-
- initTie(component, implementation, propertyValueObjectFactory, annotationSupport, versionSupported, multipleContextSupport);
-
- }
-
- private void initTie(RuntimeComponent component,
- SpringImplementation implementation,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport,
- String versionSupported,
- boolean multipleContextSupport) {
-
- // TODO: what class loader to use?
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- try {
-
- Class<?> stubClass = Class.forName("org.apache.tuscany.sca.implementation.spring.runtime.context.SpringImplementationStub", true, cl);
- Constructor<?> stubConstructor = stubClass.getConstructor(new Class<?>[]{Object.class});
- Object stub = stubConstructor.newInstance(new SpringImplementationTie(implementation, component, propertyValueObjectFactory));
-
- Class<?> tieClass = Class.forName("org.apache.tuscany.sca.implementation.spring.runtime.context.SpringContextTie", true, cl);
- Constructor<?> tieConstructor = tieClass.getConstructor(new Class<?>[]{stubClass, URL.class, boolean.class, String.class, boolean.class});
- this.tie = tieConstructor.newInstance(stub, implementation.getResource(), annotationSupport, versionSupported, multipleContextSupport);
-
- this.startMethod = tieClass.getMethod("start");
- this.closeMethod = tieClass.getMethod("close");
- this.getBeanMethod = tieClass.getMethod("getBean", String.class);
-
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- } catch (SecurityException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(e);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public void start() {
- try {
- startMethod.invoke(tie);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public void close() {
- try {
- closeMethod.invoke(tie);
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
- public Object getBean(String id) throws SpringInvocationException {
- try {
-
- return getBeanMethod.invoke(tie, id);
-
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e);
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.java
deleted file mode 100644
index 105bb4a553..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProvider.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.implementation.spring.invocation;
-
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * A provider class for runtime Spring implementation instances
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringImplementationProvider implements ImplementationProvider {
- private RuntimeComponent component;
-
- // A Spring application context object
- private SpringContextStub springContext;
-
- private SpringImplementation implementation;
-
- private JavaPropertyValueObjectFactory propertyValueObjectFactory;
-
- /**
- * Constructor for the provider - takes a component definition and a Spring implementation
- * description
- * @param component - the component in the assembly
- * @param implementation - the implementation
- */
- public SpringImplementationProvider(RuntimeComponent component,
- SpringImplementation implementation,
- ProxyFactory proxyService,
- JavaPropertyValueObjectFactory propertyValueObjectFactory,
- boolean annotationSupport,
- String versionSupported,
- boolean multipleContextSupport) {
- super();
- this.implementation = implementation;
- this.component = component;
- this.propertyValueObjectFactory = propertyValueObjectFactory;
-
- springContext = new SpringContextStub(component, implementation, proxyService, propertyValueObjectFactory, annotationSupport, versionSupported, multipleContextSupport);
-
- } // end constructor
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- return new SpringInvoker(component, springContext, service, operation);
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- /**
- * Start this Spring implementation instance
- */
- public void start() {
- springContext.start();
- }
-
- /**
- * Stop this implementation instance
- */
- public void stop() {
- springContext.close();
- }
-
-} // end class SpringImplementationProvider
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
deleted file mode 100644
index e0d31203bc..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationProviderFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.databinding.impl.MediatorImpl;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * ImplementationProviderFactory for Spring implementation type
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- *
- */
-public class SpringImplementationProviderFactory implements ImplementationProviderFactory<SpringImplementation> {
-
- private ProxyFactory proxyFactory;
- private JavaPropertyValueObjectFactory propertyFactory;
- private ConfigurationPropertiesExtensionPoint configProperties;
- private boolean annotationSupport;
- private String versionSupported;
- private boolean multipleContextSupport;
-
- /**
- * Simple constructor
- *
- */
- public SpringImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- super();
-
- ProxyFactoryExtensionPoint proxyFactories = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- proxyFactory = new ExtensibleProxyFactory(proxyFactories);
-
- configProperties = extensionPoints.getExtensionPoint(ConfigurationPropertiesExtensionPoint.class);
- if (configProperties == null) {
- configProperties = new DefaultConfigurationPropertiesExtensionPoint();
- }
- annotationSupport = configProperties.isAnnotationSupported();
- versionSupported = configProperties.getSupportedVersion();
- multipleContextSupport = configProperties.isMultipleContextSupported();
-
- // TODO: could the runtime have a default PropertyValueObjectFactory?
- propertyFactory = new JavaPropertyValueObjectFactory(new MediatorImpl(extensionPoints));
- }
-
- /**
- * Returns a SpringImplementationProvider for a given component and Spring implementation
- * @param component the component for which implementation instances are required
- * @param implementation the Spring implementation with details of the component
- * implementation
- * @return the SpringImplementationProvider for the specified component
- */
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- SpringImplementation implementation) {
- return new SpringImplementationProvider(component,
- implementation,
- proxyFactory,
- propertyFactory,
- annotationSupport,
- versionSupported,
- multipleContextSupport);
- }
-
- /**
- * Returns the class of the Spring implementation
- */
- public Class<SpringImplementation> getModelType() {
- return SpringImplementation.class;
- }
-} // end class SpringImplementationProviderFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
deleted file mode 100644
index 0a069c032f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringImplementationTie.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * This is the Tuscany side tie for the corresponding runtime stub class.
- * It enables the Sping code in the runtime module to invoke methods on a
- * Tuscany SpringImplementation without the Spring runtime module
- * needing to know about any Tuscany classes. See the SpringImplementationStub class
- * in the implementation-spring-runtime module for what the stub does.
- */
-public class SpringImplementationTie {
-
- private SpringImplementation implementation;
- private RuntimeComponent component;
- private JavaPropertyValueObjectFactory propertyFactory;
-
- public SpringImplementationTie(SpringImplementation implementation, RuntimeComponent component, JavaPropertyValueObjectFactory propertyFactory) {
- this.implementation = implementation;
- this.component = component;
- this.propertyFactory = propertyFactory;
- }
-
- public String getURI() {
- throw new IllegalStateException("Not yet impl");
- }
-
- public String getComponentName() {
- return component.getName();
- }
- /**
- * Method to create a Java Bean for a Property value
- * @param <B> the class type of the Bean
- * @param requiredType - a Class object for the required type
- * @param name - the Property name
- * @return - a Bean of the specified property, with value set
- */
- private <B> B getPropertyBean(Class requiredType, String name) {
- B propertyObject = null;
- // Get the component's list of properties
- List<ComponentProperty> props = component.getProperties();
- for (ComponentProperty prop : props) {
- if (prop.getName().equals(name)) {
- // On finding the property, create a factory for it and create a Bean using
- // the factory
- ObjectFactory factory = propertyFactory.createValueFactory(prop, prop.getValue(), requiredType);
- propertyObject = (B)factory.getInstance();
- } // end if
- } // end for
-
- return propertyObject;
- }
-
- /**
- * Creates a proxy Bean for a reference
- * @param <B> the Business interface type for the reference
- * @param businessInterface - the business interface as a Class
- * @param referenceName - the name of the Reference
- * @return an Bean of the type defined by <B>
- */
- private <B> B getService(Class<B> businessInterface, String referenceName) {
- return component.getComponentContext().getService(businessInterface, referenceName);
- }
-
- /**
- * Get a Bean for a reference or for a property.
- *
- * @param name - the name of the Bean required
- * @param requiredType - the required type of the Bean (either a Java class or a Java interface)
- * @return Object - a Bean which matches the requested bean
- */
- public Object getBean(String name, Class requiredType) {
- System.out.println("Spring parent context - getBean called for name: " + name);
- // The expectation is that the requested Bean is either a reference or a property
- // from the Spring context
- for (Reference reference : implementation.getReferences()) {
- if (reference.getName().equals(name)) {
- // Extract the Java interface for the reference (it can't be any other interface type
- // for a Spring application context)
- if (requiredType == null) {
- JavaInterface javaInterface = (JavaInterface)reference.getInterfaceContract().getInterface();
- requiredType = javaInterface.getJavaClass();
- }
- // Create and return the proxy for the reference
- return getService(requiredType, reference.getName());
- } // end if
- } // end for
-
- // For a property, get the name and the required Java type and create a Bean
- // of that type with the value inserted.
- for (Property property : implementation.getProperties()) {
- if (property.getName().equals(name)) {
- if (requiredType == null) {
- // The following code only deals with a subset of types and was superceded
- // by the information from the implementation (which uses Classes as found
- // in the Spring implementation itself.
- //requiredType = JavaXMLMapper.getJavaType( property.getXSDType() );
- requiredType = implementation.getPropertyClass(name);
- }
- return getPropertyBean(requiredType, property.getName());
- } // end if
- } // end for
- // TODO: NoSuchBeanException
- throw new RuntimeException("Unable to find Bean with name " + name);
-
- } // end method getBean( String, Class )
-
- public Object getComponentTie() {
- return new ComponentTie(component);
- }
-
- public Object getPropertyValueTie() {
- return new PropertyValueTie(component, propertyFactory);
- }
-
- public ClassLoader getClassLoader() {
- return implementation.getClassLoader();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.java
deleted file mode 100644
index d1330f8471..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvocationException.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.implementation.spring.invocation;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SpringInvocationException extends Exception {
-
- private static final long serialVersionUID = -1157790036638157513L;
-
- public SpringInvocationException(String msg) {
- super(msg);
- }
-
- public SpringInvocationException(Throwable e) {
- super(e);
- }
-
- public SpringInvocationException(String msg,Throwable e) {
- super(msg,e);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java
deleted file mode 100644
index 3bf68a689c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/invocation/SpringInvoker.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.spring.invocation;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.implementation.spring.SpringBeanElement;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Initial implementation of a Spring bean invoker
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringInvoker implements Invoker {
-
- private Method theMethod = null;
- private Object bean;
- private SpringBeanElement beanElement;
- private boolean badInvoker = false;
-
- private SpringContextStub springContext;
- private Operation operation;
-
- /**
- * SpringInvoker constructor
- * @param component - the Spring component to invoke
- * @param service - the service to invoke
- * @param operation - the operation to invoke
- */
- public SpringInvoker(RuntimeComponent component,
- SpringContextStub springContext,
- RuntimeComponentService service,
- Operation operation) {
-
- this.springContext = springContext;
- this.operation = operation;
-
- // From the component and the service, identify the Spring Bean which is the target
- SpringImplementation theImplementation = (SpringImplementation)component.getImplementation();
- beanElement = theImplementation.getBeanFromService(service.getService());
-
- if (beanElement == null) {
- badInvoker = true;
- return;
- }
-
- } // end constructor SpringInvoker
-
- // Lazy-load the method to avoid timing problems with the Spring Context
- private void setupMethod() throws SpringInvocationException{
- try {
- bean = springContext.getBean(beanElement.getId());
- Class<?> beanClass = bean.getClass();
- theMethod = JavaInterfaceUtil.findMethod(beanClass, operation);
- //System.out.println("SpringInvoker - found method " + theMethod.getName() );
- } catch (NoSuchMethodException e) {
- throw new SpringInvocationException(e);
- }
- }
-
- private Object doInvoke(Object payload) throws SpringInvocationException {
- if (theMethod == null)
- setupMethod();
-
- if (badInvoker)
- throw new SpringInvocationException("Spring invoker incorrectly configured");
- // Invoke the method on the Spring bean using the payload, returning the results
- try {
- Object ret;
-
- if (payload != null && !payload.getClass().isArray()) {
- ret = theMethod.invoke(bean, payload);
- } else {
- ret = theMethod.invoke(bean, (Object[])payload);
- }
- return ret;
- } catch (InvocationTargetException e) {
- throw new SpringInvocationException("Spring invoker invoke method '"+ theMethod.getName()+"' error.",e.getCause());
- } catch (Exception e) {
- throw new SpringInvocationException("Spring invoker invoke method '"+ theMethod.getName()+"' error.",e);
- }
-
- } // end method doInvoke
-
- /**
- * @param msg the message to invoke on the target bean
- */
- public Message invoke(Message msg) {
- try {
- Object resp = doInvoke(msg.getBody());
- msg.setBody(resp);
- } catch (SpringInvocationException e) {
- msg.setFaultBody(e.getCause());
- }catch (Throwable e) {
- msg.setFaultBody(e);
- }
- //System.out.println("Spring Invoker - invoke called");
- return msg;
- } // end method invoke
-
-} // end class SpringInvoker
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
deleted file mode 100644
index 29dc0a38a1..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/xml/SpringImplementationProcessor.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.spring.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.ComponentType;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.spring.SpringImplementation;
-import org.apache.tuscany.sca.implementation.spring.introspect.SpringXMLComponentTypeLoader;
-import org.apache.tuscany.sca.implementation.spring.invocation.ConfigurationPropertiesExtensionPoint;
-import org.apache.tuscany.sca.implementation.spring.invocation.DefaultConfigurationPropertiesExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * SpringArtifactProcessor is responsible for processing the XML of an <implementation.spring.../>
- * element in an SCA SCDL file.
- *
- * @version $Rev: 511195 $ $Date: 2007-02-24 02:29:46 +0000 (Sat, 24 Feb 2007) $
- */
-public class SpringImplementationProcessor implements StAXArtifactProcessor<SpringImplementation> {
-
- private static final String LOCATION = "location";
- private static final String IMPLEMENTATION_SPRING = "implementation.spring";
- private static final QName IMPLEMENTATION_SPRING_QNAME = new QName(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
- private static final String MSG_LOCATION_MISSING = "Reading implementation.spring - location attribute missing";
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private ConfigurationPropertiesExtensionPoint configProperties;
- private Monitor monitor;
-
- private ModelFactoryExtensionPoint factories;
- private boolean multipleContextSupport;
-
- public SpringImplementationProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
- this.factories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.assemblyFactory = factories.getFactory(AssemblyFactory.class);
- this.javaFactory = factories.getFactory(JavaInterfaceFactory.class);
- this.policyFactory = factories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
-
- this.configProperties = extensionPoints.getExtensionPoint(ConfigurationPropertiesExtensionPoint.class);
- if (configProperties == null) {
- configProperties = new DefaultConfigurationPropertiesExtensionPoint();
- }
- this.multipleContextSupport = configProperties.isMultipleContextSupported();
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-spring-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /*
- * Read the XML and parse out the attributes.
- *
- * <implementation.spring.../> has a single required attribute:
- * "location" - which is the target URI of of an archive file or a directory that contains the Spring
- * application context files.
- * If the resource identified by the location attribute is an archive file, then the file
- * META-INF/MANIFEST.MF is read from the archive.
- * If the location URI identifies a directory, then META-INF/MANIFEST.MF must exist
- * underneath that directory.
- * If the manifest file contains a header "Spring-Context" of the format:
- * Spring-Context ::= path ( ';' path )*
- *
- * Where path is a relative path with respect to the location URI, then the set of paths
- * specified in the header identify the context configuration files.
- * If there is no MANIFEST.MF file or no Spring-Context header within that file,
- * then the default behaviour is to build an application context using all the *.xml files
- * in the METAINF/spring directory.
- */
- public SpringImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Create the Spring implementation
- SpringImplementation springImplementation = null;
-
- // Read the location attribute for the spring implementation
- String springLocation = reader.getAttributeValue(null, LOCATION);
- if (springLocation != null) {
- springImplementation = new SpringImplementation();
- springImplementation.setLocation(springLocation);
- springImplementation.setUnresolved(true);
- processComponentType(springImplementation);
- } else {
- error("LocationAttributeMissing", reader);
- //throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
-
- // Read policies
- policyProcessor.readPolicies(springImplementation, reader);
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_SPRING_QNAME.equals(reader.getName())) {
- break;
- }
- } // end while
-
- return springImplementation;
- } // end read
-
- /*
- * Handles the component type for the Spring implementation
- * @param springImplementation - a Spring implementation. The component type information
- * is created for this implementation
- *
- */
- private void processComponentType(SpringImplementation springImplementation) {
-
- // Create a ComponentType and mark it unresolved
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setUnresolved(true);
- springImplementation.setComponentType(componentType);
- } // end processComponentType
-
- /*
- * Write out the XML representation of the Spring implementation
- * <implementation.spring location="..." />
- */
- public void write(SpringImplementation springImplementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.spring>
- writer.writeStartElement(Constants.SCA10_NS, IMPLEMENTATION_SPRING);
- policyProcessor.writePolicyAttributes(springImplementation, writer);
-
- if (springImplementation.getLocation() != null) {
- writer.writeAttribute(LOCATION, springImplementation.getLocation());
- }
-
- writer.writeEndElement();
-
- } // end write
-
- /**
- * Resolves the Spring implementation - loads the Spring application-context XML and
- * derives the spring implementation componentType from it
- */
- public void resolve(SpringImplementation springImplementation, ModelResolver resolver)
- throws ContributionResolveException {
-
- if (springImplementation == null)
- return;
-
- /* Load the Spring component type by reading the Spring application context */
- SpringXMLComponentTypeLoader springLoader =
- new SpringXMLComponentTypeLoader(factories, assemblyFactory, javaFactory, policyFactory, multipleContextSupport);
- try {
- // Load the Spring Implementation information from its application context file...
- springLoader.load(springImplementation, resolver);
- } catch (ContributionReadException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- throw ce;
- }
-
- ComponentType ct = springImplementation.getComponentType();
- if (ct.isUnresolved()) {
- // If the introspection fails to resolve, try to find a side file...
- ComponentType componentType = resolver.resolveModel(ComponentType.class, ct);
- if (componentType.isUnresolved()) {
- error("UnableToResolveComponentType", resolver);
- //throw new ContributionResolveException("SpringArtifactProcessor: unable to resolve componentType for Spring component");
- } else {
- springImplementation.setComponentType(componentType);
- springImplementation.setUnresolved(false);
- }
-
- } // end if
-
- } // end method resolve
-
- public QName getArtifactType() {
- return IMPLEMENTATION_SPRING_QNAME;
- }
-
- public Class<SpringImplementation> getModelType() {
- return SpringImplementation.class;
- }
-
-} // end class SpringArtifactProcessor
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 99e362fea4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.spring.xml.SpringImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.spring,model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint
deleted file mode 100644
index efa3d5ed7c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.spring.ConfigurationPropertiesExtensionPoint
+++ /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.implementation.spring.invocation.DefaultConfigurationPropertiesExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 41e20e531f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.spring.invocation.SpringImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.spring.SpringImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/impl-spring-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/impl-spring-validation-messages.properties
deleted file mode 100644
index 6fce02664a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-spring/src/main/resources/impl-spring-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-LocationAttributeMissing = Reading implementation.spring - location attribute missing
-ContributionResolveException = ContributionResolveException occured due to:
-UnableToResolveComponentType = SpringArtifactProcessor: unable to resolve componentType for Spring component \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-web-runtime/LICENSE
deleted file mode 100644
index 6b0b1270ff..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/LICENSE
+++ /dev/null
@@ -1,203 +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-java-1.5.1/modules/implementation-web-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-web-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-web-runtime/pom.xml
deleted file mode 100644
index 413175cf64..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-web-runtime</artifactId>
- <name>Apache Tuscany SCA implementation.web Extension</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-web</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jsp_2.1_spec</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api-extension</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.web.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.web.runtime*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java
deleted file mode 100644
index bf33f7ad9e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ComponentContextServlet.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.web;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Servlet that handles the GET request for the componentContext.js script
- *
- * The script is generated by calling ScriptProcessors to output the code
- * for the SCA references, properties etc.
- */
-public class ComponentContextServlet extends HttpServlet {
- private static final long serialVersionUID = 1L;
-
- protected static final String HEADER = "/** --- Apache Tuscany componentContext.js --- */\n";
- protected static final String FOOTER = "/** --- Apache Tuscany componentContext.js EOF --- */\n";
-
- public static final String COMPONENT_CONTEXT_SCRIPT_URI = "org.apache.tuscany.sca.componentContext.js";
-
- protected transient Map<String, Object> attributes = new HashMap<String, Object>();
- protected transient ServletContext servletContext;
- private transient List<ContextScriptProcessor> contextScriptProcessors = new ArrayList<ContextScriptProcessor>();
-
- public ComponentContextServlet() {
- contextScriptProcessors.add(new JSONRPCScripProcessor());
- }
-
- @Override
- public void init(ServletConfig servletConfig) throws ServletException {
- this.servletContext = servletConfig.getServletContext();
- if (attributes.size() > 0) {
- for (String name : attributes.keySet()) {
- servletContext.setAttribute(name, attributes.get(name));
- }
- }
- }
-
- @Override
- public void doGet(HttpServletRequest req, HttpServletResponse response) throws IOException {
- response.setContentType("text/plain;charset=utf-8");
- PrintWriter out = response.getWriter();
-
- out.write(HEADER);
-
- doScriptInit(req, response);
-
- doScriptReferences(req, response);
-
- out.write(FOOTER);
-
- out.flush();
- out.close();
- }
-
- /**
- * Calls each ContextScriptProcessor once to insert any required initilization code into componentContext.js
- */
- protected void doScriptInit(HttpServletRequest req, HttpServletResponse response) throws IOException, UnsupportedEncodingException {
-
- PrintWriter out = response.getWriter();
-
- out.println("if (SCA == undefined) var SCA = new Object();");
- out.println("if (SCA.componentContext == undefined) {");
- out.println(" SCA.componentContext = new Object();");
- out.println(" SCA.componentContext.serviceNames = [];");
- out.println(" SCA.componentContext.serviceProxys = [];");
- out.println(" SCA.componentContext.getService = function(serviceName){");
- out.println(" var i = SCA.componentContext.serviceNames.indexOf(serviceName);");
- out.println(" return SCA.componentContext.serviceProxys[i];");
- out.println(" };");
- out.println(" if (componentContext == undefined) var componentContext = SCA.componentContext;");
- out.println("}");
-
- for (ContextScriptProcessor csp : contextScriptProcessors) {
- csp.scriptInit(req, response);
- }
- }
-
- /**
- * Calls each ContextScriptProcessor for each SCA reference to insert code for the reference into componentContext.js
- */
- protected void doScriptReferences(HttpServletRequest req, HttpServletResponse response) throws IOException, UnsupportedEncodingException {
-
- PrintWriter out = response.getWriter();
-
- out.write("// SCA References\n");
-
- RuntimeComponent component = (RuntimeComponent)servletContext.getAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent");
-
- for (ComponentReference cr : component.getReferences()) {
- String ref = "// SCA Reference " + cr.getName() + "\n";
- out.write(ref);
- for (ContextScriptProcessor csp : contextScriptProcessors) {
- csp.scriptReference(cr, req, response);
- }
- }
-
- out.write("\n// SCA References end.\n");
- }
-
- /**
- * Calls each ContextScriptProcessor for each SCA property to insert code for the property into componentContext.js
- */
- protected void doScriptProperties(HttpServletRequest req, HttpServletResponse response) throws IOException, UnsupportedEncodingException {
- // TODO: support properties
- }
-
- /**
- * Set an attribute on the ServletContext
- */
- public void setAttribute(String name, Object value) {
- if (servletContext != null) {
- servletContext.setAttribute(name, value);
- } else {
- attributes.put(name, value);
- }
- }
-
- public void addContextScriptProcessor(ContextScriptProcessor csp) {
- contextScriptProcessors.add(csp);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessor.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessor.java
deleted file mode 100644
index 02c99debb0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessor.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.web;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-
-public interface ContextScriptProcessor {
- void scriptInit(HttpServletRequest req, HttpServletResponse response) throws IOException;
- void scriptReference(ComponentReference cr, HttpServletRequest req, HttpServletResponse response) throws IOException;
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessorExtensionPoint.java
deleted file mode 100644
index 6d3f590309..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/ContextScriptProcessorExtensionPoint.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.implementation.web;
-
-
-public interface ContextScriptProcessorExtensionPoint {
-
- void addContextScriptProcessor(ContextScriptProcessor csp);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/DefaultContextScriptProcessorExtensionPoint.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/DefaultContextScriptProcessorExtensionPoint.java
deleted file mode 100644
index 89b951e7d2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/DefaultContextScriptProcessorExtensionPoint.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.implementation.web;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class DefaultContextScriptProcessorExtensionPoint implements ContextScriptProcessorExtensionPoint {
-
- protected ComponentContextServlet componentContextServlet;
- protected List<ContextScriptProcessor> tempCSPHolder = new ArrayList<ContextScriptProcessor>();
-
- public DefaultContextScriptProcessorExtensionPoint() {
- }
-
- public void addContextScriptProcessor(ContextScriptProcessor csp) {
- if (componentContextServlet != null) {
- componentContextServlet.addContextScriptProcessor(csp);
- } else {
- tempCSPHolder.add(csp);
- }
- }
-
- public void setComponentContextServlet(ComponentContextServlet servlet) {
- componentContextServlet = servlet;
- if (tempCSPHolder.size() > 0) {
- for (ContextScriptProcessor csp : tempCSPHolder) {
- componentContextServlet.addContextScriptProcessor(csp);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/JSONRPCScripProcessor.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/JSONRPCScripProcessor.java
deleted file mode 100644
index e4ec0d71f9..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/JSONRPCScripProcessor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.web;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-
-public class JSONRPCScripProcessor implements ContextScriptProcessor {
-
- public void scriptInit(HttpServletRequest req, HttpServletResponse response) throws IOException {
- PrintWriter out = response.getWriter();
- InputStream is = getClass().getClassLoader().getResourceAsStream("jsonrpc.js");
- if (is != null) {
- int i;
- while ((i = is.read()) != -1) {
- out.write(i);
- }
- }
-
- out.println();
- }
-
- public void scriptReference(ComponentReference cr, HttpServletRequest req, HttpServletResponse response) throws IOException {
- for (Binding b : cr.getBindings()) {
- if ("org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding".equals(b.getClass().getName())) {
- PrintWriter out = response.getWriter();
- out.println("SCA.componentContext.serviceNames.push('" + cr.getName() + "');");
- out.println("SCA.componentContext.serviceProxys.push(new JSONRpcClient('" + cr.getReference().getTargets().get(0).getName() + "').Service);");
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.java
deleted file mode 100644
index c4f39bded8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/ComponentContextProxy.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.implementation.web.runtime;
-
-import java.util.Collection;
-
-import org.apache.tuscany.sca.api.ComponentContextExtension;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.RequestContext;
-import org.osoa.sca.ServiceReference;
-
-/**
- * Proxy ComponentContext wrappering a RuntimeComponent as the
- * RuntimeComponent ComponentContext has not been created till later
- */
-public class ComponentContextProxy implements ComponentContext {
-
- protected RuntimeComponent runtimeComponent;
-
- public ComponentContextProxy(RuntimeComponent runtimeComponent) {
- this.runtimeComponent = runtimeComponent;
- }
-
- protected ComponentContext getComponentContext() {
- return runtimeComponent.getComponentContext();
- }
-
- @SuppressWarnings("unchecked")
- public <B, R extends CallableReference<B>> R cast(B arg0) throws IllegalArgumentException {
- return (R) getComponentContext().cast(arg0);
- }
-
- public <B> ServiceReference<B> createSelfReference(Class<B> arg0) {
- return getComponentContext().createSelfReference(arg0);
- }
-
- public <B> ServiceReference<B> createSelfReference(Class<B> arg0, String arg1) {
- return getComponentContext().createSelfReference(arg0, arg1);
- }
-
- public <B> B getProperty(Class<B> arg0, String arg1) {
- return getComponentContext().getProperty(arg0, arg1);
- }
-
- public RequestContext getRequestContext() {
- return getComponentContext().getRequestContext();
- }
-
- public <B> B getService(Class<B> arg0, String arg1) {
- return getComponentContext().getService(arg0, arg1);
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> arg0, String arg1) {
- return getComponentContext().getServiceReference(arg0, arg1);
- }
-
- public String getURI() {
- return getComponentContext().getURI();
- }
-
- public <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName) {
- return ((ComponentContextExtension)getComponentContext()).getServiceReferences(businessInterface, referenceName);
- }
-
- public <B> Collection<B> getServices(Class<B> businessInterface, String referenceName) {
- return ((ComponentContextExtension)getComponentContext()).getServices(businessInterface, referenceName);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
deleted file mode 100644
index 2518ba5381..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/java/org/apache/tuscany/sca/implementation/web/runtime/WebImplementationProviderFactory.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.web.runtime;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.implementation.web.ComponentContextServlet;
-import org.apache.tuscany.sca.implementation.web.ContextScriptProcessorExtensionPoint;
-import org.apache.tuscany.sca.implementation.web.DefaultContextScriptProcessorExtensionPoint;
-import org.apache.tuscany.sca.implementation.web.WebImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-public class WebImplementationProviderFactory implements ImplementationProviderFactory<WebImplementation> {
-
- private ServletHost servletHost;
- private ComponentContextServlet contextServlet;
-
- public WebImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- List<ServletHost> hosts = servletHosts.getServletHosts();
- if (!hosts.isEmpty()) {
- this.servletHost = hosts.get(0);
- }
-
- contextServlet = new ComponentContextServlet();
-
- DefaultContextScriptProcessorExtensionPoint dcspep = (DefaultContextScriptProcessorExtensionPoint)extensionPoints.getExtensionPoint(ContextScriptProcessorExtensionPoint.class);
- dcspep.setComponentContextServlet(contextServlet);
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, WebImplementation implementation) {
-
- servletHost.addServletMapping("org.osoa.sca.componentContext.js", contextServlet);
- contextServlet.setAttribute("org.osoa.sca.ComponentContext", new ComponentContextProxy(component));
- contextServlet.setAttribute("org.apache.tuscany.sca.implementation.web.RuntimeComponent", component);
-
- return new ImplementationProvider() {
- public Invoker createInvoker(RuntimeComponentService arg0, Operation arg1) {
- throw new UnsupportedOperationException("Components using implementation.web have no services");
- }
- public void start() {
- }
- public void stop() {
- }
- public boolean supportsOneWayInvocation() {
- return false;
- }
- };
- }
-
- public Class<WebImplementation> getModelType() {
- return WebImplementation.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.ContextScriptProcessorExtensionPoint b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.ContextScriptProcessorExtensionPoint
deleted file mode 100644
index 960ae30552..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.ContextScriptProcessorExtensionPoint
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.implementation.web.DefaultContextScriptProcessorExtensionPoint
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 9b769c9b10..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.web.runtime.WebImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.web.WebImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/jsonrpc.js b/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/jsonrpc.js
deleted file mode 100644
index 8eb477c2e5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web-runtime/src/main/resources/jsonrpc.js
+++ /dev/null
@@ -1,493 +0,0 @@
-/*
- * JSON-RPC JavaScript client
- *
- * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $
- *
- * Copyright (c) 2003-2004 Jan-Klaas Kollhof
- * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd
- *
- * This code is based on Jan-Klaas' JavaScript o lait library (jsolait).
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-/*
- * Modifications for Apache Tuscany:
- * - JSONRpcClient_createMethod changed so callback is last arg
- */
-
-/* escape a character */
-
-escapeJSONChar =
-function escapeJSONChar(c)
-{
- if(c == "\"" || c == "\\") return "\\" + c;
- else if (c == "\b") return "\\b";
- else if (c == "\f") return "\\f";
- else if (c == "\n") return "\\n";
- else if (c == "\r") return "\\r";
- else if (c == "\t") return "\\t";
- var hex = c.charCodeAt(0).toString(16);
- if(hex.length == 1) return "\\u000" + hex;
- else if(hex.length == 2) return "\\u00" + hex;
- else if(hex.length == 3) return "\\u0" + hex;
- else return "\\u" + hex;
-};
-
-
-/* encode a string into JSON format */
-
-escapeJSONString =
-function escapeJSONString(s)
-{
- /* The following should suffice but Safari's regex is b0rken
- (doesn't support callback substitutions)
- return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g,
- escapeJSONChar) + "\"";
- */
-
- /* Rather inefficient way to do it */
- var parts = s.split("");
- for(var i=0; i < parts.length; i++) {
- var c =parts[i];
- if(c == '"' ||
- c == '\\' ||
- c.charCodeAt(0) < 32 ||
- c.charCodeAt(0) >= 128)
- parts[i] = escapeJSONChar(parts[i]);
- }
- return "\"" + parts.join("") + "\"";
-};
-
-
-/* Marshall objects to JSON format */
-
-toJSON = function toJSON(o)
-{
- if(o == null) {
- return "null";
- } else if(o.constructor == String) {
- return escapeJSONString(o);
- } else if(o.constructor == Number) {
- return o.toString();
- } else if(o.constructor == Boolean) {
- return o.toString();
- } else if(o.constructor == Date) {
- return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}';
- } else if(o.constructor == Array) {
- var v = [];
- for(var i = 0; i < o.length; i++) v.push(toJSON(o[i]));
- return "[" + v.join(", ") + "]";
- } else {
- var v = [];
- for(attr in o) {
- if(o[attr] == null) v.push("\"" + attr + "\": null");
- else if(typeof o[attr] == "function"); /* skip */
- else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr]));
- }
- return "{" + v.join(", ") + "}";
- }
-};
-
-
-/* JSONRpcClient constructor */
-
-JSONRpcClient =
-function JSONRpcClient_ctor(serverURL, user, pass, objectID)
-{
- this.serverURL = serverURL;
- this.user = user;
- this.pass = pass;
- this.objectID = objectID;
-
- /* Add standard methods */
- if(this.objectID) {
- this._addMethods(["listMethods"]);
- var req = this._makeRequest("listMethods", []);
- } else {
- this._addMethods(["system.listMethods"]);
- var req = this._makeRequest("system.listMethods", []);
- }
- var m = this._sendRequest(req);
- this._addMethods(m);
-};
-
-
-/* JSONRpcCLient.Exception */
-
-JSONRpcClient.Exception =
-function JSONRpcClient_Exception_ctor(code, message, javaStack)
-{
- this.code = code;
- var name;
- if(javaStack) {
- this.javaStack = javaStack;
- var m = javaStack.match(/^([^:]*)/);
- if(m) name = m[0];
- }
- if(name) this.name = name;
- else this.name = "JSONRpcClientException";
- this.message = message;
-};
-
-JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490;
-JSONRpcClient.Exception.CODE_ERR_CLIENT = 550;
-JSONRpcClient.Exception.CODE_ERR_PARSE = 590;
-JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591;
-JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592;
-JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593;
-
-JSONRpcClient.Exception.prototype = new Error();
-
-JSONRpcClient.Exception.prototype.toString =
-function JSONRpcClient_Exception_toString(code, msg)
-{
- return this.name + ": " + this.message;
-};
-
-
-/* Default top level exception handler */
-
-JSONRpcClient.default_ex_handler =
-function JSONRpcClient_default_ex_handler(e) { alert(e); };
-
-
-/* Client settable variables */
-
-JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler;
-JSONRpcClient.profile_async = false;
-JSONRpcClient.max_req_active = 1;
-JSONRpcClient.requestId = 1;
-
-
-/* JSONRpcClient implementation */
-
-JSONRpcClient.prototype._createMethod =
-function JSONRpcClient_createMethod(methodName)
-{
- var fn=function()
- {
- var args = [];
- var callback = null;
- for(var i=0;i<arguments.length;i++) args.push(arguments[i]);
-
-/* TUSCANY change callback to be last arg instead of first to match binding.ajax
- if(typeof args[0] == "function") callback = args.shift();
-*/
- if(typeof args[arguments.length-1] == "function") callback = args.pop();
-
- var req = fn.client._makeRequest.call(fn.client, fn.methodName,
- args, callback);
- if(callback == null) {
- return fn.client._sendRequest.call(fn.client, req);
- } else {
- JSONRpcClient.async_requests.push(req);
- JSONRpcClient.kick_async();
- return req.requestId;
- }
- };
- fn.client = this;
- fn.methodName = methodName;
- return fn;
-};
-
-JSONRpcClient.prototype._addMethods =
-function JSONRpcClient_addMethods(methodNames)
-{
- for(var i=0; i<methodNames.length; i++) {
- var obj = this;
- var names = methodNames[i].split(".");
- for(var n=0; n<names.length-1; n++) {
- var name = names[n];
- if(obj[name]) {
- obj = obj[name];
- } else {
- obj[name] = new Object();
- obj = obj[name];
- }
- }
- var name = names[names.length-1];
- if(!obj[name]) {
- var method = this._createMethod(methodNames[i]);
- obj[name] = method;
- }
- }
-};
-
-JSONRpcClient._getCharsetFromHeaders =
-function JSONRpcClient_getCharsetFromHeaders(http)
-{
- try {
- var contentType = http.getResponseHeader("Content-type");
- var parts = contentType.split(/\s*;\s*/);
- for(var i =0; i < parts.length; i++) {
- if(parts[i].substring(0, 8) == "charset=")
- return parts[i].substring(8, parts[i].length);
- }
- } catch (e) {}
- return "UTF-8"; /* default */
-};
-
-/* Async queue globals */
-JSONRpcClient.async_requests = [];
-JSONRpcClient.async_inflight = {};
-JSONRpcClient.async_responses = [];
-JSONRpcClient.async_timeout = null;
-JSONRpcClient.num_req_active = 0;
-
-JSONRpcClient._async_handler =
-function JSONRpcClient_async_handler()
-{
- JSONRpcClient.async_timeout = null;
-
- while(JSONRpcClient.async_responses.length > 0) {
- var res = JSONRpcClient.async_responses.shift();
- if(res.canceled) continue;
- if(res.profile) res.profile.dispatch = new Date();
- try {
- res.cb(res.result, res.ex, res.profile);
- } catch(e) {
- JSONRpcClient.toplevel_ex_handler(e);
- }
- }
-
- while(JSONRpcClient.async_requests.length > 0 &&
- JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) {
- var req = JSONRpcClient.async_requests.shift();
- if(req.canceled) continue;
- req.client._sendRequest.call(req.client, req);
- }
-};
-
-JSONRpcClient.kick_async =
-function JSONRpcClient_kick_async()
-{
- if(JSONRpcClient.async_timeout == null)
- JSONRpcClient.async_timeout =
- setTimeout(JSONRpcClient._async_handler, 0);
-};
-
-JSONRpcClient.cancelRequest =
-function JSONRpcClient_cancelRequest(requestId)
-{
- /* If it is in flight then mark it as canceled in the inflight map
- and the XMLHttpRequest callback will discard the reply. */
- if(JSONRpcClient.async_inflight[requestId]) {
- JSONRpcClient.async_inflight[requestId].canceled = true;
- return true;
- }
-
- /* If its not in flight yet then we can just mark it as canceled in
- the the request queue and it will get discarded before being sent. */
- for(var i in JSONRpcClient.async_requests) {
- if(JSONRpcClient.async_requests[i].requestId == requestId) {
- JSONRpcClient.async_requests[i].canceled = true;
- return true;
- }
- }
-
- /* It may have returned from the network and be waiting for its callback
- to be dispatched, so mark it as canceled in the response queue
- and the response will get discarded before calling the callback. */
- for(var i in JSONRpcClient.async_responses) {
- if(JSONRpcClient.async_responses[i].requestId == requestId) {
- JSONRpcClient.async_responses[i].canceled = true;
- return true;
- }
- }
-
- return false;
-};
-
-JSONRpcClient.prototype._makeRequest =
-function JSONRpcClient_makeRequest(methodName, args, cb)
-{
- var req = {};
- req.client = this;
- req.requestId = JSONRpcClient.requestId++;
-
- var obj = {};
- obj.id = req.requestId;
- if (this.objectID)
- obj.method = ".obj#" + this.objectID + "." + methodName;
- else
- obj.method = methodName;
- obj.params = args;
-
- if (cb) req.cb = cb;
- if (JSONRpcClient.profile_async)
- req.profile = { "submit": new Date() };
- req.data = toJSON(obj);
-
- return req;
-};
-
-JSONRpcClient.prototype._sendRequest =
-function JSONRpcClient_sendRequest(req)
-{
- if(req.profile) req.profile.start = new Date();
-
- /* Get free http object from the pool */
- var http = JSONRpcClient.poolGetHTTPRequest();
- JSONRpcClient.num_req_active++;
-
- /* Send the request */
- if (typeof(this.user) == "undefined") {
- http.open("POST", this.serverURL, (req.cb != null));
- } else {
- http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass);
- }
-
- /* setRequestHeader is missing in Opera 8 Beta */
- try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {}
-
- /* Construct call back if we have one */
- if(req.cb) {
- var self = this;
- http.onreadystatechange = function() {
- if(http.readyState == 4) {
- http.onreadystatechange = function () {};
- var res = { "cb": req.cb, "result": null, "ex": null};
- if (req.profile) {
- res.profile = req.profile;
- res.profile.end = new Date();
- }
- try { res.result = self._handleResponse(http); }
- catch(e) { res.ex = e; }
- if(!JSONRpcClient.async_inflight[req.requestId].canceled)
- JSONRpcClient.async_responses.push(res);
- delete JSONRpcClient.async_inflight[req.requestId];
- JSONRpcClient.kick_async();
- }
- };
- } else {
- http.onreadystatechange = function() {};
- }
-
- JSONRpcClient.async_inflight[req.requestId] = req;
-
- try {
- http.send(req.data);
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- if(!req.cb) return this._handleResponse(http);
-};
-
-JSONRpcClient.prototype._handleResponse =
-function JSONRpcClient_handleResponse(http)
-{
- /* Get the charset */
- if(!this.charset) {
- this.charset = JSONRpcClient._getCharsetFromHeaders(http);
- }
-
- /* Get request results */
- var status, statusText, data;
- try {
- status = http.status;
- statusText = http.statusText;
- data = http.responseText;
- } catch(e) {
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
- JSONRpcClient.kick_async();
- throw new JSONRpcClient.Exception
- (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed");
- }
-
- /* Return http object to the pool; */
- JSONRpcClient.poolReturnHTTPRequest(http);
- JSONRpcClient.num_req_active--;
-
- /* Unmarshall the response */
- if(status != 200) {
- throw new JSONRpcClient.Exception(status, statusText);
- }
- var obj;
- try {
- eval("obj = " + data);
- } catch(e) {
- throw new JSONRpcClient.Exception(550, "error parsing result");
- }
- if(obj.error)
- throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg,
- obj.error.trace);
- var res = obj.result;
-
- /* Handle CallableProxy */
- if(res && res.objectID && res.JSONRPCType == "CallableReference")
- return new JSONRpcClient(this.serverURL, this.user,
- this.pass, res.objectID);
-
- return res;
-};
-
-
-/* XMLHttpRequest wrapper code */
-
-/* XMLHttpRequest pool globals */
-JSONRpcClient.http_spare = [];
-JSONRpcClient.http_max_spare = 8;
-
-JSONRpcClient.poolGetHTTPRequest =
-function JSONRpcClient_pool_getHTTPRequest()
-{
- if(JSONRpcClient.http_spare.length > 0) {
- return JSONRpcClient.http_spare.pop();
- }
- return JSONRpcClient.getHTTPRequest();
-};
-
-JSONRpcClient.poolReturnHTTPRequest =
-function JSONRpcClient_poolReturnHTTPRequest(http)
-{
- if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare)
- delete http;
- else
- JSONRpcClient.http_spare.push(http);
-};
-
-JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
- "MSXML2.XMLHTTP.4.0",
- "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP",
- "Microsoft.XMLHTTP" ];
-
-JSONRpcClient.getHTTPRequest =
-function JSONRpcClient_getHTTPRequest()
-{
- /* Mozilla XMLHttpRequest */
- try {
- JSONRpcClient.httpObjectName = "XMLHttpRequest";
- return new XMLHttpRequest();
- } catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) {
- try {
- JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i];
- return new ActiveXObject(JSONRpcClient.msxmlNames[i]);
- } catch (e) {}
- }
-
- /* None found */
- JSONRpcClient.httpObjectName = null;
- throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object");
-};
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/LICENSE b/branches/sca-java-1.5.1/modules/implementation-web/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/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-java-1.5.1/modules/implementation-web/NOTICE b/branches/sca-java-1.5.1/modules/implementation-web/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/pom.xml b/branches/sca-java-1.5.1/modules/implementation-web/pom.xml
deleted file mode 100644
index 45c027e991..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/pom.xml
+++ /dev/null
@@ -1,100 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-web</artifactId>
- <name>Apache Tuscany SCA Web Implementation Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-jee</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.web</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.web*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.java
deleted file mode 100644
index 86af3d7204..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementation.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.implementation.web;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-
-/**
- * The model representing an Web implementation in an SCA assembly model.
- */
-public interface WebImplementation extends Implementation {
-
- /**
- * Returns the webapp URI.
- * @return the webapp URI
- */
- String getWebURI();
-
- /**
- * Sets the Webapp URI.
- * @param uri the webapp URI
- */
- void setWebURI(String webappURI);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementationFactory.java
deleted file mode 100644
index 0cb80de03e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/WebImplementationFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.web;
-
-
-/**
- * Factory for the Web implementation model.
- */
-public interface WebImplementationFactory {
-
- /**
- * Creates a new Web implementation.
- * @return a new Web implementation
- */
- WebImplementation createWebImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationFactoryImpl.java
deleted file mode 100644
index 744fefc39b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationFactoryImpl.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.implementation.web.impl;
-
-import org.apache.tuscany.sca.implementation.web.WebImplementation;
-import org.apache.tuscany.sca.implementation.web.WebImplementationFactory;
-
-/**
- * Factory for the Web implementation model.
- */
-public class WebImplementationFactoryImpl implements WebImplementationFactory {
-
- public WebImplementationFactoryImpl() {
- }
-
- public WebImplementation createWebImplementation() {
- return new WebImplementationImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
deleted file mode 100644
index bd48f7a521..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/impl/WebImplementationImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.web.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Component;
-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.builder.ComponentPreProcessor;
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.implementation.web.WebImplementation;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * The model representing an Web implementation in an SCA assembly model.
- */
-class WebImplementationImpl extends ImplementationImpl implements WebImplementation, ComponentPreProcessor {
-
- private String webURI;
-
- /**
- * Constructs a new Web implementation.
- */
- WebImplementationImpl() {
- super();
- }
-
- @Override
- public ConstrainingType getConstrainingType() {
- // The Web implementation does not support constrainingTypes
- return null;
- }
-
- @Override
- public List<Service> getServices() {
- // The Web implementation does not offer services
- return Collections.emptyList();
- }
-
- @Override
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The Web implementation does not support constrainingTypes
- }
-
- public String getWebURI() {
- return webURI;
- }
-
- public void setWebURI(String webURI) {
- this.webURI = webURI;
- }
-
- /**
- * Use preProcess to add any references and properties dynamically
- * TODO: also support introspection and handle WEB-INF/web.componentType (spec line 503)
- */
- public void preProcess(Component component) {
- if (!(component instanceof RuntimeComponent)) {
- return;
- }
- RuntimeComponent rtc = (RuntimeComponent) component;
-
- for (Reference reference : rtc.getReferences()) {
- if (getReference(reference.getName()) == null) {
- getReferences().add(createReference(reference));
- }
- }
-
- for (Property property : rtc.getProperties()) {
- if (getProperty(property.getName()) == null) {
- getProperties().add(createProperty(property));
- }
- }
- }
-
- protected Reference getReference(String name) {
- for (Reference reference : getReferences()) {
- if (reference.getName().equals(name)) {
- return reference;
- }
- }
- return null;
- }
-
- protected Reference createReference(Reference reference) {
- Reference newReference;
- try {
- newReference = (Reference)reference.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newReference;
- }
-
- protected Property getProperty(String name) {
- for (Property property : getProperties()) {
- if (property.getName().equals(name)) {
- return property;
- }
- }
- return null;
- }
-
- protected Property createProperty(Property property) {
- Property newProperty;
- try {
- newProperty = (Property)property.clone();
- } catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // should not ever happen
- }
- return newProperty;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/PropertyProcessor.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/PropertyProcessor.java
deleted file mode 100644
index 8bee80659a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/PropertyProcessor.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.web.introspect;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.DuplicatePropertyException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalPropertyException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-
-/**
- * Class to handle annotations that add Properties.
- *
- * @version $Rev$ $Date$
- */
-public class PropertyProcessor extends BaseJavaClassVisitor {
- public PropertyProcessor(AssemblyFactory assemblyFactory) {
- super(assemblyFactory);
- }
-
- private boolean removeProperty(JavaElementImpl prop, JavaImplementation type) {
- if(prop==null) {
- return false;
- }
- List<Property> props = type.getProperties();
- for(int i=0;i<props.size();i++) {
- if(props.get(i).getName().equals(prop.getName())) {
- props.remove(i);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- org.osoa.sca.annotations.Property annotation = method.getAnnotation(org.osoa.sca.annotations.Property.class);
- if (annotation == null) {
- return;
- }
-
- if (!JavaIntrospectionHelper.isSetter(method)) {
- throw new IllegalPropertyException("Annotated method is not a setter: " + method, method);
- }
-
- String name = annotation.name();
- if (name == null || "".equals(name)) {
- name = method.getName();
- if (name.startsWith("set")) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- }
- // When the name is not specified, prefix the computed name with the class name
- name = method.getDeclaringClass().getName()+"_"+name;
- }
-
- Map<String, JavaElementImpl> properties = type.getPropertyMembers();
- JavaElementImpl prop = properties.get(name);
- // Setter override field
- if (prop != null && prop.getElementType() != ElementType.FIELD) {
- throw new DuplicatePropertyException(name);
- }
-
- removeProperty(prop, type);
-
- JavaElementImpl element = new JavaElementImpl(method, 0);
- Property property = createProperty(name, element);
-
- property.setMustSupply(annotation.required());
- type.getProperties().add(property);
- properties.put(name, element);
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
-
- org.osoa.sca.annotations.Property annotation = field.getAnnotation(org.osoa.sca.annotations.Property.class);
- if (annotation == null) {
- return;
- }
-
- String name = annotation.name();
- if (name == null) {
- name = "";
- }
- if ("".equals(name) || name.equals(field.getType().getName())) {
- name = field.getName();
- // When the name is not specified, prefix the computed name with the class name
- name = field.getDeclaringClass().getName()+"_"+name;
- }
-
- Map<String, JavaElementImpl> properties = type.getPropertyMembers();
- JavaElementImpl prop = properties.get(name);
- // Setter override field
- if (prop != null && prop.getElementType() == ElementType.FIELD) {
- throw new DuplicatePropertyException(name);
- }
-
- if (prop == null) {
- JavaElementImpl element = new JavaElementImpl(field);
- Property property = createProperty(name, element);
- property.setMustSupply(annotation.required());
- type.getProperties().add(property);
- properties.put(name, element);
- }
- }
-
- @Override
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
- throws IntrospectionException {
- }
-
- protected Property createProperty(String name, JavaElementImpl element) throws IntrospectionException {
-
- Property property = assemblyFactory.createProperty();
- property.setName(name);
- Class<?> baseType = JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
- property.setXSDType(JavaXMLMapper.getXMLType(baseType));
-
- Class<?> javaType = element.getType();
- if (javaType.isArray() || Collection.class.isAssignableFrom(javaType)) {
- property.setMany(true);
- }
- return property;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/ReferenceProcessor.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/ReferenceProcessor.java
deleted file mode 100644
index d8c44fbcf2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/introspect/ReferenceProcessor.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.web.introspect;
-
-import static org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType;
-
-import java.lang.annotation.ElementType;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Multiplicity;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
-import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.BaseJavaClassVisitor;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.DuplicateReferenceException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.IllegalReferenceException;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.annotations.Reference;
-
-/**
- * Class to handle annotations that add References.
- *
- * @version $Rev$ $Date$
- */
-public class ReferenceProcessor extends BaseJavaClassVisitor {
- private JavaInterfaceFactory javaFactory;
-
- public ReferenceProcessor(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- super(assemblyFactory);
- this.javaFactory = javaFactory;
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- Reference annotation = method.getAnnotation(Reference.class);
- if (annotation == null) {
- return; // Not a reference annotation.
- }
- if (!JavaIntrospectionHelper.isSetter(method)) {
- throw new IllegalReferenceException("Annotated method is not a setter: " + method, method);
- }
- String name = annotation.name();
- if ("".equals(name)) {
- name = JavaIntrospectionHelper.toPropertyName(method.getName());
- // When the name is not specified, prefix the computed name with the class name
- name = method.getDeclaringClass().getName()+"_"+name;
- }
- JavaElementImpl ref = type.getReferenceMembers().get(name);
- // Setter override field
- if (ref != null && ref.getElementType() != ElementType.FIELD) {
- throw new DuplicateReferenceException(name);
- }
- removeReference(ref, type);
-
- JavaElementImpl element = new JavaElementImpl(method, 0);
- org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
- type.getReferences().add(reference);
- type.getReferenceMembers().put(name, element);
- }
-
- private boolean removeReference(JavaElementImpl ref, JavaImplementation type) {
- if (ref == null) {
- return false;
- }
- List<org.apache.tuscany.sca.assembly.Reference> refs = type.getReferences();
- for (int i = 0; i < refs.size(); i++) {
- if (refs.get(i).getName().equals(ref.getName())) {
- refs.remove(i);
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void visitField(Field field, JavaImplementation type) throws IntrospectionException {
- Reference annotation = field.getAnnotation(Reference.class);
- if (annotation == null) {
- return;
- }
- String name = annotation.name();
- if ("".equals(name)) {
- name = field.getName();
- // When the name is not specified, prefix the computed name with the class name
- name = field.getDeclaringClass().getName()+"_"+name;
- }
- JavaElementImpl ref = type.getReferenceMembers().get(name);
- if (ref != null && ref.getElementType() == ElementType.FIELD) {
- throw new DuplicateReferenceException(name);
- }
-
- // Setter method override field
- if (ref == null) {
- JavaElementImpl element = new JavaElementImpl(field);
- org.apache.tuscany.sca.assembly.Reference reference = createReference(element, name);
- type.getReferences().add(reference);
- type.getReferenceMembers().put(name, element);
- }
- }
-
- @Override
- public void visitConstructorParameter(JavaParameterImpl parameter, JavaImplementation type)
- throws IntrospectionException {
- }
-
- private org.apache.tuscany.sca.assembly.Reference createReference(JavaElementImpl element, String name)
- throws IntrospectionException {
- org.apache.tuscany.sca.assembly.Reference reference = assemblyFactory.createReference();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- // reference.setMember((Member)element.getAnchor());
- boolean required = true;
- Reference ref = element.getAnnotation(Reference.class);
- if (ref != null) {
- required = ref.required();
- }
- // reference.setRequired(required);
- reference.setName(name);
- Class<?> rawType = element.getType();
- if (rawType.isArray() || Collection.class.isAssignableFrom(rawType)) {
- if (required) {
- reference.setMultiplicity(Multiplicity.ONE_N);
- } else {
- reference.setMultiplicity(Multiplicity.ZERO_N);
- }
- } else {
- if (required) {
- reference.setMultiplicity(Multiplicity.ONE_ONE);
- } else {
- reference.setMultiplicity(Multiplicity.ZERO_ONE);
- }
- }
- Type genericType = element.getGenericType();
- Class<?> baseType = getBaseType(rawType, genericType);
- if (CallableReference.class.isAssignableFrom(baseType)) {
- if (Collection.class.isAssignableFrom(rawType)) {
- genericType = JavaIntrospectionHelper.getParameterType(genericType);
- }
- baseType = JavaIntrospectionHelper.getBusinessInterface(baseType, genericType);
- }
- try {
- JavaInterface callInterface = javaFactory.createJavaInterface(baseType);
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = javaFactory.createJavaInterface(callInterface.getCallbackClass());
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- } catch (InvalidInterfaceException e) {
- throw new IntrospectionException(e);
- }
- return reference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java
deleted file mode 100644
index d79517f232..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/java/org/apache/tuscany/sca/implementation/web/xml/WebImplementationProcessor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.web.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.jee.JspReferenceTagInfo;
-import org.apache.tuscany.sca.contribution.jee.WebModuleInfo;
-import org.apache.tuscany.sca.contribution.jee.JavaEEExtension;
-import org.apache.tuscany.sca.contribution.jee.JavaEEOptionalExtension;
-import org.apache.tuscany.sca.contribution.jee.impl.WebModuleInfoImpl;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.web.WebImplementation;
-import org.apache.tuscany.sca.implementation.web.WebImplementationFactory;
-import org.apache.tuscany.sca.implementation.web.introspect.PropertyProcessor;
-import org.apache.tuscany.sca.implementation.web.introspect.ReferenceProcessor;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-
-/**
- * Implements a StAX artifact processor for Web implementations.
- */
-public class WebImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WebImplementation> {
- private static final QName IMPLEMENTATION_WEB = new QName(Constants.SCA10_NS, "implementation.web");
-
- private AssemblyFactory assemblyFactory;
- private WebImplementationFactory implementationFactory;
- private Monitor monitor;
- private JavaEEExtension jeeExtension;
- private JavaEEOptionalExtension jeeOptionalExtension;
- private JavaImplementationFactory javaImplementationFactory;
- private JavaInterfaceFactory javaInterfaceFactory;
-
- public WebImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- this.implementationFactory = modelFactories.getFactory(WebImplementationFactory.class);
- this.jeeExtension = modelFactories.getFactory(JavaEEExtension.class);
- this.jeeOptionalExtension = modelFactories.getFactory(JavaEEOptionalExtension.class);
- this.monitor = monitor;
-
- this.javaImplementationFactory = new DefaultJavaImplementationFactory();
- this.javaInterfaceFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- javaImplementationFactory.addClassVisitor(new ReferenceProcessor(assemblyFactory, javaInterfaceFactory));
- javaImplementationFactory.addClassVisitor(new PropertyProcessor(assemblyFactory));
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_WEB;
- }
-
- public Class<WebImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return WebImplementation.class;
- }
-
- public WebImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.web> element
- WebImplementation implementation = implementationFactory.createWebImplementation();
- implementation.setUnresolved(true);
-
- // Read the webapp uri attribute
- String webURI = getString(reader, "web-uri");
- if (webURI != null) {
- implementation.setWebURI(webURI);
-
- // Set the URI of the component type
- // TODO: This should point to the base uri of the WAR file
- implementation.setURI(webURI);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_WEB.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(WebImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the component type
- String uri = implementation.getURI();
- if (uri != null) {
- WebModuleInfo webModuleInfo = new WebModuleInfoImpl();
- webModuleInfo.setUri(URI.create(uri));
- webModuleInfo = resolver.resolveModel(WebModuleInfo.class, webModuleInfo);
- if(jeeOptionalExtension != null) {
- ComponentType ct = jeeOptionalExtension.createImplementationWebComponentType(webModuleInfo);
- implementation.getReferences().addAll(ct.getReferences());
- implementation.getProperties().addAll(ct.getProperties());
- }
-
- // Introspection of classes
- List<Class<?>> webArtifacts = new ArrayList<Class<?>>();
- webArtifacts.addAll(webModuleInfo.getServletClasses());
- webArtifacts.addAll(webModuleInfo.getFilterClasses());
- webArtifacts.addAll(webModuleInfo.getListenerClasses());
- webArtifacts.addAll(webModuleInfo.getJSFClasses());
- JavaImplementation ji = javaImplementationFactory.createJavaImplementation();
- for(Class<?> clazz : webArtifacts) {
- try {
- javaImplementationFactory.createJavaImplementation(ji, clazz);
- } catch (IntrospectionException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- implementation.getReferences().addAll(ji.getReferences());
- implementation.getProperties().addAll(ji.getProperties());
-
- // SCA References in JSP Tags
- for(JspReferenceTagInfo jspRefTag : webModuleInfo.getJspReferenceTags()) {
- ComponentReference ref = assemblyFactory.createComponentReference();
- ref.setName(jspRefTag.name);
- JavaInterfaceContract intfContract = javaInterfaceFactory.createJavaInterfaceContract();
- try {
- intfContract.setInterface(javaInterfaceFactory.createJavaInterface(jspRefTag.type));
- } catch (InvalidInterfaceException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- ref.setInterfaceContract(intfContract);
- implementation.getReferences().add(ref);
- }
-
- // Process componentType side file
- ComponentType componentType = assemblyFactory.createComponentType();
- componentType.setURI("WEB-INF/web.componentType");
- componentType = resolver.resolveModel(ComponentType.class, componentType);
- if (!componentType.isUnresolved()) {
-
- // Initialize the implementation's services, references and properties
- implementation.getServices().addAll(componentType.getServices());
- implementation.getReferences().addAll(componentType.getReferences());
- implementation.getProperties().addAll(componentType.getProperties());
- }
- }
- implementation.setUnresolved(false);
- }
-
- public void write(WebImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <implementation.web>
- writeStart(writer, IMPLEMENTATION_WEB.getNamespaceURI(), IMPLEMENTATION_WEB.getLocalPart(),
- new XAttr("web-uri", implementation.getWebURI()));
-
- writeEnd(writer);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 3f1e888e16..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.web.xml.WebImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.web,model=org.apache.tuscany.sca.implementation.web.WebImplementation,factory=org.apache.tuscany.sca.implementation.web.WebImplementationFactory
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.WebImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.WebImplementationFactory
deleted file mode 100644
index d54fe9fcee..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.web.WebImplementationFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.web.impl.WebImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.java
deleted file mode 100644
index 10a7df7ae5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/ReadTestCase.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.implementation.web.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.implementation.web.WebImplementation;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading Web implementations.
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestWeb.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite) staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
-
- assertTrue(((WebImplementation) composite.getComponents().get(0).getImplementation()).getWebURI().equals("MyWebapp"));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.java
deleted file mode 100644
index 723672270d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/test/java/org/apache/tuscany/sca/implementation/web/xml/WriteTestCase.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.implementation.web.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write Web implementations.
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("TestWeb.composite");
- Composite composite = (Composite) staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- assertTrue(bos.toString().contains("web-uri=\"MyWebapp\""));
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite b/branches/sca-java-1.5.1/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite
deleted file mode 100644
index 181de3772b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-web/src/test/resources/org/apache/tuscany/sca/implementation/web/xml/TestWeb.composite
+++ /dev/null
@@ -1,29 +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"
- targetNamespace="http://sample/web"
- xmlns:sc="http://sample/composite"
- name="TestWeb">
-
- <component name="TestWeb">
- <implementation.web web-uri="MyWebapp"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/LICENSE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/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-java-1.5.1/modules/implementation-widget-runtime-dojo/NOTICE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/pom.xml b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/pom.xml
deleted file mode 100644
index 1d74153e5c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/pom.xml
+++ /dev/null
@@ -1,67 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-widget-runtime-dojo</artifactId>
- <name>Apache Tuscany SCA Widget Implementation Runtime (Dojo)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-widget-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom-js</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom.js*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.java
deleted file mode 100644
index 28e8f81810..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/java/org/apache/tuscany/sca/implementation/widget/dojo/DojoJavaScriptComponentGeneratorImpl.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.implementation.widget.dojo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class DojoJavaScriptComponentGeneratorImpl implements ComponentJavaScriptGenerator {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "component.script.generator.dojo");
-
- private JavascriptProxyFactoryExtensionPoint javascriptProxyFactories;
-
- public DojoJavaScriptComponentGeneratorImpl(ExtensionPointRegistry extensionPoints) {
- this.javascriptProxyFactories = extensionPoints.getExtensionPoint(JavascriptProxyFactoryExtensionPoint.class);
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public void generateJavaScriptCode(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println();
- pw.println("/* Apache Tuscany SCA Widget header */");
- pw.println();
-
- Map<String, Boolean> bindingClientProcessed = new HashMap<String, Boolean>();
-
- for(ComponentReference reference : component.getReferences()) {
- for(Binding binding : reference.getBindings()) {
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- String bindingProxyName = jsProxyFactory.getJavascriptProxyFile();
- //check if binding client code was already processed and inject to the generated script
- if(bindingProxyName != null) {
- Boolean processedFlag = bindingClientProcessed.get(bindingProxyName);
- if( processedFlag == null || processedFlag.booleanValue() == false) {
- generateJavaScriptBindingProxy(jsProxyFactory, pw);
- bindingClientProcessed.put(bindingProxyName, Boolean.TRUE);
- }
- }
-
- }
- }
-
- //pw.println("dojo.require(\"/dojo.rpc.JsonService\");");
- //pw.println("dojo.require(\"/tuscany.AtomService\");");
-
- pw.println();
- pw.println("/* Tuscany Reference/Property injection code */");
- pw.println();
-
-
- //define tuscany.sca namespace
- generateJavaScriptNamespace(pw);
-
- pw.println();
-
- //process properties
- generateJavaScriptPropertyFunction(component, pw);
-
- pw.println();
-
- //process references
- generateJavaScriptReferenceFunction(component, javascriptProxyFactories,pw);
-
-
- pw.println();
- pw.println("/** End of Apache Tuscany SCA Widget */");
- pw.println();
- pw.flush();
- pw.close();
- }
-
-
- /**
- * Retrieve the binding proxy based on the bind name
- * and embedded the JavaScript into this js
- */
- private static void generateJavaScriptBindingProxy(JavascriptProxyFactory javascriptProxyFactory, PrintWriter pw) throws IOException {
- InputStream is = javascriptProxyFactory.getJavascriptProxyFileAsStream();
- if (is != null) {
- int i;
- while ((i = is.read()) != -1) {
- pw.write(i);
- }
- }
-
- pw.println();
- pw.println();
- }
-
- /**
- * Generate the tuscany.sca namespace if not yet available
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptNamespace(PrintWriter pw) throws IOException {
- pw.println("if (!window.tuscany) { \n" +
- "window.tuscany = {}; \n" +
- "}");
- pw.println("var __tus = window.tuscany;");
-
- pw.println("if (!__tus.sca) { \n" +
- "__tus.sca = {}; \n" +
- "}");
- }
-
-
- /**
- * Generate JavaScript code to inject SCA Properties
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptPropertyFunction(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println("__tus.sca.propertyMap = {};");
- for(ComponentProperty property : component.getProperties()) {
- String propertyName = property.getName();
-
- pw.println("__tus.sca.propertyMap." + propertyName + " = new String(\"" + getPropertyValue(property) + "\");");
- }
-
- pw.println("__tus.sca.Property = function (name) {");
- pw.println(" return __tus.sca.propertyMap[name];");
- pw.println("}");
- }
-
- /**
- * Convert property value to String
- * @param property
- * @return
- */
- private static String getPropertyValue(ComponentProperty property) {
- Document doc = (Document)property.getValue();
- Element rootElement = doc.getDocumentElement();
-
- String value = null;
-
- //FIXME : Provide support for isMany and other property types
-
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
-
- return value;
- }
-
-
-
- /**
- * Generate JavaScript code to inject SCA References
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptReferenceFunction (RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, PrintWriter pw) throws IOException {
-
- pw.println("__tus.sca.referenceMap = {};");
- for(ComponentReference reference : component.getReferences()) {
- Binding binding = reference.getBindings().get(0);
-
- if (binding != null) {
-
- String referenceName = reference.getName();
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- pw.println("__tus.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";");
-
- }
- }
-
- pw.println("__tus.sca.Reference = function (name) {");
- pw.println(" return __tus.sca.referenceMap[name];");
- pw.println("}");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator
deleted file mode 100644
index 3f503c24ee..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Generator
-org.apache.tuscany.sca.implementation.widget.dojo.DojoJavaScriptComponentGeneratorImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/LICENSE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/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-java-1.5.1/modules/implementation-widget-runtime-tuscany/NOTICE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/pom.xml b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/pom.xml
deleted file mode 100644
index 8a58fccbcd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/pom.xml
+++ /dev/null
@@ -1,110 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-widget-runtime-tuscany</artifactId>
- <name>Apache Tuscany SCA Widget Implementation Runtime (Tuscany)</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-widget-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom-abdera</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <!-- Test dependencies -->
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.atom-js</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.atom.js*</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/java/org/apache/tuscany/sca/implementation/widget/tuscany/TuscanyJavaScriptComponentGeneratorImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/java/org/apache/tuscany/sca/implementation/widget/tuscany/TuscanyJavaScriptComponentGeneratorImpl.java
deleted file mode 100644
index 21961a9094..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/java/org/apache/tuscany/sca/implementation/widget/tuscany/TuscanyJavaScriptComponentGeneratorImpl.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget.tuscany;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-public class TuscanyJavaScriptComponentGeneratorImpl implements ComponentJavaScriptGenerator {
- private static final QName NAME = new QName("http://tuscany.apache.org/xmlns/sca/1.0", "component.script.generator.tuscany");
-
- private JavascriptProxyFactoryExtensionPoint javascriptProxyFactories;
-
- public TuscanyJavaScriptComponentGeneratorImpl(ExtensionPointRegistry extensionPoints) {
- this.javascriptProxyFactories = extensionPoints.getExtensionPoint(JavascriptProxyFactoryExtensionPoint.class);
- }
-
- public QName getQName() {
- return NAME;
- }
-
- public void generateJavaScriptCode(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println();
- pw.println("/* Apache Tuscany SCA Widget header */");
- pw.println();
-
- Map<String, Boolean> bindingClientProcessed = new HashMap<String, Boolean>();
-
- for(ComponentReference reference : component.getReferences()) {
- for(Binding binding : reference.getBindings()) {
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- String bindingProxyName = jsProxyFactory.getJavascriptProxyFile();
- //check if binding client code was already processed and inject to the generated script
- if(bindingProxyName != null) {
- Boolean processedFlag = bindingClientProcessed.get(bindingProxyName);
- if( processedFlag == null || processedFlag.booleanValue() == false) {
- generateJavaScriptBindingProxy(jsProxyFactory, pw);
- bindingClientProcessed.put(bindingProxyName, Boolean.TRUE);
- }
- }
-
- }
- }
-
- pw.println();
- pw.println("/* Tuscany Reference/Property injection code */");
- pw.println();
-
-
- //define tuscany.sca namespace
- generateJavaScriptNamespace(pw);
-
- pw.println();
-
- //process properties
- generateJavaScriptPropertyFunction(component, pw);
-
- pw.println();
-
- //process references
- generateJavaScriptReferenceFunction(component, javascriptProxyFactories,pw);
-
-
- pw.println();
- pw.println("/** End of Apache Tuscany SCA Widget */");
- pw.println();
- pw.flush();
- pw.close();
- }
-
-
- /**
- * Retrieve the binding proxy based on the bind name
- * and embedded the JavaScript into this js
- */
- private static void generateJavaScriptBindingProxy(JavascriptProxyFactory javascriptProxyFactory, PrintWriter pw) throws IOException {
- InputStream is = javascriptProxyFactory.getJavascriptProxyFileAsStream();
- if (is != null) {
- int i;
- while ((i = is.read()) != -1) {
- pw.write(i);
- }
- }
-
- pw.println();
- pw.println();
- }
-
- /**
- * Generate the tuscany.sca namespace if not yet available
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptNamespace(PrintWriter pw) throws IOException {
- pw.println("if (!tuscany) { \n" +
- "var tuscany = {}; \n" +
- "}");
- pw.println("if (!tuscany.sca) { \n" +
- "tuscany.sca = {}; \n" +
- "}");
- }
-
- /**
- * Generate JavaScript code to inject SCA Properties
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptPropertyFunction(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println("tuscany.sca.propertyMap = new String();");
- for(ComponentProperty property : component.getProperties()) {
- String propertyName = property.getName();
-
- pw.println("tuscany.sca.propertyMap." + propertyName + " = new String(\"" + getPropertyValue(property) + "\");");
- }
-
- pw.println("tuscany.sca.Property = function (name) {");
- pw.println(" return tuscany.sca.propertyMap[name];");
- pw.println("}");
- }
-
- /**
- * Convert property value to String
- * @param property
- * @return
- */
- private static String getPropertyValue(ComponentProperty property) {
- Document doc = (Document)property.getValue();
- Element rootElement = doc.getDocumentElement();
-
- String value = null;
-
- //FIXME : Provide support for isMany and other property types
-
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
-
- return value;
- }
-
-
-
- /**
- * Generate JavaScript code to inject SCA References
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptReferenceFunction (RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, PrintWriter pw) throws IOException {
-
- pw.println("tuscany.sca.referenceMap = new Object();");
- for(ComponentReference reference : component.getReferences()) {
- Binding binding = reference.getBindings().get(0);
-
- if (binding != null) {
-
- String referenceName = reference.getName();
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- pw.println("tuscany.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";");
-
- }
- }
-
- pw.println("tuscany.sca.Reference = function (name) {");
- pw.println(" return tuscany.sca.referenceMap[name];");
- pw.println("}");
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator
deleted file mode 100644
index b98b940b47..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the Javascript Generator
-org.apache.tuscany.sca.implementation.widget.tuscany.TuscanyJavaScriptComponentGeneratorImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java
deleted file mode 100644
index 3b5c6f89b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationTestCase.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.widget;
-
-import java.net.Socket;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WidgetImplementationTestCase extends TestCase {
-
- private SCADomain scaDomain;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("widget.composite");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- public void testPing() throws Exception {
- new Socket("127.0.0.1", 8085);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/Catalog.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/Catalog.java
deleted file mode 100644
index 370474f29f..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/Catalog.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package store;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Interface for the Catalog Service.
- *
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface Catalog {
- String[] get();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/CatalogImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/CatalogImpl.java
deleted file mode 100644
index bed053eeee..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/CatalogImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package store;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.osoa.sca.annotations.Init;
-
-/**
- * Implementation of the Catalog Service.
- *
- * @version $Rev$ $Date$
- */
-public class CatalogImpl implements Catalog {
- private List<String> catalog = new ArrayList<String>();
-
- @Init
- public void init() {
- catalog.add("Apple - $ 2.99");
- catalog.add("Orange - $ 3.55");
- catalog.add("Pear - $ 1.55");
- }
-
- public String[] get() {
- String[] catalogArray = new String[catalog.size()];
- catalog.toArray(catalogArray);
- return catalogArray;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/ShoppingCartImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/ShoppingCartImpl.java
deleted file mode 100644
index 37e8d0161a..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/java/store/ShoppingCartImpl.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package store;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.model.Feed;
-import org.apache.tuscany.sca.binding.atom.collection.Collection;
-import org.apache.tuscany.sca.binding.atom.collection.NotFoundException;
-
-/**
- * Implementation of a Shopping Cart.
- *
- * @version $Rev$ $Date$
- */
-public class ShoppingCartImpl implements Collection {
-
- private static Map<String, Entry> cart = new HashMap<String, Entry>();
-
- public Feed getFeed() {
- Feed feed = Abdera.getNewFactory().newFeed();
- feed.setTitle("shopping cart");
- feed.setSubtitle("Total : " + getTotal());
-
- for (Entry entry : cart.values()) {
- feed.addEntry(entry);
- }
- return feed;
- }
-
- public Feed query(String queryString) {
- if (queryString.startsWith("name=")) {
- String name = queryString.substring(5);
-
- Feed feed = Abdera.getNewFactory().newFeed();
- feed.setTitle("shopping cart");
- feed.setSubtitle("Total : " + getTotal());
-
- for (Entry entry : cart.values()) {
- if (entry.getTitle().contains(name)) {
- feed.addEntry(entry);
- }
- }
- return feed;
-
- } else {
- return getFeed();
- }
- }
-
- public Entry get(String id) throws NotFoundException {
- return cart.get(id);
- }
-
- public Entry post(Entry entry) {
- System.out.println("post" + entry);
- String id = "cart-" + UUID.randomUUID().toString();
- entry.setId(id);
-
- entry.addLink(id, "edit");
- entry.addLink(id, "alternate");
-
- entry.setUpdated(new Date());
-
- cart.put(id, entry);
- return entry;
- }
-
- public void put(String id, Entry entry) throws NotFoundException {
- entry.setUpdated(new Date());
- cart.put(id, entry);
- }
-
- public void delete(String id) throws NotFoundException {
- if (id.equals(""))
- cart.clear();
- else
- cart.remove(id);
- }
-
- private String getTotal() {
- float total = 0;
- String currencySymbol = "";
- if (!cart.isEmpty()) {
- String item = ((Entry)cart.values().iterator().next()).getContent();
- // Select first symbol after dash.
- currencySymbol = item.substring(item.indexOf("-") + 2, item.indexOf("-") + 3);
- }
- for (Entry entry : cart.values()) {
- String item = entry.getContent();
-
- int index = item.length()-1;
- char digit;
- while ((digit = item.charAt(index)) == '.' || Character.isDigit(digit)) {
- index--;
- }
-
- total += Float.valueOf(item.substring(index));
- }
- return currencySymbol + String.valueOf(total);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html
deleted file mode 100644
index 95b0d10a15..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/store.html
+++ /dev/null
@@ -1,127 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>Store</TITLE>
-
-<!-- one js include per sca component -->
-<script type="text/javascript" src="store.js"></script>
-
-<script language="JavaScript">
-
- //@Reference
- var catalog = new tuscany.sca.Reference("Catalog");
-
- //@Reference
- var shoppingCart = new tuscany.sca.Reference("ShoppingCart");
-
- //@Property
- var locale = Property("locale");
-
- function catalog_getResponse(items,exception) {
- if(exception){
- alert(exception.message);
- return;
- }
- var catalog = "";
- for (var i=0; i<items.length; i++)
- catalog += '<input name="items" type="checkbox" value="' +
- items[i] + '">' + items[i]+ ' <br>';
- document.getElementById('catalog').innerHTML=catalog;
- }
-
- function shoppingCart_getResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var list = "";
- for (var i=0; i<entries.length; i++) {
- var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- list += item + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
- document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
- }
- }
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm" action="/ufs/store.html">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.del("", null);
- }
- function deleteCart() {
- shoppingCart.del("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
-
- //alert(locale);
- catalog.get(catalog_getResponse);
- shoppingCart.get("", shoppingCart_getResponse);
-</script>
-
-</head>
-
-<body>
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2>
- <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../ShoppingCart/">(feed)</a>
- </form>
- </div>
-</body>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html
deleted file mode 100644
index 2e3d76d9a3..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/storeJS.html
+++ /dev/null
@@ -1,152 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>Store</TITLE>
-
-<!-- one js include per sca component -->
-<!-- For Atom, the Tuscany JavaScript client includes the model for Atom.
- Using this JavaScript model, users can use syntax such as:
- item += "name=" + entry.getName() + ", price=" + entry.getContent()
- rather than
- item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- -->
-<script type="text/javascript" src="storeJS.js"></script>
-
-<script language="JavaScript">
-
- //@Reference
- var catalog = new tuscany.sca.Reference("Catalog");
-
- //@Reference
- var shoppingCart = new tuscany.sca.Reference("ShoppingCart");
-
- //@Property
- var locale = Property("locale");
-
- function catalog_getResponse(items,exception) {
- if(exception){
- alert(exception.message);
- return;
- }
- var catalog = "";
- for (var i=0; i<items.length; i++)
- catalog += '<input name="items" type="checkbox" value="' +
- items[i] + '">' + items[i]+ ' <br>';
- document.getElementById('catalog').innerHTML=catalog;
- }
-
- function shoppingCart_getResponse(feedDoc) {
- // var xmlString = new XMLSerializer().serializeToString(feedDoc);
- // alert("shoppingCart_getResponse feed xml=" + xmlString);
- var feed = new Feed( feedDoc );
-
- if (feed != null) {
- // var entries = feed.getElementsByTagName("entry");
- var entries = feed.getEntries();
- var list = "";
- for (var i=0; i<entries.length; i++) {
- // var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- var item = entries[ i ].getContent().getText();
- list += item + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
- // document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
- var text = feed.getSubtitle().getText();
- document.getElementById('total').innerHTML = text;
- }
- }
-
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = new Entry( "cart-item" );
- entry.setContent( items[i].value );
- var entryXML = entry.toXML();
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
-
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm" action="/ufs/store.html">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.del("", null);
- }
- function deleteCart() {
- shoppingCart.del("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
- function testFeedtoXML() {
- if(exception){
- alert(exception.message);
- return;
- }
- document.getElementById('results').innerHTML = text;
- }
-
- //alert(locale);
- catalog.get(catalog_getResponse);
- shoppingCart.get("", shoppingCart_getResponse);
-</script>
-
-</head>
-
-<body>
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2>
- <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../ShoppingCart/">(feed)</a>
- </form>
- </div>
-</body>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html
deleted file mode 100644
index 352dd85508..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/content/unitTests.html
+++ /dev/null
@@ -1,250 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<html>
-<head>
-<title>Atom JavaScript Client Unit Tests</title>
-
-<!-- Include Tuscany JavaScript client model for Atom.
- Using this JavaScript model, users can use syntax such as:
- item += "name=" + entry.getName() + ", price=" + entry.getContent()
- rather than
- item += entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- -->
-<script type="text/javascript" src="atomModel.js"></script>
-
-<script language="JavaScript">
-
- function testUritoXML() {
- var test = new Uri( "http://example.org/edit/first-post.atom" );
- var text = text.toXML();
- alert( "Uri=" + text );
- }
-
- function testEmailtoXML() {
- var test = new Email( "john.doe@ibm.com" );
- var text = test.toXML();
- alert( "Email=" + text );
- }
-
- function testIdtoXML() {
- var test = new Id( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" );
- var text = test.toXML();
- alert( "Id=" + text );
- }
-
- function testLogotoXML() {
- var test = new Logo( "goofyGraphic.png" );
- var text = test.toXML();
- alert( "Logo=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testTexttoXML() {
- var test = new Text( "This is ordinary text." );
- var text = test.toXML();
- alert( "Text=" + text );
- var test = new Text( "This is <b>HTML</b> text.", "html" );
- var text = test.toXML( "supertext" );
- alert( "Text=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testPersontoXML() {
- var test = new Person( "John Doe", "john.doe@ibm.com" );
- var text = test.toXML();
- alert( "Person=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testGeneratortoXML() {
- var test = new Generator( "Power Station", "http://www.powerstation.com" );
- var text = test.toXML();
- alert( "Generator=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testCategorytoXML() {
- var test = new Category( "CategoryXYZ", "http://www.site.com/?category=CategoryXYZ" );
- var text = test.toXML();
- alert( "Category=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testLinktoXML() {
- var test = new Link( "http://example.org/edit/first-post.atom", "edit" );
- var text = test.toXML();
- alert( "Link=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testEntrytoXML() {
- // <?xml version="1.0"?>
- // <entry xmlns="http://www.w3.org/2005/Atom">
- // <title>Atom-Powered Robots Run Amok</title>
- // <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
- // <updated>2003-12-13T18:30:02Z</updated>
- // <author><name>John Doe</name></author>
- // <content>Some text.</content>
- // <link rel="edit" href="http://example.org/edit/first-post.atom"/>
- // </entry>
-
- var entry = new Entry();
- entry.setNamespace( "http://www.w3.org/2005/Atom" );
- entry.setTitle( "Atom-Powered Robots Run Amok" );
- entry.setId( "urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a" );
- entry.setUpdated( "2003-12-13T18:30:02Z" );
- entry.setContent( "Some text." );
- entry.addAuthor( new Person( "John Doe" ) );
- entry.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" ));
- entry.addContributor( new Person( "Sam Ruby" ));
- entry.addContributor( new Person( "Joe Gregorio" ));
- entry.addLink( new Link( "http://example.org/edit/first-post.atom", "edit" ));
- var text = entry.toXML();
-
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function testFeedtoXML() {
- // <feed xmlns="http://www.w3.org/2005/Atom">
- // <title type="text">dive into mark</title>
- // <subtitle type="html">A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless </subtitle>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <id>tag:example.org,2003:3</id>
- // <link rel="alternate" type="text/html" hreflang="en" href="http://example.org/"/>
- // <link rel="self" type="application/atom+xml" href="http://example.org/feed.atom"/>
- // <rights>Copyright (c) 2003, Mark Pilgrim</rights>
- // <generator uri="http://www.example.com/" version="1.0">Example Toolkit</generator>
- // <entry>
- // <title>Atom draft-07 snapshot</title>
- // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/>
- // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- // <id>tag:example.org,2003:3.2397</id>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <published>2003-12-13T08:29:29-04:00</published>
- // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author>
- // <contributor><name>Sam Ruby</name></contributor>
- // <contributor><name>Joe Gregorio</name></contributor>
- // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/">
- // <div xmlns="http://www.w3.org/1999/xhtml">
- // <p><i>[Update: The Atom draft is finished.]</i></p>
- // </div>
- // </content>
- // </entry>
- // <entry>
- // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title>
- // <category term="triathlons"/>
- // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id>
- // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/>
- // <published>2008-09-05T14:09:32-05:00</published>
- // <updated>2008-09-06T08:49:12-05:00</updated>
- // <summary type='html'>
- // &lt;a href='http://www.io.com/~beckerdo/triathlons/besthills.html'&gt;&lt;img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'&gt;&lt;/a&gt;
- // A description and Google maps of the best running and biking hills in Austin, Texas.
- // </summary>
- // </entry>
- // </feed>
-
- var feed = new Feed( "Dive into Mark" );
- feed.setSubtitle( new Text( "A &lt;em&gt;lot&lt;/em&gt; of effort went into making this effortless", "html" ));
- feed.setUpdated( "2005-07-31T12:29:29Z" );
- feed.setId( "tag:example.org,2003:3" );
- var link = new Link( "http://example.org", "alternate" );
- link.setMimeType( "text/html" );
- link.setHRefLang( "en" );
- feed.addLink( link );
- feed.addLink( new Link( "http://example.org/feed.atom", "self" ));
- feed.setRights( "Copyright (c) 2003, Mark Pilgrim" );
- feed.setGenerator( new Generator( "Example Toolkit", "http://www.example.com/" ));
- feed.addAuthor( new Person( "Mark Pilgrim", "f8dy@example.com" ));
- feed.addContributor( new Person( "Sam Ruby" ));
- feed.addContributor( new Person( "Joe Gregorio" ));
- // <entry>
- // <title>Atom draft-07 snapshot</title>
- // <link rel="alternate" type="text/html" href="http://example.org/2005/04/02/atom"/>
- // <link rel="enclosure" type="audio/mpeg" length="1337" href="http://example.org/audio/ph34r_my_podcast.mp3"/>
- // <id>tag:example.org,2003:3.2397</id>
- // <updated>2005-07-31T12:29:29Z</updated>
- // <published>2003-12-13T08:29:29-04:00</published>
- // <author><name>Mark Pilgrim</name><uri>http://example.org/</uri><email>f8dy@example.com</email></author>
- // <contributor><name>Sam Ruby</name></contributor>
- // <contributor><name>Joe Gregorio</name></contributor>
- // <content type="xhtml" xml:lang="en" xml:base="http://diveintomark.org/">
- // <div xmlns="http://www.w3.org/1999/xhtml">
- // <p><i>[Update: The Atom draft is finished.]</i></p>
- // </div>
- // </content>
- // </entry>
- // <entry>
- // <title>Dan Becker's Triathlon Site - Best Hills In Austin</title>
- // <category term="triathlons"/>
- // <id>tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html</id>
- // <link href="http://www.io.com/~beckerdo/triathlons/besthills.html"/>
- // <published>2008-09-05T14:09:32-05:00</published>
- // <updated>2008-09-06T08:49:12-05:00</updated>
- // <summary type='html'>
- // &lt;a href='http://www.io.com/~beckerdo/triathlons/besthills.html'&gt;&lt;img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'&gt;&lt;/a&gt;
- // A description and Google maps of the best running and biking hills in Austin, Texas.
- // </summary>
- // </entry>
- // </feed>
- var entry = new Entry( "Dan Becker's Triathlon Site - Best Hills In Austin" );
- entry.addCategory( new Category( "running" ));
- entry.addCategory( new Category( "triathlons" ));
- entry.setId( "tag:www.io.com,2008-09-05:/~beckerdo/triathlons/besthills.html" );
- entry.addLink( new Link ( "http://www.io.com/~beckerdo/triathlons/besthills.html" ));
- entry.setPublished( "2008-09-05T14:09:32-05:00" );
- entry.setUpdated( "2008-09-06T08:49:12-05:00" );
- entry.setSummary( new Text (
- "&lt;a href='http://www.io.com/~beckerdo/triathlons/besthills.html'&gt;&lt;img src='http://www.io.com/~beckerdo/pictures/LittleDan25.png' width='25' height='25' alt='Little Dan' align='left'&gt;&lt;/a&gt;\n" +
- "A description and Google maps of the best running and biking hills in Austin, Texas.", "html" ));
- feed.addEntry( entry );
-
- var text = feed.toXML();
- alert( "Feed xml=" + text );
- document.getElementById('results').innerHTML = removeBrackets( text );
- }
-
- function removeBrackets( input ) {
- input = input.replace( /</g, "&lt;" ); // replaceAll
- input = input.replace( />/g, "&gt;" ); // replaceAll
- return input;
- }
-</script>
-</head>
-
-<body>
-<h1>Atom JavaScript Client Unit Tests</h1>
-<p>This document tests the serialization and deserialization of the Atom JavaScript client.
- <h2>Model to XML Tests</h2>
- <input type="button" onClick="testUritoXML()" value="Uri to XML"><br>
- <input type="button" onClick="testEmailtoXML()" value="Email to XML"><br>
- <input type="button" onClick="testIdtoXML()" value="Id to XML"><br>
- <input type="button" onClick="testLogotoXML()" value="Logo to XML"><br>
- <input type="button" onClick="testTexttoXML()" value="Text to XML"><br>
- <input type="button" onClick="testPersontoXML()" value="Person to XML"><br>
- <input type="button" onClick="testGeneratortoXML()" value="Generator to XML"><br>
- <input type="button" onClick="testCategorytoXML()" value="Category to XML"><br>
- <input type="button" onClick="testLinktoXML()" value="Link to XML"><br>
- <input type="button" onClick="testEntrytoXML()" value="Entry to XML"><br>
- <input type="button" onClick="testFeedtoXML()" value="Feed to XML"><br>
- <h2>Results</h2>
- <code id="results">
- </code>
-</body>
-</html>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widget.composite b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widget.composite
deleted file mode 100644
index f23d6a20f5..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widget.composite
+++ /dev/null
@@ -1,54 +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"
- targetNamespace="http://sample/resource"
- xmlns:sr="http://sample/resource"
- name="resource">
-
- <component name="store">
- <tuscany:implementation.widget location="content/store.html"/>
- <property name="locale">en</property>
- <service name="Widget">
- <tuscany:binding.http uri="http://localhost:8085/store"/>
- </service>
- <reference name="Catalog" target="Catalog">
- <tuscany:binding.jsonrpc uri="http://localhost:8085/Catalog"/>
- </reference>
- <reference name="ShoppingCart" target="ShoppingCart">
- <tuscany:binding.atom uri="http://localhost:8085/ShoppingCart"/>
- </reference>
- </component>
-
- <component name="Catalog">
- <implementation.java class="store.CatalogImpl"/>
- <service name="Catalog">
- <tuscany:binding.jsonrpc uri="http://localhost:8085/Catalog"/>
- </service>
- </component>
-
- <component name="ShoppingCart">
- <implementation.java class="store.ShoppingCartImpl"/>
- <service name="Collection">
- <tuscany:binding.atom uri="http://localhost:8085/ShoppingCart"/>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite b/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite
deleted file mode 100644
index e44a56e520..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime-tuscany/src/test/resources/widgetJS.composite
+++ /dev/null
@@ -1,58 +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"
- targetNamespace="http://sample/resource"
- xmlns:sr="http://sample/resource"
- name="resource">
-
- <component name="storeJS">
- <!-- Note: the store.html and storeJS.html clients are similar
- except that store.html edits the client document using JavaScript
- and many node queries, and storeJS.html uses the client Atom
- JavaScript mode (fewer node queries and less XML knowledge needed.-->
- <tuscany:implementation.widget location="content/storeJS.html"/>
- <property name="locale">en</property>
- <service name="Widget">
- <tuscany:binding.http uri="/storeJS"/>
- </service>
- <reference name="Catalog" target="Catalog">
- <tuscany:binding.jsonrpc uri="/Catalog"/>
- </reference>
- <reference name="ShoppingCart" target="ShoppingCart">
- <tuscany:binding.atom uri="/ShoppingCart"/>
- </reference>
- </component>
-
- <component name="Catalog">
- <implementation.java class="store.CatalogImpl"/>
- <service name="Catalog">
- <tuscany:binding.jsonrpc uri="/Catalog"/>
- </service>
- </component>
-
- <component name="ShoppingCart">
- <implementation.java class="store.ShoppingCartImpl"/>
- <service name="Collection">
- <tuscany:binding.atom uri="/ShoppingCart"/>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/LICENSE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/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-java-1.5.1/modules/implementation-widget-runtime/NOTICE b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/pom.xml b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/pom.xml
deleted file mode 100644
index 95f9cfca25..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/pom.xml
+++ /dev/null
@@ -1,92 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-widget-runtime</artifactId>
- <name>Apache Tuscany SCA Widget Implementation Runtime</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-widget</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-web-javascript</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.widget.runtime</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.widget*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java
deleted file mode 100644
index 33db45c7cd..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptGenerator.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.net.URISyntaxException;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.ComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory;
-import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * This helper class concatenates the necessary JavaScript client code into a
- * single JavaScript per component
- * @version $Rev$ $Date$
- */
-public class WidgetComponentScriptGenerator {
-
- public static InputStream generateWidgetCode(RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories) throws IOException, URISyntaxException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter(bos);
-
- generateWidgetCode(component, javascriptProxyFactories, pw);
-
- return new ByteArrayInputStream(bos.toByteArray());
- }
-
- public static void generateWidgetCode(RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, OutputStream os) throws IOException, URISyntaxException {
- PrintWriter pw = new PrintWriter(os);
-
- generateWidgetCode(component, javascriptProxyFactories, pw);
- }
-
-
- /**
- * This helper class concatenates the necessary JavaScript client code into a
- * single JavaScript per component
- */
- public static void generateWidgetCode(RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, PrintWriter pw) throws IOException, URISyntaxException {
- pw.println();
- pw.println("/* Apache Tuscany SCA Widget header */");
- pw.println();
-
- Map<String, Boolean> bindingClientProcessed = new HashMap<String, Boolean>();
-
- for(ComponentReference reference : component.getReferences()) {
- for(Binding binding : reference.getBindings()) {
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- String bindingProxyName = jsProxyFactory.getJavascriptProxyFile();
- //check if binding client code was already processed and inject to the generated script
- if(bindingProxyName != null) {
- Boolean processedFlag = bindingClientProcessed.get(bindingProxyName);
- if( processedFlag == null || processedFlag.booleanValue() == false) {
- generateJavaScriptBindingProxy(jsProxyFactory, pw);
- bindingClientProcessed.put(bindingProxyName, Boolean.TRUE);
- }
- }
-
- }
- }
-
- pw.println();
- pw.println("/* Tuscany Reference/Property injection code */");
- pw.println();
-
-
- //define tuscany.sca namespace
- generateJavaScriptNamespace(pw);
-
- pw.println();
-
- //process properties
- generateJavaScriptPropertyFunction(component, pw);
-
- pw.println();
-
- //process references
- generateJavaScriptReferenceFunction(component, javascriptProxyFactories,pw);
-
-
- pw.println();
- pw.println("/** End of Apache Tuscany SCA Widget */");
- pw.println();
- pw.flush();
- pw.close();
-
-
- }
-
-
- /**
- * Retrieve the binding proxy based on the bind name
- * and embedded the JavaScript into this js
- */
- private static void generateJavaScriptBindingProxy(JavascriptProxyFactory javascriptProxyFactory, PrintWriter pw) throws IOException {
- InputStream is = javascriptProxyFactory.getJavascriptProxyFileAsStream();
- if (is != null) {
- int i;
- while ((i = is.read()) != -1) {
- pw.write(i);
- }
- }
-
- pw.println();
- pw.println();
- }
-
- /**
- * Generate the tuscany.sca namespace if not yet available
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptNamespace(PrintWriter pw) throws IOException {
- pw.println("if (!tuscany) { \n" +
- "var tuscany = {}; \n" +
- "}");
- pw.println("if (!tuscany.sca) { \n" +
- "tuscany.sca = {}; \n" +
- "}");
- }
-
- /**
- * Generate JavaScript code to inject SCA Properties
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptPropertyFunction(RuntimeComponent component, PrintWriter pw) throws IOException {
- pw.println("tuscany.sca.propertyMap = new String();");
- for(ComponentProperty property : component.getProperties()) {
- String propertyName = property.getName();
-
- pw.println("tuscany.sca.propertyMap." + propertyName + " = \"" + getPropertyValue(property) + "\"");
- }
-
- pw.println("tuscany.sca.Property = function (name) {");
- pw.println(" return tuscany.sca.propertyMap[name];");
- pw.println("}");
- }
-
- /**
- * Convert property value to String
- * @param property
- * @return
- */
- private static String getPropertyValue(ComponentProperty property) {
- Document doc = (Document)property.getValue();
- Element rootElement = doc.getDocumentElement();
-
- String value = null;
-
- //FIXME : Provide support for isMany and other property types
-
- if (rootElement.getChildNodes().getLength() > 0) {
- value = rootElement.getChildNodes().item(0).getTextContent();
- }
-
- return value;
- }
-
-
-
- /**
- * Generate JavaScript code to inject SCA References
- * @param pw
- * @throws IOException
- */
- private static void generateJavaScriptReferenceFunction (RuntimeComponent component, JavascriptProxyFactoryExtensionPoint javascriptProxyFactories, PrintWriter pw) throws IOException, URISyntaxException {
-
- pw.println("tuscany.sca.referenceMap = new Object();");
- for(ComponentReference reference : component.getReferences()) {
- Binding binding = reference.getBindings().get(0);
-
- if (binding != null) {
-
- String referenceName = reference.getName();
- JavascriptProxyFactory jsProxyFactory = javascriptProxyFactories.getProxyFactory(binding.getClass());
-
- pw.println("tuscany.sca.referenceMap." + referenceName + " = new " + jsProxyFactory.createJavascriptReference(reference) + ";");
-
- }
- }
-
- pw.println("tuscany.sca.Reference = function (name) {");
- pw.println(" return tuscany.sca.referenceMap[name];");
- pw.println("}");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptServlet.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptServlet.java
deleted file mode 100644
index a28e014b2e..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetComponentScriptServlet.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.implementation.widget.provider;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-
-
-/**
- * Servlet to handle requests for the widget component .js script.
- *
- * @version $Rev$ $Date$
- */
-public class WidgetComponentScriptServlet extends HttpServlet {
- private static final long serialVersionUID = 2454705532282398190L;
-
- private transient ComponentJavaScriptGenerator javaScriptgenerator;
- private transient RuntimeComponent component;
-
-
- /**
- * Constructor receiving the runtimeComponent reference that is going to be used to generate the widget client js
- * @param component
- */
- public WidgetComponentScriptServlet(RuntimeComponent component, ComponentJavaScriptGenerator javaScriptgenerator) {
- this.component = component;
- this.javaScriptgenerator = javaScriptgenerator;
- }
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- ServletOutputStream os = response.getOutputStream();
- PrintWriter pw = new PrintWriter(os);
-
- javaScriptgenerator.generateJavaScriptCode(component, pw);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java
deleted file mode 100644
index 28a1f6d1db..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationInvoker.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget.provider;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-
-
-/**
- * Implements an invoker for resource component implementations.
- *
- * @version $Rev$ $Date$
- */
-class WidgetImplementationInvoker implements Invoker {
- private RuntimeComponent component;
- private ComponentJavaScriptGenerator javaScriptGenerator;
- private String widgetName;
- private String widgetFolderURL;
- private String widgetLocationURL;
-
- WidgetImplementationInvoker(RuntimeComponent component, ComponentJavaScriptGenerator javaScriptGenerator, String widgetName, String widgetFolderURL, String widgetLocationURL) {
- this.component = component;
- this.javaScriptGenerator = javaScriptGenerator;
- this.widgetName = widgetName + ".js";
- this.widgetFolderURL = widgetFolderURL;
- this.widgetLocationURL = widgetLocationURL;
- }
-
- public Message invoke(Message msg) {
-
- // Get the resource id from the request message
- String id = (String)((Object[])msg.getBody())[0];
- try {
-
- if (id.length() == 0) {
-
- // Return an input stream for the widget resource
- URL url = new URL(widgetLocationURL);
- InputStream is = url.openStream();
- msg.setBody(is);
-
- } else if (id.equals(widgetName)) {
-
- // Generate JavaScript header for use in the Widget
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- PrintWriter pw = new PrintWriter(bos);
-
- javaScriptGenerator.generateJavaScriptCode(component, pw);
-
- InputStream is = new ByteArrayInputStream(bos.toByteArray());
-
- msg.setBody(is);
-
- } else {
-
- // Return an input stream for a resource inside the
- // widget folder
- URL url = new URL(widgetFolderURL +'/' + id);
- InputStream is = url.openStream();
- msg.setBody(is);
- }
- } catch (MalformedURLException e) {
-
- // Report exception as a fault
- msg.setFaultBody(e);
-
- } catch (IOException e) {
-
- // Report exception as a fault
- msg.setFaultBody(e);
- }
- return msg;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java
deleted file mode 100644
index 08f2fbe679..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProvider.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.widget.provider;
-
-import java.net.URI;
-
-import javax.servlet.Servlet;
-
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-class WidgetImplementationProvider implements ImplementationProvider {
-
- private RuntimeComponent component;
-
- private ComponentJavaScriptGenerator javaScriptGenerator;
- private ServletHost servletHost;
-
- private String widgetLocationURL;
- private String widgetFolderURL;
- private String widgetName;
-
- private String scriptURI;
-
- /**
- * Constructs a new resource implementation provider.
- */
- WidgetImplementationProvider(RuntimeComponent component,
- WidgetImplementation implementation,
- ComponentJavaScriptGenerator javaScriptGenerator,
- ServletHost servletHost) {
- this.component = component;
-
- this.javaScriptGenerator = javaScriptGenerator;
- this.servletHost = servletHost;
-
- widgetLocationURL = implementation.getLocationURL().toString();
- int s = widgetLocationURL.lastIndexOf('/');
- widgetFolderURL = widgetLocationURL.substring(0, s);
- widgetName = widgetLocationURL.substring(s +1);
- widgetName = widgetName.substring(0, widgetName.lastIndexOf('.'));
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- WidgetImplementationInvoker invoker = new WidgetImplementationInvoker(component, javaScriptGenerator, widgetName, widgetFolderURL, widgetLocationURL);
- return invoker;
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
- String contextRoot = getContextRoot();
-
- // get the ScaDomainScriptServlet, if it doesn't yet exist create one
- // this uses removeServletMapping / addServletMapping as there is no getServletMapping facility
- scriptURI = URI.create(contextRoot + "/" + this.widgetName + ".js").toString();
- Servlet servlet = servletHost.getServletMapping(scriptURI);
- if (servlet == null /*|| servlet instanceof HTTPGetListenerServlet*/) {
- WidgetComponentScriptServlet widgetScriptServlet;
- widgetScriptServlet = new WidgetComponentScriptServlet(this.component, javaScriptGenerator);
- servletHost.addServletMapping(scriptURI, widgetScriptServlet);
- }
- }
-
- public void stop() {
- // Unregister the component client script Servlet
- WidgetComponentScriptServlet widgetScriptServlet = (WidgetComponentScriptServlet) servletHost.getServletMapping(scriptURI);
- if (widgetScriptServlet != null) {
- // Remove the Servlet mapping
- servletHost.removeServletMapping(scriptURI);
- }
- }
-
-
- /**
- * Get the contextRoot considering the HTTP Binding URI when in a embedded environment
- * @return
- */
- private String getContextRoot() {
- String contextRoot = null;
-
- for(ComponentService service : component.getServices()) {
- if("Widget".equals(service.getName())) {
- for(org.apache.tuscany.sca.assembly.Binding binding : service.getBindings()) {
- if( binding.getClass().getName().contains("HTTPBinding")) {
- contextRoot = binding.getURI();
- }
- }
- }
- }
-
- return contextRoot == null ? "" : contextRoot;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.java
deleted file mode 100644
index aaf09f062d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/java/org/apache/tuscany/sca/implementation/widget/provider/WidgetImplementationProviderFactory.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.implementation.widget.provider;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGenerator;
-import org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGeneratorExtensionPoint;
-
-/**
- * The model representing a resource implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class WidgetImplementationProviderFactory implements ImplementationProviderFactory<WidgetImplementation> {
- private ServletHost servletHost;
- private ComponentJavaScriptGenerator javaScriptGenerator;
-
- /**
- * Constructs a resource implementation.
- */
- public WidgetImplementationProviderFactory(ExtensionPointRegistry extensionPoints) {
- ServletHostExtensionPoint servletHosts = extensionPoints.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
-
- ComponentJavaScriptGeneratorExtensionPoint javascriptGeneratorExtensionPoint = extensionPoints.getExtensionPoint(ComponentJavaScriptGeneratorExtensionPoint.class);
- javaScriptGenerator = javascriptGeneratorExtensionPoint.getComponentJavaScriptGenerators().get(0);
-
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component, WidgetImplementation implementation) {
- return new WidgetImplementationProvider(component, implementation, javaScriptGenerator, servletHost);
- }
-
- public Class<WidgetImplementation> getModelType() {
- return WidgetImplementation.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index d0f73cbdbb..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.widget.provider.WidgetImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.widget.WidgetImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/atomModel.js b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/atomModel.js
deleted file mode 100644
index c64c3fc97c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/atomModel.js
+++ /dev/null
@@ -1,1590 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Class that defines a URI represented as a string,
- */
-function Uri( value ) {
- this.value = value;
- this.getValue = function() {
- return this.value;
- };
-
- this.setValue = function(value) {
- this.value = value;
- };
-
- this.toString = function() {
- return "Uri value=" + this.value;
- };
-
- /**
- * Serialize this element to XML.
- * atomUri = text
- */
- this.toXML = function() {
- xml = "<uri>";
- xml += this.value;
- xml += "</uri>\n";
- return xml;
- };
-}
-
-/* Updated is Date */
-/* Published is Date */
-
-/**
- * Class that defines an Email represented as a string,
- */
-function Email( value ) {
- this.value = value;
- this.getValue = function() {
- return this.value;
- };
-
- this.setValue = function(value) {
- this.value = value;
- };
-
- this.toString = function() {
- return "Email value=" + this.value;
- };
-
- /**
- * Serialize this element to XML.
- * atomEmailAddress = xsd:string { pattern = ".+@.+" }
- */
- this.toXML = function() {
- xml = "<email>";
- xml += this.value;
- xml += "</email>\n";
- return xml;
- };
-}
-
-/**
- * Class that defines an Id represented as a string,
- */
-function Id( value ) {
- this.value = value;
- this.getValue = function() {
- return this.value;
- };
-
- this.setValue = function(value) {
- this.value = value;
- };
-
- this.toString = function() {
- return "Id value=" + this.value;
- };
-
- /**
- * Serialize this element to XML.
- * atomId = element atom:id {
- * atomCommonAttributes,
- * (atomUri)
- * }
- */
- this.toXML = function() {
- xml = "<id";
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += ">";
- xml += this.value;
- xml += "</id>\n";
- return xml;
- };
-}
-
-
-/**
- * Class that defines an Id represented as a string,
- */
-function Logo( value ) {
- this.value = value;
- this.getValue = function() {
- return this.value;
- };
-
- this.setValue = function(value) {
- this.value = value;
- };
-
-
- this.toString = function() {
- return "Logo value=" + this.value;
- };
-
- /**
- * Serialize this element to XML.
- * atomLogo = element atom:logo {
- * atomCommonAttributes,
- * (atomUri)
- * }
- */
- this.toXML = function() {
- xml = "<logo";
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += ">";
- xml += this.value;
- xml += "</logo>\n";
- return xml;
- };
-}
-
-/**
- * Class that defines a Text object.
- */
-function Text( content, /* optional */ type ) {
- this.content = content;
- this.type = type;
- if (type == null) this.type = "text"; // If undefined or null, use text
-
- this.setText = function(content) {
- this.content = content;
- };
-
- this.getText = function() {
- return this.content;
- };
-
- this.getValue = function() {
- return this.content;
- };
-
- this.setType = function(type) {
- if ((type != "text") && (type != "html") && (type != "xhtml")) {
- error( "Text type must be one of text, html, or xhtml" );
- }
- this.type = type;
- };
-
- this.getType = function() {
- return this.type;
- };
-
- this.setLang = function(lang) {
- this.lang = lang;
- };
-
- this.getLang = function() {
- return this.lang;
- };
-
- this.setUri = function(uri) {
- this.uri = new Uri( uri );
- };
-
- this.getUri = function() {
- return this.uri;
- };
-
- this.toString = function() {
- return "Text type=" + this.type + ", content=" + this.content;
- };
-
- /** Serialize this text element to XML.
- * atomPlainTextConstruct =
- * atomCommonAttributes,
- * attribute type { "text" | "html" }?,
- * text
- *
- * atomXHTMLTextConstruct =
- * atomCommonAttributes,
- * attribute type { "xhtml" },
- * xhtmlDiv
- *
- * atomTextConstruct = atomPlainTextConstruct | atomXHTMLTextConstruct
- */
- this.toXML = function( elementName ) {
- if ( elementName == null ) {
- elementName = "text";
- }
- xml = "<" + elementName;
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += " type=\"" + this.type + "\"";
- xml += ">";
- if ( this.type === "xhtml" ) {
- xml += "<div xmlns=\"http://www.w3.org/1999/xhtml\">";
- }
- xml += this.content;
- if ( this.type === "xhtml" ) {
- xml += "</div>";
- }
- xml += "</" + elementName + ">";
- return xml;
- }
-}
-
-/**
- * Class that defines a Person object.
- */
-function Person( name, email ) {
- this.name = name;
- if ( email != null ) {
- this.email = new Email( email );
- }
-
- this.setName = function( name ) {
- this.name = name;
- };
-
- this.getName = function() {
- return this.name;
- };
-
- this.setLang = function(lang) {
- this.lang = lang;
- };
-
- this.getLang = function() {
- return this.lang;
- };
-
- this.setEmail = function( email ) {
- this.email = new Email( email );
- };
-
- this.getEmail = function() {
- return this.email;
- };
-
- this.setUri = function( uri ) {
- this.uri = new Uri( uri );
- };
-
- this.getUri = function() {
- return this.uri;
- };
-
- this.toString = function() {
- return "Person name=" + this.name + ", email=" + this.email;
- };
-
- /** Serialize this text element to XML.
- * atomPersonConstruct =
- * atomCommonAttributes,
- * (element atom:name { text }
- * & element atom:uri { atomUri }?
- * & element atom:email { atomEmailAddress }?
- * & extensionElement*)
- */
- this.toXML = function( elementName ) {
- if ( elementName == null ) {
- elementName = "person";
- }
- xml = "<" + elementName;
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += ">\n";
- if ( this.name != null ) {
- xml += "<name>" + this.name + "</name>\n";
- }
- if ( this.uri != null ) {
- xml += "<uri>" + this.uri + "</uri>\n";
- }
- if ( this.email != null) {
- xml += this.email.toXML();
- }
- xml += "</" + elementName + ">\n";
- return xml;
- }
- }
-
-/**
- * Class that defines a Generator object.
- */
-function Generator( name, uri ) {
- this.name = name;
- this.uri = new Uri( uri );
-
- this.setName = function( name ) {
- this.name = name;
- };
-
- this.getName = function() {
- return this.name;
- };
-
- this.setVersion = function(version) {
- this.version = version;
- };
-
- this.getVersion = function() {
- return this.version;
- };
-
- this.setUri = function( uri ) {
- this.uri = new Email( uri );
- };
-
- this.getUri = function() {
- return this.uri;
- };
-
- this.toString = function() {
- return "Generator name=" + this.name + ", email=" + this.email;
- };
-
- /** Serialize this text element to XML.
- * atomGenerator = element atom:generator {
- * atomCommonAttributes,
- * attribute uri { atomUri }?,
- * attribute version { text }?,
- * text
- * }
- */
- this.toXML = function() {
- xml = "<generator";
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri.getValue() + "\"";
- }
- if ( this.lang != null) {
- xml += " lang=\"" + this.lang + "\"";
- }
- if ( this.version != null ) {
- xml += " version=\"" + this.version + "\"";
- }
- xml += ">";
- if ( this.name != null ) {
- xml += this.name;
- }
- xml += "</generator>\n";
- return xml;
- }
-}
-
-/**
- * Class that defines a Category object.
- *atomCategory =
- * element atom:category {
- * atomCommonAttributes,
- * attribute term { text },
- * attribute scheme { atomUri }?,
- * attribute label { text }?,
- * undefinedContent
- * }
- */
-function Category( label, content ) {
- this.label = label;
- this.content = content;
-
- this.setLabel = function( label ) {
- this.label = label;
- };
-
- this.getLabel = function() {
- return this.label;
- };
-
- this.setLang = function(lang) {
- this.lang = lang;
- };
-
- this.getLang = function() {
- return this.lang;
- };
-
- this.setTerm = function(term) {
- this.term = term;
- };
-
- this.getTerm = function() {
- return this.term;
- };
-
- this.setScheme = function( scheme ) {
- this.scheme = scheme;
- };
-
- this.getScheme = function() {
- return this.scheme;
- };
-
- this.setContent = function( content ) {
- this.content = content;
- };
-
- this.getContent = function() {
- return this.content;
- };
-
- this.toString = function() {
- return "Category label=" + this.label;
- };
-
- /** Serialize this text element to XML.
- * atomCategory =
- * element atom:category {
- * atomCommonAttributes,
- * attribute term { text },
- * attribute scheme { atomUri }?,
- * attribute label { text }?,
- * undefinedContent
- * }
- */
- this.toXML = function() {
- xml = "<category>\n";
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null) {
- xml += " lang=\"" + this.lang + "\"";
- }
- if ( this.term != null) {
- xml += " term=\"" + this.term + "\"";
- }
- if ( this.scheme != null) {
- xml += " scheme=\"" + this.scheme + "\"";
- }
- if ( this.label != null) {
- xml += " label=\"" + this.label + "\"";
- }
- xml += ">\n";
- if ( this.content != null ) {
- xml += this.content + "\n";
- }
- xml += "</category>\n";
- return xml;
- }
-}
-
-/**
- * Class that defines a Link object.
- */
-function Link( href, relation ) {
- this.href = new Uri( href );
- this.relation = relation;
-
- this.setHRef = function( uri ) {
- this.href = new Uri( uri );
- };
-
- this.getHRef = function() {
- return this.href;
- };
-
- this.setTitle = function( title ) {
- this.title = title;
- };
-
- this.getTitle = function() {
- return this.title;
- };
-
- this.setHRefLang = function(lang) {
- this.hrefLang = lang;
- };
-
- this.getHRefLang = function() {
- return this.hreflang;
- };
-
- this.setTitleLang = function(lang) {
- this.titleLang = lang;
- };
-
- this.getTitleLang = function() {
- return this.titleLang;
- };
-
- this.setLength= function( length ) {
- this.length= length;
- };
-
- this.getLength = function() {
- return this.length;
- };
-
-/*
-<static> <final> String TYPE_ATOM
- Link type used for Atom content.
-<static> <final> String TYPE_HTML
- Link type used for HTML content.
-*/
- this.setMimeType = function(mimeType) {
- this.mimeType = mimeType;
- };
-
- this.getMimeType = function() {
- return this.mimeType;
- };
-
- this.setContent= function( content ) {
- this.content = content;
- };
-
- this.getContent = function() {
- return this.content;
- };
-
-/*
-<static> <final> String REL_ALTERNATE
- Link that provides the URI of an alternate format of the entry's or feed's contents.
-<static> <final> String REL_ENTRY_EDIT
- Link that provides the URI that can be used to edit the entry.
-<static> <final> String REL_MEDIA_EDIT
- Link that provides the URI that can be used to edit the media associated with an entry.
-<static> <final> String REL_NEXT
- Link that provides the URI of next page in a paged feed.
-<static> <final> String REL_PREVIOUS
- Link that provides the URI of previous page in a paged feed.
-<static> <final> String REL_RELATED
- Link that provides the URI of a related link to the entry.
-<static> <final> String REL_SELF
- Link that provides the URI of the feed or entry.
-<static> <final> String REL_VIA
- Link that provides the URI that of link that provides the data for the content in the feed.
-*/
- this.setRelation = function( relation ) {
- this.relation = relation;
- };
-
- this.getRelation = function() {
- return this.relation;
- };
-
- this.toString = function() {
- return "Link href=" + this.href + ", title=" + this.title;
- };
-
- /** Serialize this text element to XML.
- * atomLink =
- * element atom:link {
- * atomCommonAttributes,
- * attribute href { atomUri },
- * attribute rel { atomNCName | atomUri }?,
- * attribute type { atomMediaType }?,
- * attribute hreflang { atomLanguageTag }?,
- * attribute title { text }?,
- * attribute length { text }?,
- * undefinedContent
- * }
- */
- this.toXML = function() {
- xml = "<link";
- if ( this.relation != null ) {
- xml += " rel=\"" + this.relation + "\"";
- }
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri.getValue() + "\"";
- }
- if ( this.lang != null) {
- xml += " lang=\"" + this.lang + "\"";
- }
- if ( this.href != null ) {
- xml += " href=\"" + this.href.getValue() + "\"";
- }
- if ( this.hreflang != null ) {
- xml += " hreflang=\"" + this.hreflang + "\"";
- }
- if ( this.title != null ) {
- xml += " title=\"" + this.title + "\"";
- }
- if ( this.length != null ) {
- xml += " length=\"" + this.length + "\"";
- }
- if ( this.content != null ) {
- xml += this.content + "\n";
- xml += "</link>\n";
- } else {
- xml += "/>\n";
- }
- return xml;
- }
-
-}
-
-/**
- * Class that defines an Entry object.
- * atomEntry =
- * element atom:entry {
- * atomCommonAttributes,
- * (atomAuthor*
- * & atomCategory*
- * & atomContent?
- * & atomContributor*
- * & atomId
- * & atomLink*
- * & atomPublished?
- * & atomRights?
- * & atomSource?
- * & atomSummary?
- * & atomTitle
- * & atomUpdated
- * & extensionElement*)
- * }
- */
-function Entry( init ) {
- // Constructor code at bottom after function definition
-
- this.authors = new Array();
- this.contributors = new Array();
- this.categories = new Array();
- this.links = new Array();
-
- this.setNamespace = function( namespace ) {
- this.namespace = namespace;
- };
-
- this.getNamespace = function() {
- return this.namespace;
- };
-
- this.setId = function( id ) {
- if (!((typeof id == "object") && (id instanceof Id)))
- this.id = new Id( id );
- else
- this.id = id;
- }
-
- this.getId = function() {
- return this.id;
- };
-
- this.setPublished = function( published ) {
- this.published = published;
- };
-
- this.getPublished = function() {
- return this.published;
- };
-
- this.setUpdated = function( updated ) {
- this.updated = updated;
- };
-
- this.getUpdated = function() {
- return this.updated;
- };
-
- this.setRights = function( rights ) {
- this.rights = rights;
- }
-
- this.getRights = function() {
- return this.rights;
- };
-
- this.setSource = function( source ) {
- this.source = source;
- }
-
- this.getSource = function() {
- return this.source;
- };
-
- /* Type Text */
- this.setTitle = function( title ) {
- if (!((typeof title == "object") && (title instanceof Text)))
- this.title = new Text( title, "text" );
- else
- this.title = title;
- }
-
- this.getTitle = function() {
- return this.title;
- };
-
- /* Type Text */
- this.setSummary = function( summary ) {
- if (!((typeof summary == "object") && (summary instanceof Text)))
- this.summary = new Text( summary, "text" );
- else
- this.summary = summary;
- }
-
- this.getSummary = function() {
- return this.summary;
- };
-
- /* Type Text */
- this.setContent = function( content ) {
- if (!((typeof content == "object") && (content instanceof Text)))
- this.content = new Text( content, "text" );
- else
- this.content = content;
- }
-
- this.getContent = function() {
- return this.content;
- };
-
- /**
- * Add an author.
- * @param name Author
- */
- this.addAuthor = function(person) {
- if (!((typeof person == "object") && (person instanceof Person)))
- error( "Entry author must be of type Person" );
- var i = this.authors.length;
- this.authors[ i ] = person;
- }
-
- /**
- * Get an author.
- * @param name Author
- */
- this.getAuthor = function(name) {
- return this.authors[ name ];
- }
-
- /**
- * Set list of authors.
- * @param name Author
- */
- this.setAuthors = function( authors ) {
- return this.authors = authors;
- }
-
- /**
- * Get an author"pom.xml".
- * @param name Author
- */
- this.getAuthors = function() {
- return this.authors;
- }
-
- /**
- * Add an contributor.
- * @param name Contributor
- */
- this.addContributor = function(person) {
- if (!((typeof person == "object") && (person instanceof Person)))
- error( "Entry contributor must be of type Person" );
- var i = this.contributors.length;
- this.contributors[ i ] = person;
- }
-
- /**
- * Get an contributor.
- * @param name Contributor
- */
- this.getContributor = function(name) {
- return this.contributors[ name ];
- }
-
- /**
- * Set list of contributors
- * @param name Author
- */
- this.setContributors = function( contributors ) {
- return this.contributors = contributors;
- }
-
- /**
- * Get an contributor.
- * @param name Contributor
- */
- this.getContributors = function() {
- return this.contributors;
- }
-
- /**
- * Add a category.
- * @param name Category
- */
- this.addCategory = function(category) {
- if (!((typeof category == "object") && (category instanceof Category)))
- error( "Entry category must be of type Category" );
- var i = this.categories.length
- this.categories[ i ] = category;
- }
-
- /**
- * Get a names category.
- * @param name Category
- */
- this.getCategory = function(name) {
- return this.categories[ name ];
- }
-
- /**
- * Set list of categories
- * @param name Author
- */
- this.setCategories = function( categories ) {
- return this.categories = categories;
- }
-
- /**
- * Get all categories.
- * @param name Category
- */
- this.getCategories = function() {
- return this.categories;
- }
-
- /**
- * Add an link.
- * @param name Link
- */
- this.addLink = function(link) {
- if (!((typeof link == "object") && (link instanceof Link)))
- error( "Entry link must be of type Link" );
- var i = this.links.length;
- this.links[ i ] = link;
- }
-
- /**
- * Get an link.
- * @param name Link
- */
- this.getLink = function(name) {
- return links[ name ];
- }
-
- /**
- * Set list of links.
- * @param name Link
- */
- this.setLinks = function( links ) {
- return this.links = links;
- }
-
- /**
- * Get an link.
- * @param name Link
- */
- this.getLinks = function() {
- return links;
- }
-
- this.readFromXML = function( xml ) {
- if (!((typeof xml == "object") && (xml instanceof string)))
- error( "Entry xml must be of type string" );
- // To Do - Read from arbutrary XML such as
- // <entry>
- // <title type="text">cart-item</title>
- // <content type="text">Apple - $ 2.99</content>
- // <id>cart-bd5323d6-1f59-4fae-a8f5-01f7654f1e77</id>
- // <link href="cart-bd5323d6-1f59-4fae-a8f5-01f7654f1e77" rel="edit"/>
- // <link href="cart-bd5323d6-1f59-4fae-a8f5-01f7654f1e77" rel="alternate"/>
- // <updated>2008-09-21T23:06:43.921Z</updated>
- // </entry>
-
- }
- this.readFromDoc = function( htmlDoc ) {
- // Expect HTML collection.
- var entryDoc = htmlDoc.getElementsByTagName("entry");
- for (var i = 0; i < entryDoc.length; i++) {
- this.readFromNode( entryDoc[ i ] );
- }
- }
-
- this.readFromNode = function( entryNode ) {
- // Expect entry node
- var childNodes = entryNode.childNodes;
- for ( var i = 0; i < childNodes.length; i++ ) {
- var node = childNodes[ i ];
- if (node.nodeType == 1 /*Node.ELEMENT_NODE*/) {
- var tagName = node.tagName;
- if (tagName == "title" ) {
- var text = getTextContent( node );
- var type = node.getAttribute( "type" );
- if ( type == undefined )
- type = "text";
- var title = new Text( text, type );
- this.setTitle( title );
- } else if ( tagName == "subtitle" ) {
- var text = getTextContent( node );
- var type = node.getAttribute( "type" );
- if ( type == undefined )
- type = "text";
- var title = new Text( text, type );
- this.setSubtitle( title );
- } else if ( tagName == "id" ) {
- var id = new Id( getTextContent( node ) );
- this.setId( id );
- } else if ( tagName == "updated" ) {
- var dateText = getTextContent( node );
- var date = new Date( dateText ); // 2008-09-21T23:06:43.921Z
- this.setUpdated( date );
- } else if ( tagName == "link" ) {
- // var href = node.attributes[ "href" ]; // Works on modern browsers.
- var attrVal = node.getAttribute( "href" );
- var link = new Link( attrVal );
- attrVal = node.getAttribute( "rel" );
- if ( attrVal )
- link.setRelation( attrVal );
- this.addLink( link );
- } else if ( tagName == "content" ) {
- var text = getTextContent( node );
- var type = node.getAttribute( "type" );
- if (type == undefined)
- type = "text";
- var content = new Text( text, type );
- this.setContent( content );
- } else {
- // To Do - implement rest of nodes
- error( "undefined element node" );
- }
- } else if (node.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) {
- var attrName = node.tagName;
- } else if (node.nodeType == 3 /*Node.TEXT_NODE*/) {
- }
- }
- }
-
- this.toString = function() {
- return "Entry title=" + this.title + ", updated=" + this.updated;
- };
-
- /** Serialize this text element to XML.
- * atomEntry =
- * element atom:entry {
- * atomCommonAttributes,
- * (atomAuthor*
- * & atomContributor*
- * & atomCategory*
- * & atomLink*
- * & atomTitle
- * & atomId
- * & atomPublished?
- * & atomUpdated
- * & atomContent?
- * & atomRights?
- * & atomSource?
- * & atomSummary?
- * & extensionElement*)
- * }
- */
- this.toXML = function() {
- xml = "<entry";
- if ( this.namespace != null ) {
- xml += " namespace=\"" + this.namespace + "\"";
- }
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += ">";
- if ( this.title != null ) {
- xml += this.title.toXML( "title" );
- }
- if ( this.id != null ) {
- xml += this.id.toXML();
- }
- if ( this.published != null ) {
- xml += "<published>" + this.published + "</published>\n";
- }
- if ( this.updated != null ) {
- xml += "<updated>" + this.updated + "</updated>\n";
- }
- if ( this.authors != null ) {
- for ( var i = 0; i < this.authors.length; i++ ) {
- var author = this.authors[ i ];
- xml += author.toXML( "author" );
- }
- }
- if ( this.contributors != null ) {
- for ( var i = 0; i < this.contributors.length; i++ ) {
- var contributor = this.contributors[ i ];
- xml += contributor.toXML( "contributor" );
- }
- }
- if ( this.categories != null ) {
- for ( var i = 0; i < this.categories.length; i++ ) {
- var category = this.categories[ i ];
- xml += category.toXML();
- }
- }
- if ( this.links != null ) {
- for ( var i = 0; i < this.links.length; i++ ) {
- var link = this.links[ i ];
- xml += link.toXML();
- }
- }
- if ( this.rights != null ) {
- xml += "<rights>" + this.rights + "</rights>\n";
- }
- if ( this.source != null ) {
- xml += "<source>" + this.source + "</source>\n";
- }
- if ( this.summary != null ) {
- xml += this.summary.toXML( "summary" );
- }
- if ( this.content != null ) {
- xml += this.content.toXML( "content" );
- }
- xml += "</entry>";
- return xml;
- }
-
- // Initialize from constructor
- if (typeof init == 'object') {
- if ( init.nodeType == 1 ) { /* Document Node.ELEMENT_NODE 1 */
- this.readFromDoc( init );
- } else {
- error( "Feed init unknown type" );
- }
- } else if ( typeof init === 'string' ) {
- this.setTitle( init );
- }
- this.namespace = "http://www.w3.org/2005/Atom";
-}
-
-/**
- * Class that defines an Feed object.
- * atomFeed =
- * element atom:feed {
- * atomCommonAttributes,
- * (atomAuthor*
- * & atomCategory*
- * & atomContributor*
- * & atomGenerator?
- * & atomIcon?
- * & atomId
- * & atomLink*
- * & atomLogo?
- * & atomRights?
- * & atomSubtitle?
- * & atomTitle
- * & atomUpdated
- * & extensionElement*),
- * atomEntry*
- */
-function Feed( init ) {
- // See init after functions have been defined.
-
- this.authors = new Array();
- this.contributors = new Array();
- this.categories = new Array();
- this.links = new Array();
- this.entries = new Array();
-
- this.setNamespace = function( namespace ) {
- this.namespace = namespace;
- };
-
- this.getNamespace = function() {
- return this.namespace;
- };
-
- this.setPublished = function( published ) {
- this.published = published;
- };
-
- this.getPublished = function() {
- return this.published;
- };
-
- this.setUpdated = function( updated ) {
- this.updated = updated;
- };
-
- this.getUpdated = function() {
- return this.updated;
- };
-
- this.setContent = function( content ) {
- if (!((typeof content == "object") && (content instanceof Text)))
- error( "Entry content must be of type Text" );
-
- this.content = content;
- }
-
- this.getContent = function() {
- return this.content;
- };
-
- this.setRights = function( rights ) {
- if (!((typeof rights == "object") && (rights instanceof Text)))
- this.rights = new Text( rights, "text" );
- else
- this.rights = rights;
- }
-
- this.getRights = function() {
- return this.rights;
- };
-
- this.setSummary = function( summary ) {
- if (!((typeof summary == "object") && (summary instanceof Text)))
- error( "Feed summary must be of type Text" );
- this.summary = summary;
- }
-
- this.getSummary = function() {
- return this.summary;
- };
-
- this.setTitle = function( title ) {
- if (!((typeof title == "object") && (title instanceof Text)))
- this.title = new Text( title, "text" );
- else
- this.title = title;
- }
-
- this.getTitle = function() {
- return this.title;
- };
-
- this.setSubtitle = function( subtitle ) {
- if (!((typeof subtitle == "object") && (subtitle instanceof Text)))
- this.subtitle = new Text( subtitle, "text" );
- else
- this.subtitle = subtitle;
- }
-
- this.getSubtitle = function() {
- return this.subtitle;
- };
-
- /* Type Id */
- this.setId = function( id ) {
- if (!((typeof id == "object") && (id instanceof Id)))
- this.id = new Id( id );
- else
- this.id = id;
- }
-
- this.getId = function() {
- return this.id;
- };
-
- this.setGenerator = function( generator ) {
- if (!((typeof generator == "object") && (generator instanceof Generator)))
- error( "Feed generator must be of type Generator" );
- this.generator = generator;
- }
-
- this.getGenerator = function() {
- return this.generator;
- };
-
- this.setBase = function( base ) {
- this.base = base;
- }
-
- this.getBase = function() {
- return this.base;
- };
-
- this.setLogo = function( logo ) {
- this.logo = logo;
- }
-
- this.getLogo = function() {
- return this.logo;
- };
-
- /**
- * Add an author.
- * @param name Author
- */
- this.addAuthor = function(person) {
- if (!((typeof person == "object") && (person instanceof Person)))
- error( "Entry author must be of type Person" );
- var i = this.authors.length;
- this.authors[ i ] = person;
- }
-
- /**
- * Get an author.
- * @param name Author
- */
- this.getAuthor = function(name) {
- return this.authors[ name ];
- }
-
- /**
- * Set list of authors.
- * @param name Author
- */
- this.setAuthors = function( authors ) {
- return this.authors = authors;
- }
-
- /**
- * Get an author.
- * @param name Author
- */
- this.getAuthors = function() {
- return this.authors;
- }
-
- /**
- * Add an contributor.
- * @param name Contributor
- */
- this.addContributor = function(person) {
- if (!((typeof person == "object") && (person instanceof Person)))
- error( "Entry contributor must be of type Person" );
- var i = this.contributors.length;
- this.contributors[ i ] = person;
- }
-
- /**
- * Get an contributor.
- * @param name Contributor
- */
- this.getContributor = function(name) {
- return this.contributors[ name ];
- }
-
- /**
- * Set list of contributors
- * @param name Author
- */
- this.setContributors = function( contributors ) {
- return this.contributors = contributors;
- }
-
- /**
- * Get an contributor.
- * @param name Contributor
- */
- this.getContributors = function() {
- return this.contributors;
- }
-
- /**
- * Add a category.
- * @param name Category
- */
- this.addCategory = function(category) {
- if (!((typeof category == "object") && (category instanceof Category)))
- error( "Feed category must be of type Category" );
- var i = this.categories.length;
- this.categories[ i ] = category;
- }
-
- /**
- * Get a named contributor.
- * @param name Category
- */
- this.getCategory = function(name) {
- return this.categories[ name ];
- }
-
- /**
- * Set list of categories
- * @param category
- */
- this.setCategories = function( categories ) {
- return this.categories = categories;
- }
-
- /**
- * Get all categories.
- * @param name Category
- */
- this.getCategories = function() {
- return this.categories;
- }
-
- /**
- * Add an link.
- * @param name Link
- */
- this.addLink = function(link) {
- if (!((typeof link == "object") && (link instanceof Link)))
- error( "Entry link must be of type Link" );
- var i = this.links.length;
- this.links[ i ] = link;
- }
-
- /**
- * Get an link.
- * @param name Link
- */
- this.getLink = function(name) {
- return this.links[ name ];
- }
-
- /**
- * Set list of links.
- * @param name Link
- */
- this.setLinks = function( links ) {
- return this.links = links;
- }
-
- /**
- * Get an link.
- * @param name Link
- */
- this.getLinks = function() {
- return this.links;
- }
-
- /**
- * Add an entry.
- * @param name Entry
- */
- this.addEntry = function(entry) {
- if (!((typeof entry == "object") && (entry instanceof Entry)))
- error( "Entry entry must be of type Entry" );
- var i = this.entries.length;
- this.entries[ i ] = entry;
- }
-
- /**
- * Get an entry by name.
- * @param name Entry
- */
- this.getEntry = function(name) {
- return this.entries[ name ];
- }
-
- /**
- * Set list of entries
- * @param name Author
- */
- this.setEntries = function( entries ) {
- return this.entries = entries;
- }
-
- /**
- * Get an contributor.
- * @param name Entry
- */
- this.getEntries = function() {
- return this.entries;
- }
-
- this.readFromXML = function( xml ) {
- // To Do Read from arbitraty XML such as
- // <feed xmlns="http://www.w3.org/2005/Atom">
- // <title type="text">shopping cart</title>
- // <subtitle type="text">Total : $4.54</subtitle>
- // <entry>
- // ...
- // </entry>
- // </feed>
- }
-
- this.readFromDoc = function( htmlDoc ) {
- // Expect HTML collection.
- var feedDoc = htmlDoc.getElementsByTagName("feed");
- for (var i = 0; i < feedDoc.length; i++) {
- this.readFromNode( feedDoc[ i ] );
- }
- }
- this.readFromNode = function( feedNode ) {
- // Expect feed node
- var childNodes = feedNode.childNodes;
- for ( var i = 0; i < childNodes.length; i++ ) {
- var node = childNodes[ i ];
- if (node.nodeType == 1 /*Node.ELEMENT_NODE*/) {
- var tagName = node.tagName;
- if (tagName == "title" ) {
- var text = getTextContent( node );
- var type = node.getAttribute( "type" );
- if ( type == undefined )
- type = "text";
- var title = new Text( text, type );
- this.setTitle( title );
- } else if ( tagName == "subtitle" ) {
- var text = getTextContent( node );
- var type = node.getAttribute( "type" );
- if ( type == undefined )
- type = "text";
- var title = new Text( text, type );
- this.setSubtitle( title );
- } else if ( tagName == "entry" ) {
- var entry = new Entry();
- entry.readFromNode( node );
- this.addEntry( entry );
- } else if ( tagName == "id" ) {
- var id = new Id( getTextContent( node ) );
- this.setId( id );
- } else if ( tagName == "updated" ) {
- var dateText = getTextContent( node );
- var date = new Date( dateText ); //2008-09-21T23:06:53.750Z
- this.setUpdated( date );
- } else if ( tagName == "link" ) {
- // var href = node.attributes[ "href" ]; // Works on modern browsers.
- var attrVal = node.getAttribute( "href" );
- var link = new Link( attrVal );
- attrVal = node.getAttribute( "rel" );
- if ( attrVal )
- link.setRelation( attrVal );
- this.addLink( link );
- } else {
- // To Do - implement rest of nodes
- error( "undefined element node" );
- }
- } else if (node.nodeType == 2 /*Node.ATTRIBUTE_NODE*/) {
- var attrName = node.tagName;
- } else if (node.nodeType == 3 /*Node.TEXT_NODE*/) {
- }
- }
- }
-
- this.toString = function() {
- return "Feed title=" + this.title + ", updated=" + this.updated;
- };
-
- /** Serialize this text element to XML.
- * atomFeed =
- * element atom:feed {
- * atomCommonAttributes,
- * (atomAuthor*
- * & atomContributor*
- * & atomCategory*
- * & atomLink*
- * & atomTitle
- * & atomSubtitle?
- * & atomId
- * & atomUpdated
- * & atomRights?
- * & atomGenerator?
- * & atomIcon?
- * & atomLogo?
- * & extensionElement*),
- * atomEntry*
- */
- this.toXML = function() {
- xml = "<feed";
- if ( this.namespace != null ) {
- xml += " namespace=\"" + this.namespace + "\"";
- }
- if ( this.uri != null ) {
- xml += " uri=\"" + this.uri + "\"";
- }
- if ( this.lang != null ) {
- xml += " lang=\"" + this.lang + "\"";
- }
- xml += ">\n";
- if ( this.title != null ) {
- xml += this.title.toXML( "title" );
- }
- if ( this.subtitle != null ) {
- xml += this.subtitle.toXML( "subtitle" );
- }
- if ( this.id != null ) {
- xml += this.id.toXML();
- }
- if ( this.published != null ) {
- xml += "<published>" + this.published + "</published>\n";
- }
- if ( this.updated != null ) {
- xml += "<updated>" + this.updated + "</updated>\n";
- }
- if ( this.authors != null ) {
- for ( var i = 0; i < this.authors.length; i++ ) {
- var author = this.authors[ i ];
- xml += author.toXML( "author" );
- }
- }
- if ( this.contributors != null ) {
- for ( var i = 0; i < this.contributors.length; i++ ) {
- var contributor = this.contributors[ i ];
- xml += contributor.toXML( "contributor" );
- }
- }
- if ( this.categories != null ) {
- for ( var i = 0; i < this.categories.length; i++ ) {
- var category = this.categories[ i ];
- xml += category.toXML();
- }
- }
- if ( this.links != null ) {
- for ( var i = 0; i < this.links.length; i++ ) {
- var link = this.links[ i ];
- xml += link.toXML();
- }
- }
- if ( this.rights != null ) {
- xml += this.rights.toXML( "rights" );
- }
- if ( this.source != null ) {
- xml += "<source>" + this.source + "</source>\n";
- }
- if ( this.logo != null ) {
- xml += "<logo>" + this.logo + "</logo>\n";
- }
- if ( this.icon != null ) {
- xml += "<icon>" + this.icon + "</icon>\n";
- }
- if ( this.generator != null ) {
- xml += this.generator.toXML( "generator" );
- }
- if ( this.summary != null ) {
- xml += this.summary.toXML( "summary" );
- }
- if ( this.entries != null ) {
- for ( var i = 0; i < this.entries.length; i++ ) {
- var entry = this.entries[ i ];
- xml += entry.toXML();
- }
- }
- xml += "</feed>\n";
- return xml;
- }
-
- // Initialize from constructor
- if (typeof init == 'object') {
- if ( init.nodeType == 9 ) { /* Document Node.DOCUMENT_NODE 9 */
- this.readFromDoc( init );
- } else {
- error( "Feed init unknown type" );
- }
- } else if ( typeof init === 'string' ) {
- this.setTitle( init );
- }
- this.namespace = "http://www.w3.org/2005/Atom";
-}
-
-function error( message ) {
- alert( message );
-}
-
-/* Returns inner text on both IE and modern browsers. */
-function getTextContent(node) {
- // innerText for IE, textContent for others, child text node, "" for others.
- if ( node.innerText )
- return node.innerText;
- if ( node.textContent )
- return node.textContent;
- if ( node.hasChildNodes() ) {
- var childNodes = node.childNodes
- for ( var j = 0; j < childNodes.length; j++ ) {
- var childNode = childNodes[ j ];
- var childType = childNode.nodeType;
- if (childNode.nodeType == 3 /*Node.TEXT_NODE*/) {
- return childNode.nodeValue;
- }
- }
- }
- return undefined;
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/binding-http.js b/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/binding-http.js
deleted file mode 100644
index 60bd841679..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget-runtime/src/main/resources/binding-http.js
+++ /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.
- */
-
-function HTTPClient(uri) {
-
- this.msxmlNames = [ "MSXML2.XMLHTTP.5.0",
- "MSXML2.XMLHTTP.4.0",
- "MSXML2.XMLHTTP.3.0",
- "MSXML2.XMLHTTP",
- "Microsoft.XMLHTTP" ];
-
- this.uri=uri;
-
- this.get = function(id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var strDocument = xhr.responseText;
- if (responseFunction != null) responseFunction(strDocument);
- } else {
- alert("get - Error getting data from the server");
- }
- }
- }
- xhr.open("GET", uri + '/' + id, true);
- xhr.send(null);
- }
-
- this.post = function (entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 201) {
- var strDocument = xhr.responseText;
- if (responseFunction != null) responseFunction(strDocument);
- } else {
- alert("post - Error getting data from the server");
- }
- }
- }
- xhr.open("POST", uri, true);
- xhr.setRequestHeader("Content-Type", "text/xml");
- xhr.send(entry);
- }
-
- this.put = function (id, entry, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var strDocument = xhr.responseText;
- if (responseFunction != null) responseFunction(strDocument);
- } else {
- alert("put - Error getting data from the server");
- }
- }
- }
- xhr.open("PUT", uri + '/' + id, true);
- xhr.setRequestHeader("Content-Type", "text/xml");
- xhr.send(entry);
- }
-
- this.del = function (id, responseFunction) {
- var xhr = this.createXMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- if (responseFunction != null) responseFunction();
- } else {
- alert("delete - Error getting data from the server");
- }
- }
- }
- xhr.open("DELETE", uri + '/' + id, true);
- xhr.send(null);
- }
- this.createXMLHttpRequest = function () {
- /* Mozilla XMLHttpRequest */
- try {return new XMLHttpRequest();} catch(e) {}
-
- /* Microsoft MSXML ActiveX */
- for (var i=0;i < this.msxmlNames.length; i++) {
- try {return new ActiveXObject(this.msxmlNames[i]);} catch (e) {}
- }
- alert("XML http request not supported");
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/LICENSE b/branches/sca-java-1.5.1/modules/implementation-widget/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/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-java-1.5.1/modules/implementation-widget/NOTICE b/branches/sca-java-1.5.1/modules/implementation-widget/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/pom.xml b/branches/sca-java-1.5.1/modules/implementation-widget/pom.xml
deleted file mode 100644
index a5811817ab..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/pom.xml
+++ /dev/null
@@ -1,79 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-widget</artifactId>
- <name>Apache Tuscany SCA Widget Implementation Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.widget</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.widget*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java
deleted file mode 100644
index f47850a05c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/Widget.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget;
-
-import java.io.InputStream;
-
-import org.apache.tuscany.sca.data.collection.Collection;
-
-/**
- * The service interface of widget implementations. This is not an API for application
- * developers. Application developers should use the data collection API to invoke
- * widget components.
- *
- * @version $Rev$ $Date$
- */
-public interface Widget extends Collection<String, InputStream> {
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.java
deleted file mode 100644
index 2a092884be..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementation.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.implementation.widget;
-
-import java.net.URL;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-
-/**
- * The model representing a widget implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public interface WidgetImplementation extends Implementation {
-
- String getLocation();
-
- void setLocation(String location);
-
- URL getLocationURL();
-
- void setLocationURL(URL url);
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.java
deleted file mode 100644
index cdf4886194..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationFactory.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.implementation.widget;
-
-/**
- * Factory for the widget implementation model.
- *
- * @version $Rev$ $Date$
- */
-public interface WidgetImplementationFactory {
-
- WidgetImplementation createWidgetImplementation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
deleted file mode 100644
index abe00bac5b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationIntrospector.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget;
-
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Scanner;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-class WidgetImplementationIntrospector {
- private static final String WEB_REFERENCE_ANNOTATION = "//@Reference";
- private static final String WEB_PROPERTY_ANNOTATION = "//@Property";
-
- private AssemblyFactory assemblyFactory;
- private WidgetImplementation widgetImplementation;
-
- WidgetImplementationIntrospector(AssemblyFactory assemblyFactory, WidgetImplementation widgetImplementation) {
- this.widgetImplementation = widgetImplementation;
- this.assemblyFactory = assemblyFactory;
- }
-
-
- /**
- * Introspect and populate a given widget implementation
- */
- public void introspectImplementation() {
- URL htmlWidget = widgetImplementation.getLocationURL();
-
- try {
- URLConnection connection = htmlWidget.openConnection();
- connection.setUseCaches(false);
- Scanner scanner = new Scanner(connection.getInputStream());
- while(scanner.hasNextLine()) {
- String line = scanner.nextLine();
- if(line.contains(WEB_PROPERTY_ANNOTATION)) {
- //process the next line, as it has the property info
- if (scanner.hasNextLine()) {
- Property property = processPropertyScript(scanner.nextLine());
- if (property != null) {
- widgetImplementation.getProperties().add(property);
- }
- }
-
- } else if(line.contains(WEB_REFERENCE_ANNOTATION)) {
- //process the next line, as it has the reference info
- if (scanner.hasNextLine()) {
- Reference reference = processReferenceScript(scanner.nextLine());
- if(reference != null){
- widgetImplementation.getReferences().add(reference);
- }
-
- }
- }
- }
-
- } catch(Exception e) {
-
- }
-
-
- }
-
-
- /**
- * Process Property declaration in JavaScript code
- * Supported ways:
- * //@Property
- * var locale = Property("locale");
- *
- * //@Property
- * locale = Property("locale");
- *
- * @param scriptContent
- * @return
- */
- private Property processPropertyScript(String scriptContent) {
- Property property = null;
- String propertyName = null;
-
- String tokens[] = scriptContent.split("=");
- tokens = tokens[0].split(" ");
- propertyName = tokens[tokens.length -1];
-
- if(propertyName != null) {
- property = assemblyFactory.createProperty();
- property.setName(propertyName);
- }
-
- return property;
- }
-
- /**
- * Process Reference declaration in JavaScript code
- * Supported ways :
- * //@Reference
- * var catalog = new Reference("catalog");
- *
- * //@Reference
- * catalog = new Reference("catalog");
- *
- * @param scriptContent
- * @return
- */
- private Reference processReferenceScript(String scriptContent) {
- Reference reference = null;
- String referenceName = null;
-
- String tokens[] = scriptContent.split("=");
-
- // find the string between the quotes
- tokens = tokens[1].split("\"");
- referenceName = tokens[1];
-
- if(referenceName != null) {
- reference = assemblyFactory.createReference();
- reference.setName(referenceName);
- }
-
- return reference;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
deleted file mode 100644
index c0087e97fe..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/WidgetImplementationProcessor.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.widget;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.io.IOException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-/**
- *
- * Implements a StAX artifact processor for Widget implementations.
- *
- * @version $Rev$ $Date$
- */
-public class WidgetImplementationProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WidgetImplementation> {
- private static final QName IMPLEMENTATION_WIDGET = new QName(Constants.SCA10_TUSCANY_NS, "implementation.widget");
-
- private AssemblyFactory assemblyFactory;
- private ContributionFactory contributionFactory;
- private WidgetImplementationFactory implementationFactory;
- private Monitor monitor;
-
- public WidgetImplementationProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- implementationFactory = modelFactories.getFactory(WidgetImplementationFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), "impl-widget-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- // Returns the QName of the XML element processed by this processor
- return IMPLEMENTATION_WIDGET;
- }
-
- public Class<WidgetImplementation> getModelType() {
- // Returns the type of model processed by this processor
- return WidgetImplementation.class;
- }
-
- public WidgetImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <implementation.widget> element
-
- // Create and initialize the resource implementation model
- WidgetImplementation implementation = null;
-
- // Read the location attribute specifying the location of the resources
- String location = reader.getAttributeValue(null, "location");
- if (location != null) {
- implementation = implementationFactory.createWidgetImplementation();
- implementation.setLocation(location);
- implementation.setUnresolved(true);
- } else {
- error("LocationAttributeMissing", reader);
- //throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_WIDGET.equals(reader.getName())) {
- break;
- }
- }
-
- return implementation;
- }
-
- public void resolve(WidgetImplementation implementation, ModelResolver resolver) throws ContributionResolveException {
-
- if (implementation != null) {
- // Resolve the resource directory location
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(implementation.getLocation());
- Artifact resolved = resolver.resolveModel(Artifact.class, artifact);
- if (resolved.getLocation() != null) {
- try {
- implementation.setLocationURL(new URL(resolved.getLocation()));
-
- //introspect implementation
- WidgetImplementationIntrospector widgetIntrospector =
- new WidgetImplementationIntrospector(assemblyFactory, implementation);
- widgetIntrospector.introspectImplementation();
-
- implementation.setUnresolved(false);
- } catch (IOException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- error("CouldNotResolveLocation", resolver, implementation.getLocation());
- //throw new ContributionResolveException("Could not resolve implementation.widget location: " + implementation.getLocation());
- }
- }
- }
-
- public void write(WidgetImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- // Write <implementation.widget>
- writeStart(writer, IMPLEMENTATION_WIDGET.getNamespaceURI(), IMPLEMENTATION_WIDGET.getLocalPart());
-
- if (implementation.getLocation() != null) {
- writer.writeAttribute("location", implementation.getLocation());
- }
-
- writeEnd(writer);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java
deleted file mode 100644
index c24c9e7eab..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationFactoryImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.widget.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
-import org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-/**
- * Factory for the widget implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class WidgetImplementationFactoryImpl implements WidgetImplementationFactory {
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- public WidgetImplementationFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
- assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- }
-
- public WidgetImplementation createWidgetImplementation() {
- return new WidgetImplementationImpl(assemblyFactory, javaFactory);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationImpl.java
deleted file mode 100644
index f50fd73b5c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/java/org/apache/tuscany/sca/implementation/widget/impl/WidgetImplementationImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.widget.impl;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.Property;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.implementation.widget.Widget;
-import org.apache.tuscany.sca.implementation.widget.WidgetImplementation;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-
-
-/**
- * The model representing a widget implementation in an SCA assembly model.
- *
- * @version $Rev$ $Date$
- */
-public class WidgetImplementationImpl implements WidgetImplementation {
- private Service widgetService;
- private List<Reference> references = new ArrayList<Reference>();
- private List<Property> properties = new ArrayList<Property>();
-
- private String location;
- private URL url;
- private boolean unresolved;
-
- /**
- * Constructs a new resource implementation.
- */
- WidgetImplementationImpl(AssemblyFactory assemblyFactory,
- JavaInterfaceFactory javaFactory) {
-
- // Resource implementation always provide a single service exposing
- // the Resource interface, and have no references and properties
- widgetService = assemblyFactory.createService();
- widgetService.setName("Widget");
-
- // Create the Java interface contract for the Resource service
- JavaInterface javaInterface;
- try {
- javaInterface = javaFactory.createJavaInterface(Widget.class);
- } catch (InvalidInterfaceException e) {
- throw new IllegalArgumentException(e);
- }
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- interfaceContract.setInterface(javaInterface);
- widgetService.setInterfaceContract(interfaceContract);
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public URL getLocationURL() {
- return url;
- }
-
- public void setLocationURL(URL url) {
- this.url = url;
- }
-
- public ConstrainingType getConstrainingType() {
- // The resource implementation does not support constrainingTypes
- return null;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
- public List<Service> getServices() {
- // The resource implementation does not support services
- return Collections.singletonList(widgetService);
- }
-
- public List<Reference> getReferences() {
- return references;
- }
-
- public String getURI() {
- return location;
- }
-
- public void setConstrainingType(ConstrainingType constrainingType) {
- // The resource implementation does not support constrainingTypes
- }
-
- public void setURI(String uri) {
- this.location = uri;
- }
-
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- @Override
- public String toString() {
- return "Widget : " + getLocation();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 6c167a6b31..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.widget.WidgetImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.widget,model=org.apache.tuscany.sca.implementation.widget.WidgetImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
deleted file mode 100644
index 633dda5675..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.widget.WidgetImplementationFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for model factory
-org.apache.tuscany.sca.implementation.widget.impl.WidgetImplementationFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/impl-widget-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/impl-widget-validation-messages.properties
deleted file mode 100644
index 3778bd4c50..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-widget/src/main/resources/impl-widget-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionResolveException = ContributionResolveException occured due to:
-LocationAttributeMissing = Reading implementation.widget - location attribute missing
-CouldNotResolveLocation = Could not resolve implementation.widget location: {0}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/LICENSE b/branches/sca-java-1.5.1/modules/implementation-xquery/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/implementation-xquery/NOTICE b/branches/sca-java-1.5.1/modules/implementation-xquery/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/pom.xml b/branches/sca-java-1.5.1/modules/implementation-xquery/pom.xml
deleted file mode 100644
index 03625d28b0..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/pom.xml
+++ /dev/null
@@ -1,105 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-implementation-xquery</artifactId>
- <name>Apache Tuscany SCA XQuery Implementation Extension</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-saxon</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-jaxb</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.xquery</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.xquery*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java
deleted file mode 100644
index f5bc5dd9b8..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementation.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery;
-
-import java.lang.reflect.Method;
-import java.util.Map;
-
-import net.sf.saxon.query.XQueryExpression;
-
-import org.apache.tuscany.sca.assembly.Implementation;
-
-/**
- * Class representing the XQuery implementation type
- * @version $Rev$ $Date$
- */
-public interface XQueryImplementation extends Implementation {
-
- /**
- * Location of the XQuery implementation file
- * @return
- */
- String getLocation();
-
- void setLocation(String location);
-
- String getLocationURL();
-
- void setLocationURL(String location);
-
- /**
- * The XQuery expression that is loaded from the XQuery implementation file
- * @return
- */
- String getXqExpression();
-
- void setXqExpression(String expression);
-
- /**
- * The XQuery expression should be extended for with additional
- * script, which provides the external variables needed to invoke
- * a function. In this way for each function that is defined in the
- * original XQuery expression additional expression is defined, which
- * can invoke this function, using external variables as input.
- * These expression extensions are stored in this map. It provides for
- * each method of a service interface that is implemented by this component
- * type corresponding expression extension
- * @return
- */
- Map<Method, String> getXqExpressionExtensionsMap();
-
- /**
- * This map is a kind of cache for function invocations. If a given
- * XQuery function of this implementation has been invoked already
- * its compiled expression can be reused. In this manner the performance
- * can be increased
- * @return
- */
- Map<String, XQueryExpression> getCompiledExpressionsCache();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java
deleted file mode 100644
index bdfd390499..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery;
-
-import org.apache.tuscany.sca.implementation.xquery.impl.XQueryImplementationFactoryImpl;
-
-/**
- * Provides instances of XQueryImplementation classes
- * @version $Rev$ $Date$
- */
-public interface XQueryImplementationFactory {
-
- XQueryImplementationFactory INSTANCE = new XQueryImplementationFactoryImpl();
-
- XQueryImplementation createXQueryImplementation();
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.java
deleted file mode 100644
index 63a3a49e13..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProvider.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.implementation.xquery;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentProperty;
-import org.apache.tuscany.sca.assembly.Reference;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.core.factory.ObjectFactory;
-import org.apache.tuscany.sca.databinding.javabeans.SimpleJavaDataBinding;
-import org.apache.tuscany.sca.databinding.saxon.SaxonNodeDataBinding;
-import org.apache.tuscany.sca.databinding.saxon.SaxonValueDataBinding;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Provides the runtime configuration of XQuery-typed component.
- *
- * Generally the following is done:
- * 1. During construction all services and references are provided
- * with the Saxon data binding, which is the one required by the
- * XQueryInvoker
- *
- * 2. During startup:
- * - a proxy is created for each reference and it is kept in the referenceProxies
- * map, which is used later by the invoker to configure the Saxon parser;
- * - each property value is read and put into the properties map. This is
- * again used by the invoker to configure the Saxon parser
- *
- * @version $Rev$ $Date$
- */
-public class XQueryImplementationProvider implements ImplementationProvider {
-
- private RuntimeComponent component;
- private XQueryImplementation implementation;
- private Map<String, Object> referenceProxies = new HashMap<String, Object>();
- private Map<String, Object> properties = new HashMap<String, Object>();
- private JavaPropertyValueObjectFactory javaFactory;
-
- public XQueryImplementationProvider(RuntimeComponent component,
- XQueryImplementation implementation,
- JavaPropertyValueObjectFactory factory) {
- this.component = component;
- this.implementation = implementation;
- this.javaFactory = factory;
- init();
- }
-
- private void init() {
- List<Service> services = implementation.getServices();
- for (Service sevice : services) {
- InterfaceContract interfaceContract = sevice.getInterfaceContract();
- //interfaceContract.getInterface().setDefaultDataBinding(ValueRepresentation.class.getName());
- setDataBinding(interfaceContract.getInterface(), false);
- }
-
- List<Reference> references = implementation.getReferences();
- for (Reference reference : references) {
- InterfaceContract interfaceContract = reference.getInterfaceContract();
- //interfaceContract.getInterface().setDefaultDataBinding(ValueRepresentation.class.getName());
- setDataBinding(interfaceContract.getInterface(), true);
- }
- }
-
- public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
- return new XQueryInvoker(service, operation, implementation, referenceProxies, properties);
- }
-
- public boolean supportsOneWayInvocation() {
- return false;
- }
-
- public void start() {
-
- for (Reference reference : component.getReferences()) {
- String refName = reference.getName();
- if (refName.startsWith("$self$.")) {
- continue;
- }
- Class interfaze = ((JavaInterface)reference.getInterfaceContract().getInterface()).getJavaClass();
- Object refProxy = component.getComponentContext().getService(interfaze, refName);
- referenceProxies.put(refName, refProxy);
- }
-
- for (ComponentProperty property : component.getProperties()) {
- String propName = property.getName();
- QName xmlType = property.getXSDType();
- Class clazz = JavaXMLMapper.getJavaType(xmlType);
-
- Object propertyValue = null;
- if (clazz == null || java.lang.Object.class.equals(clazz)) {
- propertyValue = property.getValue();
- } else {
- ObjectFactory objfactory = javaFactory.createValueFactory(property, property.getValue(), clazz);
- propertyValue = objfactory.getInstance();
- }
- properties.put(propName, propertyValue);
- }
- }
-
- private void setDataBinding(Interface interfaze, boolean isReference) {
- List<Operation> operations = interfaze.getOperations();
- for (Operation operation : operations) {
- operation.setDataBinding(SaxonNodeDataBinding.NAME);
- DataType<List<DataType>> inputType = operation.getInputType();
- if (inputType != null) {
- List<DataType> logical = inputType.getLogical();
- for (DataType inArg : logical) {
- if (SimpleJavaDataBinding.NAME.equals(inArg.getDataBinding())) {
- if (!isReference) {
- inArg.setDataBinding(SaxonValueDataBinding.NAME);
- }
- } else {
- inArg.setDataBinding(SaxonNodeDataBinding.NAME);
- }
- }
- }
- DataType outputType = operation.getOutputType();
- if (outputType != null) {
- if (SimpleJavaDataBinding.NAME.equals(outputType.getDataBinding())) {
- if (!isReference) {
- outputType.setDataBinding(SaxonValueDataBinding.NAME);
- }
- } else {
- outputType.setDataBinding(SaxonNodeDataBinding.NAME);
- }
- }
- }
- }
-
- public void stop() {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.java
deleted file mode 100644
index 05c4c51086..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryImplementationProviderFactory.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.implementation.xquery;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.databinding.Mediator;
-import org.apache.tuscany.sca.implementation.java.injection.JavaPropertyValueObjectFactory;
-import org.apache.tuscany.sca.provider.ImplementationProvider;
-import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * A factory for XQuery implementation providers
- * @version $Rev$ $Date$
- */
-public class XQueryImplementationProviderFactory implements ImplementationProviderFactory<XQueryImplementation> {
-
- private JavaPropertyValueObjectFactory javaFactory;
-
- public XQueryImplementationProviderFactory(ExtensionPointRegistry registry) {
- Mediator mediator = registry.getExtensionPoint(UtilityExtensionPoint.class).getUtility(Mediator.class);
- this.javaFactory = new JavaPropertyValueObjectFactory(mediator);
- }
-
- public ImplementationProvider createImplementationProvider(RuntimeComponent component,
- XQueryImplementation implementation) {
- return new XQueryImplementationProvider(component, implementation, javaFactory);
- }
-
- public Class<XQueryImplementation> getModelType() {
- return XQueryImplementation.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.java
deleted file mode 100644
index 0c628b3715..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvokationException.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.implementation.xquery;
-
-/**
- * Exception class used by the XQueryInvoker to report problems in
- * XQuery script invocation
- * @version $Rev$ $Date$
- */
-public class XQueryInvokationException extends Exception {
-
- private static final long serialVersionUID = -2674411654705699541L;
-
- public XQueryInvokationException(String msg) {
- super(msg);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java
deleted file mode 100644
index 2a9673068b..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/XQueryInvoker.java
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-
-import net.sf.saxon.Configuration;
-import net.sf.saxon.event.Builder;
-import net.sf.saxon.om.DocumentInfo;
-import net.sf.saxon.om.Item;
-import net.sf.saxon.om.NodeInfo;
-import net.sf.saxon.om.SequenceIterator;
-import net.sf.saxon.query.DynamicQueryContext;
-import net.sf.saxon.query.QueryResult;
-import net.sf.saxon.query.StaticQueryContext;
-import net.sf.saxon.query.XQueryExpression;
-import net.sf.saxon.trans.XPathException;
-import net.sf.saxon.value.Value;
-
-import org.apache.tuscany.sca.databinding.saxon.SaxonDataBindingHelper;
-import org.apache.tuscany.sca.databinding.saxon.collection.ItemList;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Performs the invocation of a requested XQuery function
- * @version $Rev$ $Date$
- */
-public class XQueryInvoker implements Invoker {
-
- private RuntimeComponentService service;
- private Operation operation;
- private Method theMethod;
- private XQueryImplementation implementation;
- private Map<String, Object> referenceProxies;
- private Map<String, Object> properties;
-
- /**
- * Constructs a new instance of the xquery invoker.
- * Also performs a search of java.lang.Method instance
- * that corresponds to the invoked operation
- */
- public XQueryInvoker(RuntimeComponentService service,
- Operation operation,
- XQueryImplementation implementation,
- Map<String, Object> referenceProxies,
- Map<String, Object> properties) {
- this.service = service;
- this.operation = operation;
- this.implementation = implementation;
- this.referenceProxies = referenceProxies;
- this.properties = properties;
-
- findMatchingMethod();
- }
-
- /**
- * This method contains the XQuery invocation logic
- * The following steps are performed:
- * 1. XQuery expression is produced by combining the original expression
- * and the function invocation extension (See XQueryImplementation.getXqExpressionExtensionsMap()
- * for details)
- * 2. A check is performed if this expression has been invoked already. If yes -
- * it is taken from the cache
- * 3. Configuration for the execution is either created or retrieved from
- * the cached expression
- * 4. The input parameters of the operation to be invoked are taken from the
- * payload and transformed to ones that are built with the current
- * configuration.
- * NOTE: This is unnecessary overhead - can the Configuration
- * object be attached in some way to the invocation request?
- * 5. All parameters, reference proxies and property values are mapped
- * to external variables of the XQuery script
- * 6. The query is executed and all the results are stored in a ItemList object
- *
- * NOTE: During execution of the XQuery a static variable is set with
- * the current configuration. This variable is used by the NodeInfo transformers
- * to produce the correct NodeInfo for all Output2Output transformations, which
- * happen as result of the XQuery component invoking some reference components
- * The old state of the static configuration is preserved and in this way allowing
- * to nest XQuery component invocations (i.e. one XQuery component invokes another
- * one)
- */
- private Object doInvoke(Object payload) throws XQueryInvokationException, XPathException {
- if (theMethod == null) {
- throw new XQueryInvokationException("No java method for operation: " + operation.getName());
- }
- String xqExpression =
- implementation.getXqExpression() + implementation.getXqExpressionExtensionsMap().get(theMethod);
-
- Configuration config = null;
- Properties props = new Properties();
- props.setProperty(OutputKeys.METHOD, "xml");
- props.setProperty(OutputKeys.INDENT, "yes");
-
- XQueryExpression exp = implementation.getCompiledExpressionsCache().get(xqExpression);
- if (exp == null) {
- config = new Configuration();
- StaticQueryContext sqc = new StaticQueryContext(config);
- exp = sqc.compileQuery(xqExpression);
- implementation.getCompiledExpressionsCache().put(xqExpression, exp);
- } else {
- config = exp.getStaticContext().getConfiguration();
- }
-
- Object[] params = prepareParameters(payload, config, props);
-
- DynamicQueryContext dynamicContext = new DynamicQueryContext(config);
-
- // Setting the parameters for function invocation
- String methodName = theMethod.getName();
- for (int i = 0; i < params.length; i++) {
- dynamicContext.setParameter(methodName + "_" + i, params[i]);
- }
-
- // Setting references
- for (Map.Entry<String, Object> entry : referenceProxies.entrySet()) {
- dynamicContext.setParameter(entry.getKey(), entry.getValue());
- }
-
- // Setting properties
- for (Map.Entry<String, Object> entry : properties.entrySet()) {
- dynamicContext.setParameter(entry.getKey(), transformProperty(entry.getValue(), config));
- }
-
- SequenceIterator iterator = null;
- Configuration oldConfigValue = SaxonDataBindingHelper.CURR_EXECUTING_CONFIG;
- SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = config;
- try {
- iterator = exp.iterator(dynamicContext);
- } finally {
- SaxonDataBindingHelper.CURR_EXECUTING_CONFIG = oldConfigValue;
- }
-
- ItemList list = new ItemList();
- Item item = iterator.next();
-
- while (item != null) {
- list.add(item);
- item = iterator.next();
-
- }
-
- if (list.size() == 0) {
- return null;
-
- } else if (list.size() == 1) {
-
- item = list.iterator().next();
-
- if (item instanceof NodeInfo) {
- return item;
- } else {
- return Value.asValue(item);
- }
-
- }
-
- return list;
-
- }
-
- public Message invoke(Message msg) {
- try {
- Object resp = doInvoke(msg.getBody());
- msg.setBody(resp);
- } catch (XQueryInvokationException e) {
- msg.setFaultBody(e.getCause());
- } catch (XPathException e) {
- msg.setFaultBody(e.getCause());
- }
- return msg;
- }
-
- private void findMatchingMethod() {
- Class<?> interfaze = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
-
- for (Method method : interfaze.getMethods()) {
- if (match(operation, method)) {
- theMethod = method;
- }
- }
- }
-
- private static boolean match(Operation operation, Method method) {
- Class<?>[] params = method.getParameterTypes();
- DataType<List<DataType>> inputType = operation.getInputType();
- List<DataType> types = inputType.getLogical();
- boolean matched = true;
- if (types.size() == params.length && method.getName().equals(operation.getName())) {
- for (int i = 0; i < params.length; i++) {
- Class<?> clazz = params[i];
- if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
- matched = false;
- }
- }
- } else {
- matched = false;
- }
- return matched;
-
- }
-
- private Object[] prepareParameters(Object payload, Configuration configuration, Properties props) {
- if (payload == null) {
- return new Object[0];
- }
- Object[] inputArguments = null;
- if (payload.getClass().isArray()) {
- inputArguments = (Object[])payload;
- } else {
- inputArguments = new Object[1];
- inputArguments[0] = payload;
- }
-
- Object[] parameters = new Object[inputArguments.length];
-
- for (int i = 0; i < inputArguments.length; i++) {
- if (inputArguments[i] instanceof NodeInfo) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- StreamResult sw = new StreamResult(baos);
- try {
- QueryResult.serialize((NodeInfo)inputArguments[i], sw, props, ((NodeInfo)inputArguments[i]).getConfiguration());
- baos.close();
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- StreamSource ss = new StreamSource(bais);
- parameters[i] = Builder.build(ss, null, configuration);
- } catch (Exception e) {
- e.printStackTrace();
- parameters[i] = null;
- }
- } else {
- parameters[i] = inputArguments[i];
- }
- }
-
- return parameters;
- }
-
- private Object transformProperty(Object argument, Configuration configuration) {
- Object parameter = argument;
- if (argument instanceof Document) {
- try {
- Document doc = (Document)argument;
- Node valueNode = doc.getFirstChild();
- DocumentInfo docInfo = null;
- if (valueNode instanceof Element && valueNode.getNodeName().equals("value")) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- StreamResult sr = new StreamResult(baos);
- try {
- Node element = null;
- NodeList list = valueNode.getChildNodes();
- for (int i = 0; i < list.getLength(); i++) {
- if (list.item(i).getNodeType() == Node.ELEMENT_NODE) {
- element = list.item(i);
- break;
- }
- }
- if (element == null) {
- element = valueNode.getFirstChild();
- }
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.transform(new DOMSource(element), sr);
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- docInfo = (DocumentInfo)Builder.build(new StreamSource(bais), null, configuration);
- } catch (Exception e) {
- e.printStackTrace();
- return parameter;
- }
- } else {
- docInfo = (DocumentInfo)Builder.build(new DOMSource(doc), null, configuration);
- }
- parameter = docInfo;
- } catch (XPathException e) {
- e.printStackTrace();
- return parameter;
- }
- }
-
- return parameter;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.java
deleted file mode 100644
index 5e77575c3c..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationFactoryImpl.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.implementation.xquery.impl;
-
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementationFactory;
-
-/**
- * Actual implementation of the XQuery implementation factory
- * @version $Rev$ $Date$
- */
-public class XQueryImplementationFactoryImpl implements XQueryImplementationFactory {
-
- public XQueryImplementation createXQueryImplementation() {
- XQueryImplementation implementation = new XQueryImplementationImpl();
- return implementation;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java
deleted file mode 100644
index 77c8eea511..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/impl/XQueryImplementationImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery.impl;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.saxon.query.XQueryExpression;
-
-import org.apache.tuscany.sca.assembly.impl.ImplementationImpl;
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
-
-/**
- * Actual implementation of the XQuery implementation
- * @version $Rev$ $Date$
- */
-public class XQueryImplementationImpl extends ImplementationImpl implements XQueryImplementation {
-
- private String location;
- private String locationURL;
- private String xqExpression;
-
- private Map<String, XQueryExpression> compiledExpressionsCache = new HashMap<String, XQueryExpression>();
- private Map<Method, String> xqExpressionExtensionsMap = new HashMap<Method, String>();
-
- public XQueryImplementationImpl() {
- setUnresolved(true);
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public String getLocationURL() {
- return locationURL;
- }
-
- public void setLocationURL(String locationURL) {
- this.locationURL = locationURL;
- }
-
- public String getXqExpression() {
- return xqExpression;
- }
-
- public void setXqExpression(String xqExpression) {
- this.xqExpression = xqExpression;
- }
-
- public Map<String, XQueryExpression> getCompiledExpressionsCache() {
- return compiledExpressionsCache;
- }
-
- public Map<Method, String> getXqExpressionExtensionsMap() {
- return xqExpressionExtensionsMap;
- }
-
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = super.hashCode();
- result = PRIME * result + ((location == null) ? 0 : location.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null || getClass() != obj.getClass())
- return false;
- final XQueryImplementationImpl other = (XQueryImplementationImpl)obj;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
deleted file mode 100644
index 12c478daea..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryImplementationProcessor.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery.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.xml.Constants;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Processor for the XQuery implementation type artifact
- * @version $Rev$ $Date$
- */
-public class XQueryImplementationProcessor implements StAXArtifactProcessor<XQueryImplementation> {
-
- private static final String LOCATION = "location";
- private static final String IMPLEMENTATION_XQUERY = "implementation.xquery";
- private static final QName IMPLEMENTATION_XQUERY_QNAME =
- new QName(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
- private ContributionFactory contributionFactory;
- private Monitor monitor;
-
- public XQueryImplementationProcessor(ModelFactoryExtensionPoint modelFactoryExtensionPoint, Monitor monitor) {
- assemblyFactory = modelFactoryExtensionPoint.getFactory(AssemblyFactory.class);
- javaFactory = modelFactoryExtensionPoint.getFactory(JavaInterfaceFactory.class);
- contributionFactory = modelFactoryExtensionPoint.getFactory(ContributionFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "impl-xquery-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return IMPLEMENTATION_XQUERY_QNAME;
- }
-
- /**
- * Reads from the stream and sets the location attribute of the implementation correspondingly
- */
- public XQueryImplementation read(XMLStreamReader reader)
- throws ContributionReadException, XMLStreamException {
-
- /* Create the XQuery implementation and set the location into it */
- XQueryImplementation xqueryImplementation = null;
-
- /* Read the location attribute for the XQuery implementation */
- String xqueryLocation = reader.getAttributeValue(null, LOCATION);
- if (xqueryLocation != null) {
- xqueryImplementation = XQueryImplementationFactory.INSTANCE.createXQueryImplementation();
- xqueryImplementation.setLocation(xqueryLocation);
- xqueryImplementation.setUnresolved(true);
- } else {
- error("LocationAttributeMissing", reader);
- //throw new ContributionReadException(MSG_LOCATION_MISSING);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && IMPLEMENTATION_XQUERY_QNAME.equals(reader.getName())) {
- break;
- }
- } // end while
-
- return xqueryImplementation;
- }
-
- public void write(XQueryImplementation xqueryImplementation, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
-
- writer.writeStartElement(Constants.SCA10_TUSCANY_NS, IMPLEMENTATION_XQUERY);
- if (xqueryImplementation.getLocation() != null) {
- writer.writeAttribute(LOCATION, xqueryImplementation.getLocation());
- }
- writer.writeEndElement();
-
- }
-
- public Class<XQueryImplementation> getModelType() {
- return XQueryImplementation.class;
- }
-
- /**
- * Resolves the implementation: its services and references, by invoking the XQuery
- * introspector
- */
- public void resolve(XQueryImplementation xqueryImplementation, ModelResolver resolver)
- throws ContributionResolveException {
-
- if (xqueryImplementation != null) {
- Artifact artifact = contributionFactory.createArtifact();
- artifact.setURI(xqueryImplementation.getLocation());
- artifact = resolver.resolveModel(Artifact.class, artifact);
- if (artifact.getLocation() != null) {
- xqueryImplementation.setLocationURL(artifact.getLocation());
-
- XQueryIntrospector introspector = new XQueryIntrospector(assemblyFactory, javaFactory);
-
- boolean success = introspector.introspect(xqueryImplementation, resolver);
- if (success) {
- xqueryImplementation.setUnresolved(false);
- }
- } else {
- error("CouldNotLocateFile", resolver, xqueryImplementation.getLocation());
- //throw new ContributionResolveException("Could not locate file: " + xqueryImplementation.getLocation());
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java
deleted file mode 100644
index d1e74dd40d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/java/org/apache/tuscany/sca/implementation/xquery/xml/XQueryIntrospector.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.xquery.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import net.sf.saxon.Configuration;
-import net.sf.saxon.om.NamespaceResolver;
-import net.sf.saxon.query.StaticQueryContext;
-import net.sf.saxon.query.XQueryExpression;
-import net.sf.saxon.trans.XPathException;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-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.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.implementation.xquery.XQueryImplementation;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-
-/**
- * This class introspects an XQuery file and extracts out of it
- * all implemented service, references and properties
- * It also creates expression extensions for each operation
- * in the implemented services
- * @version $Rev$ $Date$
- */
-public class XQueryIntrospector {
-
- private static final String SCA_SERVICE_PREFIX = "scaservice:java/";
- private static final String SCA_REFERENCE_PREFIX = "scareference:java/";
- private static final String SCA_PROPERTY_JAVA_PREFIX = "scaproperty:java/";
- private static final String SCA_PROPERTY_XML_PREFIX = "scaproperty:xml/";
-
- private AssemblyFactory assemblyFactory;
- private JavaInterfaceFactory javaFactory;
-
- public XQueryIntrospector(AssemblyFactory assemblyFactory, JavaInterfaceFactory javaFactory) {
- super();
- this.assemblyFactory = assemblyFactory;
- this.javaFactory = javaFactory;
- }
-
- public boolean introspect(XQueryImplementation xqueryImplementation, ModelResolver resolver) throws ContributionResolveException {
-
- String xqExpression = null;
- try {
- URL url = new URL(xqueryImplementation.getLocationURL());
- xqExpression = loadXQExpression(url);
- } catch (FileNotFoundException e) {
- throw new ContributionResolveException(e);
- } catch (IOException e) {
- throw new ContributionResolveException(e);
- }
-
- if (xqExpression == null) {
- return false;
- }
-
- xqueryImplementation.setXqExpression(xqExpression);
-
- xqExpression += "\r\n<dummy></dummy>";
-
- Configuration config = new Configuration();
- StaticQueryContext sqc = new StaticQueryContext(config);
- XQueryExpression exp = null;
- try {
- exp = sqc.compileQuery(xqExpression);
- } catch (XPathException e) {
- throw new ContributionResolveException(e);
- }
-
- if (exp == null) {
- return false;
- }
- xqueryImplementation.getCompiledExpressionsCache().put(xqExpression, exp);
-
- try {
- introspectServicesAndReferences(xqueryImplementation, exp, resolver);
- } catch (ClassNotFoundException e) {
- throw new ContributionResolveException(e);
- } catch (InvalidInterfaceException e) {
- throw new ContributionResolveException(e);
- }
-
- fillExpressionExtensions(xqueryImplementation);
-
- return true;
- }
-
- /**
- * Loads the XQuery expression from the location that is provided with the implementation
- */
- private String loadXQExpression(URL locationURL) throws FileNotFoundException, IOException {
-
- InputStream xqResourceStream = locationURL.openStream();
-
- if (xqResourceStream == null) {
- return null;
- }
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- int i = 0;
- while ((i = xqResourceStream.read()) >= 0) {
- baos.write(i);
- }
- xqResourceStream.close();
- baos.flush();
- baos.close();
-
- String xqExpression = baos.toString();
-
- return xqExpression;
- }
-
- private Class<?> resolveClass(ModelResolver resolver, String className) throws ClassNotFoundException {
- ClassReference classReference = new ClassReference(className);
- classReference = resolver.resolveModel(ClassReference.class, classReference);
- Class<?> javaClass = classReference.getJavaClass();
- if (javaClass == null) {
- throw new ClassNotFoundException(className);
- } else {
- return javaClass;
- }
- }
-
- /**
- * From the compiled XQuery expression get all namespaces and see if they
- * are services, references or properties declarations
- */
- private void introspectServicesAndReferences(XQueryImplementation xqueryImplementation, XQueryExpression exp, ModelResolver resolver)
- throws ClassNotFoundException, InvalidInterfaceException {
- NamespaceResolver namespaceResolver = exp.getStaticContext().getNamespaceResolver();
- Iterator declaredPrefixesIterator = namespaceResolver.iteratePrefixes();
- while (declaredPrefixesIterator.hasNext()) {
- String prefix = (String)declaredPrefixesIterator.next();
- String uri = namespaceResolver.getURIForPrefix(prefix, false);
- if (uri.startsWith(SCA_SERVICE_PREFIX)) {
- String serviceName = prefix;
- String className = uri.substring(SCA_SERVICE_PREFIX.length());
- Class<?> interfaze = resolveClass(resolver, className);
- Service theService = createService(interfaze, serviceName);
- xqueryImplementation.getServices().add(theService);
- } else if (uri.startsWith(SCA_REFERENCE_PREFIX)) {
- String referenceName = prefix;
- String className = uri.substring(SCA_REFERENCE_PREFIX.length());
- Class<?> interfaze = resolveClass(resolver, className);
- Reference theReference = createReference(interfaze, referenceName);
- xqueryImplementation.getReferences().add(theReference);
- } else if (uri.startsWith(SCA_PROPERTY_JAVA_PREFIX)) {
- String propertyName = prefix;
- String className = uri.substring(SCA_PROPERTY_JAVA_PREFIX.length());
- Class<?> clazz = resolveClass(resolver, className);
- QName xmlType = JavaXMLMapper.getXMLType(clazz);
- Property theProperty = createProperty(xmlType, propertyName);
- xqueryImplementation.getProperties().add(theProperty);
- } else if (uri.startsWith(SCA_PROPERTY_XML_PREFIX)) {
- String propertyName = prefix;
- String namespaceAndLocalname = uri.substring(SCA_PROPERTY_XML_PREFIX.length());
- int localNameDelimiterPostition = namespaceAndLocalname.lastIndexOf(':');
- String localName = null;
- String namespace = null;
- if (localNameDelimiterPostition < 0) {
- localName = namespaceAndLocalname;
- namespace = "";
- } else {
- namespace = namespaceAndLocalname.substring(0, localNameDelimiterPostition);
- localName = namespaceAndLocalname.substring(localNameDelimiterPostition + 1);
- }
- QName xmlType = new QName(namespace, localName);
- Property theProperty = createProperty(xmlType, propertyName);
- xqueryImplementation.getProperties().add(theProperty);
- }
- }
- }
-
- /**
- * Creates a Service for the component type based on its name and Java interface
- */
- private Service createService(Class<?> interfaze, String name) throws InvalidInterfaceException {
- Service service = assemblyFactory.createService();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- service.setInterfaceContract(interfaceContract);
-
- // Set the name for the service
- service.setName(name);
-
- // Set the call interface and, if present, the callback interface
- JavaInterface callInterface = null;
- try {
- callInterface = (JavaInterface) javaFactory.createJavaInterface(interfaze).clone();
- } catch (CloneNotSupportedException e) {
- // Ignore
- }
- //setDataBindingForInterface(callInterface, DataObject.class.getName());
- service.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = null;
- try {
- callbackInterface = (JavaInterface) javaFactory.createJavaInterface(callInterface.getCallbackClass()).clone();
- } catch (CloneNotSupportedException e) {
- //Ignore
- }
- //setDataBindingForInterface(callbackInterface, DataObject.class.getName());
- service.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
- return service;
- } // end method createService
-
- protected Property createProperty(QName type, String name) {
-
- Property property = assemblyFactory.createProperty();
- property.setName(name);
- property.setXSDType(type);
-
- property.setMany(false);
- return property;
-
- }
-
- /**
- * Creates a Reference for the component type based on its name and Java interface
- */
- private Reference createReference(Class<?> interfaze, String name) throws InvalidInterfaceException {
- Reference reference = assemblyFactory.createReference();
- JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
- reference.setInterfaceContract(interfaceContract);
-
- // Set the name of the reference to the supplied name and the multiplicity of the reference
- // to 1..1 - for XQuery implementations, this is the only multiplicity supported
- reference.setName(name);
- reference.setMultiplicity(Multiplicity.ONE_ONE);
-
- // Set the call interface and, if present, the callback interface
- // Set the call interface and, if present, the callback interface
- JavaInterface callInterface = null;
- try {
- callInterface = (JavaInterface) javaFactory.createJavaInterface(interfaze).clone();
- } catch (CloneNotSupportedException e) {
- // Ignore
- }
- reference.getInterfaceContract().setInterface(callInterface);
- if (callInterface.getCallbackClass() != null) {
- JavaInterface callbackInterface = null;
- try {
- callbackInterface = (JavaInterface) javaFactory.createJavaInterface(callInterface.getCallbackClass()).clone();
- } catch (CloneNotSupportedException e) {
- //Ignore
- }
- reference.getInterfaceContract().setCallbackInterface(callbackInterface);
- }
-
- return reference;
- }
-
- /**
- * For the methods of each implemented service corresponding expression extension
- * is generated
- * @param xqueryImplementation
- */
- private void fillExpressionExtensions(XQueryImplementation xqueryImplementation) {
- for (Service service : xqueryImplementation.getServices()) {
- Class<?> interfaze = ((JavaInterface)service.getInterfaceContract().getInterface()).getJavaClass();
-
- // For each of the methods
- for (Method method : interfaze.getMethods()) {
- String expressionExtension = createExpressionExtension(method, interfaze, service.getName());
- xqueryImplementation.getXqExpressionExtensionsMap().put(method, expressionExtension);
- }
- }
- }
-
- private String createExpressionExtension(Method method, Class<?> interfaze, String serviceName) {
- StringBuffer exprBuf = new StringBuffer();
-
- exprBuf.append("\r\n");
-
- String methodName = method.getName();
-
- // For each of the declared parameters
- for (int i = 0; i < method.getParameterTypes().length; i++) {
- exprBuf.append("declare variable $" + methodName + "_" + i + " external;\r\n");
- }
-
- exprBuf.append(serviceName + ":" + methodName + "(");
-
- for (int i = 0; i < method.getParameterTypes().length; i++) {
- exprBuf.append("$" + methodName + "_" + i);
- if (i != method.getParameterTypes().length - 1) {
- exprBuf.append(", ");
- }
- }
- exprBuf.append(")");
-
- return exprBuf.toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index a51995e56d..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.xquery.xml.XQueryImplementationProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#implementation.xquery,model=org.apache.tuscany.sca.implementation.xquery.XQueryImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
deleted file mode 100644
index 7ccc08d1ee..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.ImplementationProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the implementation extension
-org.apache.tuscany.sca.implementation.xquery.XQueryImplementationProviderFactory;model=org.apache.tuscany.sca.implementation.xquery.XQueryImplementation
diff --git a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/impl-xquery-validation-messages.properties b/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/impl-xquery-validation-messages.properties
deleted file mode 100644
index 33c605de27..0000000000
--- a/branches/sca-java-1.5.1/modules/implementation-xquery/src/main/resources/impl-xquery-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-CouldNotLocateFile = Could not locate file: {0}
-LocationAttributeMissing = Reading implementation.xquery - location attribute missing \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/LICENSE b/branches/sca-java-1.5.1/modules/interface-java-jaxws/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/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-java-1.5.1/modules/interface-java-jaxws/NOTICE b/branches/sca-java-1.5.1/modules/interface-java-jaxws/NOTICE
deleted file mode 100644
index 94481d6cfa..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2007 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/pom.xml b/branches/sca-java-1.5.1/modules/interface-java-jaxws/pom.xml
deleted file mode 100644
index 7bbc58c1bd..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/pom.xml
+++ /dev/null
@@ -1,303 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface-java-jaxws</artifactId>
- <name>Apache Tuscany SCA Java Interface for JAXWS</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-databinding-jaxb</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.ws</groupId>
- <artifactId>jaxws-api</artifactId>
- <version>2.1</version>
- <exclusions>
- <exclusion>
- <groupId>javax.xml.soap</groupId>
- <artifactId>saaj-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- Explicitly add the transitive dependencies for jaxws-api
- http://jira.codehaus.org/browse/MEV-498
- -->
- <dependency>
- <groupId>javax.jws</groupId>
- <artifactId>jsr181-api</artifactId>
- <version>1.0-MR1</version>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-all</artifactId>
- <version>3.1</version>
- <scope>compile</scope>
- </dependency>
-
- </dependencies>
-
- <repositories>
- <repository>
- <id>java.net</id>
- <name>java.net Maven 1.x Repository</name>
- <url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
- <repository>
- <id>java.net2</id>
- <name>java.net Maven 2.x Repository</name>
- <url>http://download.java.net/maven/2</url>
- </repository>
- </repositories>
-
- <pluginRepositories>
- <pluginRepository>
- <id>java.net2</id>
- <name>java.net Maven 2.x Repository</name>
- <url>http://download.java.net/maven/2</url>
- </pluginRepository>
- </pluginRepositories>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Djava.endorsed.dirs=target/endorsed</argLine>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>javax.xml.ws</groupId>
- <artifactId>jaxws-api</artifactId>
- <version>2.1</version>
- <type>jar</type>
- </artifactItem>
- <artifactItem>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>2.1</version>
- <type>jar</type>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/endorsed</outputDirectory>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <id>add-test-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-test-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/jaxws-source</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jaxws-maven-plugin</artifactId>
- <version>1.9</version>
- <!-- Explicitly add the transitive dependencies for jaxws-api
- http://jira.codehaus.org/browse/MEV-498
- -->
- <dependencies>
- <dependency>
- <groupId>javax.jws</groupId>
- <artifactId>jsr181-api</artifactId>
- <version>1.0-MR1</version>
- </dependency>
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>wsimport</id>
- <phase>generate-test-sources</phase>
- <goals>
- <goal>wsimport</goal>
- </goals>
- <configuration>
- <packageName>com.example.stock</packageName>
- <wsdlDirectory>${basedir}/src/test/resources/wsdl</wsdlDirectory>
- <wsdlFiles>
- <wsdlFile>StockExceptionTest.wsdl</wsdlFile>
- </wsdlFiles>
- <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
- <verbose>false</verbose>
- <xnocompile>true</xnocompile>
- </configuration>
- </execution>
-
- <!--
- <execution>
- <id>wsgen</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>wsgen-test</goal>
- </goals>
- <configuration>
- <sei>org.apache.tuscany.sca.interfacedef.java.jaxws.MyServiceImpl</sei>
- <genWsdl>true</genWsdl>
- <keep>true</keep>
- <resourceDestDir>${project.build.directory}/jaxws-source</resourceDestDir>
- <sourceDestDir>${project.build.directory}/jaxws-source</sourceDestDir>
- </configuration>
- </execution>
- -->
- </executions>
-
- </plugin>
-
- <!--
- wsimport cannot handle WSDL files without a service/binding element.
- CXF wsdl2java plugin does support that. I had to override the default
- value of wsdlRoot/testWsdlRoot to a non-existent file to avoid NPE -->
- <!--
- <plugin>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-codegen-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>generate-sources</id>
- <phase>generate-sources</phase>
-
- <configuration>
- <sourceRoot>${basedir}/target/jaxws-source</sourceRoot>
- <wsdlRoot>NONE</wsdlRoot>
- <testWsdlRoot>NONE</testWsdlRoot>
- <wsdlOptions>
- <wsdlOption>
- <wsdl>${basedir}/src/test/resources/wsdl/Stock.wsdl</wsdl>
- <outputDir>${basedir}/target/jaxws-source</outputDir>
- <packagenames>
- <packagename>com.example.stock.cxf</packagename>
- </packagenames>
- </wsdlOption>
- </wsdlOptions>
- </configuration>
- <goals>
- <goal>wsdl2java</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- -->
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface.java.jaxws</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef.java.jaxws*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>default-tools.jar</id>
- <activation>
- <property>
- <name>java.vendor</name>
- <value>Sun Microsystems Inc.</value>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- <version>1.5.0</version>
- <scope>system</scope>
- <systemPath>${java.home}/../lib/tools.jar</systemPath>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java
deleted file mode 100644
index cd3a4b3e1f..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/BaseBeanGenerator.java
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import javax.xml.bind.annotation.XmlAttachmentRef;
-import javax.xml.bind.annotation.XmlList;
-import javax.xml.bind.annotation.XmlMimeType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import javax.xml.ws.Holder;
-
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.ClassWriter;
-import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-
-public abstract class BaseBeanGenerator implements Opcodes {
- private static final Map<String, String> COLLECTION_CLASSES = new HashMap<String, String>();
- static {
- COLLECTION_CLASSES.put("Ljava/util/Collection;", "java/util/ArrayList");
- COLLECTION_CLASSES.put("Ljava/util/List;", "java/util/ArrayList");
- COLLECTION_CLASSES.put("Ljava/util/Set;", "java/util/HashSet");
- COLLECTION_CLASSES.put("Ljava/util/Queue;", "java/util/LinkedList");
- }
- private final static Class[] KNOWN_JAXB_ANNOTATIONS =
- {XmlAttachmentRef.class, XmlMimeType.class, XmlJavaTypeAdapter.class, XmlList.class};
- private static final Map<String, String> JAVA_KEYWORDS = new HashMap<String, String>();
-
- static {
- JAVA_KEYWORDS.put("abstract", "_abstract");
- JAVA_KEYWORDS.put("assert", "_assert");
- JAVA_KEYWORDS.put("boolean", "_boolean");
- JAVA_KEYWORDS.put("break", "_break");
- JAVA_KEYWORDS.put("byte", "_byte");
- JAVA_KEYWORDS.put("case", "_case");
- JAVA_KEYWORDS.put("catch", "_catch");
- JAVA_KEYWORDS.put("char", "_char");
- JAVA_KEYWORDS.put("class", "_class");
- JAVA_KEYWORDS.put("const", "_const");
- JAVA_KEYWORDS.put("continue", "_continue");
- JAVA_KEYWORDS.put("default", "_default");
- JAVA_KEYWORDS.put("do", "_do");
- JAVA_KEYWORDS.put("double", "_double");
- JAVA_KEYWORDS.put("else", "_else");
- JAVA_KEYWORDS.put("extends", "_extends");
- JAVA_KEYWORDS.put("false", "_false");
- JAVA_KEYWORDS.put("final", "_final");
- JAVA_KEYWORDS.put("finally", "_finally");
- JAVA_KEYWORDS.put("float", "_float");
- JAVA_KEYWORDS.put("for", "_for");
- JAVA_KEYWORDS.put("goto", "_goto");
- JAVA_KEYWORDS.put("if", "_if");
- JAVA_KEYWORDS.put("implements", "_implements");
- JAVA_KEYWORDS.put("import", "_import");
- JAVA_KEYWORDS.put("instanceof", "_instanceof");
- JAVA_KEYWORDS.put("int", "_int");
- JAVA_KEYWORDS.put("interface", "_interface");
- JAVA_KEYWORDS.put("long", "_long");
- JAVA_KEYWORDS.put("native", "_native");
- JAVA_KEYWORDS.put("new", "_new");
- JAVA_KEYWORDS.put("null", "_null");
- JAVA_KEYWORDS.put("package", "_package");
- JAVA_KEYWORDS.put("private", "_private");
- JAVA_KEYWORDS.put("protected", "_protected");
- JAVA_KEYWORDS.put("public", "_public");
- JAVA_KEYWORDS.put("return", "_return");
- JAVA_KEYWORDS.put("short", "_short");
- JAVA_KEYWORDS.put("static", "_static");
- JAVA_KEYWORDS.put("strictfp", "_strictfp");
- JAVA_KEYWORDS.put("super", "_super");
- JAVA_KEYWORDS.put("switch", "_switch");
- JAVA_KEYWORDS.put("synchronized", "_synchronized");
- JAVA_KEYWORDS.put("this", "_this");
- JAVA_KEYWORDS.put("throw", "_throw");
- JAVA_KEYWORDS.put("throws", "_throws");
- JAVA_KEYWORDS.put("transient", "_transient");
- JAVA_KEYWORDS.put("true", "_true");
- JAVA_KEYWORDS.put("try", "_try");
- JAVA_KEYWORDS.put("void", "_void");
- JAVA_KEYWORDS.put("volatile", "_volatile");
- JAVA_KEYWORDS.put("while", "_while");
- JAVA_KEYWORDS.put("enum", "_enum");
- }
-
- protected static final Map<Object, Class<?>> generatedClasses =
- Collections.synchronizedMap(new WeakHashMap<Object, Class<?>>());
-
- protected XMLAdapterExtensionPoint xmlAdapters;
-
- public byte[] defineClass(ClassWriter cw,
- String classDescriptor,
- String classSignature,
- String namespace,
- String name,
- BeanProperty[] properties) {
- // Declare the class
- declareClass(cw, classDescriptor);
-
- // Compute the propOrder
- String[] propOrder = null;
- if (properties != null && properties.length > 0) {
- int size = properties.length;
- propOrder = new String[size];
- for (int i = 0; i < size; i++) {
- propOrder[i] = getFieldName(properties[i].getName());
- }
- }
- // Annotate the class
- annotateClass(cw, name, namespace, propOrder);
-
- // Decalre the default constructor
- declareConstructor(cw, classSignature);
- if (properties != null) {
- for (BeanProperty p : properties) {
- boolean isElement = p.isElement() && (!Map.class.isAssignableFrom(p.getType()));
- String xmlAdapterClassSignature = null;
- if (xmlAdapters != null) {
- Class<?> adapterClass = xmlAdapters.getAdapter(p.getType());
- if (adapterClass != null) {
- xmlAdapterClassSignature = CodeGenerationHelper.getSignature(adapterClass);
- }
- }
- declareProperty(cw, classDescriptor, classSignature, p.getName(), p.getSignature(), p
- .getGenericSignature(), isElement, p.isNillable(), xmlAdapterClassSignature, p.getJaxbAnnotaions());
- }
- }
-
- // Close the generation
- cw.visitEnd();
- return cw.toByteArray();
- }
-
- protected static boolean isHolder(java.lang.reflect.Type type) {
- if (type instanceof ParameterizedType) {
- Class<?> cls = CodeGenerationHelper.getErasure(type);
- return cls == Holder.class;
- }
- return false;
- }
-
- protected static java.lang.reflect.Type getHolderValueType(java.lang.reflect.Type paramType) {
- if (paramType instanceof ParameterizedType) {
- ParameterizedType p = (ParameterizedType)paramType;
- Class<?> cls = CodeGenerationHelper.getErasure(p);
- if (cls == Holder.class) {
- return p.getActualTypeArguments()[0];
- }
- }
- return paramType;
- }
-
- protected void declareProperty(ClassWriter cw,
- String classDescriptor,
- String classSignature,
- String propName,
- String propClassSignature,
- String propTypeSignature,
- boolean isElement,
- boolean isNillable,
- String xmlAdapterClassSignature,
- List<Annotation> jaxbAnnotations) {
- if (propClassSignature.equals(propTypeSignature)) {
- propTypeSignature = null;
- }
- declareField(cw,
- propName,
- propClassSignature,
- propTypeSignature,
- isElement,
- isNillable,
- xmlAdapterClassSignature,
- jaxbAnnotations);
- decalreGetter(cw, classDescriptor, classSignature, propName, propClassSignature, propTypeSignature);
- declareSetter(cw, classDescriptor, classSignature, propName, propClassSignature, propTypeSignature);
- }
-
- protected String getFieldName(String propName) {
- String name = JAVA_KEYWORDS.get(propName);
- return name != null ? name : propName;
- }
-
- protected void declareField(ClassWriter cw,
- String propName,
- String propClassSignature,
- String propTypeSignature,
- boolean isElement,
- boolean isNillable,
- String xmlAdapterClassSignature,
- List<Annotation> jaxbAnnotations) {
- FieldVisitor fv;
- AnnotationVisitor av0;
- fv = cw.visitField(ACC_PROTECTED, getFieldName(propName), propClassSignature, propTypeSignature, null);
-
- // For Map property, we cannot have the XmlElement annotation
- if (isElement) {
- av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlElement;", true);
- av0.visit("name", propName);
- av0.visit("namespace", "");
- if (isNillable) {
- av0.visit("nillable", Boolean.TRUE);
- }
- // FIXME:
- // av0.visit("required", Boolean.FALSE);
- av0.visitEnd();
- }
-
- if (xmlAdapterClassSignature != null) {
- av0 = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true);
- av0.visit("value", org.objectweb.asm.Type.getType(xmlAdapterClassSignature));
- av0.visitEnd();
- }
-
- for (Annotation ann : jaxbAnnotations) {
- if (ann instanceof XmlMimeType) {
- AnnotationVisitor mime = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlMimeType;", true);
- mime.visit("value", ((XmlMimeType)ann).value());
- mime.visitEnd();
- } else if (ann instanceof XmlJavaTypeAdapter) {
- AnnotationVisitor ada = fv.visitAnnotation("Ljavax/xml/bind/annotation/adapters/XmlJavaTypeAdapter;", true);
- ada.visit("value", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).value()));
- ada.visit("type", org.objectweb.asm.Type.getType(((XmlJavaTypeAdapter)ann).type()));
- ada.visitEnd();
- } else if (ann instanceof XmlAttachmentRef) {
- AnnotationVisitor att = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlAttachmentRef;", true);
- att.visitEnd();
- } else if (ann instanceof XmlList) {
- AnnotationVisitor list = fv.visitAnnotation("Ljavax/xml/bind/annotation/XmlList;", true);
- list.visitEnd();
- }
- }
-
- fv.visitEnd();
- }
-
- protected void declareSetter(ClassWriter cw,
- String classDescriptor,
- String classSignature,
- String propName,
- String propClassSignature,
- String propTypeSignature) {
- if ("Ljava/util/List;".equals(propClassSignature)) {
- return;
- }
- MethodVisitor mv =
- cw.visitMethod(ACC_PUBLIC,
- "set" + capitalize(propName),
- "(" + propClassSignature + ")V",
- propTypeSignature == null ? null : "(" + propTypeSignature + ")V",
- null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- // mv.visitLineNumber(57, l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitVarInsn(CodeGenerationHelper.getLoadOPCode(propClassSignature), 1);
- mv.visitFieldInsn(PUTFIELD, classDescriptor, getFieldName(propName), propClassSignature);
- Label l1 = new Label();
- mv.visitLabel(l1);
- // mv.visitLineNumber(58, l1);
- mv.visitInsn(RETURN);
- Label l2 = new Label();
- mv.visitLabel(l2);
- mv.visitLocalVariable("this", classSignature, null, l0, l2, 0);
- mv.visitLocalVariable(getFieldName(propName), propClassSignature, propTypeSignature, l0, l2, 1);
- mv.visitMaxs(3, 3);
- mv.visitEnd();
-
- }
-
- protected void decalreGetter(ClassWriter cw,
- String classDescriptor,
- String classSignature,
- String propName,
- String propClassSignature,
- String propTypeSignature) {
- String collectionImplClass = COLLECTION_CLASSES.get(propClassSignature);
- if (collectionImplClass != null) {
- decalreCollectionGetter(cw,
- classDescriptor,
- classSignature,
- propName,
- propClassSignature,
- propTypeSignature,
- collectionImplClass);
- return;
- }
-
- String getterName = ("Z".equals(propClassSignature) ? "is" : "get") + capitalize(propName);
- MethodVisitor mv =
- cw.visitMethod(ACC_PUBLIC, getterName, "()" + propClassSignature, propTypeSignature == null ? null
- : "()" + propTypeSignature, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- // mv.visitLineNumber(48, l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, classDescriptor, getFieldName(propName), propClassSignature);
- mv.visitInsn(CodeGenerationHelper.getReturnOPCode(propClassSignature));
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLocalVariable("this", classSignature, null, l0, l1, 0);
- mv.visitMaxs(2, 1);
- mv.visitEnd();
- }
-
- protected void decalreCollectionGetter(ClassWriter cw,
- String classDescriptor,
- String classSignature,
- String propName,
- String propClassSignature,
- String propTypeSignature,
- String collectionImplClass) {
- String getterName = "get" + capitalize(propName);
- String fieldName = getFieldName(propName);
- MethodVisitor mv =
- cw.visitMethod(ACC_PUBLIC, getterName, "()" + propClassSignature, propTypeSignature == null ? null
- : "()" + propTypeSignature, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- mv.visitLineNumber(63, l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, classDescriptor, fieldName, propClassSignature);
- Label l1 = new Label();
- mv.visitJumpInsn(IFNONNULL, l1);
- Label l2 = new Label();
- mv.visitLabel(l2);
- mv.visitLineNumber(64, l2);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitTypeInsn(NEW, collectionImplClass);
- mv.visitInsn(DUP);
- mv.visitMethodInsn(INVOKESPECIAL, collectionImplClass, "<init>", "()V");
- mv.visitFieldInsn(PUTFIELD, classDescriptor, fieldName, propClassSignature);
- mv.visitLabel(l1);
- mv.visitLineNumber(66, l1);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitFieldInsn(GETFIELD, classDescriptor, fieldName, propClassSignature);
- mv.visitInsn(ARETURN);
- Label l3 = new Label();
- mv.visitLabel(l3);
- mv.visitLocalVariable("this", classSignature, null, l0, l3, 0);
- mv.visitMaxs(3, 1);
- mv.visitEnd();
- }
-
- protected static String capitalize(String name) {
- if (name == null || name.length() == 0) {
- return name;
- } else {
- return Character.toUpperCase(name.charAt(0)) + name.substring(1);
- }
- }
-
- protected void declareConstructor(ClassWriter cw, String classSignature) {
- MethodVisitor mv;
- mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
- mv.visitCode();
- Label l0 = new Label();
- mv.visitLabel(l0);
- // mv.visitLineNumber(37, l0);
- mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
- mv.visitInsn(RETURN);
- Label l1 = new Label();
- mv.visitLabel(l1);
- mv.visitLocalVariable("this", classSignature, null, l0, l1, 0);
- mv.visitMaxs(1, 1);
- mv.visitEnd();
- }
-
- protected void declareClass(ClassWriter cw, String classDescriptor) {
- cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, classDescriptor, null, "java/lang/Object", null);
- }
-
- protected void annotateClass(ClassWriter cw, String name, String namespace, String[] propOrder) {
- AnnotationVisitor av0;
- // @XmlRootElement
- av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlRootElement;", true);
- av0.visit("name", name);
- av0.visit("namespace", namespace);
- av0.visitEnd();
- // @XmlAccessorType
- av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlAccessorType;", true);
- av0.visitEnum("value", "Ljavax/xml/bind/annotation/XmlAccessType;", "FIELD");
- av0.visitEnd();
- // @XmlType
- av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlType;", true);
- av0.visit("name", name);
- av0.visit("namespace", namespace);
- if (propOrder != null) {
- AnnotationVisitor pv = av0.visitArray("propOrder");
- for (String p : propOrder) {
- pv.visit(null, p);
- }
- pv.visitEnd();
- }
- av0.visitEnd();
- }
-
- public Class<?> generate(String classDescriptor,
- String classSignature,
- String namespace,
- String name,
- BeanProperty[] properties,
- GeneratedClassLoader classLoader) {
- ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- byte[] byteCode = defineClass(cw, classDescriptor, classSignature, namespace, name, properties);
- String className = classDescriptor.replace('/', '.');
- Class<?> generated = classLoader.getGeneratedClass(className, byteCode);
- return generated;
- }
-
- public static class BeanProperty {
- private Class<?> type;
- private String namespace;
- private String name;
- private String signature;
- private String genericSignature;
- private List<Annotation> jaxbAnnotaions = new ArrayList<Annotation>();
- private boolean element;
- private boolean nillable;
-
- public BeanProperty(String namespace, String name, Class<?> javaClass, Type type, boolean isElement) {
- super();
- this.namespace = namespace;
- this.name = name;
- this.signature = CodeGenerationHelper.getJAXWSSignature(javaClass);
- this.type = javaClass;
- this.genericSignature = CodeGenerationHelper.getJAXWSSignature(type);
- this.element = isElement;
- // FIXME: How to test nillable?
- // this.nillable = (type instanceof GenericArrayType) || Collection.class.isAssignableFrom(javaClass) || javaClass.isArray();
- // TUSCANY-2389: Set the nillable consistent with what wsgen produces
- this.nillable = javaClass.isArray();
- }
-
- public String getName() {
- return name;
- }
-
- public String getSignature() {
- return signature;
- }
-
- public String getGenericSignature() {
- return genericSignature;
- }
-
- public Class<?> getType() {
- return type;
- }
-
- public List<Annotation> getJaxbAnnotaions() {
- return jaxbAnnotaions;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- public boolean isElement() {
- return element;
- }
-
- public boolean isNillable() {
- return nillable;
- }
- }
-
- public XMLAdapterExtensionPoint getXmlAdapters() {
- return xmlAdapters;
- }
-
- public void setXmlAdapters(XMLAdapterExtensionPoint xmlAdapters) {
- this.xmlAdapters = xmlAdapters;
- }
-
- protected static <T extends Annotation> T findAnnotation(Annotation[] anns, Class<T> annotationClass) {
- for (Annotation a : anns) {
- if (a.annotationType() == annotationClass) {
- return annotationClass.cast(a);
- }
- }
- return null;
- }
-
- protected static List<Annotation> findJAXBAnnotations(Annotation[] anns) {
- List<Annotation> jaxbAnnotation = new ArrayList<Annotation>();
- for (Class<? extends Annotation> c : KNOWN_JAXB_ANNOTATIONS) {
- Annotation a = findAnnotation(anns, c);
- if (a != null) {
- jaxbAnnotation.add(a);
- }
- }
- return jaxbAnnotation;
- }
-
- protected List<Annotation> findJAXBAnnotations(Method method) {
- List<Annotation> anns = new ArrayList<Annotation>();
- for (Class<? extends Annotation> c : KNOWN_JAXB_ANNOTATIONS) {
- Annotation ann = method.getAnnotation(c);
- if (ann != null) {
- anns.add(ann);
- }
- }
- return anns;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
deleted file mode 100644
index b05715b54e..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/CodeGenerationHelper.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.GenericArrayType;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.objectweb.asm.Opcodes;
-
-/**
- * @version $Rev$ $Date$
- */
-public class CodeGenerationHelper {
- /**
- * @param type
- * @return
- */
- public static Class<?> getErasure(Type type) {
- if (type instanceof Class) {
- return (Class<?>)type;
- } else if (type instanceof GenericArrayType) {
- GenericArrayType arrayType = (GenericArrayType)type;
- Class<?> componentType = getErasure(arrayType.getGenericComponentType());
- return Array.newInstance(componentType, 0).getClass();
- } else if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- return getErasure(pType.getRawType());
- } else if (type instanceof WildcardType) {
- WildcardType wType = (WildcardType)type;
- Type[] types = wType.getUpperBounds();
- if (types.length == 0) {
- return Object.class;
- }
- return getErasure(types[0]);
- } else if (type instanceof TypeVariable) {
- TypeVariable<?> var = (TypeVariable<?>)type;
- Type[] types = var.getBounds();
- if (types.length == 0) {
- return Object.class;
- }
- return getErasure(types[0]);
- }
- return null;
- }
-
- /**
- * @param type
- * @return
- */
- public static String getJAXWSSignature(Type type) {
- Class<?> cls = getErasure(type);
- if (Collection.class.isAssignableFrom(cls) && (type instanceof ParameterizedType)) {
- ParameterizedType pType = (ParameterizedType)type;
- Type p = pType.getActualTypeArguments()[0];
- StringBuffer sb = new StringBuffer();
- sb.append(getSignature(cls));
- sb.deleteCharAt(sb.length() - 1); // Remove ;
- sb.append('<').append(getSignature(getErasure(p))).append(">;");
- return sb.toString();
- } else if (Map.class.isAssignableFrom(cls) && (type instanceof ParameterizedType)) {
- ParameterizedType pType = (ParameterizedType)type;
- Type key = pType.getActualTypeArguments()[0];
- Type value = pType.getActualTypeArguments()[1];
- StringBuffer sb = new StringBuffer();
- sb.append(getSignature(cls));
- sb.deleteCharAt(sb.length() - 1); // Remove ;
- sb.append('<').append(getSignature(getErasure(key))).append(getSignature(getErasure(value))).append(">;");
- return sb.toString();
- } else {
- return getSignature(cls);
- }
- }
-
- /**
- * @param type
- * @return
- */
- public static String getSignature(Type type) {
- if (!(type instanceof Class)) {
- if (type instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)type;
- StringBuffer sb = new StringBuffer();
- String rawType = getSignature(pType.getRawType());
- sb.append(rawType.substring(0, rawType.length() - 1));
- sb.append('<');
- for (Type t : pType.getActualTypeArguments()) {
- String argType = getSignature(t);
- sb.append(argType);
- }
- sb.append('>');
- sb.append(rawType.substring(rawType.length() - 1));
- return sb.toString();
- }
- if (type instanceof TypeVariable) {
- return "T" + ((TypeVariable<?>)type).getName() + ";";
- }
- if (type instanceof GenericArrayType) {
- GenericArrayType arrayType = (GenericArrayType)type;
- return "[" + getSignature(arrayType.getGenericComponentType());
- }
- if (type instanceof WildcardType) {
- WildcardType wType = (WildcardType)type;
- Type[] types = wType.getUpperBounds();
- StringBuffer sb = new StringBuffer();
- if (types.length == 0 || !(types.length == 1 && types[0] == Object.class)) {
- sb.append('+');
- for (Type t : types) {
- sb.append(getSignature(t));
- }
- }
- types = wType.getLowerBounds();
- if (types.length != 0) {
- sb.append('-');
- for (Type t : wType.getLowerBounds()) {
- sb.append(getSignature(t));
- }
- }
- if (sb.length() == 0) {
- return "*";
- }
- return sb.toString();
- }
- }
- Class<?> cls = (Class<?>)type;
- return org.objectweb.asm.Type.getDescriptor(cls);
- }
-
- /**
- * Get the actual type arguments a child class has used to extend a generic base class.
- *
- * @param baseClass the base class
- * @param childClass the child class
- * @return a list of the raw classes for the actual type arguments.
- */
- public static <T> List<Class<?>> resovleTypeArguments(Class<T> baseClass, Class<? extends T> childClass) {
- Map<Type, Type> resolvedTypes = new HashMap<Type, Type>();
- Type type = childClass;
- // start walking up the inheritance hierarchy until we hit baseClass
- while (!getErasure(type).equals(baseClass)) {
- if (type instanceof Class) {
- // there is no useful information for us in raw types, so just keep going.
- type = ((Class<?>)type).getGenericSuperclass();
- } else {
- ParameterizedType parameterizedType = (ParameterizedType)type;
- Class<?> rawType = getErasure(parameterizedType.getRawType());
-
- Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
- TypeVariable<?>[] typeParameters = rawType.getTypeParameters();
- for (int i = 0; i < actualTypeArguments.length; i++) {
- resolvedTypes.put(typeParameters[i], actualTypeArguments[i]);
- }
-
- if (!rawType.equals(baseClass)) {
- type = rawType.getGenericSuperclass();
- }
- }
- }
-
- // finally, for each actual type argument provided to baseClass, determine (if possible)
- // the raw class for that type argument.
- Type[] actualTypeArguments;
- if (type instanceof Class) {
- actualTypeArguments = ((Class<?>)type).getTypeParameters();
- } else {
- actualTypeArguments = ((ParameterizedType)type).getActualTypeArguments();
- }
- List<Class<?>> typeArgumentsAsClasses = new ArrayList<Class<?>>();
- // resolve types by chasing down type variables.
- for (Type baseType : actualTypeArguments) {
- while (resolvedTypes.containsKey(baseType)) {
- baseType = resolvedTypes.get(baseType);
- }
- typeArgumentsAsClasses.add(getErasure(baseType));
- }
- return typeArgumentsAsClasses;
- }
-
- /*
- signatures.put(boolean.class, "Z");
- signatures.put(byte.class, "B");
- signatures.put(char.class, "C");
- signatures.put(short.class, "S");
- signatures.put(int.class, "I");
- signatures.put(long.class, "J");
- signatures.put(float.class, "F");
- signatures.put(double.class, "D");
- */
- public static int getLoadOPCode(String signature) {
- if ("Z".equals(signature) || "B".equals(signature)
- || "C".equals(signature)
- || "S".equals(signature)
- || "I".equals(signature)) {
- return Opcodes.ILOAD;
- }
-
- if ("J".equals(signature)) {
- return Opcodes.LLOAD;
- }
-
- if ("F".equals(signature)) {
- return Opcodes.FLOAD;
- }
-
- if ("D".equals(signature)) {
- return Opcodes.DLOAD;
- }
-
- return Opcodes.ALOAD;
-
- }
-
- public static int getReturnOPCode(String signature) {
- if ("Z".equals(signature) || "B".equals(signature)
- || "C".equals(signature)
- || "S".equals(signature)
- || "I".equals(signature)) {
- return Opcodes.IRETURN;
- }
-
- if ("J".equals(signature)) {
- return Opcodes.LRETURN;
- }
-
- if ("F".equals(signature)) {
- return Opcodes.FRETURN;
- }
-
- if ("D".equals(signature)) {
- return Opcodes.DRETURN;
- }
- if ("V".equals(signature)) {
- return Opcodes.RETURN;
- }
-
- return Opcodes.ARETURN;
-
- }
-
- /**
- * Get the package prefix for generated JAXWS artifacts
- * @param cls
- * @return
- */
- public static String getPackagePrefix(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- if (index == -1) {
- return "jaxws.";
- } else {
- return name.substring(0, index) + ".jaxws.";
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGenerator.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGenerator.java
deleted file mode 100644
index 40fbefa3ed..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGenerator.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.beans.BeanInfo;
-import java.beans.IntrospectionException;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebFault;
-
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-import org.objectweb.asm.ClassWriter;
-
-public class FaultBeanGenerator extends BaseBeanGenerator {
- public FaultBeanGenerator() {
- super();
- }
-
- protected BeanProperty[] getProperties(Class<? extends Throwable> exceptionClass) {
- BeanInfo beanInfo;
- try {
- beanInfo = Introspector.getBeanInfo(exceptionClass);
- } catch (IntrospectionException e) {
- throw new IllegalArgumentException(e);
- }
- List<BeanProperty> props = new ArrayList<BeanProperty>();
- for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
- if (pd.getReadMethod() != null) {
- String name = pd.getReadMethod().getName();
- if ("getClass".equals(name) || "getStackTrace".equals(name)
- || "getCause".equals(name)
- || "getLocalizedMessage".equals(name)) {
- continue;
- }
- // Add the field
- String field = pd.getName();
- Method getter = pd.getReadMethod();
- props.add(new BeanProperty("", field, getter.getReturnType(), getter.getGenericReturnType(), false));
- }
- }
- Collections.sort(props, new Comparator<BeanProperty>() {
- public int compare(BeanProperty o1, BeanProperty o2) {
- return o1.getName().compareTo(o2.getName());
- }
- });
- return props.toArray(new BeanProperty[0]);
- }
-
- public byte[] generate(Class<? extends Throwable> exceptionClass) {
- String className = getFaultBeanName(exceptionClass);
- ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
- String classDescriptor = className.replace('.', '/');
- String classSignature = "L" + classDescriptor + ";";
- QName element = getElementName(exceptionClass);
- String namespace = element.getNamespaceURI();
- String name = element.getLocalPart();
- return defineClass(cw, classDescriptor, classSignature, namespace, name, getProperties(exceptionClass));
- }
-
- public Class<?> generate(Class<? extends Throwable> exceptionClass, GeneratedClassLoader cl) {
- synchronized (exceptionClass) {
- Class<?> faultBeanClass = generatedClasses.get(exceptionClass);
- if (faultBeanClass == null) {
- String className = getFaultBeanName(exceptionClass);
- String classDescriptor = className.replace('.', '/');
- String classSignature = "L" + classDescriptor + ";";
- QName element = getElementName(exceptionClass);
- String namespace = element.getNamespaceURI();
- String name = element.getLocalPart();
- faultBeanClass =
- generate(classDescriptor, classSignature, namespace, name, getProperties(exceptionClass), cl);
- generatedClasses.put(exceptionClass, faultBeanClass);
- }
- return faultBeanClass;
- }
- }
-
- private static String getFaultBeanName(Class<?> exceptionClass) {
- String faultBeanName = null;
- WebFault webFault = exceptionClass.getAnnotation(WebFault.class);
- if (webFault != null) {
- faultBeanName = webFault.faultBean();
- if (!"".equals(faultBeanName)) {
- return faultBeanName;
- }
- }
-
- String name = exceptionClass.getName();
- int index = name.lastIndexOf('.');
- String pkg = name.substring(0, index);
- String clsName = name.substring(index + 1);
-
- // FIXME: [rfeng] This is a workaround to avoid "Prohibited package name: java.lang.jaxws"
- if (pkg.startsWith("java.") || pkg.startsWith("javax.")) {
- pkg = "tuscany";
- }
- faultBeanName = (pkg + ".jaxws." + clsName + "Bean");
- return faultBeanName;
- }
-
- public static QName getElementName(Class<? extends Throwable> exceptionClass) {
- WebFault webFault = exceptionClass.getAnnotation(WebFault.class);
- String namespace = null;
- String name = null;
- if (webFault != null) {
- namespace = webFault.targetNamespace();
- name = webFault.name();
- }
- if (namespace == null) {
- namespace = JavaInterfaceUtil.getNamespace(exceptionClass);
- }
- if (name == null) {
- name = exceptionClass.getSimpleName();
- }
- return new QName(namespace, name);
- }
-
- public static Class<?> generateFaultBeanClass(Class<? extends Throwable> exceptionClass) {
- FaultBeanGenerator generator = new FaultBeanGenerator();
- GeneratedClassLoader cl = new GeneratedClassLoader(exceptionClass.getClassLoader());
- return generator.generate(exceptionClass, cl);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedClassLoader.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedClassLoader.java
deleted file mode 100644
index f36dd3a443..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedClassLoader.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.security.SecureClassLoader;
-import java.util.HashMap;
-import java.util.Map;
-
-public class GeneratedClassLoader extends SecureClassLoader {
- private class GeneratedClass {
- private String className;
- private byte[] byteCode;
- private Class<?> cls;
-
- public GeneratedClass(String className, byte[] byteCode) {
- super();
- this.className = className;
- this.byteCode = byteCode;
- }
-
- public synchronized Class<?> getGeneratedClass() {
- if (cls == null) {
- cls = defineClass(className, byteCode, 0, byteCode.length);
- }
- return cls;
- }
- }
-
- private Map<String, GeneratedClass> generatedClasses = new HashMap<String, GeneratedClass>();
-
- public GeneratedClassLoader(ClassLoader parentLoader) {
- super(parentLoader);
- }
-
- @Override
- protected Class<?> findClass(String className) throws ClassNotFoundException {
- GeneratedClass cls = generatedClasses.get(className);
- if (cls != null) {
- return cls.getGeneratedClass();
- }
- return super.findClass(className);
- }
-
- public synchronized Class<?> getGeneratedClass(String className, byte[] byteCode) {
- GeneratedClass cls = generatedClasses.get(className);
- if (cls == null) {
- cls = new GeneratedClass(className, byteCode);
- generatedClasses.put(className, cls);
- }
- return cls.getGeneratedClass();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedDataTypeImpl.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedDataTypeImpl.java
deleted file mode 100644
index c3f568ef48..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/GeneratedDataTypeImpl.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.interfacedef.java.jaxws;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * A special data type that generate the class on demand
- * @version $Rev$ $Date$
- */
-public class GeneratedDataTypeImpl implements DataType<XMLType> {
- private XMLAdapterExtensionPoint xmlAdapters;
-
- private Class<?> physical;
- private XMLType logical;
-
- private Map<Class<?>, Object> metaDataMap;
- private Method method;
- private String wrapperClassName;
- private String wrapperNamespace;
- private String wrapperName;
- private boolean request;
- private GeneratedClassLoader classLoader;
-
- private Class<? extends Throwable> exceptionClass;
-
- public GeneratedDataTypeImpl(XMLAdapterExtensionPoint xmlAdapters, Class<? extends Throwable> exceptionClass, GeneratedClassLoader cl) {
- super();
- this.exceptionClass = exceptionClass;
- this.classLoader = cl;
- QName name = FaultBeanGenerator.getElementName(exceptionClass);
- this.logical = new XMLType(name, name);
- this.xmlAdapters = xmlAdapters;
- }
-
- public GeneratedDataTypeImpl(XMLAdapterExtensionPoint xmlAdapters,
- Method m,
- String wrapperClassName,
- String wrapperNamespace,
- String wrapperName,
- boolean request,
- GeneratedClassLoader cl) {
- super();
- this.method = m;
- this.wrapperClassName = wrapperClassName;
- this.wrapperNamespace = wrapperNamespace;
- this.wrapperName = wrapperName;
- this.classLoader = cl;
- this.request = request;
- QName name = new QName(wrapperNamespace, wrapperName);
- this.logical = new XMLType(name, name);
- this.xmlAdapters = xmlAdapters;
- }
-
- public String getDataBinding() {
- return JAXBDataBinding.NAME;
- }
-
- public Type getGenericType() {
- return getPhysical();
- }
-
- public XMLType getLogical() {
- return logical;
- }
-
- public synchronized Class<?> getPhysical() {
- if (physical == null) {
- if (method != null) {
- WrapperBeanGenerator generator = new WrapperBeanGenerator();
- generator.setXmlAdapters(xmlAdapters);
- physical =
- request ? generator.generateRequestWrapper(method, wrapperClassName, wrapperNamespace, wrapperName, classLoader)
- : generator.generateResponseWrapper(method, wrapperClassName, wrapperNamespace, wrapperName, classLoader);
- ;
- } else if (exceptionClass != null) {
- FaultBeanGenerator faultBeanGenerator = new FaultBeanGenerator();
- faultBeanGenerator.setXmlAdapters(xmlAdapters);
- physical = faultBeanGenerator.generate(exceptionClass, classLoader);
- }
- }
- return physical;
- }
-
- public void setDataBinding(String dataBinding) {
- // NOP
- }
-
- public void setGenericType(Type genericType) {
- // NOP
- }
-
- public void setLogical(XMLType logical) {
- this.logical = logical;
- }
-
- public void setPhysical(Class<?> cls) {
- // NOP
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public <T> T getMetaData(Class<T> type) {
- return metaDataMap == null ? null : type.cast(metaDataMap.get(type));
- }
-
- public <T> void setMetaData(Class<T> type, T metaData) {
- if (metaDataMap == null) {
- metaDataMap = new ConcurrentHashMap<Class<?>, Object>();
- }
- metaDataMap.put(type, metaData);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
deleted file mode 100644
index adb1224066..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSFaultExceptionMapper.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebFault;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * JAX-WS ExceptionHandler
- *
- * @version $Rev$ $Date$
- */
-public class JAXWSFaultExceptionMapper implements FaultExceptionMapper {
- public static final String GETCAUSE = "getCause";
- public static final String GETLOCALIZEDMESSAGE = "getLocalizedMessage";
- public static final String GETSTACKTRACE = "getStackTrace";
- public static final String GETCLASS = "getClass";
-
- private static final Class<?>[] EMPTY_CLASS_ARRAY = new Class[0];
- private DataBindingExtensionPoint dataBindingExtensionPoint;
- private XMLAdapterExtensionPoint xmlAdapterExtensionPoint;
-
-
- public JAXWSFaultExceptionMapper(DataBindingExtensionPoint dataBindingExtensionPoint, XMLAdapterExtensionPoint xmlAdapters) {
- super();
- this.dataBindingExtensionPoint = dataBindingExtensionPoint;
- this.xmlAdapterExtensionPoint = xmlAdapters;
- }
-
- /**
- * The following is quoted from the JAX-WS Specification v2.1
- * <ul>
- * <li>WrapperException(String message, FaultBean faultInfo) <br>
- * A constructor where WrapperException is replaced with the name of the
- * generated wrapper exception and FaultBean is replaced by the name of the
- * generated fault bean.
- * <li> WrapperException(String message, FaultBean faultInfo, Throwable
- * cause) <br>
- * A constructor where WrapperException is replaced with the name of the
- * generated wrapper exception and FaultBean is replaced by the name of the
- * generated fault bean. The last argument, cause, may be used to convey
- * protocol specific fault information
- * </ul>
- */
- @SuppressWarnings("unchecked")
- public Throwable wrapFaultInfo(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause, Operation operation) {
- Class<?> exceptionClass = exceptionType.getPhysical();
- if (exceptionClass.isInstance(faultInfo)) {
- return (Throwable)faultInfo;
- }
- DataType<?> faultBeanType = exceptionType.getLogical();
- Class<?> faultBeanClass = faultBeanType.getPhysical();
- try {
- Throwable exc =
- newInstance((Class<? extends Throwable>)exceptionClass, message, faultBeanClass, faultInfo, cause);
- // Include the elem name into the FaultException we build so it can be used for matching in the DataTransformationInterceptor
- //
- // Note this may happen even if we find a constructor above, that is the type of the non-generic fault exc may be an instance
- // of FaultException
- //
- if ((exc instanceof FaultException) && (faultBeanType.getLogical() instanceof XMLType)) {
- FaultException faultExc = (FaultException)exc;
- DataType<XMLType> faultBeanXMLType = (DataType<XMLType>)faultBeanType;
- XMLType faultLogical = faultBeanXMLType.getLogical();
- faultExc.setFaultName(faultLogical.getElementName());
- }
- return exc;
- } catch (Throwable e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- private Throwable newInstance(Class<? extends Throwable> exceptionClass,
- String message,
- Class<?> faultBeanClass,
- Object faultInfo,
- Throwable cause) throws Exception {
- Throwable ex = null;
- Constructor<? extends Throwable> ctor = null;
- try {
- // Get the message property
- Method getMessage = faultBeanClass.getMethod("getMessage");
- message = (String)getMessage.invoke(faultInfo);
- } catch (Throwable e) {
- // Ignore
- }
- if (faultInfo == null) {
- try {
- ctor = exceptionClass.getConstructor(String.class, Throwable.class);
- ex = ctor.newInstance(message, cause);
- } catch (NoSuchMethodException e1) {
- try {
- ctor = exceptionClass.getConstructor(String.class);
- ex = ctor.newInstance(message);
- } catch (NoSuchMethodException e2) {
- try {
- ctor = exceptionClass.getConstructor(Throwable.class);
- ex = ctor.newInstance(cause);
- } catch (NoSuchMethodException e3) {
- ctor = exceptionClass.getConstructor();
- ex = ctor.newInstance();
- }
- }
- }
- } else {
- try {
- // FIXME: What about if the faultBeanClass is a subclass of the argument type?
- ctor = exceptionClass.getConstructor(String.class, faultBeanClass, Throwable.class);
- ex = ctor.newInstance(message, faultInfo, cause);
- } catch (NoSuchMethodException e1) {
- try {
- ctor = exceptionClass.getConstructor(String.class, faultInfo.getClass());
- ex = ctor.newInstance(message, faultInfo);
- } catch (NoSuchMethodException e2) {
- try {
- ctor = exceptionClass.getConstructor(String.class, Throwable.class);
- ex = ctor.newInstance(message, cause);
- populateException(ex, faultInfo);
- } catch (NoSuchMethodException e3) {
- try {
- ctor = exceptionClass.getConstructor(String.class);
- ex = ctor.newInstance(message);
- populateException(ex, faultInfo);
- } catch (NoSuchMethodException e4) {
- try {
- ctor = exceptionClass.getConstructor();
- if (ctor != null) {
- ex = ctor.newInstance();
- populateException(ex, faultInfo);
- } else {
- ex = new FaultException(message, faultInfo, cause);
- }
- } catch (NoSuchMethodException e5) {
- try {
- ctor = exceptionClass.getConstructor(Throwable.class);
- ex = ctor.newInstance(cause);
- populateException(ex, faultInfo);
- } catch (NoSuchMethodException e6) {
- ctor = exceptionClass.getConstructor();
- ex = ctor.newInstance();
- }
- }
- }
- }
- }
- }
- }
-
- return ex;
- }
-
- /**
- * Populate the java exception from the fault bean
- * @param ex
- * @param faultBean
- * @throws Exception
- */
- private void populateException(Throwable ex, Object faultBean) throws Exception {
- PropertyDescriptor props[] = Introspector.getBeanInfo(faultBean.getClass()).getPropertyDescriptors();
- for (PropertyDescriptor p : props) {
- Method getter = p.getReadMethod();
- Method setter = p.getWriteMethod();
- if (getter == null || setter == null) {
- continue;
- }
- try {
- Method m = ex.getClass().getMethod(setter.getName(), setter.getParameterTypes());
- Object pv = getter.invoke(faultBean);
- m.invoke(ex, pv);
- } catch (Exception e) {
- // Ignore;
- }
- }
- }
-
- public Object getFaultInfo(Throwable exception, Class<?> faultBeanClass, Operation operation) {
- if (exception == null) {
- return null;
- }
-
- // Check if it's the generic FaultException
- if (exception instanceof FaultException) {
- return ((FaultException)exception).getFaultInfo();
- }
-
- try {
- Method method = exception.getClass().getMethod("getFaultInfo", EMPTY_CLASS_ARRAY);
- return method.invoke(exception, (Object[])null);
- } catch (NoSuchMethodException e) {
- // Follow the JAX-WS v2.1 Specification section 3.7
- return createFaultBean(exception, faultBeanClass);
- } catch (Throwable e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- private Object createFaultBean(Throwable exception, Class<?> faultBeanClass) {
- /**
- * For each getter in the exception and its superclasses, a property of the same
- * type and name is added to the bean. The getCause, getLocalizedMessage and
- * getStackTrace getters from java.lang.Throwable and the getClass getter from
- * java.lang.Object are excluded from the list of getters to be mapped.
- */
- // Return the exception as-is if it's already the fault bean
- if (faultBeanClass.isInstance(exception)) {
- return exception;
- }
- try {
- Object faultBean = null;
- for (Constructor<?> ctor : faultBeanClass.getConstructors()) {
- Class<?>[] params = ctor.getParameterTypes();
- if (params.length == 1 && String.class == params[0]) {
- faultBean = ctor.newInstance(exception.getMessage());
- } else if (params.length == 2 && String.class == params[0]
- && Throwable.class.isAssignableFrom(params[1])) {
- faultBean = ctor.newInstance(exception.getMessage(), exception);
- } else if (params.length == 0) {
- faultBean = ctor.newInstance();
- }
- if (faultBean != null) {
- break;
- }
- }
- if (faultBean == null) {
- return exception;
- }
- BeanInfo beanInfo = Introspector.getBeanInfo(exception.getClass());
- for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
- Method getter = pd.getReadMethod();
- String name = getter.getName();
- if (!isMappedGetter(name)) {
- continue;
- }
- Method setter = null;
- try {
- setter = faultBeanClass.getMethod("set" + capitalize(pd.getName()), getter.getReturnType());
- } catch (NoSuchMethodException e) {
- continue;
- }
- Object prop = getter.invoke(exception);
- setter.invoke(faultBean, prop);
- }
- return faultBean;
- } catch (Throwable ex) {
- throw new IllegalArgumentException(ex);
- }
- }
-
- @SuppressWarnings("unchecked")
- public boolean introspectFaultDataType(DataType<DataType> exceptionType, final Operation operation, final boolean generatingFaultBean) {
- QName faultName = null;
- boolean result = false;
-
- final Class<?> cls = exceptionType.getPhysical();
- if (cls == FaultException.class) {
- return true;
- }
- DataType faultType = (DataType)exceptionType.getLogical();
- Class<?> faultBean = null;
- final WebFault fault = cls.getAnnotation(WebFault.class);
- if (fault != null) {
- if (!"".equals(fault.name()) || !"".equals(fault.targetNamespace())) {
- QName faultQName = ((XMLType)faultType.getLogical()).getElementName();
- String faultNS =
- "".equals(fault.targetNamespace()) ? faultQName.getNamespaceURI() : fault.targetNamespace();
- String faultLocal = "".equals(fault.name()) ? faultQName.getLocalPart() : fault.name();
- faultName = new QName(faultNS, faultLocal);
- XMLType xmlType = new XMLType(faultName, null);
- faultType.setLogical(xmlType);
- }
- if (!"".equals(fault.faultBean())) {
- faultBean = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
- public Class<?> run() {
- try {
- return Class.forName(fault.faultBean(), false, cls.getClassLoader());
- } catch (ClassNotFoundException e) {
- throw new ServiceRuntimeException(e);
- }
- }
- });
- } else {
- Method m;
- try {
- m = cls.getMethod("getFaultInfo", (Class[])null);
- faultBean = m.getReturnType();
- } catch (NoSuchMethodException e) {
- // Ignore
- }
- }
- }
-
- if (faultBean == null) {
- final String faultBeanClassName = CodeGenerationHelper.getPackagePrefix(cls) + cls.getSimpleName() + "Bean";
- final QName qname = faultName;
- faultType = AccessController.doPrivileged(new PrivilegedAction<DataType<XMLType>>() {
- public DataType<XMLType> run() {
- try {
- Class<?> faultBean = Class.forName(faultBeanClassName, false, cls.getClassLoader());
- return new DataTypeImpl<XMLType>(faultBean, new XMLType(qname, qname));
- } catch (ClassNotFoundException e) {
- if (generatingFaultBean) {
- Class<? extends Throwable> t = (Class<? extends Throwable>)cls;
- ClassLoader parent =
- operation == null ? t.getClassLoader() : ((JavaInterface)operation.getInterface())
- .getJavaClass().getClassLoader();
- GeneratedClassLoader cl = new GeneratedClassLoader(parent);
- GeneratedDataTypeImpl dt = new GeneratedDataTypeImpl(xmlAdapterExtensionPoint, t, cl);
- return dt;
- } else {
- return new DataTypeImpl<XMLType>(cls, new XMLType(qname, qname));
- }
- }
- }
- });
- } else {
- faultType.setDataBinding(null);
- faultType.setGenericType(faultBean);
- faultType.setPhysical(faultBean);
- }
-
- // TODO: Use the databinding framework to introspect the fault bean class
- if (faultType.getDataBinding() == null && dataBindingExtensionPoint != null) {
- faultBean = faultType.getPhysical();
- result =
- dataBindingExtensionPoint.introspectType(faultType, operation);
- }
- ((DataType) exceptionType).setLogical(faultType);
-
- /*
- The introspection of the fault DT may not have calculated the correct element name,
- though we may have already done this in this method. Let's look at the DataType now
- that introspection is done, and, if it has an XMLType, let's set the element to the
- 'faultName' if we calculated one.
- */
- if ((faultName != null) && (faultType.getLogical() instanceof XMLType)) {
- XMLType faultTypeXML = (XMLType)faultType.getLogical();
- // The element name (if set) should match the fault name
- faultTypeXML.setElementName(faultName);
- }
-
- return result;
- }
-
- public static boolean isMappedGetter(String methodName) {
- if (GETCAUSE.equals(methodName) || GETLOCALIZEDMESSAGE.equals(methodName)
- || GETSTACKTRACE.equals(methodName)
- || GETCLASS.equals(methodName)) {
- return false;
- } else {
- return true;
- }
- }
-
- private static String capitalize(String name) {
- if (name == null || name.length() == 0) {
- return name;
- } else {
- return Character.toUpperCase(name.charAt(0)) + name.substring(1);
- }
- }
-
- public void setDataBindingExtensionPoint(DataBindingExtensionPoint dataBindingExtensionPoint) {
- this.dataBindingExtensionPoint = dataBindingExtensionPoint;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
deleted file mode 100644
index 27cd163d13..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.jws.WebParam.Mode;
-import javax.jws.soap.SOAPBinding;
-import javax.jws.soap.SOAPBinding.Style;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Holder;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.ResponseWrapper;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.javabeans.JavaExceptionDataBinding;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding;
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.FaultExceptionMapper;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-
-/**
- * Introspect the java class/interface with JSR-181 and JAXWS annotations
- *
- * @version $Rev$ $Date$
- */
-public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
- private static final String JAXB_DATABINDING = JAXBDataBinding.NAME;
- private static final String GET = "get";
- private DataBindingExtensionPoint dataBindingExtensionPoint;
- private FaultExceptionMapper faultExceptionMapper;
- private XMLAdapterExtensionPoint xmlAdapterExtensionPoint;
-
- public JAXWSJavaInterfaceProcessor(DataBindingExtensionPoint dataBindingExtensionPoint,
- FaultExceptionMapper faultExceptionMapper,
- XMLAdapterExtensionPoint xmlAdapters) {
- super();
- this.dataBindingExtensionPoint = dataBindingExtensionPoint;
- this.faultExceptionMapper = faultExceptionMapper;
- this.xmlAdapterExtensionPoint = xmlAdapters;
- }
-
- public JAXWSJavaInterfaceProcessor() {
- super();
- }
-
- private static String capitalize(String name) {
- if (name == null || name.length() == 0) {
- return name;
- } else {
- return Character.toUpperCase(name.charAt(0)) + name.substring(1);
- }
- }
-
- private ParameterMode getParameterMode(Class<?> javaType, WebParam.Mode mode) {
- if (javaType != Holder.class) {
- return ParameterMode.IN;
- }
- if (mode == Mode.IN) {
- return ParameterMode.IN;
- } else if (mode == Mode.INOUT) {
- return ParameterMode.INOUT;
- } else if (mode == Mode.OUT) {
- return ParameterMode.OUT;
- } else {
- // null
- return ParameterMode.INOUT;
- }
- }
-
- public void visitInterface(JavaInterface contract) throws InvalidInterfaceException {
-
- final Class<?> clazz = contract.getJavaClass();
- WebService webService = clazz.getAnnotation(WebService.class);
- String tns = JavaXMLMapper.getNamespace(clazz);
- String localName = clazz.getSimpleName();
- if (webService != null) {
- tns = getValue(webService.targetNamespace(), tns);
- localName = getValue(webService.name(), localName);
- contract.setQName(new QName(tns, localName));
- // Mark SEI as Remotable
- contract.setRemotable(true);
- }
- if (!contract.isRemotable()) {
- return;
- }
-
- // SOAP binding (doc/lit/wrapped|bare or rpc/lit)
- SOAPBinding soapBinding = clazz.getAnnotation(SOAPBinding.class);
-
- for (Iterator<Operation> it = contract.getOperations().iterator(); it.hasNext();) {
- final JavaOperation operation = (JavaOperation)it.next();
- final Method method = operation.getJavaMethod();
- introspectFaultTypes(operation);
-
- // SOAP binding (doc/lit/wrapped|bare or rpc/lit)
- SOAPBinding methodSOAPBinding = method.getAnnotation(SOAPBinding.class);
- if (methodSOAPBinding == null) {
- methodSOAPBinding = soapBinding;
- }
-
- boolean documentStyle = true;
- boolean bare = false;
- if (methodSOAPBinding != null) {
- bare = methodSOAPBinding.parameterStyle() == SOAPBinding.ParameterStyle.BARE;
- if (bare) {
- // For BARE parameter style, the data won't be unwrapped
- // The wrapper should be null
- operation.setInputWrapperStyle(false);
- operation.setOutputWrapperStyle(false);
- }
- documentStyle = methodSOAPBinding.style() == Style.DOCUMENT;
- }
-
- String operationName = operation.getName();
- // WebMethod
- WebMethod webMethod = method.getAnnotation(WebMethod.class);
- if (webMethod != null) {
- if (webMethod.exclude()) {
- // Exclude the method
- it.remove();
- continue;
- }
- operationName = getValue(webMethod.operationName(), operationName);
- operation.setName(operationName);
- operation.setAction(webMethod.action());
- }
-
- // Is one way?
- Oneway oneway = method.getAnnotation(Oneway.class);
- if (oneway != null) {
- // JSR 181
- assert method.getReturnType() == void.class;
- operation.setNonBlocking(true);
- }
-
- List<ParameterMode> parameterModes = operation.getParameterModes();
-
- Class<?>[] parameterTypes = method.getParameterTypes();
- // Handle BARE mapping
- if (bare) {
- for (int i = 0; i < parameterTypes.length; i++) {
- WebParam param = getAnnotation(method, i, WebParam.class);
- if (param != null) {
- String ns = getValue(param.targetNamespace(), tns);
- // Default to <operationName> for doc-bare
- String name = getValue(param.name(), documentStyle ? operationName : "arg" + i);
- QName element = new QName(ns, name);
- Object logical = operation.getInputType().getLogical().get(i).getLogical();
- if (logical instanceof XMLType) {
- ((XMLType)logical).setElementName(element);
- }
- parameterModes.set(i, getParameterMode(parameterTypes[i], param.mode()));
- } else {
- parameterModes.set(i, getParameterMode(parameterTypes[i], null));
- }
- }
- WebResult result = method.getAnnotation(WebResult.class);
- if (result != null) {
- String ns = getValue(result.targetNamespace(), tns);
- // Default to <operationName>Response for doc-bare
- String name = getValue(result.name(), documentStyle ? operationName + "Response" : "return");
- QName element = new QName(ns, name);
- Object logical = operation.getOutputType().getLogical();
- if (logical instanceof XMLType) {
- ((XMLType)logical).setElementName(element);
- }
- }
- // FIXME: [rfeng] For the BARE mapping, do we need to create a Wrapper?
- // it's null at this point
- } else {
-
- RequestWrapper requestWrapper = method.getAnnotation(RequestWrapper.class);
- String ns = requestWrapper == null ? tns : getValue(requestWrapper.targetNamespace(), tns);
- String name =
- requestWrapper == null ? operationName : getValue(requestWrapper.localName(), operationName);
- String wrapperBeanName = requestWrapper == null ? "" : requestWrapper.className();
- if ("".equals(wrapperBeanName)) {
- wrapperBeanName = CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName());
- }
-
- DataType<XMLType> inputWrapperDT = null;
-
- final String inputWrapperClassName = wrapperBeanName;
- final String inputNS = ns;
- final String inputName = name;
- inputWrapperDT = AccessController.doPrivileged(new PrivilegedAction<DataType<XMLType>>() {
- public DataType<XMLType> run() {
- try {
- Class<?> wrapperClass = Class.forName(inputWrapperClassName, false, clazz.getClassLoader());
- QName qname = new QName(inputNS, inputName);
- DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
- dataBindingExtensionPoint.introspectType(dt, operation);
- // TUSCANY-2505
- if (dt.getLogical() instanceof XMLType) {
- XMLType xmlType = (XMLType)dt.getLogical();
- xmlType.setElementName(qname);
- }
- return dt;
- } catch (ClassNotFoundException e) {
- GeneratedClassLoader cl = new GeneratedClassLoader(clazz.getClassLoader());
- return new GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, inputWrapperClassName,
- inputNS, inputName, true, cl);
- }
- }
- });
-
- QName inputWrapper = inputWrapperDT.getLogical().getElementName();
-
- ResponseWrapper responseWrapper = method.getAnnotation(ResponseWrapper.class);
- ns = responseWrapper == null ? tns : getValue(responseWrapper.targetNamespace(), tns);
- name =
- responseWrapper == null ? operationName + "Response" : getValue(responseWrapper.localName(),
- operationName + "Response");
- wrapperBeanName = responseWrapper == null ? "" : responseWrapper.className();
- if ("".equals(wrapperBeanName)) {
- wrapperBeanName =
- CodeGenerationHelper.getPackagePrefix(clazz) + capitalize(method.getName()) + "Response";
- }
-
- DataType<XMLType> outputWrapperDT = null;
- final String outputWrapperClassName = wrapperBeanName;
- final String outputNS = ns;
- final String outputName = name;
-
- outputWrapperDT = AccessController.doPrivileged(new PrivilegedAction<DataType<XMLType>>() {
- public DataType<XMLType> run() {
- try {
- Class<?> wrapperClass =
- Class.forName(outputWrapperClassName, false, clazz.getClassLoader());
- QName qname = new QName(outputNS, outputName);
- DataType dt = new DataTypeImpl<XMLType>(wrapperClass, new XMLType(qname, qname));
- dataBindingExtensionPoint.introspectType(dt, operation);
- // TUSCANY-2505
- if (dt.getLogical() instanceof XMLType) {
- XMLType xmlType = (XMLType)dt.getLogical();
- xmlType.setElementName(qname);
- }
- return dt;
- } catch (ClassNotFoundException e) {
- GeneratedClassLoader cl = new GeneratedClassLoader(clazz.getClassLoader());
- return new GeneratedDataTypeImpl(xmlAdapterExtensionPoint, method, outputWrapperClassName,
- outputNS, outputName, false, cl);
- }
- }
- });
- QName outputWrapper = outputWrapperDT.getLogical().getElementName();
-
- List<ElementInfo> inputElements = new ArrayList<ElementInfo>();
- for (int i = 0; i < parameterTypes.length; i++) {
- WebParam param = getAnnotation(method, i, WebParam.class);
- ns = param != null ? param.targetNamespace() : "";
- // Default to "" for doc-lit-wrapped && non-header
- ns = getValue(ns, documentStyle && (param == null || !param.header()) ? "" : tns);
- name = param != null ? param.name() : "";
- name = getValue(name, "arg" + i);
- QName element = new QName(ns, name);
- Object logical = operation.getInputType().getLogical().get(i).getLogical();
- QName type = null;
- if (logical instanceof XMLType) {
- ((XMLType)logical).setElementName(element);
- type = ((XMLType)logical).getTypeName();
- }
- inputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
- if (param != null) {
- parameterModes.set(i, getParameterMode(parameterTypes[i], param.mode()));
- } else {
- parameterModes.set(i, getParameterMode(parameterTypes[i], null));
- }
- }
-
- List<ElementInfo> outputElements = new ArrayList<ElementInfo>();
- WebResult result = method.getAnnotation(WebResult.class);
- // Default to "" for doc-lit-wrapped && non-header
- ns = result != null ? result.targetNamespace() : "";
- ns = getValue(ns, documentStyle && (result == null || !result.header()) ? "" : tns);
- name = result != null ? result.name() : "";
- name = getValue(name, "return");
- QName element = new QName(ns, name);
-
- if (operation.getOutputType() != null) {
- Object logical = operation.getOutputType().getLogical();
- QName type = null;
- if (logical instanceof XMLType) {
- ((XMLType)logical).setElementName(element);
- type = ((XMLType)logical).getTypeName();
- }
- outputElements.add(new ElementInfo(element, new TypeInfo(type, false, null)));
- }
-
- String db = inputWrapperDT != null ? inputWrapperDT.getDataBinding() : JAXB_DATABINDING;
-
- WrapperInfo inputWrapperInfo = new WrapperInfo(db, new ElementInfo(inputWrapper, null), inputElements);
- WrapperInfo outputWrapperInfo =
- new WrapperInfo(db, new ElementInfo(outputWrapper, null), outputElements);
-
- inputWrapperInfo.setWrapperType(inputWrapperDT);
- outputWrapperInfo.setWrapperType(outputWrapperDT);
-
- operation.setInputWrapper(inputWrapperInfo);
- operation.setOutputWrapper(outputWrapperInfo);
- }
-
- List<DataType> inputTypes = operation.getInputType().getLogical();
- for (int i = 0, size = parameterModes.size(); i < size; i++) {
- // Holder pattern. Physical types of Holder<T> classes are updated to <T> to aid in transformations.
- if (Holder.class == inputTypes.get(i).getPhysical()) {
- Type firstActual = getFirstActualType(inputTypes.get(i).getGenericType());
- if (firstActual != null) {
- inputTypes.get(i).setPhysical((Class<?>)firstActual);
- if (parameterModes.get(i) == ParameterMode.IN) {
- parameterModes.set(i, ParameterMode.INOUT);
- }
- }
- }
- // FIXME: We only handle one Holder
- // Set the output type to the parameter type
- ParameterMode mode = parameterModes.get(i);
- if (mode == ParameterMode.OUT || mode == ParameterMode.INOUT) {
- operation.setOutputType(inputTypes.get(i));
- }
- }
- }
- }
-
- /**
- * Given a Class<T>, returns T, otherwise null.
- * @param testClass
- * @return
- */
- protected static Type getFirstActualType(Type genericType) {
- if (genericType instanceof ParameterizedType) {
- ParameterizedType pType = (ParameterizedType)genericType;
- Type[] actualTypes = pType.getActualTypeArguments();
- if ((actualTypes != null) && (actualTypes.length > 0)) {
- return actualTypes[0];
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private void introspectFaultTypes(Operation operation) {
- if (operation != null && operation.getFaultTypes() != null) {
- for (DataType exceptionType : operation.getFaultTypes()) {
- faultExceptionMapper.introspectFaultDataType(exceptionType, operation, true);
- DataType faultType = (DataType)exceptionType.getLogical();
- if (faultType.getDataBinding() == JavaExceptionDataBinding.NAME) {
- // The exception class doesn't have an associated bean class, so
- // synthesize a virtual bean by introspecting the exception class.
- createSyntheticBean(operation, exceptionType);
- }
- }
- }
- }
-
- private void createSyntheticBean(Operation operation, DataType exceptionType) {
- DataType faultType = (DataType)exceptionType.getLogical();
- QName faultBeanName = ((XMLType)faultType.getLogical()).getElementName();
- List<DataType<XMLType>> beanDataTypes = new ArrayList<DataType<XMLType>>();
- for (Method aMethod : exceptionType.getPhysical().getMethods()) {
- if (Modifier.isPublic(aMethod.getModifiers()) && aMethod.getName().startsWith(GET)
- && aMethod.getParameterTypes().length == 0
- && JAXWSFaultExceptionMapper.isMappedGetter(aMethod.getName())) {
- String propName = resolvePropertyFromMethod(aMethod.getName());
- QName propQName = new QName(faultBeanName.getNamespaceURI(), propName);
- Class propType = aMethod.getReturnType();
- XMLType xmlPropType = new XMLType(propQName, null);
- DataType<XMLType> propDT = new DataTypeImpl<XMLType>(propType, xmlPropType);
- org.apache.tuscany.sca.databinding.annotation.DataType dt =
- aMethod.getAnnotation(org.apache.tuscany.sca.databinding.annotation.DataType.class);
- if (dt != null) {
- propDT.setDataBinding(dt.value());
- }
- dataBindingExtensionPoint.introspectType(propDT, operation);
-
- // sort the list lexicographically as specified in JAX-WS spec section 3.7
- int i = 0;
- for (; i < beanDataTypes.size(); i++) {
- if (beanDataTypes.get(i).getLogical().getElementName().getLocalPart().compareTo(propName) > 0) {
- break;
- }
- }
- beanDataTypes.add(i, propDT);
- }
- }
- operation.getFaultBeans().put(faultBeanName, beanDataTypes);
- }
-
- private String resolvePropertyFromMethod(String methodName) {
- StringBuffer propName = new StringBuffer();
- propName.append(Character.toLowerCase(methodName.charAt(GET.length())));
- propName.append(methodName.substring(GET.length() + 1));
- return propName.toString();
- }
-
- private <T extends Annotation> T getAnnotation(Method method, int index, Class<T> annotationType) {
- Annotation[] annotations = method.getParameterAnnotations()[index];
- for (Annotation annotation : annotations) {
- if (annotation.annotationType() == annotationType) {
- return annotationType.cast(annotation);
- }
- }
- return null;
- }
-
- private static String getValue(String value, String defaultValue) {
- return "".equals(value) ? defaultValue : value;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.java
deleted file mode 100644
index 18eda13efb..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WebServiceInterfaceProcessor.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.interfacedef.java.jaxws;
-
-import javax.jws.WebService;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-
-/**
- * Introspect the java class/interface to see if it has @WebService annotation
- *
- * @version $Rev$ $Date$
- */
-public class WebServiceInterfaceProcessor implements JavaInterfaceVisitor {
-
- public WebServiceInterfaceProcessor() {
- super();
- }
-
- public void visitInterface(JavaInterface contract) throws InvalidInterfaceException {
-
- final Class<?> clazz = contract.getJavaClass();
- WebService webService = clazz.getAnnotation(WebService.class);
- if (webService != null) {
- // Mark SEI as Remotable
- contract.setRemotable(true);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
deleted file mode 100644
index 764c10ff00..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGenerator.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
-
-public class WrapperBeanGenerator extends BaseBeanGenerator {
-
- public List<Class<?>> generateWrapperBeans(Class<?> sei) {
- GeneratedClassLoader cl = new GeneratedClassLoader(sei.getClassLoader());
- List<Class<?>> classes = new ArrayList<Class<?>>();
- for (Method m : sei.getMethods()) {
- if (m.getDeclaringClass() == Object.class) {
- continue;
- }
- classes.add(generateRequestWrapper(sei, m, cl));
- classes.add(generateResponseWrapper(sei, m, cl));
- }
- return classes;
-
- }
-
- public Class<?> generateRequestWrapper(Class<?> sei, Method m, GeneratedClassLoader cl) {
- String wrapperNamespace = JavaInterfaceUtil.getNamespace(sei);
- String wrapperName = m.getName();
- String wrapperBeanName = capitalize(wrapperName);
- String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName;
-
- return generateRequestWrapper(m, wrapperClassName, wrapperNamespace, wrapperName, cl);
- }
-
- public Class<?> generateRequestWrapper(Method m,
- String wrapperClassName,
- String wrapperNamespace,
- String wrapperName,
- GeneratedClassLoader cl) {
- synchronized (m.getDeclaringClass()) {
- MethodKey key = new MethodKey(m, true);
- Class<?> wrapperClass = generatedClasses.get(key);
- if (wrapperClass == null) {
- String wrapperClassDescriptor = wrapperClassName.replace('.', '/');
- String wrapperClassSignature = "L" + wrapperClassDescriptor + ";";
-
- Class<?>[] paramTypes = m.getParameterTypes();
- Type[] genericParamTypes = m.getGenericParameterTypes();
- Annotation[][] paramAnnotations = m.getParameterAnnotations();
- List<BeanProperty> properties = new ArrayList<BeanProperty>();
- for (int i = 0; i < paramTypes.length; i++) {
- String propNS = "";
- String propName = "arg" + i;
-
- WebParam webParam = findAnnotation(paramAnnotations[i], WebParam.class);
- if (webParam != null && webParam.header()) {
- continue;
- }
- WebParam.Mode mode = WebParam.Mode.IN;
- if (webParam != null) {
- mode = webParam.mode();
- if (webParam.name().length() > 0) {
- propName = webParam.name();
- }
- propNS = webParam.targetNamespace();
- }
- if (mode.equals(WebParam.Mode.IN) || mode.equals(WebParam.Mode.INOUT)) {
- java.lang.reflect.Type genericParamType = getHolderValueType(genericParamTypes[i]);
- Class<?> paramType = CodeGenerationHelper.getErasure(genericParamType);
- BeanProperty prop = new BeanProperty(propNS, propName, paramType, genericParamType, true);
- prop.getJaxbAnnotaions().addAll(findJAXBAnnotations(paramAnnotations[i]));
- properties.add(prop);
- }
- }
-
- wrapperClass =
- generate(wrapperClassDescriptor, wrapperClassSignature, wrapperNamespace, wrapperName, properties
- .toArray(new BeanProperty[properties.size()]), cl);
- generatedClasses.put(key, wrapperClass);
- }
- return wrapperClass;
-
- }
- }
-
- public Class<?> generateResponseWrapper(Class<?> sei, Method m, GeneratedClassLoader cl) {
- String wrapperNamespace = JavaInterfaceUtil.getNamespace(sei);
-
- String wrapperName = m.getName() + "Response";
- String wrapperBeanName = capitalize(wrapperName);
- String wrapperClassName = CodeGenerationHelper.getPackagePrefix(sei) + wrapperBeanName;
- return generateResponseWrapper(m, wrapperClassName, wrapperNamespace, wrapperName, cl);
-
- }
-
- public Class<?> generateResponseWrapper(Method m,
- String wrapperClassName,
- String wrapperNamespace,
- String wrapperName,
- GeneratedClassLoader cl) {
- synchronized (m.getDeclaringClass()) {
- MethodKey key = new MethodKey(m, false);
- Class<?> wrapperClass = generatedClasses.get(key);
- if (wrapperClass == null) {
- String wrapperClassDescriptor = wrapperClassName.replace('.', '/');
- String wrapperClassSignature = "L" + wrapperClassDescriptor + ";";
-
- List<BeanProperty> properties = new ArrayList<BeanProperty>();
- // Collect all OUT, INOUT parameters as fields
- Annotation[][] paramAnns = m.getParameterAnnotations();
- Class<?>[] paramTypes = m.getParameterTypes();
- java.lang.reflect.Type[] genericParamTypes = m.getGenericParameterTypes();
- for (int i = 0; i < paramTypes.length; i++) {
- WebParam webParam = findAnnotation(paramAnns[i], WebParam.class);
- if (webParam != null) {
- if (webParam.header() || webParam.mode() == WebParam.Mode.IN) {
- continue;
- }
- }
- if (!isHolder(genericParamTypes[i])) {
- continue;
- }
-
- List<Annotation> jaxb = findJAXBAnnotations(paramAnns[i]);
-
- java.lang.reflect.Type genericParamType = getHolderValueType(genericParamTypes[i]);
- Class<?> paramType = CodeGenerationHelper.getErasure(genericParamType);
-
- String paramNamespace = "";
- String paramName = "arg" + i;
-
- if (webParam != null) {
- if (webParam.name().length() > 0)
- paramName = webParam.name();
- if (webParam.targetNamespace().length() > 0)
- paramNamespace = webParam.targetNamespace();
- }
-
- BeanProperty prop = new BeanProperty(paramNamespace, paramName, paramType, genericParamType, true);
- prop.getJaxbAnnotaions().addAll(jaxb);
- properties.add(prop);
- }
-
- WebResult webResult = m.getAnnotation(WebResult.class);
- Class<?> returnType = m.getReturnType();
- if (!((webResult != null && webResult.header()) || returnType == Void.TYPE)) {
- String propName = "return";
- String propNS = "";
-
- if (webResult != null) {
- if (webResult.name().length() > 0) {
- propName = webResult.name();
- }
- if (webResult.targetNamespace().length() > 1) {
- propNS = webResult.targetNamespace();
- }
- }
-
- List<Annotation> jaxb = findJAXBAnnotations(m.getAnnotations());
-
- Type genericReturnType = m.getGenericReturnType();
- BeanProperty prop = new BeanProperty(propNS, propName, returnType, genericReturnType, true);
- prop.getJaxbAnnotaions().addAll(jaxb);
- properties.add(prop);
- }
- wrapperClass =
- generate(wrapperClassDescriptor, wrapperClassSignature, wrapperNamespace, wrapperName, properties
- .toArray(new BeanProperty[properties.size()]), cl);
- generatedClasses.put(key, wrapperClass);
- }
- return wrapperClass;
-
- }
- }
-
- private static class MethodKey {
- private Method m;
- private boolean request;
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((m == null) ? 0 : m.hashCode());
- result = prime * result + (request ? 1231 : 1237);
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final MethodKey other = (MethodKey)obj;
- if (m == null) {
- if (other.m != null)
- return false;
- } else if (!m.equals(other.m))
- return false;
- if (request != other.request)
- return false;
- return true;
- }
-
- public MethodKey(Method m, boolean request) {
- super();
- this.m = m;
- this.request = request;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.java
deleted file mode 100644
index 1b07e25bad..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean.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.interfacedef.java.jaxws;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public interface Bean<T> {
- T getP1();
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.java
deleted file mode 100644
index d38a21ba52..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean1.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.interfacedef.java.jaxws;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Bean1 {
- private String p1;
- private int p2;
- public String getP1() {
- return p1;
- }
- public void setP1(String p1) {
- this.p1 = p1;
- }
- public int getP2() {
- return p2;
- }
- public void setP2(int p2) {
- this.p2 = p2;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.java
deleted file mode 100644
index 7b9375063d..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/Bean2.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.interfacedef.java.jaxws;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class Bean2 implements Bean<String>{
- private String p1;
- private int p2;
- public String getP1() {
- return p1;
- }
- public void setP1(String p1) {
- this.p1 = p1;
- }
- public int getP2() {
- return p2;
- }
- public void setP2(int p2) {
- this.p2 = p2;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.java
deleted file mode 100644
index 567591f166..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/FaultBeanGeneratorTestCase.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.interfacedef.java.jaxws;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.lang.annotation.Annotation;
-
-import javax.xml.bind.JAXBContext;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.util.CheckClassAdapter;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FaultBeanGeneratorTestCase extends TestCase {
- public void testGenerate() throws IOException {
- byte[] content = new FaultBeanGenerator().generate(MyException.class);
- ClassReader cr = new ClassReader(content);
- PrintWriter pw = new PrintWriter(System.out);
- CheckClassAdapter.verify(cr, false, pw);
- }
-
- public void testGenerateClass() throws Exception {
- Class<?> cls = FaultBeanGenerator.generateFaultBeanClass(MyException.class);
- Assert.assertEquals("org.apache.tuscany.sca.interfacedef.java.jaxws.jaxws.MyExceptionBean", cls.getName());
- for (Annotation a : cls.getAnnotations()) {
- System.out.println(a);
- }
- // XmlType xmlType = cls.getAnnotation(XmlType.class);
- // System.out.println(xmlType);
- Object bean = cls.newInstance();
- JAXBContext context = JAXBContextHelper.createJAXBContext(cls);
- StringWriter sw = new StringWriter();
- context.createMarshaller().marshal(bean, sw);
- System.out.println(sw.toString());
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
deleted file mode 100644
index 725f296090..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessorTestCase.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-import javax.jws.soap.SOAPBinding;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
-import org.apache.tuscany.sca.databinding.jaxb.DefaultXMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.databinding.jaxb.XMLAdapterExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-
-import com.example.stock.StockExceptionTest;
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JAXWSJavaInterfaceProcessorTestCase extends TestCase {
- private JAXWSJavaInterfaceProcessor interfaceProcessor;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- DataBindingExtensionPoint db = new DefaultDataBindingExtensionPoint();
- XMLAdapterExtensionPoint xa = new DefaultXMLAdapterExtensionPoint();
- interfaceProcessor = new JAXWSJavaInterfaceProcessor(db, new JAXWSFaultExceptionMapper(db, xa), xa);
- }
-
- public void testWrapper() throws Exception {
- DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory();
- JavaInterface contract = iFactory.createJavaInterface(StockExceptionTest.class);
-
- interfaceProcessor.visitInterface(contract);
- Operation op = contract.getOperations().get(0);
- Assert.assertTrue(!op.isInputWrapperStyle());
- Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOffer"), op.getInputWrapper().getWrapperElement().getQName());
- Assert.assertEquals(new QName("http://www.example.com/stock", "stockQuoteOfferResponse"), op.getOutputWrapper().getWrapperElement().getQName());
- }
-
- /**
- * Test method for
- * {@link org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor#visitInterface(JavaInterface)}.
- */
- public final void testProcessor() throws Exception {
- DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory();
- JavaInterface contract = iFactory.createJavaInterface(WebServiceInterfaceWithoutAnnotation.class);
-
- interfaceProcessor.visitInterface(contract);
- assertFalse(contract.isRemotable());
-
- contract = iFactory.createJavaInterface(WebServiceInterfaceWithAnnotation.class);
- interfaceProcessor.visitInterface(contract);
- assertTrue(contract.isRemotable());
-
- Operation op1 = contract.getOperations().get(0);
- Operation op2 = contract.getOperations().get(1);
-
- Operation op = null;
- if ("m1".equals(op1.getName())) {
- op = op1;
- } else {
- op = op2;
- }
-
- assertTrue(!op.isInputWrapperStyle() && op.getInputWrapper() == null);
-
- if ("M2".equals(op2.getName())) {
- op = op2;
- } else {
- op = op1;
- }
- assertTrue(!op.isInputWrapperStyle() && op.getInputWrapper() != null);
-
- }
-
- @WebService
- private static interface WebServiceInterfaceWithAnnotation {
-
- @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
- @WebMethod(operationName = "m1")
- String m1(String str);
-
- @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
- @WebMethod(operationName = "M2")
- String m2(String str, int i);
- }
-
- private static interface WebServiceInterfaceWithoutAnnotation {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java
deleted file mode 100644
index b3c7102a78..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JavaReflectionHelperTestCase.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.lang.reflect.Field;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaReflectionHelperTestCase {
- @Test
- public void testErasure() throws Exception {
- for (Field f : TestGenericClass.class.getDeclaredFields()) {
- Class<?> cls = CodeGenerationHelper.getErasure(f.getGenericType());
- System.out.println(cls.getName());
- Assert.assertSame(f.getType(), cls);
- }
- }
-
- @Test
- public void testSignature() throws Exception {
- for (Field f : TestGenericClass.class.getDeclaredFields()) {
- String sig = CodeGenerationHelper.getSignature(f.getGenericType());
- System.out.println(sig);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.java
deleted file mode 100644
index 4df0517de6..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyException.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.interfacedef.java.jaxws;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class MyException extends Exception {
- private String error;
- private int code;
-
- public MyException() {
- super();
- }
-
- public MyException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public MyException(String message) {
- super(message);
- }
-
- public MyException(Throwable cause) {
- super(cause);
- }
-
- public String getError() {
- return error;
- }
-
- public void setError(String error) {
- this.error = error;
- }
-
- public int getCode() {
- return code;
- }
-
- public void setCode(int code) {
- this.code = code;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java
deleted file mode 100644
index 78527193d5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/MyServiceImpl.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.util.List;
-
-import javax.jws.WebMethod;
-import javax.jws.WebService;
-
-/**
- * @version $Rev$ $Date$
- */
-@WebService
-public class MyServiceImpl {
-
- public MyServiceImpl() {
- super();
- }
-
- @WebMethod
- public <T extends Bean1> T getBean(T b, Bean2 b2) {
- return null;
- }
-
- @WebMethod
- public List<? extends Bean1> getBeans() {
- return null;
- }
-
- @WebMethod
- public String convert(String str, int i) throws MyException {
- return "ME";
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.java
deleted file mode 100644
index 2ecf822904..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestGenericClass.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.interfacedef.java.jaxws;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TestGenericClass <T extends Serializable & List<String>, S> {
- public TestGenericClass<?, S> i;
- public T f1;
- public T[] f2;
- public S f3;
- public List<? extends T> list1;
- public List<?> list2;
- public List<? extends Serializable> list3;
- public int f4;
- public int[] f5;
- public Map<? super T, S> map;
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.java
deleted file mode 100644
index a6a3375eff..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/TestInterface.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.interfacedef.java.jaxws;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.xml.ws.Holder;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * @version $Rev$ $Date$
- */
-@Remotable
-public interface TestInterface {
- int convert(String currency1, String currency2);
-
- List<Double> getRates(String currency);
-
- void check(boolean flag);
-
- String[] list(int[] list);
-
- int[][] map(String[][] strs);
-
- String getGreetings(String name);
-
- String[] getGreetingsArray(String[] names);
-
- List<String> getGreetingsList(List<String> names);
-
- ArrayList<String> getGreetingsArrayList(ArrayList<String> names);
-
- Map<String, String> getGreetingsMap(Map<String, String> namesMap);
-
- HashMap<String, String> getGreetingsHashMap(HashMap<String, String> namesMap);
-
- @WebMethod
- @WebResult(name = "output")
- String webMethod(@WebParam(name = "input", mode = WebParam.Mode.IN)
- String in, @WebParam(name = "holder", mode = WebParam.Mode.INOUT)
- Holder<String> holder);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java
deleted file mode 100644
index b14ef19939..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/java/org/apache/tuscany/sca/interfacedef/java/jaxws/WrapperBeanGeneratorTestCase.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.jaxws;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
-import org.apache.tuscany.sca.databinding.jaxb.JAXBTypeHelper;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WrapperBeanGeneratorTestCase {
- @Test
- public void testGenerate() throws Exception {
- List<Class<?>> classes = new WrapperBeanGenerator().generateWrapperBeans(TestInterface.class);
- for (Class<?> cls : classes) {
- for (Field f : cls.getDeclaredFields()) {
- System.out.println(f.getName());
- System.out.println(f.getGenericType());
- for (Annotation a : f.getAnnotations()) {
- System.out.println(a);
- }
- }
- for (Method m : cls.getDeclaredMethods()) {
- System.out.println(m);
- for (Annotation a : m.getAnnotations()) {
- System.out.println(a);
- }
- }
- }
- JAXBContext context = JAXBContextHelper.createJAXBContext(classes.toArray(new Class<?>[classes.size()]));
- for (Class<?> cls : classes) {
- Object obj = cls.newInstance();
- StringWriter sw = new StringWriter();
- context.createMarshaller().marshal(obj, sw);
- // System.out.println(sw.toString());
- StringReader sr = new StringReader(sw.toString());
- context.createUnmarshaller().unmarshal(new StreamSource(sr), cls);
- }
- }
-
- @Test
- public void testGenerateSchema() throws Exception {
- List<Class<?>> classes = new WrapperBeanGenerator().generateWrapperBeans(TestInterface.class);
- JAXBContext context = JAXBContextHelper.createJAXBContext(classes.toArray(new Class<?>[classes.size()]));
- Map<String, String> results = JAXBTypeHelper.generateSchema(context);
- for (String xsd : results.values()) {
- System.out.println(xsd);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/Stock.wsdl b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/Stock.wsdl
deleted file mode 100644
index 882408ade6..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/Stock.wsdl
+++ /dev/null
@@ -1,142 +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.
--->
-<wsdl:definitions targetNamespace="http://www.example.com/stock" xmlns:impl="http://www.example.com/stock"
- xmlns:tns="http://www.example.com/stock" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
- <wsdl:types>
- <schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <complexType name="StockOffer">
- <sequence>
- <element name="symbol" minOccurs="1" type="xsd:string" />
- <element name="price" minOccurs="1" type="xsd:float" nillable="true" /><!-- max price reqested, actual response -->
- <element name="name" minOccurs="0" type="xsd:string" />
- <element name="list" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
- </sequence>
- </complexType>
-
- <element name="stockQuoteOffer">
- <complexType>
- <sequence>
- <element name="input" minOccurs="0" maxOccurs="unbounded" type="tns:StockOffer" />
- </sequence>
- </complexType>
- </element>
- <element name="stockQuoteOfferResponse">
- <complexType>
- <sequence>
- <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
- </sequence>
- </complexType>
- </element>
-
- <!-- Faults -->
- <element name="InvalidSymbolFault">
- <complexType>
- <sequence>
- <element name="message" minOccurs="1" type="xsd:string" />
- <element name="offer" minOccurs="1" type="tns:StockOffer" />
- </sequence>
- </complexType>
- </element>
-
- <element name="MarketClosedFault" type="xsd:int" />
-
- <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
-
- </schema>
- </wsdl:types>
-
-
- <wsdl:message name="stockQuoteOfferRequest">
- <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="stockQuoteOfferResponse">
- <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="InvalidSymbolFault">
- <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
- </wsdl:message>
-
- <wsdl:message name="MarketClosedFault">
- <wsdl:part element="tns:MarketClosedFault" name="fault" />
- </wsdl:message>
-
- <wsdl:message name="TestNotDeclaredAtSourceFault">
- <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
- </wsdl:message>
-
-
- <wsdl:portType name="StockExceptionTest">
- <wsdl:operation name="stockQuoteOffer">
- <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
-
- <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
-
- <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
-
- <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
-
- <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
- </wsdl:operation>
-
-
- </wsdl:portType>
-
- <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
- <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-
- <wsdl:operation name="stockQuoteOffer">
- <wsdlsoap:operation soapAction="" />
-
- <wsdl:input name="stockQuoteOfferRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
-
- <wsdl:output name="stockQuoteOfferResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
-
- <wsdl:fault name="InvalidSymbolException">
- <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
- </wsdl:fault>
-
- <wsdl:fault name="MarketClosedException">
- <wsdlsoap:fault name="MarketClosedException" use="literal" />
- </wsdl:fault>
-
- <wsdl:fault name="TestNotDeclaredAtSourceException">
- <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
- </wsdl:fault>
-
-
-
- </wsdl:operation>
-
-
- </wsdl:binding>
-
-
-</wsdl:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl b/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
deleted file mode 100644
index 4fee9e9756..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-jaxws/src/test/resources/wsdl/StockExceptionTest.wsdl
+++ /dev/null
@@ -1,149 +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.
- -->
-<wsdl:definitions targetNamespace="http://www.example.com/stock" xmlns:impl="http://www.example.com/stock"
- xmlns:tns="http://www.example.com/stock" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="StockExceptionTest">
- <wsdl:types>
- <schema targetNamespace="http://www.example.com/stock" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <complexType name="StockOffer">
- <sequence>
- <element name="symbol" minOccurs="1" type="xsd:string" />
- <element name="price" minOccurs="1" type="xsd:float" nillable="true" /> <!-- max price reqested, actual response -->
- <element name="name" minOccurs="0" type="xsd:string" />
- <element name="list" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
- </sequence>
- </complexType>
-
- <element name="stockQuoteOffer">
- <complexType>
- <sequence>
- <element name="input" minOccurs="0" maxOccurs="unbounded" type="tns:StockOffer" />
- </sequence>
- </complexType>
- </element>
- <!-- TUSCANY 2505, make the responseWrapper non-anonymous -->
- <element name="stockQuoteOfferResponse" type="tns:StockQuoteOfferResponseType">
- </element>
- <complexType name="StockQuoteOfferResponseType">
- <sequence>
- <element name="stockQuoteOfferReturn" minOccurs="0" type="tns:StockOffer" />
- </sequence>
- </complexType>
- <!-- Faults -->
- <element name="InvalidSymbolFault">
- <complexType>
- <sequence>
- <element name="message" minOccurs="1" type="xsd:string" />
- <element name="offer" minOccurs="1" type="tns:StockOffer" />
- </sequence>
- </complexType>
- </element>
-
- <element name="MarketClosedFault" type="xsd:int" />
-
- <element name="TestNotDeclaredAtSourceFault" type="xsd:string" />
-
- </schema>
- </wsdl:types>
-
-
- <wsdl:message name="stockQuoteOfferRequest">
- <wsdl:part element="tns:stockQuoteOffer" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="stockQuoteOfferResponse">
- <wsdl:part element="tns:stockQuoteOfferResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="InvalidSymbolFault">
- <wsdl:part element="tns:InvalidSymbolFault" name="fault" />
- </wsdl:message>
-
- <wsdl:message name="MarketClosedFault">
- <wsdl:part element="tns:MarketClosedFault" name="fault" />
- </wsdl:message>
-
- <wsdl:message name="TestNotDeclaredAtSourceFault">
- <wsdl:part element="tns:TestNotDeclaredAtSourceFault" name="fault" />
- </wsdl:message>
-
-
- <wsdl:portType name="StockExceptionTest">
- <wsdl:operation name="stockQuoteOffer">
- <wsdl:input message="tns:stockQuoteOfferRequest" name="stockQuoteOfferRequest" />
-
- <wsdl:output message="tns:stockQuoteOfferResponse" name="stockQuoteOfferResponse" />
-
- <wsdl:fault message="tns:InvalidSymbolFault" name="InvalidSymbolException" />
-
- <wsdl:fault message="tns:MarketClosedFault" name="MarketClosedException" />
-
- <wsdl:fault message="tns:TestNotDeclaredAtSourceFault" name="TestNotDeclaredAtSourceException" />
- </wsdl:operation>
-
-
- </wsdl:portType>
-
- <wsdl:binding name="StockExceptionTestServiceSoapBinding" type="tns:StockExceptionTest">
- <!-- <wsaw:UsingAddressing wsdl:required="false" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/> -->
-
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
-
- <wsdl:operation name="stockQuoteOffer">
- <wsdlsoap:operation soapAction="" />
-
- <wsdl:input name="stockQuoteOfferRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
-
- <wsdl:output name="stockQuoteOfferResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
-
- <wsdl:fault name="InvalidSymbolException">
- <wsdlsoap:fault name="InvalidSymbolException" use="literal" />
- </wsdl:fault>
-
- <wsdl:fault name="MarketClosedException">
- <wsdlsoap:fault name="MarketClosedException" use="literal" />
- </wsdl:fault>
-
- <wsdl:fault name="TestNotDeclaredAtSourceException">
- <wsdlsoap:fault name="TestNotDeclaredAtSourceException" use="literal" />
- </wsdl:fault>
-
-
-
- </wsdl:operation>
-
-
- </wsdl:binding>
-
- <wsdl:service name="StockExceptionTestService">
- <wsdl:port binding="tns:StockExceptionTestServiceSoapBinding" name="StockExceptionTestServiceSoapPort">
- <wsdlsoap:address location="http://localhost:8085/services/exchangeJaxbService" />
-
- </wsdl:port>
-
- </wsdl:service>
-
-</wsdl:definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/LICENSE b/branches/sca-java-1.5.1/modules/interface-java-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-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-java-1.5.1/modules/interface-java-xml/NOTICE b/branches/sca-java-1.5.1/modules/interface-java-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/pom.xml b/branches/sca-java-1.5.1/modules/interface-java-xml/pom.xml
deleted file mode 100644
index 965420a54b..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/pom.xml
+++ /dev/null
@@ -1,83 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface-java-xml</artifactId>
- <name>Apache Tuscany SCA Java Interface XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface.java.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef.java.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java b/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.java
deleted file mode 100644
index 5d2d8ed51c..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaConstants.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.interfacedef.java.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Interface Java XML Constants.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaConstants {
-
- String INTERFACE_JAVA = "interface.java";
- QName INTERFACE_JAVA_QNAME = new QName(Constants.SCA10_NS, "interface.java");
- String INTERFACE = "interface";
- String CALLBACK_INTERFACE = "callbackInterface";
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
deleted file mode 100644
index 79ed9562cb..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/java/org/apache/tuscany/sca/interfacedef/java/xml/JavaInterfaceProcessor.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceProcessor implements StAXArtifactProcessor<JavaInterfaceContract>, JavaConstants {
-
- private JavaInterfaceFactory javaFactory;
- private ExtensionFactory extensionFactory;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- public JavaInterfaceProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.javaFactory = modelFactories.getFactory(JavaInterfaceFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-javaxml-validation-messages", Severity.ERROR, model, message,(Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- private JavaInterface createJavaInterface(String interfaceName) {
- JavaInterface javaInterface = javaFactory.createJavaInterface();
- javaInterface.setUnresolved(true);
- javaInterface.setName(interfaceName);
- return javaInterface;
- }
-
- public JavaInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- // Read an <interface.java>
- JavaInterfaceContract javaInterfaceContract = javaFactory.createJavaInterfaceContract();
- String interfaceName = reader.getAttributeValue(null, INTERFACE);
- if (interfaceName != null) {
- JavaInterface javaInterface = createJavaInterface(interfaceName);
- javaInterfaceContract.setInterface(javaInterface);
- }
-
- String callbackInterfaceName = reader.getAttributeValue(null, CALLBACK_INTERFACE);
- if (callbackInterfaceName != null) {
- JavaInterface javaCallbackInterface = createJavaInterface(callbackInterfaceName);
- javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
- }
-
- // Handle extended attributes
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
- (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- javaInterfaceContract.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && INTERFACE_JAVA_QNAME.equals(reader.getName())) {
- break;
- }
- }
- return javaInterfaceContract;
- }
-
- public void write(JavaInterfaceContract javaInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write an <interface.java>
- writer.writeStartElement(Constants.SCA10_NS, INTERFACE_JAVA);
- JavaInterface javaInterface = (JavaInterface)javaInterfaceContract.getInterface();
-
- if (javaInterface != null && javaInterface.getName() != null) {
- writer.writeAttribute(INTERFACE, javaInterface.getName());
- }
-
- JavaInterface javaCallbackInterface = (JavaInterface)javaInterfaceContract.getCallbackInterface();
- if (javaCallbackInterface != null && javaCallbackInterface.getName() != null) {
- writer.writeAttribute(CALLBACK_INTERFACE, javaCallbackInterface.getName());
- }
-
- // Write extended attributes
- for(Extension extension : javaInterfaceContract.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- writer.writeEndElement();
- }
-
- private JavaInterface resolveJavaInterface(JavaInterface javaInterface, ModelResolver resolver) throws ContributionResolveException {
-
- if (javaInterface != null && javaInterface.isUnresolved()) {
-
- // Resolve the Java interface
- javaInterface = resolver.resolveModel(JavaInterface.class, javaInterface);
- if (javaInterface.isUnresolved()) {
-
- // If the Java interface has never been resolved yet, do it now
- ClassReference classReference = new ClassReference(javaInterface.getName());
- classReference = resolver.resolveModel(ClassReference.class, classReference);
- Class javaClass = classReference.getJavaClass();
- if (javaClass == null) {
- error("ClassNotFoundException", resolver, javaInterface.getName());
- return javaInterface;
- //throw new ContributionResolveException(new ClassNotFoundException(javaInterface.getName()));
- }
-
- try {
- // Introspect the Java interface and populate the interface and
- // operations
- javaFactory.createJavaInterface(javaInterface, javaClass);
-
- } catch (InvalidInterfaceException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", javaFactory, ce);
- return javaInterface;
- //throw ce;
- }
-
- // Cache the resolved interface
- javaInterface.setUnresolved(false);
- resolver.addModel(javaInterface);
- }
- }
- return javaInterface;
- }
-
- public void resolve(JavaInterfaceContract javaInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the interface and callback interface
- JavaInterface javaInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getInterface(), resolver);
- javaInterfaceContract.setInterface(javaInterface);
-
- JavaInterface javaCallbackInterface = resolveJavaInterface((JavaInterface)javaInterfaceContract.getCallbackInterface(), resolver);
- javaInterfaceContract.setCallbackInterface(javaCallbackInterface);
- }
-
- public QName getArtifactType() {
- return INTERFACE_JAVA_QNAME;
- }
-
- public Class<JavaInterfaceContract> getModelType() {
- return JavaInterfaceContract.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index b3e52e5709..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.interfacedef.java.xml.JavaInterfaceProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#interface.java,model=org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties b/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties
deleted file mode 100644
index bc0a7192b5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/main/resources/interface-javaxml-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ClassNotFoundException = Class Not Found Exception: {0}
-ContributionResolveException = ContributionResolveException occured due to :
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
deleted file mode 100644
index 313f950873..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/ReadTestCase.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading Java interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ComponentType componentType = (ComponentType)staxProcessor.read(reader);
- assertNotNull(componentType);
- }
-
- public void testReadConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
- assertNotNull(constrainingType);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.java
deleted file mode 100644
index 55fc12d176..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/java/org/apache/tuscany/sca/interfacedef/java/xml/WriteTestCase.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.interfacedef.java.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test writing Java interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(componentType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
- }
-
- public void testReadWriteConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(constrainingType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/Calculator.composite
deleted file mode 100644
index 3de6410596..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/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://sample.calculator"
- targetNamespace="http://calc"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.java interface="calculator.CalculatorService"/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType b/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorComponent.constrainingType
deleted file mode 100644
index dca38c9224..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/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 interface="calculator.CalculatorService" />
- </service>
-
- <reference name="divideService">
- <interface.java interface="calculator.DivideService" />
- </reference>
-
-</constrainingType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType b/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/xml/CalculatorImpl.componentType
deleted file mode 100644
index 23ebf576e5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/java/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 interface="calculator.CalculatorService" />
- </service>
-
- <reference name="divideService">
- <interface.java interface="calculator.DivideService" />
- </reference>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java/LICENSE b/branches/sca-java-1.5.1/modules/interface-java/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/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-java-1.5.1/modules/interface-java/NOTICE b/branches/sca-java-1.5.1/modules/interface-java/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface-java/pom.xml b/branches/sca-java-1.5.1/modules/interface-java/pom.xml
deleted file mode 100644
index a7e698383e..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/pom.xml
+++ /dev/null
@@ -1,82 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface-java</artifactId>
- <name>Apache Tuscany SCA Java Interface Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface.java</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef.java*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.java
deleted file mode 100644
index e10c023cda..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/DefaultJavaInterfaceFactory.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.interfacedef.java;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
-import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A factory for the Java interface model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultJavaInterfaceFactory extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
- private ModelFactoryExtensionPoint modelFactoryExtensionPoint;
- private boolean loadedVisitors;
-
- public DefaultJavaInterfaceFactory() {
- }
-
- public DefaultJavaInterfaceFactory(ModelFactoryExtensionPoint modelFactoryExtensionPoint) {
- this.modelFactoryExtensionPoint = modelFactoryExtensionPoint;
- }
-
- @Override
- public List<JavaInterfaceVisitor> getInterfaceVisitors() {
- loadVisitors();
- return super.getInterfaceVisitors();
- }
-
- /**
- * Load visitors declared under META-INF/services
- */
- @SuppressWarnings("unchecked")
- private synchronized void loadVisitors() {
- if (loadedVisitors)
- return;
-
- if (modelFactoryExtensionPoint != null) {
- PolicyFactory policyFactory = modelFactoryExtensionPoint.getFactory(PolicyFactory.class);
- if (policyFactory != null) {
- addInterfaceVisitor(new PolicyJavaInterfaceVisitor(policyFactory));
- }
- }
-
- // Get the databinding service declarations
- Set<ServiceDeclaration> visitorDeclarations;
- try {
- visitorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavaInterfaceVisitor.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load data bindings
- for (ServiceDeclaration visitorDeclaration: visitorDeclarations) {
- JavaInterfaceVisitor visitor;
- try {
- Class<JavaInterfaceVisitor> visitorClass = (Class<JavaInterfaceVisitor>)visitorDeclaration.loadClass();
- visitor = visitorClass.newInstance();
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- addInterfaceVisitor(visitor);
- }
-
- loadedVisitors = true;
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
deleted file mode 100644
index 9c09ef50c2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java;
-
-import javax.xml.namespace.QName;
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.interfacedef.Interface;
-
-/**
- * Represents a Java interface.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaInterface extends Interface, Base {
-
- /**
- * Returns the name of the Java interface class.
- *
- * @return the name of the Java interface class
- */
- String getName();
-
- /**
- * Sets the name of the Java interface class.
- *
- * @param className the name of the Java interface class
- */
- void setName(String className);
-
- /**
- * Returns the QName of the JAX-WS interface.
- *
- * @return the QName of the JAX-WS interface
- */
- QName getQName();
-
- /**
- * Sets the QName of the JAX-WS interface.
- *
- * @param interfaceName the QName of the JAX-WS interface
- */
- void setQName(QName interfaceName);
-
- /**
- * Returns the Java interface class.
- *
- * @return the Java interface class
- */
- Class<?> getJavaClass();
-
- /**
- * Sets the Java interface class.
- *
- * @param javaClass the Java interface class
- */
- void setJavaClass(Class<?> javaClass);
-
- /**
- * Returns the callback class specified in an @Callback annotation.
- *
- * @return the callback class specified in an @Callback annotation
- */
- Class<?> getCallbackClass();
-
- /**
- * Sets the callback class specified in an @Callback annotation.
- *
- * @param callbackClass the callback class specified in an @Callback annotation
- */
- void setCallbackClass(Class<?> callbackClass);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.java
deleted file mode 100644
index ac747d579d..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceContract.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.interfacedef.java;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * Represents a Java interface contract.
- * JavaInterfaceContract
- *
- * @version $Rev$ $Date$
- */
-public interface JavaInterfaceContract extends InterfaceContract, Extensible {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.java
deleted file mode 100644
index 9225926269..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterfaceFactory.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.interfacedef.java;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-
-/**
- * Factory for the Java interface model
- *
- * @version $Rev$ $Date$
- */
-public interface JavaInterfaceFactory {
-
- /**
- * Creates a new Java interface model.
- *
- * @return
- */
- JavaInterface createJavaInterface();
-
- /**
- * Creates a new Java interface model from an interface class.
- * @param interfaceClass the interface class to introspect.
- * @return
- */
- JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException;
-
- /**
- * Creates the contents of a Java interface model from an interface class.
- * @param javaInterface the Java interface model
- * @param interfaceClass the interface class to introspect.
- * @return
- */
- void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException;
-
- /**
- * Creates a new Java interface contract.
- *
- * @return
- */
- JavaInterfaceContract createJavaInterfaceContract();
-
- /**
- * Registers the given visitor.
- *
- * @param visitor
- */
- void addInterfaceVisitor(JavaInterfaceVisitor visitor);
-
- /**
- * Deregisters the given visitor.
- *
- * @param visitor
- */
- void removeInterfaceVisitor(JavaInterfaceVisitor visitor);
-
- /**
- * Returns a list of interface visitors.
- *
- * @return
- */
- List<JavaInterfaceVisitor> getInterfaceVisitors();
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
deleted file mode 100644
index e6cb35cc4b..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.java;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * Represents a Java operation.
- *
- * @version $Rev$ $Date$
- */
-public interface JavaOperation extends Operation {
-
- /**
- * Returns the Java method defining the operation.
- * @return the Java method
- */
- Method getJavaMethod();
-
- /**
- * Sets the Java method defining the operation.
- * @param method the Java method
- */
- void setJavaMethod(Method method);
-
- /**
- * Returns the JAX-WS @WebMethod action parameter.
- * @return the action value
- */
- String getAction();
-
- /**
- * Sets the JAX-WS @WebMethod action parameter.
- * @param action the action value
- */
- void setAction(String action);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/ClassCachedJavaInterfaceFactoryImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/ClassCachedJavaInterfaceFactoryImpl.java
deleted file mode 100644
index bb085c9cf9..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/ClassCachedJavaInterfaceFactoryImpl.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceFactoryImpl;
-import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A factory for the Java interface model, using Class object as key to cache JavaInterface
- *
- * @version $Rev$ $Date$
- */
-public class ClassCachedJavaInterfaceFactoryImpl extends JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
-
- private ModelFactoryExtensionPoint modelFactoryExtensionPoint;
- private boolean loadedVisitors;
-
- private static Cache cache = new Cache();
-
- public ClassCachedJavaInterfaceFactoryImpl () {
- }
-
- public ClassCachedJavaInterfaceFactoryImpl(ModelFactoryExtensionPoint modelFactoryExtensionPoint) {
- this.modelFactoryExtensionPoint = modelFactoryExtensionPoint;
- }
-
- @Override
- public List<JavaInterfaceVisitor> getInterfaceVisitors() {
- loadVisitors();
- return super.getInterfaceVisitors();
- }
-
- /**
- * Load visitors declared under META-INF/services
- */
- @SuppressWarnings("unchecked")
- private synchronized void loadVisitors() {
- if (loadedVisitors)
- return;
-
- if (modelFactoryExtensionPoint != null) {
- PolicyFactory policyFactory = modelFactoryExtensionPoint.getFactory(PolicyFactory.class);
- if (policyFactory != null) {
- addInterfaceVisitor(new PolicyJavaInterfaceVisitor(policyFactory));
- }
- }
-
- // Get the databinding service declarations
- Set<ServiceDeclaration> visitorDeclarations;
- try {
- visitorDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavaInterfaceVisitor.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- // Load data bindings
- for (ServiceDeclaration visitorDeclaration: visitorDeclarations) {
- JavaInterfaceVisitor visitor;
- try {
- Class<JavaInterfaceVisitor> visitorClass = (Class<JavaInterfaceVisitor>)visitorDeclaration.loadClass();
- visitor = visitorClass.newInstance();
- } catch (ClassNotFoundException e) {
- throw new IllegalArgumentException(e);
- } catch (InstantiationException e) {
- throw new IllegalArgumentException(e);
- } catch (IllegalAccessException e) {
- throw new IllegalArgumentException(e);
- }
- addInterfaceVisitor(visitor);
- }
-
- loadedVisitors = true;
- }
-
- public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
-
- JavaInterface javaInterface = cache.get(interfaceClass);
- if (javaInterface == null) {
- javaInterface = super.createJavaInterface(interfaceClass);
- cache.put(interfaceClass, javaInterface);
- }
-
- return javaInterface;
- }
-
- private static class Cache {
-
- private Map<Class,JavaInterface> _cache = new WeakHashMap<Class,JavaInterface>();
-
- public synchronized JavaInterface get(Class<?> interfaceClass) {
- return _cache.get(interfaceClass);
- }
-
- public synchronized void put(Class<?> interfaceClass, JavaInterface javaInterface) {
- _cache.put(interfaceClass, javaInterface);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java
deleted file mode 100644
index 009eaf90c9..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceContractImpl.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-
-/**
- * Represents a Java interface contract.
- *
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceContractImpl extends InterfaceContractImpl implements JavaInterfaceContract {
- private List<Object> extensions = new ArrayList<Object>();
- private List<Extension> attributeExtensions = new ArrayList<Extension>();
-
- protected JavaInterfaceContractImpl() {
- }
-
- @Override
- public JavaInterfaceContractImpl clone() throws CloneNotSupportedException {
- return (JavaInterfaceContractImpl) super.clone();
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public List<Extension> getAttributeExtensions() {
- return attributeExtensions;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
deleted file mode 100644
index 1454851fb1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceFactoryImpl.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-
-/**
- * A factory for the Java model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class JavaInterfaceFactoryImpl implements JavaInterfaceFactory {
-
- private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
- private JavaInterfaceIntrospectorImpl introspector;
- private Map<Class<?>, JavaInterface> cache = Collections.synchronizedMap(new WeakHashMap<Class<?>, JavaInterface>());
-
- public JavaInterfaceFactoryImpl() {
- introspector = new JavaInterfaceIntrospectorImpl(this);
- }
-
- public JavaInterface createJavaInterface() {
- return new JavaInterfaceImpl();
- }
-
- public JavaInterface createJavaInterface(Class<?> interfaceClass) throws InvalidInterfaceException {
- // TODO: Review if the sharing of JavaInterface is ok
- synchronized (interfaceClass) {
- JavaInterface javaInterface = cache.get(interfaceClass);
- if (javaInterface == null) {
- javaInterface = createJavaInterface();
- introspector.introspectInterface(javaInterface, interfaceClass);
- cache.put(interfaceClass, javaInterface);
- }
- return javaInterface;
- }
- }
-
- public void createJavaInterface(JavaInterface javaInterface, Class<?> interfaceClass) throws InvalidInterfaceException {
- introspector.introspectInterface(javaInterface, interfaceClass);
- }
-
- public JavaInterfaceContract createJavaInterfaceContract() {
- return new JavaInterfaceContractImpl();
- }
-
- public void addInterfaceVisitor(JavaInterfaceVisitor extension) {
- visitors.add(extension);
- }
-
- public void removeInterfaceVisitor(JavaInterfaceVisitor extension) {
- visitors.remove(extension);
- }
-
- public List<JavaInterfaceVisitor> getInterfaceVisitors() {
- return visitors;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
deleted file mode 100644
index 194a4a9175..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import javax.xml.namespace.QName;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-
-/**
- * Represents a Java interface.
- *
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceImpl extends InterfaceImpl implements JavaInterface {
-
- private String className;
- private Class<?> javaClass;
- private Class<?> callbackClass;
- private QName qname;
-
- protected JavaInterfaceImpl() {
- }
-
- public String getName() {
- if (isUnresolved()) {
- return className;
- } else if (javaClass != null) {
- return javaClass.getName();
- } else {
- return null;
- }
- }
-
- public void setName(String className) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.className = className;
- }
-
- public QName getQName() {
- return qname;
- }
-
- public void setQName(QName interfacename) {
- qname = interfacename;
- }
-
- public Class<?> getJavaClass() {
- return javaClass;
- }
-
- public void setJavaClass(Class<?> javaClass) {
- this.javaClass = javaClass;
- if (javaClass != null) {
- this.className = javaClass.getName();
- }
- }
-
- public Class<?> getCallbackClass() {
- return callbackClass;
- }
-
- public void setCallbackClass(Class<?> callbackClass) {
- this.callbackClass = callbackClass;
- }
-
- @Override
- public String toString() {
- return getName();
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((className == null) ? 0 : className.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- JavaInterfaceImpl other = (JavaInterfaceImpl)obj;
- if (isUnresolved() || other.isUnresolved()) {
- if (className == null) {
- if (other.className != null)
- return false;
- } else if (!className.equals(other.className))
- return false;
- } else {
- if (javaClass == null) {
- if (other.javaClass != null)
- return false;
- } else if (!javaClass.equals(other.javaClass))
- return false;
- if (callbackClass == null) {
- if (other.callbackClass != null)
- return false;
- } else if (!callbackClass.equals(other.callbackClass))
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
deleted file mode 100644
index 91f946da47..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceIntrospectorImpl.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidCallbackException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.osoa.sca.annotations.Conversational;
-import org.osoa.sca.annotations.EndsConversation;
-import org.osoa.sca.annotations.OneWay;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * Default implementation of a Java interface introspector.
- *
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceIntrospectorImpl {
- public static final String IDL_INPUT = "idl:input";
-
- private static final String UNKNOWN_DATABINDING = null;
-
- private List<JavaInterfaceVisitor> visitors = new ArrayList<JavaInterfaceVisitor>();
-
- public JavaInterfaceIntrospectorImpl(JavaInterfaceFactory javaFactory) {
- this.visitors = javaFactory.getInterfaceVisitors();
- }
-
- public void introspectInterface(JavaInterface javaInterface, Class<?> clazz)
- throws InvalidInterfaceException {
- javaInterface.setJavaClass(clazz);
-
- boolean remotable = clazz.isAnnotationPresent(Remotable.class);
-
- // Consider @javax.ejb.Remote, java.rmi.Remote and javax.ejb.EJBObject
- // equivalent to @Remotable
- if (!remotable) {
- for (Annotation annotation : clazz.getAnnotations()) {
- if ("javax.ejb.Remote".equals(annotation.annotationType().getName())) {
- remotable = true;
- break;
- }
- }
- }
- if (!remotable) {
- for (Class<?> superInterface : clazz.getInterfaces()) {
- if (Remote.class == superInterface || "javax.ejb.EJBObject".equals(superInterface.getName())) {
- remotable = true;
- break;
- }
- }
- }
-
- javaInterface.setRemotable(remotable);
-
- boolean conversational = clazz.isAnnotationPresent(Conversational.class);
- javaInterface.setConversational(conversational);
-
- Class<?> callbackClass = null;
- org.osoa.sca.annotations.Callback callback = clazz.getAnnotation(org.osoa.sca.annotations.Callback.class);
- if (callback != null && !Void.class.equals(callback.value())) {
- callbackClass = callback.value();
- if (remotable && !callbackClass.isAnnotationPresent(Remotable.class)) {
- throw new InvalidCallbackException("Callback must be remotable on a remotable interface");
- }
- if (!remotable && callbackClass.isAnnotationPresent(Remotable.class)) {
- throw new InvalidCallbackException("Callback must not be remotable on a local interface");
- }
- } else if (callback != null && Void.class.equals(callback.value())) {
- throw new InvalidCallbackException("No callback interface specified on annotation");
- }
-
- javaInterface.setCallbackClass(callbackClass);
-
- String ns = JavaXMLMapper.getNamespace(clazz);
- javaInterface.getOperations().addAll(getOperations(clazz, remotable, conversational, ns));
-
- for (JavaInterfaceVisitor extension : visitors) {
- extension.visitInterface(javaInterface);
- }
- }
-
- private Class<?>[] getActualTypes(Type[] types, Class<?>[] rawTypes, Map<String, Type> typeBindings) {
- Class<?>[] actualTypes = new Class<?>[types.length];
- for (int i = 0; i < actualTypes.length; i++) {
- actualTypes[i] = getActualType(types[i], rawTypes[i], typeBindings);
- }
- return actualTypes;
- }
-
- private Class<?> getActualType(Type type, Class<?> rawType, Map<String, Type> typeBindings) {
- if (type instanceof TypeVariable<?>) {
- TypeVariable<?> typeVariable = (TypeVariable<?>)type;
- type = typeBindings.get(typeVariable.getName());
- if (type instanceof Class<?>) {
- return (Class<?>)type;
- }
- }
- return rawType;
- }
-
- private void collectGenericInterfaces(Class<?> clazz, Set<Type> genericInterfaces) {
- for (Type t : clazz.getGenericInterfaces()) {
- genericInterfaces.add(t);
- }
- Class<?>[] interfaces = clazz.getInterfaces();
- for(Class<?> c : interfaces){
- collectGenericInterfaces(c, genericInterfaces);
- }
- }
-
- private <T> List<Operation> getOperations(Class<T> clazz,
- boolean remotable,
- boolean conversational,
- String ns) throws InvalidInterfaceException {
-
- Set<Type> genericInterfaces = new HashSet<Type>();
- collectGenericInterfaces(clazz, genericInterfaces);
- Map<String, Type> typeBindings = new HashMap<String, Type>();
- for (Type genericInterface : genericInterfaces) {
- if (genericInterface instanceof ParameterizedType) {
- ParameterizedType parameterizedType = (ParameterizedType)genericInterface;
- TypeVariable<?>[] typeVariables = ((Class<?>)parameterizedType.getRawType()).getTypeParameters();
- Type[] typeArguments = parameterizedType.getActualTypeArguments();
- for (int i = 0; i < typeArguments.length; i++) {
- typeBindings.put(typeVariables[i].getName(), typeArguments[i]);
- }
- }
- }
-
- Method[] methods = clazz.getMethods();
- List<Operation> operations = new ArrayList<Operation>(methods.length);
- Set<String> names = remotable ? new HashSet<String>() : null;
- for (Method method : methods) {
- if (method.getDeclaringClass() == Object.class) {
- // Skip the methods on the Object.class
- continue;
- }
- String name = method.getName();
- if (remotable && names.contains(name)) {
- throw new OverloadedOperationException(method);
- }
- if (remotable) {
- names.add(name);
- }
-
- Class<?> returnType = getActualType(method.getGenericReturnType(), method.getReturnType(), typeBindings);
- Class<?>[] parameterTypes =
- getActualTypes(method.getGenericParameterTypes(), method.getParameterTypes(), typeBindings);
- Class<?>[] faultTypes =
- getActualTypes(method.getGenericExceptionTypes(), method.getExceptionTypes(), typeBindings);
-
- boolean nonBlocking = method.isAnnotationPresent(OneWay.class);
- if (nonBlocking) {
- if (!(returnType == void.class)) {
- throw new InvalidOperationException(
- "Method should return 'void' when declared with an @OneWay annotation. " + method,
- method);
- }
- if (!(faultTypes.length == 0)) {
- throw new InvalidOperationException(
- "Method should not declare exceptions with an @OneWay annotation. " + method,
- method);
- }
- }
-
- ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
- if (method.isAnnotationPresent(EndsConversation.class)) {
- if (!conversational) {
- throw new InvalidOperationException(
- "Method is marked as end conversation but contract is not conversational",
- method);
- }
- conversationSequence = ConversationSequence.CONVERSATION_END;
- } else if (conversational) {
- conversationSequence = ConversationSequence.CONVERSATION_CONTINUE;
- }
-
- JavaOperation operation = new JavaOperationImpl();
- operation.setName(name);
-
- // Set outputType to null for void
- XMLType xmlReturnType = new XMLType(new QName(ns, "return"), null);
- DataType<XMLType> returnDataType =
- returnType == void.class ? null : new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, returnType, method
- .getGenericReturnType(), xmlReturnType);
-
- // Input types
- List<DataType> paramDataTypes = new ArrayList<DataType>(parameterTypes.length);
- Type[] genericParamTypes = method.getGenericParameterTypes();
- for (int i = 0; i < parameterTypes.length; i++) {
- Class paramType = parameterTypes[i];
- XMLType xmlParamType = new XMLType(new QName(ns, "arg" + i), null);
- DataTypeImpl<XMLType> xmlDataType = new DataTypeImpl<XMLType>(
- UNKNOWN_DATABINDING, paramType, genericParamTypes[i],xmlParamType);
- ParameterMode mode = ParameterMode.IN;
-
- paramDataTypes.add( xmlDataType);
- operation.getParameterModes().add(mode);
- }
-
- // Fault types
- List<DataType> faultDataTypes = new ArrayList<DataType>(faultTypes.length);
- Type[] genericFaultTypes = method.getGenericExceptionTypes();
- for (int i = 0; i < faultTypes.length; i++) {
- Class<?> faultType = faultTypes[i];
- // Only add checked exceptions
- // JAXWS Specification v2.1 section 3.7 says RemoteException should not be mapped
- if (Exception.class.isAssignableFrom(faultType) && (!RuntimeException.class.isAssignableFrom(faultType))
- && (!RemoteException.class.isAssignableFrom(faultType))) {
- XMLType xmlFaultType = new XMLType(new QName(ns, faultType.getSimpleName()), null);
- DataType<XMLType> faultDataType =
- new DataTypeImpl<XMLType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i], xmlFaultType);
- faultDataTypes.add(new DataTypeImpl<DataType>(UNKNOWN_DATABINDING, faultType, genericFaultTypes[i],
- faultDataType));
- }
- }
-
- DataType<List<DataType>> inputType =
- new DataTypeImpl<List<DataType>>(IDL_INPUT, Object[].class, paramDataTypes);
- operation.setInputType(inputType);
- operation.setOutputType(returnDataType);
- operation.setFaultTypes(faultDataTypes);
- operation.setConversationSequence(conversationSequence);
- operation.setNonBlocking(nonBlocking);
- operation.setJavaMethod(method);
- operations.add(operation);
- }
- return operations;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
deleted file mode 100644
index 2782ffd8db..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtil.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.lang.reflect.TypeVariable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-
-/**
- * Contains methods for mapping between an operation in a
- * {@link org.apache.tuscany.spi.model.ServiceContract} and a method defined by
- * a Java interface
- *
- * @version $Rev$ $Date$
- */
-public final class JavaInterfaceUtil {
-
- private JavaInterfaceUtil() {
- }
-
- /**
- * Return the method on the implementation class that matches the operation.
- *
- * @param implClass the implementation class or interface
- * @param operation the operation to match
- * @return the method described by the operation
- * @throws NoSuchMethodException if no such method exists
- * @Deprecated
- */
- public static Method findMethod(Class<?> implClass, Operation operation) throws NoSuchMethodException {
- String name = operation.getName();
- if (operation instanceof JavaOperation) {
- name = ((JavaOperation)operation).getJavaMethod().getName();
- }
- Interface interface1 = operation.getInterface();
- int numParams = operation.getInputType().getLogical().size();
- if (interface1 != null && interface1.isRemotable()) {
- List<Method> matchingMethods = new ArrayList<Method>();
- for (Method m : implClass.getMethods()) {
- if (m.getName().equals(name) && m.getParameterTypes().length == numParams) {
- matchingMethods.add(m);
- }
- }
-
- // TUSCANY-2180 If there is only one method then we just match on the name
- // (this is the same as the existing behaviour)
- if (matchingMethods.size() == 1) {
- return matchingMethods.get(0);
- }
- if (matchingMethods.size() > 1) {
- // TUSCANY-2180 We need to check the parameter types too
- Class<?>[] paramTypes = getPhysicalTypes(operation);
- return implClass.getMethod(name, paramTypes);
- }
-
- // No matching method found
- throw new NoSuchMethodException("No matching method for operation " + operation.getName()
- + " is found on "
- + implClass);
- }
- Class<?>[] paramTypes = getPhysicalTypes(operation);
- return implClass.getMethod(name, paramTypes);
- }
-
- /**
- * @Deprecated
- */
- private static Class<?>[] getPhysicalTypes(Operation operation) {
- DataType<List<DataType>> inputType = operation.getInputType();
- if (inputType == null) {
- return new Class<?>[] {};
- }
- List<DataType> types = inputType.getLogical();
- Class<?>[] javaTypes = new Class<?>[types.size()];
- for (int i = 0; i < javaTypes.length; i++) {
- DataType<?> type = types.get(i);
- javaTypes[i] = getClassOfDataType(type);
- }
- return javaTypes;
- }
-
- /**
- * Get the Java Type that represent the DataType informed
- * When dataType.getGenericType() is GenericArrayType or WildcardType the Physical type is used,
- * because the physical type have the correct information about this DataType.
- * @param dataType DataType
- * @return The Class<?> that represent the DataType
- */
- private static Class<?> getClassOfDataType(DataType<?> dataType){
- Type generic = dataType.getGenericType();
- boolean isGeneric = (generic != null
- && generic != dataType.getPhysical()
- && (generic instanceof TypeVariable<?>
- || generic instanceof ParameterizedType));
- Class<?> javaType = null;
- if (isGeneric) {
- javaType = getClassOfSimpleGeneric(generic);
- }else {
- Type physical = dataType.getPhysical();
- javaType = getClassOfPhysical(physical);
- }
- if (javaType == null) {
- throw new UnsupportedOperationException();
- }
- return javaType;
- }
-
- /**
- * Return Class<?> of Type Generic informed
- * @param generic The Generic Type
- * @return The Class<?> that represent the Generic
- */
- private static Class<?> getClassOfSimpleGeneric(Type generic){
- Class<?> javaType = null;
- if (generic instanceof TypeVariable<?>){
- javaType = (Class<?>)Object.class;
- } else if (generic instanceof ParameterizedType){
- javaType = (Class<?>)((ParameterizedType)generic).getRawType();
- }
- return javaType;
- }
-
- /**
- * Return Class<?> of Type Physical informed
- * @param physical The Physical
- * @return The Class<?> that represent the Physical
- */
- private static Class<?> getClassOfPhysical(Type physical){
- Class<?> javaType = null;
- if (physical instanceof Class<?>) {
- javaType = (Class<?>)physical;
- }
- return javaType;
- }
-
- /**
- * Searches a collection of operations for a match against the given method
- *
- * @param method the method to match
- * @param operations the operations to match against
- * @return a matching operation or null
- * @Deprecated
- */
- public static Operation findOperation(Method method, Collection<Operation> operations) {
- for (Operation operation : operations) {
- if (match(operation, method)) {
- return operation;
- }
- }
- return null;
- }
-
- /**
- * Determines if the given operation matches the given method
- *
- * @return true if the operation matches, false if does not
- */
- private static boolean match(Operation operation, Method method) {
- Class<?>[] params = method.getParameterTypes();
- DataType<List<DataType>> inputType = operation.getInputType();
- List<DataType> types = inputType.getLogical();
- boolean found = true;
- if (types.size() == params.length && method.getName().equals(operation.getName())) {
- for (int i = 0; i < params.length; i++) {
- Class<?> clazz = params[i];
- if (!clazz.equals(operation.getInputType().getLogical().get(i).getPhysical())) {
- found = false;
- }
- }
- } else {
- found = false;
- }
- return found;
-
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static String getNamespace(Class<?> cls) {
- String packageName = getPackageName(cls);
- if ("".equals(packageName)) {
- return "";
- }
- StringBuffer ns = new StringBuffer("http://");
- String[] names = packageName.split("\\.");
- for (int i = names.length - 1; i >= 0; i--) {
- ns.append(names[i]);
- if (i != 0) {
- ns.append('.');
- }
- }
- ns.append('/');
- return ns.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java
deleted file mode 100644
index 4384213bf5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.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.interfacedef.java.impl;
-
-import java.lang.reflect.Method;
-
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-
-/**
- * Represents a Java operation.
- *
- * @version $Rev$ $Date$
- */
-public class JavaOperationImpl extends OperationImpl implements JavaOperation {
-
- private Method method;
- private String action;
-
- public Method getJavaMethod() {
- return method;
- }
-
- public void setJavaMethod(Method method) {
- this.method = method;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((method == null) ? 0 : method.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final JavaOperationImpl other = (JavaOperationImpl)obj;
- if (method == null) {
- if (other.method != null)
- return false;
- } else if (!method.equals(other.method))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return method == null ? "null" : method.toGenericString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
deleted file mode 100644
index ed00510a67..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/PolicyJavaInterfaceVisitor.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.lang.reflect.Method;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.osoa.sca.annotations.PolicySets;
-import org.osoa.sca.annotations.Requires;
-
-/**
- * Processes an {@link org.osoa.sca.annotations.Requires} annotation
- *
- * @version $Rev$ $Date$
- */
-public class PolicyJavaInterfaceVisitor implements JavaInterfaceVisitor {
- private PolicyFactory policyFactory;
-
- public PolicyJavaInterfaceVisitor(PolicyFactory policyFactory) {
- super();
- this.policyFactory = policyFactory;
- }
-
- private QName getQName(String intentName) {
- QName qname;
- if (intentName.startsWith("{")) {
- int i = intentName.indexOf('}');
- if (i != -1) {
- qname = new QName(intentName.substring(1, i), intentName.substring(i + 1));
- } else {
- qname = new QName("", intentName);
- }
- } else {
- qname = new QName("", intentName);
- }
- return qname;
- }
-
- /**
- * Read policy intents on the given interface or class
- * @param clazz
- * @param requiredIntents
- */
- private void readIntentsAndPolicySets(Class<?> clazz, List<Intent> requiredIntents, List<PolicySet> policySets) {
- Requires intentAnnotation = clazz.getAnnotation(Requires.class);
- if (intentAnnotation != null) {
- String[] intentNames = intentAnnotation.value();
- if (intentNames.length != 0) {
- for (String intentName : intentNames) {
-
- // Add each intent to the list
- Intent intent = policyFactory.createIntent();
- intent.setName(getQName(intentName));
- requiredIntents.add(intent);
- }
- }
- }
-
- PolicySets policySetAnnotation = clazz.getAnnotation(PolicySets.class);
- if (policySetAnnotation != null) {
- String[] policySetNames = policySetAnnotation.value();
- if (policySetNames.length != 0) {
- for (String policySetName : policySetNames) {
-
- // Add each intent to the list
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(getQName(policySetName));
- policySets.add(policySet);
- }
- }
- }
- }
-
- private void readIntents(Requires intentAnnotation, List<Intent> requiredIntents) {
- //Requires intentAnnotation = method.getAnnotation(Requires.class);
- if (intentAnnotation != null) {
- String[] intentNames = intentAnnotation.value();
- if (intentNames.length != 0) {
- //Operation operation = assemblyFactory.createOperation();
- //operation.setName(method.getName());
- //operation.setUnresolved(true);
- for (String intentName : intentNames) {
-
- // Add each intent to the list, associated with the
- // operation corresponding to the annotated method
- Intent intent = policyFactory.createIntent();
- intent.setName(getQName(intentName));
- //intent.getOperations().add(operation);
- requiredIntents.add(intent);
- }
- }
- }
- }
-
- private void readPolicySets(PolicySets policySetAnnotation, List<PolicySet> policySets) {
- if (policySetAnnotation != null) {
- String[] policySetNames = policySetAnnotation.value();
- if (policySetNames.length != 0) {
- //Operation operation = assemblyFactory.createOperation();
- //operation.setName(method.getName());
- //operation.setUnresolved(true);
- for (String policySetName : policySetNames) {
- // Add each intent to the list, associated with the
- // operation corresponding to the annotated method
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(getQName(policySetName));
- //intent.getOperations().add(operation);
- policySets.add(policySet);
- }
- }
- }
- }
-
- public void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException {
-
- if (javaInterface.getJavaClass() != null) {
- readIntentsAndPolicySets(javaInterface.getJavaClass(), javaInterface.getRequiredIntents(), javaInterface
- .getPolicySets());
-
- // Read intents on the service interface methods
- List<Operation> operations = javaInterface.getOperations();
- for (Operation op : operations) {
- JavaOperation operation = (JavaOperation)op;
- Method method = operation.getJavaMethod();
- if (method.getAnnotation(Requires.class) != null || method.getAnnotation(PolicySets.class) != null) {
- readIntents(method.getAnnotation(Requires.class), op.getRequiredIntents());
- readPolicySets(method.getAnnotation(PolicySets.class), op.getPolicySets());
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java b/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java
deleted file mode 100644
index 3bc03a528e..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/introspect/JavaInterfaceVisitor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.introspect;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-
-/**
- * Implementations introspect metadata on a Java interface, populating the
- * corresponding {@link JavaInterface}
- *
- * @version $Rev$ $Date$
- */
-public interface JavaInterfaceVisitor {
-
- /**
- * Visit a java interface
- * @param javaInterface
- * @throws InvalidInterfaceException
- */
- void visitInterface(JavaInterface javaInterface) throws InvalidInterfaceException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory b/branches/sca-java-1.5.1/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
deleted file mode 100644
index 5ba12ec137..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory
+++ /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.interfacedef.java.DefaultJavaInterfaceFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java b/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
deleted file mode 100644
index 14b0577f65..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilDuplicateRemotableTestCase.java
+++ /dev/null
@@ -1,308 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.impl;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.OverloadedOperationException;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * This test case will test that a Component that has multiple Remotable interfaces
- * that contain methods with the same name will correctly select the right method.
- *
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceUtilDuplicateRemotableTestCase extends TestCase {
-
- /**
- * Test to get the getTime() method from the LocalTimeService
- *
- * @throws Exception Test failed
- */
- public void testLocalTimeServiceGetTime() throws Exception {
- doTestLocalTimeServiceGetTime(LocalTimeService.class);
- }
-
- /**
- * Test to get the getTime() method from the LocalTimeService interface from
- * the specified class
- *
- * @param timeServiceClass The class that implements the LocalTimeService
- * @throws Exception Test failed
- */
- private void doTestLocalTimeServiceGetTime(Class timeServiceClass) throws Exception {
- // Add a getTime() method
- Operation operation = newOperation("getTime", LocalTimeService.class);
-
- Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
- assertEquals("getTime", method.getName());
- assertEquals(0, method.getParameterTypes().length);
- }
-
- /**
- * Test to get the getTime(String) method from the WorldTimeService
- *
- * @throws Exception Test failed
- */
- public void testWorldTimeServiceGetTime() throws Exception {
- doTestWorldTimeServiceGetTime(WorldTimeService.class);
- }
-
- /**
- * Test to get the getTime(String) method from the WorldTimeService interface from
- * the specified class
- *
- * @param timeServiceClass The class that implements the WorldTimeService
- * @throws Exception Test failed
- */
- private void doTestWorldTimeServiceGetTime(Class timeServiceClass) throws Exception {
- // Add a getTime(String) method
- Operation operation = newOperation("getTime", WorldTimeService.class, String.class);
-
- Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
- assertEquals("getTime", method.getName());
- assertEquals(1, method.getParameterTypes().length);
- assertEquals(String.class, method.getParameterTypes()[0]);
- }
-
- /**
- * Test to get the getTime(int) method from the GMTTimeService
- *
- * @throws Exception Test failed
- */
- public void testGMTTimeServiceGetTime() throws Exception {
- doTestGMTTimeServiceGetTime(GMTTimeService.class);
- }
-
- /**
- * Test to get the getTime(int) method from the GMTTimeService interface from
- * the specified class
- *
- * @param timeServiceClass The class that implements the WorldTimeService
- * @throws Exception Test failed
- */
- private void doTestGMTTimeServiceGetTime(Class timeServiceClass) throws Exception {
- // Add a getTime(String) method
- Operation operation = newOperation("getTime", GMTTimeService.class, Integer.TYPE);
-
- Method method = JavaInterfaceUtil.findMethod(timeServiceClass, operation);
- assertEquals("getTime", method.getName());
- assertEquals(1, method.getParameterTypes().length);
- assertEquals(Integer.TYPE, method.getParameterTypes()[0]);
- }
-
-
- /**
- * Test to get the getTime() method from the LocalTimeService on the
- * TimeServiceImpl class
- *
- * @throws Exception Test failed
- */
- public void testLocalTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
- doTestLocalTimeServiceGetTime(TimeServiceImpl.class);
- }
-
- /**
- * Test to get the getTime(String) method from the WorldTimeService on the
- * TimeServiceImpl class
- *
- * @throws Exception Test failed
- */
- public void testWorldTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
- doTestWorldTimeServiceGetTime(TimeServiceImpl.class);
- }
-
- /**
- * Test to get the getTime(int) method from the GMTTimeService
- *
- * @throws Exception Test failed
- */
- public void testGMTTimeServiceGetTimeFromTimeServiceImpl() throws Exception {
- doTestGMTTimeServiceGetTime(TimeServiceImpl.class);
- }
-
- /**
- * Creates a new operation with the specified name and parameter types
- *
- * @param name The name of the operation
- * @param operationInterface The interface to which the operation belongs
- * @param parameterTypes The types of the parameters for this operation
- * @return An operation with the specified name and parameter types
- */
- private static Operation newOperation(String name, Class operationInterface, Class... parameterTypes) {
- // Create and set the operation name
- Operation operation = new OperationImpl();
- operation.setName(name);
-
- // Make the operation remotable
- Interface iface = new InterfaceImpl();
- iface.setRemotable(true);
- operation.setInterface(iface);
-
- // Construct the parameters
- List<DataType> types = new ArrayList<DataType>();
- DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- for (Class parameterType : parameterTypes) {
- DataType type = new DataTypeImpl<Class>(parameterType, Object.class);
- types.add(type);
- }
- operation.setInputType(inputType);
-
- // Return the created operation
- return operation;
- }
-
- /**
- * Test case that validates that a @Remotable interface with Overloaded operations
- * is detected.
- *
- * This test case is for TUSCANY-2194
- */
- public void testDuplicateOpeartionOnRemotableInterface()
- {
- JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
- JavaInterfaceIntrospectorImpl introspector = new JavaInterfaceIntrospectorImpl(javaFactory);
- JavaInterfaceImpl javaInterface = new JavaInterfaceImpl();
-
- try {
- introspector.introspectInterface(javaInterface, DuplicateMethodOnRemotableInterface.class);
- Assert.fail("Should have thrown an exception as @Remotable interface has overloaded methods");
- } catch (OverloadedOperationException ex) {
- // As expected
- // Make sure that the class and method names are in the exception
- String exMsg = ex.toString();
- Assert.assertTrue("Method name missing from exception", exMsg.indexOf("aDuplicateMethod") != -1);
- Assert.assertTrue("Class name missing from exception",
- exMsg.indexOf(DuplicateMethodOnRemotableInterface.class.getName()) != -1);
- } catch (InvalidInterfaceException ex) {
- // Should have thrown OverloadedOperationException
- Assert.fail("Should have thrown an OverloadedOperationException but threw " + ex);
- }
- }
-
-
- /**
- * Sample @Remotable interface that has an overloaded operation which is not
- * allowed according to the SCA Assembly Specification.
- */
- @Remotable
- private interface DuplicateMethodOnRemotableInterface {
- void aNonDuplicateMethod();
- void aDuplicateMethod();
- void aDuplicateMethod(String aParam);
- }
-
-
- /**
- * Sample interface needed for the unit tests
- */
- @Remotable
- private interface LocalTimeService {
-
- /**
- * Gets the local time
- *
- * @return The Local Time
- */
- String getTime();
- }
-
- /**
- * Sample interface needed for the unit tests
- */
- @Remotable
- private interface WorldTimeService {
-
- /**
- * Gets the time in the specified TimeZone
- *
- * @param timeZone A Time Zone
- *
- * @return The time in the specified TimeZone
- */
- String getTime(String timeZone);
- }
-
- /**
- * Sample interface needed for the unit tests
- */
- @Remotable
- private interface GMTTimeService {
-
- /**
- * Gets the time with the specified GMT offset
- *
- * @param gmtOffset A GMT offset in hours
- *
- * @return The time with the specified GMT offset
- */
- String getTime(int gmtOffset);
- }
-
- /**
- * Sample implementation class that implements the three @Remotable interfaces
- */
- private class TimeServiceImpl implements LocalTimeService, WorldTimeService, GMTTimeService {
- /**
- * Gets the local time
- *
- * @return The Local Time
- */
- public String getTime() {
- return "The current local time";
- }
-
- /**
- * Gets the time in the specified TimeZone
- *
- * @param timeZone A Time Zone
- *
- * @return The time in the specified TimeZone
- */
- public String getTime(String timeZone) {
- return "The current time in TimeZone " + timeZone;
- }
-
- /**
- * Gets the time with the specified GMT offset
- *
- * @param gmtOffset A GMT offset in hours
- *
- * @return The time with the specified GMT offset
- */
- public String getTime(int gmtOffset) {
- return "The current time with GMT offset of " + gmtOffset;
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java b/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.java
deleted file mode 100644
index 66f98adce3..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceUtilTestCase.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.interfacedef.java.impl;
-
-import static org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil.findOperation;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceUtilTestCase extends TestCase {
- private List<Operation> operations;
-
- public void testNoParamsFindOperation() throws Exception {
- Method method = Foo.class.getMethod("foo");
- Operation ret = findOperation(method, operations);
- assertEquals("foo", ret.getName());
- assertEquals(0, method.getParameterTypes().length);
- }
-
- public void testParamsFindOperation() throws Exception {
- Method method = Foo.class.getMethod("foo", String.class);
- Operation ret = findOperation(method, operations);
- assertEquals("foo", ret.getName());
- assertEquals(String.class, method.getParameterTypes()[0]);
- }
-
- public void testPrimitiveParamFindOperation() throws NoSuchMethodException {
- Method method = Foo.class.getMethod("foo", Integer.TYPE);
- Operation operation = findOperation(method, operations);
- assertEquals(Integer.TYPE, operation.getInputType().getLogical().get(0).getPhysical());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- Operation operation = newOperation("foo");
- List<DataType> types = new ArrayList<DataType>();
- DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- operation.setInputType(inputType);
-
- operations = new ArrayList<Operation>();
- operations.add(operation);
-
- types = new ArrayList<DataType>();
- inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- DataType type = new DataTypeImpl<Class>(String.class, Object.class);
- types.add(type);
- operation = newOperation("foo");
- operation.setInputType(inputType);
- operations.add(operation);
-
- types = new ArrayList<DataType>();
- type = new DataTypeImpl<Class>(String.class, Object.class);
- DataType type2 = new DataTypeImpl<Class>(String.class, Object.class);
- types.add(type);
- types.add(type2);
- inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- operation = newOperation("foo");
- operation.setInputType(inputType);
- operations.add(operation);
-
- types = new ArrayList<DataType>();
- type = new DataTypeImpl<Class>(Integer.class, Object.class);
- types.add(type);
- inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- operation = newOperation("foo");
- operation.setInputType(inputType);
- operations.add(operation);
-
- types = new ArrayList<DataType>();
- type = new DataTypeImpl<Class>(Integer.TYPE, Object.class);
- types.add(type);
- inputType = new DataTypeImpl<List<DataType>>(Object[].class, types);
- operation = newOperation("foo");
- operation.setInputType(inputType);
- operations.add(operation);
-
- }
-
- private interface Foo {
- void foo();
-
- void foo(String foo);
-
- void foo(int b);
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java b/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
deleted file mode 100644
index f90a5cb8a1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/ConversationalIntrospectionTestCase.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.introspection.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InvalidOperationException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.osoa.sca.annotations.Conversational;
-import org.osoa.sca.annotations.EndsConversation;
-
-/**
- * @version $Rev$ $Date$
- */
-public class ConversationalIntrospectionTestCase extends TestCase {
- private JavaInterfaceFactory javaFactory;
-
- @Override
- protected void setUp() throws Exception {
- javaFactory = new DefaultJavaInterfaceFactory();
- }
-
- private Operation getOperation(Interface i, String name) {
- for (Operation op : i.getOperations()) {
- if (op.getName().equals(name)) {
- return op;
- }
- }
- return null;
- }
-
- public void testServiceContractConversationalInformationIntrospection() throws Exception {
- Interface i = javaFactory.createJavaInterface(Foo.class);
- assertNotNull(i);
- assertTrue(i.isConversational());
- ConversationSequence seq = getOperation(i, "operation").getConversationSequence();
- assertEquals(ConversationSequence.CONVERSATION_CONTINUE, seq);
- seq = getOperation(i, "endOperation").getConversationSequence();
- assertEquals(ConversationSequence.CONVERSATION_END, seq);
- }
-
- public void testBadServiceContract() throws Exception {
- try {
- javaFactory.createJavaInterface(BadFoo.class);
- fail();
- } catch (InvalidOperationException e) {
- // expected
- }
- }
-
- public void testNonConversationalInformationIntrospection() throws Exception {
- Interface i = javaFactory.createJavaInterface(NonConversationalFoo.class);
- assertFalse(i.isConversational());
- ConversationSequence seq = getOperation(i, "operation")
- .getConversationSequence();
- assertEquals(ConversationSequence.CONVERSATION_NONE, seq);
- }
-
- @Conversational
- private interface Foo {
- void operation();
-
- @EndsConversation
- void endOperation();
- }
-
- private interface BadFoo {
- void operation();
-
- @EndsConversation
- void endOperation();
- }
-
- private interface NonConversationalFoo {
- void operation();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java b/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.java
deleted file mode 100644
index 14ac8b0134..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/JavaInterfaceProcessorRegistryImplTestCase.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.interfacedef.java.introspection.impl;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expectLastCall;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.easymock.EasyMock;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JavaInterfaceProcessorRegistryImplTestCase extends TestCase {
- private JavaInterfaceFactory factory;
-
- @SuppressWarnings("unchecked")
- public void testSimpleInterface() throws InvalidInterfaceException {
- JavaInterface intf = factory.createJavaInterface(Simple.class);
-
- assertEquals(Simple.class, intf.getJavaClass());
- List<Operation> operations = intf.getOperations();
- assertEquals(1, operations.size());
- Operation baseInt = operations.get(0);
- assertEquals("baseInt", baseInt.getName());
-
- QName element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "return");
-
- DataType<XMLType> returnType = baseInt.getOutputType();
- assertEquals(Integer.TYPE, returnType.getPhysical());
- assertEquals(element, returnType.getLogical().getElementName());
-
- List<DataType> parameterTypes = baseInt.getInputType().getLogical();
- assertEquals(1, parameterTypes.size());
- DataType<XMLType> arg0 = parameterTypes.get(0);
- assertEquals(Integer.TYPE, arg0.getPhysical());
-
- element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "arg0");
- assertEquals(element, arg0.getLogical().getElementName());
-
- List<DataType> faultTypes = baseInt.getFaultTypes();
- assertEquals(1, faultTypes.size());
- DataType<DataType<XMLType>> fault0 = faultTypes.get(0);
- assertEquals(IOException.class, fault0.getPhysical());
- element = new QName("http://impl.introspection.java.interfacedef.sca.tuscany.apache.org/", "IOException");
- assertEquals(element, fault0.getLogical().getLogical().getElementName());
- }
-
- public void testUnregister() throws Exception {
- JavaInterfaceVisitor extension = createMock(JavaInterfaceVisitor.class);
- extension.visitInterface(EasyMock.isA(JavaInterface.class));
- expectLastCall().once();
- replay(extension);
- factory.addInterfaceVisitor(extension);
- factory.createJavaInterface(Base.class);
- factory.removeInterfaceVisitor(extension);
- factory.createJavaInterface(Base.class);
- verify(extension);
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- factory = new DefaultJavaInterfaceFactory();
-
- }
-
- private static interface Base {
- int baseInt(int param) throws IllegalArgumentException, IOException;
- }
-
- private static interface Simple extends Base {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java
deleted file mode 100644
index 5a454f176c..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-java/src/test/java/org/apache/tuscany/sca/interfacedef/java/introspection/impl/PolicyProcessorTestCase.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.java.introspection.impl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.osoa.sca.annotations.PolicySets;
-import org.osoa.sca.annotations.Requires;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyProcessorTestCase extends TestCase {
- private JavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
- private PolicyJavaInterfaceVisitor policyProcessor;
-
- public void testInterfaceLevel() throws Exception {
- JavaInterface type = factory.createJavaInterface(Interface1.class);
- policyProcessor.visitInterface(type);
- assertEquals(1, type.getRequiredIntents().size());
- assertEquals(1, type.getPolicySets().size());
- }
-
- public void testMethodLevel() throws Exception {
- JavaInterface type = factory.createJavaInterface(Interface2.class);
- policyProcessor.visitInterface(type);
- assertEquals(0, type.getRequiredIntents().size());
- assertEquals(1, type.getOperations().get(0).getRequiredIntents().size());
- assertEquals(1, type.getOperations().get(1).getRequiredIntents().size());
- assertEquals(0, type.getPolicySets().size());
- assertEquals(1, type.getOperations().get(0).getPolicySets().size());
- assertEquals(1, type.getOperations().get(1).getPolicySets().size());
- }
-
- public void testInterfaceAndMethodLevel() throws Exception {
- JavaInterface type = factory.createJavaInterface(Interface3.class);
- policyProcessor.visitInterface(type);
- assertEquals(1, type.getRequiredIntents().size());
- assertEquals(1, type.getOperations().get(0).getRequiredIntents().size());
- assertEquals(1, type.getOperations().get(1).getRequiredIntents().size());
- assertEquals(1, type.getPolicySets().size());
- assertEquals(1, type.getOperations().get(0).getPolicySets().size());
- assertEquals(1, type.getOperations().get(1).getPolicySets().size());
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- policyProcessor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory());
- }
-
- // @Remotable
- @Requires( {"transaction.global"})
- @PolicySets( {"{http://ns1}PS1"})
- private interface Interface1 {
- int method1();
-
- int method2();
-
- int method3();
-
- int method4();
- }
-
- private interface Interface2 {
- @Requires( {"transaction.global"})
- @PolicySets( {"{http://ns1}PS1"})
- int method1();
-
- @Requires( {"transaction.local"})
- @PolicySets( {"{http://ns1}PS2"})
- int method2();
- }
-
- @Requires( {"transaction.global.Interface6"})
- @PolicySets( {"{http://ns1}PS1"})
- private interface Interface3 {
- @Requires( {"transaction.global.Interface6.method1"})
- @PolicySets( {"{http://ns1}PS2"})
- int method1();
-
- @Requires( {"transaction.local.Interface6.method2"})
- @PolicySets( {"{http://ns1}PS3"})
- int method2();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/LICENSE b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-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-java-1.5.1/modules/interface-wsdl-xml/NOTICE b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/pom.xml b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/pom.xml
deleted file mode 100644
index 6a2837418c..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/pom.xml
+++ /dev/null
@@ -1,95 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface-wsdl-xml</artifactId>
- <name>Apache Tuscany SCA WSDL Interface XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface.wsdl.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef.wsdl.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELExtensionHandler.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELExtensionHandler.java
deleted file mode 100644
index 13203d4adc..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELExtensionHandler.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import java.io.PrintWriter;
-
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionDeserializer;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.extensions.ExtensionSerializer;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-/**
- * A WSDL extension processor for extension elements introduced by BPEL - in particular
- * the <partnerLinkType.../> elements
- *
- * @version $Rev$ $Date$
- */
-public class BPELExtensionHandler implements ExtensionSerializer, ExtensionDeserializer {
-
- private final String localName = "partnerLinkType";
- private final String roleName = "role";
-
- /**
- * Marshals the BPEL partner link type extension element to XML
- * See (@link javax.wsdl.extensions.ExtensionSerializer)
- */
- @SuppressWarnings("unchecked")
- public void marshall(Class parentType, QName elementType, ExtensibilityElement theElement,
- PrintWriter writer, Definition def, ExtensionRegistry extReg)
- throws WSDLException {
- // The format of the Partner Link Type in XML is as follows:
- // <foo:partnerLinkType name="bar">
- // <foo:role name="somename" portType="xyz:portTypeName"/>
- // <foo:role name="othername" portType="xyz:portTypeName2"/>
- // <foo:partnerLinkType>
- BPELPartnerLinkTypeExt thePLinkType = (BPELPartnerLinkTypeExt) theElement;
- QName theType = thePLinkType.getElementType();
-
- writer.println("<" + theType.toString() +
- " name=\"" + thePLinkType.getName() + "\">");
- for( int i = 0; i < 2; i++ ) {
- if( thePLinkType.getRoleName( i ) != null ) {
- writer.println( "<" + theType.getPrefix() + ":role"
- + " name=\"" + thePLinkType.getRoleName(i) + "\" portType=\""
- + thePLinkType.getRolePortType(i) + "\">");
- } // end if
- } // end for
- writer.println("</" + theType.toString() + ">");
- } // end marshall
-
- /**
- * Unmarshals the BPEL partner link type element from XML
- * See (@link javax.wsdl.extensions.ExtensionDeserializer)
- * The format of the Partner Link Type in XML is as follows:
- * <foo:partnerLinkType name="bar">
- * <foo:role name="somename" portType="xyz:portTypeName"/>
- * <foo:role name="othername" portType="xyz:portTypeName2"/>
- * <foo:partnerLinkType>
- *
- * One role is mandatory, the second is optional.
- */
- @SuppressWarnings("unchecked")
- public ExtensibilityElement unmarshall(Class theClass, QName elementType,
- Element theElement, Definition def, ExtensionRegistry extReg)
- throws WSDLException {
-
- // Check that this elementType really is a partnerLinkType element
- if( !elementType.getLocalPart().equals(localName) ) return null;
- BPELPartnerLinkTypeExt theExtension = new BPELPartnerLinkTypeExt();
- theExtension.setElementType(elementType);
- theExtension.setName( theElement.getAttribute("name") );
-
- // Fetch the child "role" elements
- NodeList theRoles = theElement.getElementsByTagNameNS("*", roleName);
- for ( int i=0; i < theRoles.getLength(); i++ ) {
- if( i > 1 ) break;
- Element roleNode = (Element)theRoles.item(i);
- String roleName = roleNode.getAttribute("name");
- String portType = roleNode.getAttribute("portType");
- if (portType == null || portType.length() == 0) {
- // Fetch the child "portType" element
- NodeList portTypesNodes = roleNode.getElementsByTagNameNS("*", "portType");
- for (int p = 0; p < portTypesNodes.getLength(); p++) {
- Element portTypeNode = (Element)portTypesNodes.item(p);
- portType = portTypeNode.getAttribute("name");
- break;
- }
- }
- // The PortType attribute is a QName in prefix:localName format - convert to a QName
- QName rolePortType = getQNameValue( def, portType );
- theExtension.setRole( i, roleName, rolePortType );
- } // end for
- return theExtension;
- } // end unmarshall
-
-
- /**
- * Returns a QName from a string.
- * @param definition - a WSDL Definition
- * @param value - the String from which to form the QName in the form "pref:localName"
- * @return
- */
- protected QName getQNameValue(Definition definition, String value) {
- if (value != null && definition != null) {
- int index = value.indexOf(':');
- String prefix = index == -1 ? "" : value.substring(0, index);
- String localName = index == -1 ? value : value.substring(index + 1);
- String ns = definition.getNamespace(prefix);
- if (ns == null) {
- ns = "";
- }
- return new QName(ns, localName, prefix);
- } else {
- return null;
- }
- } // end getQNameValue
-
-} // end BPELExtensionHandler
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELPartnerLinkTypeExt.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELPartnerLinkTypeExt.java
deleted file mode 100644
index 67124832f3..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/BPELPartnerLinkTypeExt.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.xml.namespace.QName;
-
-/**
- * A class to serve as the extensibility element for BPEL partnerLinkType elements
- *
- * @version $Rev$ $Date$
- */
-public class BPELPartnerLinkTypeExt implements ExtensibilityElement {
-
- private QName elementType = null;
- private String linkTypeName = null;
- private String[] roleNames = new String[2];
- private QName[] rolePortTypes = new QName[2];
-
- // -- methods required by the Extensibility Element interface
- public QName getElementType() {
- return elementType;
- }
-
- public Boolean getRequired() {
- return true;
- }
-
- public void setElementType(QName theName ) {
- elementType = theName;
- }
-
- public void setRequired(Boolean required) {
- // intentionally left blank
- }
-
- // -- other methods
-
- public void setName( String theName ) {
- linkTypeName = theName;
- }
-
- public String getName() {
- return linkTypeName;
- }
-
- public void setRole( int i, String name, QName portType ) {
- if( i > 1 ) return;
- roleNames[i] = name;
- rolePortTypes[i] = portType;
- }
-
- public String getRoleName( int i ) {
- if( i > 1 ) return null;
- return roleNames[i];
- }
-
- public QName getRolePortType( int i ) {
- if( i > 1 ) return null;
- return rolePortTypes[i];
- }
-
-} // end BPELPartnerLinkTypeExt
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.java
deleted file mode 100644
index f9ddda6d98..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLConstants.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.interfacedef.wsdl.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Constants for WSDL.
- *
- * @version $Rev$ $Date$
- */
-public interface WSDLConstants {
-
- String INTERFACE_WSDL = "interface.wsdl";
- QName INTERFACE_WSDL_QNAME = new QName(Constants.SCA10_NS, "interface.wsdl");
- String INTERFACE = "interface";
- String CALLBACK_INTERFACE = "callbackInterface";
- String WSDL_LOCATION = "wsdlLocation";
- String WSDLI_NS = "http://www.w3.org/2004/08/wsdl-instance";
- QName WSDL_LOCATION_QNAME = new QName(WSDLI_NS, WSDL_LOCATION);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
deleted file mode 100644
index 828a6ece35..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessor.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-
-/**
- * An ArtifactProcessor for WSDL documents.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLDocumentProcessor implements URLArtifactProcessor<WSDLDefinition> {
-
- public static final QName WSDL11 = new QName("http://schemas.xmlsoap.org/wsdl/", "definitions");
- public static final QName WSDL11_IMPORT = new QName("http://schemas.xmlsoap.org/wsdl/", "import");
- public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
-
- private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- private WSDLFactory factory;
- private XSDFactory xsdFactory;
- private Monitor monitor;
-
- public WSDLDocumentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.factory = modelFactories.getFactory(WSDLFactory.class);
- this.xsdFactory = modelFactories.getFactory(XSDFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- try {
- WSDLDefinition definition = indexRead(artifactURL);
- definition.setURI(artifactURI);
- return definition;
- } catch (Exception e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", artifactURL, ce);
- //throw ce;
- return null;
- }
- }
-
- public void resolve(WSDLDefinition model, ModelResolver resolver) throws ContributionResolveException {
- if (model == null) return;
-
- Definition definition = model.getDefinition();
- if (definition != null) {
- for (Object imports : definition.getImports().values()) {
- List importList = (List)imports;
- for (Object i : importList) {
- Import imp = (Import)i;
- if (imp.getDefinition() != null) {
- continue;
- }
- if (imp.getLocationURI() == null) {
- // FIXME: [rfeng] By the WSDL 1.1 Specification, the location attribute is required
- // We need to resolve it by QName
- WSDLDefinition proxy = factory.createWSDLDefinition();
- proxy.setUnresolved(true);
- proxy.setNamespace(imp.getNamespaceURI());
- WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy);
- if (resolved != null && !resolved.isUnresolved()) {
- imp.setDefinition(resolved.getDefinition());
- if (!model.getImportedDefinitions().contains(resolved)) {
- model.getImportedDefinitions().add(resolved);
- }
- }
- } else {
- String location = imp.getLocationURI();
- URI uri = URI.create(location);
- if (uri.isAbsolute()) {
- WSDLDefinition resolved;
- try {
- resolved = read(null, uri, uri.toURL());
- imp.setDefinition(resolved.getDefinition());
- if (!model.getImportedDefinitions().contains(resolved)) {
- model.getImportedDefinitions().add(resolved);
- }
- } catch (Exception e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- } else {
- if (location.startsWith("/")) {
- // This is a relative URI against a contribution
- location = location.substring(1);
- // TODO: Need to resolve it against the contribution
- } else {
- // This is a relative URI against the WSDL document
- URI baseURI = URI.create(model.getDefinition().getDocumentBaseURI());
- URI locationURI = baseURI.resolve(location);
- WSDLDefinition resolved;
- try {
- resolved = read(null, locationURI, locationURI.toURL());
- imp.setDefinition(resolved.getDefinition());
- if (!model.getImportedDefinitions().contains(resolved)) {
- model.getImportedDefinitions().add(resolved);
- }
- } catch (Exception e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", resolver, ce);
- //throw ce;
- }
- }
- }
- }
- }
- }
- }
- }
-
- public String getArtifactType() {
- return ".wsdl";
- }
-
- public Class<WSDLDefinition> getModelType() {
- return WSDLDefinition.class;
- }
-
- /**
- * Read the namespace for the WSDL definition and inline schemas
- *
- * @param doc
- * @return
- * @throws IOException
- * @throws XMLStreamException
- */
- protected WSDLDefinition indexRead(URL doc) throws Exception {
- WSDLDefinition wsdlDefinition = factory.createWSDLDefinition();
- wsdlDefinition.setUnresolved(true);
- wsdlDefinition.setLocation(doc.toURI());
-
- InputStream is = doc.openStream();
- try {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- int eventType = reader.getEventType();
- int index = 0;
- while (true) {
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- if (WSDL11.equals(reader.getName())) {
- String tns = reader.getAttributeValue(null, "targetNamespace");
- wsdlDefinition.setNamespace(tns);
- // The definition is marked as resolved but not loaded
- wsdlDefinition.setUnresolved(false);
- wsdlDefinition.setDefinition(null);
- }
- if (XSD.equals(reader.getName())) {
- String tns = reader.getAttributeValue(null, "targetNamespace");
- XSDefinition xsd = xsdFactory.createXSDefinition();
- xsd.setUnresolved(true);
- xsd.setNamespace(tns);
- xsd.setLocation(URI.create(doc.toURI() + "#" + index));
- index++;
- // The definition is marked as resolved but not loaded
- xsd.setUnresolved(false);
- xsd.setSchema(null);
- wsdlDefinition.getXmlSchemas().add(xsd);
- }
- }
- if (reader.hasNext()) {
- eventType = reader.next();
- } else {
- break;
- }
- }
- return wsdlDefinition;
- } finally {
- is.close();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
deleted file mode 100644
index a7244ce13c..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLInterfaceProcessor.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-
-import java.util.List;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.ExtensionFactory;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXAttributeProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationImpl;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-import com.ibm.wsdl.OperationImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WSDLInterfaceProcessor implements StAXArtifactProcessor<WSDLInterfaceContract>, WSDLConstants {
-
- private WSDLFactory wsdlFactory;
- private ExtensionFactory extensionFactory;
- private StAXAttributeProcessor<Object> extensionAttributeProcessor;
- private Monitor monitor;
-
- public WSDLInterfaceProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor extensionProcessor,
- StAXAttributeProcessor extensionAttributeProcessor,
- Monitor monitor) {
- this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- this.extensionFactory = modelFactories.getFactory(ExtensionFactory.class);
- this.extensionAttributeProcessor = extensionAttributeProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a warning.
- *
- * @param problem
- * @param model
- * @param message data
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an error.
- *
- * @param problem
- * @param model
- * @param message data
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an exception.
- *
- * @param problem
- * @param model
- * @param exception
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "interface-wsdlxml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Create a WSDL interface from a URI.
- * @param uri
- * @return
- * @throws ContributionReadException
- */
- private WSDLInterface createWSDLInterface(String uri) throws ContributionReadException {
-
- WSDLInterface wsdlInterface = null;
-
- // Read a QName in the form:
- // namespace#wsdl.interface(name)
- int index = uri.indexOf('#');
- if (index == -1) {
- error("InvalidWSDLInterfaceAttr", wsdlFactory, uri);
- //throw new ContributionReadException("Invalid WSDL interface attribute: " + uri);
- } else {
- wsdlInterface = wsdlFactory.createWSDLInterface();
- wsdlInterface.setUnresolved(true);
- String namespace = uri.substring(0, index);
- String name = uri.substring(index + 1);
- name = name.substring("wsdl.interface(".length(), name.length() - 1);
- wsdlInterface.setName(new QName(namespace, name));
- }
-
- return wsdlInterface;
- }
-
- public WSDLInterfaceContract read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- // Read an <interface.wsdl>
- WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
-
- // Read wsdlLocation
- String location = reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION);
- wsdlInterfaceContract.setLocation(location);
-
- String uri = reader.getAttributeValue(null, INTERFACE);
- if (uri != null) {
- WSDLInterface wsdlInterface = createWSDLInterface(uri);
- if (wsdlInterface != null)
- wsdlInterfaceContract.setInterface(wsdlInterface);
- }
-
- uri = reader.getAttributeValue(null, CALLBACK_INTERFACE);
- if (uri != null) {
- WSDLInterface wsdlCallbackInterface = createWSDLInterface(uri);
- if (wsdlCallbackInterface != null)
- wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
- }
-
- // Handle extended attributes
- for (int a = 0; a < reader.getAttributeCount(); a++) {
- QName attributeName = reader.getAttributeName(a);
- if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI().length() > 0) {
- if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
- (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
- Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
- Extension attributeExtension;
- if (attributeValue instanceof Extension) {
- attributeExtension = (Extension) attributeValue;
- } else {
- attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
- }
- wsdlInterfaceContract.getAttributeExtensions().add(attributeExtension);
- }
- }
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && INTERFACE_WSDL_QNAME.equals(reader.getName())) {
- break;
- }
- }
- return wsdlInterfaceContract;
- }
-
- public void write(WSDLInterfaceContract wsdlInterfaceContract, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- // Write an <interface.wsdl>
- writer.writeStartElement(Constants.SCA10_NS, INTERFACE_WSDL);
-
- // Write interface name
- WSDLInterface wsdlInterface = (WSDLInterface)wsdlInterfaceContract.getInterface();
- if (wsdlInterface != null) {
- QName qname = wsdlInterface.getName();
- String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
- writer.writeAttribute(INTERFACE, uri);
- }
-
- WSDLInterface wsdlCallbackInterface = (WSDLInterface)wsdlInterfaceContract.getCallbackInterface();
- if (wsdlCallbackInterface != null) {
- QName qname = wsdlCallbackInterface.getName();
- String uri = qname.getNamespaceURI() + "#wsdl.interface(" + qname.getLocalPart() + ")";
- writer.writeAttribute(CALLBACK_INTERFACE, uri);
- }
-
- // Write location
- if (wsdlInterfaceContract.getLocation() != null) {
- writer.writeAttribute(WSDLI_NS, WSDL_LOCATION, wsdlInterfaceContract.getLocation());
- }
-
- // Write extended attributes
- for(Extension extension : wsdlInterfaceContract.getAttributeExtensions()) {
- if(extension.isAttribute()) {
- extensionAttributeProcessor.write(extension, writer);
- }
- }
-
- writer.writeEndElement();
- }
-
- private WSDLInterface resolveWSDLInterface(WSDLInterface wsdlInterface, ModelResolver resolver) throws ContributionResolveException {
-
- if (wsdlInterface != null && wsdlInterface.isUnresolved()) {
-
- // Resolve the WSDL interface
- wsdlInterface = resolver.resolveModel(WSDLInterface.class, wsdlInterface);
- if (wsdlInterface.isUnresolved()) {
-
- // If the WSDL interface has never been resolved yet, do it now
- // First, resolve the WSDL definition for the given namespace
- WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
- wsdlDefinition.setUnresolved(true);
- wsdlDefinition.setNamespace(wsdlInterface.getName().getNamespaceURI());
- WSDLDefinition resolved = null;
- try {
- resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition);
- } catch (ContributionRuntimeException e) {
- ContributionResolveException ce = new ContributionResolveException(e.getCause());
- error("ContributionResolveException", wsdlDefinition, ce);
- }
- if (resolved != null && !resolved.isUnresolved()) {
- wsdlDefinition.setDefinition(resolved.getDefinition());
- wsdlDefinition.setLocation(resolved.getLocation());
- wsdlDefinition.setURI(resolved.getURI());
- wsdlDefinition.getImportedDefinitions().addAll(resolved.getImportedDefinitions());
- wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
- wsdlDefinition.setUnresolved(false);
- WSDLObject<PortType> portType = wsdlDefinition.getWSDLObject(PortType.class, wsdlInterface.getName());
- if (portType != null) {
- // Introspect the WSDL portType and validate
- // the input/output messages.
- List<OperationImpl> operations = portType.getElement().getOperations();
- for (OperationImpl operation : operations) {
- if (operation.getInput() != null && operation.getInput().getMessage() == null) {
- ContributionResolveException ce = new ContributionResolveException("WSDL binding operation input name " + operation.getInput().getName() + " does not match with PortType Definition");
- error("ContributionResolveException", wsdlDefinition, ce);
- }
- if (operation.getOutput() != null && operation.getOutput().getMessage() == null) {
- ContributionResolveException ce = new ContributionResolveException("WSDL binding operation output name " + operation.getOutput().getName() + " does not match with PortType Definition");
- error("ContributionResolveException", wsdlDefinition, ce);
- }
- }
-
- // Introspect the WSDL portType and add the resulting
- // WSDLInterface to the resolver
- try {
- wsdlDefinition.setDefinition(portType.getDefinition());
- wsdlInterface = wsdlFactory.createWSDLInterface(portType.getElement(), wsdlDefinition, resolver);
- wsdlInterface.setWsdlDefinition(wsdlDefinition);
- resolver.addModel(wsdlInterface);
- } catch (ContributionRuntimeException e) {
- ContributionResolveException ce = new ContributionResolveException(e.getCause());
- error("ContributionResolveException", wsdlDefinition, ce);
- } catch (InvalidInterfaceException e) {
- ContributionResolveException ce = new ContributionResolveException(e);
- error("ContributionResolveException", wsdlDefinition, ce);
- //throw ce;
- }
- }
- else {
- warning("WsdlInterfaceDoesNotMatch", wsdlDefinition, wsdlInterface.getName());
- }
- }
- }
- }
- return wsdlInterface;
- }
-
- public void resolve(WSDLInterfaceContract wsdlInterfaceContract, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the interface and callback interface
- WSDLInterface wsdlInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getInterface(), resolver);
- wsdlInterfaceContract.setInterface(wsdlInterface);
-
- WSDLInterface wsdlCallbackInterface = resolveWSDLInterface((WSDLInterface)wsdlInterfaceContract.getCallbackInterface(), resolver);
- wsdlInterfaceContract.setCallbackInterface(wsdlCallbackInterface);
- }
-
- public QName getArtifactType() {
- return WSDLConstants.INTERFACE_WSDL_QNAME;
- }
-
- public Class<WSDLInterfaceContract> getModelType() {
- return WSDLInterfaceContract.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
deleted file mode 100644
index d2ed43e7f0..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLModelResolver.java
+++ /dev/null
@@ -1,600 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Operation;
-import javax.wsdl.PortType;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.AttributeExtensible;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionDeserializer;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.extensions.ExtensionSerializer;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensionDeserializer;
-import javax.wsdl.extensions.UnknownExtensionSerializer;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.xml.WSDLLocator;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-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;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLDefinitionImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.xml.sax.InputSource;
-
-/**
- * A Model Resolver for WSDL models.
- *
- * @version $Rev: 557916 $ $Date: 2007-07-20 01:04:40 -0700 (Fri, 20 Jul 2007) $
- */
-public class WSDLModelResolver implements ModelResolver {
- //Schema element names
- public static final String ELEM_SCHEMA = "schema";
- public static final QName WSDL11_IMPORT = new QName("http://schemas.xmlsoap.org/wsdl/", "import");
-
- //Schema URI
- public static final String NS_URI_XSD_1999 = "http://www.w3.org/1999/XMLSchema";
- public static final String NS_URI_XSD_2000 = "http://www.w3.org/2000/10/XMLSchema";
- public static final String NS_URI_XSD_2001 = "http://www.w3.org/2001/XMLSchema";
-
- //Schema QNames
- public static final QName Q_ELEM_XSD_1999 = new QName(NS_URI_XSD_1999, ELEM_SCHEMA);
- public static final QName Q_ELEM_XSD_2000 = new QName(NS_URI_XSD_2000, ELEM_SCHEMA);
- public static final QName Q_ELEM_XSD_2001 = new QName(NS_URI_XSD_2001, ELEM_SCHEMA);
- public static final List<QName> XSD_QNAME_LIST =
- Arrays.asList(new QName[] {Q_ELEM_XSD_1999, Q_ELEM_XSD_2000, Q_ELEM_XSD_2001});
-
- // ---- Policy WSDL Attachments
-
- public static final QName Q_POLICY_ATTRIBUTE_EXTENSION = new QName("http://www.osoa.org/xmlns/sca/1.0", "requires");
- public static final QName Q_POLICY_END_CONVERSATION_ATTRIBUTE_EXTENSION = new QName("http://www.osoa.org/xmlns/sca/1.0", "endsConversation");
-
- // ---- Stuff added for BPEL extension elements --- Mike Edwards 01/05/2008
- public static final String ELEM_PLINKTYPE = "partnerLinkType";
- public static final String NS_BPEL_1_1 = "http://schemas.xmlsoap.org/ws/2004/03/partner-link/";
- public static final QName BPEL_PLINKTYPE = new QName( NS_BPEL_1_1, ELEM_PLINKTYPE );
- // ---- end of BPEL extension stuff
-
- private Contribution contribution;
- private Map<String, List<WSDLDefinition>> map = new HashMap<String, List<WSDLDefinition>>();
-
- private ExtensionRegistry wsdlExtensionRegistry;
-
- private WSDLFactory wsdlFactory;
- private javax.wsdl.factory.WSDLFactory wsdl4jFactory;
- private ContributionFactory contributionFactory;
- private XSDFactory xsdFactory;
-
- public WSDLModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
-
- this.wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- this.wsdl4jFactory = modelFactories.getFactory(javax.wsdl.factory.WSDLFactory.class);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.xsdFactory = modelFactories.getFactory(XSDFactory.class);
-
- wsdlExtensionRegistry = this.wsdl4jFactory.newPopulatedExtensionRegistry();
- // REVIEW: [rfeng] Disable the schema extension for WSDL4J to avoid aggressive loading
- ExtensionDeserializer deserializer = new UnknownExtensionDeserializer();
- ExtensionSerializer serializer = new UnknownExtensionSerializer();
- for (QName schema : XSD_QNAME_LIST) {
- wsdlExtensionRegistry.registerSerializer(Types.class, schema, serializer);
- wsdlExtensionRegistry.registerDeserializer(Types.class, schema, deserializer);
- }
- // ---- Policy WSDL Extensions
- try {
- wsdlExtensionRegistry.registerExtensionAttributeType(PortType.class, Q_POLICY_ATTRIBUTE_EXTENSION, AttributeExtensible.LIST_OF_QNAMES_TYPE);
- wsdlExtensionRegistry.registerExtensionAttributeType(Operation.class, Q_POLICY_END_CONVERSATION_ATTRIBUTE_EXTENSION, AttributeExtensible.STRING_TYPE);
- } catch (NoSuchMethodError e) {
- // That method does not exist on older WSDL4J levels
- }
-
- // ---- BPEL additions
- serializer = new BPELExtensionHandler();
- deserializer = new BPELExtensionHandler();
- wsdlExtensionRegistry.registerSerializer(Definition.class, BPEL_PLINKTYPE, serializer);
- wsdlExtensionRegistry.registerDeserializer(Definition.class, BPEL_PLINKTYPE, deserializer);
- // ---- end of BPEL additions
- }
-
- /**
- * Implementation of a WSDL locator.
- */
- private class WSDLLocatorImpl implements WSDLLocator {
- private InputStream inputStream;
- private URL base;
- private String latestImportURI;
- private Map<String, String> wsdlImports;
-
- public WSDLLocatorImpl(URL base, InputStream is, Map<String, String> imports) {
- this.base = base;
- this.inputStream = is;
- this.wsdlImports = imports;
- }
-
- public void close() {
- try {
- inputStream.close();
- } catch (IOException e) {
- // Ignore
- }
- }
-
- public InputSource getBaseInputSource() {
- try {
- return XMLDocumentHelper.getInputSource(base, inputStream);
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public String getBaseURI() {
- return base.toString();
- }
-
- public InputSource getImportInputSource(String parentLocation, String importLocation) {
- try {
-
- if (importLocation == null)
- throw new IllegalArgumentException("Required attribute 'location' is missing.");
-
- if (importLocation.trim().equals(""))
- throw new IllegalArgumentException("Required attribute 'location' is empty.");
-
- URL url = null;
- if (importLocation.startsWith("/")) {
- // The URI is relative to the contribution
- String uri = importLocation.substring(1);
-
- Artifact proxyArtifact = contributionFactory.createArtifact();
- proxyArtifact.setURI(uri);
-
- //use contribution resolution (this supports import/export)
- Artifact importedArtifact =
- contribution.getModelResolver().resolveModel(Artifact.class, proxyArtifact);
- if (importedArtifact.getLocation() != null) {
- //get the artifact URL
- url = new URL(importedArtifact.getLocation());
- }
- } else {
- url = new URL(new URL(parentLocation), importLocation);
- }
- if (url == null) {
- return null;
- }
- latestImportURI = url.toString();
- return XMLDocumentHelper.getInputSource(url);
- } catch (IOException e) {
- // If we are not able to resolve the imports using location, then
- // try resolving them using the namespace.
- try {
- if (! wsdlImports.isEmpty()) {
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof WSDLDefinitionImpl) {
- String namespace = ((WSDLDefinitionImpl)artifact.getModel()).getNamespace();
- for (Map.Entry<String, String> entry : ((Map<String, String>)wsdlImports).entrySet()) {
- if (entry.getKey().equals(namespace)) {
- URL url = ((WSDLDefinitionImpl)artifact.getModel()).getLocation().toURL();
- return XMLDocumentHelper.getInputSource(url);
- }
- }
- }
- }
- }
- } catch (IOException ex) {
- throw new ContributionRuntimeException(ex);
- }
- throw new ContributionRuntimeException(e);
- }
- }
-
- public String getLatestImportURI() {
- return latestImportURI;
- }
-
- }
-
- public void addModel(Object resolved) {
- WSDLDefinition definition = (WSDLDefinition)resolved;
- for (XSDefinition d : definition.getXmlSchemas()) {
- if (contribution != null) {
- contribution.getModelResolver().addModel(d);
- }
- }
- List<WSDLDefinition> list = map.get(definition.getNamespace());
- if (list == null) {
- list = new ArrayList<WSDLDefinition>();
- map.put(definition.getNamespace(), list);
- }
- list.add(definition);
- }
-
- public Object removeModel(Object resolved) {
- WSDLDefinition definition = (WSDLDefinition)resolved;
- List<WSDLDefinition> list = map.get(definition.getNamespace());
- if (list == null) {
- return null;
- } else {
- return list.remove(definition);
- }
- }
-
- /**
- * Create a facade Definition which imports all the definitions
- *
- * @param definitions A list of the WSDL definitions under the same target namespace
- * @return The aggregated WSDL definition
- */
- private WSDLDefinition aggregate(List<WSDLDefinition> definitions) throws ContributionReadException {
- if (definitions == null || definitions.size() == 0) {
- return null;
- }
- if (definitions.size() == 1) {
- WSDLDefinition d = definitions.get(0);
- loadDefinition(d);
- return d;
- }
- WSDLDefinition aggregated = wsdlFactory.createWSDLDefinition();
- for (WSDLDefinition d : definitions) {
- loadDefinition(d);
- }
- Definition facade = wsdl4jFactory.newDefinition();
- String ns = definitions.get(0).getNamespace();
- facade.setQName(new QName(ns, "$aggregated$"));
- facade.setTargetNamespace(ns);
-
- for (WSDLDefinition d : definitions) {
- if (d.getDefinition() != null) {
- javax.wsdl.Import imp = facade.createImport();
- imp.setNamespaceURI(d.getNamespace());
- imp.setDefinition(d.getDefinition());
- imp.setLocationURI(d.getDefinition().getDocumentBaseURI());
- facade.addImport(imp);
- aggregated.getXmlSchemas().addAll(d.getXmlSchemas());
- aggregated.getImportedDefinitions().add(d);
- }
- }
- aggregated.setDefinition(facade);
- definitions.clear();
- definitions.add(aggregated);
- return aggregated;
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- // Lookup a definition for the given namespace
- String namespace = ((WSDLDefinition)unresolved).getNamespace();
- if (namespace == null) {
- return modelClass.cast(unresolved);
- }
- List<WSDLDefinition> list = map.get(namespace);
- WSDLDefinition resolved = null;
- try {
- resolved = aggregate(list);
- } catch (ContributionReadException e) {
- throw new RuntimeException(e);
- }
- if (resolved != null && !resolved.isUnresolved()) {
- 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(namespace)) {
-
- // Delegate the resolution to the namespace import resolver
- resolved =
- namespaceImport.getModelResolver().resolveModel(WSDLDefinition.class,
- (WSDLDefinition)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- } else if (import_ instanceof DefaultImport) {
-
- // Delegate the resolution to the default import resolver
- resolved =
- import_.getModelResolver().resolveModel(WSDLDefinition.class,
- (WSDLDefinition)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- return modelClass.cast(unresolved);
- }
-
- // Use non-sca mechanism to resolve the import location, if not
- // found then use the sca mechanism
- private <T> T resolveImports (Class<T> modelClass, WSDLDefinition unresolved) throws ContributionReadException {
-
- WSDLDefinition resolved = null;
- if (unresolved.getDefinition() == null && unresolved.getLocation() != null) {
- try {
- // Load the definition using non-sca mechanism.
- List<WSDLDefinition> list = new ArrayList<WSDLDefinition>();
- list.add(unresolved);
- map.put(unresolved.getNamespace(), list);
- resolved = aggregate(list);
- // if no exception then its resolved.
- if (unresolved.getNamespace().equals(resolved.getDefinition().getTargetNamespace())) {
- resolved.setNamespace(resolved.getDefinition().getTargetNamespace());
- resolved.setUnresolved(false);
- resolved.setURI(resolved.getLocation());
- return modelClass.cast(resolved);
- }
- } catch (ContributionReadException e) {
- // Resolve the wsdl definition using the namespace, by searching the
- // contribution artifacts for wsdl definition for the given namespace.
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof WSDLDefinitionImpl) {
- String namespace = ((WSDLDefinitionImpl)artifact.getModel()).getNamespace();
- if (unresolved.getNamespace().equals(namespace)) {
- WSDLDefinition wsdlDefinition = (WSDLDefinition)artifact.getModel();
- if (wsdlDefinition.getDefinition() == null) {
- loadDefinition(wsdlDefinition);
- }
- return modelClass.cast(wsdlDefinition);
- }
- }
- }
- }
- }
-
- return modelClass.cast(unresolved);
- }
-
- /**
- * Load the WSDL definition and inline schemas
- *
- * @param wsdlDef
- * @throws ContributionReadException
- */
- private void loadDefinition(WSDLDefinition wsdlDef) throws ContributionReadException {
- if (wsdlDef.getDefinition() != null || wsdlDef.getLocation() == null) {
- return;
- }
- try {
- URL artifactURL = wsdlDef.getLocation().toURL();
- // Read a WSDL document
- InputStream is = artifactURL.openStream();
- WSDLReader reader = wsdl4jFactory.newWSDLReader();
- reader.setFeature("javax.wsdl.verbose", false);
- reader.setFeature("javax.wsdl.importDocuments", true);
- // FIXME: We need to decide if we should disable the import processing by WSDL4J
- // reader.setFeature("javax.wsdl.importDocuments", false);
- reader.setExtensionRegistry(wsdlExtensionRegistry); // use a custom registry
-
- // Collection of namespace,location for wsdl:import definition
- Map<String, String> wsdlImports = indexRead(wsdlDef.getLocation().toURL());
-
- WSDLLocatorImpl locator = new WSDLLocatorImpl(artifactURL, is, wsdlImports);
- Definition definition = reader.readWSDL(locator);
- wsdlDef.setDefinition(definition);
-
- // If this definition imports any definitions from other namespaces,
- // set the correct WSDLDefinition import relationships.
- for (Map.Entry<String, List<javax.wsdl.Import>> entry :
- ((Map<String, List<javax.wsdl.Import>>)definition.getImports()).entrySet()) {
- if (!entry.getKey().equals(definition.getTargetNamespace())) {
- WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
- wsdlDefinition.setUnresolved(true);
- wsdlDefinition.setNamespace(entry.getKey());
- WSDLDefinition resolved = null;
- for (javax.wsdl.Import imp : entry.getValue()) {
- if (imp.getDefinition() == null) {
- throw new IllegalArgumentException("Required attribute 'location' is missing.");
- }
- try {
- wsdlDefinition.setLocation(new URI(imp.getDefinition().getDocumentBaseURI()));
- resolved = resolveImports(WSDLDefinition.class, wsdlDefinition);
- if (!resolved.isUnresolved()) {
- if (resolved.getImportedDefinitions().isEmpty()) {
- if (resolved.getDefinition().getTargetNamespace().equals(imp.getDefinition().getTargetNamespace())) {
- // this WSDLDefinition contains the imported document
- wsdlDef.getImportedDefinitions().add(resolved);
- imp.setLocationURI(resolved.getURI().toString());
- }
- } else {
- // this is a facade, so look in its imported definitions
- for (WSDLDefinition def : resolved.getImportedDefinitions()) {
- if (def.getDefinition().getTargetNamespace().equals(imp.getDefinition().getTargetNamespace())) {
- wsdlDef.getImportedDefinitions().add(def);
- imp.setLocationURI(def.getURI().toString());
- break;
- }
- }
- }
- }
- } catch (Exception e) {
- throw new ContributionReadException(e);
- }
- }
- }
- }
-
- //Read inline schemas
- readInlineSchemas(wsdlDef, definition);
- } catch (WSDLException e) {
- throw new ContributionReadException(e);
- } catch (XMLStreamException e) {
- throw new ContributionReadException(e);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
- }
-
- private Document promote(Element element) {
- Document doc = (Document)element.getOwnerDocument().cloneNode(false);
- Element schema = (Element)doc.importNode(element, true);
- doc.appendChild(schema);
- Node parent = element.getParentNode();
- while (parent instanceof Element) {
- Element root = (Element)parent;
- NamedNodeMap nodeMap = root.getAttributes();
- if (nodeMap != null) {
- for (int i = 0; i < nodeMap.getLength(); i++) {
- Attr attr = (Attr)nodeMap.item(i);
- String name = attr.getName();
- if ("xmlns".equals(name) || name.startsWith("xmlns:")) {
- if (schema.getAttributeNode(name) == null) {
- schema.setAttributeNodeNS((Attr)doc.importNode(attr, true));
- }
- }
- }
- }
- parent = parent.getParentNode();
- }
- doc.setDocumentURI(element.getOwnerDocument().getDocumentURI());
- return doc;
- }
-
- /**
- * Populate the inline schemas including those from the imported definitions
- *
- * @param definition
- * @param schemaCollection
- */
- private void readInlineSchemas(WSDLDefinition wsdlDefinition, Definition definition) {
- if (contribution == null) {
- // Check null for test cases
- return;
- }
- Types types = definition.getTypes();
- if (types != null) {
- int index = 0;
- for (Object ext : types.getExtensibilityElements()) {
- ExtensibilityElement extElement = (ExtensibilityElement)ext;
- Element element = null;
- if (XSD_QNAME_LIST.contains(extElement.getElementType())) {
- if (extElement instanceof Schema) {
- element = ((Schema)extElement).getElement();
- } else if (extElement instanceof UnknownExtensibilityElement) {
- element = ((UnknownExtensibilityElement)extElement).getElement();
- }
- }
- if (element != null) {
- Document doc = promote(element);
- XSDefinition xsDefinition = xsdFactory.createXSDefinition();
- xsDefinition.setUnresolved(true);
- xsDefinition.setNamespace(element.getAttribute("targetNamespace"));
- xsDefinition.setDocument(doc);
- xsDefinition.setLocation(URI.create(doc.getDocumentURI() + "#" + index));
- XSDefinition resolved =
- contribution.getModelResolver().resolveModel(XSDefinition.class, xsDefinition);
- if (resolved != null && !resolved.isUnresolved()) {
- if (!wsdlDefinition.getXmlSchemas().contains(resolved)) {
- // Don't add resolved because it may be an aggregate that
- // contains more than we need. The resolver will have
- // set the specific schema we need into unresolved.
- wsdlDefinition.getXmlSchemas().add(xsDefinition);
- }
- }
- index++;
- }
- }
- }
- for (Object imports : definition.getImports().values()) {
- List impList = (List)imports;
- for (Object i : impList) {
- javax.wsdl.Import anImport = (javax.wsdl.Import)i;
- // Read inline schemas
- if (anImport.getDefinition() != null) {
- readInlineSchemas(wsdlDefinition, anImport.getDefinition());
- }
- }
- }
- }
-
-
- /**
- * Read the namespace and location for the WSDL imports
- *
- * @param doc
- * @return
- * @throws IOException
- * @throws XMLStreamException
- */
- protected Map<String, String> indexRead(URL doc) throws IOException, XMLStreamException {
-
- Map<String, String> wsdlImports = new HashMap<String, String>();
- InputStream is = doc.openStream();
- try {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- int eventType = reader.getEventType();
- int index = 0;
- while (true) {
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- if (WSDL11_IMPORT.equals(reader.getName())) {
- String ns = reader.getAttributeValue(null, "namespace");
- String loc = reader.getAttributeValue(null, "location");
- wsdlImports.put(ns, loc);
- }
- }
- if (reader.hasNext()) {
- eventType = reader.next();
- } else {
- break;
- }
- }
- return wsdlImports;
- } finally {
- is.close();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 9666a6dbd8..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLInterfaceProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#interface.wsdl,model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 553c764233..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLDocumentProcessor;type=.wsdl,model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index 30d2039e80..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.interfacedef.wsdl.xml.WSDLModelResolver;model=org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/interface-wsdlxml-validation-messages.properties b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/interface-wsdlxml-validation-messages.properties
deleted file mode 100644
index 7355d3390d..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/main/resources/interface-wsdlxml-validation-messages.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionReadException = ContributionReadException occured due to :
-ContributionResolveException = Error in contribution: {0}
-InvalidWSDLInterfaceAttr = Invalid WSDL interface attribute: {0}
-WsdlInterfaceDoesNotMatch = The #wsdl.interface({0}) specified does not match with WSDL Definitions
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.java
deleted file mode 100644
index b68d0cc175..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/AbstractWSDLTestCase.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.interfacedef.wsdl;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-
-/**
- * Test case for WSDLOperation.
- *
- * @version $Rev$ $Date$
- */
-public abstract class AbstractWSDLTestCase extends TestCase {
- protected URLArtifactProcessor<Object> documentProcessor;
- protected ModelResolver resolver;
- protected WSDLFactory wsdlFactory;
- protected XSDFactory xsdFactory;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
- xsdFactory = modelFactories.getFactory(XSDFactory.class);
-
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- Contribution contribution = contributionFactory.createContribution();
- ModelResolverExtensionPoint modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- resolver = new ExtensibleModelResolver(contribution, extensionPoints);
- contribution.setModelResolver(resolver);
-
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.java
deleted file mode 100644
index dc7e1ced38..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLInterfaceIntrospectorTestCase.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.interfacedef.wsdl.introspect;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-
-/**
- * Test case for InterfaceWSDLIntrospectorImpl.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLInterfaceIntrospectorTestCase extends AbstractWSDLTestCase {
- private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
-
- private PortType portType;
- private WSDLDefinition definition;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- URL url = getClass().getResource("../xml/stockquote.wsdl");
- definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
- }
-
- @SuppressWarnings("unchecked")
- public final void testIntrospectPortType() throws InvalidInterfaceException {
- WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver);
- Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType");
- List<Operation> operations = contract.getOperations();
- Assert.assertEquals(1, operations.size());
- Operation operation = operations.get(0);
- Assert.assertEquals("getLastTradePrice", operation.getName());
- DataType<List<DataType>> inputType = operation.getInputType();
- Assert.assertEquals(1, inputType.getLogical().size());
- DataType<XMLType> returnType = operation.getOutputType();
- Assert.assertNotNull(returnType);
- Assert.assertEquals(0, operation.getFaultTypes().size());
- // Assert.assertEquals(1,
- // operation.getWrapper().getInputChildElements().size());
- // Assert.assertEquals(1,
- // operation.getWrapper().getOutputChildElements().size());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
deleted file mode 100644
index 5b019b748f..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLOperationIntrospectorTestCase.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.introspect;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Operation;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
-
-/**
- * Test case for WSDLOperation.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLOperationIntrospectorTestCase extends AbstractWSDLTestCase {
- private static final QName PORTTYPE_NAME =
- new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
-
-
- @SuppressWarnings("unchecked")
- public final void testWrappedOperation() throws Exception {
- URL url = getClass().getResource("../xml/stockquote.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
- Operation operation = portType.getOperation("getLastTradePrice", null, null);
-
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
-
- DataType<List<DataType>> inputType = op.getInputType();
- Assert.assertEquals(1, inputType.getLogical().size());
- DataType<XMLType> type = inputType.getLogical().get(0);
- Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), type.getLogical().getElementName());
-
- DataType<XMLType> outputType = op.getOutputType();
- Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePriceResponse"),
- outputType.getLogical().getElementName());
- Assert.assertTrue(op.isWrapperStyle());
-
- DataType<List<DataType>> unwrappedInputType = op.getWrapper().getInputWrapperInfo().getUnwrappedInputType();
- List<DataType> childTypes = unwrappedInputType.getLogical();
- Assert.assertEquals(1, childTypes.size());
- DataType<XMLType> childType = childTypes.get(0);
- Assert.assertEquals(new QName(null, "tickerSymbol"), childType.getLogical().getElementName());
-
- childType = op.getWrapper().getOutputWrapperInfo().getUnwrappedOutputType();
- Assert.assertEquals(new QName(null, "price"), childType.getLogical().getElementName());
- }
-
- public final void testUnwrappedOperation() throws Exception {
- URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
-
- Operation operation = portType.getOperation("getLastTradePrice1", null, null);
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
- Assert.assertFalse(op.isWrapperStyle());
- Assert.assertEquals(1, op.getInputType().getLogical().size());
-
- operation = portType.getOperation("getLastTradePrice2", null, null);
- op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
- Assert.assertFalse(op.isWrapperStyle());
- Assert.assertEquals(2, op.getInputType().getLogical().size());
- }
-
- public final void testInvalidWSDL() throws Exception {
- URL url = getClass().getResource("../xml/invalid-stockquote.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("invalid-stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
-
- Operation operation = portType.getOperation("getLastTradePrice", null, null);
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
-
- try {
- op.isWrapperStyle();
- fail("InvalidWSDLException should have been thrown");
- } catch (InvalidInterfaceException e) {
- // Expected
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
deleted file mode 100644
index cf379a1b11..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WSDLPolicyAnnotatedInterfaceIntrospectorTestCase.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.introspect;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.policy.Intent;
-
-/**
- * Test case for InterfaceWSDLIntrospectorImpl.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLPolicyAnnotatedInterfaceIntrospectorTestCase extends AbstractWSDLTestCase {
- private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
- private static final QName INTENT = new QName("http://example.com/stockquote.wsdl", "PolicyIntent");
-
- private PortType portType;
- private WSDLDefinition definition;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- URL url = getClass().getResource("/policy/stockquote_policy.wsdl");
- definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
- }
-
- @SuppressWarnings("unchecked")
- public final void testIntrospectPortType() throws InvalidInterfaceException {
- WSDLInterface contract = wsdlFactory.createWSDLInterface(portType, definition, resolver);
- Assert.assertEquals(contract.getName().getLocalPart(), "StockQuotePortType");
- Assert.assertTrue(contract.isConversational());
-
- boolean foundIntent = false;
-
- for(Intent intent : contract.getRequiredIntents()) {
- if(INTENT.equals(intent.getName())) {
- foundIntent = true;
- }
- }
-
- Assert.assertTrue(foundIntent);
-
- for(Operation operation : contract.getOperations()) {
- if(operation.getName().equals("cancel")) {
- Assert.assertEquals(operation.getConversationSequence(), ConversationSequence.CONVERSATION_END);
- }
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
deleted file mode 100644
index ff18c65c69..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/introspect/WrapperStyleOperationTestCase.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.introspect;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.wsdl.Operation;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
-
-/**
- * Test case for WSDLOperation.
- *
- * @version $Rev$ $Date$
- */
-public class WrapperStyleOperationTestCase extends AbstractWSDLTestCase {
- private static final QName PORTTYPE_NAME = new QName("http://example.com/stockquote.wsdl", "StockQuotePortType");
-
- public final void testWrappedOperation() throws Exception {
- URL url = getClass().getResource("../xml/stockquote.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
- Operation operation = portType.getOperation("getLastTradePrice", null, null);
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
- Assert.assertTrue(op.isWrapperStyle());
- Assert.assertEquals(1, op.getWrapper().getInputChildElements().size());
- Assert.assertEquals(1, op.getWrapper().getOutputChildElements().size());
- }
-
- public final void testUnwrappedOperation() throws Exception {
- URL url = getClass().getResource("../xml/unwrapped-stockquote.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url);
- resolver.addModel(definition);
- definition = resolver.resolveModel(WSDLDefinition.class, definition);
- PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
- Operation operation = portType.getOperation("getLastTradePrice1", null, null);
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
- Assert.assertFalse(op.isWrapperStyle());
- operation = portType.getOperation("getLastTradePrice2", null, null);
- op = new WSDLOperationIntrospectorImpl(xsdFactory, operation, definition, "org.w3c.dom.Node", resolver);
- Assert.assertFalse(op.isWrapperStyle());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
deleted file mode 100644
index f23b0d2b59..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/ReadTestCase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Test reading WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class ReadTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private CompositeBuilder compositeBuilder;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- SCABindingFactory scaBindingFactory = modelFactories.getFactory(SCABindingFactory.class);
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
- IntentAttachPointTypeFactory attachPointTypeFactory = modelFactories.getFactory(IntentAttachPointTypeFactory.class);
- compositeBuilder = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, attachPointTypeFactory, mapper, null);
- }
-
- public void testReadComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ComponentType componentType = (ComponentType)staxProcessor.read(reader);
- assertNotNull(componentType);
- }
-
- public void testReadConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(reader);
- assertNotNull(constrainingType);
- }
-
- public void testReadComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- Composite composite = (Composite)staxProcessor.read(reader);
- assertNotNull(composite);
-
- compositeBuilder.build(composite);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.java
deleted file mode 100644
index 2d3a3a54ff..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLDocumentProcessorTestCase.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.interfacedef.wsdl.xml;
-
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.wsdl.Import;
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.wsdl.AbstractWSDLTestCase;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WSDLDocumentProcessorTestCase extends AbstractWSDLTestCase {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- @Override
- public void setUp() throws Exception {
- super.setUp();
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- @Override
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testWSDL() throws Exception {
-
- URL url = getClass().getResource("/wsdl/helloworld-service.wsdl");
- WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, URI.create("wsdl/helloworld-service.wsdl"), url);
-
- Assert.assertNull(definition.getDefinition());
- Assert.assertEquals("http://helloworld", definition.getNamespace());
- URL url1 = getClass().getResource("/wsdl/helloworld-interface.wsdl");
- WSDLDefinition definition1 = (WSDLDefinition)documentProcessor.read(null, URI.create("wsdl/helloworld-interface.wsdl"), url1);
- Assert.assertNull(definition1.getDefinition());
- Assert.assertEquals("http://helloworld", definition1.getNamespace());
-
- resolver.addModel(definition);
- resolver.addModel(definition1);
- resolver.resolveModel(WSDLDefinition.class, definition);
- resolver.resolveModel(WSDLDefinition.class, definition1);
- WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, definition);
- List imports = (List)definition.getDefinition().getImports().get("http://helloworld");
- Assert.assertNotNull(imports);
- Assert.assertNotNull(((Import)imports.get(0)).getDefinition());
- Assert.assertNotNull(resolved.getDefinition().getPortType(new QName("http://helloworld", "HelloWorld")));
- Assert.assertNotNull(resolved.getDefinition().getService(new QName("http://helloworld", "HelloWorldService")));
-
- assertNotNull(resolved.getXmlSchemaType(new QName("http://greeting", "Name")));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.java
deleted file mode 100644
index c27a1dbd70..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WSDLTestCase.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.interfacedef.wsdl.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-
-/**
- * Test reading WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLTestCase extends TestCase {
-
- private ExtensibleURLArtifactProcessor documentProcessor;
- private WSDLModelResolver wsdlResolver;
-
- @Override
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
-
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- wsdlResolver = new WSDLModelResolver(null, modelFactories);
- }
-
- public void testReadWSDLDocument() throws Exception {
- URL url = getClass().getResource("example.wsdl");
- WSDLDefinition definition = documentProcessor.read(null, new URI("example.wsdl"), url, WSDLDefinition.class);
- assertNotNull(definition);
- assertNull(definition.getDefinition());
- assertEquals(definition.getNamespace(), "http://www.example.org");
- }
-
- public void testReadWSDLImports() throws Exception {
- QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
- QName aPortType = new QName("http://helloworld", "HelloWorld");
-
- URL url = getClass().getResource("test1.wsdl");
- WSDLDefinition test1Defn = documentProcessor.read(null, new URI("test1.wsdl"), url, WSDLDefinition.class);
- assertNotNull(test1Defn);
- wsdlResolver.addModel(test1Defn);
- test1Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test1Defn);
- //binding is a part of test1.wsdl
- assertNotNull(test1Defn.getDefinition().getBinding(aBinding));
- //porttype is part of test2.wsdl
- assertNotNull(test1Defn.getDefinition().getPortType(aPortType));
- }
-
- public void testReadSameNamespaceWSDLDocument() throws Exception {
- QName aBinding = new QName("http://helloworld", "HelloWorldSoapBinding");
- QName aPortType = new QName("http://helloworld", "HelloWorld");
-
- URL url = getClass().getResource("test2.wsdl");
- WSDLDefinition test2Defn = documentProcessor.read(null, new URI("test2.wsdl"), url, WSDLDefinition.class);
- assertNotNull(test2Defn);
- wsdlResolver.addModel(test2Defn);
- test2Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test2Defn);
-
- //bindings are a part of test1.wsdl so should not be found
- assertNull(test2Defn.getDefinition().getBinding(aBinding));
- assertNotNull(test2Defn.getDefinition().getPortType(aPortType));
-
- url = getClass().getResource("test1.wsdl");
- WSDLDefinition test1Defn = documentProcessor.read(null, new URI("test1.wsdl"), url, WSDLDefinition.class);
- assertNotNull(test1Defn);
- wsdlResolver.addModel(test1Defn);
-
- test1Defn = wsdlResolver.resolveModel(WSDLDefinition.class, test1Defn);
-
- assertNotNull(test1Defn.getDefinition().getPortType(aPortType));
- assertNotNull(test1Defn.getDefinition().getBinding(aBinding));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.java
deleted file mode 100644
index 6448291f41..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/WriteTestCase.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.interfacedef.wsdl.xml;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ComponentType;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConstrainingType;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-
-/**
- * Test reading/write WSDL interfaces.
- *
- * @version $Rev$ $Date$
- */
-public class WriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, null);
- }
-
- public void testReadWriteComponentType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
- ComponentType componentType = (ComponentType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(componentType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(componentType, outputFactory.createXMLStreamWriter(bos));
- }
-
- public void testReadWriteConstrainingType() throws Exception {
- InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
- ConstrainingType constrainingType = (ConstrainingType)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(constrainingType);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(constrainingType, outputFactory.createXMLStreamWriter(bos));
- }
-
- public void testReadWriteComposite() throws Exception {
- InputStream is = getClass().getResourceAsStream("Calculator.composite");
- Composite composite = (Composite)staxProcessor.read(inputFactory.createXMLStreamReader(is));
- assertNotNull(composite);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java
deleted file mode 100644
index 105b3da7fa..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/xml/XMLDocumentHelperTestCase.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.xml;
-
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.xsd.xml.XMLDocumentHelper;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLDocumentHelperTestCase {
- private URL wsdl;
- private URL xsd;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- wsdl = getClass().getResource("/wsdl/helloworld-interface.wsdl");
- }
-
- @Test
- public void testReadTNS() throws Exception {
- String tns = XMLDocumentHelper.readTargetNamespace(wsdl, XMLDocumentHelper.WSDL11, true, "targetNamespace", XMLInputFactory.newInstance());
- Assert.assertEquals("http://helloworld", tns);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite
deleted file mode 100644
index 875fdf35d2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/Calculator.composite
+++ /dev/null
@@ -1,55 +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://sample.calculator"
- targetNamespace="http://calc"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- name="Calculator">
-
- <service name="CalculatorService" promote="CalculatorServiceComponent">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
- wsdli:wsdlLocation="http://tempuri.org"/>
- </service>
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent"/>
- <reference name="subtractService" target="SubtractServiceComponent"/>
- <reference name="multiplyService" target="MultiplyServiceComponent"/>
- <reference name="divideService" target="DivideServiceComponent"/>
- </component>
-
- <component name="AddServiceComponent">
- <implementation.java class="calculator.AddServiceImpl"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <implementation.java class="calculator.SubtractServiceImpl"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <implementation.java class="calculator.MultiplyServiceImpl"/>
- </component>
-
- <component name="DivideServiceComponent">
- <implementation.java class="calculator.DivideServiceImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
deleted file mode 100644
index 3eb81b61bd..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorComponent.constrainingType
+++ /dev/null
@@ -1,36 +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"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
- name="CalculatorComponent">
-
- <service name="CalculatorService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
- wsdli:wsdlLocation="http://tempuri.org"/>
- </service>
-
- <reference name="divideService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
- </reference>
-
-</constrainingType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType
deleted file mode 100644
index aea7046a3d..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/CalculatorImpl.componentType
+++ /dev/null
@@ -1,33 +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"
- xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance">
-
- <service name="CalculatorService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Calculator)"
- wsdli:wsdlLocation="http://tempuri.org"/>
- </service>
-
- <reference name="divideService">
- <interface.wsdl interface="http://sample/calculator#wsdl.interface(Divide)"/>
- </reference>
-
-</componentType>
- \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl
deleted file mode 100644
index 5e8e5dad0d..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/example.wsdl
+++ /dev/null
@@ -1,26 +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.
--->
-<wsdl:definitions targetNamespace="http://www.example.org"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
- name="example">
-
- <wsdl:portType name="HelloWorld">
- </wsdl:portType>
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
deleted file mode 100644
index ad81fc7867..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/invalid-stockquote.wsdl
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice1">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput" />
- <output message="tns:GetLastTradePriceOutput" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd
deleted file mode 100644
index 241ec15d36..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/ipo.xsd
+++ /dev/null
@@ -1,136 +0,0 @@
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<schema targetNamespace="http://www.example.com/IPO"
- xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO">
-
- <annotation>
- <documentation xml:lang="en">
- International Purchase order schema for Example.com
- Copyright 2000 Example.com. All rights reserved.
- </documentation>
- </annotation>
-
-
- <element name="purchaseOrder" type="ipo:PurchaseOrderType" />
-
- <element name="comment" type="string" />
-
- <complexType name="PurchaseOrderType">
- <sequence>
- <element name="shipTo" type="ipo:Address" />
- <element name="billTo" type="ipo:Address" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="items" type="ipo:Items" />
- </sequence>
- <attribute name="orderDate" type="date" />
- </complexType>
-
- <complexType name="Items">
- <sequence>
- <element name="item" minOccurs="0" maxOccurs="unbounded">
- <complexType>
- <sequence>
- <element name="productName" type="string" />
- <element name="quantity">
- <simpleType>
- <restriction base="positiveInteger">
- <maxExclusive value="100" />
- </restriction>
- </simpleType>
- </element>
- <element name="USPrice" type="decimal" />
- <element ref="ipo:comment" minOccurs="0" />
- <element name="shipDate" type="date"
- minOccurs="0" />
- </sequence>
- <attribute name="partNum" type="ipo:SKU"
- use="required" />
- </complexType>
- </element>
- </sequence>
- </complexType>
-
- <simpleType name="SKU">
- <restriction base="string">
- <pattern value="\d{3}-[A-Z]{2}" />
- </restriction>
- </simpleType>
-
- <complexType name="Address">
- <sequence>
- <element name="name" type="string" />
- <element name="street" type="string" />
- <element name="city" type="string" />
- </sequence>
- </complexType>
-
- <complexType name="USAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="state" type="ipo:USState" />
- <element name="zip" type="positiveInteger" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="UKAddress">
- <complexContent>
- <extension base="ipo:Address">
- <sequence>
- <element name="postcode" type="ipo:UKPostcode" />
- </sequence>
- <attribute name="exportCode" type="positiveInteger"
- fixed="1" />
- </extension>
- </complexContent>
- </complexType>
-
- <!-- other Address derivations for more countries -->
-
- <simpleType name="USState">
- <restriction base="string">
- <enumeration value="AK" />
- <enumeration value="AL" />
- <enumeration value="AR" />
- <enumeration value="CA" />
- <enumeration value="PA" />
- <!-- and so on ... -->
- </restriction>
- </simpleType>
-
- <simpleType name="Postcode">
- <restriction base="string">
- <length value="7" fixed="true" />
- </restriction>
- </simpleType>
-
-
- <simpleType name="UKPostcode">
- <restriction base="ipo:Postcode">
- <pattern value="[A-Z]{2}\d\s\d[A-Z]{2}" />
- </restriction>
- </simpleType>
-
-
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
deleted file mode 100644
index 39cd5547d9..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/stockquote.wsdl
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput" />
- <output message="tns:GetLastTradePriceOutput" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl
deleted file mode 100644
index 8e26f7b4b5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.wsdl
+++ /dev/null
@@ -1,45 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:import location="test2.wsdl" namespace="http://helloworld"></wsdl:import>
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address location="http://localhost:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
deleted file mode 100644
index c2210f4a94..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test1.xsd
+++ /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.
--->
-<schema targetNamespace="http://www.example.com/Customer" xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:ipo="http://www.example.com/IPO" xmlns:tns="http://www.example.com/Customer">
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
-
- <complexType name="Customer">
- <sequence>
- <element name="customerID" type="string"></element>
- <element name="name" type="string"></element>
- <element name="order" type="ipo:PurchaseOrderType" />
- </sequence>
- </complexType>
- <element name="customer" type="tns:Customer"></element>
-
-</schema>
-
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl
deleted file mode 100644
index 529b395fd5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/test2.wsdl
+++ /dev/null
@@ -1,63 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <import namespace="http://www.example.com/IPO" schemaLocation="ipo.xsd" />
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="xsd:string" />
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="xsd:string" />
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest" />
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse" />
- </wsdl:operation>
- </wsdl:portType>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl
deleted file mode 100644
index 666a7e4069..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/org/apache/tuscany/sca/interfacedef/wsdl/xml/unwrapped-stockquote.wsdl
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote" targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl" xmlns:xsd1="http://example.com/stockquote.xsd"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput1">
- <part name="body" element="xsd1:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput1">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <message name="GetLastTradePriceInput2">
- <part name="body" element="xsd1:getLastTradePrice" />
- <part name="other" type="xsd:string"/>
- </message>
-
- <message name="GetLastTradePriceOutput2">
- <part name="body" element="xsd1:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput1" />
- <output message="tns:GetLastTradePriceOutput1" />
- </operation>
- <operation name="getLastTradePrice1">
- <input message="tns:GetLastTradePriceInput1" />
- <output message="tns:GetLastTradePriceOutput1" />
- </operation>
- <operation name="getLastTradePrice2">
- <input message="tns:GetLastTradePriceInput2" />
- <output message="tns:GetLastTradePriceOutput2" />
- </operation>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
deleted file mode 100644
index 7cdf801692..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/policy/stockquote_policy.wsdl
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<definitions name="StockQuote"
- targetNamespace="http://example.com/stockquote.wsdl"
- xmlns:tns="http://example.com/stockquote.wsdl"
- xmlns:xsd="http://example.com/stockquote.xsd"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns="http://schemas.xmlsoap.org/wsdl/">
-
- <types>
- <schema targetNamespace="http://example.com/stockquote.xsd" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="getLastTradePrice">
- <complexType>
- <sequence>
- <element name="tickerSymbol" type="string" />
- </sequence>
- </complexType>
- </element>
- <element name="getLastTradePriceResponse">
- <complexType>
- <sequence>
- <element name="price" type="float" />
- </sequence>
- </complexType>
- </element>
- </schema>
- </types>
-
- <message name="GetLastTradePriceInput">
- <part name="body" element="xsd:getLastTradePrice" />
- </message>
-
- <message name="GetLastTradePriceOutput">
- <part name="body" element="xsd:getLastTradePriceResponse" />
- </message>
-
- <portType name="StockQuotePortType" sca:requires="sca:conversational tns:PolicyIntent">
- <operation name="getLastTradePrice">
- <input message="tns:GetLastTradePriceInput" />
- <output message="tns:GetLastTradePriceOutput" />
- </operation>
- <operation name="cancel" sca:endsConversation="true"/>
- </portType>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl
deleted file mode 100644
index b0b6644e7f..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-interface.wsdl
+++ /dev/null
@@ -1,67 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://helloworld"
- xmlns="http://www.w3.org/2001/XMLSchema" xmlns:g="http://greeting">
-
- <!--
- <import namespace="http://greeting" schemaLocation="../xsd/greeting.xsd" />
- -->
- <include schemaLocation="../xsd/helloworld.xsd" />
-
- <element name="getGreetings">
- <complexType>
- <sequence>
- <element name="name" type="g:Name" />
- </sequence>
- </complexType>
- </element>
-
- <element name="getGreetingsResponse">
- <complexType>
- <sequence>
- <element name="getGreetingsReturn" type="g:Greeting" />
- </sequence>
- </complexType>
- </element>
-
- </schema>
- </wsdl:types>
-
- <wsdl:message name="getGreetingsRequest">
- <wsdl:part element="tns:getGreetings" name="parameters" />
- </wsdl:message>
-
- <wsdl:message name="getGreetingsResponse">
- <wsdl:part element="tns:getGreetingsResponse" name="parameters" />
- </wsdl:message>
-
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="getGreetings">
- <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest" />
- <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse" />
- </wsdl:operation>
- </wsdl:portType>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl
deleted file mode 100644
index 0a7979e308..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/wsdl/helloworld-service.wsdl
+++ /dev/null
@@ -1,49 +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.
--->
-<wsdl:definitions targetNamespace="http://helloworld" xmlns:tns="http://helloworld"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="helloworld">
-
- <wsdl:import location="helloworld-interface.wsdl" namespace="http://helloworld"></wsdl:import>
- <!--
- <wsdl:import namespace="http://helloworld"></wsdl:import>
- -->
-
- <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
- <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="getGreetings">
- <wsdlsoap:operation soapAction="" />
- <wsdl:input name="getGreetingsRequest">
- <wsdlsoap:body use="literal" />
- </wsdl:input>
- <wsdl:output name="getGreetingsResponse">
- <wsdlsoap:body use="literal" />
- </wsdl:output>
- </wsdl:operation>
- </wsdl:binding>
-
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
- <wsdlsoap:address
- location="http://localhost:8085/sample-helloworldws-1.0-SNAPSHOT/services/HelloWorldWebService" />
- </wsdl:port>
- </wsdl:service>
-
-</wsdl:definitions>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd
deleted file mode 100644
index 635ca25bfc..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/greeting.xsd
+++ /dev/null
@@ -1,29 +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.
--->
-<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
- <include schemaLocation="name.xsd" />
- <complexType name="Greeting">
- <sequence>
- <element name="message" type="string" />
- <element name="name" type="Name" />
- </sequence>
- </complexType>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd
deleted file mode 100644
index bb0c9bc7b7..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/helloworld.xsd
+++ /dev/null
@@ -1,22 +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.
--->
-<schema targetNamespace="http://helloworld" xmlns="http://www.w3.org/2001/XMLSchema">
- <import namespace="http://greeting" schemaLocation="greeting.xsd" />
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd b/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd
deleted file mode 100644
index 300de931ec..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl-xml/src/test/resources/xsd/name.xsd
+++ /dev/null
@@ -1,29 +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.
--->
-<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <complexType name="Name">
- <sequence>
- <element name="firstName" type="string" />
- <element name="lastName" type="string" />
- </sequence>
- </complexType>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/LICENSE b/branches/sca-java-1.5.1/modules/interface-wsdl/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/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-java-1.5.1/modules/interface-wsdl/NOTICE b/branches/sca-java-1.5.1/modules/interface-wsdl/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/pom.xml b/branches/sca-java-1.5.1/modules/interface-wsdl/pom.xml
deleted file mode 100644
index 6f20b30a61..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/pom.xml
+++ /dev/null
@@ -1,103 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface-wsdl</artifactId>
- <name>Apache Tuscany SCA WSDL Interface Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-interface</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>1.4.2</version>
- </dependency>
-
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.6.2</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <!-- Apache repository for Web Services artifacts -->
- <repository>
- <id>apache.ws.zone</id>
- <name>Apache WS Zone Repository</name>
- <url>http://ws.zones.apache.org/repository2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface.wsdl</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef.wsdl*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.java
deleted file mode 100644
index 2a5dd07d08..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/DefaultWSDLFactory.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.interfacedef.wsdl;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLFactoryImpl;
-
-/**
- * A factory for the WSDL model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultWSDLFactory extends WSDLFactoryImpl implements WSDLFactory {
-
- public DefaultWSDLFactory(ModelFactoryExtensionPoint modelFactories) {
- super(modelFactories);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
deleted file mode 100644
index 039e75f437..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.WSDLElement;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaType;
-
-/**
- * Represents a WSDL definition.
- * WSDLDefinition
- *
- * @version $Rev$ $Date$
- */
-public interface WSDLDefinition extends Base {
-
- /**
- * Returns the WSDL definition model, if there are more than one WSDL definition under the
- * same namespace, the definition will be a facade which imports all the physical WSDL
- * definitions
- *
- * @return the WSDL definition model
- */
- Definition getDefinition();
-
- /**
- * Sets the WSDL definition model
- * @param definition the WSDL definition model
- */
- void setDefinition(Definition definition);
-
- /**
- * Returns the namespace of this WSDL definition.
- * @return the namespace of this WSDL definition
- */
- String getNamespace();
-
- /**
- * Sets the namespace of this WSDL definition.
- * @param namespace the namespace of this WSDL definition
- */
- void setNamespace(String namespace);
-
- /**
- * Get a list of inline XML schema definitions
- * @return A list of inline XML schema definitions
- */
- List<XSDefinition> getXmlSchemas();
-
- /**
- * Get the location of the WSDL file
- * @return The location of the WSDL file
- */
- URI getLocation();
-
- /**
- * Set the location of the WSDL file
- * @param url
- */
- void setLocation(URI url);
-
- /**
- * Get the contribution artifact URI of the WSDL document
- * @return The URI of the WSDL document
- */
- URI getURI();
-
- /**
- * Set the contribution artifact URI of the WSDL document
- * @param uri
- */
- void setURI(URI uri);
-
- /**
- * Get the WSDL definitions imported by this definition
- * @return A list of imported WSDL definitions
- */
- List<WSDLDefinition> getImportedDefinitions();
-
- /**
- * Get an XSD element by QName
- * @param name
- * @return
- */
- XmlSchemaElement getXmlSchemaElement(QName name);
-
- /**
- * Get an XSD type by QName
- * @param name
- * @return
- */
- XmlSchemaType getXmlSchemaType(QName name);
-
- /**
- * Get the WSDL object by type and name
- * @param <T>
- * @param type javax.wsdl.Service/PortType/Binding/Message.class
- * @param name The QName of the object
- * @return WSDLObject
- */
- <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name);
-
- /**
- * Get the generated binding for a WSDLDefinition
- * @return the WSDL binding
- */
- Binding getBinding();
-
- /**
- * Set the generated binding for a WSDLDefinition
- * @param binding the WSDL binding
- */
- void setBinding(Binding binding);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
deleted file mode 100644
index 95985dcc28..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLFactory.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.wsdl;
-
-import javax.wsdl.PortType;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-
-/**
- * Factory for the WSDL model.
- *
- * @version $Rev$ $Date$
- */
-public interface WSDLFactory {
-
- /**
- * Creates a new WSDL interface.
- *
- * @return a new WSDL interface
- */
- WSDLInterface createWSDLInterface();
-
- /**
- * Creates a new WSDL interface from a WSDL portType.
- *
- * @param portType the portType to inspect
- * @return a WSDLInterface corresponding to the WSDL portType
- */
- WSDLInterface createWSDLInterface(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
-
- /**
- * Creates the contents of a WSDL interface from a WSDL portType.
- *
- * @param portType the portType to inspect
- * @return a WSDLInterface corresponding to the WSDL portType
- */
- void createWSDLInterface(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidInterfaceException;
-
- /**
- * Creates a new WSDL definition.
- *
- * @return a new WSDL definition
- */
- WSDLDefinition createWSDLDefinition();
-
- /**
- * Creates a new WSDL interface contract.
- *
- * @return
- */
- WSDLInterfaceContract createWSDLInterfaceContract();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.java
deleted file mode 100644
index c0da060af2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterface.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.interfacedef.wsdl;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.tuscany.sca.interfacedef.Interface;
-
-
-/**
- * Represents a WSDL interface.
- *
- * @version $Rev$ $Date$
- */
-public interface WSDLInterface extends Interface, Base {
-
- /**
- * Returns the name of the WSDL interface.
- *
- * @return the name of the WSDL interface
- */
- QName getName();
-
- /**
- * Sets the name of the WSDL interface.
- *
- * @param interfaceName the name of the WSDL interface
- */
- void setName(QName interfaceName);
-
- /**
- * Returns the WSDL interface portType.
- *
- * @return the WSDL interface portType
- */
- PortType getPortType();
-
- /**
- * Sets the WSDL interface portType
- *
- * @param portType the WSDL interface portType
- */
- void setPortType(PortType portType);
-
- WSDLDefinition getWsdlDefinition();
-
- void setWsdlDefinition(WSDLDefinition wsdlDefinition);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.java
deleted file mode 100644
index 2ef21a50cf..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLInterfaceContract.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.interfacedef.wsdl;
-
-import org.apache.tuscany.sca.assembly.Extensible;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-
-/**
- * Represents a WSDL interface contract.
- *
- * @version $Rev$ $Date$
- */
-public interface WSDLInterfaceContract extends InterfaceContract, Extensible {
-
- /**
- * Sets the WSDL location.
- * @param location the WSDL location
- */
- void setLocation(String location);
-
- /**
- * Returns the WSDL location
- * @return the WSDL location
- */
- String getLocation();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java
deleted file mode 100644
index 0b707163da..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLObject.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl;
-
-import java.io.Serializable;
-
-import javax.wsdl.Definition;
-
-/**
- * Model for objects in a WSDL definition
- * @version $Rev$ $Date$
- */
-public interface WSDLObject<T extends Serializable> {
- /**
- * Get the owning definition where the element is declared
- * @return The owning definition
- */
- Definition getDefinition();
-
- /**
- * Set the owning definition
- * @param definition
- */
- void setDefinition(Definition definition);
-
- /**
- * Get the WSDL element such as Service, PortType, Binding or Message
- * @return The WSDL element
- */
- T getElement();
-
- /**
- * Set the WSDL element
- * @param element
- */
- void setElement(T element);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.java
deleted file mode 100644
index d73cccb714..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLOperation.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.interfacedef.wsdl;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * WSDL 1.1 Operation
- * @version $Rev$ $Date$
- */
-public interface WSDLOperation extends Operation {
- /**
- * Get the underlying WSDL operation
- * @return
- */
- javax.wsdl.Operation getWsdlOperation();
-
- /**
- * Set the underlying WSDL operation
- * @param operation
- */
- void setWsdlOperation(javax.wsdl.Operation operation);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.java
deleted file mode 100644
index 1e7b4faa32..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/InvalidWSDLException.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.interfacedef.wsdl.impl;
-
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-
-/**
- * An exception to indicate the WSDL definition is invalid
- *
- * @version $Rev$ $Date$
- */
-public class InvalidWSDLException extends InvalidInterfaceException {
- private static final long serialVersionUID = 3742887584293256519L;
-
- public InvalidWSDLException(String message) {
- super(message);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
deleted file mode 100644
index 16e9cf43f3..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.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.interfacedef.wsdl.impl;
-
-import static org.apache.tuscany.sca.xsd.impl.XSDefinitionImpl.getXmlSchemaObject;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Message;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.WSDLElement;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaType;
-
-/**
- * Represents a WSDL definition.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLDefinitionImpl implements WSDLDefinition {
-
- private Definition definition;
- private String namespace;
- private URI location;
- private URI uri;
- private List<WSDLDefinition> imported = new ArrayList<WSDLDefinition>();
- private List<XSDefinition> schemas = new ArrayList<XSDefinition>();
- private boolean unresolved;
- private Binding binding;
-
- protected WSDLDefinitionImpl() {
- }
-
- public Definition getDefinition() {
- return definition;
- }
-
- public void setDefinition(Definition definition) {
- this.definition = definition;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- public String getNamespace() {
- if (isUnresolved()) {
- return namespace;
- } else if (definition != null) {
- return definition.getTargetNamespace();
- } else {
- return namespace;
- }
- }
-
- public void setNamespace(String namespace) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- } else {
- this.namespace = namespace;
- }
- }
-
- /*
- @Override
- public int hashCode() {
- return String.valueOf(getNamespace()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof WSDLDefinition) {
- WSDLDefinition def = (WSDLDefinition)obj;
- if (getNamespace() != null) {
- return getNamespace().equals(def.getNamespace());
- } else {
- return def.getNamespace() == null;
- }
- } else {
- return false;
- }
- }
- */
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemas()
- */
- public List<XSDefinition> getXmlSchemas() {
- return schemas;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getLocation()
- */
- public URI getLocation() {
- return location;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#setLocation(java.net.URI)
- */
- public void setLocation(URI url) {
- this.location = url;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getURI()
- */
- public URI getURI() {
- return uri;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#setURI(java.net.URI)
- */
- public void setURI(URI uri) {
- this.uri = uri;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getImportedDefinitions()
- */
- public List<WSDLDefinition> getImportedDefinitions() {
- return imported;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof WSDLDefinitionImpl))
- return false;
- final WSDLDefinitionImpl other = (WSDLDefinitionImpl)obj;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (namespace == null) {
- if (other.namespace != null)
- return false;
- } else if (!namespace.equals(other.namespace))
- return false;
- return true;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaElement(javax.xml.namespace.QName)
- */
- public XmlSchemaElement getXmlSchemaElement(QName name) {
- XmlSchemaCollection schemaCollection = null;
- for (XSDefinition xsd : schemas) {
- if (schemaCollection == null && xsd.getSchemaCollection() != null) {
- schemaCollection = xsd.getSchemaCollection();
- }
- XmlSchema schema = xsd.getSchema();
- XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
- if (element != null) {
- return element;
- }
- }
- if (schemaCollection != null) {
- return schemaCollection.getElementByQName(name);
- }
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition#getXmlSchemaType(javax.xml.namespace.QName)
- */
- public XmlSchemaType getXmlSchemaType(QName name) {
- XmlSchemaCollection schemaCollection = null;
- for (XSDefinition xsd : schemas) {
- if (xsd.getSchemaCollection() != null) {
- schemaCollection = xsd.getSchemaCollection();
- }
- XmlSchema schema = xsd.getSchema();
- XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
- if (type != null) {
- return type;
- }
- }
- if (schemaCollection != null) {
- return schemaCollection.getTypeByQName(name);
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private static <T extends WSDLElement> WSDLObject<T> getWSDLObject(Definition definition, Class<T> type, QName name) {
- if (definition == null) {
- return null;
- }
- Map<QName, WSDLElement> map = null;
- if (type == PortType.class) {
- map = definition.getPortTypes();
- } else if (type == Service.class) {
- map = definition.getServices();
- } else if (type == Binding.class) {
- map = definition.getBindings();
- } else if (type == Message.class) {
- map = definition.getMessages();
- } else {
- throw new IllegalArgumentException("Invalid type: " + type.getName());
- }
- if (map.containsKey(name)) {
- return (WSDLObject<T>)new WSDLObjectImpl(definition, map.get(name));
- } else {
- for (Object imports : definition.getImports().values()) {
- List<Import> importList = (List<Import>)imports;
- for (Import i : importList) {
- definition = i.getDefinition();
- WSDLObject<T> element = getWSDLObject(definition, type, name);
- if (element != null) {
- return element;
- }
- }
- }
- }
- return null;
- }
-
- public <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name) {
- return getWSDLObject(definition, type, name);
- }
-
- public Binding getBinding() {
- return binding;
- }
-
- public void setBinding(Binding binding) {
- this.binding = binding;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
deleted file mode 100644
index 1f2263e1c9..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.wsdl.impl;
-
-import javax.wsdl.PortType;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-
-/**
- * A factory for the WSDL model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class WSDLFactoryImpl implements WSDLFactory {
-
- private WSDLInterfaceIntrospectorImpl introspector;
-
- public WSDLFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
- introspector = new WSDLInterfaceIntrospectorImpl(modelFactories);
- }
-
- public WSDLInterface createWSDLInterface() {
- return new WSDLInterfaceImpl();
- }
-
- public WSDLInterface createWSDLInterface(PortType portType,
- WSDLDefinition wsdlDefinition,
- ModelResolver resolver) throws InvalidInterfaceException {
- WSDLInterface wsdlInterface = createWSDLInterface();
- introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
- return wsdlInterface;
- }
-
- public void createWSDLInterface(WSDLInterface wsdlInterface,
- PortType portType,
- WSDLDefinition wsdlDefinition,
- ModelResolver resolver) throws InvalidInterfaceException {
- introspector.introspectPortType(wsdlInterface, portType, wsdlDefinition, resolver);
- }
-
- public WSDLDefinition createWSDLDefinition() {
- return new WSDLDefinitionImpl();
- }
-
- public WSDLInterfaceContract createWSDLInterfaceContract() {
- return new WSDLInterfaceContractImpl();
- }
-
- public WSDLInterfaceIntrospectorImpl getWSDLInterfaceIntrospector() {
- return introspector;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java
deleted file mode 100644
index e116f567c1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceContractImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.wsdl.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-
-/**
- * Represents a WSDL interface contract.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLInterfaceContractImpl extends InterfaceContractImpl implements WSDLInterfaceContract {
- private String location;
- private List<Object> extensions = new ArrayList<Object>();
- private List<Extension> attributeExtensions = new ArrayList<Extension>();
-
-
- protected WSDLInterfaceContractImpl() {
- }
-
- public String getLocation() {
- return location;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public List<Extension> getAttributeExtensions() {
- return attributeExtensions;
- }
-
-
- @Override
- public WSDLInterfaceContractImpl clone() throws CloneNotSupportedException {
- return (WSDLInterfaceContractImpl) super.clone();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.java
deleted file mode 100644
index e8379ee56b..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceImpl.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.interfacedef.wsdl.impl;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-
-/**
- * Represents a WSDL interface.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLInterfaceImpl extends InterfaceImpl implements WSDLInterface {
-
- private QName name;
- private PortType portType;
- private WSDLDefinition wsdlDefinition;
-
- protected WSDLInterfaceImpl() {
- setRemotable(true);
- }
-
- public QName getName() {
- if (isUnresolved()) {
- return name;
- } else {
- return portType.getQName();
- }
- }
-
- public void setName(QName interfaceName) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- }
- this.name = interfaceName;
- }
-
- public PortType getPortType() {
- return portType;
- }
-
- public void setPortType(PortType portType) {
- this.portType = portType;
- if (portType != null) {
- this.name = portType.getQName();
- }
- }
-
- public WSDLDefinition getWsdlDefinition() {
- return wsdlDefinition;
- }
-
- public void setWsdlDefinition(WSDLDefinition wsdlDefinition) {
- this.wsdlDefinition = wsdlDefinition;
- }
-
- @Override
- public WSDLInterfaceImpl clone() throws CloneNotSupportedException {
- return (WSDLInterfaceImpl) super.clone();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- WSDLInterfaceImpl other = (WSDLInterfaceImpl)obj;
- if (isUnresolved() || other.isUnresolved()) {
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- } else {
- if (portType == null) {
- if (other.portType != null)
- return false;
- } else if (!portType.equals(other.portType))
- return false;
- }
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
deleted file mode 100644
index 18fce72f90..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.impl;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
-
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-
-/**
- * Introspector for creating WSDLInterface definitions from WSDL PortTypes.
- *
- * @version $Rev$ $Date$
- */
-public class WSDLInterfaceIntrospectorImpl {
- private static final QName POLICY_REQUIRES = new QName("http://www.osoa.org/xmlns/sca/1.0", "requires");
- private static final QName POLICY_CONVERSATIONAL = new QName("http://www.osoa.org/xmlns/sca/1.0", "conversational");
- public static final QName POLICY_END_CONVERSATION = new QName("http://www.osoa.org/xmlns/sca/1.0", "endsConversation");
-
- private XSDFactory xsdFactory;
- private PolicyFactory policyFactory;
-
- public WSDLInterfaceIntrospectorImpl(ModelFactoryExtensionPoint modelFactories) {
- this.xsdFactory = modelFactories.getFactory(XSDFactory.class);;
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);;
- }
-
- // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS Specification?
- private List<Operation> introspectOperations(PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
- List<Operation> operations = new ArrayList<Operation>();
- for (Object o : portType.getOperations()) {
- javax.wsdl.Operation wsdlOp = (javax.wsdl.Operation)o;
- Operation operation = getOperation(wsdlOp, wsdlDefinition, resolver, xsdFactory);
- if(isEndConversation(wsdlOp)) {
- operation.setConversationSequence(ConversationSequence.CONVERSATION_END);
- }
- operations.add(operation);
- }
- return operations;
- }
-
- public void introspectPortType(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
- processIntents(wsdlInterface, portType);
- wsdlInterface.setPortType(portType);
- wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition, resolver));
- wsdlInterface.setConversational(isConversational(portType));
- }
-
- public static Operation getOperation(javax.wsdl.Operation wsdlOp,
- WSDLDefinition wsdlDefinition,
- ModelResolver resolver,
- XSDFactory xsdFactory) throws InvalidWSDLException {
- WSDLOperationIntrospectorImpl op = new WSDLOperationIntrospectorImpl(xsdFactory, wsdlOp, wsdlDefinition, null, resolver);
- return op.getOperation();
- }
-
- private void processIntents(WSDLInterface wsdlInterface, PortType portType) {
- Object o;
- try {
- o = portType.getExtensionAttribute(POLICY_REQUIRES);
- } catch (NoSuchMethodError e) {
- // That method does not exist on older WSDL4J levels
- o = null;
- }
- if(o != null && o instanceof Vector) {
- Vector<QName> policyAttributes = (Vector<QName>) o;
-
- Enumeration<QName> policyItents = policyAttributes.elements();
- while(policyItents.hasMoreElements()) {
- QName intentName = policyItents.nextElement();
-
- //ignores conversational, as it will have it's own
- //attribute in the wsdl interface model
- if(! intentName.equals(POLICY_CONVERSATIONAL)) {
- //process the intent
- System.out.println(">>> Intent : " + intentName);
-
- // Add each intent to the list
- Intent intent = policyFactory.createIntent();
- intent.setName(intentName);
-
- wsdlInterface.getRequiredIntents().add(intent);
- }
- }
-
- }
- }
-
- private boolean isConversational(PortType portType) {
- boolean conversational = false;
-
- Object o;
- try {
- o = portType.getExtensionAttribute(POLICY_REQUIRES);
- } catch (NoSuchMethodError e) {
- // That method does not exist on older WSDL4J levels
- o =null;
- }
- if(o != null && o instanceof Vector) {
- Vector<QName> policyAttributes = (Vector<QName>) o;
-
- if(policyAttributes.contains(POLICY_CONVERSATIONAL)) {
- return true;
- }
-
- }
-
- return conversational;
- }
-
- private boolean isEndConversation(javax.wsdl.Operation operation) {
- boolean endConversation = false;
-
- Object o;
- try {
- o = operation.getExtensionAttribute(POLICY_END_CONVERSATION);
- } catch (NoSuchMethodError e) {
- // That method does not exist on older WSDL4J levels
- o = null;
- }
- if(o != null && o instanceof String) {
- endConversation = Boolean.valueOf((String)o);
- }
-
- return endConversation;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.java
deleted file mode 100644
index f18eaef27b..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLObjectImpl.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.interfacedef.wsdl.impl;
-
-import java.io.Serializable;
-
-import javax.wsdl.Definition;
-
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLObject;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WSDLObjectImpl<T extends Serializable> implements WSDLObject<T> {
- private Definition definition;
- private T element;
-
- public WSDLObjectImpl() {
- super();
- }
-
- public WSDLObjectImpl(Definition definition, T element) {
- super();
- this.definition = definition;
- this.element = element;
- }
-
- public Definition getDefinition() {
- return definition;
- }
-
- public void setDefinition(Definition definition) {
- this.definition = definition;
- }
-
- public T getElement() {
- return element;
- }
-
- public void setElement(T element) {
- this.element = element;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.java
deleted file mode 100644
index 317b9cce81..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationImpl.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.interfacedef.wsdl.impl;
-
-import javax.wsdl.Operation;
-
-import org.apache.tuscany.sca.interfacedef.impl.OperationImpl;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
-
-/**
- * @version $Rev$ $Date$
- */
-public class WSDLOperationImpl extends OperationImpl implements WSDLOperation {
- private Operation operation;
-
- public WSDLOperationImpl() {
- super();
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation#getWsdlOperation()
- */
- public Operation getWsdlOperation() {
- return operation;
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation#setWsdlOperation(javax.wsdl.Operation)
- */
- public void setWsdlOperation(Operation operation) {
- this.operation = operation;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((operation == null) ? 0 : operation.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!super.equals(obj))
- return false;
- if (getClass() != obj.getClass())
- return false;
- final WSDLOperationImpl other = (WSDLOperationImpl)obj;
- if (operation == null) {
- if (other.operation != null)
- return false;
- } else if (!operation.equals(other.operation))
- return false;
- return true;
- }
-
- @Override
- public String toString() {
- return operation == null ? null : operation.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
deleted file mode 100644
index 19b14336f5..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLOperationIntrospectorImpl.java
+++ /dev/null
@@ -1,617 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.wsdl.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.wsdl.Fault;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.xml.XMLConstants;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
-import org.apache.tuscany.sca.interfacedef.util.FaultException;
-import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLOperation;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchemaComplexType;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
-import org.apache.ws.commons.schema.XmlSchemaParticle;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
-import org.apache.ws.commons.schema.XmlSchemaSimpleType;
-import org.apache.ws.commons.schema.XmlSchemaType;
-
-/**
- * Metadata for a WSDL operation
- *
- * @version $Rev$ $Date$
- */
-public class WSDLOperationIntrospectorImpl {
- private static final Logger logger = Logger.getLogger(WSDLOperationIntrospectorImpl.class.getName());
- private static final QName ANY = new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "any");
-
- private XSDFactory xsdFactory;
- private ModelResolver resolver;
- private WSDLDefinition wsdlDefinition;
- private javax.wsdl.Operation operation;
- private WSDLOperation operationModel;
- private DataType<List<DataType>> inputType;
- private DataType outputType;
- private List<DataType> faultTypes;
- private String dataBinding;
-
- /**
- * @param wsdlFactory The WSDLFactory to use
- * @param operation The WSDL4J operation
- * @param wsdlDefinition The WSDL Definition
- * @param dataBinding The default databinding
- * @param resolver The ModelResolver to use
- */
- public WSDLOperationIntrospectorImpl(XSDFactory xsdFactory,
- javax.wsdl.Operation operation,
- WSDLDefinition wsdlDefinition,
- String dataBinding,
- ModelResolver resolver) {
- super();
- this.xsdFactory = xsdFactory;
- this.operation = operation;
- this.wsdlDefinition = wsdlDefinition;
- this.resolver = resolver;
- this.dataBinding = dataBinding;
- this.wrapper = new Wrapper();
- }
-
- private Wrapper wrapper;
-
- private Boolean wrapperStyle;
-
- /**
- * Test if the operation qualifies wrapper style as defined by the JAX-WS
- * 2.0 Specification
- *
- * @return true if the operation qualifies wrapper style, otherwise false
- */
- public boolean isWrapperStyle() throws InvalidWSDLException {
- if (wrapperStyle == null) {
- wrapperStyle =
- (operation.getInput() == null || operation.getInput().getMessage() == null
- || operation.getInput().getMessage().getParts().size() == 0 || wrapper.getInputChildElements() != null) && (operation
- .getOutput() == null || operation.getOutput().getMessage() == null
- || operation.getOutput().getMessage().getParts().size() == 0 || wrapper.getOutputChildElements() != null);
- }
- return wrapperStyle;
- }
-
- public Wrapper getWrapper() throws InvalidWSDLException {
- if (!isWrapperStyle()) {
- throw new IllegalStateException("The operation is not wrapper style.");
- } else {
- return wrapper;
- }
- }
-
- /**
- * @return
- * @throws InvalidServiceContractException
- */
- public DataType<List<DataType>> getInputType() throws InvalidWSDLException {
- if (inputType == null) {
- Input input = operation.getInput();
- Message message = (input == null) ? null : input.getMessage();
- inputType = getMessageType(message);
- inputType.setDataBinding("idl:input");
- }
- return inputType;
- }
-
- /**
- * @return
- * @throws NotSupportedWSDLException
- */
- @SuppressWarnings("unchecked")
- public DataType<XMLType> getOutputType() throws InvalidWSDLException {
- if (outputType == null) {
- Output output = operation.getOutput();
- Message outputMsg = (output == null) ? null : output.getMessage();
-
- List outputParts = (outputMsg == null) ? null : outputMsg.getOrderedParts(null);
- if (outputParts != null && outputParts.size() > 0) {
- if (outputParts.size() > 1) {
- // We don't support output with multiple parts
- if (logger.isLoggable(Level.WARNING)) {
- logger.warning("Multi-part output is not supported, please use BARE parameter style.");
- }
- // throw new InvalidWSDLException("Multi-part output is not supported");
- }
- Part part = (Part)outputParts.get(0);
- outputType = new WSDLPart(part, Object.class).getDataType();
- // outputType.setMetadata(WSDLOperation.class.getName(), this);
- }
- }
- return outputType;
- }
-
- /**
- * @return
- * @throws NotSupportedWSDLException
- */
- public List<DataType> getFaultTypes() throws InvalidWSDLException {
- if (faultTypes == null) {
- Collection faults = operation.getFaults().values();
- faultTypes = new ArrayList<DataType>();
- for (Object f : faults) {
- Fault fault = (Fault)f;
- Message faultMsg = fault.getMessage();
- List faultParts = faultMsg.getOrderedParts(null);
- if (faultParts.size() != 1) {
- throw new InvalidWSDLException("The fault message MUST have a single part");
- }
- Part part = (Part)faultParts.get(0);
- WSDLPart wsdlPart = new WSDLPart(part, Object.class);
- faultTypes.add(new DataTypeImpl<DataType>(FaultException.class, wsdlPart.getDataType()));
- }
- }
- return faultTypes;
- }
-
- private DataType<List<DataType>> getMessageType(Message message) throws InvalidWSDLException {
- List<DataType> partTypes = new ArrayList<DataType>();
- if (message != null) {
- Collection parts = message.getOrderedParts(null);
- for (Object p : parts) {
- WSDLPart part = new WSDLPart((Part)p, Object.class);
- DataType<XMLType> partType = part.getDataType();
- partTypes.add(partType);
- }
- }
- return new DataTypeImpl<List<DataType>>(dataBinding, Object[].class, partTypes);
- }
-
- /**
- * @return
- * @throws NotSupportedWSDLException
- */
- public Operation getOperation() throws InvalidWSDLException {
- if (operationModel == null) {
- boolean oneway = (operation.getOutput() == null);
- operationModel = new WSDLOperationImpl();
- operationModel.setWsdlOperation(operation);
- operationModel.setName(operation.getName());
- operationModel.setFaultTypes(getFaultTypes());
- operationModel.setNonBlocking(oneway);
- operationModel.setConversationSequence(ConversationSequence.CONVERSATION_NONE);
- operationModel.setInputType(getInputType());
- operationModel.setOutputType(getOutputType());
-
- // FIXME: [rfeng] How to determine the parameter mode?
- for (DataType d : operationModel.getInputType().getLogical()) {
- operationModel.getParameterModes().add(ParameterMode.IN);
- }
-
- operationModel.setInputWrapperStyle(isWrapperStyle());
- operationModel.setOutputWrapperStyle(isWrapperStyle());
- if (isWrapperStyle()) {
- operationModel.setInputWrapper(getWrapper().getInputWrapperInfo());
- operationModel.setOutputWrapper(getWrapper().getOutputWrapperInfo());
- }
- }
- return operationModel;
- }
-
- private XmlSchemaElement getElement(QName elementName) {
-
- XmlSchemaElement element = wsdlDefinition.getXmlSchemaElement(elementName);
- if (element == null) {
- XSDefinition definition = xsdFactory.createXSDefinition();
- definition.setUnresolved(true);
- definition.setNamespace(elementName.getNamespaceURI());
- definition = resolver.resolveModel(XSDefinition.class, definition);
- if (definition.getSchema() != null) {
- element = definition.getSchema().getElementByName(elementName);
- }
- }
- return element;
- }
-
- private XmlSchemaType getType(QName typeName) {
- XmlSchemaType type = wsdlDefinition.getXmlSchemaType(typeName);
- if (type == null) {
- XSDefinition definition = xsdFactory.createXSDefinition();
- definition.setUnresolved(true);
- definition.setNamespace(typeName.getNamespaceURI());
- definition = resolver.resolveModel(XSDefinition.class, definition);
- if (definition.getSchema() != null) {
- type = definition.getSchema().getTypeByName(typeName);
- }
- }
- return type;
- }
-
- /**
- * Metadata for a WSDL part
- */
- public class WSDLPart {
- private Part part;
-
- private XmlSchemaElement element;
-
- private DataType dataType;
-
- public WSDLPart(Part part, Class javaType) throws InvalidWSDLException {
- this.part = part;
- QName elementName = part.getElementName();
- if (elementName != null) {
- element = WSDLOperationIntrospectorImpl.this.getElement(elementName);
- if (element == null) {
- throw new InvalidWSDLException("Element cannot be resolved: " + elementName.toString());
- }
- } else {
- // Create an faked XSD element to host the metadata
- element = new XmlSchemaElement();
- element.setName(part.getName());
- element.setQName(new QName(null, part.getName()));
- QName typeName = part.getTypeName();
- if (typeName != null) {
- XmlSchemaType type = WSDLOperationIntrospectorImpl.this.getType(typeName);
- if (type == null) {
- throw new InvalidWSDLException("Type cannot be resolved: " + typeName.toString());
- }
- element.setSchemaType(type);
- element.setSchemaTypeName(type.getQName());
- }
- }
- XMLType xmlType = new XMLType(getElementInfo(element));
- xmlType.setNillable(element.isNillable());
- xmlType.setMany(element.getMaxOccurs() > 1);
- dataType = new DataTypeImpl<XMLType>(dataBinding, javaType, xmlType);
- }
-
- /**
- * @return the element
- */
- public XmlSchemaElement getElement() {
- return element;
- }
-
- /**
- * @return the part
- */
- public Part getPart() {
- return part;
- }
-
- /**
- * @return the dataType
- */
- public DataType<XMLType> getDataType() {
- return dataType;
- }
- }
-
- /**
- * The "Wrapper Style" WSDL operation is defined by The Java API for
- * XML-Based Web Services (JAX-WS) 2.0 specification, section 2.3.1.2
- * Wrapper Style. <p/> A WSDL operation qualifies for wrapper style mapping
- * only if the following criteria are met:
- * <ul>
- * <li>(i) The operation�s input and output messages (if present) each
- * contain only a single part
- * <li>(ii) The input message part refers to a global element declaration
- * whose localname is equal to the operation name
- * <li>(iii) The output message part refers to a global element declaration
- * <li>(iv) The elements referred to by the input and output message parts
- * (henceforth referred to as wrapper elements) are both complex types
- * defined using the xsd:sequence compositor
- * <li>(v) The wrapper elements only contain child elements, they must not
- * contain other structures such as wildcards (element or attribute),
- * xsd:choice, substitution groups (element references are not permitted) or
- * attributes; furthermore, they must not be nillable.
- * </ul>
- */
- public class Wrapper {
- private XmlSchemaElement inputWrapperElement;
-
- private XmlSchemaElement outputWrapperElement;
-
- private List<XmlSchemaElement> inputElements;
-
- private List<XmlSchemaElement> outputElements;
-
- // private DataType<List<DataType<XMLType>>> unwrappedInputType;
- //
- // private DataType<XMLType> unwrappedOutputType;
-
- private transient WrapperInfo inputWrapperInfo;
- private transient WrapperInfo outputWrapperInfo;
-
- private List<XmlSchemaElement> getChildElements(XmlSchemaElement element) throws InvalidWSDLException {
- if (element == null) {
- return null;
- }
- if (element.isNillable()) {
- // Wrapper element cannot be nillable
- return null;
- }
- XmlSchemaType type = element.getSchemaType();
- if (type == null) {
- String qName = element.getQName().toString();
- throw new InvalidWSDLException("The XML schema element does not have a type: " + qName);
- }
- if (!(type instanceof XmlSchemaComplexType)) {
- // Has to be a complexType
- return null;
- }
- XmlSchemaComplexType complexType = (XmlSchemaComplexType)type;
- if (complexType.getAttributes().getCount() != 0 || complexType.getAnyAttribute() != null) {
- // No attributes
- return null;
- }
- XmlSchemaParticle particle = complexType.getParticle();
- if (particle == null) {
- // No particle
- return Collections.emptyList();
- }
- if (!(particle instanceof XmlSchemaSequence)) {
- return null;
- }
- XmlSchemaSequence sequence = (XmlSchemaSequence)complexType.getParticle();
- XmlSchemaObjectCollection items = sequence.getItems();
- List<XmlSchemaElement> childElements = new ArrayList<XmlSchemaElement>();
- for (int i = 0; i < items.getCount(); i++) {
- XmlSchemaObject schemaObject = items.getItem(i);
- if (!(schemaObject instanceof XmlSchemaElement)) {
- // Should contain elements only
- return null;
- }
- XmlSchemaElement childElement = (XmlSchemaElement)schemaObject;
- /*
- if (childElement.getSubstitutionGroup() != null) {
- return null;
- }
- */
- if (childElement.getName() == null || childElement.getRefName() != null) {
- XmlSchemaElement ref = getElement(childElement.getRefName());
- if (ref == null) {
- throw new InvalidWSDLException("XML schema element ref cannot be resolved: " + childElement);
- }
- childElement = ref;
- }
- if (ANY.equals(childElement.getQName())) {
- // Wildcard is not allowed
- return null;
- }
- // TODO: Do we support maxOccurs >1 ?
- if (childElement.getMaxOccurs() > 1) {
- // TODO: [rfeng] To be implemented
- /*
- if(logger.isLoggable(Level.WARNING)) {
- logger.warning("Support for elements with maxOccurs>1 is not implemented.");
- }
- */
- // return null;
- }
- childElements.add(childElement);
- }
- return childElements;
- }
-
- /**
- * Return a list of child XSD elements under the wrapped request element
- *
- * @return a list of child XSD elements or null if if the request
- * element is not wrapped
- */
- public List<XmlSchemaElement> getInputChildElements() throws InvalidWSDLException {
- if (inputElements != null) {
- return inputElements;
- }
- Input input = operation.getInput();
- if (input != null) {
- Message inputMsg = input.getMessage();
- Collection parts = inputMsg.getParts().values();
- if (parts.size() != 1) {
- return null;
- }
- Part part = (Part)parts.iterator().next();
- QName elementName = part.getElementName();
- if (elementName == null) {
- return null;
- }
- if (!operation.getName().equals(elementName.getLocalPart())) {
- return null;
- }
- inputWrapperElement = getElement(elementName);
- if (inputWrapperElement == null) {
- throw new InvalidWSDLException("The element is not declared in a XML schema: " + elementName
- .toString());
- }
- if (inputWrapperElement.isNillable()) {
- // The wrapper element cannot be nilable
- return null;
- }
- inputElements = getChildElements(inputWrapperElement);
- return inputElements;
- } else {
- return null;
- }
- }
-
- /**
- * Return a list of child XSD elements under the wrapped response
- * element
- *
- * @return a list of child XSD elements or null if if the response
- * element is not wrapped
- */
- public List<XmlSchemaElement> getOutputChildElements() throws InvalidWSDLException {
- if (outputElements != null) {
- return outputElements;
- }
- Output output = operation.getOutput();
- if (output != null) {
- Message outputMsg = output.getMessage();
- Collection parts = outputMsg.getParts().values();
- if (parts.size() != 1) {
- return null;
- }
- Part part = (Part)parts.iterator().next();
- QName elementName = part.getElementName();
- if (elementName == null) {
- throw new InvalidWSDLException("The element is not declared in the XML schema: " + part.getName());
- }
- outputWrapperElement = WSDLOperationIntrospectorImpl.this.getElement(elementName);
- if (outputWrapperElement == null) {
- return null;
- }
- if (outputWrapperElement.isNillable()) {
- // The wrapper element cannot be nilable
- return null;
- }
- outputElements = getChildElements(outputWrapperElement);
- // FIXME: Do we support multiple child elements for the response?
- return outputElements;
- } else {
- return null;
- }
- }
-
- /**
- * @return the inputWrapperElement
- */
- public XmlSchemaElement getInputWrapperElement() {
- return inputWrapperElement;
- }
-
- /**
- * @return the outputWrapperElement
- */
- public XmlSchemaElement getOutputWrapperElement() {
- return outputWrapperElement;
- }
-
- /*
- public DataType<List<DataType<XMLType>>> getUnwrappedInputType() throws InvalidWSDLException {
- if (unwrappedInputType == null) {
- List<DataType<XMLType>> childTypes = new ArrayList<DataType<XMLType>>();
- for (XmlSchemaElement element : getInputChildElements()) {
- DataType<XMLType> type =
- new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
- // type.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
- childTypes.add(type);
- }
- unwrappedInputType =
- new DataType<List<DataType<XMLType>>>("idl:unwrapped.input", Object[].class, childTypes);
- }
- return unwrappedInputType;
- }
-
- public DataType<XMLType> getUnwrappedOutputType() throws InvalidServiceContractException {
- if (unwrappedOutputType == null) {
- List<XmlSchemaElement> elements = getOutputChildElements();
- if (elements != null && elements.size() > 0) {
- if (elements.size() > 1) {
- // We don't support output with multiple parts
- throw new NotSupportedWSDLException("Multi-part output is not supported");
- }
- XmlSchemaElement element = elements.get(0);
- unwrappedOutputType =
- new DataType<XMLType>(dataBinding, Object.class, new XMLType(getElementInfo(element)));
- // unwrappedOutputType.setMetadata(ElementInfo.class.getName(), getElementInfo(element));
- }
- }
- return unwrappedOutputType;
- }
- */
-
- public WrapperInfo getInputWrapperInfo() throws InvalidWSDLException {
- if (inputWrapperInfo == null) {
- ElementInfo in = getElementInfo(getInputWrapperElement());
- List<ElementInfo> inChildren = new ArrayList<ElementInfo>();
- if (in != null) {
- for (XmlSchemaElement e : getInputChildElements()) {
- inChildren.add(getElementInfo(e));
- }
- }
-
- inputWrapperInfo = new WrapperInfo(dataBinding, in, inChildren);
- }
- return inputWrapperInfo;
- }
-
- public WrapperInfo getOutputWrapperInfo() throws InvalidWSDLException {
- if (outputWrapperInfo == null) {
- ElementInfo out = getElementInfo(getOutputWrapperElement());
- List<ElementInfo> outChildren = new ArrayList<ElementInfo>();
- if (out != null) {
- for (XmlSchemaElement e : getOutputChildElements()) {
- outChildren.add(getElementInfo(e));
- }
- }
- outputWrapperInfo = new WrapperInfo(dataBinding, out, outChildren);
- }
- return outputWrapperInfo;
- }
- }
-
- private static ElementInfo getElementInfo(XmlSchemaElement element) {
- if (element == null) {
- return null;
- }
- ElementInfo elementInfo = new ElementInfo(element.getQName(), getTypeInfo(element.getSchemaType()));
- elementInfo.setMany(element.getMaxOccurs() > 1);
- elementInfo.setNillable(element.isNillable());
- return elementInfo;
- }
-
- private static TypeInfo getTypeInfo(XmlSchemaType type) {
- if (type == null) {
- return null;
- }
- XmlSchemaType baseType = (XmlSchemaType)type.getBaseSchemaType();
- QName name = type.getQName();
- boolean simple = (type instanceof XmlSchemaSimpleType);
- if (baseType == null) {
- return new TypeInfo(name, simple, null);
- } else {
- return new TypeInfo(name, simple, getTypeInfo(baseType));
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory b/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory
deleted file mode 100644
index c11d22d7b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface-wsdl/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory
+++ /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.interfacedef.wsdl.DefaultWSDLFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/interface/LICENSE b/branches/sca-java-1.5.1/modules/interface/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/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-java-1.5.1/modules/interface/NOTICE b/branches/sca-java-1.5.1/modules/interface/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/interface/pom.xml b/branches/sca-java-1.5.1/modules/interface/pom.xml
deleted file mode 100644
index 3ec425facb..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/pom.xml
+++ /dev/null
@@ -1,57 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-interface</artifactId>
- <name>Apache Tuscany SCA Interface Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.interface</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.interfacedef*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.java
deleted file mode 100644
index 247a432330..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ConversationSequence.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.interfacedef;
-
-/**
- * Enum of the Conversation Sequence values.
- *
- * @version $Rev$ $Date$
- */
-public enum ConversationSequence {
- CONVERSATION_NONE, CONVERSATION_START, CONVERSATION_CONTINUE, CONVERSATION_END
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java
deleted file mode 100644
index 63e26ef7f7..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/DataType.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef;
-
-import java.lang.reflect.Type;
-
-/**
- * Representation of the type of data associated with an operation. Data is
- * represented in two forms: the physical form used by the runtime and a logical
- * form used by the assembly. The physical form is a Java Type because the
- * runtime is written in Java. This may be the same form used by the application
- * but it may not; for example, an application that is performing stream
- * processing may want a physical form such as an
- * {@link java.io.InputStream InputStream} to semantically operate on application
- * data such as a purchase order. The logical description is that used by the
- * assembly model and is an identifier into some well-known type space; examples
- * may be a Java type represented by its Class or an XML type represented by its
- * QName. Every data type may also contain metadata describing the expected
- * data; for example, it could specify a preferred data binding technology or
- * the size of a typical instance.
- *
- * @version $Rev$ $Date$
- */
-public interface DataType<L> extends Cloneable {
- /**
- * Set the java type for the data
- * @param cls
- */
- void setPhysical(Class<?> cls);
-
- /**
- * Returns the physical type used by the runtime.
- *
- * @return the physical type used by the runtime
- */
- Class<?> getPhysical();
-
- /**
- * Get the java generic type
- * @return The java generic type
- */
- Type getGenericType();
-
- /**
- * Set the java generic type
- * @param genericType
- */
- void setGenericType(Type genericType);
-
- /**
- * Returns the logical identifier used by the assembly. The type of this
- * value identifies the logical type system in use. Known values are:
- * <ul>
- * <li>a Class identifies a Java type by name and
- * ClassLoader; this includes Java Classes as they are specializations of
- * Type</li>
- * <li>a XMLType identifies an XML type by local name and
- * namespace</li>
- * </ul>
- *
- * @return the logical type name
- */
- L getLogical();
-
- /**
- * Get the databinding for the given data type
- * @return the databinding
- */
- String getDataBinding();
-
- /**
- * Set the databinding for the given data type
- * @param dataBinding the dataBinding to set
- */
- void setDataBinding(String dataBinding);
-
- /**
- * Clone a data type
- * @return The cloned data type
- * @throws CloneNotSupportedException
- */
- Object clone() throws CloneNotSupportedException;
-
- /**
- * Set the logical type of the data type
- * @param logical the logical to set
- */
- void setLogical(L logical);
-
- /**
- * Get the databinding-specific metadata
- * @param type The java type of the metadata
- * @return the databinding-specific metadata
- */
- <T> T getMetaData(Class<T> type);
- /**
- * Set the databinding-specific metadata
- * @param type The java type of the metadata
- * @param metaData the databinding-specific metadata, such as SDO's commonj.sdo.Type or
- * JAXB's javax.xml.bind.JAXBContext
- */
- <T> void setMetaData(Class<T> type, T metaData);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.java
deleted file mode 100644
index 70f6d5b403..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/FaultExceptionMapper.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.interfacedef;
-
-/**
- * This interface represents the mapping between WSDL faults and Java exceptions
- *
- * @version $Rev$ $Date$
- */
-@SuppressWarnings("unchecked")
-public interface FaultExceptionMapper {
- /**
- * Introspect an exception class to find out the fault data type following the WSDL2Java
- * mapping rules. The result will be populated into the logical type of the exception data
- * type
- *
- * @param exceptionDataType The data type representing a java exception class
- * @param operation TODO
- * @param generatingFaultBean If JAXWS Section 3.7 Fault Bean will be generated
- * @return true if the introspection can recognize the exception data type
- */
- boolean introspectFaultDataType(DataType<DataType> exceptionDataType, Operation operation, boolean generatingFaultBean);
-
- /**
- * Create a java exception to wrap the fault data
- *
- * @param exceptionType The DataType for the exception
- * @param message message for the exception
- * @param faultInfo The fault data
- * @param cause of the exception
- * @param operation TODO
- * @return An instance of java exception to represent the fault
- */
- Throwable wrapFaultInfo(DataType<DataType> exceptionType, String message, Object faultInfo, Throwable cause, Operation operation);
-
- /**
- * Retrieve the fault info from a java exception
- *
- * @param exception The java exception that represents the fault data
- * @param faultBeanClass
- * @param operation TODO
- * @return The fault data
- */
- Object getFaultInfo(Throwable exception, Class<?> faultBeanClass, Operation operation);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java
deleted file mode 100644
index 179dc1755e..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/IncompatibleInterfaceContractException.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef;
-
-/**
- * Denotes incompatible service contracts for a wire
- *
- * @version $Rev$ $Date$
- */
-public class IncompatibleInterfaceContractException extends Exception {
- private static final long serialVersionUID = 5127478601823295587L;
- private final InterfaceContract source;
- private final InterfaceContract target;
- private final Operation sourceOperation;
- private final Operation targetOperation;
-
- public IncompatibleInterfaceContractException(String message, InterfaceContract source, InterfaceContract target) {
- super(message);
- this.source = source;
- this.target = target;
- this.sourceOperation = null;
- this.targetOperation = null;
- }
-
- public IncompatibleInterfaceContractException(String message,
- InterfaceContract source,
- InterfaceContract target,
- Operation sourceOperation,
- Operation targetOperation) {
- super(message);
- this.source = source;
- this.target = target;
- this.sourceOperation = sourceOperation;
- this.targetOperation = targetOperation;
- }
-
- public InterfaceContract getTarget() {
- return target;
- }
-
- public InterfaceContract getSource() {
- return source;
- }
-
- public Operation getSourceOperation() {
- return sourceOperation;
- }
-
- public Operation getTargetOperation() {
- return targetOperation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.java
deleted file mode 100644
index 1e91dc6fdb..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Interface.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.interfacedef;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents a service interface. This interface will typically be extended to
- * support concrete interface type systems, such as Java interfaces, WSDL 1.1
- * portTypes and WSDL 2.0 interfaces.
- *
- * @version $Rev$ $Date$
- */
-public interface Interface extends Cloneable, PolicySetAttachPoint {
-
- /**
- * Returns true if the interface is a remotable interface..
- *
- * @return true if the interface is a remotable interface
- */
- boolean isRemotable();
-
- /**
- * Sets whether the interface is a remotable or local interface.
- *
- * @param remotable indicates whether the interface is remotable or local
- */
- void setRemotable(boolean remotable);
-
-
- // FIXME: [rfeng] We need to re-consider the conversational as an intent
- /**
- * Test if the interface is conversational
- * @return
- */
- boolean isConversational();
-
- /**
- * Set whether the interface is conversational
- * @param conversational
- */
- void setConversational(boolean conversational);
-
- /**
- * Returns the operations defined on this interface.
- *
- * @return the operations defined on this interface
- */
- List<Operation> getOperations();
-
- /**
- * Set the databinding for the interface
- * @param dataBinding
- * @deprecated Please use resetDataBinding
- */
- @Deprecated
- void setDefaultDataBinding(String dataBinding);
-
- /**
- * Reset the databinding for the interface
- * @param dataBinding
- */
- void resetDataBinding(String dataBinding);
-
- /**
- * Set the interface input types by copying those from the
- * interface provided
- *
- * @param newInterface
- */
- public void resetInterfaceInputTypes(Interface newInterface);
-
- /**
- * Set the interface output types by copying those from the
- * interface provided
- *
- * @param newInterface
- */
- public void resetInterfaceOutputTypes(Interface newInterface);
-
- /**
- * Returns true if the Interface is dynamic.
- *
- * @return true if the Interface is dynamic.
- */
- boolean isDynamic();
-
- /**
- * Implementations must support cloning.
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.java
deleted file mode 100644
index 568a6c595c..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContract.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.interfacedef;
-
-
-/**
- * Interface contracts define one or more business functions. These business
- * functions are provided by services and are used by references.
- *
- * @version $Rev$ $Date$
- */
-public interface InterfaceContract extends Cloneable {
-
- /**
- * Returns the interface definition representing the interface for
- * invocations from the requestor to the provider.
- *
- * @return the interface definition representing the interface for
- * invocations from the requestor to the provider
- */
- Interface getInterface();
-
- /**
- * Sets the interface definition representing the interface for invocations
- * from the requestor to the provider.
- *
- * @param callInterface the interface definition representing the interface
- * for invocations from the requestor to the provider
- */
- void setInterface(Interface callInterface);
-
- /**
- * Returns the interface definition representing the interface for
- * invocations from the provider to the requestor.
- *
- * @return the interface definition representing the interface for
- * invocations from the provider to the requestor.
- */
- Interface getCallbackInterface();
-
- /**
- * Sets the interface definition representing the interface for invocations
- * from the provider to the requestor.
- *
- * @param callbackInterface the interface definition representing the
- * interface for invocations from the provider to the requestor.
- */
- void setCallbackInterface(Interface callbackInterface);
-
- // FIXME: We need a better way to do this
- /**
- * Convert an interface contract to a unidirectional interface contract
- *
- * @param isCallback true for a callback interface contract, false for
- * a forward interface contract
- * @return A unidirectional interface contract, cloned if necessary
- */
- InterfaceContract makeUnidirectional(boolean isCallback);
-
- /**
- * Implementations must support cloning.
- */
- Object clone() throws CloneNotSupportedException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.java
deleted file mode 100644
index 5601b09660..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InterfaceContractMapper.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.interfacedef;
-
-/**
- * The InterfaceContractMapper is responsible to match interfaces
- *
- * @version $Rev$ $Date$
- */
-public interface InterfaceContractMapper {
- /**
- * Check the compatibility of the source and the target interface contracts.
- * <p>
- * A wire may only connect a source to a target if the target implements an
- * interface that is compatible with the interface required by the source.
- * The source and the target are compatible if: <p/>
- * <ol>
- * <li>the source interface and the target interface MUST either both be
- * remotable or they are both local
- * <li>the methods on the target interface MUST be the same as or be a
- * superset of the methods in the interface specified on the source
- * <li>compatibility for the individual method is defined as compatibility
- * of the signature, that is method name, input types, and output types MUST
- * BE the same.
- * <li>the order of the input and output types also MUST BE the same.
- * <li>the set of Faults and Exceptions expected by the source MUST BE the
- * same or be a superset of those specified by the service.
- * <li>other specified attributes of the two interfaces MUST match,
- * including Scope and Callback interface
- * </ol>
- * <p/>
- * <p>
- * Please note this test is not symmetric: the success of isCompatible(A, B)
- * does NOT imply isCompatible(B, A)
- *
- * @param source The source interface contract
- * @param target The target interface contract
- * @return true if the source contract can be supported by the target
- * contract
- */
- boolean isCompatible(InterfaceContract source, InterfaceContract target);
-
- /**
- * @param source
- * @param target
- * @param ignoreCallback
- * @param silent
- * @return
- * @throws IncompatibleInterfaceContractException
- */
- boolean checkCompatibility(InterfaceContract source,
- InterfaceContract target,
- boolean ignoreCallback,
- boolean silent) throws IncompatibleInterfaceContractException;
-
- /**
- * Test if the source data type is compatible with the target data type. The
- * compatibility is defined as follows.
- * <ul>
- * <li>source's logical type is either the same or subtype of the target's
- * logical type
- * </ul>
- * For example, if the source type is a SDO Customer and the target type is
- * a JAXB Customer and both Customer are generated from the same XSD type.
- *
- * @param source The source data type
- * @param target The target data type
- * @return
- */
- boolean isCompatible(DataType source, DataType target, boolean remotable);
-
- /**
- * Check if source operation is compatible with the target operation
- *
- * @param source The source operation
- * @param target The target operation
- * @return true if the source operation is compatible with the target
- * operation
- */
- boolean isCompatible(Operation source, Operation target, boolean remotable);
-
- /**
- * @param source
- * @param target
- * @return
- */
- boolean isCompatible(Interface source, Interface target);
-
- /**
- * Map the source operation to a compatible operation in the target
- * interface
- *
- * @param target The target interface
- * @param source The source operation
- * @return A compatible operation
- */
- Operation map(Interface target, Operation source);
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java
deleted file mode 100644
index f952a86478..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidCallbackException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef;
-
-
-/**
- * Denotes an illegal callback interface
- *
- * @version $Rev$ $Date$
- */
-
-public class InvalidCallbackException extends InvalidInterfaceException {
- private static final long serialVersionUID = 2727755895702116397L;
-
- public InvalidCallbackException(String message) {
- super(message);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.java
deleted file mode 100644
index 2a273c9a26..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidInterfaceException.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.interfacedef;
-
-/**
- * @version $Rev$ $Date$
- */
-public abstract class InvalidInterfaceException extends Exception {
-
- public InvalidInterfaceException() {
- super();
- }
-
- public InvalidInterfaceException(String message) {
- super(message);
- }
-
- public InvalidInterfaceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public InvalidInterfaceException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.java
deleted file mode 100644
index b19805c5b1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/InvalidOperationException.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.interfacedef;
-
-import java.lang.reflect.Method;
-
-/**
- * Denotes an invalid conversational interface definition
- *
- * @version $Rev$ $Date$
- */
-public class InvalidOperationException extends InvalidInterfaceException {
-
- private static final long serialVersionUID = -1797615361821517091L;
- private final Method operation;
-
- public InvalidOperationException(String message, Method operation) {
- super(message);
- this.operation = operation;
- }
-
- public Method getOperation() {
- return operation;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java
deleted file mode 100644
index 395960d04f..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/Operation.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Represents an operation on a service interface.
- *
- * @version $Rev$ $Date$
- */
-public interface Operation extends Cloneable, PolicySetAttachPoint {
- /**
- * Returns the name of the operation.
- *
- * @return the name of the operation
- */
- String getName();
-
- /**
- * Sets the name of the operation.
- *
- * @param name the name of the operation
- */
- void setName(String name);
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
- /**
- * Get the data type that represents the input of this operation. The logic
- * type is a list of data types and each element represents a parameter
- *
- * @return the inputType
- */
- DataType<List<DataType>> getInputType();
-
- /**
- * @param inputType
- */
- void setInputType(DataType<List<DataType>> inputType);
-
- /**
- * Get the data type for the output
- *
- * @return the outputType
- */
- DataType getOutputType();
-
- /**
- * @param outputType
- */
- void setOutputType(DataType outputType);
-
- /**
- * Get a list of data types to represent the faults/exceptions
- *
- * @return the faultTypes
- */
- List<DataType> getFaultTypes();
-
- /**
- * @param faultTypes
- */
- void setFaultTypes(List<DataType> faultTypes);
-
- /**
- * Get the owning interface
- * @return
- */
- Interface getInterface();
-
- /**
- * Set the owning interface
- * @param interfaze
- */
- void setInterface(Interface interfaze);
-
- /**
- * Get the sequence of the conversation
- * @return
- */
- ConversationSequence getConversationSequence();
-
- /**
- * Set the sequence of conversation for the operation
- * @param sequence
- */
- void setConversationSequence(ConversationSequence sequence);
-
- /**
- * Indicate if the operation is non-blocking
- * @return
- */
- boolean isNonBlocking();
-
- /**
- * Set the operation to be non-blocking
- */
- void setNonBlocking(boolean nonBlocking);
-
- /**
- * @return the inputWrapperInfo
- */
- WrapperInfo getInputWrapper();
-
- /**
- * @param wrapperInfo the inputWrapperInfo to set
- */
- void setInputWrapper(WrapperInfo wrapperInfo);
-
- /**
- * @return the outputWrapperInfo
- */
- WrapperInfo getOutputWrapper();
-
- /**
- * @param wrapperInfo the outputWrapperInfo to set
- */
- // TODO - WI
- void setOutputWrapper(WrapperInfo wrapperInfo);
-
- /**
- * @return the inputWrapperStyle
- */
- boolean isInputWrapperStyle();
-
- /**
- * @param inputWrapperStyle the wrapperStyle to set
- */
- void setInputWrapperStyle(boolean wrapperStyle);
-
- /**
- * @return the outputWrapperStyle
- */
- boolean isOutputWrapperStyle();
-
- /**
- * @param outputWrapperStyle the wrapperStyle to set
- */
- void setOutputWrapperStyle(boolean wrapperStyle);
-
- /**
- * @deprecated This should be the WrapperInfo.getDataBinding()
- * Get the databinding for the operation
- * @return
- */
- @Deprecated
- String getDataBinding();
-
- /**
- * @deprecated This should be the WrapperInfo.setDataBinding()
- * Set the databinding for the operation
- * @param dataBinding
- */
- @Deprecated
- void setDataBinding(String dataBinding);
-
- /**
- * Returns true if the operation is dynamic.
- *
- * @return true if the operation is dynamic otherwise false
- */
- boolean isDynamic();
-
- /**
- * Set if the operation is dynamic
- * @param b
- */
- void setDynamic(boolean b);
-
- /**
- * Get the synthesized fault beans for this operation
- *
- * @return the fault beans
- */
- Map<QName, List<DataType<XMLType>>> getFaultBeans();
-
- /**
- * Set the synthesized fault beans for this operation
- * @param faultBeans
- */
- void setFaultBeans(Map<QName, List<DataType<XMLType>>> faultBeans);
-
- /**
- * Implementations must support cloning.
- */
- Object clone() throws CloneNotSupportedException;
-
- List<ParameterMode> getParameterModes();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.java
deleted file mode 100644
index 6773b29088..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/OverloadedOperationException.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.interfacedef;
-
-import java.lang.reflect.Method;
-
-/**
- * Exception thrown to indicate that a service contract specification contains
- * an overloaded method.
- *
- * @version $Rev$ $Date$
- */
-public class OverloadedOperationException extends InvalidInterfaceException {
- private static final long serialVersionUID = -4658711318608885638L;
- private final Method operation;
-
- public OverloadedOperationException(Method operation) {
- super(operation == null ?
- null : "Cannot overload operation " + operation.getName()
- + " on " + operation.getDeclaringClass().getName()
- + " as it is a @Remotable interface");
- this.operation = operation;
- }
-
- public Method getOperation() {
- return operation;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.java
deleted file mode 100644
index c4244a3480..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/ParameterMode.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.interfacedef;
-
-/**
- * Parameter mode
- * @see http://java.sun.com/javase/6/docs/api/javax/jws/WebParam.Mode.html
- */
-public enum ParameterMode {
- IN, OUT, INOUT;
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.java
deleted file mode 100644
index 8fa91a8e52..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/DataTypeImpl.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.interfacedef.impl;
-
-import java.lang.reflect.Type;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-
-/**
- * Representation of the type of data associated with an operation. Data is
- * represented in two forms: the physical form used by the runtime and a logical
- * form used by the assembly. The physical form is a Java Type because the
- * runtime is written in Java. This may be the same form used by the application
- * but it may not; for example, an application that is performing stream
- * processing may want a physical form such as an
- * {@link java.io.InputStream InputStream} to semantially operate on application
- * data such as a purchase order. The logical description is that used by the
- * assembly model and is an identifier into some well-known type space; examples
- * may be a Java type represented by its Class or an XML type represented by its
- * QName. Every data type may also contain metadata describing the expected
- * data; for example, it could specify a preferred data binding technology or
- * the size of a typical instance.
- *
- * @version $Rev$ $Date$
- */
-public class DataTypeImpl<L> implements DataType<L> {
- private String dataBinding;
- private Class<?> physical;
- private Type genericType;
- private L logical;
- private Map<Class<?>, Object> metaDataMap;
-
- /**
- * Construct a data type specifying the physical and logical types.
- *
- * @param physical the physical class used by the runtime
- * @param logical the logical type
- * @see #getLogical()
- */
- public DataTypeImpl(Class<?> physical, L logical) {
- this(null, physical, physical, logical);
- }
-
- /**
- * @param dataBinding
- * @param physical
- * @param logical
- */
- public DataTypeImpl(String dataBinding, Class<?> physical, L logical) {
- this(dataBinding, physical, physical, logical);
- }
-
- /**
- * @param dataBinding
- * @param physical
- * @param genericType
- * @param logical
- */
- public DataTypeImpl(String dataBinding, Class<?> physical, Type genericType, L logical) {
- super();
- this.dataBinding = dataBinding;
- this.physical = physical;
- this.genericType = genericType;
- this.logical = logical;
- }
-
- /**
- * Returns the physical type used by the runtime.
- *
- * @return the physical type used by the runtime
- */
- public Class<?> getPhysical() {
- return physical;
- }
-
- /**
- * @param physical the physical to set
- */
- public void setPhysical(Class<?> physical) {
- this.physical = physical;
- }
-
- /**
- * Get the java generic type
- * @return The java generic type
- */
- public Type getGenericType() {
- return genericType;
- }
-
- /**
- * Set the java generic type
- * @param genericType
- */
- public void setGenericType(Type genericType) {
- this.genericType = genericType;
- }
-
- /**
- * Returns the logical identifier used by the assembly. The type of this
- * value identifies the logical type system in use. Known values are:
- * <ul>
- * <li>a java.lang.reflect.Type identifies a Java type by name and
- * ClassLoader; this includes Java Classes as they are specializations of
- * Type</li>
- * <li>a javax.xml.namespace.QName identifies an XML type by local name and
- * namespace</li>
- * </ul>
- *
- * @return the logical type name
- */
- public L getLogical() {
- return logical;
- }
-
- /**
- * @param logical the logical to set
- */
- public void setLogical(L logical) {
- this.logical = logical;
- }
-
- public String getDataBinding() {
- return dataBinding;
- }
-
- /**
- * @param dataBinding the dataBinding to set
- */
- public void setDataBinding(String dataBinding) {
- this.dataBinding = dataBinding;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Object clone() throws CloneNotSupportedException {
- DataTypeImpl copy = (DataTypeImpl)super.clone();
- return copy;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((dataBinding == null) ? 0 : dataBinding.hashCode());
- result = prime * result + ((genericType == null) ? 0 : genericType.hashCode());
- result = prime * result + ((logical == null) ? 0 : logical.hashCode());
- result = prime * result + ((physical == null) ? 0 : physical.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final DataTypeImpl other = (DataTypeImpl)obj;
- if (dataBinding == null) {
- if (other.dataBinding != null)
- return false;
- } else if (!dataBinding.equals(other.dataBinding))
- return false;
- if (genericType == null) {
- if (other.genericType != null)
- return false;
- } else if (!genericType.equals(other.genericType))
- return false;
- if (logical == null) {
- if (other.logical != null)
- return false;
- } else if (!logical.equals(other.logical))
- return false;
- if (physical == null) {
- if (other.physical != null)
- return false;
- } else if (!physical.equals(other.physical))
- return false;
- return true;
- }
-
- public <T> T getMetaData(Class<T> type) {
- return metaDataMap == null ? null : type.cast(metaDataMap.get(type));
- }
-
- public <T> void setMetaData(Class<T> type, T metaData) {
- if (metaDataMap == null) {
- metaDataMap = new ConcurrentHashMap<Class<?>, Object>();
- }
- metaDataMap.put(type, metaData);
- }
-
- @Override
- public String toString() {
- // private Class<?> physical;
- // private Type genericType;
- // private L logical;
- // private Map<Class<?>, Object> metaDataMap;
- StringBuilder b = new StringBuilder( 256 );
- b.append( "DataType[" );
- b.append( "dataBinding=" + ((dataBinding==null) ? "null" : dataBinding) );
- b.append( ", genericType=" + ((genericType==null) ? "null" : genericType) );
- b.append( ", physical=" + ((physical==null) ? "null" : physical) );
- b.append( ", logical=" + ((logical==null) ? "null" : logical) );
- b.append( ", metaData size=" + ((metaDataMap==null) ? "0" : metaDataMap.size()) );
- b.append( "]" );
- return b.toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.java
deleted file mode 100644
index 15581b5e04..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractImpl.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.interfacedef.impl;
-
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-
-/**
- * Represents an interface contract. InterfaceContractImpl
- *
- * @version $Rev$ $Date$
- */
-public abstract class InterfaceContractImpl implements InterfaceContract {
- private Interface callInterface;
- private Interface callbackInterface;
-
- public Interface getCallbackInterface() {
- return callbackInterface;
- }
-
- public Interface getInterface() {
- return callInterface;
- }
-
- public void setCallbackInterface(Interface callbackInterface) {
- this.callbackInterface = callbackInterface;
- }
-
- public void setInterface(Interface callInterface) {
- this.callInterface = callInterface;
- }
-
- public InterfaceContract makeUnidirectional(boolean isCallback) {
- if (!isCallback && callbackInterface == null)
- return this; // already a unidirectional forward interface contract
-
- if (isCallback && callInterface == null)
- return this; // already a unidirectional callback interface contract
-
- // contract is bidirectional, so create a new unidirectional contract
- try {
- InterfaceContract newContract = clone();
- if (!isCallback) {
- newContract.setCallbackInterface(null); // create unidirectional forward interface contract
- } else {
- newContract.setInterface(null); // create unidirectional callback interface contract
- }
- return newContract;
- } catch (CloneNotSupportedException e) {
- // will not happen
- return null;
- }
- }
-
- @Override
- public InterfaceContractImpl clone() throws CloneNotSupportedException {
- InterfaceContractImpl copy = (InterfaceContractImpl)super.clone();
- if (this.callbackInterface != null) {
- copy.callbackInterface = (Interface)this.callbackInterface.clone();
- }
- if (this.callInterface != null) {
- copy.callInterface = (Interface)this.callInterface.clone();
- }
- return copy;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((callInterface == null) ? 0 : callInterface.hashCode());
- result = prime * result + ((callbackInterface == null) ? 0 : callbackInterface.hashCode());
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final InterfaceContractImpl other = (InterfaceContractImpl)obj;
- if (callInterface == null) {
- if (other.callInterface != null) {
- return false;
- }
- } else if (!callInterface.equals(other.callInterface)) {
- return false;
- }
- if (callbackInterface == null) {
- if (other.callbackInterface != null) {
- return false;
- }
- } else if (!callbackInterface.equals(other.callbackInterface)) {
- return false;
- }
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
deleted file mode 100644
index 9aeeafe6b9..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractMapperImpl.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InterfaceContractMapperImpl implements InterfaceContractMapper {
-
- public boolean isCompatible(DataType source, DataType target, boolean remotable) {
- if (source == target) {
- return true;
- }
- if (!remotable) {
- if (source == null || target == null) {
- return false;
- }
- // For local case
- return target.getPhysical().isAssignableFrom(source.getPhysical());
- } else {
- // FIXME: How to test if two remotable data type is compatible?
- // return target.getLogical().equals(source.getLogical());
- return true;
- }
-
- }
-
- public boolean isCompatible(Operation source, Operation target, boolean remotable) {
- if (source == target) {
- return true;
- }
-
- if (source.isDynamic() || target.isDynamic()) {
- return true;
- }
-
- // Check name
- if (!source.getName().equals(target.getName())) {
- return false;
- }
-
- if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
- return false;
- }
-
- // if (source.getInterface().isRemotable()) {
- // return true;
- // }
-
- // FIXME: We need to deal with wrapped<-->unwrapped conversion
-
- // Check output type
- DataType sourceOutputType = source.getOutputType();
- DataType targetOutputType = target.getOutputType();
-
- // Note the target output type is now the source for checking
- // compatibility
- if (!isCompatible(targetOutputType, sourceOutputType, remotable)) {
- return false;
- }
-
- boolean checkSourceWrapper = true;
- List<DataType> sourceInputType = source.getInputType().getLogical();
- if (source.isInputWrapperStyle() && source.getInputWrapper() != null) {
- sourceInputType = source.getInputWrapper().getUnwrappedInputType().getLogical();
- checkSourceWrapper = false;
- }
- boolean checkTargetWrapper = true;
- List<DataType> targetInputType = target.getInputType().getLogical();
- if (target.isInputWrapperStyle() && target.getInputWrapper() != null) {
- targetInputType = target.getInputWrapper().getUnwrappedInputType().getLogical();
- checkTargetWrapper = false;
- }
-
- if (checkSourceWrapper != checkTargetWrapper) {
- return true;
- }
- if (sourceInputType.size() != targetInputType.size()) {
- return false;
- }
-
- int size = sourceInputType.size();
- for (int i = 0; i < size; i++) {
- if (!isCompatible(sourceInputType.get(i), targetInputType.get(i), remotable)) {
- return false;
- }
- }
-
- // Check fault types
- for (DataType targetFaultType : target.getFaultTypes()) {
- // Source fault types must be the same or superset of target fault
- // types
- boolean found = true;
- for (DataType sourceFaultType : source.getFaultTypes()) {
- found = false;
- if (isCompatible(targetFaultType, sourceFaultType, remotable)) {
- // Target fault type can be covered by the source fault type
- found = true;
- break;
- }
- }
- if (!found) {
- return false;
- }
- }
-
- return true;
- }
-
- // FIXME: How to improve the performance for the lookup
- private Operation getOperation(List<Operation> operations, String name) {
- for (Operation op : operations) {
- if (op.getName().equals(name)) {
- return op;
- }
- }
- return null;
- }
-
- public boolean checkCompatibility(InterfaceContract source,
- InterfaceContract target,
- boolean ignoreCallback,
- boolean silent) throws IncompatibleInterfaceContractException {
- if (source == target) {
- // Shortcut for performance
- return true;
- }
-
- if (source.getInterface().isDynamic() || target.getInterface().isDynamic()) {
- return true;
- }
-
- if (source.getInterface().isRemotable() != target.getInterface().isRemotable()) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Remotable settings do not match", source, target);
- } else {
- return false;
- }
- }
- if (source.getInterface().isConversational() != target.getInterface().isConversational()) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Interaction scopes do not match", source, target);
- } else {
- return false;
- }
- }
-
- for (Operation operation : source.getInterface().getOperations()) {
- Operation targetOperation = map(target.getInterface(), operation);
- if (targetOperation == null) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Operation not found on target", source, target);
- } else {
- return false;
- }
- }
- if (!source.getInterface().isRemotable()) {
- // FIXME: for remotable operation, only compare name for now
- if (!isCompatible(operation, targetOperation, false)) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Target operations are not compatible",
- source, target);
- } else {
- return false;
- }
- }
- }
- }
-
- if (ignoreCallback) {
- return true;
- }
-
- if (source.getCallbackInterface() == null && target.getCallbackInterface() == null) {
- return true;
- }
- if (source.getCallbackInterface() == null || target.getCallbackInterface() == null) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Callback interface doesn't match", source, target);
- } else {
- return false;
- }
- }
-
- for (Operation operation : source.getCallbackInterface().getOperations()) {
- Operation targetOperation = map(target.getCallbackInterface(), operation);
- if (targetOperation == null) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Callback operation not found on target", source,
- target, null, targetOperation);
- } else {
- return false;
- }
- }
- if (!source.getCallbackInterface().isRemotable()) {
- // FIXME: for remotable operation, only compare name for now
- if (!isCompatible(operation, targetOperation, false)) {
- if (!silent) {
- throw new IncompatibleInterfaceContractException("Target callback operation is not compatible",
- source, target, operation, targetOperation);
- } else {
- return false;
- }
- }
- }
- }
- return true;
- }
-
- public boolean isCompatible(Interface source, Interface target) {
- if (source == target) {
- // Shortcut for performance
- return true;
- }
- if (source == null || target == null) {
- return false;
- }
-
- if (source.isDynamic() || target.isDynamic()) {
- return true;
- }
-
- if (source.isRemotable() != target.isRemotable()) {
- return false;
- }
- if (source.isConversational() != target.isConversational()) {
- return false;
- }
-
- for (Operation operation : source.getOperations()) {
- Operation targetOperation = getOperation(target.getOperations(), operation.getName());
- if (targetOperation == null) {
- return false;
- }
- if (!isCompatible(operation, targetOperation, source.isRemotable())) {
- return false;
- }
- }
- return true;
- }
-
- public boolean isCompatible(InterfaceContract source, InterfaceContract target) {
- try {
- return checkCompatibility(source, target, false, false);
- } catch (IncompatibleInterfaceContractException e) {
- return false;
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.interfacedef.InterfaceContractMapper#map(org.apache.tuscany.sca.interfacedef.Interface,
- * org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Operation map(Interface target, Operation source) {
- // TODO: How to handle the case that source operation is dynamic?
- if (target == null || target.isDynamic()) {
- return source;
- } else if (target.isRemotable()) {
- for (Operation op : target.getOperations()) {
- if (op.getName().equals(source.getName())) {
- return op;
- }
- }
- return null;
- } else {
- for (Operation op : target.getOperations()) {
- if (isCompatible(source, op, target.isRemotable())) {
- return op;
- }
- }
- return null;
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
deleted file mode 100644
index 449ca5af9e..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceImpl.java
+++ /dev/null
@@ -1,331 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a service interface.
- *
- * @version $Rev$ $Date$
- */
-public class InterfaceImpl implements Interface {
-
- private boolean remotable;
- private boolean conversational;
- private OperationList operations = new OperationList();
- private boolean unresolved;
-
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private IntentAttachPointType type;
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
-
-
- public boolean isRemotable() {
- return remotable;
- }
-
- public void setRemotable(boolean local) {
- this.remotable = local;
- }
-
- public List<Operation> getOperations() {
- return operations;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- /**
- * @return the conversational
- */
- public boolean isConversational() {
- return conversational;
- }
-
- /**
- * @param conversational the conversational to set
- */
- public void setConversational(boolean conversational) {
- this.conversational = conversational;
- }
-
- private class OperationList extends ArrayList<Operation> {
- private static final long serialVersionUID = -903469106307606099L;
-
- @Override
- public Operation set(int index, Operation element) {
- element.setInterface(InterfaceImpl.this);
- return super.set(index, element);
- }
-
- @Override
- public void add(int index, Operation element) {
- element.setInterface(InterfaceImpl.this);
- super.add(index, element);
- }
-
- @Override
- public boolean add(Operation o) {
- o.setInterface(InterfaceImpl.this);
- return super.add(o);
- }
-
- @Override
- public boolean addAll(Collection<? extends Operation> c) {
- for (Operation op : c) {
- op.setInterface(InterfaceImpl.this);
- }
- return super.addAll(c);
- }
-
- @Override
- public boolean addAll(int index, Collection<? extends Operation> c) {
- for (Operation op : c) {
- op.setInterface(InterfaceImpl.this);
- }
- return super.addAll(index, c);
- }
-
- }
-
- @Deprecated
- public void setDefaultDataBinding(String dataBinding) {
- for (Operation op : getOperations()) {
- if (op.getDataBinding() == null) {
- op.setDataBinding(dataBinding);
- DataType<List<DataType>> inputType = op.getInputType();
- if (inputType != null) {
- for (DataType d : inputType.getLogical()) {
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBinding);
- }
- }
- }
- DataType outputType = op.getOutputType();
- if (outputType != null && outputType.getDataBinding() == null) {
- outputType.setDataBinding(dataBinding);
- }
- List<DataType> faultTypes = op.getFaultTypes();
- if (faultTypes != null) {
- for (DataType d : faultTypes) {
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBinding);
- }
- DataType ft = (DataType) d.getLogical();
- if (ft.getDataBinding() == null) {
- ft.setDataBinding(dataBinding);
- }
-
- }
- }
-
- if (op.isInputWrapperStyle()) {
- WrapperInfo inputWrapperInfo = op.getInputWrapper();
- if (inputWrapperInfo != null) {
- DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
- if (unwrappedInputType != null) {
- for (DataType d : unwrappedInputType.getLogical()) {
- if (d.getDataBinding() == null) {
- d.setDataBinding(dataBinding);
- }
- }
- }
- }
- }
-
- if (op.isOutputWrapperStyle()) {
- WrapperInfo outputWrapperInfo = op.getOutputWrapper();
- if (outputWrapperInfo != null){
- DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
- if (unwrappedOutputType != null && unwrappedOutputType.getDataBinding() == null) {
- unwrappedOutputType.setDataBinding(dataBinding);
- }
- }
- }
- }
- }
- }
-
- private void setDataBinding(DataType dataType, String dataBinding) {
- if ("java:array".equals(dataType.getDataBinding())) {
- setDataBinding((DataType)dataType.getLogical(), dataBinding);
- } else {
- dataType.setDataBinding(dataBinding);
- }
- }
-
- public void resetInterfaceInputTypes(Interface newInterface){
- for (int i = 0; i < getOperations().size(); i++) {
- // only remote interfaces only have a data type model defined
- // and in this case operations cannot be overloaded so match
- // operations by name
- Operation oldOperation = getOperations().get(i);
- Operation newOperation = null;
-
- for (Operation tmpOperation : newInterface.getOperations()){
- if (tmpOperation.getName().equals(oldOperation.getName())){
- newOperation = tmpOperation;
- }
- }
-
- if (newOperation == null){
- break;
- }
-
- // set input types
- oldOperation.setInputType(newOperation.getInputType());
-
- // set wrapper
- if (newOperation.isInputWrapperStyle()) {
- oldOperation.setInputWrapperStyle(true);
- oldOperation.setInputWrapper(newOperation.getInputWrapper());
- }
- }
- }
-
- public void resetInterfaceOutputTypes(Interface newInterface){
- for (int i = 0; i < getOperations().size(); i++) {
- // only remote interfaces only have a data type model defined
- // and in this case operations cannot be overloaded so match
- // operations by name
- Operation oldOperation = getOperations().get(i);
- Operation newOperation = null;
-
- for (Operation tmpOperation : newInterface.getOperations()){
- if (tmpOperation.getName().equals(oldOperation.getName())){
- newOperation = tmpOperation;
- }
- }
-
- if (newOperation == null){
- break;
- }
-
- // set output types
- oldOperation.setOutputType(newOperation.getOutputType());
-
- // set fault types
- oldOperation.setFaultTypes(newOperation.getFaultTypes());
-
- // set wrapper
- if (newOperation.isOutputWrapperStyle()) {
- oldOperation.setOutputWrapperStyle(true);
- oldOperation.setOutputWrapper(newOperation.getOutputWrapper());
- }
- }
- }
-
- public void resetDataBinding(String dataBinding) {
- for (Operation op : getOperations()) {
- op.setDataBinding(dataBinding);
- DataType<List<DataType>> inputType = op.getInputType();
- if (inputType != null) {
- for (DataType d : inputType.getLogical()) {
- setDataBinding(d, dataBinding);
- }
- }
- DataType outputType = op.getOutputType();
- if (outputType != null) {
- setDataBinding(outputType, dataBinding);
- }
- List<DataType> faultTypes = op.getFaultTypes();
- if (faultTypes != null) {
- for (DataType d : faultTypes) {
- setDataBinding(d, dataBinding);
- setDataBinding((DataType) d.getLogical(), dataBinding);
- }
- }
-
- if (op.isInputWrapperStyle()) {
- WrapperInfo inputWrapperInfo = op.getInputWrapper();
- if (inputWrapperInfo != null) {
- DataType<List<DataType>> unwrappedInputType = inputWrapperInfo.getUnwrappedInputType();
- if (unwrappedInputType != null) {
- for (DataType d : unwrappedInputType.getLogical()) {
- setDataBinding(d, dataBinding);
- }
- }
- }
- }
-
- if (op.isOutputWrapperStyle()) {
- WrapperInfo outputWrapperInfo = op.getOutputWrapper();
- if (outputWrapperInfo != null){
- DataType unwrappedOutputType = outputWrapperInfo.getUnwrappedOutputType();
- if (unwrappedOutputType != null) {
- setDataBinding(unwrappedOutputType, dataBinding);
- }
- }
- }
- }
- }
-
- public boolean isDynamic() {
- return false;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return type;
- }
-
- public void setType(IntentAttachPointType type) {
- this.type = type;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- InterfaceImpl copy = (InterfaceImpl)super.clone();
- copy.operations = new OperationList();
- for (Operation operation : this.operations) {
- Operation clonedOperation = (Operation)operation.clone();
- copy.operations.add(clonedOperation);
- }
- return copy;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
deleted file mode 100644
index 5d75db1281..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/impl/OperationImpl.java
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.interfacedef.ConversationSequence;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.interfacedef.ParameterMode;
-import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
-import org.apache.tuscany.sca.interfacedef.util.XMLType;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents an operation on a service interface.
- *
- * @version $Rev$ $Date$
- */
-public class OperationImpl implements Operation {
-
- private String name;
- private boolean unresolved;
- private DataType outputType;
- private DataType<List<DataType>> inputType;
- private List<DataType> faultTypes;
- private Interface interfaze;
- private ConversationSequence conversationSequence = ConversationSequence.CONVERSATION_NONE;
- private List<ParameterMode> parameterModes = new ArrayList<ParameterMode>();
- private boolean nonBlocking;
- // TODO - WI
- //private WrapperInfo wrapper;
- private boolean inputWrapperStyle;
- private boolean outputWrapperStyle;
- private WrapperInfo inputWrapper;
- private WrapperInfo outputWrapper;
- private boolean dynamic;
- private Map<QName, List<DataType<XMLType>>> faultBeans;
-
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private IntentAttachPointType type;
-
- /**
- * @param name
- */
- public OperationImpl() {
- inputType = new DataTypeImpl<List<DataType>>("idl:input", Object[].class, new ArrayList<DataType>());
- faultTypes = new ArrayList<DataType>();
- faultBeans = new HashMap<QName, List<DataType<XMLType>>>();
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- /**
- * @return the faultTypes
- */
- public List<DataType> getFaultTypes() {
- return faultTypes;
- }
-
- /**
- * @param faultTypes the faultTypes to set
- */
- public void setFaultTypes(List<DataType> faultTypes) {
- this.faultTypes = faultTypes;
- }
-
- /**
- * @return the inputType
- */
- public DataType<List<DataType>> getInputType() {
- return inputType;
- }
-
- /**
- * @param inputType the inputType to set
- */
- public void setInputType(DataType<List<DataType>> inputType) {
- this.inputType = inputType;
- }
-
- /**
- * @return the outputType
- */
- public DataType getOutputType() {
- return outputType;
- }
-
- /**
- * @param outputType the outputType to set
- */
- public void setOutputType(DataType outputType) {
- this.outputType = outputType;
- }
-
- /**
- * @return the interface
- */
- public Interface getInterface() {
- return interfaze;
- }
-
- /**
- * @param interfaze the interface to set
- */
- public void setInterface(Interface interfaze) {
- this.interfaze = interfaze;
- }
-
- /**
- * @return the conversationSequence
- */
- public ConversationSequence getConversationSequence() {
- return conversationSequence;
- }
-
- /**
- * @param conversationSequence the conversationSequence to set
- */
- public void setConversationSequence(ConversationSequence conversationSequence) {
- this.conversationSequence = conversationSequence;
- }
-
- /**
- * @return the nonBlocking
- */
- public boolean isNonBlocking() {
- return nonBlocking;
- }
-
- /**
- * @param nonBlocking the nonBlocking to set
- */
- public void setNonBlocking(boolean nonBlocking) {
- this.nonBlocking = nonBlocking;
- }
-
- /**
- * @return the wrapperInfo
- */
- // TODO - WI
- //public WrapperInfo getWrapper() {
- // return wrapper;
- //}
-
- /**
- * @param wrapperInfo the wrapperInfo to set
- */
- // TODO - WI
- //public void setWrapper(WrapperInfo wrapperInfo) {
- // this.wrapper = wrapperInfo;
- //}
-
- public WrapperInfo getInputWrapper() {
- return inputWrapper;
- }
-
- public void setInputWrapper(WrapperInfo inputWrapper) {
- this.inputWrapper = inputWrapper;
- }
-
- public WrapperInfo getOutputWrapper() {
- return outputWrapper;
- }
-
- public void setOutputWrapper(WrapperInfo outputWrapper) {
- this.outputWrapper = outputWrapper;
- }
-
- /**
- * @return the inputWrapperStyle
- */
- public boolean isInputWrapperStyle() {
- return inputWrapperStyle;
- }
-
- /**
- * @param inputWrapperStyle the wrapperStyle to set
- */
- public void setInputWrapperStyle(boolean wrapperStyle) {
- this.inputWrapperStyle = wrapperStyle;
- }
-
- /**
- * @return the outputWrapperStyle
- */
- public boolean isOutputWrapperStyle() {
- return outputWrapperStyle;
- }
-
- /**
- * @param outputWrapperStyle the wrapperStyle to set
- */
- public void setOutputWrapperStyle(boolean wrapperStyle) {
- this.outputWrapperStyle = wrapperStyle;
- }
-
- // TODO - WI
- // These are deprecated and are a little awkward now that
- // we split input wrapper from output wrapper
- public String getDataBinding() {
- return inputWrapper != null ? inputWrapper.getDataBinding() : null;
- }
-
- public void setDataBinding(String dataBinding) {
- if (inputWrapper != null) {
- inputWrapper.setDataBinding(dataBinding);
- }
- if (outputWrapper != null) {
- outputWrapper.setDataBinding(dataBinding);
- }
- }
-
- public boolean isDynamic() {
- return dynamic;
- }
-
- public void setDynamic(boolean b) {
- this.dynamic = b;
- }
-
- public Map<QName, List<DataType<XMLType>>> getFaultBeans() {
- return faultBeans;
- }
-
- public void setFaultBeans(Map<QName, List<DataType<XMLType>>> faultBeans) {
- this.faultBeans = faultBeans;
- }
-
- @Override
- public OperationImpl clone() throws CloneNotSupportedException {
- OperationImpl copy = (OperationImpl) super.clone();
-
- final List<DataType> clonedFaultTypes = new ArrayList<DataType>(this.faultTypes.size());
- for (DataType t : this.faultTypes) {
- clonedFaultTypes.add((DataType) t.clone());
- }
- copy.faultTypes = clonedFaultTypes;
-
- List<DataType> clonedLogicalTypes = new ArrayList<DataType>();
- for (DataType t : inputType.getLogical()) {
- DataType type = (DataType) t.clone();
- clonedLogicalTypes.add(type);
- }
- DataType<List<DataType>> clonedInputType =
- new DataTypeImpl<List<DataType>>(inputType.getPhysical(), clonedLogicalTypes);
- clonedInputType.setDataBinding(inputType.getDataBinding());
- copy.inputType = clonedInputType;
-
- if (this.outputType != null) {
- copy.outputType = (DataType) this.outputType.clone();
- }
-
- return copy;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return type;
- }
-
- public void setType(IntentAttachPointType type) {
- this.type = type;
- }
-
- public List<ParameterMode> getParameterModes() {
- return parameterModes;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.java
deleted file mode 100644
index 777fa567f1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/ElementInfo.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.interfacedef.util;
-
-import javax.xml.namespace.QName;
-
-/**
- * An abstraction of XML schema elements.
- *
- * @version $Rev$ $Date$
- */
-public class ElementInfo {
- private final QName name;
- private final TypeInfo type;
- private boolean many = false;
- private boolean nillable = false;
-
- /**
- * @param name
- * @param type
- */
- public ElementInfo(QName name, TypeInfo type) {
- super();
- this.name = name;
- this.type = type;
- }
-
- /**
- * @return the name
- */
- public QName getQName() {
- return name;
- }
-
- /**
- * @return the type
- */
- public TypeInfo getType() {
- return type;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Element: ").append(name).append(" ").append(type);
- return sb.toString();
- }
-
- public boolean isMany() {
- return many;
- }
-
- public void setMany(boolean many) {
- this.many = many;
- }
-
- public boolean isNillable() {
- return nillable;
- }
-
- public void setNillable(boolean nillable) {
- this.nillable = nillable;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((type == null) ? 0 : type.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final ElementInfo other = (ElementInfo)obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- /*
- if (type == null) {
- if (other.type != null)
- return false;
- } else if (!type.equals(other.type))
- return false;
- */
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.java
deleted file mode 100644
index 844b0af509..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/FaultException.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.interfacedef.util;
-
-import javax.xml.namespace.QName;
-
-/**
- * The generic java exception to wrap service faults
- *
- * @version $Rev$ $Date$
- */
-public class FaultException extends Exception {
- private static final long serialVersionUID = -8002583655240625792L;
- private transient Object faultInfo; // FIXME: How to serialize it?
- private QName faultName;
-
- /**
- * @param message
- * @param faultInfo
- */
- public FaultException(String message, Object faultInfo) {
- super(message);
- this.faultInfo = faultInfo;
- }
-
- /**
- * @param message
- * @param faultInfo
- * @param cause
- */
- public FaultException(String message, Object faultInfo, Throwable cause) {
- super(message, cause);
- this.faultInfo = faultInfo;
- }
-
- /**
- * @return the faultInfo
- */
- public Object getFaultInfo() {
- return faultInfo;
- }
-
- public QName getFaultName() {
- return faultName;
- }
-
- public void setFaultName(QName logical) {
- this.faultName = logical;
- }
-
- public boolean isMatchingType(Object type) {
- if (faultName == null) {
- return false;
- }
-
- if ((type instanceof QName) && faultName.equals(type)) {
- return true;
- }
- if (type instanceof XMLType && faultName.equals(((XMLType)type).getElementName())) {
- return true;
- }
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.java
deleted file mode 100644
index 54c0a3ec11..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/JavaXMLMapper.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.interfacedef.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-/**
- * Utility class that can be used to map XSD types to Java classes and Java classes to XSD types.
- *
- * @version $Rev$ $Date$
- */
-public final class JavaXMLMapper {
- public static final String URI_2001_SCHEMA_XSD = "http://www.w3.org/2001/XMLSchema";
- private static final Map<Class, QName> JAVA2XML = new HashMap<Class, QName>();
- private static final Map<String, Class> XML2JAVA = new HashMap<String, Class>();
-
- private JavaXMLMapper() {
- }
-
- static {
- JAVA2XML.put(boolean.class, getTypeName("boolean"));
- JAVA2XML.put(byte.class, getTypeName("byte"));
- JAVA2XML.put(short.class, getTypeName("short"));
- JAVA2XML.put(int.class, getTypeName("int"));
- JAVA2XML.put(long.class, getTypeName("long"));
- JAVA2XML.put(float.class, getTypeName("float"));
- JAVA2XML.put(double.class, getTypeName("double"));
- JAVA2XML.put(Boolean.class, getTypeName("boolean"));
- JAVA2XML.put(Byte.class, getTypeName("byte"));
- JAVA2XML.put(Short.class, getTypeName("short"));
- JAVA2XML.put(Integer.class, getTypeName("int"));
- JAVA2XML.put(Long.class, getTypeName("long"));
- JAVA2XML.put(Float.class, getTypeName("float"));
- JAVA2XML.put(Double.class, getTypeName("double"));
- JAVA2XML.put(java.lang.String.class, getTypeName("string"));
- JAVA2XML.put(java.math.BigInteger.class, getTypeName("integer"));
- JAVA2XML.put(java.math.BigDecimal.class, getTypeName("decimal"));
- JAVA2XML.put(java.util.Calendar.class, getTypeName("dateTime"));
- JAVA2XML.put(java.util.Date.class, getTypeName("dateTime"));
- JAVA2XML.put(javax.xml.namespace.QName.class, getTypeName("QName"));
- JAVA2XML.put(java.net.URI.class, getTypeName("string"));
- JAVA2XML.put(javax.xml.datatype.XMLGregorianCalendar.class, getTypeName("anySimpleType"));
- JAVA2XML.put(javax.xml.datatype.Duration.class, getTypeName("duration"));
- JAVA2XML.put(java.lang.Object.class, getTypeName("anyType"));
- JAVA2XML.put(java.awt.Image.class, getTypeName("base64Binary"));
- JAVA2XML.put(byte[].class, getTypeName("base64Binary"));
- // java2XSD.put(javax.activation.DataHandler.class, getTypeName("base64Binary"));
- JAVA2XML.put(javax.xml.transform.Source.class, getTypeName("base64Binary"));
- JAVA2XML.put(java.util.UUID.class, getTypeName("string"));
- }
-
- static {
- XML2JAVA.put("string", java.lang.String.class);
- XML2JAVA.put("integer", java.math.BigInteger.class);
- XML2JAVA.put("int", int.class);
- XML2JAVA.put("long", long.class);
- XML2JAVA.put("short", short.class);
- XML2JAVA.put("decimal", java.math.BigDecimal.class);
- XML2JAVA.put("float", float.class);
- XML2JAVA.put("double", double.class);
- XML2JAVA.put("boolean", boolean.class);
- XML2JAVA.put("byte", byte.class);
- XML2JAVA.put("QName", javax.xml.namespace.QName.class);
- XML2JAVA.put("dateTime", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("base64Binary", byte[].class);
- XML2JAVA.put("hexBinary", byte[].class);
- XML2JAVA.put("unsignedInt", long.class);
- XML2JAVA.put("unsignedShort", int.class);
- XML2JAVA.put("unsignedByte", short.class);
- XML2JAVA.put("time", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("date", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gDay", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gMonth", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gYear", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gYearMonth", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("gMonthDay", javax.xml.datatype.XMLGregorianCalendar.class);
- XML2JAVA.put("anySimpleType", java.lang.Object.class); // For elements
- // XML2JAVA.put("anySimpleType", java.lang.String.class); // For
- // attributes
- XML2JAVA.put("duration", javax.xml.datatype.Duration.class);
- XML2JAVA.put("NOTATION", javax.xml.namespace.QName.class);
- }
-
- public static Class getJavaType(QName xmlType) {
- if (URI_2001_SCHEMA_XSD.equals(xmlType.getNamespaceURI())) {
- return XML2JAVA.get(xmlType.getLocalPart());
- } else {
- return null;
- }
- }
-
- private static QName getTypeName(String name) {
- return new QName(URI_2001_SCHEMA_XSD, name);
- }
-
- public static QName getXMLType(Class javaType) {
- return JAVA2XML.get(javaType);
- }
-
- private static String getPackageName(Class<?> cls) {
- String name = cls.getName();
- int index = name.lastIndexOf('.');
- return index == -1 ? "" : name.substring(0, index);
- }
-
- public static String getNamespace(Class<?> cls) {
- String packageName = getPackageName(cls);
- if ("".equals(packageName)) {
- return "";
- }
- StringBuffer ns = new StringBuffer("http://");
- String[] names = packageName.split("\\.");
- for (int i = names.length - 1; i >= 0; i--) {
- ns.append(names[i]);
- if (i != 0) {
- ns.append('.');
- }
- }
- ns.append('/');
- return ns.toString();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java
deleted file mode 100644
index 2598dc8545..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/TypeInfo.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.util;
-
-import javax.xml.namespace.QName;
-
-/**
- * An abstraction of XML schema types
- *
- * @version $Rev$ $Date$
- */
-public class TypeInfo {
- private QName name;
-
- private boolean isSimpleType;
-
- private TypeInfo baseType;
-
- /**
- * @param name
- * @param isSimpleType
- */
- public TypeInfo(QName name, boolean isSimpleType, TypeInfo baseType) {
- super();
- this.name = name;
- this.isSimpleType = isSimpleType;
- this.baseType = baseType;
- }
-
- /**
- * @return the isSimpleType
- */
- public boolean isSimpleType() {
- return isSimpleType;
- }
-
- /**
- * @return the name
- */
- public QName getQName() {
- return name;
- }
-
- /**
- * @return the baseType
- */
- public TypeInfo getBaseType() {
- return baseType;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Type: ").append(name);
- return sb.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final TypeInfo other = (TypeInfo)obj;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
deleted file mode 100644
index b5a7915a11..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/WrapperInfo.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.impl.DataTypeImpl;
-
-/**
- * The "Wrapper Style" WSDL operation is defined by The Java API for XML-Based
- * Web Services (JAX-WS) 2.0 specification, section 2.3.1.2 Wrapper Style. <p/>
- * A WSDL operation qualifies for wrapper style mapping only if the following
- * criteria are met:
- * <ul>
- * <li>(i) The operation is input and output messages (if present) each contain
- * only a single part
- * <li>(ii) The input message part refers to a global element declaration whose
- * localname is equal to the operation name
- * <li>(iii) The output message part refers to a global element declaration
- * <li>(iv) The elements referred to by the input and output message parts
- * (henceforth referred to as wrapper elements) are both complex types defined
- * using the xsd:sequence compositor
- * <li>(v) The wrapper elements only contain child elements, they must not
- * contain other structures such as wildcards (element or attribute),
- * xsd:choice, substitution groups (element references are not permitted) or
- * attributes; furthermore, they must not be nillable.
- * </ul>
- *
- * @version $Rev$ $Date$
- */
-public class WrapperInfo {
- private String dataBinding;
- private ElementInfo wrapperElement;
- private List<ElementInfo> childElements;
- private DataType<XMLType> wrapperType;
-
- // A cache for the derived data type of the unwrapped
- // input child elements
- private DataType<List<DataType>> unwrappedInputType;
-
- // A cache for the derived data type of the unwrapped
- // output child element (we only support one child)
- private DataType<XMLType> unwrappedOutputType;
-
- public WrapperInfo(String dataBinding,
- ElementInfo wrapperElement,
- List<ElementInfo> childElements) {
- super();
- this.dataBinding = dataBinding;
- this.wrapperElement = wrapperElement;
- this.childElements = childElements;
- }
-
- public List<ElementInfo> getChildElements() {
- return childElements;
- }
-
- public ElementInfo getWrapperElement() {
- return wrapperElement;
- }
-
- public String getDataBinding() {
- return dataBinding;
- }
-
- public void setDataBinding(String dataBinding) {
- this.dataBinding = dataBinding;
- }
-
- public DataType<XMLType> getWrapperType() {
- return wrapperType;
- }
-
- public void setWrapperType(DataType<XMLType> wrapperType) {
- this.wrapperType = wrapperType;
- }
-
- public Class<?> getWrapperClass() {
- return wrapperType == null ? null : wrapperType.getPhysical();
- }
-
-
- public DataType<List<DataType>> getUnwrappedInputType() {
- if (unwrappedInputType == null) {
- List<DataType> childTypes = new ArrayList<DataType>();
- for (ElementInfo element : getChildElements()) {
- DataType type = getDataType(element);
- childTypes.add(type);
- }
- unwrappedInputType = new DataTypeImpl<List<DataType>>("idl:unwrapped.input", Object[].class, childTypes);
- }
- return unwrappedInputType;
- }
-
- public DataType getUnwrappedOutputType() {
- if (unwrappedOutputType == null) {
- List<ElementInfo> elements = getChildElements();
- if (elements != null && elements.size() > 0) {
- if (elements.size() > 1) {
- // We don't support output with multiple parts
- // throw new IllegalArgumentException("Multi-part output is not supported");
- }
- ElementInfo element = elements.get(0);
-
- unwrappedOutputType = getDataType(element);
- }
- }
- return unwrappedOutputType;
- }
-
- private DataType getDataType(ElementInfo element) {
- DataType type = null;
- if (element.isMany()) {
- DataType logical = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
- type = new DataTypeImpl<DataType>("java:array", Object[].class, logical);
- } else {
- type = new DataTypeImpl<XMLType>(dataBinding, Object.class, new XMLType(element));
- }
- return type;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java b/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
deleted file mode 100644
index 26ecf6e352..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/java/org/apache/tuscany/sca/interfacedef/util/XMLType.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.interfacedef.util;
-
-import javax.xml.namespace.QName;
-
-/**
- * The metadata for an XML element or type.
- *
- * @version $Rev$ $Date$
- */
-public class XMLType {
- public static final XMLType UNKNOWN = new XMLType(null, null);
- protected QName element;
- protected QName type;
- protected boolean nillable = true;
- protected boolean many = false;
-
- /**
- * @param element
- */
- public XMLType(ElementInfo element) {
- super();
- this.element = element.getQName();
- if (element.getType() != null) {
- this.type = element.getType().getQName();
- }
- }
-
- /**
- * @param element
- */
- public XMLType(TypeInfo type) {
- this.element = null;
- this.type = type.getQName();
- }
-
- public XMLType(QName element, QName type) {
- this.element = element;
- this.type = type;
- }
-
- /**
- * @return the type
- */
- public QName getTypeName() {
- return type;
- }
-
- public boolean isElement() {
- return element != null;
- }
-
- public QName getElementName() {
- return element;
- }
-
- public void setElementName(QName element) {
- this.element = element;
- }
-
- public void setTypeName(QName type) {
- this.type = type;
- }
-
- public static XMLType getType(QName type) {
- return new XMLType(null, type);
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int PRIME = 31;
- int result = 1;
- result = PRIME * result + ((element == null) ? 0 : element.hashCode());
- result = PRIME * result + ((type == null) ? 0 : type.hashCode());
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final XMLType other = (XMLType)obj;
- if (element == null) {
- if (other.element != null) {
- return false;
- }
- } else if (!element.equals(other.element)) {
- return false;
- }
- if (type == null) {
- if (other.type != null) {
- return false;
- }
- } else if (!type.equals(other.type)) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return "Element: " + element + " Type: " + type;
- }
-
- public boolean isNillable() {
- return nillable;
- }
-
- public void setNillable(boolean niable) {
- this.nillable = niable;
- }
-
- public boolean isMany() {
- return many;
- }
-
- public void setMany(boolean many) {
- this.many = many;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper b/branches/sca-java-1.5.1/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper
deleted file mode 100644
index 821c58bde1..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/main/resources/META-INF/services/org.apache.tuscany.sca.interfacedef.InterfaceContractMapper
+++ /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.interfacedef.impl.InterfaceContractMapperImpl
diff --git a/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java b/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
deleted file mode 100644
index 269a3dc038..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/ContractCompatibilityTestCase.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.interfacedef.impl;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.DataType;
-import org.apache.tuscany.sca.interfacedef.IncompatibleInterfaceContractException;
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.Operation;
-
-/**
- * TODO some tests commented out due to DataType.equals() needing to be strict
- *
- * @version $Rev$ $Date$
- */
-public class ContractCompatibilityTestCase extends TestCase {
-
- private InterfaceContractMapper mapper;
-
- @Override
- protected void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- mapper = utilities.getUtility(InterfaceContractMapper.class);
- }
-
- public void testNoOperation() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- InterfaceContract target = new MockContract("FooContract");
- mapper.checkCompatibility(source, target, false, false);
- }
-
- public void testBasic() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- Operation opSource1 = newOperation("op1");
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
- InterfaceContract target = new MockContract("FooContract");
- Operation opSource2 = newOperation("op1");
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opSource2);
- target.getInterface().getOperations().addAll(targetOperations.values());
- mapper.checkCompatibility(source, target, false, false);
- }
-
- public void testBasicIncompatibleOperationNames() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- Operation opSource1 = newOperation("op1");
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
- InterfaceContract target = new MockContract("FooContract");
- Operation opSource2 = newOperation("op2");
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op2", opSource2);
- target.getInterface().getOperations().addAll(targetOperations.values());
- try {
- mapper.checkCompatibility(source, target, false, false);
- fail();
- } catch (IncompatibleInterfaceContractException e) {
- // expected
- }
- }
-
- public void testInputTypes() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- List<DataType> sourceInputTypes = new ArrayList<DataType>();
- sourceInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
- DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
- Operation opSource1 = newOperation("op1");
- opSource1.setInputType(inputType);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- List<DataType> targetInputTypes = new ArrayList<DataType>();
- targetInputTypes.add(new DataTypeImpl<Type>(Object.class, Object.class));
- DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
-
- Operation opTarget = newOperation("op1");
- opTarget.setInputType(targetInputType);
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- mapper.checkCompatibility(source, target, false, false);
- }
-
- public void testIncompatibleInputTypes() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- List<DataType> sourceInputTypes = new ArrayList<DataType>();
- sourceInputTypes.add(new DataTypeImpl<Type>(Integer.class, Integer.class));
- DataType<List<DataType>> inputType = new DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
- Operation opSource1 = newOperation("op1");
- opSource1.setInputType(inputType);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- List<DataType> targetInputTypes = new ArrayList<DataType>();
- targetInputTypes.add(new DataTypeImpl<Type>(String.class, String.class));
- DataType<List<DataType>> targetInputType = new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
-
- Operation opTarget = newOperation("op1");
- opTarget.setInputType(targetInputType);
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- try {
- mapper.checkCompatibility(source, target, false, false);
- fail();
- } catch (IncompatibleInterfaceContractException e) {
- // expected
- }
- }
-
- /**
- * Verfies source input types can be super types of the target
- */
- public void testSourceSuperTypeInputCompatibility() throws Exception {
- // InterfaceContract source = new MockContract("FooContract");
- // List<DataType> sourceInputTypes = new ArrayList<DataType>();
- // sourceInputTypes.add(new DataTypeImpl<Type>(Object.class,
- // Object.class));
- // DataType<List<DataType>> inputType = new
- // DataTypeImpl<List<DataType>>(String.class, sourceInputTypes);
- // Operation opSource1 = newOperationImpl("op1", inputType, null, null,
- // false, null);
- // Map<String, Operation> sourceOperations = new HashMap<String,
- // Operation>();
- // sourceOperations.put("op1", opSource1);
- // source.getInterface().getOperations().addAll(sourceOperations.values());
- //
- // InterfaceContract target = new MockContract("FooContract");
- // List<DataType> targetInputTypes = new ArrayList<DataType>();
- // targetInputTypes.add(new DataTypeImpl<Type>(String.class,
- // String.class));
- // DataType<List<DataType>> targetInputType =
- // new DataTypeImpl<List<DataType>>(String.class, targetInputTypes);
- //
- // Operation opTarget = newOperationImpl("op1", targetInputType, null,
- // null, false, null);
- // Map<String, Operation> targetOperations = new HashMap<String,
- // Operation>();
- // targetOperations.put("op1", opTarget);
- // target.getInterface().getOperations().addAll(targetOperations.values());
- // wireService.checkCompatibility(source, target, false);
- }
-
- public void testOutputTypes() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
- Operation opSource1 = newOperation("op1");
- opSource1.setOutputType(sourceOutputType);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- DataType targetOutputType = new DataTypeImpl<Type>(String.class, String.class);
- Operation opTarget = newOperation("op1");
- opTarget.setOutputType(targetOutputType);
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- mapper.checkCompatibility(source, target, false, false);
- }
-
- /**
- * Verifies a return type that is a supertype of of the target is compatible
- */
- public void testSupertypeOutputTypes() throws Exception {
- // InterfaceContract source = new MockContract("FooContract");
- // DataType sourceOutputType = new DataTypeImpl<Type>(Object.class,
- // Object.class);
- // Operation opSource1 = newOperationImpl("op1", null,
- // sourceOutputType, null, false, null);
- // Map<String, Operation> sourceOperations = new HashMap<String,
- // Operation>();
- // sourceOperations.put("op1", opSource1);
- // source.getInterface().getOperations().addAll(sourceOperations.values());
- //
- // InterfaceContract target = new MockContract("FooContract");
- // DataType targetOutputType = new DataTypeImpl<Type>(String.class,
- // String.class);
- // Operation opTarget = newOperationImpl("op1", null, targetOutputType,
- // null, false, null);
- // Map<String, Operation> targetOperations = new HashMap<String,
- // Operation>();
- // targetOperations.put("op1", opTarget);
- // target.getInterface().getOperations().addAll(targetOperations.values());
- // wireService.checkCompatibility(source, target, false);
- }
-
- public void testIncompatibleOutputTypes() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- DataType sourceOutputType = new DataTypeImpl<Type>(String.class, String.class);
- Operation opSource1 = newOperation("op1");
- opSource1.setOutputType(sourceOutputType);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- DataType targetOutputType = new DataTypeImpl<Type>(Integer.class, Integer.class);
- Operation opTarget = newOperation("op1");
- opTarget.setOutputType(targetOutputType);
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- try {
- mapper.checkCompatibility(source, target, false, false);
- fail();
- } catch (IncompatibleInterfaceContractException e) {
- // expected
- }
- }
-
- public void testFaultTypes() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
- List<DataType> sourceFaultTypes = new ArrayList<DataType>();
- sourceFaultTypes.add(0, sourceFaultType);
- Operation opSource1 = newOperation("op1");
- opSource1.setFaultTypes(sourceFaultTypes);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- DataType targetFaultType = new DataTypeImpl<Type>(String.class, String.class);
- List<DataType> targetFaultTypes = new ArrayList<DataType>();
- targetFaultTypes.add(0, targetFaultType);
-
- Operation opTarget = newOperation("op1");
- opTarget.setFaultTypes(targetFaultTypes);
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- mapper.checkCompatibility(source, target, false, false);
- }
-
- public void testSourceFaultTargetNoFaultCompatibility() throws Exception {
- InterfaceContract source = new MockContract("FooContract");
- DataType sourceFaultType = new DataTypeImpl<Type>(String.class, String.class);
- List<DataType> sourceFaultTypes = new ArrayList<DataType>();
- sourceFaultTypes.add(0, sourceFaultType);
- Operation opSource1 = newOperation("op1");
- opSource1.setFaultTypes(sourceFaultTypes);
- Map<String, Operation> sourceOperations = new HashMap<String, Operation>();
- sourceOperations.put("op1", opSource1);
- source.getInterface().getOperations().addAll(sourceOperations.values());
-
- InterfaceContract target = new MockContract("FooContract");
- Operation opTarget = newOperation("op1");
- Map<String, Operation> targetOperations = new HashMap<String, Operation>();
- targetOperations.put("op1", opTarget);
- target.getInterface().getOperations().addAll(targetOperations.values());
- mapper.checkCompatibility(source, target, false, false);
- }
-
- /**
- * Verifies a source's fault which is a supertype of the target's fault are
- * compatible
- *
- * @throws Exception
- */
- public void testFaultSuperTypes() throws Exception {
- // InterfaceContract source = new MockContract("FooContract");
- // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
- // Exception.class);
- // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
- // sourceFaultTypes.add(0, sourceFaultType);
- // Operation opSource1 = newOperationImpl("op1", null, null,
- // sourceFaultTypes, false, null);
- // Map<String, Operation> sourceOperations = new HashMap<String,
- // Operation>();
- // sourceOperations.put("op1", opSource1);
- // source.getInterface().getOperations().addAll(sourceOperations.values());
- //
- // InterfaceContract target = new MockContract("FooContract");
- // DataType targetFaultType = new
- // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
- // List<DataType> targetFaultTypes = new ArrayList<DataType>();
- // targetFaultTypes.add(0, targetFaultType);
- //
- // Operation opTarget = newOperationImpl("op1", null, null,
- // targetFaultTypes, false, null);
- // Map<String, Operation> targetOperations = new HashMap<String,
- // Operation>();
- // targetOperations.put("op1", opTarget);
- // target.getInterface().getOperations().addAll(targetOperations.values());
- // wireService.checkCompatibility(source, target, false);
- }
-
- /**
- * Verifies a source's faults which are supertypes and a superset of the
- * target's faults are compatible
- */
- public void testFaultSuperTypesAndSuperset() throws Exception {
- // InterfaceContract source = new MockContract("FooContract");
- // DataType sourceFaultType = new DataTypeImpl<Type>(Exception.class,
- // Exception.class);
- // DataType sourceFaultType2 = new
- // DataTypeImpl<Type>(RuntimeException.class, RuntimeException.class);
- // List<DataType> sourceFaultTypes = new ArrayList<DataType>();
- // sourceFaultTypes.add(0, sourceFaultType);
- // sourceFaultTypes.add(1, sourceFaultType2);
- // Operation opSource1 = newOperationImpl("op1", null, null,
- // sourceFaultTypes, false, null);
- // Map<String, Operation> sourceOperations = new HashMap<String,
- // Operation>();
- // sourceOperations.put("op1", opSource1);
- // source.getInterface().getOperations().addAll(sourceOperations.values());
- //
- // InterfaceContract target = new MockContract("FooContract");
- // DataType targetFaultType = new
- // DataTypeImpl<Type>(TuscanyException.class, TuscanyException.class);
- // List<DataType> targetFaultTypes = new ArrayList<DataType>();
- // targetFaultTypes.add(0, targetFaultType);
- //
- // Operation opTarget = newOperationImpl("op1", null, null,
- // targetFaultTypes, false, null);
- // Map<String, Operation> targetOperations = new HashMap<String,
- // Operation>();
- // targetOperations.put("op1", opTarget);
- // target.getInterface().getOperations().addAll(targetOperations.values());
- // wireService.checkCompatibility(source, target, false);
- }
-
- private static class MockInterface extends InterfaceImpl {
-
- }
-
- private class MockContract<T> extends InterfaceContractImpl {
- public MockContract() {
- }
-
- public MockContract(String interfaceClass) {
- Interface jInterface = new MockInterface();
- setInterface(jInterface);
- }
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java b/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.java
deleted file mode 100644
index 12bb09eb95..0000000000
--- a/branches/sca-java-1.5.1/modules/interface/src/test/java/org/apache/tuscany/sca/interfacedef/impl/InterfaceContractTestCase.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.interfacedef.impl;
-
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.interfacedef.Interface;
-import org.apache.tuscany.sca.interfacedef.InterfaceContract;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class InterfaceContractTestCase {
- private InterfaceContract contract;
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- contract = new MockInterfaceContract();
- Interface i1 = new MockInterface();
- contract.setInterface(i1);
- Operation op1 = newOperation("op1");
- i1.getOperations().add(op1);
- Interface i2 = new MockInterface();
- contract.setCallbackInterface(i2);
- Operation callbackOp1 = newOperation("callbackOp1");
- i2.getOperations().add(callbackOp1);
- }
-
- @Test
- public void testClone() throws Exception {
- InterfaceContract copy = (InterfaceContract) contract.clone();
- Assert.assertNotNull(copy);
- Assert.assertNotSame(copy.getCallbackInterface(), contract.getCallbackInterface());
- Assert.assertNotSame(copy.getInterface(), contract.getInterface());
- }
-
- private static class MockInterfaceContract extends InterfaceContractImpl implements InterfaceContract {
- }
-
- private static class MockInterface extends InterfaceImpl implements Interface {
- }
-
- private static Operation newOperation(String name) {
- Operation operation = new OperationImpl();
- operation.setName(name);
- return operation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/LICENSE b/branches/sca-java-1.5.1/modules/monitor/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/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-java-1.5.1/modules/monitor/NOTICE b/branches/sca-java-1.5.1/modules/monitor/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/monitor/pom.xml b/branches/sca-java-1.5.1/modules/monitor/pom.xml
deleted file mode 100644
index bef1dc6efd..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/pom.xml
+++ /dev/null
@@ -1,57 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-monitor</artifactId>
- <name>Apache Tuscany SCA Monitor</name>
-
- <dependencies>
-
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.monitor</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.monitor*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.java
deleted file mode 100644
index 6ee6e705cc..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Monitor.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.monitor;
-
-import java.util.List;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-/**
- * A monitor for the watching for validation problems
- *
- * @version $Rev$ $Date$
- */
-public abstract class Monitor {
- /**
- * Reports a build problem.
- *
- * @param problem
- */
- public abstract void problem(Problem problem);
-
- /**
- * Returns a list of reported problems.
- *
- * @return the list of problems. The list may be empty
- */
- public abstract List<Problem> getProblems();
-
- /**
- * Create a new problem.
- *
- * @param sourceClassName the class name reporting the problem
- * @param bundleName the name of the message bundle to use
- * @param severity the severity of the problem
- * @param problemObject the model object for which the problem is being reported
- * @param messageId the id of the problem message
- * @param cause the exception which caused the problem
- * @return
- */
- public abstract Problem createProblem(String sourceClassName,
- String bundleName,
- Severity severity,
- Object problemObject,
- String messageId,
- Exception cause);
-
- /**
- * Create a new problem.
- *
- * @param sourceClassName the class name reporting the problem
- * @param bundleName the name of the message bundle to use
- * @param severity the severity of the problem
- * @param problemObject the model object for which the problem is being reported
- * @param messageId the id of the problem message
- * @param messageParams the parameters of the problem message
- * @return
- */
- public abstract Problem createProblem(String sourceClassName,
- String bundleName,
- Severity severity,
- Object problemObject,
- String messageId,
- Object... messageParams);
-
- /**
- * A utility function for raising a warning. It creates the problem and
- * adds it to the monitor
- *
- * @param monitor
- * @param reportingObject
- * @param messageBundle
- * @param messageId
- * @param messageParameters
- */
- public static void warning (Monitor monitor,
- Object reportingObject,
- String messageBundle,
- String messageId,
- String... messageParameters){
- if (monitor != null) {
- Problem problem =
- monitor.createProblem(reportingObject.getClass().getName(),
- messageBundle,
- Severity.WARNING,
- null,
- messageId,
- (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * A utility function for raising an error. It creates the problem and
- * adds it to the monitor
- *
- * @param monitor
- * @param reportingObject
- * @param messageBundle
- * @param messageId
- * @param messageParameters
- */
- public static void error (Monitor monitor,
- Object reportingObject,
- String messageBundle,
- String messageId,
- String... messageParameters){
- if (monitor != null) {
- Problem problem =
- monitor.createProblem(reportingObject.getClass().getName(),
- messageBundle,
- Severity.ERROR,
- null,
- messageId,
- (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * A utility function for raising an error. It creates the problem and
- * adds it to the monitor
- *
- * @param monitor
- * @param reportingObject
- * @param messageBundle
- * @param messageId
- * @param exception
- */
- public static void error (Monitor monitor,
- Object reportingObject,
- String messageBundle,
- String messageId,
- Exception cause){
- if (monitor != null) {
- Problem problem =
- monitor.createProblem(reportingObject.getClass().getName(),
- messageBundle,
- Severity.ERROR,
- null,
- messageId,
- cause);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.java
deleted file mode 100644
index 38c3bbd991..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorFactory.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.monitor;
-
-/**
- * A factory for validation monitors
- *
- * @version $Rev$ $Date$
- */
-public interface MonitorFactory {
-
- /**
- * Create a new monitor
- *
- * @return a new monitor
- */
- Monitor createMonitor();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorRuntimeException.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorRuntimeException.java
deleted file mode 100644
index 90cbe99688..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/MonitorRuntimeException.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.monitor;
-
-
-/**
- * Denotes an exception that has been logged and recorded in the monitor.
- *
- * @version $Rev$ $Date$
- */
-public class MonitorRuntimeException extends RuntimeException {
- private static final long serialVersionUID = 8972044333077591932L;
-
- public MonitorRuntimeException() {
- super();
- }
-
- /**
- * @param message
- * @param cause
- */
- public MonitorRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public MonitorRuntimeException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public MonitorRuntimeException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.java
deleted file mode 100644
index 83a2d63eae..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/Problem.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.monitor;
-
-
-/**
- * Records an validation problem.
- *
- * @version $Rev$ $Date$
- */
-public interface Problem {
-
- public enum Severity {
- INFO,
- WARNING,
- ERROR
- }
-
- String getSourceClassName();
-
- String getBundleName();
-
- Severity getSeverity();
-
- Object getProblemObject();
-
- String getMessageId();
-
- Exception getCause();
-
- Object[] getMessageParams();
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.java
deleted file mode 100644
index 274b4faefd..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorFactoryImpl.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.monitor.impl;
-
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-
-
-/**
- * A factory for creating validation monitors
- *
- * @version $Rev$ $Date$
- */
-public class DefaultMonitorFactoryImpl implements MonitorFactory {
-
- private Monitor monitor = null;
-
- public Monitor createMonitor() {
- if (monitor == null){
- monitor = new DefaultMonitorImpl();
- }
- return monitor ;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.java
deleted file mode 100644
index 7df34d0c74..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/DefaultMonitorImpl.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.monitor.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-/**
- * A monitor for the watching for validation problems
- *
- * @version $Rev$ $Date$
- */
-public class DefaultMonitorImpl extends Monitor {
- private static final Logger logger = Logger.getLogger(DefaultMonitorImpl.class.getName());
-
- // Cache all the problem reported to monitor for further analysis
- private List<Problem> problemCache = new ArrayList<Problem>();
-
- public void problem(Problem problem) {
-
- Logger problemLogger = Logger.getLogger(problem.getSourceClassName(), problem.getBundleName());
-
- if (problemLogger == null){
- logger.severe("Can't get logger " + problem.getSourceClassName()+ " with bundle " + problem.getBundleName());
- }
-
- if (problem.getSeverity() == Severity.INFO) {
- problemCache.add(problem);
- problemLogger.logp(Level.INFO, problem.getSourceClassName(), null,
- problem.getMessageId(), problem.getMessageParams());
- }
- else if (problem.getSeverity() == Severity.WARNING) {
- problemCache.add(problem);
- problemLogger.logp(Level.WARNING, problem.getSourceClassName(), null,
- problem.getMessageId(), problem.getMessageParams());
- }
- else if (problem.getSeverity() == Severity.ERROR) {
- if (problem.getCause() != null) {
- problemCache.add(problem);
- problemLogger.logp(Level.SEVERE, problem.getSourceClassName(),
- null, problem.getMessageId(), problem.getCause().toString());
-
- } else {
- problemCache.add(problem);
- problemLogger.logp(Level.SEVERE, problem.getSourceClassName(), null,
- problem.getMessageId(), problem.getMessageParams());
- }
- }
- }
-
- public List<Problem> getProblems(){
- return problemCache;
- }
-
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Exception cause) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, cause);
- }
-
- public Problem createProblem(String sourceClassName, String bundleName,
- Severity severity, Object problemObject, String messageId,
- Object... messageParams) {
- return new ProblemImpl(sourceClassName, bundleName, severity,
- problemObject, messageId, messageParams);
- }
-
- public Problem getLastLoggedProblem(){
- return problemCache.get(problemCache.size() - 1);
- }
-
- public boolean isMessageLogged(String messageId) {
- for (Problem problem : problemCache){
- if (problem.getMessageId().equals(messageId)){
- return true;
- }
- }
-
- return false;
- }
-
- public Problem getProblem(String messageId) {
- for (Problem problem : problemCache){
- if (problem.getMessageId().equals(messageId)){
- return problem;
- }
- }
-
- return null;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java b/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.java
deleted file mode 100644
index 5a0aaeddd0..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/java/org/apache/tuscany/sca/monitor/impl/ProblemImpl.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.monitor.impl;
-
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
-
-import org.apache.tuscany.sca.monitor.Problem;
-
-/**
- * Reports a composite assembly problem.
- *
- * @version $Rev$ $Date$
- */
-public class ProblemImpl implements Problem {
-
- private String sourceClassName;
- private String bundleName;
- private Severity severity;
- private Object problemObject;
- private String messageId;
- private Object[] messageParams;
- private Exception cause;
-
- /**
- * Construct a new problem
- *
- * @param sourceClassName the class name reporting the problem
- * @param bundleName the name of the message bundle to use
- * @param severity the severity of the problem
- * @param problemObject the model object for which the problem is being reported
- * @param messageId the id of the problem message
- * @param messageParams the parameters of the problem message
- */
- public ProblemImpl(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Object... messageParams ) {
- this.sourceClassName = sourceClassName;
- this.bundleName = bundleName;
- this.severity = severity;
- this.problemObject = problemObject;
- this.messageId = messageId;
- this.messageParams = messageParams;
- }
-
- /**
- * Construct a new problem
- *
- * @param sourceClassName the class name reporting the problem
- * @param bundleName the name of the message bundle to use
- * @param severity the severity of the problem
- * @param problemObject the model object for which the problem is being reported
- * @param messageId the id of the problem message
- * @param cause the exception which caused the problem
- */
- public ProblemImpl(String sourceClassName, String bundleName, Severity severity, Object problemObject, String messageId, Exception cause) {
- this.sourceClassName = sourceClassName;
- this.bundleName = bundleName;
- this.severity = severity;
- this.problemObject = problemObject;
- this.messageId = messageId;
- this.cause = cause;
- }
-
- public String getSourceClassName() {
- return sourceClassName;
- }
-
- public String getBundleName() {
- return bundleName;
- }
-
- public Severity getSeverity() {
- return severity;
- }
-
- public Object getProblemObject() {
- return problemObject;
- }
-
- public String getMessageId() {
- return messageId;
- }
-
- public Object[] getMessageParams() {
- return messageParams;
- }
-
- public Exception getCause() {
- return cause;
- }
-
- @Override
- public String toString() {
- Logger logger = Logger.getLogger(sourceClassName, bundleName);
-
- LogRecord record = new LogRecord(Level.INFO, messageId);
-
- if (cause == null){
- record.setParameters(messageParams);
-
- } else {
- Object[] params = new String[1];
- params[0] = cause.toString();
- record.setParameters(params);
- }
- record.setResourceBundle(logger.getResourceBundle());
- record.setSourceClassName(sourceClassName);
-
- Formatter formatter = new SimpleFormatter();
-
- return formatter.formatMessage(record);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory b/branches/sca-java-1.5.1/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory
deleted file mode 100644
index 0212a69382..0000000000
--- a/branches/sca-java-1.5.1/modules/monitor/src/main/resources/META-INF/services/org.apache.tuscany.sca.monitor.MonitorFactory
+++ /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.monitor.impl.DefaultMonitorFactoryImpl
diff --git a/branches/sca-java-1.5.1/modules/node-api/LICENSE b/branches/sca-java-1.5.1/modules/node-api/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/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-java-1.5.1/modules/node-api/NOTICE b/branches/sca-java-1.5.1/modules/node-api/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/node-api/pom.xml b/branches/sca-java-1.5.1/modules/node-api/pom.xml
deleted file mode 100644
index bdac355418..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/pom.xml
+++ /dev/null
@@ -1,61 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-node-api</artifactId>
- <name>Apache Tuscany SCA Node API</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.node.api</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.node*</Export-Package>
- <DynamicImport-Package>org.apache.tuscany.sca.node.impl,org.apache.tuscany.sca.extensibility</DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.java
deleted file mode 100644
index f390e8881e..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAClient.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.node;
-
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-
-
-/**
- * Provides client access to the services in a domain.
- *
- * @version $Rev$ $Date$
- */
-public interface SCAClient {
-
- /**
- * Cast a type-safe reference to a CallahbleReference. Converts a type-safe
- * reference to an equivalent CallableReference; if the target refers to a
- * service then a ServiceReference will be returned, if the target refers to
- * a callback then a CallableReference will be returned.
- *
- * @param target a reference proxy provided by the SCA runtime
- * @param <B> the Java type of the business interface for the reference
- * @param <R> the type of reference to be returned
- * @return a CallableReference equivalent for the proxy
- * @throws IllegalArgumentException if the supplied instance is not a
- * reference supplied by the SCA runtime
- */
- <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
-
- /**
- * Returns a proxy for a service provided by a component in the SCA domain.
- *
- * @param businessInterface the interface that will be used to invoke the
- * service
- * @param serviceName the name of the service
- * @param <B> the Java type of the business interface for the service
- * @return an object that implements the business interface
- */
- <B> B getService(Class<B> businessInterface, String serviceName);
-
- /**
- * Returns a ServiceReference for a service provided by a component in the
- * SCA domain.
- *
- * @param businessInterface the interface that will be used to invoke the
- * service
- * @param serviceName the name of the service
- * @param <B> the Java type of the business interface for the service
- * @return a ServiceReference for the designated service
- */
- <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName);
-
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java
deleted file mode 100644
index de7f352122..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCAContribution.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.node;
-
-/**
- * Represents an SCA contribution uri + location.
- */
-public final class SCAContribution {
- private String uri;
- private String location;
-
- /**
- * Constructs a new SCA contribution.
- *
- * @param uri The URI that uniquely identifies the contribution in the SCA domain
- * @param location The URL of the contribution archive
- */
- public SCAContribution(String uri, String location) {
- this.uri = uri;
- this.location = location;
- }
-
- /**
- * Get the URI of the contribution
- * @return The URI that uniquely identifies the contribution in the SCA domain
- */
- public String getURI() {
- return uri;
- }
-
- /**
- * The location of the contribution
- * @return The URL of the contribution archive
- */
- public String getLocation() {
- return location;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.java
deleted file mode 100644
index fea749a57c..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode.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.node;
-
-
-
-/**
- * Represents an SCA processing node.
- * A node is loaded with an SCA composites. It can start and stop that composite.
- *
- * @version $Rev$ $Date$
- */
-public interface SCANode {
-
- /**
- * Start the composite loaded in the node.
- */
- void start();
-
- /**
- * Stop the composite loaded in the node.
- */
- void stop();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.java
deleted file mode 100644
index a1d4ddb2b1..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2.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.node;
-
-
-
-/**
- * Represents an SCA processing node.
- * A node is loaded with an SCA composites. It can start and stop that composite.
- *
- * @version $Rev$ $Date$
- * @deprecated Use SCANode instead
- */
-@Deprecated
-public interface SCANode2 extends SCANode {
-}
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java
deleted file mode 100644
index 2b0dbc88eb..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANode2Factory.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * A factory for SCA processing nodes. An SCA processing node can be loaded
- * with an SCA composite and the SCA contributions required by the composite.
- *
- * @version $Rev$ $Date$
- * @deprecated Use SCANodeFactory
- */
-@Deprecated
-public abstract class SCANode2Factory {
-
- public static class NodeProxy implements SCANode2, SCAClient {
- private Object node;
-
- private NodeProxy(Object node) {
- super();
- this.node = node;
- }
-
- public static <T> T createProxy(Class<T> type, Object node) {
- try {
- return type.getDeclaredConstructor(Object.class).newInstance(node);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- try {
- return (R)node.getClass().getMethod("cast", Object.class).invoke(node, target);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- try {
- return (B)node.getClass().getMethod("getService", Class.class, String.class).invoke(node,
- businessInterface,
- serviceName);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName) {
- try {
- return (ServiceReference<B>)node.getClass().getMethod("getServiceReference", Class.class, String.class)
- .invoke(node, businessInterface, serviceName);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public void start() {
- try {
- node.getClass().getMethod("start").invoke(node);
- } catch (Throwable e) {
- handleException(e);
- }
- }
-
- public void stop() {
- try {
- node.getClass().getMethod("stop").invoke(node);
- } catch (Throwable e) {
- handleException(e);
- }
- }
-
- private static void handleException(Throwable ex) {
- if (ex instanceof InvocationTargetException) {
- ex = ((InvocationTargetException)ex).getTargetException();
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException)ex;
- }
- if (ex instanceof Error) {
- throw (Error)ex;
- } else {
- throw new RuntimeException(ex);
- }
- }
-
- }
-
- /**
- * Returns a new SCA node factory instance.
- *
- * @return a new SCA node factory
- */
- public static SCANode2Factory newInstance() {
- SCANode2Factory scaNodeFactory = null;
-
- try {
- final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility
- try {
- Class<?> discoveryClass =
- Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery", true, classLoader);
- Object instance = discoveryClass.getMethod("getInstance").invoke(null);
- Class<?> factoryImplClass =
- (Class<?>)discoveryClass.getMethod("loadFirstServiceClass", Class.class)
- .invoke(instance, SCANode2Factory.class);
- if (factoryImplClass != null) {
- scaNodeFactory = (SCANode2Factory)factoryImplClass.newInstance();
- return scaNodeFactory;
- }
- } catch (ClassNotFoundException e) {
- // Ignore
- }
-
- // Fail back to default impl
- String className = "org.apache.tuscany.sca.node.impl.Node2FactoryImpl";
-
- Class<?> cls = Class.forName(className, true, classLoader);
- scaNodeFactory = (SCANode2Factory)cls.newInstance();
- return scaNodeFactory;
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Create a SCA node based on the discovery of the contribution on the classpath for the
- * given classloader. This method should be treated a convinient shortcut with the following
- * assumptions:
- * <ul>
- * <li>This is a standalone application and there is a deployable composite file on the classpath.
- * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
- * </ul>
- * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
- * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
- * then thread context classloader will be used
- * @return A newly created SCA node
- */
- public abstract SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader);
-
- /**
- * Creates a new SCA node from the configuration URL
- *
- * @param configurationURL the URL of the node configuration which is the ATOM feed
- * that contains the URI of the composite and a collection of URLs for the contributions
- *
- * @return a new SCA node.
- */
- public abstract SCANode2 createSCANodeFromURL(String configurationURL);
-
- /**
- * Creates a new SCA node.
- *
- * @param compositeURI the URI of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related
- * artifacts. If the list is empty, then we will use the thread context classloader to discover
- * the contribution on the classpath
- *
- * @return a new SCA node.
- */
- public abstract SCANode2 createSCANode(String compositeURI, SCAContribution... contributions);
-
- /**
- * Creates a new SCA node.
- *
- * @param compositeURI the URI of the composite to use
- * @param compositeContent the XML content of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related artifacts
- * @return a new SCA node.
- */
- public abstract SCANode2 createSCANode(String compositeURI,
- String compositeContent,
- SCAContribution... contributions);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java b/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.java
deleted file mode 100644
index e60d8238d3..0000000000
--- a/branches/sca-java-1.5.1/modules/node-api/src/main/java/org/apache/tuscany/sca/node/SCANodeFactory.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.node;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * A factory for SCA processing nodes. An SCA processing node can be loaded
- * with an SCA composite and the SCA contributions required by the composite.
- *
- * @version $Rev$ $Date$
- */
-public abstract class SCANodeFactory {
-
- public static class NodeProxy implements SCANode, SCAClient {
- private Object node;
-
- private NodeProxy(Object node) {
- super();
- this.node = node;
- }
-
- public static <T> T createProxy(Class<T> type, Object node) {
- try {
- return type.getDeclaredConstructor(Object.class).newInstance(node);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- try {
- return (R)node.getClass().getMethod("cast", Object.class).invoke(node, target);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public <B> B getService(Class<B> businessInterface, String serviceName) {
- try {
- return (B)node.getClass().getMethod("getService", Class.class, String.class).invoke(node,
- businessInterface,
- serviceName);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String serviceName) {
- try {
- return (ServiceReference<B>)node.getClass().getMethod("getServiceReference", Class.class, String.class)
- .invoke(node, businessInterface, serviceName);
- } catch (Throwable e) {
- handleException(e);
- return null;
- }
- }
-
- public void start() {
- try {
- node.getClass().getMethod("start").invoke(node);
- } catch (Throwable e) {
- handleException(e);
- }
- }
-
- public void stop() {
- try {
- node.getClass().getMethod("stop").invoke(node);
- } catch (Throwable e) {
- handleException(e);
- }
- }
-
- private static void handleException(Throwable ex) {
- if (ex instanceof InvocationTargetException) {
- ex = ((InvocationTargetException)ex).getTargetException();
- }
- if (ex instanceof RuntimeException) {
- throw (RuntimeException)ex;
- }
- if (ex instanceof Error) {
- throw (Error)ex;
- } else {
- throw new RuntimeException(ex);
- }
- }
-
- }
-
- /**
- * Returns a new SCA node factory instance.
- *
- * @return a new SCA node factory
- */
- public static SCANodeFactory newInstance() {
- SCANodeFactory scaNodeFactory = null;
-
- try {
- // final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- // Use reflection APIs to call ServiceDiscovery to avoid hard dependency to tuscany-extensibility
- try {
- Class<?> discoveryClass =
- Class.forName("org.apache.tuscany.sca.extensibility.ServiceDiscovery");
- Object instance = discoveryClass.getMethod("getInstance").invoke(null);
- Class<?> factoryImplClass =
- (Class<?>)discoveryClass.getMethod("loadFirstServiceClass", Class.class)
- .invoke(instance, SCANodeFactory.class);
- if (factoryImplClass != null) {
- scaNodeFactory = (SCANodeFactory)factoryImplClass.newInstance();
- return scaNodeFactory;
- }
- } catch (ClassNotFoundException e) {
- // Ignore
- }
-
- // Fail back to default impl
- String className = "org.apache.tuscany.sca.node.impl.NodeFactoryImpl";
-
- Class<?> cls = Class.forName(className);
- scaNodeFactory = (SCANodeFactory)cls.newInstance();
- return scaNodeFactory;
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Create a SCA node based on the discovery of the contribution on the classpath.
- *
- * @return a new SCA node.
- */
- public abstract SCANode createSCANode();
-
- /**
- * Create a SCA node based on the discovery of the contribution on the classpath for the
- * given classloader. This method should be treated a convinient shortcut with the following
- * assumptions:
- * <ul>
- * <li>This is a standalone application and there is a deployable composite file on the classpath.
- * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
- * </ul>
- * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
- * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
- * then thread context classloader will be used
- * @return A newly created SCA node
- */
- public abstract SCANode createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader);
-
- /**
- * Creates a new SCA node from the configuration URL
- *
- * @param configurationURL the URL of the node configuration which is the ATOM feed
- * that contains the URI of the composite and a collection of URLs for the contributions
- *
- * @return a new SCA node.
- */
- public abstract SCANode createSCANodeFromURL(String configurationURL);
-
- /**
- * Creates a new SCA node.
- *
- * @param compositeURI the URI of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related
- * artifacts. If the list is empty, then we will use the thread context classloader to discover
- * the contribution on the classpath
- *
- * @return a new SCA node.
- */
- public abstract SCANode createSCANode(String compositeURI, SCAContribution... contributions);
-
- /**
- * Creates a new SCA node.
- *
- * @param compositeURI the URI of the composite to use
- * @param compositeContent the XML content of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related artifacts
- * @return a new SCA node.
- */
- public abstract SCANode createSCANode(String compositeURI,
- String compositeContent,
- SCAContribution... contributions);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/LICENSE b/branches/sca-java-1.5.1/modules/node-impl/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/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-java-1.5.1/modules/node-impl/NOTICE b/branches/sca-java-1.5.1/modules/node-impl/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/node-impl/pom.xml b/branches/sca-java-1.5.1/modules/node-impl/pom.xml
deleted file mode 100644
index cd415d9a5c..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/pom.xml
+++ /dev/null
@@ -1,154 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-node-impl</artifactId>
- <name>Apache Tuscany SCA Node Implementation</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-definitions-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-sca-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-databinding</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-endpoint</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.node.impl</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.node.impl*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java
deleted file mode 100644
index 419900c5ac..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2FactoryImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode2;
-import org.apache.tuscany.sca.node.SCANode2Factory;
-
-/**
- * Default implementation of an SCA node factory.
- *
- * @version $Rev$ $Date$
- * @deprecated
- */
-@Deprecated
-public class Node2FactoryImpl extends SCANode2Factory {
- public Node2FactoryImpl() {
- }
-
- @Override
- public SCANode2 createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader) {
- return new Node2Impl(classLoader, compositeURI);
- }
-
- @Override
- public SCANode2 createSCANodeFromURL(String configurationURI) {
- return new Node2Impl(configurationURI);
- }
-
- @Override
- public SCANode2 createSCANode(String compositeURI, SCAContribution... contributions) {
- return new Node2Impl(compositeURI, contributions);
- }
-
- @Override
- public SCANode2 createSCANode(String compositeURI, String compositeContent, SCAContribution... contributions) {
- return new Node2Impl(compositeURI, compositeContent, contributions);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.java
deleted file mode 100644
index bc2f10fb7e..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/Node2Impl.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.node.impl;
-
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode2;
-
-/**
- * Node2 Impl
- */
-public class Node2Impl extends NodeImpl implements SCANode2 {
-
- /**
- * @param configurationURI
- */
- public Node2Impl(String configurationURI) {
- super(configurationURI);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * @param classLoader
- * @param compositeURI
- */
- public Node2Impl(ClassLoader classLoader, String compositeURI) {
- super(classLoader, compositeURI);
- }
-
- /**
- * @param compositeURI
- * @param contributions
- */
- public Node2Impl(String compositeURI, SCAContribution[] contributions) {
- super(compositeURI, contributions);
- }
-
- /**
- * @param compositeURI
- * @param compositeContent
- * @param contributions
- */
- public Node2Impl(String compositeURI, String compositeContent, SCAContribution[] contributions) {
- super(compositeURI, compositeContent, contributions);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
deleted file mode 100644
index 7dd7da7f4f..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeFactoryImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-
-/**
- * Default implementation of an SCA node factory.
- *
- * @version $Rev$ $Date$
- */
-public class NodeFactoryImpl extends SCANodeFactory {
- public NodeFactoryImpl() {
- }
-
- @Override
- public SCANode createSCANodeFromClassLoader(String compositeURI, ClassLoader classLoader) {
- return new NodeImpl(classLoader, compositeURI);
- }
-
- @Override
- public SCANode createSCANodeFromURL(String configurationURI) {
- return new NodeImpl(configurationURI);
- }
-
- @Override
- public SCANode createSCANode(String compositeURI, SCAContribution... contributions) {
- return new NodeImpl(compositeURI, contributions);
- }
-
- @Override
- public SCANode createSCANode(String compositeURI, String compositeContent, SCAContribution... contributions) {
- return new NodeImpl(compositeURI, compositeContent, contributions);
- }
-
- @Override
- public SCANode createSCANode() {
- return new NodeImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
deleted file mode 100644
index 4a93993560..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
+++ /dev/null
@@ -1,897 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-package org.apache.tuscany.sca.node.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.ComponentService;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.CompositeService;
-import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.implementation.node.ConfiguredNodeImplementation;
-import org.apache.tuscany.sca.implementation.node.NodeImplementationFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.MonitorRuntimeException;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentContext;
-import org.osoa.sca.CallableReference;
-import org.osoa.sca.ServiceReference;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * A local representation of the SCADomain running on a single node
- *
- * @version $Rev$ $Date$
- */
-public class NodeImpl implements SCANode, SCAClient {
-
- private static final Logger logger = Logger.getLogger(NodeImpl.class.getName());
-
- // The node configuration name, used for logging
- private String configurationName;
-
- // The Tuscany runtime that does the hard work
- private RuntimeBootStrapper runtime;
- private CompositeActivator compositeActivator;
- private XMLInputFactory inputFactory;
- private ModelFactoryExtensionPoint modelFactories;
- private StAXArtifactProcessorExtensionPoint artifactProcessors;
- private URLArtifactProcessorExtensionPoint documentProcessors;
- private Monitor monitor;
-
- private List<Contribution> contributions;
- // The composite loaded into this node
- private Composite composite;
-
- /**
- * Constructs a new SCA node.
- *
- * @param configurationURI the URI of the node configuration information.
- */
- NodeImpl(String configurationURI) {
- configurationName = configurationURI;
- logger.log(Level.INFO, "Creating node: " + configurationName);
-
- try {
- // Initialize the runtime
- initRuntime();
-
- // Read the node configuration feed
- StAXArtifactProcessor<ConfiguredNodeImplementation> configurationProcessor =
- artifactProcessors.getProcessor(ConfiguredNodeImplementation.class);
- URL configurationURL = new URL(configurationURI);
- InputStream is = configurationURL.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- reader.nextTag();
- ConfiguredNodeImplementation configuration = configurationProcessor.read(reader);
- is.close();
-
- // Resolve contribution URLs
- for (Contribution contribution : configuration.getContributions()) {
- URL contributionURL = new URL(configurationURL, contribution.getLocation());
- contribution.setLocation(contributionURL.toString());
- }
-
- // Resolve composite URL
- URL compositeURL = new URL(configurationURL, configuration.getComposite().getURI());
- configuration.getComposite().setURI(compositeURL.toString());
-
- // Configure the node
- configureNode(configuration);
-
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Construct a node by discovering the node configuration on the classpath
- * @param classLoader
- * @param compositeURI
- */
- NodeImpl() {
- configurationName = "default";
- logger.log(Level.INFO, "Creating node: " + configurationName);
-
- try {
- initRuntime();
-
- ConfiguredNodeImplementation config = findNodeConfiguration(null, null);
- configureNode(config);
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Construct a node by discovering the node configuration (composite+contrbutions) on the classpath
- * @param classLoader
- * @param compositeURI
- */
- NodeImpl(ClassLoader classLoader, String compositeURI) {
- configurationName = compositeURI;
- logger.log(Level.INFO, "Creating node: " + configurationName);
-
- if (compositeURI != null) {
- //URI uri = URI.create(compositeURI);
- URI uri;
- try {
- uri = new URI(null, compositeURI, null);
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException("Invalid Composite URI: " + compositeURI, e);
- }
-
- if (uri.isAbsolute()) {
- throw new IllegalArgumentException("Composite URI must be a resource name: " + compositeURI);
- }
- }
- try {
- // Initialize the runtime
- initRuntime();
-
- ConfiguredNodeImplementation config = findNodeConfiguration(compositeURI, classLoader);
- configureNode(config);
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Throwable e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- /**
- * Discover the contribution on the classpath
- * @param compositeURI
- * @param classLoader
- * @return A configured node implementation
- * @throws Exception
- */
- private ConfiguredNodeImplementation findNodeConfiguration(final String compositeURI, ClassLoader classLoader)
- throws Exception {
- NodeImplementationFactory nodeImplementationFactory =
- modelFactories.getFactory(NodeImplementationFactory.class);
- ConfiguredNodeImplementation config = nodeImplementationFactory.createConfiguredNodeImplementation();
-
- // Default to thread context classloader
- if (classLoader == null) {
- classLoader = Thread.currentThread().getContextClassLoader();
- }
- String contributionArtifactPath = compositeURI;
- URL contributionArtifactURL = null;
- if (compositeURI != null) {
- contributionArtifactURL = getResource(classLoader, compositeURI);
- if (contributionArtifactURL == null) {
- throw new IllegalArgumentException("Composite not found: " + contributionArtifactPath);
- }
- // Set to relative URI to avoid duplicate loading
- Composite composite = createComposite(compositeURI);
- config.setComposite(composite);
- } else {
- // No composite is specified, tring to search the SCA metadata files
- contributionArtifactPath = Contribution.SCA_CONTRIBUTION_META;
- contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_META);
-
- if (contributionArtifactURL == null) {
- contributionArtifactPath = Contribution.SCA_CONTRIBUTION_GENERATED_META;
- contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_GENERATED_META);
- }
- if (contributionArtifactURL == null) {
- contributionArtifactPath = Contribution.SCA_CONTRIBUTION_DEPLOYABLES;
- contributionArtifactURL = getResource(classLoader, Contribution.SCA_CONTRIBUTION_DEPLOYABLES);
- }
-
- // No contribution can be discovered
- if (contributionArtifactURL == null) {
- throw new IllegalArgumentException("No default contribution can be discovered on the classpath");
- }
-
- // No composite will be created, all deployable composites will be used later
- }
-
- Contribution c = getContribution(contributionArtifactURL, contributionArtifactPath);
- config.getContributions().add(c);
-
- return config;
- }
-
- private Contribution getContribution(URL contributionArtifactURL, String contributionArtifactPath) {
- URL contributionURL = getContributionURL(contributionArtifactURL, contributionArtifactPath);
-
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
-
- SCAContribution contribution = new SCAContribution(contributionURL.toString(), contributionURL.toString());
- Contribution c = createContribution(contributionFactory, contribution);
- return c;
- }
-
- public static URL getContributionURL(URL contributionArtifactURL, String contributionArtifactPath) {
- URL contributionURL = null;
- // "jar:file://....../something.jar!/a/b/c/app.composite"
- try {
- String url = contributionArtifactURL.toExternalForm();
- String protocol = contributionArtifactURL.getProtocol();
- String escapedContributionArtifactPath = new URI(null, contributionArtifactPath, null).toASCIIString();
-
- if ("file".equals(protocol)) {
- // directory contribution
- if (url.endsWith(escapedContributionArtifactPath)) {
- final String location = url.substring(0, url.lastIndexOf(escapedContributionArtifactPath));
- // workaround from evil URL/URI form Maven
- // contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
- // Allow privileged access to open URL stream. Add FilePermission to added to
- // security policy file.
- try {
- contributionURL = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
- public URL run() throws IOException {
- return FileHelper.toFile(new URL(location)).toURI().toURL();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (MalformedURLException)e.getException();
- }
- }
-
- } else if ("jar".equals(protocol)) {
- // jar contribution
- String location = url.substring(4, url.lastIndexOf("!/"));
- // workaround for evil URL/URI from Maven
- contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
-
- } else if ("wsjar".equals(protocol)) {
- // See https://issues.apache.org/jira/browse/TUSCANY-2219
- // wsjar contribution
- String location = url.substring(6, url.lastIndexOf("!/"));
- // workaround for evil url/uri from maven
- contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
-
- } else if ("zip".equals(protocol)) {
- // See https://issues.apache.org/jira/browse/TUSCANY-2598
- // zip contribution, remove the zip prefix and pad with file:
- String location = "file:"+url.substring(4, url.lastIndexOf("!/"));
- contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
-
- } else if (protocol != null && (protocol.equals("bundle") || protocol.equals("bundleresource"))) {
- contributionURL =
- new URL(contributionArtifactURL.getProtocol(), contributionArtifactURL.getHost(),
- contributionArtifactURL.getPort(), "/");
- }
- } catch (MalformedURLException mfe) {
- throw new IllegalArgumentException(mfe);
- } catch (URISyntaxException use) {
- throw new IllegalArgumentException(use);
- }
- return contributionURL;
- }
-
- private static URL getResource(final ClassLoader classLoader, final String compositeURI) {
- return AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return classLoader.getResource(compositeURI);
- }
- });
- }
-
- /**
- * Constructs a new SCA node.
- *
- * @param compositeURI
- * @param contributions
- */
- NodeImpl(String compositeURI, SCAContribution[] contributions) {
- configurationName = compositeURI;
- logger.log(Level.INFO, "Creating node: " + configurationName);
-
- try {
- // Initialize the runtime
- initRuntime();
-
- URI uri = compositeURI == null ? null : URI.create(compositeURI);
- ConfiguredNodeImplementation configuration = null;
- if (contributions == null || contributions.length == 0) {
- if (uri != null && uri.getScheme() != null) {
- throw new IllegalArgumentException("No SCA contributions are provided");
- }
- configuration = findNodeConfiguration(compositeURI, null);
- } else {
-
- // Create a node configuration
- NodeImplementationFactory nodeImplementationFactory =
- modelFactories.getFactory(NodeImplementationFactory.class);
- configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
-
- Composite composite = compositeURI == null ? null : createComposite(compositeURI);
- configuration.setComposite(composite);
-
-
- // Create contribution models
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- for (SCAContribution c : contributions) {
- Contribution contribution = createContribution(contributionFactory, c);
- configuration.getContributions().add(contribution);
- }
- }
-
- // Configure the node
- configureNode(configuration);
-
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- private Composite createComposite(String compositeURI) {
- // Create composite model
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- Composite composite = assemblyFactory.createComposite();
- composite.setURI(compositeURI);
- composite.setUnresolved(true);
- return composite;
- }
-
- /**
- * Constructs a new SCA node.
- *
- * @param compositeURI
- * @param compositeContent
- * @param contributions
- */
- NodeImpl(String compositeURI, String compositeContent, SCAContribution[] contributions) {
- configurationName = compositeURI;
- logger.log(Level.INFO, "Creating node: " + configurationName);
-
- try {
- // Initialize the runtime
- initRuntime();
-
- ConfiguredNodeImplementation configuration = null;
- if (contributions == null || contributions.length == 0) {
- configuration = findNodeConfiguration(compositeURI, null);
- } else {
- // Create a node configuration
- NodeImplementationFactory nodeImplementationFactory =
- modelFactories.getFactory(NodeImplementationFactory.class);
- configuration = nodeImplementationFactory.createConfiguredNodeImplementation();
-
- // Read the composite model
- StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
- // URL compositeURL = new URL(compositeURI);
- logger.log(Level.INFO, "Loading composite: " + compositeURI);
-
- CompositeDocumentProcessor compositeDocProcessor =
- (CompositeDocumentProcessor)documentProcessors.getProcessor(Composite.class);
- composite =
- compositeDocProcessor.read(URI.create(compositeURI), new ByteArrayInputStream(compositeContent
- .getBytes("UTF-8")));
-
- analyzeProblems();
-
- configuration.setComposite(composite);
-
- // Create contribution models
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- for (SCAContribution c : contributions) {
- Contribution contribution = createContribution(contributionFactory, c);
- configuration.getContributions().add(contribution);
- }
- }
-
- // Configure the node
- configureNode(configuration);
-
- } catch (ServiceRuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- private static Contribution createContribution(ContributionFactory contributionFactory, SCAContribution c) {
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(c.getURI());
- contribution.setLocation(c.getLocation());
- contribution.setUnresolved(true);
- return contribution;
- }
-
- /**
- * Initialize the Tuscany runtime.
- *
- * @throws Exception
- */
- private void initRuntime() throws Exception {
-
- // Create a node runtime
- runtime = new RuntimeBootStrapper(Thread.currentThread().getContextClassLoader());
- runtime.start();
-
- // Get the various factories we need
- ExtensionPointRegistry registry = runtime.getExtensionPointRegistry();
- modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- inputFactory = modelFactories.getFactory(XMLInputFactory.class);
-
- // Create the required artifact processors
- artifactProcessors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-
- // Save the composite activator
- compositeActivator = runtime.getCompositeActivator();
-
- // save the monitor
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
- }
-
- /**
- * Escape the space in URL string
- * @param uri
- * @return
- */
- private static URI createURI(String uri) {
- if (uri.indexOf(' ') != -1) {
- uri = uri.replace(" ", "%20");
- }
- return URI.create(uri);
- }
-
- private void configureNode(ConfiguredNodeImplementation configuration) throws Exception {
-
- // Find if any contribution JARs already available locally on the classpath
- Map<String, URL> localContributions = localContributions();
-
- // Load the specified contributions
- ContributionService contributionService = runtime.getContributionService();
- contributions = new ArrayList<Contribution>();
- for (Contribution contribution : configuration.getContributions()) {
- URI uri = createURI(contribution.getLocation());
- if (uri.getScheme() == null) {
- uri = new File(contribution.getLocation()).toURI();
- }
- URL contributionURL = uri.toURL();
-
- // Extract contribution file name
- String file = contributionURL.getPath();
- int i = file.lastIndexOf('/');
- if (i != -1 && i < file.length() - 1) {
- file = file.substring(i + 1);
-
- // If we find the local contribution file on the classpath, use it in
- // place of the original contribution URL
- URL localContributionURL = localContributions.get(file);
- if (localContributionURL != null) {
- contributionURL = localContributionURL;
- }
- }
-
- // Load the contribution
- logger.log(Level.INFO, "Loading contribution: " + contributionURL);
- contributions.add(contributionService.contribute(contribution.getURI(), contributionURL, false));
- analyzeProblems();
- }
-
- composite = configuration.getComposite();
-
- if(composite != null && composite.isUnresolved()) {
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- Artifact compositeFile = contributionFactory.createArtifact();
- compositeFile.setUnresolved(true);
- compositeFile.setURI(composite.getURI());
- for (Contribution c : contributions) {
- ModelResolver resolver = c.getModelResolver();
- Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
- if (resolved != null && resolved.isUnresolved() == false) {
- composite = (Composite) resolved.getModel();
- break;
- }
- }
- }
-
- // FIXME: This is a hack to get a list of deployable composites. By design, the deployment composite should
- // has been configured
- if (composite == null) {
- List<Composite> deployables = new ArrayList<Composite>();
- for (Contribution c : contributions) {
- deployables.addAll(c.getDeployables());
- }
- aggregate(deployables);
- configuration.setComposite(composite);
- }
-
- Contribution contribution = null;
- if (composite.getName() == null) {
- // Load the specified composite
- URL compositeURL;
-
- URI uri = createURI(configuration.getComposite().getURI());
- if (uri.getScheme() == null) {
-
- // If the composite URI is a relative URI, try to resolve it within the contributions
- contribution = contribution(contributions, uri.toString());
- if (contribution == null) {
- throw new IllegalArgumentException("Composite is not found in contributions: " + uri);
- }
- compositeURL = new URL(location(contribution, uri.toString()));
-
- } else {
-
- // If the composite URI is an absolute URI, use it as is
- compositeURL = uri.toURL();
- }
-
- URLArtifactProcessor<Composite> compositeDocProcessor = documentProcessors.getProcessor(Composite.class);
- // Read the composite
- logger.log(Level.INFO, "Loading composite: " + compositeURL);
- // InputStream is = compositeURL.openStream();
- // XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- try {
- composite = compositeDocProcessor.read(null, uri, compositeURL);
- } catch (ContributionReadException e) {
- // ignore - errors will be detected by analyzeProblems() call below
- }
- // reader.close();
-
- analyzeProblems();
-
- }
- // And resolve the composite within the scope of the last contribution
- if (contribution == null && contributions.size() != 0) {
- contribution = contributions.get(contributions.size() - 1);
- }
-
- // Resolve the given composite within the scope of the selected contribution
- if (contribution != null) {
- StAXArtifactProcessor<Composite> compositeProcessor = artifactProcessors.getProcessor(Composite.class);
- compositeProcessor.resolve(composite, contribution.getModelResolver());
- analyzeProblems();
- }
- // Create a top level composite to host our composite
- // This is temporary to make the activator happy
- AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
- Composite tempComposite = assemblyFactory.createComposite();
- tempComposite.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "temp"));
- tempComposite.setURI("http://tuscany.apache.org/xmlns/sca/1.0");
-
- // Include the node composite in the top-level composite
- tempComposite.getIncludes().add(composite);
-
- // set the top level composite on the composite activator as
- // logic in callable reference resolution relies on this being
- // available
- compositeActivator.setDomainComposite(tempComposite);
-
- // Build the composite
- runtime.buildComposite(composite);
-
- analyzeProblems();
- }
-
- /**
- * Create a deployment composite that includes a list of deployable composites
- * @param composites
- */
- private void aggregate(List<Composite> composites) {
- if (composites.size() == 0) {
- throw new IllegalArgumentException("No deployable composite is declared");
- } else if (composites.size() == 1) {
- composite = composites.get(0);
- } else {
- // Include all composites
- AssemblyFactory assemblyFactory = runtime.getAssemblyFactory();
- Composite aggregated = assemblyFactory.createComposite();
- aggregated.setName(new QName("http://tuscany.apache.org/xmlns/sca/1.0", "aggregated"));
- aggregated.setURI("http://tuscany.apache.org/xmlns/sca/1.0/aggregated");
- aggregated.getIncludes().addAll(composites);
- composite = aggregated;
- }
- }
-
- /**
- * Returns the artifact representing the given composite.
- *
- * @param contribution
- * @param compositeURI
- * @return
- */
- private String location(Contribution contribution, String uri) {
- if (uri != null && uri.startsWith("/")) {
- uri = uri.substring(1);
- }
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- Artifact compositeFile = contributionFactory.createArtifact();
- compositeFile.setUnresolved(true);
- compositeFile.setURI(uri);
- ModelResolver resolver = contribution.getModelResolver();
- Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
- if (resolved != null && !resolved.isUnresolved()) {
- return resolved.getLocation();
- } else {
- return null;
- }
- }
-
- /**
- * Returns the contribution containing the given composite.
- *
- * @param contributions
- * @param compositeURI
- * @return
- */
- private Contribution contribution(List<Contribution> contributions, String compositeURI) {
- if (compositeURI != null && compositeURI.startsWith("/")) {
- compositeURI = compositeURI.substring(1);
- }
- ContributionFactory contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- Artifact compositeFile = contributionFactory.createArtifact();
- compositeFile.setUnresolved(true);
- compositeFile.setURI(compositeURI);
- for (Contribution c : contributions) {
- ModelResolver resolver = c.getModelResolver();
- Artifact resolved = resolver.resolveModel(Artifact.class, compositeFile);
- if (resolved != null && !resolved.isUnresolved()) {
- return c;
- }
- }
- return null;
- }
-
- private void analyzeProblems() throws Exception {
-
- for (Problem problem : monitor.getProblems()) {
- if ((problem.getSeverity() == Severity.ERROR) && (!problem.getMessageId().equals("SchemaError"))) {
- if (problem.getCause() != null) {
- throw new ServiceRuntimeException(new MonitorRuntimeException(problem.getCause()));
- } else {
- throw new ServiceRuntimeException(new MonitorRuntimeException(problem.toString()));
- }
- }
- }
- }
-
- public void start() {
- logger.log(Level.INFO, "Starting node: " + configurationName);
-
- try {
-
- // Activate the composite
- compositeActivator.activate(composite);
-
- // Start the composite
- compositeActivator.start(composite);
-
- } catch (ActivationException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public void stop() {
- logger.log(Level.INFO, "Stopping node: " + configurationName);
-
- try {
-
- // Stop the composite
- compositeActivator.stop(composite);
-
- // Deactivate the composite
- compositeActivator.deactivate(composite);
-
- runtime.stop();
- } catch (ActivationException e) {
- throw new ServiceRuntimeException(e);
- }
- }
-
- public <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException {
- return (R)runtime.getProxyFactory().cast(target);
- }
-
- public <B> B getService(Class<B> businessInterface, String serviceName) {
-
- ServiceReference<B> serviceReference = getServiceReference(businessInterface, serviceName);
- if (serviceReference == null) {
- throw new ServiceRuntimeException("Service not found: " + serviceName);
- }
- return serviceReference.getService();
- }
-
- public <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String name) {
-
- // Extract the component name
- String componentName;
- String serviceName;
- int i = name.indexOf('/');
- if (i != -1) {
- componentName = name.substring(0, i);
- serviceName = name.substring(i + 1);
-
- } else {
- componentName = name;
- serviceName = null;
- }
-
- // Lookup the component
- Component component = null;
-
- for (Component compositeComponent : composite.getComponents()) {
- if (compositeComponent.getName().equals(componentName)) {
- component = compositeComponent;
- break;
- }
- }
-
- if (component == null) {
- throw new ServiceRuntimeException("The service " + name + " has not been contributed to the domain");
- }
- RuntimeComponentContext componentContext = null;
-
- // If the component is a composite, then we need to find the
- // non-composite component that provides the requested service
- if (component.getImplementation() instanceof Composite) {
- for (ComponentService componentService : component.getServices()) {
- if (serviceName == null || serviceName.equals(componentService.getName())) {
- CompositeService compositeService = (CompositeService)componentService.getService();
- if (compositeService != null) {
- if (serviceName != null) {
- serviceName = "$promoted$" + component.getName() + "$slash$" + serviceName;
- }
- componentContext =
- ((RuntimeComponent)compositeService.getPromotedComponent()).getComponentContext();
-
- if (componentContext == null){
- // there is a break in the promotion chain so just let and exception
- // be thrown
- break;
- }
- return componentContext.createSelfReference(businessInterface, compositeService
- .getPromotedService());
- }
- break;
- }
- }
- // No matching service found
- throw new ServiceRuntimeException("Composite service not found: " + name);
- } else {
- componentContext = ((RuntimeComponent)component).getComponentContext();
- if (serviceName != null) {
- return componentContext.createSelfReference(businessInterface, serviceName);
- } else {
- return componentContext.createSelfReference(businessInterface);
- }
- }
- }
-
- /**
- * Returns the extension point registry used by this node.
- *
- * @return
- */
- public ExtensionPointRegistry getExtensionPointRegistry() {
- return runtime.getExtensionPointRegistry();
- }
-
- /**
- * Returns the composite being run by this node.
- *
- * @return
- */
- public Composite getComposite() {
- return composite;
- }
-
- /**
- * Returns contribution JARs available on the classpath.
- *
- * @return
- */
- private static Map<String, URL> localContributions() {
- Map<String, URL> localContributions = new HashMap<String, URL>();
- collectJARs(localContributions, Thread.currentThread().getContextClassLoader());
- return localContributions;
- }
-
- /**
- * Collect JARs on the classpath of a URLClassLoader
- * @param urls
- * @param cl
- */
- private static void collectJARs(Map<String, URL> urls, ClassLoader cl) {
- if (cl == null) {
- return;
- }
-
- // Collect JARs from the URLClassLoader's classpath
- if (cl instanceof URLClassLoader) {
- URL[] jarURLs = ((URLClassLoader)cl).getURLs();
- if (jarURLs != null) {
- for (URL jarURL : jarURLs) {
- String file = jarURL.getPath();
- int i = file.lastIndexOf('/');
- if (i != -1 && i < file.length() - 1) {
- file = file.substring(i + 1);
- urls.put(file, jarURL);
- }
- }
- }
- }
-
- // Collect JARs from the parent ClassLoader
- collectJARs(urls, cl.getParent());
- }
-
- public CompositeActivator getCompositeActivator() {
- return compositeActivator;
- }
-
- public RuntimeBootStrapper getRuntime() {
- return runtime;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java
deleted file mode 100644
index 4d78bf8dfe..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.RuntimeAssemblyFactory;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.ExtensibleProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.impl.SCADefinitionsImpl;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderExtensionPoint;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeBootStrapper {
- private static final Logger logger = Logger.getLogger(RuntimeBootStrapper.class.getName());
- private List<ModuleActivator> modules;
- private ExtensionPointRegistry registry;
-
- private ClassLoader classLoader;
- private AssemblyFactory assemblyFactory;
- private ContributionService contributionService;
- private CompositeActivator compositeActivator;
- private CompositeBuilder compositeBuilder;
- // private DomainBuilder domainBuilder;
- private WorkScheduler workScheduler;
- private ScopeRegistry scopeRegistry;
- private ProxyFactory proxyFactory;
- private List<SCADefinitions> policyDefinitions;
- private ModelResolver policyDefinitionsResolver;
- private Monitor monitor;
- private ConversationManager conversationManager;
-
- public RuntimeBootStrapper(ClassLoader classLoader) {
- this.classLoader = classLoader;
- registry = new DefaultExtensionPointRegistry();
- }
-
- public void start() throws ActivationException {
- long start = System.currentTimeMillis();
-
- // Create our extension point registry
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
-
- // Get work scheduler
- workScheduler = utilities.getUtility(WorkScheduler.class);
-
- conversationManager = utilities.getUtility(ConversationManager.class);
-
- // Create an interface contract mapper
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- // Get factory extension point
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Get Message factory
- MessageFactory messageFactory = factories.getFactory(MessageFactory.class);
-
- // Get proxy factory
- ProxyFactoryExtensionPoint proxyFactories = registry.getExtensionPoint(ProxyFactoryExtensionPoint.class);
- proxyFactory = new ExtensibleProxyFactory(proxyFactories);
-
- // Create model factories
- assemblyFactory = new RuntimeAssemblyFactory();
- factories.addFactory(assemblyFactory);
- PolicyFactory policyFactory = new DefaultPolicyFactory();
- factories.addFactory(policyFactory);
-
- // Load the runtime modules
- modules = loadModules(registry);
-
- // Start the runtime modules
- startModules(registry, modules);
-
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory intentAttachPointTypeFactory = new DefaultIntentAttachPointTypeFactory();
- factories.addFactory(intentAttachPointTypeFactory);
- ContributionFactory contributionFactory = factories.getFactory(ContributionFactory.class);
-
- // Create a monitor
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
-
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- } else {
- monitorFactory = new DefaultMonitorFactoryImpl();
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
-
- // Create a contribution service
- policyDefinitions = new ArrayList<SCADefinitions>();
- policyDefinitionsResolver = new DefaultModelResolver();
- contributionService =
- RuntimeBuilder.createContributionService(classLoader,
- registry,
- contributionFactory,
- assemblyFactory,
- policyFactory,
- mapper,
- policyDefinitions,
- policyDefinitionsResolver,
- monitor);
-
- // add the contribution service into the utility extension point
- utilities.addUtility(contributionService);
-
- // Create the ScopeRegistry
- scopeRegistry = RuntimeBuilder.createScopeRegistry(registry);
-
- // Create a composite activator
- compositeActivator =
- RuntimeBuilder.createCompositeActivator(registry,
- assemblyFactory,
- messageFactory,
- scaBindingFactory,
- mapper,
- proxyFactory,
- scopeRegistry,
- workScheduler);
-
- // Load the definitions.xml
- loadSCADefinitions();
-
- if (logger.isLoggable(Level.FINE)) {
- long end = System.currentTimeMillis();
- logger.fine("The tuscany runtime is started in " + (end - start) + " ms.");
- }
- }
-
- public void stop() throws ActivationException {
- long start = System.currentTimeMillis();
-
- // Stop the runtime modules
- stopModules(registry, modules);
-
- // Stop and destroy the work manager
- workScheduler.destroy();
-
- conversationManager.destroy();
- conversationManager = null;
-
- // Cleanup
- modules = null;
- registry = null;
- assemblyFactory = null;
- contributionService = null;
- compositeActivator = null;
- workScheduler = null;
- scopeRegistry = null;
-
- if (logger.isLoggable(Level.FINE)) {
- long end = System.currentTimeMillis();
- logger.fine("The tuscany runtime is stopped in " + (end - start) + " ms.");
- }
- }
-
- public void buildComposite(Composite composite) throws CompositeBuilderException {
- //Get factory extension point
- ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- SCABindingFactory scaBindingFactory = factories.getFactory(SCABindingFactory.class);
- IntentAttachPointTypeFactory intentAttachPointTypeFactory =
- factories.getFactory(IntentAttachPointTypeFactory.class);
- EndpointFactory endpointFactory = factories.getFactory(EndpointFactory.class);
- DocumentBuilderFactory documentBuilderFactory = factories.getFactory(DocumentBuilderFactory.class);
- TransformerFactory transformerFactory = factories.getFactory(TransformerFactory.class);
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- InterfaceContractMapper mapper = utilities.getUtility(InterfaceContractMapper.class);
-
- //Create a composite builder
- SCADefinitions aggregatedDefinitions = new SCADefinitionsImpl();
- for (SCADefinitions definition : ((List<SCADefinitions>)policyDefinitions)) {
- SCADefinitionsUtil.aggregateSCADefinitions(definition, aggregatedDefinitions);
- }
- compositeBuilder =
- RuntimeBuilder.createCompositeBuilder(monitor,
- assemblyFactory,
- scaBindingFactory,
- endpointFactory,
- intentAttachPointTypeFactory,
- documentBuilderFactory,
- transformerFactory,
- mapper,
- aggregatedDefinitions);
- compositeBuilder.build(composite);
-
- }
-
- public ContributionService getContributionService() {
- return contributionService;
- }
-
- public CompositeActivator getCompositeActivator() {
- return compositeActivator;
- }
-
- public CompositeBuilder getCompositeBuilder() {
- return compositeBuilder;
- }
-
- public AssemblyFactory getAssemblyFactory() {
- return assemblyFactory;
- }
-
- private void loadSCADefinitions() throws ActivationException {
- try {
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- URLArtifactProcessor<SCADefinitions> definitionsProcessor =
- documentProcessors.getProcessor(SCADefinitions.class);
- SCADefinitionsProviderExtensionPoint scaDefnProviders =
- registry.getExtensionPoint(SCADefinitionsProviderExtensionPoint.class);
-
- SCADefinitions systemSCADefinitions = new SCADefinitionsImpl();
- SCADefinitions aSCADefn = null;
- for (SCADefinitionsProvider aProvider : scaDefnProviders.getSCADefinitionsProviders()) {
- aSCADefn = aProvider.getSCADefinition();
- SCADefinitionsUtil.aggregateSCADefinitions(aSCADefn, systemSCADefinitions);
- }
-
- policyDefinitions.add(systemSCADefinitions);
-
- //we cannot expect that providers will add the intents and policysets into the resolver
- //so we do this here explicitly
- for (Intent intent : systemSCADefinitions.getPolicyIntents()) {
- policyDefinitionsResolver.addModel(intent);
- }
-
- for (PolicySet policySet : systemSCADefinitions.getPolicySets()) {
- policyDefinitionsResolver.addModel(policySet);
- }
-
- for (IntentAttachPointType attachPoinType : systemSCADefinitions.getBindingTypes()) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- for (IntentAttachPointType attachPoinType : systemSCADefinitions.getImplementationTypes()) {
- policyDefinitionsResolver.addModel(attachPoinType);
- }
-
- //now that all system sca definitions have been read, lets resolve them right away
- definitionsProcessor.resolve(systemSCADefinitions, policyDefinitionsResolver);
- } catch (Exception e) {
- throw new ActivationException(e);
- }
- }
-
- private List<ModuleActivator> loadModules(ExtensionPointRegistry registry) throws ActivationException {
-
- // Load and instantiate the modules found on the classpath (or any registered ClassLoaders)
- modules = new ArrayList<ModuleActivator>();
- try {
- Set<ServiceDeclaration> moduleActivators =
- ServiceDiscovery.getInstance().getServiceDeclarations(ModuleActivator.class);
- List<ServiceDeclaration> orderedModuleActivators = sort(moduleActivators);
- Set<String> moduleClasses = new HashSet<String>();
- for (ServiceDeclaration moduleDeclarator : orderedModuleActivators) {
- if (moduleClasses.contains(moduleDeclarator.getClassName())) {
- continue;
- }
- moduleClasses.add(moduleDeclarator.getClassName());
- Class<?> moduleClass = moduleDeclarator.loadClass();
- ModuleActivator module = (ModuleActivator)moduleClass.newInstance();
- modules.add(module);
- }
- } catch (IOException e) {
- throw new ActivationException(e);
- } catch (ClassNotFoundException e) {
- throw new ActivationException(e);
- } catch (InstantiationException e) {
- throw new ActivationException(e);
- } catch (IllegalAccessException e) {
- throw new ActivationException(e);
- }
-
- return modules;
- }
-
- private void startModules(ExtensionPointRegistry registry, List<ModuleActivator> modules)
- throws ActivationException {
- boolean debug = logger.isLoggable(Level.FINE);
- // Start all the extension modules
- for (ModuleActivator module : modules) {
- long start = 0L;
- if (debug) {
- logger.fine(module.getClass().getName() + " is starting.");
- start = System.currentTimeMillis();
- }
- try {
- module.start(registry);
- if (debug) {
- long end = System.currentTimeMillis();
- logger.fine(module.getClass().getName() + " is started in " + (end - start) + " ms.");
- }
- } catch (Throwable e) {
- logger.log(Level.WARNING, "Exception starting module " + module.getClass().getName()
- + " :"
- + e.getMessage());
- logger.log(Level.FINE, "Exception starting module " + module.getClass().getName(), e);
- }
- }
- }
-
- private void stopModules(final ExtensionPointRegistry registry, List<ModuleActivator> modules) {
- boolean debug = logger.isLoggable(Level.FINE);
- for (ModuleActivator module : modules) {
- long start = 0L;
- if (debug) {
- logger.fine(module.getClass().getName() + " is stopping.");
- start = System.currentTimeMillis();
- }
- module.stop(registry);
- if (debug) {
- long end = System.currentTimeMillis();
- logger.fine(module.getClass().getName() + " is stopped in " + (end - start) + " ms.");
- }
- }
- }
-
- /**
- * @return the proxyFactory
- */
- public ProxyFactory getProxyFactory() {
- return proxyFactory;
- }
-
- /**
- * @return the registry
- */
- public ExtensionPointRegistry getExtensionPointRegistry() {
- return registry;
- }
-
- @SuppressWarnings("unchecked")
- private static List<ServiceDeclaration> sort(Set<ServiceDeclaration> servicesDeclaration) {
- ServiceDeclaration[] servicesArray = new ServiceDeclaration[servicesDeclaration.size()];
- servicesArray = (ServiceDeclaration[])servicesDeclaration.toArray(servicesArray);
- Arrays.sort(servicesArray, new Comparator() {
- public int compare(final Object xObj, final Object yObj) {
- String xPriority = ((ServiceDeclaration) xObj).getAttributes().get("priority");
- String yPriority = ((ServiceDeclaration) yObj).getAttributes().get("priority");
-
- long x = 0, y = 0;
- if (xPriority != null && xPriority.length() > 0) {
- x = Long.parseLong(xPriority);
- }
-
- if (yPriority != null && yPriority.length() > 0) {
- y = Long.parseLong(yPriority);
- }
-
- return x > y ? 1 : -1;
- }
- });
- return Arrays.asList(servicesArray);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java b/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java
deleted file mode 100644
index f609e15c5c..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.transform.TransformerFactory;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.EndpointFactory;
-import org.apache.tuscany.sca.assembly.SCABindingFactory;
-import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
-import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
-import org.apache.tuscany.sca.assembly.xml.CompositeDocumentProcessor;
-import org.apache.tuscany.sca.context.ContextFactoryExtensionPoint;
-import org.apache.tuscany.sca.context.RequestContextFactory;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidatingXMLInputFactory;
-import org.apache.tuscany.sca.contribution.processor.DefaultValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensiblePackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessor;
-import org.apache.tuscany.sca.contribution.processor.PackageProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ValidationSchemaExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionListenerExtensionPoint;
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.ContributionService;
-import org.apache.tuscany.sca.contribution.service.ExtensibleContributionListener;
-import org.apache.tuscany.sca.contribution.service.TypeDescriber;
-import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
-import org.apache.tuscany.sca.contribution.service.impl.ContributionServiceImpl;
-import org.apache.tuscany.sca.contribution.service.impl.PackageTypeDescriberImpl;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.core.assembly.ActivationException;
-import org.apache.tuscany.sca.core.assembly.CompositeActivator;
-import org.apache.tuscany.sca.core.assembly.CompositeActivatorImpl;
-import org.apache.tuscany.sca.core.conversation.ConversationManager;
-import org.apache.tuscany.sca.core.invocation.ExtensibleWireProcessor;
-import org.apache.tuscany.sca.core.invocation.ProxyFactory;
-import org.apache.tuscany.sca.core.scope.CompositeScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ConversationalScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.RequestScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ScopeContainerFactory;
-import org.apache.tuscany.sca.core.scope.ScopeRegistry;
-import org.apache.tuscany.sca.core.scope.ScopeRegistryImpl;
-import org.apache.tuscany.sca.core.scope.StatelessScopeContainerFactory;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.endpointresolver.EndpointResolverFactoryExtensionPoint;
-import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
-import org.apache.tuscany.sca.invocation.MessageFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessor;
-import org.apache.tuscany.sca.runtime.RuntimeWireProcessorExtensionPoint;
-import org.apache.tuscany.sca.work.WorkScheduler;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class RuntimeBuilder {
-
- // private static final Logger logger = Logger.getLogger(RuntimeBuilder.class.getName());
-
- public static CompositeActivator createCompositeActivator(ExtensionPointRegistry registry,
- AssemblyFactory assemblyFactory,
- MessageFactory messageFactory,
- SCABindingFactory scaBindingFactory,
- InterfaceContractMapper mapper,
- ProxyFactory proxyFactory,
- ScopeRegistry scopeRegistry,
- WorkScheduler workScheduler) {
-
- // Create a wire post processor extension point
- RuntimeWireProcessorExtensionPoint wireProcessors =
- registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
- RuntimeWireProcessor wireProcessor = new ExtensibleWireProcessor(wireProcessors);
-
- // Retrieve the processors extension point
- StAXArtifactProcessorExtensionPoint processors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- // Create a provider factory extension point
- ProviderFactoryExtensionPoint providerFactories =
- registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
-
- // Create a endpoint resolver factory extension point
- EndpointResolverFactoryExtensionPoint endpointResolverFactories =
- registry.getExtensionPoint(EndpointResolverFactoryExtensionPoint.class);
-
- JavaInterfaceFactory javaInterfaceFactory =
- registry.getExtensionPoint(ModelFactoryExtensionPoint.class).getFactory(JavaInterfaceFactory.class);
- RequestContextFactory requestContextFactory =
- registry.getExtensionPoint(ContextFactoryExtensionPoint.class).getFactory(RequestContextFactory.class);
-
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- ConversationManager conversationManager = utilities.getUtility(ConversationManager.class);
-
- // Create the composite activator
- CompositeActivator compositeActivator =
- new CompositeActivatorImpl(assemblyFactory, messageFactory, javaInterfaceFactory, scaBindingFactory,
- mapper, scopeRegistry, workScheduler, wireProcessor, requestContextFactory,
- proxyFactory, providerFactories, endpointResolverFactories, processors,
- conversationManager);
-
- return compositeActivator;
- }
-
- public static CompositeBuilder createCompositeBuilder(Monitor monitor,
- AssemblyFactory assemblyFactory,
- SCABindingFactory scaBindingFactory,
- EndpointFactory endpointFactory,
- IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- DocumentBuilderFactory documentBuilderFactory,
- TransformerFactory transformerFactory,
- InterfaceContractMapper interfaceContractMapper,
- SCADefinitions policyDefinitions) {
-
- return new CompositeBuilderImpl(assemblyFactory, endpointFactory, scaBindingFactory,
- intentAttachPointTypeFactory, documentBuilderFactory, transformerFactory,
- interfaceContractMapper, policyDefinitions,
- monitor);
- }
-
- /**
- * Create the contribution service used by this domain.
- *
- * @throws ActivationException
- */
- public static ContributionService createContributionService(ClassLoader classLoader,
- ExtensionPointRegistry registry,
- ContributionFactory contributionFactory,
- AssemblyFactory assemblyFactory,
- PolicyFactory policyFactory,
- InterfaceContractMapper mapper,
- List<SCADefinitions> policyDefinitions,
- ModelResolver policyDefinitionResolver,
- Monitor monitor) throws ActivationException {
-
- // Get the model factory extension point
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
-
- // Create a new XML input factory
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
-
- // Create a validation XML schema extension point
- ValidationSchemaExtensionPoint schemas = registry.getExtensionPoint(ValidationSchemaExtensionPoint.class);
-
- // Create a validating XML input factory
- XMLInputFactory validatingInputFactory = new DefaultValidatingXMLInputFactory(inputFactory, schemas, monitor);
- modelFactories.addFactory(validatingInputFactory);
-
- // Create StAX artifact processor extension point
- StAXArtifactProcessorExtensionPoint staxProcessors =
- registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
-
- // Create and register StAX processors for SCA assembly XML
- // Allow privileged access to factory. Requires RuntimePermission in security policy file.
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- ExtensibleStAXArtifactProcessor staxProcessor =
- new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
-
- // Create URL artifact processor extension point
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
-
- // Create and register document processors for SCA assembly XML
- DocumentBuilderFactory documentBuilderFactory = modelFactories.getFactory(DocumentBuilderFactory.class);
- documentBuilderFactory.setNamespaceAware(true);
- documentProcessors.getProcessor(Composite.class);
- documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, validatingInputFactory,
- documentBuilderFactory, policyDefinitions, monitor));
-
- // Create Model Resolver extension point
- ModelResolverExtensionPoint modelResolvers = registry.getExtensionPoint(ModelResolverExtensionPoint.class);
-
- // Create contribution package processor extension point
- TypeDescriber describer = new PackageTypeDescriberImpl();
- PackageProcessor packageProcessor =
- new ExtensiblePackageProcessor(registry.getExtensionPoint(PackageProcessorExtensionPoint.class), describer,
- monitor);
-
- // Create contribution listener
- ExtensibleContributionListener contributionListener =
- new ExtensibleContributionListener(registry.getExtensionPoint(ContributionListenerExtensionPoint.class));
-
- // Create a contribution repository
- ContributionRepository repository;
- try {
- repository = new ContributionRepositoryImpl("target", inputFactory, monitor);
- } catch (IOException e) {
- throw new ActivationException(e);
- }
-
- ExtensibleURLArtifactProcessor documentProcessor =
- new ExtensibleURLArtifactProcessor(documentProcessors, monitor);
-
- // Create the contribution service
- ContributionService contributionService =
- new ContributionServiceImpl(repository, packageProcessor, documentProcessor, staxProcessor,
- contributionListener, policyDefinitionResolver, modelResolvers, modelFactories,
- assemblyFactory, contributionFactory, inputFactory, policyDefinitions, registry, monitor);
- return contributionService;
- }
-
- public static ScopeRegistry createScopeRegistry(ExtensionPointRegistry registry) {
- ScopeRegistry scopeRegistry = new ScopeRegistryImpl();
- ScopeContainerFactory[] factories =
- new ScopeContainerFactory[] {new CompositeScopeContainerFactory(), new StatelessScopeContainerFactory(),
- new RequestScopeContainerFactory(),
- new ConversationalScopeContainerFactory(null),
- // new HttpSessionScopeContainer(monitor)
- };
- for (ScopeContainerFactory f : factories) {
- scopeRegistry.register(f);
- }
-
- //FIXME Pass the scope container differently as it's not an extension point
- registry.addExtensionPoint(scopeRegistry);
-
- return scopeRegistry;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory b/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory
deleted file mode 100644
index 4215855ac9..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANode2Factory
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.node.impl.Node2FactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory b/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory
deleted file mode 100644
index 800bdd84cc..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.node.SCANodeFactory
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-org.apache.tuscany.sca.node.impl.NodeFactoryImpl \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorld.java b/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorld.java
deleted file mode 100644
index 2f519cb81d..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorld.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 hello;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * HelloWorld interface
- */
-@Remotable
-public interface HelloWorld {
- String hello(String name);
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorldImpl.java b/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorldImpl.java
deleted file mode 100644
index c9a7560b12..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/hello/HelloWorldImpl.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 hello;
-
-/**
- * HelloWorldImpl
- */
-public class HelloWorldImpl implements HelloWorld {
- public String hello(String name) {
- System.out.println("Hello: " + name);
- return "Hello, " + name;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java b/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java
deleted file mode 100644
index 52d96dd72d..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/Node2ImplTestCase.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * \"License\"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import hello.HelloWorld;
-
-import java.io.File;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode2;
-import org.apache.tuscany.sca.node.SCANode2Factory;
-import org.junit.Test;
-
-/**
- * Test case for Node2Impl
- */
-public class Node2ImplTestCase {
- private static String composite =
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"" + " xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\""
- + " targetNamespace=\"http://sample/composite\""
- + " xmlns:sc=\"http://sample/composite\""
- + " name=\"HelloWorld\">"
- + " <component name=\"HelloWorld\">"
- + " <implementation.java class=\"hello.HelloWorldImpl\"/>"
- + " </component>"
- + " </composite>";
-
- @Test
- public void testNodeWithCompositeContent() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- SCANode2 node = factory.createSCANode("HelloWorld.composite", composite, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithCompositeContentAndNoContribution() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCANode2 node = factory.createSCANode("HelloWorld.composite", composite);
- testNode(node);
- }
-
- @Test
- public void testNodeWithoutCompositeURI() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- SCANode2 node = factory.createSCANode(null, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithCompositeURI() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
- SCANode2 node = factory.createSCANode(compositeURI, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithRelativeCompositeURI() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- String compositeURI = "HelloWorld.composite";
- SCANode2 node = factory.createSCANode(compositeURI, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithRelativeCompositeURIAndNoContribution() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- String compositeURI = "HelloWorld.composite";
- SCANode2 node = factory.createSCANode(compositeURI, new SCAContribution[0]);
- testNode(node);
- }
-
- @Test
- public void testNodeWithClassLoader() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- String compositeURI = "HelloWorld.composite";
- SCANode2 node = factory.createSCANodeFromClassLoader(compositeURI, HelloWorld.class.getClassLoader());
- testNode(node);
- }
-
- @Test
- public void testNodeWithClassLoaderAndNullComposite() {
- SCANode2Factory factory = SCANode2Factory.newInstance();
- SCANode2 node = factory.createSCANodeFromClassLoader(null, HelloWorld.class.getClassLoader());
- testNode(node);
- }
-
- private void testNode(SCANode2 node) {
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java b/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
deleted file mode 100644
index d620f6b62a..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/java/org/apache/tuscany/sca/node/impl/NodeImplTestCase.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * \"License\"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.impl;
-
-import hello.HelloWorld;
-
-import java.io.File;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCAContribution;
-import org.apache.tuscany.sca.node.SCANode;
-import org.apache.tuscany.sca.node.SCANodeFactory;
-import org.junit.Test;
-
-/**
- * Test case for NodeImpl
- */
-public class NodeImplTestCase {
- private static String composite =
- "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\"" + " xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\""
- + " targetNamespace=\"http://sample/composite\""
- + " xmlns:sc=\"http://sample/composite\""
- + " name=\"HelloWorld\">"
- + " <component name=\"HelloWorld\">"
- + " <implementation.java class=\"hello.HelloWorldImpl\"/>"
- + " </component>"
- + " </composite>";
-
- @Test
- public void testNodeWithCompositeContent() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- SCANode node = factory.createSCANode("HelloWorld.composite", composite, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithCompositeContentAndNoContribution() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCANode node = factory.createSCANode("HelloWorld.composite", composite);
- testNode(node);
- }
-
- @Test
- public void testNodeWithoutCompositeURI() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- SCANode node = factory.createSCANode(null, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithCompositeURI() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- String compositeURI = new File("target/test-classes/HelloWorld.composite").toURI().toString();
- SCANode node = factory.createSCANode(compositeURI, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithRelativeCompositeURI() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCAContribution contribution = new SCAContribution("c1", new File("target/test-classes").toURI().toString());
- String compositeURI = "HelloWorld.composite";
- SCANode node = factory.createSCANode(compositeURI, contribution);
- testNode(node);
- }
-
- @Test
- public void testNodeWithRelativeCompositeURIAndNoContribution() {
- SCANodeFactory factory = new NodeFactoryImpl();
- String compositeURI = "HelloWorld.composite";
- SCANode node = factory.createSCANode(compositeURI, new SCAContribution[0]);
- testNode(node);
- }
-
- @Test
- public void testNodeWithClassLoader() {
- SCANodeFactory factory = new NodeFactoryImpl();
- String compositeURI = "HelloWorld.composite";
- SCANode node = factory.createSCANodeFromClassLoader(compositeURI, HelloWorld.class.getClassLoader());
- testNode(node);
- }
-
- @Test
- public void testNodeWithClassLoaderAndNullComposite() {
- SCANodeFactory factory = new NodeFactoryImpl();
- SCANode node = factory.createSCANodeFromClassLoader(null, HelloWorld.class.getClassLoader());
- testNode(node);
- }
-
- private void testNode(SCANode node) {
- node.start();
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- Assert.assertEquals("Hello, Node", hw.hello("Node"));
- node.stop();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/HelloWorld.composite b/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/HelloWorld.composite
deleted file mode 100644
index 9e3299d691..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/HelloWorld.composite
+++ /dev/null
@@ -1,30 +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"
- targetNamespace="http://sample/composite"
- xmlns:sc="http://sample/composite"
- name="HelloWorld">
-
- <component name="HelloWorld">
- <implementation.java class="hello.HelloWorldImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml b/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml
deleted file mode 100644
index 1d37bcebe0..0000000000
--- a/branches/sca-java-1.5.1/modules/node-impl/src/test/resources/META-INF/sca-contribution.xml
+++ /dev/null
@@ -1,23 +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.
--->
-
-<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:sc="http://sample/composite">
- <deployable composite="sc:HelloWorld" />
-</contribution>
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/LICENSE b/branches/sca-java-1.5.1/modules/node-launcher-osgi/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/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-java-1.5.1/modules/node-launcher-osgi/NOTICE b/branches/sca-java-1.5.1/modules/node-launcher-osgi/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/pom.xml b/branches/sca-java-1.5.1/modules/node-launcher-osgi/pom.xml
deleted file mode 100644
index 1d75dbef9b..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/pom.xml
+++ /dev/null
@@ -1,155 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-node-launcher-osgi</artifactId>
- <name>Apache Tuscany SCA Node OSGi Launcher</name>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version> <!-- To be compatible with Jetty 6 -->
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>1.0.1</version>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.framework</artifactId>
- <version>1.0.4</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>javax.servlet</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.foundation</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility-osgi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-osgi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-domain-manager</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-http-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <includeScope>test</includeScope>
- <outputDirectory>${project.build.directory}/tuscany/modules</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- <excludeArtifactIds></excludeArtifactIds>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.apache.tuscany.sca.node.osgi.launcher.NodeMain</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.node.launcher.osgi</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.node.osgi.launcher*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/Contribution.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/Contribution.java
deleted file mode 100644
index 0214d5185f..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/Contribution.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-/**
- * Represents an SCA contribution uri + location.
- *
- * @version $Rev$ $Date$
- */
-public final class Contribution {
- private String uri;
- private String location;
-
- /**
- * Constructs a new SCA contribution.
- *
- * @param uri
- * @param location
- */
- public Contribution(String uri, String location) {
- this.uri = uri;
- this.location = location;
- }
-
- public String getURI() {
- return uri;
- }
-
- public String getLocation() {
- return location;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/DomainManagerLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/DomainManagerLauncher.java
deleted file mode 100644
index f94c43bd52..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/DomainManagerLauncher.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.node.osgi.launcher;
-
-import static org.apache.tuscany.sca.node.osgi.launcher.NodeLauncherUtil.domainManager;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple launcher for the SCA domain manager.
- *
- * @version $Rev$ $Date$
- */
-public class DomainManagerLauncher {
-
- private static final Logger logger = Logger.getLogger(DomainManagerLauncher.class.getName());
-
- /**
- * Constructs a new DomainManagerLauncher.
- */
- private DomainManagerLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static DomainManagerLauncher newInstance() {
- return new DomainManagerLauncher();
- }
-
- /**
- * Creates a new DomainManager.
- *
- * @return a new DomainManager
- * @throws LauncherException
- */
- public <T> T createDomainManager() throws LauncherException {
- return (T)domainManager(".");
- }
-
- /**
- * Creates a new DomainManager.
- *
- * @param rootDirectory the domain's root configuration directory
- *
- * @return a new DomainManager
- * @throws LauncherException
- */
- public <T> T createDomainManager(String rootDirectory) throws LauncherException {
- return (T)domainManager(rootDirectory);
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA Domain Manager starting...");
-
- // Create a domain manager
- DomainManagerLauncher launcher = newInstance();
- OSGiHost host = NodeLauncherUtil.startOSGi();
- try {
-
- Object domainManager = launcher.createDomainManager();
-
- // Start the domain manager
- try {
- domainManager.getClass().getMethod("start").invoke(domainManager);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Domain Manager could not be started", e);
- throw e;
- }
- logger.info("SCA Domain Manager started.");
-
- logger.info("Press enter to shutdown.");
- try {
- System.in.read();
- } catch (IOException e) {
- }
-
- // Stop the domain manager
- try {
- domainManager.getClass().getMethod("stop").invoke(domainManager);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Domain Manager could not be stopped", e);
- throw e;
- }
- } finally {
- NodeLauncherUtil.stopOSGi(host);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHost.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHost.java
deleted file mode 100644
index 5e4a0ed338..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHost.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.node.osgi.launcher;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.felix.framework.Felix;
-import org.apache.felix.framework.cache.BundleCache;
-import org.apache.felix.framework.util.FelixConstants;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-/**
- *
- */
-public class FelixOSGiHost implements OSGiHost {
-
- private Felix felix;
- private LauncherBundleActivator activator;
- //private ClassLoader tccl;
-
- private final static String systemPackages =
- "org.osgi.framework; version=1.3.0," + "org.osgi.service.packageadmin; version=1.2.0, "
- + "org.osgi.service.startlevel; version=1.0.0, "
- + "org.osgi.service.url; version=1.0.0, "
- + "org.osgi.util.tracker; version=1.3.2, "
- + "javax.xml, "
- + "javax.xml.datatype, "
- + "javax.xml.namespace, "
- + "javax.xml.parsers, "
- + "javax.xml.transform, "
- + "javax.xml.transform.dom, "
- + "javax.xml.transform.sax, "
- + "javax.xml.transform.stream, "
- + "javax.xml.validation, "
- + "javax.xml.xpath, "
- // Force the classes to be imported from the system bundle
- // + "javax.xml.stream, "
- // + "javax.xml.stream.util, "
- + "javax.sql,"
- + "org.w3c.dom, "
- + "org.xml.sax, "
- + "org.xml.sax.ext, "
- + "org.xml.sax.helpers, "
- + "javax.security.auth, "
- + "javax.security.cert, "
- + "javax.security.auth.login, "
- + "javax.security.auth.callback, "
- + "javax.naming, "
- + "javax.naming.spi, "
- + "javax.naming.directory, "
- + "javax.management, "
- + "javax.imageio, "
- + "sun.misc, "
- + "javax.net, "
- + "javax.net.ssl, "
- + "javax.crypto, "
- + "javax.rmi, "
- + "javax.transaction, "
- + "javax.transaction.xa";
-
- public LauncherBundleActivator getActivator() {
- if (activator == null) {
- activator = new LauncherBundleActivator();
- }
- return activator;
- }
-
- public void setActivator(LauncherBundleActivator activator) {
- this.activator = activator;
- }
-
- public BundleContext start() {
- try {
- startup();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- BundleContext bundleContext = felix.getBundleContext();
- return bundleContext;
- }
-
- public void stop() {
- try {
- shutdown();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- private void startup() throws BundleException {
- if (felix != null) {
- throw new IllegalStateException("Felix is already running.");
- }
-
- // Create a configuration property map.
- Map<String, String> configMap = new HashMap<String, String>();
- // Configure the Felix instance to be embedded.
- configMap.put(FelixConstants.EMBEDDED_EXECUTION_PROP, "true");
- // Add core OSGi packages to be exported from the class path
- // via the system bundle.
- configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
- // Explicitly specify the directory to use for caching bundles.
- configMap.put(BundleCache.CACHE_PROFILE_DIR_PROP, "target/.felix");
- List<BundleActivator> list = new ArrayList<BundleActivator>();
-
- list.add(getActivator());
-
- // Now create an instance of the framework with
- // our configuration properties and activator.
- felix = new Felix(configMap, list);
-
- // Now start Felix instance.
- felix.start();
-
- //tccl = Thread.currentThread().getContextClassLoader();
- //Thread.currentThread().setContextClassLoader(getContextClassLoader(felix.getBundleContext()));
-
- }
-
- private ClassLoader getContextClassLoader(BundleContext bundleContext) {
- for (Bundle b : bundleContext.getBundles()) {
- if ("org.apache.tuscany.sca.extensibility.osgi".equals(b.getSymbolicName())) {
- try {
- b.start();
- Class<?> discovererClass = b.loadClass("org.apache.tuscany.sca.extensibility.ServiceDiscovery");
- Method getInstance = discovererClass.getMethod("getInstance");
- Object instance = getInstance.invoke(null);
- Method getter = discovererClass.getMethod("getServiceDiscoverer");
- Object discoverer = getter.invoke(instance);
-
- Method getCL = discoverer.getClass().getMethod("getContextClassLoader");
- ClassLoader cl = (ClassLoader)getCL.invoke(discoverer);
- return cl;
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
- }
- return null;
- }
-
- private void shutdown() throws BundleException {
- if (felix != null) {
- felix.stopAndWait();
- }
- //Thread.currentThread().setContextClassLoader(tccl);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/JarFileFinder.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/JarFileFinder.java
deleted file mode 100644
index 38c7093a16..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/JarFileFinder.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Logger;
-
-/**
- *
- */
-public class JarFileFinder {
- /**
- * A file name filter used to filter JAR files.
- */
- static class StandAloneJARFileNameFilter implements FilenameFilter {
-
- public boolean accept(File dir, String name) {
- name = name.toLowerCase();
-
- // Exclude tuscany-sca-all and tuscany-sca-manifest as they duplicate
- // code in the individual runtime module JARs
- if (name.startsWith("tuscany-sca-all")) {
- return false;
- }
- if (name.startsWith("tuscany-sca-manifest")) {
- return false;
- }
-
- // Filter out the Tomcat and Webapp hosts
- if (name.startsWith("tuscany-host-tomcat") || name.startsWith("tuscany-host-webapp")) {
- //FIXME This is temporary
- return false;
- }
-
- // Include JAR and MAR files
- if (name.endsWith(".jar")) {
- return true;
- }
- if (name.endsWith(".mar")) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * A file name filter used to filter JAR files.
- */
- static class WebAppJARFileNameFilter extends StandAloneJARFileNameFilter {
-
- public boolean accept(File dir, String name) {
- if (!super.accept(dir, name)) {
- return false;
- }
- name = name.toLowerCase();
-
- // Exclude servlet-api JARs
- if (name.startsWith("servlet-api")) {
- return false;
- }
-
- // Exclude the Tomcat and Jetty hosts
- if (name.startsWith("tuscany-host-tomcat") || name.startsWith("tuscany-host-jetty")) {
- //FIXME This is temporary
- return false;
- }
-
- return true;
- }
- }
-
- private static final Logger logger = Logger.getLogger(JarFileFinder.class.getName());
-
- static final String TUSCANY_HOME = "TUSCANY_HOME";
- private static final String TUSCANY_PATH = "TUSCANY_PATH";
-
- /**
- * Collect JAR files in the given directory
- * @param directory
- * @param urls
- * @param filter
- * @throws MalformedURLException
- */
- private static void collectJARFiles(File directory, List<URL> urls, FilenameFilter filter)
- throws MalformedURLException {
- String[] files = directory.list(filter);
- if (files != null) {
- URL directoryURL = new URL(directory.toURI().toString() + "/");
- int count = 0;
- for (String file : files) {
- URL url = new URL(directoryURL, file);
- urls.add(url);
- count++;
- }
- if (count != 0) {
- logger.fine("Runtime classpath: " + count
- + " JAR"
- + (count > 1 ? "s" : "")
- + " from "
- + directory.toString());
- }
- }
- }
-
- /**
- * Collect JAR files under the given directory.
- *
- * @param directory
- * @param jarDirectoryURLs
- * @param jarURLs
- * @param filter
- * @throws MalformedURLException
- */
- private static void collectJARFiles(String directory,
- Set<URL> jarDirectoryURLs,
- List<URL> jarURLs,
- FilenameFilter filter) throws MalformedURLException {
- File directoryFile = new File(directory);
- URL directoryURL = directoryFile.toURI().toURL();
- if (!jarDirectoryURLs.contains(directoryURL) && directoryFile.exists()) {
-
- // Collect files under $TUSCANY_HOME
- jarDirectoryURLs.add(directoryURL);
- collectJARFiles(directoryFile, jarURLs, filter);
-
- // Collect files under $TUSCANY_HOME/modules
- File modulesDirectory = new File(directoryFile, "modules");
- URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
- jarDirectoryURLs.add(modulesDirectoryURL);
- collectJARFiles(modulesDirectory, jarURLs, filter);
- }
-
- // Collect files under $TUSCANY_HOME/lib
- File libDirectory = new File(directoryFile, "lib");
- URL libDirectoryURL = libDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
- jarDirectoryURLs.add(libDirectoryURL);
- collectJARFiles(libDirectory, jarURLs, filter);
- }
- }
- }
-
- /**
- * Returns a ClassLoader for the Tuscany runtime JARs.
- *
- * @param parentClassLoader
- * @param filter
- *
- * @return
- */
- public static List<URL> findJarFiles(File root, FilenameFilter filter) throws FileNotFoundException,
- URISyntaxException, MalformedURLException {
-
- // Build list of runtime JARs
- Set<URL> jarDirectoryURLs = new HashSet<URL>();
- List<URL> jarURLs = new ArrayList<URL>();
-
- URL url = null;
- if (root != null) {
- url = root.toURI().toURL();
- } else {
- // First determine the path to the launcher class
- String resource = JarFileFinder.class.getName().replace('.', '/') + ".class";
- url = JarFileFinder.class.getClassLoader().getResource(resource);
- if (url == null) {
- throw new FileNotFoundException(resource);
- }
-
- url = getContainer(url, resource);
- }
- URI uri = url.toURI();
-
- // If the launcher class is in a JAR, add all runtime JARs from directory containing
- // that JAR (e.g. the Tuscany modules directory) as well as the ../modules and
- // ../lib directories
- if (url != null && "file".equals(url.getProtocol())) {
-
- File file = new File(uri);
- if (file.exists()) {
- File jarDirectory = file.getParentFile();
- if (jarDirectory != null && jarDirectory.exists()) {
-
- // Collect JAR files from the directory containing the input JAR
- // (e.g. the Tuscany modules directory)
- URL jarDirectoryURL = jarDirectory.toURI().toURL();
- jarDirectoryURLs.add(jarDirectoryURL);
- collectJARFiles(jarDirectory, jarURLs, filter);
-
- File homeDirectory = jarDirectory.getParentFile();
- if (homeDirectory != null && homeDirectory.exists()) {
-
- // Collect JARs from the ../modules directory
- File modulesDirectory = new File(homeDirectory, "modules");
- URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
- jarDirectoryURLs.add(modulesDirectoryURL);
- collectJARFiles(modulesDirectory, jarURLs, filter);
- }
-
- // Collect JARs from the ../lib directory
- File libDirectory = new File(homeDirectory, "lib");
- URL libDirectoryURL = libDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
- jarDirectoryURLs.add(libDirectoryURL);
- collectJARFiles(libDirectory, jarURLs, filter);
- }
- }
- }
- }
- }
-
- // Look for a TUSCANY_HOME system property or environment variable
- // Add all the JARs found under $TUSCANY_HOME, $TUSCANY_HOME/modules
- // and $TUSCANY_HOME/lib
- String home = getProperty(TUSCANY_HOME);
- if (home != null && home.length() != 0) {
- logger.fine(TUSCANY_HOME + ": " + home);
- collectJARFiles(home, jarDirectoryURLs, jarURLs, filter);
- }
-
- // Look for a TUSCANY_PATH system property or environment variable
- // Add all the JARs found under $TUSCANY_PATH, $TUSCANY_PATH/modules
- // and $TUSCANY_PATH/lib
- String ext = getProperty(TUSCANY_PATH);
- if (ext != null && ext.length() != 0) {
- logger.fine(TUSCANY_PATH + ": " + ext);
- String separator = getProperty("path.separator");
- for (StringTokenizer tokens = new StringTokenizer(ext, separator); tokens.hasMoreTokens();) {
- collectJARFiles(tokens.nextToken(), jarDirectoryURLs, jarURLs, filter);
- }
- }
-
- return jarURLs;
-
- }
-
- static String getProperty(final String prop) {
- return AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- String value = System.getProperty(prop);
- if (value == null || value.length() == 0) {
- return System.getenv(prop);
- } else {
- return value;
- }
- }
- });
- }
-
- private static File toFile(URL url) {
- if (url == null || !url.getProtocol().equals("file")) {
- return null;
- } else {
- String filename = url.getFile().replace('/', File.separatorChar);
- int pos = 0;
- while ((pos = filename.indexOf('%', pos)) >= 0) {
- if (pos + 2 < filename.length()) {
- String hexStr = filename.substring(pos + 1, pos + 3);
- char ch = (char)Integer.parseInt(hexStr, 16);
- filename = filename.substring(0, pos) + ch + filename.substring(pos + 3);
- }
- }
- return new File(filename);
- }
- }
-
- private static URL getContainer(URL resourceURL, String resourceName) {
- URL root = null;
- // "jar:file://....../something.jar!/a/b/c/app.composite"
- try {
- String url = resourceURL.toExternalForm();
- String protocol = resourceURL.getProtocol();
- if ("file".equals(protocol)) {
- // directory contribution
- if (url.endsWith("/" + resourceName)) {
- final String location = url.substring(0, url.length() - resourceName.length() - 1);
- // workaround from evil URL/URI form Maven
- // contributionURL = FileHelper.toFile(new URL(location)).toURI().toURL();
- // Allow privileged access to open URL stream. Add FilePermission to added to
- // security policy file.
- try {
- root = AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
- public URL run() throws IOException {
- return toFile(new URL(location)).toURI().toURL();
- }
- });
- } catch (PrivilegedActionException e) {
- throw (MalformedURLException)e.getException();
- }
- }
-
- } else if ("jar".equals(protocol)) {
- // jar contribution
- String location = url.substring(4, url.lastIndexOf("!/"));
- // workaround for evil URL/URI from Maven
- root = toFile(new URL(location)).toURI().toURL();
-
- } else if ("wsjar".equals(protocol)) {
- // See https://issues.apache.org/jira/browse/TUSCANY-2219
- // wsjar contribution
- String location = url.substring(6, url.lastIndexOf("!/"));
- // workaround for evil url/uri from maven
- root = toFile(new URL(location)).toURI().toURL();
-
- } else if (protocol != null && (protocol.equals("bundle") || protocol.equals("bundleresource"))) {
- root = new URL(resourceURL.getProtocol(), resourceURL.getHost(), resourceURL.getPort(), "/");
- }
- } catch (MalformedURLException mfe) {
- throw new IllegalArgumentException(mfe);
- }
- return root;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherBundleActivator.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherBundleActivator.java
deleted file mode 100644
index afd6804ad2..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherBundleActivator.java
+++ /dev/null
@@ -1,475 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URL;
-import java.security.CodeSource;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.jar.JarOutputStream;
-import java.util.jar.Manifest;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Constants;
-
-/**
- * Bundle activator which installs Tuscany modules and 3rd party jars into an OSGi runtime.
- *
- */
-public class LauncherBundleActivator implements BundleActivator, Constants, BundleListener {
- private static Logger logger = Logger.getLogger(LauncherBundleActivator.class.getName());
- private static final String[] immutableJars = {"bcprov"};
-
- private BundleContext bundleContext;
- private List<Bundle> tuscanyBundles = new ArrayList<Bundle>();
-
- private List<URL> jarFiles;
-
- public LauncherBundleActivator() {
- super();
- }
-
- public LauncherBundleActivator(List<URL> jarFiles) {
- super();
- this.jarFiles = jarFiles;
- }
-
- public static String toString(Bundle b, boolean verbose) {
- StringBuffer sb = new StringBuffer();
- sb.append(b.getBundleId()).append(" ").append(b.getSymbolicName());
- int s = b.getState();
- if ((s & Bundle.UNINSTALLED) != 0) {
- sb.append(" UNINSTALLED");
- }
- if ((s & Bundle.INSTALLED) != 0) {
- sb.append(" INSTALLED");
- }
- if ((s & Bundle.RESOLVED) != 0) {
- sb.append(" RESOLVED");
- }
- if ((s & Bundle.STARTING) != 0) {
- sb.append(" STARTING");
- }
- if ((s & Bundle.STOPPING) != 0) {
- sb.append(" STOPPING");
- }
- if ((s & Bundle.ACTIVE) != 0) {
- sb.append(" ACTIVE");
- }
-
- if (verbose) {
- sb.append(" ").append(b.getLocation());
- sb.append(" ").append(b.getHeaders());
- }
- return sb.toString();
- }
-
- public void start(BundleContext bundleContext) throws Exception {
- this.bundleContext = bundleContext;
- this.bundleContext.addBundleListener(this);
- installTuscany(bundleContext);
-
- for (Bundle b : bundleContext.getBundles()) {
- try {
- if ("org.apache.tuscany.sca.contribution.osgi".equals(b.getSymbolicName())) {
- b.start();
- logger.info(toString(b, false) + " " + b.getState());
- break;
- }
- } catch (Exception e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
- /*
- for (Bundle bundle : tuscanyBundles) {
- try {
- bundle.stop();
- } catch (Exception e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- */
-
- for (Bundle bundle : tuscanyBundles) {
- try {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Uninstalling bundle: " + toString(bundle, false));
- }
- bundle.uninstall();
- } catch (Exception e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
- this.bundleContext.removeBundleListener(this);
- tuscanyBundles.clear();
- this.bundleContext = null;
- }
-
- public void installTuscany(BundleContext bundleContext) {
- long start = System.currentTimeMillis();
-
- try {
-
- // FIXME: SDO bundles dont have the correct dependencies
- System.setProperty("commonj.sdo.impl.HelperProvider", "org.apache.tuscany.sdo.helper.HelperProviderImpl");
- List<URL> urls = jarFiles;
- if (urls == null) {
- File tuscanyInstallDir = findTuscanyInstallDir(bundleContext.getBundle());
-
- urls = JarFileFinder.findJarFiles(tuscanyInstallDir, new JarFileFinder.StandAloneJARFileNameFilter());
- }
-
- for (URL url : urls) {
- File file = new File(url.toURI());
- if (file.getName().startsWith("org.apache.felix.") || file.getName().startsWith("org.osgi.")) {
- continue;
- }
- try {
- Bundle bundle = createAndInstallBundle(bundleContext, url);
- } catch (Exception e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
- }
-
- long end = System.currentTimeMillis();
- logger.info("Tuscany bundles are installed in " + (end - start) + " ms.");
-
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private File findTuscanyInstallDir(Bundle bundle) throws IOException {
- String tuscanyDirName = JarFileFinder.getProperty(JarFileFinder.TUSCANY_HOME);
- if (tuscanyDirName != null) {
- File tuscanyInstallDir = new File(tuscanyDirName);
- if (tuscanyInstallDir.exists() && tuscanyInstallDir.isDirectory())
- return tuscanyInstallDir;
- }
-
- String location = bundle.getLocation();
-
- if (location != null && location.startsWith("file:")) {
- File file = new File(URI.create(location));
- File tuscanyInstallDir = file.getParentFile();
- if (tuscanyInstallDir.exists() && tuscanyInstallDir.isDirectory())
- return tuscanyInstallDir;
- }
- if (this.getClass().getProtectionDomain() != null) {
- CodeSource codeSource = this.getClass().getProtectionDomain().getCodeSource();
- if (codeSource != null) {
- try {
- File tuscanyInstallDir = new File(codeSource.getLocation().toURI());
- if (tuscanyInstallDir.exists() && tuscanyInstallDir.isDirectory())
- return tuscanyInstallDir;
- } catch (Exception e) {
- // ignore
- }
- }
- }
- return null;
- }
-
- public Bundle createAndInstallBundle(BundleContext bundleContext, URL bundleFile) throws Exception {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Installing bundle: " + bundleFile);
- }
- long start = System.currentTimeMillis();
-
- Manifest manifest = readManifest(bundleFile);
- boolean isOSGiBundle = manifest != null && manifest.getMainAttributes().getValue(BUNDLE_SYMBOLICNAME) != null;
-
- if (!isOSGiBundle) {
- manifest = updateBundleManifest(bundleFile, manifest);
- }
-
- String symbolicName = manifest.getMainAttributes().getValue(BUNDLE_SYMBOLICNAME);
- String version = manifest.getMainAttributes().getValue(BUNDLE_VERSION);
- Bundle bundle = findBundle(bundleContext, symbolicName, version);
- if (bundle != null) {
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Bundle is already installed: " + symbolicName);
- }
- return bundle;
- }
-
- String bundleLocation = bundleFile.toString();
- InputStream inStream = null;
- if (!isOSGiBundle) {
- // We need to repackage the bundle
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- JarOutputStream jarOut = new JarOutputStream(out, manifest);
-
- String classpath = manifest.getMainAttributes().getValue("Bundle-ClassPath");
- boolean embedded = classpath != null && !classpath.trim().equals(".");
- if (embedded) {
- addFileToJar(bundleFile, jarOut);
- } else {
- copyJar(bundleFile, jarOut);
- }
-
- jarOut.close();
- inStream = new ByteArrayInputStream(out.toByteArray());
- } else {
- // The file itself is already a bundle
- inStream = bundleFile.openStream();
- }
-
- try {
- bundle = bundleContext.installBundle(bundleLocation, inStream);
- if (logger.isLoggable(Level.FINE)) {
- logger.fine("Bundle installed in " + (System.currentTimeMillis() - start) + " ms: " + bundleLocation);
- }
- tuscanyBundles.add(bundle);
- return bundle;
- } finally {
- inStream.close();
- }
-
- }
-
- private Bundle findBundle(BundleContext bundleContext, String symbolicName, String version) {
- Bundle[] bundles = bundleContext.getBundles();
- if (version == null) {
- version = "0.0.0";
- }
- for (Bundle b : bundles) {
- String v = (String)b.getHeaders().get(BUNDLE_VERSION);
- if (v == null) {
- v = "0.0.0";
- }
- if (b.getSymbolicName().equals(symbolicName) && (version.equals("0.0.0") || v.equals(version))) {
- return b;
- }
- }
- return null;
- }
-
- private String getFileName(URL url) {
- String name = url.getPath();
- int index = name.lastIndexOf('/');
- return name.substring(index + 1);
- }
-
- private void addFileToJar(URL file, JarOutputStream jarOut) throws IOException {
- JarEntry ze = new JarEntry(getFileName(file));
- jarOut.putNextEntry(ze);
- InputStream inStream = file.openStream();
- copy(inStream, jarOut);
- inStream.close();
- }
-
- private void copy(InputStream in, OutputStream out) throws IOException {
- byte[] readBuf = new byte[4096];
- int bytesRead;
- while ((bytesRead = in.read(readBuf)) > 0) {
- out.write(readBuf, 0, bytesRead);
- }
- }
-
- private void copyJar(URL in, JarOutputStream jarOut) throws IOException {
- JarInputStream jarIn = new JarInputStream(in.openStream());
- ZipEntry ze;
- while ((ze = jarIn.getNextEntry()) != null) {
- // Skip the MANIFEST.MF
- if (ze.getName().equals("META-INF/MANIFEST.MF"))
- continue;
- jarOut.putNextEntry(ze);
- copy(jarIn, jarOut);
- }
- jarIn.close();
- }
-
- private Manifest readManifest(URL jarFile) throws IOException {
- JarInputStream jar = new JarInputStream(jarFile.openStream());
- // Read the Manifest from the jar file
- Manifest manifest = jar.getManifest();
- jar.close();
-
- if (manifest == null) {
- // Create a new one if no Manifest is found
- manifest = new Manifest();
- }
- return manifest;
- }
-
- private Manifest updateBundleManifest(URL jarFile, Manifest manifest) throws Exception {
-
- // Check if we have an associated .mf file
- String name = jarFile.toString();
- int index = name.lastIndexOf('.');
- if (index != -1) {
- URL mf = new URL(name.substring(0, index) + ".mf");
- try {
- InputStream in = mf.openStream();
- manifest.read(in);
- in.close();
- } catch (IOException e) {
- // Ignore
- }
- }
-
- String jarFileName = getFileName(jarFile);
- boolean isImmutableJar = false;
- for (String immutableJar : immutableJars) {
- if (jarFileName.startsWith(immutableJar)) {
- isImmutableJar = true;
- break;
- }
- }
-
- Attributes attributes = manifest.getMainAttributes();
- if (attributes.getValue(BUNDLE_SYMBOLICNAME) == null) {
- String bundleSymbolicName = jarFileName;
- if (bundleSymbolicName.endsWith(".jar")) {
- bundleSymbolicName = bundleSymbolicName.substring(0, bundleSymbolicName.length() - 4);
- }
- attributes.putValue(BUNDLE_SYMBOLICNAME, bundleSymbolicName);
- } else {
- // Assume the jar is already a bundle
- return null;
- }
-
- if (attributes.getValue("Manifest-Version") == null) {
- attributes.putValue("Manifest-Version", "1.0");
- }
-
- if (attributes.getValue(BUNDLE_MANIFESTVERSION) == null) {
- attributes.putValue(BUNDLE_MANIFESTVERSION, "2");
- }
-
- if (isImmutableJar && attributes.getValue(BUNDLE_CLASSPATH) == null) {
- attributes.putValue(BUNDLE_CLASSPATH, ".," + jarFileName);
- }
-
- JarInputStream jar = new JarInputStream(jarFile.openStream());
- HashSet<String> packages = getPackagesInJar(jarFileName, jar);
- jar.close();
- String version = getJarVersion(jarFileName);
-
- // attributes.remove(new Attributes.Name("Require-Bundle"));
- // attributes.remove(new Attributes.Name("Import-Package"));
-
- if (attributes.getValue(BUNDLE_VERSION) == null) {
- attributes.putValue(BUNDLE_VERSION, version);
- }
- // Existing export statements in bundles may contain versions, so they should be used as is
- // SDO exports are not sufficient, and should be changed
- if (attributes.getValue(EXPORT_PACKAGE) == null || jarFileName.startsWith("tuscany-sdo-impl")) {
- String pkgs = packagesToString(packages, version);
- if (pkgs.length() > 0) {
- attributes.putValue(EXPORT_PACKAGE, pkgs);
- attributes.putValue(IMPORT_PACKAGE, packagesToString(packages, null));
- }
- // attributes.putValue("Import-Package", packagesToString(packages, null));
- }
-
- attributes.putValue(DYNAMICIMPORT_PACKAGE, "*");
- return manifest;
- }
-
- private HashSet<String> getPackagesInJar(String bundleName, JarInputStream jar) throws Exception {
- HashSet<String> packages = new HashSet<String>();
- ZipEntry entry;
- while ((entry = jar.getNextEntry()) != null) {
- String entryName = entry.getName();
- if (!entry.isDirectory() && entryName != null && entryName.length() > 0 && !entryName.startsWith(".")
- // && !entryName.startsWith("META-INF")
- && entryName.lastIndexOf("/") > 0) {
- String pkg = entryName.substring(0, entryName.lastIndexOf("/")).replace('/', '.');
- packages.add(pkg);
-
- }
- }
- // FIXME: Split package
- if (bundleName.startsWith("axis2-adb")) {
- packages.remove("org.apache.axis2.util");
- } else if (bundleName.startsWith("axis2-codegen")) {
- packages.remove("org.apache.axis2.wsdl");
- packages.remove("org.apache.axis2.wsdl.util");
- } else if (bundleName.startsWith("bsf-all")) {
- packages.remove("org.mozilla.javascript");
- }
-
- return packages;
- }
-
- private String packagesToString(HashSet<String> packages, String version) {
-
- StringBuilder pkgBuf = new StringBuilder();
- for (String pkg : packages) {
- if (pkgBuf.length() > 0) {
- pkgBuf.append(',');
- }
- pkgBuf.append(pkg);
- if (version != null && !pkg.startsWith("META-INF.")) {
- pkgBuf.append(";version=\"");
- pkgBuf.append(version);
- pkgBuf.append('\"');
- }
- }
- return pkgBuf.toString();
- }
-
- private String getJarVersion(String bundleName) {
- Pattern pattern = Pattern.compile("-([0-9.]+)");
- Matcher matcher = pattern.matcher(bundleName);
- String version = "1.0.0";
- if (matcher.find()) {
- version = matcher.group();
- if (version.endsWith(".")) {
- version = version.substring(1, version.length() - 1);
- } else {
- version = version.substring(1);
- }
- }
- return version;
- }
-
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- public void bundleChanged(BundleEvent event) {
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherException.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherException.java
deleted file mode 100644
index bf17222e34..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/LauncherException.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.node.osgi.launcher;
-
-
-/**
- * Denotes an error launching an SCA domain manager or node.
- *
- * @version $Rev$ $Date$
- */
-public class LauncherException extends Exception {
- private static final long serialVersionUID = 4581189418849190567L;
-
- public LauncherException() {
- super();
- }
-
- /**
- * @param message
- * @param cause
- */
- public LauncherException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public LauncherException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public LauncherException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeDaemonLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeDaemonLauncher.java
deleted file mode 100644
index f0e4e9da70..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeDaemonLauncher.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import static org.apache.tuscany.sca.node.osgi.launcher.NodeLauncherUtil.nodeDaemon;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A launcher for the SCA Node daemon.
- *
- * @version $Rev$ $Date$
- */
-public class NodeDaemonLauncher {
-
- private static final Logger logger = Logger.getLogger(NodeDaemonLauncher.class.getName());
-
- /**
- * Constructs a new node daemon launcher.
- */
- private NodeDaemonLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static NodeDaemonLauncher newInstance() {
- return new NodeDaemonLauncher();
- }
-
- /**
- * Creates a new node daemon.
- *
- * @param
- * @return a new node daemon
- * @throws LauncherException
- */
- public <T> T createNodeDaemon() throws LauncherException {
- return (T)nodeDaemon();
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA Node Daemon starting...");
-
- // Create a node daemon
- NodeDaemonLauncher launcher = newInstance();
- OSGiHost host = NodeLauncherUtil.startOSGi();
-
- try {
- Object daemon = launcher.createNodeDaemon();
-
- // Start the node daemon
- try {
- daemon.getClass().getMethod("start").invoke(daemon);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node Daemon could not be started", e);
- throw e;
- }
- logger.info("SCA Node Daemon started.");
-
- logger.info("Press enter to shutdown.");
- try {
- System.in.read();
- } catch (IOException e) {
- }
-
- // Stop the node daemon
- try {
- daemon.getClass().getMethod("stop").invoke(daemon);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node Daemon could not be stopped", e);
- throw e;
- }
- } finally {
- NodeLauncherUtil.stopOSGi(host);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncher.java
deleted file mode 100644
index ea487c384b..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncher.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import static org.apache.tuscany.sca.node.osgi.launcher.NodeLauncherUtil.node;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A launcher for SCA nodes.
- *
- * @version $Rev$ $Date$
- */
-public class NodeLauncher {
-
- static final Logger logger = Logger.getLogger(NodeLauncher.class.getName());
-
- /**
- * Constructs a new node launcher.
- */
- private NodeLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static NodeLauncher newInstance() {
- return new NodeLauncher();
- }
-
- /**
- * Creates a new SCA node from the configuration URL
- *
- * @param configurationURL the URL of the node configuration which is the ATOM feed
- * that contains the URI of the composite and a collection of URLs for the contributions
- *
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNodeFromURL(String configurationURL) throws LauncherException {
- return (T)node(configurationURL, null, null, null, null);
- }
-
- /**
- * Creates a new SCA OSGi Node.
- *
- * @param compositeURI the URI of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related
- * artifacts. If the list is empty, then we will use the thread context classloader to discover
- * the contribution on the classpath
- *
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNode(String compositeURI, Contribution... contributions) throws LauncherException {
- return (T)node(null, compositeURI, null, contributions, null);
- }
-
- /**
- * Creates a new SCA OSGi Node.
- *
- * @param compositeURI the URI of the composite to use
- * @param compositeContent the XML content of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related artifacts
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNode(String compositeURI, String compositeContent, Contribution... contributions)
- throws LauncherException {
- return (T)node(null, compositeURI, compositeContent, contributions, null);
- }
-
- /**
- * Create a SCA node based on the discovery of the contribution on the classpath for the
- * given classloader. This method should be treated a convenient shortcut with the following
- * assumptions:
- * <ul>
- * <li>This is a standalone application and there is a deployable composite file on the classpath.
- * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
- * </ul>
- *
- * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
- * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
- * then thread context classloader will be used
- * @return A newly created SCA node
- */
- public <T> T createNodeFromClassLoader(String compositeURI, ClassLoader classLoader) throws LauncherException {
- return (T)node(null, compositeURI, null, null, classLoader);
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA OSGi Node is starting...");
-
- // Create a node
- NodeLauncher launcher = newInstance();
-
- OSGiHost host = NodeLauncherUtil.startOSGi();
- try {
-
- Object node;
- if (args.length == 1) {
-
- // Create from a configuration URI
- String configurationURI = args[0];
- logger.info("SCA OSGi Node configuration: " + configurationURI);
- node = launcher.createNodeFromURL(configurationURI);
- } else {
-
- // Create from a composite URI and a contribution location
- String compositeURI = args[0];
- String contributionLocation = args[1];
- logger.info("SCA composite: " + compositeURI);
- logger.info("SCA contribution: " + contributionLocation);
- node = launcher.createNode(compositeURI, new Contribution("default", contributionLocation));
- }
-
- // Start the node
- try {
- node.getClass().getMethod("start").invoke(node);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA OSGi Node could not be started", e);
- throw e;
- }
- logger.info("SCA OSGi Node is now started.");
-
- logger.info("Press Enter to shutdown...");
- try {
- System.in.read();
- } catch (IOException e) {
- }
-
- // Stop the node
- try {
- node.getClass().getMethod("stop").invoke(node);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA OSGi Node could not be stopped", e);
- throw e;
- }
- } finally {
- NodeLauncherUtil.stopOSGi(host);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherUtil.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherUtil.java
deleted file mode 100644
index adba1e2da7..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherUtil.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.node.osgi.launcher;
-
-import java.lang.reflect.Constructor;
-import java.util.logging.Level;
-
-/**
- * Common functions and constants used by the admin components.
- *
- * @version $Rev$ $Date$
- */
-final class NodeLauncherUtil {
- // private static final Logger logger = Logger.getLogger(NodeLauncherUtil.class.getName());
-
- private static final String DOMAIN_MANAGER_LAUNCHER_BOOTSTRAP =
- "org.apache.tuscany.sca.domain.manager.launcher.DomainManagerLauncherBootstrap";
-
- private static final String NODE_IMPLEMENTATION_DAEMON_BOOTSTRAP =
- "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationDaemonBootstrap";
-
- private static final String NODE_IMPLEMENTATION_LAUNCHER_BOOTSTRAP =
- "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherBootstrap";
-
- /**
- * Collect JAR files under the given directory.
- *
- * @p @param contributions
- * @throws LauncherException
- */
- static Object node(String configurationURI,
- String compositeURI,
- String compositeContent,
- Contribution[] contributions,
- ClassLoader contributionClassLoader) throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
-
- // Use Java reflection to create the node as only the runtime class
- // loader knows the runtime classes required by the node
- String className = NODE_IMPLEMENTATION_LAUNCHER_BOOTSTRAP;
- Class<?> bootstrapClass;
- bootstrapClass = Class.forName(className, false, tccl);
-
- Object bootstrap;
- if (configurationURI != null) {
-
- // Construct the node with a configuration URI
- bootstrap = bootstrapClass.getConstructor(String.class).newInstance(configurationURI);
-
- } else if (contributionClassLoader != null) {
-
- // Construct the node with a compositeURI and a classloader
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class, ClassLoader.class);
- bootstrap = constructor.newInstance(compositeURI, contributionClassLoader);
-
- } else if (compositeContent != null) {
-
- // Construct the node with a composite URI, the composite content and
- // the URIs and locations of a list of contributions
- Constructor<?> constructor =
- bootstrapClass.getConstructor(String.class, String.class, String[].class, String[].class);
- String[] uris = new String[contributions.length];
- String[] locations = new String[contributions.length];
- for (int i = 0; i < contributions.length; i++) {
- uris[i] = contributions[i].getURI();
- locations[i] = contributions[i].getLocation();
- }
- bootstrap = constructor.newInstance(compositeURI, compositeContent, uris, locations);
-
- } else {
-
- // Construct the node with a composite URI and the URIs and
- // locations of a list of contributions
- Constructor<?> constructor =
- bootstrapClass.getConstructor(String.class, String[].class, String[].class);
- String[] uris = new String[contributions.length];
- String[] locations = new String[contributions.length];
- for (int i = 0; i < contributions.length; i++) {
- uris[i] = contributions[i].getURI();
- locations[i] = contributions[i].getLocation();
- }
- bootstrap = constructor.newInstance(compositeURI, uris, locations);
- }
-
- Object node = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- try {
- Class<?> type = Class.forName("org.apache.tuscany.sca.node.SCANodeFactory");
- type = type.getDeclaredClasses()[0];
- return type.getMethod("createProxy", Class.class, Object.class).invoke(null, type, node);
- } catch (ClassNotFoundException e) {
- // Ignore
- }
- return node;
-
- } catch (Exception e) {
- NodeLauncher.logger.log(Level.SEVERE, "SCA Node could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- /**
- * Creates a new node daemon.
- *
- * @throws LauncherException
- */
- static Object nodeDaemon() throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
-
- // Use Java reflection to create the node daemon as only the runtime class
- // loader knows the runtime classes required by the node
- String className = NODE_IMPLEMENTATION_DAEMON_BOOTSTRAP;
- Class<?> bootstrapClass;
- bootstrapClass = Class.forName(className, false, tccl);
- Object bootstrap = bootstrapClass.getConstructor().newInstance();
-
- Object nodeDaemon = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- return nodeDaemon;
-
- } catch (Exception e) {
- NodeLauncher.logger.log(Level.SEVERE, "SCA Node Daemon could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- /**
- * Creates a new domain manager.
- *
- * @throws LauncherException
- */
- static Object domainManager(String rootDirectory) throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
-
- // Use Java reflection to create the node daemon as only the runtime class
- // loader knows the runtime classes required by the node
- String className = DOMAIN_MANAGER_LAUNCHER_BOOTSTRAP;
- Class<?> bootstrapClass;
- bootstrapClass = Class.forName(className, false, tccl);
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class);
- Object bootstrap = constructor.newInstance(rootDirectory);
-
- Object domainManager = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- return domainManager;
-
- } catch (Exception e) {
- NodeLauncher.logger.log(Level.SEVERE, "SCA Domain Manager could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- static OSGiHost startOSGi() {
- OSGiHost host = new FelixOSGiHost();
- host.start();
- return host;
- }
-
- static void stopOSGi(OSGiHost host) {
- host.stop();
- }
-
- /*
- static OSGiHost getOSGiHost() throws Exception {
- ServiceDiscovery discovery = ServiceDiscovery.getInstance(Thread.currentThread().getContextClassLoader());
- Class<?> hostClass = discovery.loadFirstServiceClass(OSGiHost.class);
- if (hostClass != null) {
- return (OSGiHost) hostClass.newInstance();
- } else {
- return null;
- }
- }
- */
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeMain.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeMain.java
deleted file mode 100644
index 445ea80786..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeMain.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.node.osgi.launcher;
-
-
-/**
- * Main class for this JAR.
- * With no arguments this class launches the SCA Node Daemon.
- * With a "domain" argument it launches the SCA domain admin node.
- * With any other argument it launches an SCA Node.
- *
- * @version $Rev$ $Date$
- */
-public class NodeMain {
-
- public static void main(String[] args) throws Exception {
- if (args.length != 0) {
- if (args[0].equals("domain")) {
- DomainManagerLauncher.main(args);
- } else {
- NodeLauncher.main(args);
- }
- } else {
- NodeDaemonLauncher.main(args);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeServletFilter.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeServletFilter.java
deleted file mode 100644
index fcbe259dba..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/NodeServletFilter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-/**
- * A Servlet filter that forwards service requests to the Servlets registered with
- * the Tuscany ServletHost.
- *
- * @version $Rev$ $Date$
- */
-public class NodeServletFilter implements Filter {
- private static final String NODE_WEB_APP_SERVLET_HOST = "org.apache.tuscany.sca.implementation.node.osgi.webapp.NodeWebAppServletHost";
-
- private static final long serialVersionUID = 1L;
-
- private static final Logger logger = Logger.getLogger(NodeServletFilter.class.getName());
-
- private ClassLoader runtimeClassLoader;
- private Class<?> servletHostClass;
- private Object servletHost;
- private Filter filter;
-
- public void init(FilterConfig filterConfig) throws ServletException {
- logger.info("Apache Tuscany SCA WebApp Node starting...");
-
- try {
- // Get the Tuscany runtime ClassLoader
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- // Load the Tuscany WebApp Servlet host and get the host instance
- // for the current webapp
- String className = NODE_WEB_APP_SERVLET_HOST;
- if (runtimeClassLoader != null) {
- servletHostClass = Class.forName(className, true, runtimeClassLoader);
- } else {
- servletHostClass = Class.forName(className);
- }
- servletHost = servletHostClass.getMethod("servletHost").invoke(null);
-
- // Initialize the Servlet host
- servletHostClass.getMethod("init", FilterConfig.class).invoke(servletHost, filterConfig);
-
- // The Servlet host also implements the filter interface
- filter = (Filter)servletHost;
-
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
-
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Error Starting SCA WebApp Node", e);
- throw new ServletException(e);
- }
-
- logger.info("SCA WebApp Node started.");
- }
-
- public void destroy() {
- logger.info("Apache Tuscany WebApp Node stopping...");
- if (servletHost != null) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- servletHostClass.getMethod("destroy").invoke(servletHost);
-
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Error Stopping SCA WebApp Node", e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- logger.info("SCA WebApp Node stopped.");
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
- throws IOException, ServletException {
-
- // Delegate to the Servlet host filter
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- filter.doFilter(request, response, chain);
-
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/OSGiHost.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/OSGiHost.java
deleted file mode 100644
index c5ea0439de..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/main/java/org/apache/tuscany/sca/node/osgi/launcher/OSGiHost.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.node.osgi.launcher;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * SPI to plug in OSGi implementations such as Equinox or Felix
- */
-public interface OSGiHost {
- BundleContext start();
- void stop();
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorld.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorld.java
deleted file mode 100644
index 2f519cb81d..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorld.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 hello;
-
-import org.osoa.sca.annotations.Remotable;
-
-/**
- * HelloWorld interface
- */
-@Remotable
-public interface HelloWorld {
- String hello(String name);
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorldImpl.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorldImpl.java
deleted file mode 100644
index c9a7560b12..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/hello/HelloWorldImpl.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 hello;
-
-/**
- * HelloWorldImpl
- */
-public class HelloWorldImpl implements HelloWorld {
- public String hello(String name) {
- System.out.println("Hello: " + name);
- return "Hello, " + name;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHostTestCase.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHostTestCase.java
deleted file mode 100644
index e5194d0e5f..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/FelixOSGiHostTestCase.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.node.osgi.launcher;
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-
-/**
- *
- */
-public class FelixOSGiHostTestCase {
- @Test
- public void testStartThenStop() {
- FelixOSGiHost host = new FelixOSGiHost();
- BundleContext context = host.start();
- Assert.assertNotNull(context);
- for (Bundle b : context.getBundles()) {
- System.out.println(toString(b, false));
- }
- host.stop();
- }
-
- @Test
- public void testStartTwice() {
- FelixOSGiHost host = new FelixOSGiHost();
- host.start();
- try {
- host.start();
- Assert.fail();
- } catch (IllegalStateException e) {
- Assert.assertTrue(IllegalStateException.class.isInstance(e.getCause()));
- } finally {
- host.stop();
- }
- }
-
- public static String toString(Bundle b, boolean verbose) {
- StringBuffer sb = new StringBuffer();
- sb.append(b.getBundleId()).append(" ").append(b.getSymbolicName());
- int s = b.getState();
- if ((s & Bundle.UNINSTALLED) != 0) {
- sb.append(" UNINSTALLED");
- }
- if ((s & Bundle.INSTALLED) != 0) {
- sb.append(" INSTALLED");
- }
- if ((s & Bundle.RESOLVED) != 0) {
- sb.append(" RESOLVED");
- }
- if ((s & Bundle.STARTING) != 0) {
- sb.append(" STARTING");
- }
- if ((s & Bundle.STOPPING) != 0) {
- sb.append(" STOPPING");
- }
- if ((s & Bundle.ACTIVE) != 0) {
- sb.append(" ACTIVE");
- }
-
- sb.append(" ").append(b.getLocation());
- if (verbose) {
- Dictionary<Object, Object> dict = b.getHeaders();
- Enumeration<Object> keys = dict.keys();
- while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
- sb.append(" ").append(key).append("=").append(dict.get(key));
- }
- }
- return sb.toString();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherTestCase.java b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherTestCase.java
deleted file mode 100644
index 97976e256a..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/java/org/apache/tuscany/sca/node/osgi/launcher/NodeLauncherTestCase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.osgi.launcher;
-
-import hello.HelloWorld;
-
-import org.apache.tuscany.sca.node.SCAClient;
-import org.apache.tuscany.sca.node.SCANode;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- *
- */
-public class NodeLauncherTestCase {
- private static OSGiHost host;
-
- @BeforeClass
- public static void setUp() {
- System.setProperty("TUSCANY_HOME", "target/tuscany");
- host = NodeLauncherUtil.startOSGi();
- }
-
- @AfterClass
- public static void tearDown() {
- if (host != null) {
- NodeLauncherUtil.stopOSGi(host);
- }
-
- }
-
- @Test
- public void testLaunch() throws Exception {
- NodeLauncher launcher = NodeLauncher.newInstance();
- SCANode node = launcher.createNodeFromClassLoader("HelloWorld.composite", getClass().getClassLoader());
- node.start();
-
- HelloWorld hw = ((SCAClient)node).getService(HelloWorld.class, "HelloWorld");
- hw.hello("OSGi");
-
- node.stop();
- }
-
- @Test
- @Ignore("contribution-osgi issue")
- public void testLaunchDomain() throws Exception {
- DomainManagerLauncher.main(new String[] {});
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/resources/HelloWorld.composite b/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/resources/HelloWorld.composite
deleted file mode 100644
index 9e3299d691..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher-osgi/src/test/resources/HelloWorld.composite
+++ /dev/null
@@ -1,30 +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"
- targetNamespace="http://sample/composite"
- xmlns:sc="http://sample/composite"
- name="HelloWorld">
-
- <component name="HelloWorld">
- <implementation.java class="hello.HelloWorldImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/LICENSE b/branches/sca-java-1.5.1/modules/node-launcher/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/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-java-1.5.1/modules/node-launcher/NOTICE b/branches/sca-java-1.5.1/modules/node-launcher/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/pom.xml b/branches/sca-java-1.5.1/modules/node-launcher/pom.xml
deleted file mode 100644
index 8e605c7063..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/pom.xml
+++ /dev/null
@@ -1,72 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-node-launcher</artifactId>
- <name>Apache Tuscany SCA Node Launcher</name>
-
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.apache.tuscany.sca.node.launcher.NodeMain</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.node.launcher</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.node*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java
deleted file mode 100644
index 4f4f861e2f..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/Contribution.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.node.launcher;
-
-/**
- * Represents an SCA contribution uri + location.
- *
- * @version $Rev$ $Date$
- */
-public final class Contribution {
- private String uri;
- private String location;
-
- /**
- * Constructs a new SCA contribution.
- *
- * @param uri
- * @param location
- */
- public Contribution(String uri, String location) {
- this.uri = uri;
- this.location = location;
- }
-
- public String getURI() {
- return uri;
- }
-
- public String getLocation() {
- return location;
- }
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
deleted file mode 100644
index eb06ad7411..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/DomainManagerLauncher.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.launcher;
-
-import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.domainManager;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple launcher for the SCA domain manager.
- *
- * @version $Rev$ $Date$
- */
-public class DomainManagerLauncher {
-
- static final Logger logger = Logger.getLogger(DomainManagerLauncher.class.getName());
-
- /**
- * Constructs a new DomainManagerLauncher.
- */
- private DomainManagerLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static DomainManagerLauncher newInstance() {
- return new DomainManagerLauncher();
- }
-
- /**
- * Creates a new DomainManager.
- *
- * @return a new DomainManager
- * @throws LauncherException
- */
- public <T> T createDomainManager() throws LauncherException {
- return (T)domainManager(".");
- }
-
- /**
- * Creates a new DomainManager.
- *
- * @param rootDirectory the domain's root configuration directory
- *
- * @return a new DomainManager
- * @throws LauncherException
- */
- public <T> T createDomainManager(String rootDirectory) throws LauncherException {
- return (T)domainManager(rootDirectory);
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA Domain Manager is starting...");
-
- // Create a launcher
- DomainManagerLauncher launcher = newInstance();
-
- Object domainManager = null;
- ShutdownThread shutdown = null;
- try {
- while (true) {
-
- // Start the domain manager
- domainManager = launcher.createDomainManager();
- try {
- domainManager.getClass().getMethod("start").invoke(domainManager);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Domain Manager could not be started", e);
- throw e;
- }
- logger.info("SCA Domain Manager is now started.");
-
- // Install a shutdown hook
- shutdown = new ShutdownThread(domainManager);
- Runtime.getRuntime().addShutdownHook(shutdown);
-
- logger.info("Press 'q' to quit, 'r' to restart.");
- int k = 0;
- try {
- while ((k != 'q') && (k != 'r')) {
- k = System.in.read();
- }
- } catch (IOException e) {
-
- // Wait forever
- Object lock = new Object();
- synchronized(lock) {
- lock.wait();
- }
- }
-
- // Stop the domain manager
- if (domainManager != null) {
- Object dm = domainManager;
- domainManager = null;
- stopDomainManager(dm);
- }
-
- // Quit
- if (k == 'q' ) {
- break;
- }
- }
- } catch (Exception e) {
- // Stop the domain manager
- if (domainManager != null) {
- try {
- Object dm = domainManager;
- domainManager = null;
- stopDomainManager(dm);
- } catch (Exception e2) {
- }
- }
- throw e;
-
- } finally {
-
- // Remove the shutdown hook
- if (shutdown != null) {
- Runtime.getRuntime().removeShutdownHook(shutdown);
- }
- }
- }
-
- /**
- * Stop the given domain manager.
- *
- * @param domainManager
- * @throws Exception
- */
- private static void stopDomainManager(Object domainManager) throws Exception {
- try {
- domainManager.getClass().getMethod("stop").invoke(domainManager);
- logger.info("SCA Domain Manager is now stopped.");
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Domain Manager could not be stopped", e);
- throw e;
- }
- }
-
- private static class ShutdownThread extends Thread {
- private Object domainManager;
-
- public ShutdownThread(Object domainManager) {
- super();
- this.domainManager = domainManager;
- }
-
- public void run() {
- try {
- stopDomainManager(domainManager);
- } catch (Exception e) {
- // Ignore
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.java
deleted file mode 100644
index 39e8d81139..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/LauncherException.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.node.launcher;
-
-
-/**
- * Denotes an error launching an SCA domain manager or node.
- *
- * @version $Rev$ $Date$
- */
-public class LauncherException extends Exception {
- private static final long serialVersionUID = 4581189418849190567L;
-
- public LauncherException() {
- super();
- }
-
- /**
- * @param message
- * @param cause
- */
- public LauncherException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * @param message
- */
- public LauncherException(String message) {
- super(message);
- }
-
- /**
- * @param cause
- */
- public LauncherException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java
deleted file mode 100644
index 7cfabfe265..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeDaemonLauncher.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.launcher;
-
-import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.nodeDaemon;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A launcher for the SCA Node daemon.
- *
- * @version $Rev$ $Date$
- */
-public class NodeDaemonLauncher {
-
- static final Logger logger = Logger.getLogger(NodeDaemonLauncher.class.getName());
-
- /**
- * Constructs a new node daemon launcher.
- */
- private NodeDaemonLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static NodeDaemonLauncher newInstance() {
- return new NodeDaemonLauncher();
- }
-
- /**
- * Creates a new node daemon.
- *
- * @param
- * @return a new node daemon
- * @throws LauncherException
- */
- public <T> T createNodeDaemon() throws LauncherException {
- return (T)nodeDaemon();
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA Node Daemon is starting...");
-
- // Create a node launcher
- NodeDaemonLauncher launcher = newInstance();
-
- Object node = null;
- ShutdownThread shutdown = null;
- try {
- while (true) {
-
- // Start the node
- node = launcher.createNodeDaemon();
- try {
- node.getClass().getMethod("start").invoke(node);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node Daemon could not be started", e);
- throw e;
- }
- logger.info("SCA Node Daemon is now started.");
-
- // Install a shutdown hook
- shutdown = new ShutdownThread(node);
- Runtime.getRuntime().addShutdownHook(shutdown);
-
- logger.info("Press 'q' to quit, 'r' to restart.");
- int k = 0;
- try {
- while ((k != 'q') && (k != 'r')) {
- k = System.in.read();
- }
- } catch (IOException e) {
-
- // Wait forever
- Object lock = new Object();
- synchronized(lock) {
- lock.wait();
- }
- }
-
- // Stop the node
- if (node != null) {
- Object n = node;
- node = null;
- stopNode(n);
- }
-
- // Quit
- if (k == 'q' ) {
- break;
- }
- }
- } catch (Exception e) {
- // Stop the node
- if (node != null) {
- try {
- Object n = node;
- node = null;
- stopNode(n);
- } catch (Exception e2) {
- }
- }
- throw e;
-
- } finally {
-
- // Remove the shutdown hook
- if (shutdown != null) {
- Runtime.getRuntime().removeShutdownHook(shutdown);
- }
- }
- }
-
- /**
- * Stop the given node.
- *
- * @param node
- * @throws Exception
- */
- private static void stopNode(Object node) throws Exception {
- try {
- node.getClass().getMethod("stop").invoke(node);
- logger.info("SCA Node Daemon is now stopped.");
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node Daemon could not be stopped", e);
- throw e;
- }
- }
-
- private static class ShutdownThread extends Thread {
- private Object node;
-
- public ShutdownThread(Object node) {
- super();
- this.node = node;
- }
-
- public void run() {
- try {
- stopNode(node);
- } catch (Exception e) {
- // Ignore
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java
deleted file mode 100644
index be9bdb15c4..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncher.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.launcher;
-
-import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.node;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A launcher for SCA nodes.
- *
- * @version $Rev$ $Date$
- */
-public class NodeLauncher {
-
- static final Logger logger = Logger.getLogger(NodeLauncher.class.getName());
-
- /**
- * Constructs a new node launcher.
- */
- private NodeLauncher() {
- }
-
- /**
- * Returns a new launcher instance.
- *
- * @return a new launcher instance
- */
- public static NodeLauncher newInstance() {
- return new NodeLauncher();
- }
-
- /**
- * Creates a new SCA node from the configuration URL
- *
- * @param configurationURL the URL of the node configuration which is the ATOM feed
- * that contains the URI of the composite and a collection of URLs for the contributions
- *
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNodeFromURL(String configurationURL) throws LauncherException {
- return (T)node(configurationURL, null, null, null, null);
- }
-
- /**
- * Creates a new SCA Node.
- *
- * @param compositeURI the URI of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related
- * artifacts. If the list is empty, then we will use the thread context classloader to discover
- * the contribution on the classpath
- *
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNode(String compositeURI, Contribution...contributions) throws LauncherException {
- return (T)node(null, compositeURI, null, contributions, null);
- }
-
- /**
- * Creates a new SCA Node.
- *
- * @param compositeURI the URI of the composite to use
- * @param compositeContent the XML content of the composite to use
- * @param contributions the URI of the contributions that provides the composites and related artifacts
- * @return a new SCA node.
- * @throws LauncherException
- */
- public <T> T createNode(String compositeURI, String compositeContent, Contribution...contributions) throws LauncherException {
- return (T)node(null, compositeURI, compositeContent, contributions, null);
- }
-
- /**
- * Create a SCA node based on the discovery of the contribution on the classpath for the
- * given classloader. This method should be treated a convenient shortcut with the following
- * assumptions:
- * <ul>
- * <li>This is a standalone application and there is a deployable composite file on the classpath.
- * <li>There is only one contribution which contains the deployable composite file physically in its packaging hierarchy.
- * </ul>
- *
- * @param compositeURI The URI of the composite file relative to the root of the enclosing contribution
- * @param classLoader The ClassLoader used to load the composite file as a resource. If the value is null,
- * then thread context classloader will be used
- * @return A newly created SCA node
- */
- public <T> T createNodeFromClassLoader(String compositeURI, ClassLoader classLoader) throws LauncherException {
- return (T)node(null, compositeURI, null, null, classLoader);
- }
-
- public static void main(String[] args) throws Exception {
- logger.info("Apache Tuscany SCA Node is starting...");
-
- // Create a node launcher
- NodeLauncher launcher = newInstance();
-
- Object node = null;
- ShutdownThread shutdown = null;
- try {
- while (true) {
- if (args.length ==1) {
-
- // Create a node from a configuration URI
- String configurationURI = args[0];
- logger.info("SCA Node configuration: " + configurationURI);
- node = launcher.createNodeFromURL(configurationURI);
- } else {
-
- // Create a node from a composite URI and a contribution location
- String compositeURI = args[0];
- String contributionLocation = args[1];
- logger.info("SCA composite: " + compositeURI);
- logger.info("SCA contribution: " + contributionLocation);
- node = launcher.createNode(compositeURI, new Contribution("default", contributionLocation));
- }
-
- // Start the node
- try {
- node.getClass().getMethod("start").invoke(node);
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node could not be started", e);
- throw e;
- }
- logger.info("SCA Node is now started.");
-
- // Install a shutdown hook
- shutdown = new ShutdownThread(node);
- Runtime.getRuntime().addShutdownHook(shutdown);
-
- logger.info("Press 'q' to quit, 'r' to restart.");
- int k = 0;
- try {
- while ((k != 'q') && (k != 'r')) {
- k = System.in.read();
- }
- } catch (IOException e) {
-
- // Wait forever
- Object lock = new Object();
- synchronized(lock) {
- lock.wait();
- }
- }
-
- // Stop the node
- if (node != null) {
- Object n = node;
- node = null;
- stopNode(n);
- }
-
- // Quit
- if (k == 'q' ) {
- break;
- }
- }
- } catch (Exception e) {
- // Stop the node
- if (node != null) {
- try {
- Object n = node;
- node = null;
- stopNode(n);
- } catch (Exception e2) {
- }
- }
- throw e;
-
- } finally {
-
- // Remove the shutdown hook
- if (shutdown != null) {
- Runtime.getRuntime().removeShutdownHook(shutdown);
- }
- }
- }
-
- /**
- * Stop the given node.
- *
- * @param node
- * @throws Exception
- */
- private static void stopNode(Object node) throws Exception {
- try {
- node.getClass().getMethod("stop").invoke(node);
- logger.info("SCA Node is now stopped.");
- } catch (Exception e) {
- logger.log(Level.SEVERE, "SCA Node could not be stopped", e);
- throw e;
- }
- }
-
- private static class ShutdownThread extends Thread {
- private Object node;
-
- public ShutdownThread(Object node) {
- super();
- this.node = node;
- }
-
- public void run() {
- try {
- stopNode(node);
- } catch (Exception e) {
- // Ignore
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
deleted file mode 100644
index 59d050734c..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.launcher;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Common functions and constants used by the admin components.
- *
- * @version $Rev$ $Date$
- */
-final class NodeLauncherUtil {
- private static final Logger logger = Logger.getLogger(NodeLauncherUtil.class.getName());
-
- private static final String TUSCANY_HOME = "TUSCANY_HOME";
- private static final String TUSCANY_PATH = "TUSCANY_PATH";
-
-
- /**
- * Returns a ClassLoader for the Tuscany runtime JARs for use in a standalone
- * J2SE environment.
- *
- * @param parentClassLoader
- *
- * @return
- */
- static ClassLoader standAloneRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
- return runtimeClassLoader(parentClassLoader, new StandAloneJARFileNameFilter());
- }
-
- /**
- * Returns a ClassLoader for the Tuscany runtime JARs for use in a Webapp
- * environment.
- *
- * @param parentClassLoader
- *
- * @return
- */
- static ClassLoader webAppRuntimeClassLoader(ClassLoader parentClassLoader) throws FileNotFoundException, URISyntaxException, MalformedURLException {
- return runtimeClassLoader(parentClassLoader, new WebAppJARFileNameFilter());
- }
-
- /**
- * Returns a ClassLoader for the Tuscany runtime JARs.
- *
- * @param parentClassLoader
- * @param filter
- *
- * @return
- */
- private static ClassLoader runtimeClassLoader(ClassLoader parentClassLoader, FilenameFilter filter) throws FileNotFoundException, URISyntaxException, MalformedURLException {
-
- // Build list of runtime JARs
- Set<URL> jarDirectoryURLs = new HashSet<URL>();
- List<URL> jarURLs = new ArrayList<URL>();
-
- // First determine the path to the launcher class
- String resource = NodeLauncherUtil.class.getName().replace('.', '/') + ".class";
- URL url = NodeLauncherUtil.class.getClassLoader().getResource(resource);
- if (url == null) {
- throw new FileNotFoundException(resource);
- }
- URI uri = url.toURI();
-
- // If the launcher class is in a JAR, add all runtime JARs from directory containing
- // that JAR (e.g. the Tuscany modules directory) as well as the ../modules and
- // ../lib directories
- String scheme = uri.getScheme();
- if (scheme.equals("jar")) {
- String path = uri.toString().substring(4);
- int i = path.indexOf("!/");
- if (i != -1) {
- path = path.substring(0, i);
- uri = URI.create(path);
- }
-
- File file = new File(uri);
- if (file.exists()) {
- File jarDirectory = file.getParentFile();
- if (jarDirectory != null && jarDirectory.exists()) {
-
- // Collect JAR files from the directory containing the input JAR
- // (e.g. the Tuscany modules directory)
- URL jarDirectoryURL = jarDirectory.toURI().toURL();
- jarDirectoryURLs.add(jarDirectoryURL);
- collectJARFiles(jarDirectory, jarURLs, filter);
-
- File homeDirectory = jarDirectory.getParentFile();
- if (homeDirectory != null && homeDirectory.exists()) {
-
- // Collect JARs from the ../modules directory
- File modulesDirectory = new File(homeDirectory, "modules");
- URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
- jarDirectoryURLs.add(modulesDirectoryURL);
- collectJARFiles(modulesDirectory, jarURLs, filter);
- }
-
- // Collect JARs from the ../lib directory
- File libDirectory = new File(homeDirectory, "lib");
- URL libDirectoryURL = libDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
- jarDirectoryURLs.add(libDirectoryURL);
- collectJARFiles(libDirectory, jarURLs, filter);
- }
- }
- }
- }
- }
-
- // Look for a TUSCANY_HOME system property or environment variable
- // Add all the JARs found under $TUSCANY_HOME, $TUSCANY_HOME/modules
- // and $TUSCANY_HOME/lib
- String home = System.getProperty(TUSCANY_HOME);
- if (home == null || home.length() == 0) {
- home = System.getenv(TUSCANY_HOME);
- }
- if (home != null && home.length() != 0) {
- logger.fine(TUSCANY_HOME + ": " + home);
- collectJARFiles(home, jarDirectoryURLs, jarURLs, filter);
- }
-
- // Look for a TUSCANY_PATH system property or environment variable
- // Add all the JARs found under $TUSCANY_PATH, $TUSCANY_PATH/modules
- // and $TUSCANY_PATH/lib
- String ext = System.getProperty(TUSCANY_PATH);
- if (ext == null || ext.length() == 0) {
- ext = System.getenv(TUSCANY_PATH);
- }
- if (ext != null && ext.length() != 0) {
- logger.fine(TUSCANY_PATH + ": " + ext);
- String separator = System.getProperty("path.separator");
- for (StringTokenizer tokens = new StringTokenizer(ext, separator); tokens.hasMoreTokens(); ) {
- collectJARFiles(tokens.nextToken(), jarDirectoryURLs, jarURLs, filter);
- }
- }
-
- // Return the runtime class loader
- if (!jarURLs.isEmpty()) {
-
- // Return a ClassLoader configured with the runtime JARs
- ClassLoader classLoader = new RuntimeClassLoader(jarURLs.toArray(new URL[jarURLs.size()]), parentClassLoader);
- return classLoader;
-
- } else {
- return null;
- }
- }
-
- /**
- * Collect JAR files under the given directory.
- *
- * @param directory
- * @param jarDirectoryURLs
- * @param jarURLs
- * @param filter
- * @throws MalformedURLException
- */
- private static void collectJARFiles(String directory, Set<URL> jarDirectoryURLs, List<URL> jarURLs, FilenameFilter filter)
- throws MalformedURLException {
- File directoryFile = new File(directory);
- URL directoryURL = directoryFile.toURI().toURL();
- if (!jarDirectoryURLs.contains(directoryURL) && directoryFile.exists()) {
-
- // Collect files under $TUSCANY_HOME
- jarDirectoryURLs.add(directoryURL);
- collectJARFiles(directoryFile, jarURLs, filter);
-
- // Collect files under $TUSCANY_HOME/modules
- File modulesDirectory = new File(directoryFile, "modules");
- URL modulesDirectoryURL = modulesDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(modulesDirectoryURL) && modulesDirectory.exists()) {
- jarDirectoryURLs.add(modulesDirectoryURL);
- collectJARFiles(modulesDirectory, jarURLs, filter);
- }
-
- // Collect files under $TUSCANY_HOME/lib
- File libDirectory = new File(directoryFile, "lib");
- URL libDirectoryURL = libDirectory.toURI().toURL();
- if (!jarDirectoryURLs.contains(libDirectoryURL) && libDirectory.exists()) {
- jarDirectoryURLs.add(libDirectoryURL);
- collectJARFiles(libDirectory, jarURLs, filter);
- }
- }
- }
-
- /**
- * Collect JAR files in the given directory
- * @param directory
- * @param urls
- * @param filter
- * @throws MalformedURLException
- */
- private static void collectJARFiles(File directory, List<URL> urls, FilenameFilter filter) throws MalformedURLException {
- String[] files = directory.list(filter);
- if (files != null) {
- URL directoryURL = new URL(directory.toURI().toString() + "/");
- int count = 0;
- for (String file: files) {
- URL url = new URL(directoryURL, file);
- urls.add(url);
- count++;
- }
- if (count != 0) {
- logger.fine("Runtime classpath: "+ count + " JAR" + (count > 1? "s":"")+ " from " + directory.toString());
- }
- }
- }
-
- /**
- * A file name filter used to filter JAR files.
- */
- private static class StandAloneJARFileNameFilter implements FilenameFilter {
-
- public boolean accept(File dir, String name) {
- name = name.toLowerCase();
-
- // Exclude tuscany-sca-all and tuscany-sca-manifest as they duplicate
- // code in the individual runtime module JARs
- if (name.startsWith("tuscany-sca-all")) {
- return false;
- }
- if (name.startsWith("tuscany-sca-manifest")) {
- return false;
- }
-
- // Filter out the Tomcat and Webapp hosts
- if (name.startsWith("tuscany-host-tomcat") ||
- name.startsWith("tuscany-host-webapp")) {
- //FIXME This is temporary
- return false;
- }
-
- // Include JAR and MAR files
- if (name.endsWith(".jar")) {
- return true;
- }
- if (name.endsWith(".mar")) {
- return true;
- }
- return false;
- }
- }
-
- /**
- * A file name filter used to filter JAR files.
- */
- private static class WebAppJARFileNameFilter extends StandAloneJARFileNameFilter {
-
- @Override
- public boolean accept(File dir, String name) {
- if (!super.accept(dir, name)) {
- return false;
- }
- name = name.toLowerCase();
-
- // Exclude servlet-api JARs
- if (name.startsWith("servlet-api")) {
- return false;
- }
-
- // Exclude the Tomcat and Jetty hosts
- if (name.startsWith("tuscany-host-tomcat") || name.startsWith("tuscany-host-jetty")) {
- //FIXME This is temporary
- return false;
- }
-
- return true;
- }
- }
-
-
- /**
- * Creates a new node.
- *
- * @param compositeURI
- * @param contributions
- * @throws LauncherException
- */
- static Object node(String configurationURI, String compositeURI, String compositeContent, Contribution[] contributions, ClassLoader contributionClassLoader) throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
-
- // Set up runtime ClassLoader
- ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
- new StandAloneJARFileNameFilter());
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- // Use Java reflection to create the node as only the runtime class
- // loader knows the runtime classes required by the node
- String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationLauncherBootstrap";
- Class<?> bootstrapClass;
- if (runtimeClassLoader != null) {
- bootstrapClass = Class.forName(className, true, runtimeClassLoader);
- } else {
- bootstrapClass = Class.forName(className);
- }
-
- Object bootstrap;
- if (configurationURI != null) {
-
- // Construct the node with a configuration URI
- bootstrap = bootstrapClass.getConstructor(String.class).newInstance(configurationURI);
-
- } else if (contributionClassLoader != null) {
-
- // Construct the node with a compositeURI and a classloader
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class, ClassLoader.class);
- bootstrap = constructor.newInstance(compositeURI, contributionClassLoader);
-
- } else if (compositeContent != null) {
-
- // Construct the node with a composite URI, the composite content and
- // the URIs and locations of a list of contributions
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class, String.class, String[].class, String[].class);
- String[] uris = new String[contributions.length];
- String[] locations = new String[contributions.length];
- for (int i = 0; i < contributions.length; i++) {
- uris[i] = contributions[i].getURI();
- locations[i] = contributions[i].getLocation();
- }
- bootstrap = constructor.newInstance(compositeURI, compositeContent, uris, locations);
-
- } else {
-
- // Construct the node with a composite URI and the URIs and
- // locations of a list of contributions
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class, String[].class, String[].class);
- String[] uris = new String[contributions.length];
- String[] locations = new String[contributions.length];
- for (int i = 0; i < contributions.length; i++) {
- uris[i] = contributions[i].getURI();
- locations[i] = contributions[i].getLocation();
- }
- bootstrap = constructor.newInstance(compositeURI, uris, locations);
- }
-
- Object node = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- return node;
-
- } catch (Exception e) {
- Throwable ce = e instanceof InvocationTargetException ? e.getCause() : e;
- if (ce.getClass().getName().equals("org.osoa.sca.ServiceRuntimeException") &&
- ce.getCause() != null &&
- ce.getCause().getClass().getName().equals("org.apache.tuscany.sca.monitor.MonitorRuntimeException")) {
- NodeLauncher.logger.log(Level.SEVERE, "SCA Node could not be created");
- throw new LauncherException("SCA Node could not be created");
- }
- NodeLauncher.logger.log(Level.SEVERE, "SCA Node could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- /**
- * Creates a new node daemon.
- *
- * @throws LauncherException
- */
- static Object nodeDaemon() throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- // Set up runtime ClassLoader
- ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
- new StandAloneJARFileNameFilter());
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- // Use Java reflection to create the node daemon as only the runtime class
- // loader knows the runtime classes required by the node
- String className = "org.apache.tuscany.sca.implementation.node.launcher.NodeImplementationDaemonBootstrap";
- Class<?> bootstrapClass;
- if (runtimeClassLoader != null) {
- bootstrapClass = Class.forName(className, true, runtimeClassLoader);
- } else {
- bootstrapClass = Class.forName(className);
- }
- Object bootstrap = bootstrapClass.getConstructor().newInstance();
-
- Object nodeDaemon = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- return nodeDaemon;
-
- } catch (Exception e) {
- NodeDaemonLauncher.logger.log(Level.SEVERE, "SCA Node Daemon could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- /**
- * Creates a new domain manager.
- *
- * @throws LauncherException
- */
- static Object domainManager(String rootDirectory) throws LauncherException {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- // Set up runtime ClassLoader
- ClassLoader runtimeClassLoader = runtimeClassLoader(Thread.currentThread().getContextClassLoader(),
- new StandAloneJARFileNameFilter());
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- // Use Java reflection to create the node daemon as only the runtime class
- // loader knows the runtime classes required by the node
- String className = "org.apache.tuscany.sca.domain.manager.launcher.DomainManagerLauncherBootstrap";
- Class<?> bootstrapClass;
- if (runtimeClassLoader != null) {
- bootstrapClass = Class.forName(className, true, runtimeClassLoader);
- } else {
- bootstrapClass = Class.forName(className);
- }
- Constructor<?> constructor = bootstrapClass.getConstructor(String.class);
- Object bootstrap = constructor.newInstance(rootDirectory);
-
- Object domainManager = bootstrapClass.getMethod("getNode").invoke(bootstrap);
- return domainManager;
-
- } catch (Exception e) {
- DomainManagerLauncher.logger.log(Level.SEVERE, "SCA Domain Manager could not be created", e);
- throw new LauncherException(e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
- /**
- * Simple URL class loader for the runtime JARs
- */
- private static class RuntimeClassLoader extends URLClassLoader {
- private static final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
- private ClassLoader parent;
-
- /**
- * Constructs a new class loader.
- * @param urls
- * @param parent
- */
- private RuntimeClassLoader(URL[] urls, ClassLoader parent) {
- super(urls);
- this.parent = parent;
- }
-
- @Override
- public URL findResource(String name) {
- URL url = super.findResource(name);
- if (url == null) {
- url = parent.getResource(name);
- }
- return url;
- }
-
- @Override
- public Enumeration<URL> findResources(String name) throws IOException {
- Enumeration<URL> resources = super.findResources(name);
- Enumeration<URL> parentResources = parent.getResources(name);
- List<URL> allResources = new ArrayList<URL>();
- for (; resources.hasMoreElements(); ) {
- allResources.add(resources.nextElement());
- }
- for (; parentResources.hasMoreElements(); ) {
- allResources.add(parentResources.nextElement());
- }
- return Collections.enumeration(allResources);
- }
-
- @Override
- protected Class<?> findClass(String name) throws ClassNotFoundException {
- Class<?> cl;
-
- // First try to load the class using the parent classloader
- try {
- cl = parent.loadClass(name);
- ClassLoader loadedBy = cl.getClassLoader();
-
- // If the class was not loaded directly by the parent classloader
- // or the system classloader try to load a local version of the class
- // using our RuntimeClassloader instead
- if (loadedBy != parent &&
- loadedBy != systemClassLoader &&
- loadedBy != null) {
-
- try {
- cl = super.findClass(name);
- } catch (ClassNotFoundException e) {
- // No class alternative was found in our RuntimeClassloader,
- // use the class found in the parent classloader hierarchy
- }
- }
- } catch (ClassNotFoundException e) {
-
- // The class was not found by the parent class loader, try
- // to load it using our RuntimeClassloader
- cl = super.findClass(name);
- }
-
- return cl;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.java
deleted file mode 100644
index eafe4ddaa0..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeMain.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.node.launcher;
-
-
-/**
- * Main class for this JAR.
- * With no arguments this class launches the SCA Node Daemon.
- * With a "domain" argument it launches the SCA domain admin node.
- * With any other argument it launches an SCA Node.
- *
- * @version $Rev$ $Date$
- */
-public class NodeMain {
-
- public static void main(String[] args) throws Exception {
- if (args.length != 0) {
- if (args[0].equals("domain")) {
- DomainManagerLauncher.main(args);
- } else {
- NodeLauncher.main(args);
- }
- } else {
- NodeDaemonLauncher.main(args);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java b/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java
deleted file mode 100644
index 5345363031..0000000000
--- a/branches/sca-java-1.5.1/modules/node-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeServletFilter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.node.launcher;
-
-import static org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.webAppRuntimeClassLoader;
-
-import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-
-/**
- * A Servlet filter that forwards service requests to the Servlets registered with
- * the Tuscany ServletHost.
- *
- * @version $Rev$ $Date$
- */
-public class NodeServletFilter implements Filter {
- private static final long serialVersionUID = 1L;
-
- private static final String NODE_WEB_APP_SERVLET_HOST = "org.apache.tuscany.sca.implementation.node.webapp.NodeWebAppServletHost";
-
- private static final Logger logger = Logger.getLogger(NodeServletFilter.class.getName());
-
- private ClassLoader runtimeClassLoader;
- private Class<?> servletHostClass;
- private Object servletHost;
- private Filter filter;
-
- public void init(FilterConfig filterConfig) throws ServletException {
- logger.info("Apache Tuscany SCA WebApp Node is starting...");
-
- try {
- // Get the Tuscany runtime ClassLoader
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- runtimeClassLoader = webAppRuntimeClassLoader(getClass().getClassLoader());
-
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- // Load the Tuscany WebApp Servlet host and get the host instance
- // for the current webapp
- String className = NODE_WEB_APP_SERVLET_HOST;
- if (runtimeClassLoader != null) {
- servletHostClass = Class.forName(className, true, runtimeClassLoader);
- } else {
- servletHostClass = Class.forName(className);
- }
- servletHost = servletHostClass.getMethod("servletHost").invoke(null);
-
- // Initialize the Servlet host
- servletHostClass.getMethod("init", FilterConfig.class).invoke(servletHost, filterConfig);
-
- // The Servlet host also implements the filter interface
- filter = (Filter)servletHost;
-
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
-
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Error Starting SCA WebApp Node", e);
- throw new ServletException(e);
- }
-
- logger.info("SCA WebApp Node started.");
- }
-
- public void destroy() {
- logger.info("Apache Tuscany WebApp Node stopping...");
- if (servletHost != null) {
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- servletHostClass.getMethod("destroy").invoke(servletHost);
-
- } catch (Exception e) {
- logger.log(Level.SEVERE, "Error Stopping SCA WebApp Node", e);
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
- logger.info("SCA WebApp Node stopped.");
- }
-
- public void doFilter(ServletRequest request, ServletResponse response, javax.servlet.FilterChain chain)
- throws IOException, ServletException {
-
- // Delegate to the Servlet host filter
- ClassLoader tccl = Thread.currentThread().getContextClassLoader();
- try {
- if (runtimeClassLoader != null) {
- Thread.currentThread().setContextClassLoader(runtimeClassLoader);
- }
-
- filter.doFilter(request, response, chain);
-
- } finally {
- Thread.currentThread().setContextClassLoader(tccl);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-manager/LICENSE b/branches/sca-java-1.5.1/modules/node-manager/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/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-java-1.5.1/modules/node-manager/NOTICE b/branches/sca-java-1.5.1/modules/node-manager/NOTICE
deleted file mode 100644
index 94481d6cfa..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2007 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/node-manager/pom.xml b/branches/sca-java-1.5.1/modules/node-manager/pom.xml
deleted file mode 100644
index b051b2fb2e..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/pom.xml
+++ /dev/null
@@ -1,138 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-node-manager</artifactId>
- <name>Apache Tuscany SCA Node Manager Application</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-node</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-launcher</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-data-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-node-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-jetty</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java-runtime</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-binding-atom-abdera</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.node.manager</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.node.manager*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeManagerUtil.java b/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeManagerUtil.java
deleted file mode 100644
index 8dfae91314..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeManagerUtil.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.implementation.node.manager;
-
-/**
- * Utility methods for node implementation launchers.
- *
- * @version $Rev$ $Date$
- */
-public class NodeManagerUtil {
-
- private static final String TUSCANY_DOMAIN = "TUSCANY_DOMAIN";
- private static final String DEFAULT_DOMAIN = "http://localhost:9990";
-
- /**
- * Determine the URI of a node configuration. The domain URI can be configured
- * using a TUSCANY_DOMAIN system property or environment variable.
- *
- * @param nodeName
- * @return
- */
- public static String nodeConfigurationURI(String nodeName) {
- String domain = System.getProperty(TUSCANY_DOMAIN);
- if (domain == null || domain.length() == 0) {
- domain = System.getenv(TUSCANY_DOMAIN);
- }
- if (domain == null || domain.length() ==0) {
- domain = DEFAULT_DOMAIN;
- }
- String nodeConfiguration = domain + "/node-config/" + nodeName;
- return nodeConfiguration;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeProcessCollectionImpl.java b/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeProcessCollectionImpl.java
deleted file mode 100644
index 019c2562ec..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/NodeProcessCollectionImpl.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.implementation.node.manager;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.data.collection.Entry;
-import org.apache.tuscany.sca.data.collection.Item;
-import org.apache.tuscany.sca.data.collection.ItemCollection;
-import org.apache.tuscany.sca.data.collection.LocalItemCollection;
-import org.apache.tuscany.sca.data.collection.NotFoundException;
-import org.apache.tuscany.sca.node.launcher.NodeLauncher;
-import org.osoa.sca.ServiceRuntimeException;
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a node process collection service.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={ItemCollection.class, LocalItemCollection.class})
-public class NodeProcessCollectionImpl implements ItemCollection, LocalItemCollection {
-
- private static final Logger logger = Logger.getLogger(NodeProcessCollectionImpl.class.getName());
-
- private List<SCANodeVM> nodeVMs = new ArrayList<SCANodeVM>();
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() {
- }
-
- public Entry<String, Item>[] getAll() {
- logger.fine("getAll");
-
- // Return all the running VMs
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- for (SCANodeVM vm: nodeVMs) {
- entries.add(entry(vm));
- }
- return entries.toArray(new Entry[entries.size()]);
- }
-
- public Item get(String key) throws NotFoundException {
- logger.fine("get " + key);
-
- // Return the specified VM
- SCANodeVM vm = vm(key);
- if (vm == null) {
- throw new NotFoundException();
- }
-
- return item(vm);
- }
-
- public String post(String key, Item item) {
- logger.fine("post " + key);
-
- // If the VM is already running just return it
- SCANodeVM vm = vm(key);
- if (vm != null) {
- if (vm.isAlive()) {
- return key;
- } else {
- // Remove dead VM entry
- try {
- vm.stop();
- } catch (InterruptedException e) {
- throw new ServiceRuntimeException(e);
- }
- nodeVMs.remove(vm);
- }
- }
-
- // Start a new VM and add it to the collection
- vm = new SCANodeVM(key);
- nodeVMs.add(0, vm);
- try {
- vm.start();
- } catch (IOException e) {
- throw new ServiceRuntimeException(e);
- }
-
- return key;
- }
-
- public void put(String key, Item item) throws NotFoundException {
- throw new UnsupportedOperationException();
- }
-
- public void delete(String key) throws NotFoundException {
- logger.fine("delete " + key);
-
- // Stop a VM and remove it from the collection
- SCANodeVM vm = vm(key);
- if (vm != null) {
- try {
- vm.stop();
- } catch (InterruptedException e) {
- throw new ServiceRuntimeException(e);
- }
- nodeVMs.remove(vm);
- } else {
- //throw new NotFoundException();
- }
- }
-
- public Entry<String, Item>[] query(String queryString) {
- logger.fine("query " + queryString);
-
- if (queryString.startsWith("node=")) {
-
- // Return the log for the specified VM
- String key = queryString.substring(queryString.indexOf('=') + 1);
- List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>();
- for (SCANodeVM vm: nodeVMs) {
- if (vm.getNodeName().equals(key)) {
- entries.add(entry(vm));
- }
- }
- return entries.toArray(new Entry[entries.size()]);
-
- } else {
- throw new UnsupportedOperationException();
- }
- }
-
- /**
- * Returns the specified VM.
- *
- * @param key
- * @return
- */
- private SCANodeVM vm(String key) {
- for (SCANodeVM vm: nodeVMs) {
- if (key.equals(vm.getNodeName())) {
- return vm;
- }
- }
- return null;
- }
-
- /**
- * Returns an entry representing a VM.
- *
- * @param vm
- * @return
- */
- private static Entry<String, Item> entry(SCANodeVM vm) {
- Entry<String, Item> entry = new Entry<String, Item>();
- entry.setKey(vm.getNodeName());
- entry.setData(item(vm));
- return entry;
- }
-
- /**
- * Returns an item representing a VM.
- *
- * @param vm
- * @return
- */
- private static Item item(SCANodeVM vm) {
- Item item = new Item();
- String key = vm.getNodeName();
- item.setTitle(title(key));
- item.setLink("/node-config/" + vm.getNodeName());
- item.setContents("<span id=\"log\" style=\"white-space: nowrap; font-size: small\">" + vm.getLog().toString() + "</span>");
- return item;
- }
-
- /**
- * Represent a child Java VM running an SCA node.
- */
- private static class SCANodeVM {
- private String nodeName;
- private StringBuffer log;
- private Process process;
- private Thread monitor;
- private int status;
-
- SCANodeVM(String nodeName) {
- log = new StringBuffer();
- this.nodeName =nodeName;
- }
-
- /**
- * Starts a node in a new VM.
- */
- private void start() throws IOException {
-
- // Determine the node configuration URI
- String nodeConfigurationURI = NodeManagerUtil.nodeConfigurationURI(nodeName);
-
- // Build the Java VM command line
- Properties props = System.getProperties();
- String java = props.getProperty("java.home") + "/bin/java";
- String cp = props.getProperty("java.class.path");
- String main = NodeLauncher.class.getName();
- final List<String> command = new ArrayList<String>();
- command.add(java);
- command.add("-cp");
- command.add(cp);
-
- // Propagate TUSCANY properties
- String tuscanyHome = props.getProperty("TUSCANY_HOME");
- if (tuscanyHome != null) {
- command.add("-DTUSCANY_HOME=" + tuscanyHome);
- }
- String tuscanyPath = props.getProperty("TUSCANY_PATH");
- if (tuscanyPath != null) {
- command.add("-DTUSCANY_PATH=" + tuscanyPath);
- }
-
- // Specify the main class and parameters
- command.add(main);
- command.add(nodeConfigurationURI);
-
- logger.info("Starting " + "java " + main + " " + nodeConfigurationURI);
-
- // Start the VM
- ProcessBuilder builder = new ProcessBuilder(command);
- builder.redirectErrorStream(true);
- process = builder.start();
-
- logger.info("Started " + process);
-
- // Start a thread to monitor the process
- final BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
- monitor = new Thread(new Runnable() {
- public void run() {
- try {
- for (;;) {
- String s = reader.readLine();
- if (s != null) {
- logger.info(s);
- log.append(s + "<br>");
- } else {
- break;
- }
- }
- status = process.waitFor();
- } catch (IOException e) {
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- });
- monitor.start();
- }
-
- /**
- * Returns the composite used to start this VM.
- * @return
- */
- String getNodeName() {
- return nodeName;
- }
-
- /**
- * Returns the log for this VM.
- *
- * @return
- */
- StringBuffer getLog() {
- return log;
- }
-
- /**
- * Returns true if the VM is alive
- *
- * @return
- */
- private boolean isAlive() {
- return monitor.isAlive();
- }
-
- /**
- * Returns the VM status code.
- * @return
- */
- int getStatus() {
- return status;
- }
-
- /**
- * Stops the VM.
- *
- * @throws InterruptedException
- */
- private void stop() throws InterruptedException {
- logger.info("Stopping " + process);
-
- process.destroy();
- monitor.join();
-
- logger.info("Stopped " + process);
- }
- }
-
- /**
- * Returns a node title.
- *
- * @param key
- * @return
- */
- private static String title(String key) {
- return key;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/PingServiceImpl.java b/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/PingServiceImpl.java
deleted file mode 100644
index d0475e1dd3..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/src/main/java/org/apache/tuscany/sca/implementation/node/manager/PingServiceImpl.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.implementation.node.manager;
-
-import java.io.IOException;
-import java.util.logging.Logger;
-
-import javax.servlet.Servlet;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.osoa.sca.annotations.Init;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * Implementation of a ping service component.
- *
- * @version $Rev$ $Date$
- */
-@Scope("COMPOSITE")
-@Service(interfaces={Servlet.class})
-public class PingServiceImpl extends HttpServlet {
- private static final long serialVersionUID = -3477992129462720901L;
-
- private static final Logger logger = Logger.getLogger(PingServiceImpl.class.getName());
-
- /**
- * Initialize the component.
- */
- @Init
- public void initialize() throws ParserConfigurationException {
- }
-
- @Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- logger.fine("ping");
- response.getWriter().print("<html><body><span id=\"ping\">OK</span></body></html>");
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/node-manager/src/main/resources/NodeDaemon.composite b/branches/sca-java-1.5.1/modules/node-manager/src/main/resources/NodeDaemon.composite
deleted file mode 100644
index cb587b02fd..0000000000
--- a/branches/sca-java-1.5.1/modules/node-manager/src/main/resources/NodeDaemon.composite
+++ /dev/null
@@ -1,39 +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:t="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- name="NodeDaemon">
-
- <component name="NodeProcessCollectionComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.node.manager.NodeProcessCollectionImpl"/>
- <service name="ItemCollection">
- <t:binding.atom uri="http://localhost:9990/node/processes" title="Log"/>
- </service>
- </component>
-
- <component name="PingServiceComponent">
- <implementation.java class="org.apache.tuscany.sca.implementation.node.manager.PingServiceImpl"/>
- <service name="Servlet">
- <t:binding.http uri="http://localhost:9990/ping"/>
- </service>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/LICENSE b/branches/sca-java-1.5.1/modules/osgi-runtime/LICENSE
deleted file mode 100644
index 43e91eb0b0..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/LICENSE
+++ /dev/null
@@ -1,203 +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-java-1.5.1/modules/osgi-runtime/NOTICE b/branches/sca-java-1.5.1/modules/osgi-runtime/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/pom.xml b/branches/sca-java-1.5.1/modules/osgi-runtime/pom.xml
deleted file mode 100644
index b664a6f3db..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-osgi-runtime</artifactId>
- <name>Apache Tuscany SCA OSGi Runtime Helper Library</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.main</artifactId>
- <version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core-spi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility-osgi</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.osgi.runtime
- </Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.osgi.runtime*
- </Export-Package>
- <Bundle-Activator>org.apache.tuscany.sca.osgi.runtime.OSGiBundleActivator
- </Bundle-Activator>
- <DynamicImport-Package>org.apache.felix.main,org.eclipse.core.runtime.adaptor
- </DynamicImport-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java
deleted file mode 100644
index 43101b14c9..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/EquinoxRuntime.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.osgi.runtime;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * Implementation of an OSGi Runtime using Equinox.
- *
- * @version $Rev$ $Date$
- */
-public class EquinoxRuntime extends OSGiRuntime {
-
-
- private static BundleContext bundleContext;
-
- private static EquinoxRuntime instance;
-
- private static Class<?> eclipseStarterClass;
-
- public static OSGiRuntime getInstance() throws Exception {
- if (instance == null) {
- eclipseStarterClass = EquinoxRuntime.class.getClassLoader().loadClass("org.eclipse.core.runtime.adaptor.EclipseStarter");
- EquinoxRuntime runtime = new EquinoxRuntime();
- instance = runtime;
- }
- return instance;
- }
-
- @Override
- protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
-
- if (bundleContext != null)
- return bundleContext;
-
- Method startupMethod = eclipseStarterClass.getMethod("startup", String [].class, Runnable.class);
-
- // Equinox version 3.2 upwards have a startup method which returns BundleContext
- if (startupMethod.getReturnType() == BundleContext.class) {
- bundleContext = (BundleContext) startupMethod.invoke(null, new String[] {"-clean", "-console"}, null );
- }
- else {
-
- // Older versions of Equinox don't have a public method to obtain system bundlecontext
- // Extract bundleContext from the private field 'context'. We are assuming that
- // there is no access restriction
- Method mainMethod = eclipseStarterClass.getMethod("main", String [].class);
- mainMethod.invoke(null, (Object)new String[] {"-clean", "-console"});
-
- Field contextField = eclipseStarterClass.getDeclaredField("context");
- contextField.setAccessible(true);
- bundleContext = (BundleContext) contextField.get(null);
-
- }
-
-
- return bundleContext;
-
- }
-
- @Override
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- @Override
- protected void setBundleContext(BundleContext bundleContext) {
- super.setBundleContext(bundleContext);
- EquinoxRuntime.bundleContext = bundleContext;
- }
-
- @Override
- public void shutdown() throws Exception {
-
- if (bundleContext == null)
- return;
- bundleContext = null;
- instance = null;
- if (eclipseStarterClass != null) {
- Method shutdownMethod = eclipseStarterClass.getMethod("shutdown");
- try {
- shutdownMethod.invoke(eclipseStarterClass);
- } catch (Exception e) {
- // Ignore errors.
- }
- }
- super.shutdown();
- }
-
-
- @Override
- public boolean supportsBundleFragments() {
- return false;
- }
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java
deleted file mode 100644
index f8b56c88d6..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/FelixRuntime.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.osgi.runtime;
-
-import java.io.File;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * Implementation of an OSGi Runtime using Felix.
- *
- * @version $Rev$ $Date$
- */
-public class FelixRuntime extends OSGiRuntime implements BundleActivator {
-
- private static BundleContext bundleContext;
-
- private static FelixRuntime instance;
-
- private static Class<?> felixMainClass;
- private static Class<?> felixClass;
- private static Object felix;
-
- public static OSGiRuntime getInstance() throws Exception {
- if (instance == null) {
- felixMainClass = FelixRuntime.class.getClassLoader().loadClass("org.apache.felix.main.Main");
- FelixRuntime runtime = new FelixRuntime();
- instance = runtime;
- }
- return instance;
- }
-
-
- private static void deleteDirectory(File dir) {
-
- File[] files = dir.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory())
- deleteDirectory(files[i]);
- else
- files[i].delete();
- }
- dir.delete();
-
- }
-
- @Override
- protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
-
- if (bundleContext != null)
- return bundleContext;
-
-
- ClassLoader cl = FelixRuntime.class.getClassLoader();
-
- felixClass = cl.loadClass("org.apache.felix.framework.Felix");
- Method propsMethod = felixMainClass.getMethod("loadConfigProperties");
- Properties props = (Properties)propsMethod.invoke(null);
-
- String profileDirName = ".felix";
- File targetDir = new File("target");
- if (targetDir.exists() && targetDir.isDirectory())
- profileDirName = "target/" + profileDirName;
- File profileDir = new File(profileDirName);
- if (profileDir.isDirectory())
- deleteDirectory(profileDir);
- else
- profileDir.delete();
- profileDir.mkdir();
- profileDir.deleteOnExit();
-
- props.put("felix.cache.profiledir", profileDir.getAbsolutePath());
- props.put("felix.embedded.execution", "true");
-
- String systemPackages =
- "org.osgi.framework; version=1.3.0," +
- "org.osgi.service.packageadmin; version=1.2.0, " +
- "org.osgi.service.startlevel; version=1.0.0, " +
- "org.osgi.service.url; version=1.0.0, " +
- "org.osgi.util.tracker; version=1.3.2, " +
- "javax.xml, " +
- "javax.xml.datatype, " +
- "javax.xml.namespace, " +
- "javax.xml.parsers, " +
- "javax.xml.transform, " +
- "javax.xml.transform.dom, " +
- "javax.xml.transform.sax, " +
- "javax.xml.transform.stream, " +
- "javax.xml.validation, " +
- "javax.xml.xpath, " +
- "org.apache.xerces.jaxp.datatype, " +
- "org.w3c.dom, " +
- "org.xml.sax, " +
- "org.xml.sax.ext, " +
- "org.xml.sax.helpers, " +
- "javax.security.auth, " +
- "javax.naming, " +
- "javax.naming.spi, " +
- "javax.naming.directory, " +
- "javax.management, " +
- "sun.misc";
-
-
- if (!tuscanyRunningInOSGiContainer) {
- systemPackages = systemPackages + ", org.osoa.sca.annotations, org.osoa.sca";
- systemPackages = systemPackages + ", commonj.sdo, commonj.sdo.helper, org.apache.tuscany.sdo.helper, org.apache.tuscany.sdo.impl, org.apache.tuscany.sdo.model, org.apache.tuscany.sdo.model.impl";
- systemPackages = systemPackages + ", org.eclipse.emf.ecore, org.eclipse.emf.ecore.util, org.eclipse.emf.ecore.impl";
- }
- props.put("org.osgi.framework.system.packages", systemPackages);
-
- try {
- Constructor felixConstructor = felixClass.getConstructor(Map.class, List.class);
- List<BundleActivator> activators = new ArrayList<BundleActivator>();
-
- Class<?> autoActivatorClass = cl.loadClass("org.apache.felix.main.AutoActivator");
- Constructor autoActivatorConstructor = autoActivatorClass.getConstructor(Map.class);
- BundleActivator autoActivator = (BundleActivator)autoActivatorConstructor.newInstance(props);
- activators.add(autoActivator);
-
- felix = felixConstructor.newInstance(props, activators);
- ((Bundle)felix).start();
- bundleContext = ((Bundle)felix).getBundleContext();
-
-
- } catch (Exception e) {
-
- // This is the older Felix API which has been retained temporarily to avoid build break
- // TODO: Remove these once Felix 1.0.0 is released.
-
- Class<?> propertyResolverClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolver");
- Class<?> propertyResolverImplClass = cl.loadClass("org.apache.felix.framework.util.MutablePropertyResolverImpl");
-
- Constructor implConstructor = propertyResolverImplClass.getConstructor(Map.class);
- Object mutableProps = implConstructor.newInstance(props);
-
-
- try {
- Constructor felixConstructor = felixClass.getConstructor(propertyResolverClass, List.class);
- List<BundleActivator> activators = new ArrayList<BundleActivator>();
- felix = felixConstructor.newInstance(mutableProps, activators);
- ((Bundle)felix).start();
- bundleContext = ((Bundle)felix).getBundleContext();
- } catch (Exception e1) {
-
-
- felix = felixClass.newInstance();
- Method startMethod = felixClass.getMethod("start", propertyResolverClass, List.class);
- List<BundleActivator> activators = new ArrayList<BundleActivator>();
- BundleActivator activator = new FelixRuntime();
- activators.add(activator);
- startMethod.invoke(felix, mutableProps, activators);
-
- synchronized (activator) {
- int retries = 0;
- while (bundleContext == null && retries++ < 10) {
- activator.wait(1000);
- }
- }
- }
- }
-
- return bundleContext;
-
- }
-
- public void start(BundleContext context) throws Exception {
-
- bundleContext = context;
- synchronized (this) {
- this.notify();
- }
- }
-
- public void stop(BundleContext context) throws Exception {
- bundleContext = null;
- }
-
-
-
- @Override
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- @Override
- protected void setBundleContext(BundleContext bundleContext) {
- super.setBundleContext(bundleContext);
- FelixRuntime.bundleContext = bundleContext;
- }
-
-
- @Override
- public void shutdown() throws Exception {
-
- if (bundleContext == null)
- return;
- bundleContext = null;
- instance = null;
-
- // We could potentially use Felix.stopAndWait, but use timed wait for now because
- // stopAndWait hangs with Felix 1.0.0
- if (felix instanceof Bundle) {
- Bundle felixBundle = (Bundle)felix;
- felixBundle.stop();
- int retries = 50;
- synchronized (felix) {
- while (retries-- > 0 && felixBundle.getState() != Bundle.UNINSTALLED) {
- felix.wait(100);
- }
- }
- }
- else if (felix != null) {
- Method shutdownMethod = felixClass.getMethod("shutdown");
- try {
- shutdownMethod.invoke(felix);
- } catch (Exception e) {
- // Ignore errors
- }
- felix = null;
- }
- super.shutdown();
- }
-
- @Override
- public boolean supportsBundleFragments() {
- return false;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java
deleted file mode 100644
index 19041daf50..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/KnopflerfishRuntime.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.osgi.runtime;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Hashtable;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * Implementation of an OSGi Runtime using Knopflerfish.
- *
- * @version $Rev$ $Date$
- */
-public class KnopflerfishRuntime extends OSGiRuntime {
-
- private static BundleContext bundleContext;
-
- private static KnopflerfishRuntime instance;
-
-
- private static Class<?> frameworkClass;
-
- private static Object framework;
-
- public static OSGiRuntime getInstance() throws Exception {
- if (instance == null) {
- frameworkClass = KnopflerfishRuntime.class.getClassLoader().loadClass("org.knopflerfish.framework.Framework");
- KnopflerfishRuntime runtime = new KnopflerfishRuntime();
- instance = runtime;
- }
- return instance;
- }
-
-
-
- // FIXME: Knopflerfish does not expose the methods used for configuration as public methods
- // It may be worth using the private methods in org.knopflerfish.framework.Main for
- // configuring using reflection if security policies allow it.
- // For now, a simple configuration routine reads sca.xargs from the directory in
- // the classpath which contains framework.jar. The entries in init.xargs starting with
- // -install are assumed to be single-line entries with full bundle location.
- //
- @Override
- protected BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
-
- if (bundleContext != null)
- return bundleContext;
-
-
-
- System.setProperty("org.knopflerfish.framework.bundlestorage", "memory");
-
- Constructor frameworkConstructor = frameworkClass.getConstructor(Object.class);
- framework = frameworkConstructor.newInstance(new KnopflerfishRuntime());
- Method launchMethod = frameworkClass.getMethod("launch", long.class);
- launchMethod.invoke(framework, 0);
- Method getContextMethod = frameworkClass.getMethod("getSystemBundleContext");
- bundleContext = (BundleContext)getContextMethod.invoke(framework);
-
- System.setProperty("com.gatespace.bundle.cm.store", "knopflerfish.store");
- File xargsFile = null;
- String classpath = System.getProperty("java.class.path");
- String[] classpathEntries = classpath.split(System.getProperty("path.separator"));
- for (int i = 0; i < classpathEntries.length; i++) {
- if (classpathEntries[i].endsWith("framework.jar")) {
- String path = classpathEntries[i].substring(0, classpathEntries[i].length() - "framework.jar".length());
- path = path + "sca.xargs";
- xargsFile = new File(path);
- if (!xargsFile.exists())
- xargsFile = null;
- break;
- }
- }
- if (xargsFile != null) {
- BufferedReader reader = new BufferedReader(new FileReader(xargsFile));
- String line;
- Hashtable<String, Bundle> bundles = new Hashtable<String, Bundle>();
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("-install")) {
- try {
-
- String bundleLocation = line.substring("-install".length()).trim();
- Bundle bundle = bundleContext.installBundle(bundleLocation);
- bundles.put(bundleLocation, bundle);
-
- } catch (BundleException e) {
- e.printStackTrace();
- }
-
- }
- if (line.startsWith("-start")) {
-
- try {
- String bundleLocation = line.substring("-start".length()).trim();
- Bundle bundle = bundles.get(bundleLocation);
- bundle.start();
- } catch (BundleException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
-
- return bundleContext;
-
- }
-
- @Override
- public BundleContext getBundleContext() {
- return bundleContext;
- }
-
- @Override
- protected void setBundleContext(BundleContext bundleContext) {
- super.setBundleContext(bundleContext);
- KnopflerfishRuntime.bundleContext = bundleContext;
- }
-
- @Override
- public void shutdown() throws Exception {
-
- if (bundleContext == null)
- return;
- bundleContext = null;
- instance = null;
- if (framework != null) {
- Method shutdownMethod = frameworkClass.getMethod("shutdown");
- try {
- shutdownMethod.invoke(framework);
- } catch (Exception e) {
- // Ignore errors
- }
- framework = null;
- }
- super.shutdown();
-
- }
-
- @Override
- public boolean supportsBundleFragments() {
- return true;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java
deleted file mode 100644
index b87f70deef..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiBundleActivator.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.osgi.runtime;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashSet;
-
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.extensibility.osgi.OSGiServiceDiscoverer;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-
-/**
- * OSGi bundle activator, which is run when Tuscany is run inside an OSGi runtime.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiBundleActivator implements BundleActivator, BundleListener {
-
- private static final String TUSCANY_SCA_BUNDLE_PREFIX = "org.apache.tuscany.sca";
- private static final String TUSCANY_3RD_PARTY_BUNDLE_PREFIX = "org.apache.tuscany.sca.3rdparty";
- private OSGiRuntime runtime;
- /*
- private ConcurrentHashMap<Bundle, ClassLoader> serviceDiscoveryClassLoaders =
- new ConcurrentHashMap<Bundle, ClassLoader>();
- */
- private BundleClassLoader threadContextClassLoader;
- private ClassLoader origTCCL;
- private Bundle thisBundle;
-
- public void start(BundleContext bundleContext) throws Exception {
-
- initializeTuscanyClassLoaders(bundleContext);
-
- runtime = OSGiRuntime.findRuntime();
- runtime.setBundleContext(bundleContext);
- runtime.setContextClassLoader(threadContextClassLoader);
- runtime.initialize();
-
- }
-
- public void stop(BundleContext bundleContext) throws Exception {
-
- // runtime.shutdown();
-
- if (Thread.currentThread().getContextClassLoader() == threadContextClassLoader)
- Thread.currentThread().setContextClassLoader(origTCCL);
- }
-
- /**
- * Create a bundle ClassLoader which has visibility of all Tuscany related
- * bundles. Use this ClassLoader as TCCL, and the Tuscany service discovery
- * ClassLoader.
- *
- * @param bundleContext
- */
- private void initializeTuscanyClassLoaders(BundleContext bundleContext) {
-
- OSGiServiceDiscoverer discoverer = new OSGiServiceDiscoverer(bundleContext);
- ServiceDiscovery.getInstance().setServiceDiscoverer(discoverer);
- thisBundle = bundleContext.getBundle();
-
- origTCCL = Thread.currentThread().getContextClassLoader();
-
- threadContextClassLoader = new BundleClassLoader(thisBundle, origTCCL);
-
- Thread.currentThread().setContextClassLoader(threadContextClassLoader);
-
- ClassLoader cl = new BundleClassLoader(thisBundle, null);
- // ServiceDiscovery.getInstance().registerClassLoader(cl);
- // serviceDiscoveryClassLoaders.put(thisBundle, cl);
-
- Bundle[] bundles = bundleContext.getBundles();
- for (Bundle bundle : bundles) {
- updateBundleClassLoader(bundle);
- }
- bundleContext.addBundleListener(this);
-
- }
-
- /**
- * Add an installed bundle to the list of bundles in the service discovery classpath
- * if the installed bundle is a Tuscany bundle using the same Core-SPI bundle.
- * Since the bundle containing this activator is in Tuscany Runtime, this bundle
- * will provide access to Runtime and its dependencies (SPI, SCA-API). Third party
- * bundles don't need to be in the service discovery classpath, since they will be automatically
- * imported by bundles which require them. That leaves Tuscany extension bundles,
- * which are added to the service discovery classpath here.
- *
- * 3rd party bundle should be explicitly added to TCCL since classes from these
- * bundles use TCCL to load other classes from the bundle.
- *
- * Load one class from the bundle to check if the new bundle matches this runtime bundle.
- *
- * @param bundle
- */
- private void updateBundleClassLoader(Bundle bundle) {
-
- if (bundle.getSymbolicName().startsWith(TUSCANY_SCA_BUNDLE_PREFIX)) {
-
- // This may be the third party bundle.
- if (bundle.getSymbolicName().startsWith(TUSCANY_3RD_PARTY_BUNDLE_PREFIX)) {
-
- threadContextClassLoader.addBundle(bundle);
- } else {
-
- String thisBundleVersion = (String)thisBundle.getHeaders().get("Bundle-Version");
- String bundleVersion = (String)bundle.getHeaders().get("Bundle-Version");
-
- if (thisBundleVersion == null || bundleVersion == null || thisBundleVersion.equals(bundleVersion)) {
-
- if (!threadContextClassLoader.bundles.contains(bundle)) {
- ClassLoader cl = new BundleClassLoader(bundle, null);
- // ServiceDiscovery.getInstance().registerClassLoader(cl);
- // serviceDiscoveryClassLoaders.put(bundle, cl);
- threadContextClassLoader.addBundle(bundle);
- }
- }
- }
- } else {
- threadContextClassLoader.addBundle(bundle);
- }
- }
-
- /**
- * Handle bundle install/uninstall events
- */
- public void bundleChanged(BundleEvent event) {
-
- Bundle bundle = event.getBundle();
- if (event.getType() == BundleEvent.UNINSTALLED) {
-// ClassLoader cl = serviceDiscoveryClassLoaders.get(bundle);
-// if (cl != null) {
-// ServiceDiscovery.getInstance().unregisterClassLoader(cl);
-// }
- threadContextClassLoader.removeBundle(bundle);
- } else if (event.getType() == BundleEvent.INSTALLED) {
- updateBundleClassLoader(bundle);
- }
- }
-
- /**
- * Bundle ClassLoader that searches a bundle classpath consisting of
- * a list of bundles. The parent ClassLoader is searched only if a class
- * cannot be loaded from the bundle classpath. Tuscany bundles are
- * dynamically added and removed from the bundle classpath when the bundles
- * are installed and uninstalled.
- *
- * No ordering of bundles is maintained at the moment.
- *
- */
- private static class BundleClassLoader extends ClassLoader {
-
- private HashSet<Bundle> bundles;
-
- BundleClassLoader(Bundle bundle, ClassLoader parent) {
- super(parent);
- this.bundles = new HashSet<Bundle>();
- bundles.add(bundle);
- }
-
- private synchronized void addBundle(Bundle bundle) {
- bundles.add(bundle);
- }
-
- private synchronized void removeBundle(Bundle bundle) {
- if (bundles.contains(bundle))
- bundles.remove(bundle);
- }
-
- @Override
- protected Class<?> findClass(String className) throws ClassNotFoundException {
- Class<?> clazz = null;
- synchronized (this) {
- for (Bundle bundle : bundles) {
- try {
- clazz = bundle.loadClass(className);
- break;
- } catch (ClassNotFoundException e) {
- } catch (NoClassDefFoundError e) {
- }
-
- }
- }
- if (clazz != null) {
- return clazz;
- }
- return super.findClass(className);
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public Enumeration<URL> getResources(String resName) throws IOException {
- HashSet<URL> urlSet = new HashSet<URL>();
- Enumeration<URL> urls = null;
- synchronized (this) {
- for (Bundle bundle : bundles) {
- urls = bundle.getResources(resName);
- if (urls != null) {
- while (urls.hasMoreElements()) {
- urlSet.add(urls.nextElement());
- }
- }
- }
- }
- if (urlSet.size() > 0)
- return Collections.enumeration(urlSet);
- return super.getResources(resName);
- }
-
- @Override
- public URL getResource(String resName) {
- URL url = null;
- synchronized (this) {
- for (Bundle bundle : bundles) {
- url = bundle.getResource(resName);
- if (url != null)
- return url;
- }
- }
- return super.getResource(resName);
- }
-
- @Override
- public String toString() {
- return "Tuscany BundleClassLoader " + bundles.iterator().next();
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java
deleted file mode 100644
index 79b1c0a5f4..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntime.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.osgi.runtime;
-
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * Base OSGiRuntime implementation.
- *
- * @version $Rev$ $Date$
- */
-public abstract class OSGiRuntime {
- private static final Logger logger = Logger.getLogger(OSGiRuntime.class.getName());
-
- public abstract BundleContext getBundleContext();
-
- public abstract boolean supportsBundleFragments();
-
- protected abstract BundleContext startRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception;
-
- private static OSGiRuntime instance;
-
- private BundleContext bundleContext;
-
- private PackageAdmin packageAdmin;
-
- private boolean tuscanyRunningInOSGiContainer;
-
- private ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
-
- /**
- * System property org.apache.tuscany.implementation.osgi.runtime.OSGiRuntime can be set to the
- * name of the OSGiRuntime class (eg. EquinoxRuntime). If set, start this runtime and return the
- * system bundlecontext. If not set, start Equinox/Felix/Knopflerfish (in that order) from the
- * classpath.
- *
- * @throws BundleException
- */
- public static synchronized OSGiRuntime findRuntime() throws Exception {
-
- if (instance != null) {
-
- return instance;
- }
- String runtimeClassName = System.getProperty(OSGiRuntime.class.getName());
-
-
- if (runtimeClassName != null) {
- try {
- Class<?> runtimeClass = OSGiRuntime.class.getClassLoader().loadClass(runtimeClassName);
- Method method = runtimeClass.getMethod("getInstance");
- instance = (OSGiRuntime) method.invoke(null);
- return instance;
-
- } catch (Exception e) {
- throw new BundleException("Could not start OSGi runtime " + runtimeClassName, e);
- }
- }
-
- try {
-
- instance = EquinoxRuntime.getInstance();
- return instance;
-
- } catch (ClassNotFoundException e) {
- // Ignore
- } catch (Throwable e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
-
- try {
-
- instance = FelixRuntime.getInstance();
- return instance;
-
- } catch (ClassNotFoundException e) {
- // Ignore
- } catch (Throwable e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
-
- try {
-
- instance = KnopflerfishRuntime.getInstance();
- return instance;
-
- } catch (ClassNotFoundException e) {
- // Ignore
- } catch (Throwable e) {
- logger.log(Level.SEVERE, e.getMessage(), e);
- }
-
- throw new BundleException("Could not start OSGi runtime from the classpath");
- }
-
-
- public static synchronized OSGiRuntime getRuntime() throws Exception {
- return getRuntime(false);
- }
-
- public static synchronized OSGiRuntime getRuntime(boolean tuscanyRunningInOSGiContainer) throws Exception {
-
- instance = findRuntime();
-
- if (instance != null) {
-
- if (instance.bundleContext == null) {
- instance.tuscanyRunningInOSGiContainer = tuscanyRunningInOSGiContainer;
- instance.startRuntime(tuscanyRunningInOSGiContainer);
- instance.initialize();
- }
- return instance;
- }
- return instance;
- }
-
-
- public void shutdown() throws Exception {
-
- bundleContext = null;
- packageAdmin = null;
- }
-
- protected void setBundleContext(BundleContext bundleContext) {
- instance.tuscanyRunningInOSGiContainer = true;
- this.bundleContext = bundleContext;
- }
-
-
-
- public ClassLoader getContextClassLoader() {
- return contextClassLoader;
- }
-
- protected void setContextClassLoader(ClassLoader contextClassLoader) {
- this.contextClassLoader = contextClassLoader;
- }
-
- protected void initialize() {
-
- bundleContext = getBundleContext();
-
- if (bundleContext != null) {
-
- org.osgi.framework.ServiceReference packageAdminReference =
- bundleContext.getServiceReference("org.osgi.service.packageadmin.PackageAdmin");
- if (packageAdminReference != null) {
-
- packageAdmin = (PackageAdmin)bundleContext.getService(packageAdminReference);
- }
- }
-
- }
-
- public Bundle findBundle(String bundleSymbolicName, String bundleVersion) {
-
- if (bundleContext != null) {
- Bundle[] installedBundles = bundleContext.getBundles();
- for (Bundle bundle : installedBundles) {
- if (bundleSymbolicName.equals(bundle.getSymbolicName()) && (bundleVersion == null || bundleVersion
- .equals(bundle.getHeaders().get("Bundle-Version"))))
- return bundle;
- }
-
- }
- return null;
- }
-
- public static synchronized Bundle findInstalledBundle(String bundleLocation) {
- if (instance != null) {
- if (bundleLocation.startsWith("bundle:")||bundleLocation.startsWith("bundleresource:")) {
- try {
- return findInstalledBundle(new URL(bundleLocation));
- } catch (MalformedURLException e) {
- // ignore
- }
- } else {
- return instance.findBundle(bundleLocation);
- }
- }
- return null;
- }
-
- public static synchronized Bundle findInstalledBundle(URL bundleURL) {
- if (instance != null) {
- if (instance.bundleContext != null) {
- Bundle[] installedBundles = instance.bundleContext.getBundles();
- for (Bundle bundle : installedBundles) {
- try {
- if (bundle.getEntry("/").getHost().equals(bundleURL.getHost()))
- return bundle;
- } catch (Exception e) {
- // Ignore exception
- }
- }
- }
- return null;
- }
- return null;
- }
-
- public Bundle findBundle(String bundleLocation) {
-
- if (bundleContext != null) {
- Bundle[] installedBundles = bundleContext.getBundles();
- for (Bundle bundle : installedBundles) {
- if (bundle.getLocation().equals(bundleLocation))
- return bundle;
- }
-
- }
- return null;
- }
-
- public Bundle installBundle(String bundleLocation, InputStream inputStream) {
-
- try {
- if (bundleContext != null) {
- Bundle bundle = findBundle(bundleLocation);
- if (bundle != null)
- return bundle;
- if (inputStream == null)
- bundle = bundleContext.installBundle(bundleLocation);
- else
- bundle = bundleContext.installBundle(bundleLocation, inputStream);
-
- if (bundle != null && packageAdmin != null)
- packageAdmin.refreshPackages(null);
-
- return bundle;
- }
- } catch (BundleException e) {
- }
- return null;
- }
-
- /**
- * Stops the OSGi instance.
- *
- * @throws Exception Failed to shutdown the OSGi instance.
- */
- public static synchronized void stop() throws Exception {
- if (instance != null && !instance.tuscanyRunningInOSGiContainer) {
- instance.shutdown();
- instance = null;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java
deleted file mode 100644
index 1dbe75f431..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeModuleActivator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.osgi.runtime;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-
-/**
- * @version $Rev$ $Date$
- */
-public class OSGiRuntimeModuleActivator implements ModuleActivator {
-
- /**
- * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
- */
- public void start(ExtensionPointRegistry registry) {
- }
-
- /**
- * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
- */
- public void stop(ExtensionPointRegistry registry) {
- try {
- OSGiRuntime.stop();
- } catch (Throwable e) {
- // Ignore the exception
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index bd3fd72280..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.osgi.runtime.OSGiRuntimeModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java b/branches/sca-java-1.5.1/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java
deleted file mode 100644
index 7ce3f6c18f..0000000000
--- a/branches/sca-java-1.5.1/modules/osgi-runtime/src/test/java/org/apache/tuscany/sca/osgi/runtime/OSGiRuntimeTestCase.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.osgi.runtime;
-
-import junit.framework.TestCase;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * Test OSGi runtime.
- *
- * @version $Rev$ $Date$
- */
-public class OSGiRuntimeTestCase extends TestCase {
- private OSGiRuntime runtime;
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- try {
- this.runtime = OSGiRuntime.getRuntime();
- } catch ( Throwable e ) {
- System.out.println( "DOB: OSGiRuntimeTestCase.setUp error=" + e );
- e.printStackTrace();
- }
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- */
- @Override
- protected void tearDown() throws Exception {
- OSGiRuntime.stop();
- }
-
- public void testRuntime() throws Exception {
-
- BundleContext bc1 = runtime.getBundleContext();
-
- assertNotNull(bc1);
-
- BundleContext bc2 = runtime.getBundleContext();
-
- assertNotNull(bc2);
-
- assertTrue(bc1 == bc2);
-
- OSGiRuntime.stop();
- runtime = OSGiRuntime.getRuntime();
-
- BundleContext bc3 = runtime.getBundleContext();
-
- assertNotNull(bc3);
-
- assertTrue(bc1 != bc3);
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/LICENSE b/branches/sca-java-1.5.1/modules/policy-logging/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/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-java-1.5.1/modules/policy-logging/NOTICE b/branches/sca-java-1.5.1/modules/policy-logging/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/pom.xml b/branches/sca-java-1.5.1/modules/policy-logging/pom.xml
deleted file mode 100644
index 09f85f2907..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/pom.xml
+++ /dev/null
@@ -1,77 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-logging</artifactId>
- <name>Apache Tuscany SCA Logging Policy Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.logging</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.logging*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.java
deleted file mode 100644
index 4220caab80..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/LoggingPolicyDefinitionsProvider.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.policy.logging;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class LoggingPolicyDefinitionsProvider implements SCADefinitionsProvider {
- private String definitionsFile = "org/apache/tuscany/sca/policy/logging/definitions.xml";
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public LoggingPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- // Allow privileged access to load resource. Requires RuntimePermssion in security policy.
- URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(definitionsFile);
- }
- });
-
- Object scaDefn = null;
- try {
- URI uri = new URI(definitionsFile);
- return (SCADefinitions)urlArtifactProcessor.read(null,
- uri,
- definitionsFileUrl);
- } catch ( Exception e ) {
- throw new SCADefinitionsProviderException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
deleted file mode 100644
index c53c37ccf6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingImplementationPolicyProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-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.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JDKLoggingImplementationPolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private Implementation implementation;
-
- public JDKLoggingImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- super();
- this.component = component;
- this.implementation = implementation;
- }
-
- private String getContext() {
- return "component.implementation: " + component.getURI() + "(" + implementation.getClass().getName() + ")";
- }
-
- private PolicySet findPolicySet(Operation operation) {
- for (PolicySet ps : component.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (JDKLoggingPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
-
- if ( component instanceof OperationsConfigurator ) {
- for ( ConfiguredOperation confOp : ((OperationsConfigurator)component).getConfiguredOperations() ) {
- if ( confOp.getName().equals(operation.getName())) {
- for (PolicySet ps : confOp.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (JDKLoggingPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- }
- }
-
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet(operation);
- return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
deleted file mode 100644
index 731b2d8d62..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicy.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import java.util.logging.Level;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class JDKLoggingPolicy implements Policy {
- private static final QName JDK_LOGGING_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jdkLogger");
-
- private String loggerName;
- private String resourceBundleName;
- private Level logLevel;
- private boolean useParentHandlers = false;
-
- public String getLoggerName() {
- return loggerName;
- }
-
- public void setLoggerName(String loggerName) {
- this.loggerName = loggerName;
- }
-
- public Level getLogLevel() {
- return logLevel;
- }
-
- public void setLogLevel(Level logLevel) {
- this.logLevel = logLevel;
- }
-
- public String getResourceBundleName() {
- return resourceBundleName;
- }
-
- public void setResourceBundleName(String resourceBundleName) {
- this.resourceBundleName = resourceBundleName;
- }
-
- public boolean isUseParentHandlers() {
- return useParentHandlers;
- }
-
- public void setUseParentHandlers(boolean useParentHandlers) {
- this.useParentHandlers = useParentHandlers;
- }
-
- public QName getSchemaName() {
- return JDK_LOGGING_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
deleted file mode 100644
index 58a6d21ee7..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyInterceptor.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class JDKLoggingPolicyInterceptor implements Interceptor {
- public static final String loggingPolicy = "JDKLoggingPolicy";
- public static final QName policySetQName = new QName(Constants.SCA10_TUSCANY_NS, loggingPolicy);
- private Logger logger = null;
-
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
-
- public JDKLoggingPolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- JDKLoggingPolicy policy = (JDKLoggingPolicy)policySet.getPolicies().get(0);
- logger = Logger.getLogger(policy.getLoggerName());
- logger.setLevel(policy.getLogLevel());
- logger.setUseParentHandlers(policy.isUseParentHandlers());
-
- boolean found = false;
- for (Handler handler : logger.getHandlers()) {
- if (handler instanceof ConsoleHandler) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- ConsoleHandler consoleHandler = new ConsoleHandler();
- consoleHandler.setLevel(Level.ALL);
- logger.addHandler(consoleHandler);
- }
- }
- }
-
- public Message invoke(Message msg) {
- if (logger == null) {
- return getNext().invoke(msg);
- }
- Object msgBody = msg.getBody();
- if (msgBody instanceof Object[]) {
- logger.logp(Level.INFO, context, "", "Invoking operation - " + operation.getName());
-
- StringBuffer sb = new StringBuffer();
- if (msgBody == null) {
- sb.append("");
- } else {
- Object[] args = (Object[])msgBody;
- for (int i = 0; i < args.length; i++) {
- sb.append(args[i]);
- if (i != args.length - 1) {
- sb.append(", ");
- }
- }
- }
-
- Object[] logParams = new Object[] {operation.getName(), sb.toString()};
- logger.logp(Level.FINER, context, "", "Invoking operation {0} with arguments {1}", logParams);
- }
-
- Message responseMsg = null;
- try {
- responseMsg = getNext().invoke(msg);
- return responseMsg;
- } catch (RuntimeException e) {
- logger.logp(Level.SEVERE, context, "", "Exception thrown from operation - " + operation.getName(), e);
- throw e;
- } finally {
- if (responseMsg != null) {
- Object[] logParams = new Object[] {operation.getName(), responseMsg.getBody()};
- logger.logp(Level.INFO, context, "", "Returned from operation - " + operation.getName());
- logger.logp(Level.FINER, context, "", "Returning from operation {0} with return value {1}", logParams);
- }
- }
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
deleted file mode 100644
index 83526e0f03..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProcessor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.logging.Level;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JDKLoggingPolicyProcessor implements StAXArtifactProcessor<JDKLoggingPolicy> {
- private static final QName JDK_LOGGING_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "jdkLogger");
- private static final String LOG_LEVEL = "logLevel";
- private static final String RESOURCE_BUNDLE = "resourceBundle";
- private static final String USE_PARENT_HANDLERS = "useParentHandlers";
- private static final String TUSACNY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
-
- public QName getArtifactType() {
- return JDK_LOGGING_POLICY_QNAME;
- }
-
- public JDKLoggingPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public JDKLoggingPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JDKLoggingPolicy policy = new JDKLoggingPolicy();
- int event = reader.getEventType();
- QName name = null;
-
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(JDK_LOGGING_POLICY_QNAME) ) {
- String loggerName = reader.getAttributeValue(null, Constants.NAME);
- policy.setLoggerName(loggerName);
- } else if ( LOG_LEVEL.equals(name.getLocalPart()) ) {
- policy.setLogLevel(Level.parse(reader.getElementText()));
- } else if ( RESOURCE_BUNDLE.equals(name.getLocalPart()) ) {
- policy.setResourceBundleName(reader.getElementText());
- } else if ( USE_PARENT_HANDLERS.equals(name.getLocalPart()) ) {
- policy.setUseParentHandlers(Boolean.getBoolean(reader.getElementText()));
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( JDK_LOGGING_POLICY_QNAME.equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(JDKLoggingPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- JDK_LOGGING_POLICY_QNAME.getLocalPart(),
- JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if (policy.getLoggerName() != null) {
- writer.writeAttribute(Constants.NAME, policy.getLoggerName());
- }
- if ( policy.getLogLevel() != null ) {
- writer.writeStartElement(prefix,
- LOG_LEVEL,
- JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
- writer.writeCharacters(policy.getLogLevel().getLocalizedName());
- writer.writeEndElement();
- }
-
- if ( policy.getResourceBundleName() != null ) {
- writer.writeStartElement(prefix,
- RESOURCE_BUNDLE,
- JDK_LOGGING_POLICY_QNAME.getNamespaceURI());
- writer.writeCharacters(policy.getResourceBundleName());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- public Class<JDKLoggingPolicy> getModelType() {
- return JDKLoggingPolicy.class;
- }
-
- public void resolve(JDKLoggingPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
deleted file mode 100644
index 9bbae8956f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JDKLoggingPolicyProviderFactory implements PolicyProviderFactory<JDKLoggingPolicy> {
- private ExtensionPointRegistry registry;
-
- public JDKLoggingPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return new JDKLoggingImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new JDKLoggingReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new JDKLoggingServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
deleted file mode 100644
index feddc8c056..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingReferencePolicyProvider.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JDKLoggingReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public JDKLoggingReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JDKLoggingPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
deleted file mode 100644
index 472f76c680..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/java/org/apache/tuscany/sca/policy/logging/jdk/JDKLoggingServicePolicyProvider.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.logging.jdk;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JDKLoggingServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public JDKLoggingServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JDKLoggingPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new JDKLoggingPolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index f56f96e4b9..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jdkLogger,model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index e14c657d80..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicyProviderFactory;model=org.apache.tuscany.sca.policy.logging.jdk.JDKLoggingPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index ec40cb7dc5..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.policy.logging.LoggingPolicyDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml b/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
deleted file mode 100644
index 956a8983a2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/main/resources/org/apache/tuscany/sca/policy/logging/definitions.xml
+++ /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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="logging" constrains="sca:implementation.java sca:implementation.spring">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java b/branches/sca-java-1.5.1/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.java
deleted file mode 100644
index d5b1b9eedc..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/test/java/org/apache/tuscany/sca/policy/logging/jdk/PolicyReadTestCase.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.policy.logging.jdk;
-
-
-import java.io.InputStream;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.net.URL;
-import java.util.logging.Level;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-/**
- * Test the reading of ws config params policy.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyReadTestCase extends TestCase {
-
- @Override
- public void setUp() throws Exception {
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testPolicyReading() throws Exception {
- JDKLoggingPolicyProcessor processor = new JDKLoggingPolicyProcessor(null, null);
-
- URL url = getClass().getResource("mock_policies.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- InputStream urlStream = url.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
-
-
- JDKLoggingPolicy policy = processor.read(reader);
- assertEquals(policy.getLoggerName(), "test.logger");
- assertEquals(policy.getLogLevel(), Level.INFO );
- assertEquals(policy.getResourceBundleName(), "Trace_Messages.properties");
- }
-
- public void testPolicyWriting() throws Exception {
- JDKLoggingPolicyProcessor processor = new JDKLoggingPolicyProcessor(null, null);
-
- JDKLoggingPolicy policy = new JDKLoggingPolicy();
- policy.setLoggerName("test.logger");
- policy.setLogLevel(Level.INFO);
- policy.setResourceBundleName("Trace_Messages.properties");
-
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- StringWriter sw = new StringWriter();
- XMLStreamWriter writer = outputFactory.createXMLStreamWriter(sw);
- processor.write(policy, writer);
- writer.close();
-
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- StringReader sr = new StringReader(sw.toString());
- XMLStreamReader reader = inputFactory.createXMLStreamReader(sr);
-
- policy = processor.read(reader);
- assertEquals(policy.getLoggerName(), "test.logger");
- assertEquals(policy.getLogLevel(), Level.INFO );
- assertEquals(policy.getResourceBundleName(), "Trace_Messages.properties");
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml b/branches/sca-java-1.5.1/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
deleted file mode 100644
index fabb554236..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-logging/src/test/resources/org/apache/tuscany/sca/policy/logging/jdk/mock_policies.xml
+++ /dev/null
@@ -1,23 +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.
--->
-<tuscany:jdkLogger xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" name="test.logger">
- <logLevel>INFO</logLevel>
- <resourceBundle>Trace_Messages.properties</resourceBundle>
-</tuscany:jdkLogger> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-reliability/LICENSE b/branches/sca-java-1.5.1/modules/policy-reliability/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/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-java-1.5.1/modules/policy-reliability/NOTICE b/branches/sca-java-1.5.1/modules/policy-reliability/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-reliability/pom.xml b/branches/sca-java-1.5.1/modules/policy-reliability/pom.xml
deleted file mode 100644
index 95b1091491..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-reliability</artifactId>
- <name>Apache Tuscany SCA Reliability Policy Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.reliability</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.reliability*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/java/org/apache/tuscany/sca/policy/reliability/ReliabilityPolicyDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/policy-reliability/src/main/java/org/apache/tuscany/sca/policy/reliability/ReliabilityPolicyDefinitionsProvider.java
deleted file mode 100644
index 60e28f5231..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/java/org/apache/tuscany/sca/policy/reliability/ReliabilityPolicyDefinitionsProvider.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.policy.reliability;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class ReliabilityPolicyDefinitionsProvider implements SCADefinitionsProvider {
- private String definitionsFile = "org/apache/tuscany/sca/policy/reliability/definitions.xml";
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public ReliabilityPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- SCADefinitions scaDefns = null;
- SCADefinitions tuscanyDefns = null;
- try {
- // Allow privileged access to load resource. Requires RuntimePermssion in security policy.
- URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(definitionsFile);
- }
- });
-
- URI uri = new URI(definitionsFile);
-
- scaDefns = (SCADefinitions)urlArtifactProcessor.read(null,
- uri,
- definitionsFileUrl);
-
- return scaDefns;
-
- } catch ( Exception e ) {
- throw new SCADefinitionsProviderException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index 7f616cb3d4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.policy.reliability.ReliabilityPolicyDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/org/apache/tuscany/sca/policy/reliability/definitions.xml b/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/org/apache/tuscany/sca/policy/reliability/definitions.xml
deleted file mode 100644
index df87906ab8..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-reliability/src/main/resources/org/apache/tuscany/sca/policy/reliability/definitions.xml
+++ /dev/null
@@ -1,62 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
-
- <!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="atLeastOnce"
- constrains="sca:binding">
- <description>
- This intent is used to indicate that a message sent
- by a client is always delivered to the component.
- </description>
- </intent>
-
- <intent name="atMostOnce"
- constrains="sca:binding">
- <description>
- This intent is used to indicate that a message that was
- successfully sent by a client is not delivered more than
- once to the component.
- </description>
- </intent>
-
- <intent name="ordered"
- constrains="sca:binding">
- <description>
- This intent is used to indicate that all the messages
- are delivered to the component in the order they were
- sent by the client.
- </description>
- </intent>
-
- <intent name="exactlyOnce"
- constrains="sca:binding"
- requires="atLeastOnce atMostOnce">
- <description>
- This profile intent is used to indicate that a message
- sent by a client is always delivered to the component.
- It also indicates that duplicate messages are not
- delivered to the component.
- </description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security-geronimo/pom.xml b/branches/sca-java-1.5.1/modules/policy-security-geronimo/pom.xml
deleted file mode 100644
index eb3be9d9f7..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-geronimo/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-security-geronimo</artifactId>
- <name>Apache Tuscany SCA Geronimo Policy Security</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.modules</groupId>
- <artifactId>geronimo-security</artifactId>
- <version>2.0.1</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.security.geronimo</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.security.geronimo*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/java/org/apache/tuscany/sca/policy/security/geronimo/GeronimoLDAPSecurityHandler.java b/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/java/org/apache/tuscany/sca/policy/security/geronimo/GeronimoLDAPSecurityHandler.java
deleted file mode 100644
index 38cad3c0cd..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/java/org/apache/tuscany/sca/policy/security/geronimo/GeronimoLDAPSecurityHandler.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.geronimo;
-
-import java.security.AccessControlContext;
-import java.util.List;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-import javax.security.jacc.WebRoleRefPermission;
-
-import org.apache.geronimo.security.ContextManager;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationCallbackHandler;
-import org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicy;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler;
-import org.apache.tuscany.sca.policy.security.http.util.HttpSecurityUtil;
-import org.osoa.sca.ServiceRuntimeException;
-
-public class GeronimoLDAPSecurityHandler implements LDAPSecurityHandler {
-
- public GeronimoLDAPSecurityHandler() {
-
- }
-
- /**
- * The Http Service calls this method prior to servicing the specified request.
- * This method controls whether the request is processed in the normal manner
- * or an error is returned.
- *
- * If the request requires authentication and the Authorization header
- * in the request is missing or not acceptable, then this method should
- * set the WWW-Authenticate header in the response object, set the status
- * in the response object to Unauthorized(401) and return false.
- * See also RFC 2617: HTTP Authentication: Basic and Digest Access Authentication
- * (available at http://www.ietf.org/rfc/rfc2617.txt).
- *
- * If the request requires a secure connection and the getScheme method
- * in the request does not return 'https' or some other acceptable secure protocol,
- * then this method should set the status in the response object to Forbidden(403)
- * and return false.
- *
- * When this method returns false, the Http Service will send the response back to
- * the client, thereby completing the request. When this method returns true, the
- * Http Service will proceed with servicing the request.
- *
- * If the specified request has been authenticated, this method must set the
- * AUTHENTICATION_TYPE request attribute to the type of authentication used,
- * and the REMOTE_USER request attribute to the remote user
- * (request attributes are set using the setAttribute method on the request).
- * If this method does not perform any authentication, it must not set these attributes.
- *
- * @param msg
- * @return
- */
- public void handleSecurity(Message msg,
- List<LDAPRealmAuthenticationPolicy> authenticationPolicies,
- List<AuthorizationPolicy> authorizationPolicies) throws javax.security.auth.login.LoginException {
- Subject subject = null;
- Subject authenticatedSubject = null;
-
-
- // Perform user authentication
- LDAPRealmAuthenticationPolicy authenticationPolicy = authenticationPolicies.get(0);
- if( authenticationPolicy != null) {
- subject = HttpSecurityUtil.getSubject(msg);
- CallbackHandler callbackHandler = new LDAPRealmAuthenticationCallbackHandler(subject);
-
- /* Uses Geronimo to login */
- LoginContext geronimoLoginContext = ContextManager.login(authenticationPolicy.getRealmConfigurationName(), callbackHandler);
-
- authenticatedSubject = geronimoLoginContext.getSubject();
- ContextManager.setCallers(authenticatedSubject, authenticatedSubject);
- if (authenticatedSubject != null) {
- //TODO: add authenticated subject to the msg header ?
- }
- }
-
- AuthorizationPolicy authorizationPolicy = authorizationPolicies.get(0);
- if(authorizationPolicy != null) {
- if(authorizationPolicy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) {
- /* Geronimo Specific code */
- AccessControlContext acc = ContextManager.getCurrentContext();
-
- boolean isAllowed = false;
- for (String requiredRole : authorizationPolicy.getRoleNames()) {
- isAllowed = isUserInRole(acc, requiredRole);
- if(isAllowed) {
- break;
- }
- }
-
- if(! isAllowed ) {
- throw new javax.security.auth.login.LoginException("Insufficient access rights !");
- }
- }
-
- }
-
- }
-
-
-
-
- public boolean isUserInRole(AccessControlContext acc, String role) {
- /* Geronimo Specific code */
- try {
- acc.checkPermission(new WebRoleRefPermission("", role));
- } catch (Exception e) {
- return false;
- }
-
- return true;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler b/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler
deleted file mode 100644
index f435bf408e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-geronimo/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler
+++ /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.policy.security.geronimo.GeronimoLDAPSecurityHandler \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/LICENSE b/branches/sca-java-1.5.1/modules/policy-security-http/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/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-java-1.5.1/modules/policy-security-http/NOTICE b/branches/sca-java-1.5.1/modules/policy-security-http/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/pom.xml b/branches/sca-java-1.5.1/modules/policy-security-http/pom.xml
deleted file mode 100644
index 17046203f2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/pom.xml
+++ /dev/null
@@ -1,106 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-security-http</artifactId>
- <name>Apache Tuscany SCA Security Policy Model for HTTP Binding</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.3</version>
- <exclusions>
- <exclusion>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version><!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.security</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>
- org.apache.tuscany.sca.policy.identity,
- org.apache.tuscany.sca.policy.authorization,
- org.apache.tuscany.sca.policy.security*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicy.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicy.java
deleted file mode 100644
index 4ab7e582ac..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicy.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.policy.authentication;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.host.http.UserContext;
-
-/**
- * This policy configures authentication/authorization
- * in embedded http servers
- *
- * @version $Rev$ $Date$
- */
-public class AuthenticationConfigurationPolicy {
- public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "basicAuthenticationConfiguration");
-
- private List<UserContext> users = new ArrayList<UserContext>();
-
- public List<UserContext> getUsers() {
- return this.users;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicyProcessor.java
deleted file mode 100644
index a112e25364..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/authentication/AuthenticationConfigurationPolicyProcessor.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.authentication;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.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.host.http.UserContext;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * <sca:policySet name="widgetBindingAuthenticationPolicySet"
- * provides="sca:authentication"
- * appliesTo="tuscany:binding.http">
- * <tuscany:authenticationConfiguration>
- * <tuscany:user username="user1" password="tuscany" roles="admin"/>
- * <tuscany:user username="user2" password="tuscany" roles="admin, user"/>
- * <tuscany:user username="user3" password="tuscany" roles="user"/>
- * </tuscany:authenticationConfiguration>
- * </sca:policySet>
- *
- *
- * @version $Rev$ $Date$
- */
-
-public class AuthenticationConfigurationPolicyProcessor implements StAXArtifactProcessor<AuthenticationConfigurationPolicy> {
- private static final QName AUTHENTICATION_CONFIGURATION_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "authenticationConfiguration");
- private static final QName USER_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "user");
-
- private Monitor monitor;
-
- public AuthenticationConfigurationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return AuthenticationConfigurationPolicy.NAME;
- }
-
- public Class<AuthenticationConfigurationPolicy> getModelType() {
- return AuthenticationConfigurationPolicy.class;
- }
-
- public AuthenticationConfigurationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- AuthenticationConfigurationPolicy authenticationConfiguration = new AuthenticationConfigurationPolicy();
-
- int event = reader.getEventType();
- QName start = reader.getName();
- QName name = null;
- while (true) {
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
- if(USER_QNAME.equals(name)) {
- UserContext user = new UserContext();
- //<tuscany:user username="user1" password="tuscany" roles="admin, user"/>
- String username = reader.getAttributeValue(null, "username");
- if(username == null) {
- error("RequiredAttributeUsernameMissing", reader);
- } else {
- user.setUsername(username);
- }
-
- String password = reader.getAttributeValue(null, "password");
- if(password == null) {
- error("RequiredAttributePasswordMissing", reader);
- } else {
- user.setPassword(password);
- }
-
- String roles = reader.getAttributeValue(null, "roles");
- if(roles == null) {
- error("RequiredAttributeRolesMissing", reader);
- } else {
- for (StringTokenizer tokens = new StringTokenizer(roles, ","); tokens.hasMoreTokens();) {
- user.getRoles().add(tokens.nextToken());
- }
- }
-
- authenticationConfiguration.getUsers().add(user);
- }
- break;
- case END_ELEMENT:
- if (start.equals(reader.getName())) {
- if (reader.hasNext()) {
- reader.next();
- }
- return authenticationConfiguration;
- }
-
- }
- if (reader.hasNext()) {
- event = reader.next();
- } else {
- return authenticationConfiguration;
- }
- }
- }
-
- public void write(AuthenticationConfigurationPolicy model, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- // TODO Auto-generated method stub
- }
-
- public void resolve(AuthenticationConfigurationPolicy model, ModelResolver resolver) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicy.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicy.java
deleted file mode 100644
index 5301e13269..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicy.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.policy.confidentiality;
-
-import java.util.Properties;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-
-/**
- * Models the SCA Implementation Security Policy Assertion for Confidentiality.
- *
- * This would map to enabling SSL communication and would require
- * the following configuration items :
- *
- * - javax.net.ssl.keyStore
- * - javax.net.ssl.keyStorePassword
- * - javax.net.ssl.keyStoreType
- *
- * - javax.net.ssl.trustStoreType
- * - javax.net.ssl.trustStore
- * - javax.net.ssl.trustStorePassword
- *
- * @version $Rev$ $Date$
- */
-public class ConfidentialityPolicy implements Policy {
- public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "confidentiality");
-
- private String trustStoreType;
- private String trustStore;
- private String trustStorePassword;
-
- private String keyStoreType;
- private String keyStore;
- private String keyStorePassword;
-
-
- public String getTrustStoreType() {
- return trustStoreType;
- }
-
- public void setTrustStoreType(String trustStoreType) {
- this.trustStoreType = trustStoreType;
- }
-
- public String getTrustStore() {
- return trustStore;
- }
-
- public void setTrustStore(String trustStore) {
- this.trustStore = trustStore;
- }
-
- public String getTrustStorePassword() {
- return trustStorePassword;
- }
-
- public void setTrustStorePassword(String trustStorePassword) {
- this.trustStorePassword = trustStorePassword;
- }
-
- public String getKeyStoreType() {
- return keyStoreType;
- }
-
- public void setKeyStoreType(String keyStoreType) {
- this.keyStoreType = keyStoreType;
- }
-
- public String getKeyStore() {
- return keyStore;
- }
-
- public void setKeyStore(String keyStore) {
- this.keyStore = keyStore;
- }
-
- public String getKeyStorePassword() {
- return keyStorePassword;
- }
-
- public void setKeyStorePassword(String keyStorePassword) {
- this.keyStorePassword = keyStorePassword;
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
-
- }
-
- public Properties toProperties() {
- Properties properties = new Properties();
-
- properties.put("javax.net.ssl.trustStoreType", trustStoreType);
- properties.put("javax.net.ssl.trustStore", trustStore);
- properties.put("javax.net.ssl.trustStorePassword", trustStorePassword);
-
- properties.put("javax.net.ssl.keyStoreType", keyStoreType);
- properties.put("javax.net.ssl.keyStore", keyStore);
- properties.put("javax.net.ssl.keyStorePassword", keyStorePassword);
-
- return properties;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicyProcessor.java
deleted file mode 100644
index 86866c2c8e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/confidentiality/ConfidentialityPolicyProcessor.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.confidentiality;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-public class ConfidentialityPolicyProcessor implements StAXArtifactProcessor<ConfidentialityPolicy> {
- private static final QName KEY_STORE_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "keyStore");
- private static final QName TRUST_STORE_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "trustStore");
-
- private Monitor monitor;
-
- public ConfidentialityPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return ConfidentialityPolicy.NAME;
- }
-
- public Class<ConfidentialityPolicy> getModelType() {
- return ConfidentialityPolicy.class;
- }
-
- public ConfidentialityPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- ConfidentialityPolicy policy = new ConfidentialityPolicy();
- int event = reader.getEventType();
- QName start = reader.getName();
- QName name = null;
- while (true) {
- switch (event) {
- case START_ELEMENT:
- name = reader.getName();
- if(KEY_STORE_QNAME.equals(name)) {
- //<tuscany:keyStore type="JKS" file="conf/tomcat.keystore" password="apache"/>
- String type = reader.getAttributeValue(null, "type");
- if(type == null) {
- error("RequiredAttributeKeyStoreTypeMissing", reader);
- } else {
- policy.setKeyStoreType(type);
- }
-
- String file = reader.getAttributeValue(null, "file");
- if(file == null) {
- error("RequiredAttributeKeyStoreFileMissing", reader);
- } else {
- policy.setKeyStore(file);
- }
-
- String password = reader.getAttributeValue(null, "password");
- if(file == null) {
- error("RequiredAttributeKeyStorePasswordMissing", reader);
- } else {
- policy.setKeyStorePassword(password);
- }
-
- } else if(TRUST_STORE_QNAME.equals(name)) {
- //<tuscany:trustStore type="" file="" password=""/>
- String type = reader.getAttributeValue(null, "type");
- if(type == null) {
- error("RequiredAttributeTrustStoreTypeMissing", reader);
- } else {
- policy.setTrustStoreType(type);
- }
-
- String file = reader.getAttributeValue(null, "file");
- if(file == null) {
- error("RequiredAttributeTrusStoreFileMissing", reader);
- } else {
- policy.setTrustStore(file);
- }
-
- String password = reader.getAttributeValue(null, "password");
- if(file == null) {
- error("RequiredAttributeTrustStorePasswordMissing", reader);
- } else {
- policy.setTrustStorePassword(password);
- }
-
- }
- break;
- case END_ELEMENT:
- if (start.equals(reader.getName())) {
- if (reader.hasNext()) {
- reader.next();
- }
- return policy;
- }
-
- }
- if (reader.hasNext()) {
- event = reader.next();
- } else {
- return policy;
- }
- } }
-
- public void write(ConfidentialityPolicy model, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- // TODO Auto-generated method stub
-
- }
-
- public void resolve(ConfidentialityPolicy model, ModelResolver resolver) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.java
deleted file mode 100644
index ee094f022d..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationCallbackHandler.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.policy.security.http;
-
-import java.io.IOException;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.Callback;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.callback.NameCallback;
-import javax.security.auth.callback.PasswordCallback;
-import javax.security.auth.callback.UnsupportedCallbackException;
-
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal;
-
-
-/**
- * @version $Rev$ $Date$
- */
-public class LDAPRealmAuthenticationCallbackHandler implements CallbackHandler {
- private final Subject subject;
-
- public LDAPRealmAuthenticationCallbackHandler(Subject subject) {
- this.subject = subject;
- }
- public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
-
- BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject, BasicAuthenticationPrincipal.class);
-
- if (principal != null){
- /*
- System.out.println(">>> LDAPRealmAuthenticationCallbackHandler" +
- " Username: " + principal.getName() +
- " Password: " + principal.getPassword());
- */
- for (int i = 0; i < callbacks.length; i++) {
- if (callbacks[i] instanceof NameCallback) {
- NameCallback nc = (NameCallback)callbacks[i];
- nc.setName(principal.getName());
- } else if (callbacks[i] instanceof PasswordCallback) {
- PasswordCallback pc = (PasswordCallback)callbacks[i];
- pc.setPassword(principal.getPassword().toCharArray());
- } else {
- throw new UnsupportedCallbackException
- (callbacks[i], "Unsupported Callback!");
- }
- }
- }
-
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java
deleted file mode 100644
index 8a2f38115a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationImplementationPolicyProvider.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http;
-
-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.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-public class LDAPRealmAuthenticationImplementationPolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private Implementation implementation;
- private LDAPSecurityHandler securityHandler;
-
- public LDAPRealmAuthenticationImplementationPolicyProvider(RuntimeComponent component, Implementation implementation, LDAPSecurityHandler securityHandler) {
- super();
- this.component = component;
- this.implementation = implementation;
- this.securityHandler = securityHandler;
- }
-
-
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-
- public Interceptor createInterceptor(Operation operation) {
- List<LDAPRealmAuthenticationPolicy> policies = findAuthenticationPolicies(operation);
- if (policies == null || policies.isEmpty()) {
- return null;
- } else {
- return new LDAPRealmAuthenticationInterceptor(securityHandler, findAuthenticationPolicies(operation), findAuthorizationPolicies(operation));
- }
- }
-
- /**
- * Internal utility methods
- */
-
- /**
- * Find applicable authentication policySets
- * It first check if any explicitly policySet was identified
- * Otherwise it look into the list of applicablePolicySets
- * @param op
- * @return
- */
- private List<LDAPRealmAuthenticationPolicy> findAuthenticationPolicies(Operation op) {
- List<LDAPRealmAuthenticationPolicy> polices = new ArrayList<LDAPRealmAuthenticationPolicy>();
-
-
- // check explicity added policies first
- ConfiguredOperation configuredOperation = findOperation(op);
- if (configuredOperation!= null && configuredOperation.getPolicySets().size() > 0) {
- for ( PolicySet ps : configuredOperation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof LDAPRealmAuthenticationPolicy) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
-
- // otherwise find applicable policySets
- if ( polices.size() == 0) {
-
- if (implementation instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = component.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (LDAPRealmAuthenticationPolicy.class.isInstance(p)) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
-
- return polices;
- }
-
- /**
- * Find applicable authorization policySets
- * It first check if any explicitly policySet was identified
- * Otherwise it look into the list of applicablePolicySets
- * @param op
- * @return
- */
- private List<AuthorizationPolicy> findAuthorizationPolicies(Operation op) {
- List<AuthorizationPolicy> polices = new ArrayList<AuthorizationPolicy>();
-
-
- // check explicity added policies first
- ConfiguredOperation configuredOperation = findOperation(op);
- if (configuredOperation!= null && configuredOperation.getPolicySets().size() > 0) {
- for ( PolicySet ps : configuredOperation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof AuthorizationPolicy) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
-
- // otherwise find applicable policySets
- if ( polices.size() == 0) {
-
- if (implementation instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (AuthorizationPolicy.class.isInstance(p)) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = component.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (AuthorizationPolicy.class.isInstance(p)) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
-
- }
-
- return polices;
- }
-
- /**
- * Find a given configured operation
- * @param operation
- * @return
- */
- private ConfiguredOperation findOperation(Operation operation) {
- ConfiguredOperation configuredOperation = null;
-
- for (ConfiguredOperation cOperation : ((OperationsConfigurator)component).getConfiguredOperations()) {
- if(cOperation.getName().equals(operation.getName())) {
- configuredOperation = cOperation;
- break;
- }
- }
-
- return configuredOperation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationInterceptor.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationInterceptor.java
deleted file mode 100644
index 3f71891a01..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationInterceptor.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.policy.security.http;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class LDAPRealmAuthenticationInterceptor implements Interceptor {
- private LDAPSecurityHandler securityHandler;
- private List<LDAPRealmAuthenticationPolicy> authenticationPolicies;
- private List<AuthorizationPolicy> authorizationPolicies;
- private Invoker next;
-
- public LDAPRealmAuthenticationInterceptor(LDAPSecurityHandler securityHandler,
- List<LDAPRealmAuthenticationPolicy> authenticationPolicies,
- List<AuthorizationPolicy> authorizationPolicies) {
- super();
- this.securityHandler = securityHandler;
- this.authenticationPolicies = authenticationPolicies;
- this.authorizationPolicies = authorizationPolicies;
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- public Message invoke(Message msg) {
- try {
- securityHandler.handleSecurity(msg, authenticationPolicies, authorizationPolicies);
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return getNext().invoke(msg);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicy.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicy.java
deleted file mode 100644
index ddb6790964..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicy.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.security.http;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * This policy provides realm based authentication/authorization
- *
- * @version $Rev$ $Date$
- */
-public class LDAPRealmAuthenticationPolicy implements Policy{
- static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS,"ldapRealmAuthentication");
-
- private String realmName;
- private String realmConfigurationName;
-
- /**
- *
- * @return
- */
- public String getRealmName() {
- return realmName;
- }
-
- /**
- *
- * @param realmName
- */
- public void setRealmName(String realmName) {
- this.realmName = realmName;
- }
-
- /**
- *
- * @return
- */
- public String getRealmConfigurationName() {
- return realmConfigurationName;
- }
-
- /**
- *
- * @param realmConfigurationName
- */
- public void setRealmConfigurationName(String realmConfigurationName) {
- this.realmConfigurationName = realmConfigurationName;
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProcessor.java
deleted file mode 100644
index 625bb08b7f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProcessor.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-
-public class LDAPRealmAuthenticationPolicyProcessor implements StAXArtifactProcessor<LDAPRealmAuthenticationPolicy> {
- static final QName REALM_QNAME = new QName(Constants.SCA10_TUSCANY_NS,"realm");
- public static final QName REALM_CONFIGURATION_QNAME = new QName(Constants.SCA10_TUSCANY_NS,"realmConfigurationName");
-
- private Monitor monitor;
-
-
- public LDAPRealmAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-http-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public Class<LDAPRealmAuthenticationPolicy> getModelType() {
- return LDAPRealmAuthenticationPolicy.class;
- }
-
-
- public QName getArtifactType() {
- return LDAPRealmAuthenticationPolicy.NAME;
- }
-
- public LDAPRealmAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- LDAPRealmAuthenticationPolicy policy = new LDAPRealmAuthenticationPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if (name.equals(REALM_QNAME)) {
- String realmName = reader.getElementText();
- if (realmName != null) {
- policy.setRealmName(realmName.trim());
- }
- }
- if (name.equals(REALM_CONFIGURATION_QNAME)) {
- String realmConfigurationName = reader.getElementText();
- if (realmConfigurationName != null) {
- policy.setRealmConfigurationName(realmConfigurationName.trim());
- }
- }
-
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( LDAPRealmAuthenticationPolicy.NAME.equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(LDAPRealmAuthenticationPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- LDAPRealmAuthenticationPolicy.NAME.getLocalPart(),
- LDAPRealmAuthenticationPolicy.NAME.getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
-
- writer.writeEndElement();
- }
-
-
- public void resolve(LDAPRealmAuthenticationPolicy policy, ModelResolver resolver) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index 45fe650b22..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationPolicyProviderFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandlerExtensionPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class LDAPRealmAuthenticationPolicyProviderFactory implements PolicyProviderFactory<LDAPRealmAuthenticationPolicy> {
- private LDAPSecurityHandler securityHandler;
-
- public LDAPRealmAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
-
- LDAPSecurityHandlerExtensionPoint securityHandlerExtensionPoint = registry.getExtensionPoint(LDAPSecurityHandlerExtensionPoint.class);
- if (securityHandlerExtensionPoint.getLDAPSecurityHandlers().size() > 0) {
- securityHandler = securityHandlerExtensionPoint.getLDAPSecurityHandlers().get(0);
- }
- }
-
- public Class<LDAPRealmAuthenticationPolicy> getModelType() {
- return LDAPRealmAuthenticationPolicy.class;
- }
-
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return new LDAPRealmAuthenticationImplementationPolicyProvider(component, implementation, securityHandler);
- }
-
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new LDAPRealmAuthenticationServicePolicyProvider(component, service, binding, securityHandler);
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java
deleted file mode 100644
index 5a8b7c7d85..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/LDAPRealmAuthenticationServicePolicyProvider.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandler;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class LDAPRealmAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
- LDAPSecurityHandler securityHandler;
-
- private List<Operation> operations = new ArrayList<Operation>();
-
- public LDAPRealmAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding, LDAPSecurityHandler securityHandler) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- this.securityHandler = securityHandler;
-
- this.operations.addAll(service.getInterfaceContract().getInterface().getOperations());
- }
-
- public String getPhase() {
- return Phase.SERVICE_BINDING_POLICY;
- }
-
- public Interceptor createInterceptor(Operation operation) {
- List<LDAPRealmAuthenticationPolicy> authenticationPolicies = null;
- List<AuthorizationPolicy> authorizationPolicies = null;
-
- if (operation != null) {
- authenticationPolicies = findAuthenticationPolicies(operation);
- authorizationPolicies = findAuthorizationPolicies(operation);
- }
-
- if (authenticationPolicies == null || authenticationPolicies.isEmpty()) {
- return null;
- } else {
- return new LDAPRealmAuthenticationInterceptor(securityHandler, authenticationPolicies, authorizationPolicies);
- }
- }
-
-
- /**
- * Private utility methods
- */
-
- /**
- * Find applicable authorization policySets
- * It first check if any explicitly policySet was identified
- * Otherwise it look into the list of applicablePolicySets
- * @param op
- * @return
- */
- private List<LDAPRealmAuthenticationPolicy> findAuthenticationPolicies(Operation op) {
- List<LDAPRealmAuthenticationPolicy> polices = new ArrayList<LDAPRealmAuthenticationPolicy>();
-
- // check explicity added policies first
- ConfiguredOperation configuredOperation = findOperation(op);
- if (configuredOperation!= null && configuredOperation.getPolicySets().size() > 0) {
- for ( PolicySet ps : configuredOperation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof LDAPRealmAuthenticationPolicy) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
-
-
- // otherwise find applicable policySets
- if ( polices.size() == 0) {
- // FIXME: How do we get a list of effective policySets for a given operation?
- for(Operation operation : operations) {
- if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) {
- for (PolicySet ps : operation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof LDAPRealmAuthenticationPolicy) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
- }
-
- if (service instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop!= null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getApplicablePolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof LDAPRealmAuthenticationPolicy) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = service.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof LDAPRealmAuthenticationPolicy) {
- polices.add((LDAPRealmAuthenticationPolicy)p);
- }
- }
- }
- }
-
- return polices;
- }
-
- /**
- * Find applicable authorization policySets
- * It first check if any explicitly policySet was identified
- * Otherwise it look into the list of applicablePolicySets
- * @param op
- * @return
- */
- private List<AuthorizationPolicy> findAuthorizationPolicies(Operation op) {
- List<AuthorizationPolicy> polices = new ArrayList<AuthorizationPolicy>();
-
- // check explicity added policies first
- ConfiguredOperation configuredOperation = findOperation(op);
- if (configuredOperation!= null && configuredOperation.getPolicySets().size() > 0) {
- for ( PolicySet ps : configuredOperation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof AuthorizationPolicy) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
-
- // otherwise find applicable policySets
- if ( polices.size() == 0) {
- // FIXME: How do we get a list of effective policySets for a given operation?
- for(Operation operation : operations) {
- if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) {
- for (PolicySet ps : operation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof AuthorizationPolicy) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
- }
-
- if (service instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getApplicablePolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof AuthorizationPolicy) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = service.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (p instanceof AuthorizationPolicy) {
- polices.add((AuthorizationPolicy)p);
- }
- }
- }
- }
-
- return polices;
- }
-
- /**
- * Find a given configured operation
- * @param operation
- * @return
- */
- private ConfiguredOperation findOperation(Operation operation) {
- ConfiguredOperation configuredOperation = null;
-
- for (ConfiguredOperation cOperation : ((OperationsConfigurator)component).getConfiguredOperations()) {
- if(cOperation.getName().equals(operation.getName())) {
- configuredOperation = cOperation;
- break;
- }
- }
-
- return configuredOperation;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java
deleted file mode 100644
index b454289673..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/DefaultLDAPSecurityExtensionPoint.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http.extensibility;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-
-
-/**
- * Default Extension point for LDAP Security Handlers
- *
- * @version $Rev$ $Date$
- */
-
-public class DefaultLDAPSecurityExtensionPoint implements LDAPSecurityHandlerExtensionPoint {
- private List<LDAPSecurityHandler> securityHandlers = new ArrayList<LDAPSecurityHandler>();
-
- private ExtensionPointRegistry extensionPoints;
- private Monitor monitor = null;
-
- private boolean loaded = false;
-
- public DefaultLDAPSecurityExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- }
-
-
- public void addLDAPSecurityHandler(LDAPSecurityHandler securityHandler) {
- securityHandlers.add(securityHandler);
- }
-
- public void removeLDAPSecurityHandler(LDAPSecurityHandler securityHandler) {
- securityHandlers.remove(securityHandler);
- }
-
- public List<LDAPSecurityHandler> getLDAPSecurityHandlers() {
- loadHandlers();
- return securityHandlers;
- }
-
-
- /**
- * Private Utility methods
- */
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = monitor.createProblem(this.getClass().getName(), null, Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- @SuppressWarnings("unchecked")
- private synchronized void loadHandlers() {
- if (loaded) {
- return;
- }
-
- // Get the proxy factories declarations
- Set<ServiceDeclaration> handlerDeclarations = null;
- try {
- handlerDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(LDAPSecurityHandler.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", handlerDeclarations, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration : handlerDeclarations) {
- // Create a factory, and register it
- LDAPSecurityHandler securityHandler = null;
- try {
- Class<LDAPSecurityHandler> securityHandlerClass = (Class<LDAPSecurityHandler>) processorDeclaration.loadClass();
-
- securityHandler = securityHandlerClass.newInstance();
-
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", securityHandler, ie);
- throw ie;
- }
-
- addLDAPSecurityHandler(securityHandler);
- }
-
- loaded = true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandler.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandler.java
deleted file mode 100644
index bf64f8fa30..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandler.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.policy.security.http.extensibility;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicy;
-
-public interface LDAPSecurityHandler {
-
- /**
- * The Http Service calls this method prior to servicing the specified request.
- * This method controls whether the request is processed in the normal manner
- * or an error is returned.
- *
- * If the request requires authentication and the Authorization header
- * in the request is missing or not acceptable, then this method should
- * set the WWW-Authenticate header in the response object, set the status
- * in the response object to Unauthorized(401) and return false.
- * See also RFC 2617: HTTP Authentication: Basic and Digest Access Authentication
- * (available at http://www.ietf.org/rfc/rfc2617.txt).
- *
- * If the request requires a secure connection and the getScheme method
- * in the request does not return 'https' or some other acceptable secure protocol,
- * then this method should set the status in the response object to Forbidden(403)
- * and return false.
- *
- * When this method returns false, the Http Service will send the response back to
- * the client, thereby completing the request. When this method returns true, the
- * Http Service will proceed with servicing the request.
- *
- * If the specified request has been authenticated, this method must set the
- * AUTHENTICATION_TYPE request attribute to the type of authentication used,
- * and the REMOTE_USER request attribute to the remote user
- * (request attributes are set using the setAttribute method on the request).
- * If this method does not perform any authentication, it must not set these attributes.
- *
- * @param msg
- * @return
- */
- void handleSecurity(Message msg,
- List<LDAPRealmAuthenticationPolicy> authenticationPolicies,
- List<AuthorizationPolicy> authorizationPolicies) throws javax.security.auth.login.LoginException;
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandlerExtensionPoint.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandlerExtensionPoint.java
deleted file mode 100644
index 73765c0a10..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/extensibility/LDAPSecurityHandlerExtensionPoint.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http.extensibility;
-
-import java.util.List;
-
-/**
- * Extension point for LDAP Security Handlers
- *
- * @version $Rev$ $Date$
- */
-public interface LDAPSecurityHandlerExtensionPoint {
-
- /**
- * Add a LDAP security handler
- * @param securityHandler
- */
- void addLDAPSecurityHandler (LDAPSecurityHandler securityHandler);
-
- /**
- * Remove a LDAP security handler
- * @param securityHandler
- */
- void removeLDAPSecurityHandler (LDAPSecurityHandler securityHandler);
-
- /**
- * Return a list of security handlers
- * @return
- */
- List<LDAPSecurityHandler> getLDAPSecurityHandlers();
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/util/HttpSecurityUtil.java b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/util/HttpSecurityUtil.java
deleted file mode 100644
index 88b2ee9fce..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/java/org/apache/tuscany/sca/policy/security/http/util/HttpSecurityUtil.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.http.util;
-
-import java.util.StringTokenizer;
-
-import javax.security.auth.Subject;
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPrincipal;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class HttpSecurityUtil {
-
- /**
- * Check if Authorization header is available
- * @param request
- * @param response
- * @return
- */
- public static boolean hasAuthorizationHeader(HttpServletRequest request) {
- boolean result = false;
- if(request.getHeader("Authorization") != null) {
- result = true;
- }
-
- return result;
- }
-
- /**
- *
- * @param request
- * @param response
- * @return
- */
- public static String getAuthorizationHeader(HttpServletRequest request) {
- return request.getHeader("Authorization");
- }
-
- public static Subject getSubject(Message msg){
-
- Subject subject = null;
- HttpServletRequest request = null;
-
- for (Object header : msg.getHeaders()){
- if (header instanceof Subject){
- subject = (Subject)header;
- break;
- } else if( header instanceof HttpServletRequest) {
- request = (HttpServletRequest) header;
- }
- }
-
- //if there is no subject, but request is available
- //try to build a subject from authorization header
- if (subject == null & request != null) {
- if ( hasAuthorizationHeader(request)) {
- subject = getSubject(getAuthorizationHeader(request));
- }
-
- }
- if (subject == null){
- subject = new Subject();
- msg.getHeaders().add(subject);
- }
-
- return subject;
-
- }
-
- public static Subject getSubject(String httpAuthorizationHeader){
-
-
- // get the security context
- Subject subject = new Subject();
- String user = null;
- String password = null;
-
- if (httpAuthorizationHeader != null) {
- StringTokenizer tokens = new StringTokenizer(httpAuthorizationHeader);
- if (tokens.hasMoreTokens()) {
- String basic = tokens.nextToken();
- if (basic.equalsIgnoreCase("Basic")) {
- String credentials = tokens.nextToken();
- String userAndPassword = new String(Base64.decodeBase64(credentials.getBytes()));
- int colon = userAndPassword.indexOf(":");
- if (colon != -1) {
- user = userAndPassword.substring(0, colon);
- password = userAndPassword.substring(colon + 1);
- }
- }
- }
- }
-
- if(user != null && password != null) {
- BasicAuthenticationPrincipal principal = new BasicAuthenticationPrincipal(user, password);
- subject.getPrincipals().add(principal);
- }
-
- return subject;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index fd57d8a44f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.authentication.AuthenticationConfigurationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#authenticationConfiguration,model=org.apache.tuscany.sca.policy.authentication.AuthenticationConfigurationPolicy
-org.apache.tuscany.sca.policy.confidentiality.ConfidentialityPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#confidentiality,model=org.apache.tuscany.sca.policy.confidentiality.ConfidentialityPolicy
-org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#ldapRealmAuthentication,model=org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandlerExtensionPoint b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandlerExtensionPoint
deleted file mode 100644
index 79ee88142a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.security.http.extensibility.LDAPSecurityHandlerExtensionPoint
+++ /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.policy.security.http.extensibility.DefaultLDAPSecurityExtensionPoint \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index 5a92f0dfd7..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.policy.security.http.LDAPRealmAuthenticationPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/policy-security-http-validation-messages.properties b/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/policy-security-http-validation-messages.properties
deleted file mode 100644
index ebb47f2b60..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-http/src/main/resources/policy-security-http-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-RequiredAttributeRolesMissing = Required attribute 'roles' is missing.
-ClassNotFoundException = Class Not Found Exception: {0} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/LICENSE b/branches/sca-java-1.5.1/modules/policy-security-jsr250/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/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-java-1.5.1/modules/policy-security-jsr250/NOTICE b/branches/sca-java-1.5.1/modules/policy-security-jsr250/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/pom.xml b/branches/sca-java-1.5.1/modules/policy-security-jsr250/pom.xml
deleted file mode 100644
index b8bd14f2f8..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/pom.xml
+++ /dev/null
@@ -1,83 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-security-jsr250</artifactId>
- <name>Apache Tuscany SCA Java JSR250 Implementation</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-security</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-implementation-java</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.annotation</groupId>
- <artifactId>jsr250-api</artifactId>
- <version>1.0</version>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.implementation.java</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.implementation.java*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JSR250Activator.java b/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JSR250Activator.java
deleted file mode 100644
index befe398129..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JSR250Activator.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.implementation.java.impl;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.introspect.impl.JSR250PolicyProcessor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A module activator for the Java implementation model.
- *
- * @version $Rev$ $Date$
- */
-public class JSR250Activator implements ModuleActivator {
-
- public void start(ExtensionPointRegistry registry) {
- ModelFactoryExtensionPoint modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- AssemblyFactory assemblyFactory = modelFactories.getFactory(AssemblyFactory.class);
- PolicyFactory policyFactory = modelFactories.getFactory(PolicyFactory.class);
-
- JavaImplementationFactory javaImplementationFactory = modelFactories.getFactory(JavaImplementationFactory.class);
- javaImplementationFactory.addClassVisitor(new JSR250PolicyProcessor(assemblyFactory, policyFactory));
-
- }
-
- public void stop(ExtensionPointRegistry registry) {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JSR250PolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JSR250PolicyProcessor.java
deleted file mode 100644
index f639bc679f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/JSR250PolicyProcessor.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-
-import javax.annotation.security.DenyAll;
-import javax.annotation.security.PermitAll;
-import javax.annotation.security.RolesAllowed;
-import javax.annotation.security.RunAs;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.implementation.java.IntrospectionException;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy;
-
-/**
- * Processes an {@link javax.annotation.security.*} annotation
- * Below is a list of annotations
- *
- * Type Method
- * RunAs x
- * RolesAllowed x x
- * PermitAll x x
- * DenyAll x
- *
- * @version $Rev$ $Date$
- */
-public class JSR250PolicyProcessor extends BaseJavaClassVisitor {
- private static final QName RUN_AS = new QName("http://www.osoa.org/xmlns/sca/1.0","runAs");
- private static final QName ALLOW = new QName("http://www.osoa.org/xmlns/sca/1.0","allow");
- private static final QName PERMIT_ALL = new QName("http://www.osoa.org/xmlns/sca/1.0","permitAll");
- private static final QName DENY_ALL = new QName("http://www.osoa.org/xmlns/sca/1.0","denyAll");
-
- private PolicyFactory policyFactory;
-
- public JSR250PolicyProcessor(AssemblyFactory assemblyFactory, PolicyFactory policyFactory) {
- super(assemblyFactory);
- this.policyFactory = policyFactory;
- }
-
-
- @Override
- public <T> void visitClass(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
-
- RunAs runAs = clazz.getAnnotation(javax.annotation.security.RunAs.class);
- if (runAs != null) {
-
- String roleName = runAs.value();
- if(roleName == null) {
- //FIXME handle monitor or error
- }
-
- SecurityIdentityPolicy policy = new SecurityIdentityPolicy();
- policy.setRunAsRole(roleName);
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(RUN_AS);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
- }
-
- RolesAllowed rolesAllowed = clazz.getAnnotation(javax.annotation.security.RolesAllowed.class);
- if(rolesAllowed != null) {
- if(rolesAllowed.value().length == 0) {
- //FIXME handle monitor or error
- }
-
- AuthorizationPolicy policy = new AuthorizationPolicy();
- policy.setAccessControl(AuthorizationPolicy.AcessControl.allow);
-
- for(String role : rolesAllowed.value()) {
- policy.getRoleNames().add(role);
- }
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(ALLOW);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
- }
-
- PermitAll permitAll = clazz.getAnnotation(javax.annotation.security.PermitAll.class);
- if(permitAll != null) {
- AuthorizationPolicy policy = new AuthorizationPolicy();
- policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(PERMIT_ALL);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- ((org.apache.tuscany.sca.policy.PolicySetAttachPoint)type).getPolicySets().add(policySet);
- }
-
- }
-
- @Override
- public void visitMethod(Method method, JavaImplementation type) throws IntrospectionException {
- RolesAllowed rolesAllowed = method.getAnnotation(javax.annotation.security.RolesAllowed.class);
- if(rolesAllowed != null) {
- if(rolesAllowed.value().length == 0) {
- //FIXME handle monitor or error
- }
-
- AuthorizationPolicy policy = new AuthorizationPolicy();
- policy.setAccessControl(AuthorizationPolicy.AcessControl.allow);
-
- for(String role : rolesAllowed.value()) {
- policy.getRoleNames().add(role);
- }
-
- ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(ALLOW);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- confOp.getPolicySets().add(policySet);
- }
-
- PermitAll permitAll = method.getAnnotation(javax.annotation.security.PermitAll.class);
- if(permitAll != null) {
- AuthorizationPolicy policy = new AuthorizationPolicy();
- policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
-
- ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(PERMIT_ALL);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- confOp.getPolicySets().add(policySet);
- }
-
- DenyAll denyAll = method.getAnnotation(javax.annotation.security.DenyAll.class);
- if(denyAll != null) {
- AuthorizationPolicy policy = new AuthorizationPolicy();
- policy.setAccessControl(AuthorizationPolicy.AcessControl.denyAll);
-
- ConfiguredOperation confOp = assemblyFactory.createConfiguredOperation();
- confOp.setName(method.getName());
- ((OperationsConfigurator)type).getConfiguredOperations().add(confOp);
-
- PolicySet policySet = policyFactory.createPolicySet();
- policySet.setName(DENY_ALL);
- policySet.getPolicies().add(policy);
- policySet.setUnresolved(false);
- confOp.getPolicySets().add(policySet);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 550e6d3708..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.implementation.java.impl.JSR250Activator
diff --git a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCaseFIXME.java b/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCaseFIXME.java
deleted file mode 100644
index 894117354e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security-jsr250/src/test/java/org/apache/tuscany/sca/implementation/java/introspect/impl/PolicyProcessorTestCaseFIXME.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.implementation.java.introspect.impl;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.implementation.java.DefaultJavaImplementationFactory;
-import org.apache.tuscany.sca.implementation.java.JavaImplementation;
-import org.apache.tuscany.sca.implementation.java.JavaImplementationFactory;
-import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
-import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
-import org.apache.tuscany.sca.interfacedef.java.impl.PolicyJavaInterfaceVisitor;
-import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.osoa.sca.annotations.Requires;
-import org.osoa.sca.annotations.Service;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyProcessorTestCaseFIXME extends TestCase {
- private ServiceProcessor serviceProcessor;
- private JSR250PolicyProcessor policyProcessor;
- private PolicyJavaInterfaceVisitor visitor;
- private JavaImplementation type;
-
- // This actually is a test for PolicyJavaInterfaceProcessor. It will get
- // invoked via the call to ImplementationProcessorServiceImpl.createService in
- // ServiceProcessor. Of course ServiceProcessor class has to be working.
- public void stestSingleInterfaceWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
- serviceProcessor.visitClass(Service1.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service1.class, type);
- verifyIntents(Service1.class, type);
- }
-
- public void stestMultipleInterfacesWithIntentsOnInterfaceAtInterfaceLevel() throws Exception {
- serviceProcessor.visitClass(Service2.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service2.class, type);
- verifyIntents(Service2.class, type);
- }
-
- public void stestSingleInterfaceWithIntentsOnImplAtClassLevel() throws Exception {
- serviceProcessor.visitClass(Service3.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service3.class, type);
- verifyIntents(Service3.class, type);
- }
-
- public void stestMultipleInterfacesWithIntentsOnImplAtClassLevel() throws Exception {
- serviceProcessor.visitClass(Service4.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service4.class, type);
- verifyIntents(Service4.class, type);
- }
-
- public void stestSingleInterfaceWithIntentsOnInterfaceAtMethodLevel() throws Exception {
- serviceProcessor.visitClass(Service5.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service5.class, type);
- verifyIntents(Service5.class, type);
- }
-
- public void testSingleInterfaceWithIntentsOnServiceAndInterfaceAtImplAndInertfaceAndMethodLevel() throws Exception {
- serviceProcessor.visitClass(Service6.class, type);
- visitor.visitInterface((JavaInterface)type.getServices().get(0).getInterfaceContract().getInterface());
- policyProcessor.visitClass(Service6.class, type);
- for (Method method : Service6.class.getDeclaredMethods()) {
- policyProcessor.visitMethod(method, type);
- }
- verifyIntents(Service6.class, type);
- }
-
- private void verifyIntents(Class serviceImplClass, JavaImplementation type) {
- if ( !(type instanceof PolicySetAttachPoint) ) {
- fail("No Intents on the service ");
- }
- Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
- if (serviceImplIntentAnnotation != null) {
- String[] serviceImplIntents = serviceImplIntentAnnotation.value();
- List<Intent> requiredIntents = ((PolicySetAttachPoint)type).getRequiredIntents();
- if (serviceImplIntents.length > 0) {
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on the service ");
- }
- Map<String, Intent> intentMap = new HashMap<String, Intent>();
- for (Intent intent : requiredIntents) {
- intentMap.put(intent.getName().getLocalPart(), intent);
- }
- for (String intent : serviceImplIntents) {
- assertTrue("ComponentType for Service class " + serviceImplClass.getName()
- + " did not contain Service Implementation intent "
- + intent, intentMap.containsKey(intent));
- }
- }
- }
-
- // This should match what was specified on @Service for a Service Implementation
- // If we use these to get the Service names and we get a null Service
- // name then it would seem that wrong values were put on the @Service annotation
- // or the wrong interfaces were specified on the implements list of the class
- // statement?
- Map<String, org.apache.tuscany.sca.assembly.Service> serviceMap = new HashMap<String, org.apache.tuscany.sca.assembly.Service>();
- for (org.apache.tuscany.sca.assembly.Service service: type.getServices()) {
- serviceMap.put(service.getName(), service);
- }
- for (Class interfaceClass : serviceImplClass.getInterfaces()) {
- Requires interfaceIntentAnnotation = (Requires)interfaceClass.getAnnotation(Requires.class);
- org.apache.tuscany.sca.assembly.Service service = serviceMap.get(interfaceClass.getSimpleName());
- if (service == null) {
- fail("No service defined for interface " + interfaceClass.getSimpleName()
- + " on Service Implementation "
- + serviceImplClass.getName());
- }
-
- if (interfaceIntentAnnotation != null) {
- String[] interfaceIntents = interfaceIntentAnnotation.value();
- List<Intent> requiredIntents = service.getInterfaceContract().getInterface().getRequiredIntents();
- if (interfaceIntents.length > 0) {
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on the service " + service.getName());
- }
- Map<String, Intent> intentMap = new HashMap<String, Intent>();
- for (Intent intent : requiredIntents) {
- intentMap.put(intent.getName().getLocalPart(), intent);
- }
- for (String intent : interfaceIntents) {
- assertTrue("Interface " + service.getName()
- + " did not contain Service Interface intent "
- + intent, intentMap.containsKey(intent));
- }
- }
- }
-
- for (Method method : interfaceClass.getDeclaredMethods()) {
- Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
-
- // Verify that each of the Intents on each of the Service
- // Interface Methods exist on their associated operation.
- if (methodIntentAnnotation != null) {
- String[] methodIntents = methodIntentAnnotation.value();
- if (methodIntents.length > 0) {
- List<Intent> requiredIntents = null;
- for ( ConfiguredOperation confOp : service.getConfiguredOperations() ) {
- if ( confOp.getName().equals(method.getName()) &&
- confOp.getContractName().equals(service.getName()) ) {
- requiredIntents = confOp.getRequiredIntents();
- }
- }
-
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on operation " + method.getName());
- }
- for (String intent : methodIntents) {
- boolean found = false;
- for (Intent requiredIntent: requiredIntents) {
- if (requiredIntent.getName().getLocalPart().equals(intent)) {
- found = true;
- break;
- }
- }
- assertTrue("Operation " + method.getName()
- + " did not contain Service Interface method intent "
- + intent, found);
- }
- }
- }
- }
-
- for (Method method : serviceImplClass.getDeclaredMethods()) {
- Requires methodIntentAnnotation = method.getAnnotation(Requires.class);
-
- // Verify that each of the Intents on each of the Service
- // Implementation Methods exist on their associated
- // operation.
- if (methodIntentAnnotation != null) {
- String[] methodIntents = methodIntentAnnotation.value();
- if (methodIntents.length > 0) {
- List<Intent> requiredIntents = null;
- for ( ConfiguredOperation confOp : ((OperationsConfigurator)type).getConfiguredOperations() ) {
- if ( confOp.getName().equals(method.getName()) ) {
- requiredIntents = confOp.getRequiredIntents();
- }
- }
-
- if (requiredIntents == null || requiredIntents.size() == 0) {
- fail("No Intents on operation " + method.getName());
- }
-
- for (String intent : methodIntents) {
- boolean found = false;
- for (Intent requiredIntent: requiredIntents) {
- if (requiredIntent.getName().getLocalPart().equals(intent)) {
- found = true;
- break;
- }
- }
- assertTrue("Operation " + method.getName()
- + " did not contain Implementation method intent "
- + intent, found);
- }
- }
- }
- }
- }
- }
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaInterfaceFactory());
- policyProcessor = new JSR250PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
- visitor = new PolicyJavaInterfaceVisitor(new DefaultPolicyFactory());
- JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory();
- type = javaImplementationFactory.createJavaImplementation();
- }
-
- // @Remotable
- @Requires( {"transaction.global"})
- private interface Interface1 {
- int method1();
-
- int method2();
-
- int method3();
-
- int method4();
- }
-
- @Service(Interface1.class)
- private class Service1 implements Interface1 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
- }
-
- // @Remotable
- @Requires( {"transaction.local"})
- private interface Interface2 {
- int method5();
-
- int method6();
- }
-
- @Service(interfaces = {Interface1.class, Interface2.class})
- private class Service2 implements Interface1, Interface2 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
-
- public int method5() {
- return 0;
- }
-
- public int method6() {
- return 0;
- }
- }
-
- // @Remotable
- private interface Interface3 {
- int method1();
-
- int method2();
-
- int method3();
-
- int method4();
- }
-
- @Service(Interface3.class)
- @Requires( {"transaction.global"})
- private class Service3 implements Interface3 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
- }
-
- // @Remotable
- private interface Interface4 {
- int method5();
-
- int method6();
- }
-
- @Service(interfaces = {Interface3.class, Interface4.class})
- @Requires( {"transaction.local"})
- private class Service4 implements Interface3, Interface4 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
-
- public int method3() {
- return 0;
- }
-
- public int method4() {
- return 0;
- }
-
- public int method5() {
- return 0;
- }
-
- public int method6() {
- return 0;
- }
- }
-
- private interface Interface5 {
- @Requires( {"transaction.global"})
- int method1();
-
- @Requires( {"transaction.local"})
- int method2();
- }
-
- @Service(Interface5.class)
- private class Service5 implements Interface5 {
- public int method1() {
- return 0;
- }
-
- public int method2() {
- return 0;
- }
- }
-
- @Requires( {"transaction.global.Interface6"})
- private interface Interface6 {
- @Requires( {"transaction.global.Interface6.method1"})
- int method1();
-
- @Requires( {"transaction.local.Interface6.method2"})
- int method2();
- }
-
- @Service(Interface6.class)
- @Requires( {"transaction.global.Service6"})
- private class Service6 implements Interface6 {
- @Requires( {"transaction.global.Service6.method1"})
- public int method1() {
- return 0;
- }
-
- @Requires( {"transaction.global.Service6.method1"})
- public int method2() {
- return 0;
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/LICENSE b/branches/sca-java-1.5.1/modules/policy-security/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/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-java-1.5.1/modules/policy-security/NOTICE b/branches/sca-java-1.5.1/modules/policy-security/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-security/pom.xml b/branches/sca-java-1.5.1/modules/policy-security/pom.xml
deleted file mode 100644
index 995261a6df..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/pom.xml
+++ /dev/null
@@ -1,74 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-security</artifactId>
- <name>Apache Tuscany SCA Security Policy Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.security</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>
- org.apache.tuscany.sca.policy.identity,
- org.apache.tuscany.sca.policy.authorization,
- org.apache.tuscany.sca.policy.security*
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/SecurityUtil.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/SecurityUtil.java
deleted file mode 100644
index 81bc3271c6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/SecurityUtil.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-import java.security.Principal;
-
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.invocation.Message;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SecurityUtil {
-
- public static Subject getSubject(Message msg){
-
- Subject subject = null;
-
- for (Object header : msg.getHeaders()){
- if (header instanceof Subject){
- subject = (Subject)header;
- break;
- }
- }
-
- if (subject == null){
- subject = new Subject();
- msg.getHeaders().add(subject);
- }
-
- return subject;
- }
-
- public static <T> T getPrincipal(Subject subject, Class<T> clazz){
- for (Principal msgPrincipal : subject.getPrincipals() ){
- if (clazz.isInstance(msgPrincipal)){
- return clazz.cast(msgPrincipal);
- }
- }
-
- return null;
- }
-
- public static Principal getPrincipal(Message msg){
-
- Principal principal = null;
-
- for (Object header : msg.getHeaders()){
- if (header instanceof Principal){
- principal = (Principal)header;
- break;
- }
- }
-
- return principal;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicy.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicy.java
deleted file mode 100644
index c4909d6bd8..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicy.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.policy.authentication.basic;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationPolicy implements Policy {
- public static final QName BASIC_AUTHENTICATION_POLICY_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "basicAuthentication");
- public static final String BASIC_AUTHENTICATION_USERNAME = "userName";
- public static final String BASIC_AUTHENTICATION_PASSWORD = "password";
-
- private String userName;
- private String password;
-
- public String getUserName() {
- return userName;
- }
-
- public void setUserName(String userName) {
- this.userName = userName;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public QName getSchemaName() {
- return BASIC_AUTHENTICATION_POLICY_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProcessor.java
deleted file mode 100644
index 1b89b52a31..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProcessor.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.authentication.basic;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationPolicyProcessor implements StAXArtifactProcessor<BasicAuthenticationPolicy> {
-
- public QName getArtifactType() {
- return BasicAuthenticationPolicy.BASIC_AUTHENTICATION_POLICY_QNAME;
- }
-
- public BasicAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public BasicAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- BasicAuthenticationPolicy policy = new BasicAuthenticationPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( name.equals(getArtifactType()) ) {
- // no attributes at the moment
- } else if ( BasicAuthenticationPolicy.BASIC_AUTHENTICATION_USERNAME.equals(name.getLocalPart()) ) {
- policy.setUserName(reader.getElementText());
- } else if ( BasicAuthenticationPolicy.BASIC_AUTHENTICATION_PASSWORD.equals(name.getLocalPart()) ) {
- policy.setPassword(reader.getElementText());
- }
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( getArtifactType().equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(BasicAuthenticationPolicy policy, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- if ( policy.getUserName() != null ) {
- writer.writeStartElement(prefix,
- BasicAuthenticationPolicy.BASIC_AUTHENTICATION_USERNAME,
- getArtifactType().getNamespaceURI());
- writer.writeCharacters(policy.getUserName());
- writer.writeEndElement();
- }
-
- if ( policy.getPassword() != null ) {
- writer.writeStartElement(prefix,
- BasicAuthenticationPolicy.BASIC_AUTHENTICATION_PASSWORD,
- getArtifactType().getNamespaceURI());
- writer.writeCharacters(policy.getPassword());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- public Class<BasicAuthenticationPolicy> getModelType() {
- return BasicAuthenticationPolicy.class;
- }
-
- public void resolve(BasicAuthenticationPolicy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index 348934bd6c..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.authentication.basic;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationPolicyProviderFactory implements PolicyProviderFactory<BasicAuthenticationPolicy> {
- private ExtensionPointRegistry registry;
-
- public BasicAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return null;//new BasicAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return new BasicAuthenticationReferencePolicyProvider(component, reference, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new BasicAuthenticationServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPrincipal.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPrincipal.java
deleted file mode 100644
index 3ab9cb656d..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationPrincipal.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.policy.authentication.basic;
-
-import java.security.Principal;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationPrincipal implements Principal {
-
- private String name;
- private String password;
-
- public BasicAuthenticationPrincipal(String name, String password){
- if (name == null) {
- throw new IllegalArgumentException("name cannot be null");
- }
-
- this.name = name;
- this.password = password;
- }
-
- public String getName() {
- return name;
- }
-
- public String getPassword() {
- return password;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return name;
- }
-
-
- @Override
- public boolean equals(Object principal) {
- if (principal == null)
- return false;
- if (this == principal)
- return true;
- if (getClass() != principal.getClass())
- return false;
- final BasicAuthenticationPrincipal other = (BasicAuthenticationPrincipal)principal;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name)){
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.java
deleted file mode 100644
index c38b95286e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyInterceptor.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.policy.authentication.basic;
-
-
-import javax.security.auth.Subject;
-
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationReferencePolicyInterceptor implements Interceptor {
-
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private BasicAuthenticationPolicy policy;
-
- public BasicAuthenticationReferencePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof BasicAuthenticationPolicy){
- policy = (BasicAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
-
- // get the security context
- Subject subject = SecurityUtil.getSubject(msg);
- BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
- BasicAuthenticationPrincipal.class);
-
- // if no credentials propogated from the reference then use
- // the ones from the policy
- if (principal == null &&
- policy.getUserName() != null &&
- !policy.getUserName().equals("")) {
- principal = new BasicAuthenticationPrincipal(policy.getUserName(),
- policy.getPassword());
- subject.getPrincipals().add(principal);
- }
-
- if (principal == null){
- // alternatively we could call out here to some 3rd party system to get credentials
- // or convert from some other security principal
- }
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyProvider.java
deleted file mode 100644
index 5aa36ecc89..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationReferencePolicyProvider.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.authentication.basic;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationReferencePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentReference reference;
- private Binding binding;
-
- public BasicAuthenticationReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- super();
- this.component = component;
- this.reference = reference;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.reference: " + component.getURI()
- + "#"
- + reference.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new BasicAuthenticationReferencePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
deleted file mode 100644
index e783d77c97..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyInterceptor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.authentication.basic;
-
-
-import javax.security.auth.Subject;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-
-
-/**
- * Policy handler to handle PolicySet related to Logging with the QName
- * {http://tuscany.apache.org/xmlns/sca/1.0/impl/java}LoggingPolicy
- *
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationServicePolicyInterceptor implements Interceptor {
- private Invoker next;
- private Operation operation;
- private PolicySet policySet = null;
- private String context;
- private BasicAuthenticationPolicy policy;
-
- public BasicAuthenticationServicePolicyInterceptor(String context, Operation operation, PolicySet policySet) {
- super();
- this.operation = operation;
- this.policySet = policySet;
- this.context = context;
- init();
- }
-
- private void init() {
- if (policySet != null) {
- for (Object policyObject : policySet.getPolicies()){
- if (policyObject instanceof BasicAuthenticationPolicy){
- policy = (BasicAuthenticationPolicy)policyObject;
- break;
- }
- }
- }
- }
-
- public Message invoke(Message msg) {
-
- Subject subject = SecurityUtil.getSubject(msg);
- BasicAuthenticationPrincipal principal = SecurityUtil.getPrincipal(subject,
- BasicAuthenticationPrincipal.class);
-
- if (principal != null){
-
- System.out.println("Username: " +
- principal.getName() +
- " Password: " +
- principal.getPassword());
-
- // could call out here to some 3rd party system to do whatever you
- // need to do do with username and password
-
- }
-
- return getNext().invoke(msg);
- }
-
- public Invoker getNext() {
- return next;
- }
-
- public void setNext(Invoker next) {
- this.next = next;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyProvider.java
deleted file mode 100644
index aae0386589..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/basic/BasicAuthenticationServicePolicyProvider.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.authentication.basic;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class BasicAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- public BasicAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
- }
-
- private PolicySet findPolicySet() {
- if (binding instanceof PolicySetAttachPoint) {
- List<PolicySet> policySets = ((PolicySetAttachPoint)binding).getApplicablePolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (BasicAuthenticationPolicy.class.isInstance(p)) {
- return ps;
- }
- }
- }
- }
- return null;
- }
-
- private String getContext() {
- return "component.service: " + component.getURI()
- + "#"
- + service.getName()
- + "("
- + binding.getClass().getName()
- + ")";
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#createInterceptor(org.apache.tuscany.sca.interfacedef.Operation)
- */
- public Interceptor createInterceptor(Operation operation) {
- PolicySet ps = findPolicySet();
- return ps == null ? null : new BasicAuthenticationServicePolicyInterceptor(getContext(), operation, ps);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProvider#getPhase()
- */
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/TokenPrincipal.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/TokenPrincipal.java
deleted file mode 100644
index 147b863c01..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authentication/token/TokenPrincipal.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.policy.authentication.token;
-
-import java.security.Principal;
-
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TokenPrincipal implements Principal {
-
- private String name;
-
- public TokenPrincipal(String name){
- if (name == null) {
- throw new IllegalArgumentException("name cannot be null");
- }
-
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public String toString() {
- return name;
- }
-
-
- @Override
- public boolean equals(Object principal) {
- if (principal == null)
- return false;
- if (this == principal)
- return true;
- if (getClass() != principal.getClass())
- return false;
- final TokenPrincipal other = (TokenPrincipal)principal;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name)){
- return false;
- }
-
- return true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java
deleted file mode 100644
index d58fa51256..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicy.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.authorization;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Models the SCA Implementation Security Policy Assertion for Authorization.
- *
- * @version $Rev$ $Date$
- */
-public class AuthorizationPolicy implements Policy {
- public static final QName NAME = new QName(Constants.SCA10_NS, "authorization");
-
- public static enum AcessControl {
- permitAll, denyAll, allow
- };
-
- private List<String> roleNames = new ArrayList<String>();
-
- public AuthorizationPolicy() {
- }
-
- private AcessControl accessControl;
-
- public AcessControl getAccessControl() {
- return accessControl;
- }
-
- public void setAccessControl(AcessControl accessControl) {
- this.accessControl = accessControl;
- }
-
- public List<String> getRoleNames() {
- if (accessControl == AcessControl.allow) {
- return roleNames;
- } else {
- throw new IllegalArgumentException("Role names are only available for 'allow'");
- }
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- @Override
- public String toString() {
- if (accessControl == AcessControl.allow) {
- return accessControl.name() + " " + roleNames;
- }
- return accessControl.name();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java
deleted file mode 100644
index 30fb0b32a4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/authorization/AuthorizationPolicyProcessor.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.authorization;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class AuthorizationPolicyProcessor implements StAXArtifactProcessor<AuthorizationPolicy> {
- private static final String ROLES = "roles";
- private Monitor monitor;
-
- public QName getArtifactType() {
- return AuthorizationPolicy.NAME;
- }
-
- public AuthorizationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public AuthorizationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- AuthorizationPolicy policy = new AuthorizationPolicy();
- int event = reader.getEventType();
- QName start = reader.getName();
- while (true) {
- switch (event) {
- case START_ELEMENT:
- String ac = reader.getName().getLocalPart();
- if ("allow".equals(ac)) {
- policy.setAccessControl(AuthorizationPolicy.AcessControl.allow);
- String roleNames = reader.getAttributeValue(null, ROLES);
- if (roleNames == null) {
- error("RequiredAttributeRolesMissing", reader);
- //throw new IllegalArgumentException("Required attribute 'roles' is missing.");
- } else {
- StringTokenizer st = new StringTokenizer(roleNames);
- while (st.hasMoreTokens()) {
- policy.getRoleNames().add(st.nextToken());
- }
- }
- } else if ("permitAll".equals(ac)) {
- policy.setAccessControl(AuthorizationPolicy.AcessControl.permitAll);
- } else if ("denyAll".endsWith(ac)) {
- policy.setAccessControl(AuthorizationPolicy.AcessControl.denyAll);
- }
- break;
- case END_ELEMENT:
- if (start.equals(reader.getName())) {
- if (reader.hasNext()) {
- reader.next();
- }
- return policy;
- }
-
- }
- if (reader.hasNext()) {
- event = reader.next();
- } else {
- return policy;
- }
- }
- }
-
- public void write(AuthorizationPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- writer.writeStartElement(AuthorizationPolicy.NAME.getLocalPart());
-
- writer.writeStartElement(policy.getAccessControl().name());
-
- if (policy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) {
- StringBuffer sb = new StringBuffer();
- for (String role : policy.getRoleNames()) {
- sb.append(role);
- }
-
- if (sb.length() > 0) {
- writer.writeAttribute(ROLES, sb.toString());
- }
- }
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
-
- public Class<AuthorizationPolicy> getModelType() {
- return AuthorizationPolicy.class;
- }
-
- public void resolve(AuthorizationPolicy policy, ModelResolver resolver) throws ContributionResolveException {
-
- if ((policy.getAccessControl() == AuthorizationPolicy.AcessControl.allow) &&
- (policy.getRoleNames().isEmpty())){
- // role names are required so leave policy unresolved
- return;
- }
-
- //right now nothing to resolve
- policy.setUnresolved(false);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyInterceptor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyInterceptor.java
deleted file mode 100644
index 1559e22cb9..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyInterceptor.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.policy.identity;
-
-import java.security.Principal;
-import java.util.List;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.apache.tuscany.sca.policy.SecurityUtil;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SecurityIdentityImplementationPolicyInterceptor implements Interceptor {
- private List<SecurityIdentityPolicy> securityIdentityPolicies;
- private Invoker next;
-
- public SecurityIdentityImplementationPolicyInterceptor(List<SecurityIdentityPolicy> securityIdentityPolicies) {
- super();
- this.securityIdentityPolicies = securityIdentityPolicies;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
- */
- public Invoker getNext() {
- return next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
- */
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- try {
-
- Subject subject = SecurityUtil.getSubject(msg);
-
- // May do some selection here based on runAs settings.
- // by default though there is nothing to do as the implementation
- // assumes the callers user credentials
-
-
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return getNext().invoke(msg);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.java
deleted file mode 100644
index aa52e0bc41..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityImplementationPolicyProvider.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.policy.identity;
-
-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.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SecurityIdentityImplementationPolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private Implementation implementation;
-
- public SecurityIdentityImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- super();
- this.component = component;
- this.implementation = implementation;
- }
-
- private List<SecurityIdentityPolicy> findPolicies(Operation op) {
- List<SecurityIdentityPolicy> polices = new ArrayList<SecurityIdentityPolicy>();
- // FIXME: How do we get a list of effective policySets for a given operation?
- if (implementation instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (SecurityIdentityPolicy.class.isInstance(p)) {
- polices.add((SecurityIdentityPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = component.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (SecurityIdentityPolicy.class.isInstance(p)) {
- polices.add((SecurityIdentityPolicy)p);
- }
- }
- }
- return polices;
- }
-
- public Interceptor createInterceptor(Operation operation) {
- List<SecurityIdentityPolicy> policies = findPolicies(operation);
- if (policies == null || policies.isEmpty()) {
- return null;
- } else {
- return new SecurityIdentityImplementationPolicyInterceptor(findPolicies(operation));
- }
- }
-
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicy.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicy.java
deleted file mode 100644
index 8f848ef06a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicy.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.identity;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * Models the SCA Implementation Security Policy Assertion for Security Identity.
- *
- * @version $Rev$ $Date$
- */
-public class SecurityIdentityPolicy implements Policy {
- public static final QName NAME = new QName(Constants.SCA10_NS, "securityIdentity");
-
- private boolean useCallerIdentity;
-
- private String runAsRole;
-
- public SecurityIdentityPolicy() {
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUseCallerIdentity() {
- return useCallerIdentity;
- }
-
- public void setUseCallerIdentity(boolean useCallerIdentity) {
- this.useCallerIdentity = useCallerIdentity;
- }
-
- public String getRunAsRole() {
- return runAsRole;
- }
-
- public void setRunAsRole(String runAsRole) {
- this.runAsRole = runAsRole;
- }
-
- @Override
- public String toString() {
- if (useCallerIdentity) {
- return "useCallerIdentity";
- }
- return "runAs " + runAsRole;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java
deleted file mode 100644
index b9030ac4ab..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProcessor.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.identity;
-
-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.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class SecurityIdentityPolicyProcessor implements StAXArtifactProcessor<SecurityIdentityPolicy> {
- private static final String ROLE = "role";
- private Monitor monitor;
-
- public QName getArtifactType() {
- return SecurityIdentityPolicy.NAME;
- }
-
- public SecurityIdentityPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public SecurityIdentityPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- SecurityIdentityPolicy policy = new SecurityIdentityPolicy();
- int event = reader.getEventType();
- QName start = reader.getName();
- while (true) {
- switch (event) {
- case START_ELEMENT:
- String ac = reader.getName().getLocalPart();
- if ("runAs".equals(ac)) {
- String roleName = reader.getAttributeValue(null, ROLE);
- if (roleName == null) {
- error("RequiredAttributeRolesMissing", reader);
- //throw new IllegalArgumentException("Required attribute 'roles' is missing.");
- } else {
- policy.setRunAsRole(roleName);
- }
- } else if ("useCallerIdentity".equals(ac)) {
- policy.setUseCallerIdentity(true);
- }
- break;
- case END_ELEMENT:
- if (start.equals(reader.getName())) {
- if (reader.hasNext()) {
- reader.next();
- }
- return policy;
- }
-
- }
- if (reader.hasNext()) {
- event = reader.next();
- } else {
- return policy;
- }
- }
- }
-
- public void write(SecurityIdentityPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- writer.writeStartElement(SecurityIdentityPolicy.NAME.getLocalPart());
-
- String child = policy.isUseCallerIdentity() ? "useCallerIdentity" : "runAs";
- writer.writeStartElement(child);
-
- if (!policy.isUseCallerIdentity()) {
- writer.writeAttribute(ROLE, policy.getRunAsRole());
- }
-
- writer.writeEndElement();
- writer.writeEndElement();
- }
-
- public Class<SecurityIdentityPolicy> getModelType() {
- return SecurityIdentityPolicy.class;
- }
-
- public void resolve(SecurityIdentityPolicy policy, ModelResolver resolver) throws ContributionResolveException {
-
- if (policy.getRunAsRole() != null)
- //right now nothing to resolve
- policy.setUnresolved(false);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProviderFactory.java
deleted file mode 100644
index a20f314a2a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/identity/SecurityIdentityPolicyProviderFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.identity;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class SecurityIdentityPolicyProviderFactory implements PolicyProviderFactory<SecurityIdentityPolicy> {
- private ExtensionPointRegistry registry;
-
- public SecurityIdentityPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- this.registry = registry;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return new SecurityIdentityImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class getModelType() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java
deleted file mode 100644
index c914d99365..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/SecurityPolicyDefinitionsProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security;
-
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to security
- *
- * @version $Rev$ $Date$
- */
-public class SecurityPolicyDefinitionsProvider implements SCADefinitionsProvider {
- private static final String definitionsFile = "org/apache/tuscany/sca/policy/security/definitions.xml";
- private static final String tuscanyDefinitionsFile = "org/apache/tuscany/sca/policy/security/tuscany_definitions.xml";
-
- URLArtifactProcessor urlArtifactProcessor = null;
-
- public SecurityPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
- SCADefinitions scaDefns = null;
- SCADefinitions tuscanyDefns = null;
- try {
- // Allow privileged access to load resource. Requires
- // RuntimePermssion in security policy.
- URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(definitionsFile);
- }
- });
-
- URI uri = new URI(definitionsFile);
-
- scaDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
-
- definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
- public URL run() {
- return getClass().getClassLoader().getResource(tuscanyDefinitionsFile);
- }
- });
-
- uri = new URI(definitionsFile);
- tuscanyDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
-
- SCADefinitionsUtil.aggregateSCADefinitions(tuscanyDefns, scaDefns);
- return scaDefns;
-
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
deleted file mode 100644
index 981c29df6a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationImplementationPolicyProvider.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.security.jaas;
-
-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.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-/**
- * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationImplementationPolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private Implementation implementation;
-
- public JaasAuthenticationImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- super();
- this.component = component;
- this.implementation = implementation;
- }
-
- private List<JaasAuthenticationPolicy> findPolicies(Operation op) {
- List<JaasAuthenticationPolicy> polices = new ArrayList<JaasAuthenticationPolicy>();
- // FIXME: How do we get a list of effective policySets for a given operation?
- if (implementation instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)implementation;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (JaasAuthenticationPolicy.class.isInstance(p)) {
- polices.add((JaasAuthenticationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = component.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JaasAuthenticationPolicy.class.isInstance(p)) {
- polices.add((JaasAuthenticationPolicy)p);
- }
- }
- }
- return polices;
- }
-
- public Interceptor createInterceptor(Operation operation) {
- List<JaasAuthenticationPolicy> policies = findPolicies(operation);
- if (policies == null || policies.isEmpty()) {
- return null;
- } else {
- return new JaasAuthenticationInterceptor(findPolicies(operation));
- }
- }
-
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java
deleted file mode 100644
index ea7e12cfaf..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationInterceptor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.jaas;
-
-import java.security.Principal;
-import java.util.List;
-
-import javax.security.auth.Subject;
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationInterceptor implements Interceptor {
- private List<JaasAuthenticationPolicy> authenticationPolicies;
- private Invoker next;
-
- public JaasAuthenticationInterceptor(List<JaasAuthenticationPolicy> authenticationPolicies) {
- super();
- this.authenticationPolicies = authenticationPolicies;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
- */
- public Invoker getNext() {
- return next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
- */
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- try {
- for (JaasAuthenticationPolicy policy : authenticationPolicies) {
- CallbackHandler callbackHandler = (CallbackHandler)policy.getCallbackHandlerClass().newInstance();
- LoginContext lc = new LoginContext(policy.getConfigurationName(), callbackHandler);
- lc.login();
- }
- } catch (Exception e) {
- throw new ServiceRuntimeException(e);
- }
- return getNext().invoke(msg);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java
deleted file mode 100644
index f41d36194a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicy.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.security.jaas;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationPolicy implements Policy {
- public static final QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "jaasAuthentication");
-
- private String configurationName = "other";
- private String callbackHandlerClassName;
- private Class<?> callbackHandlerClass;
-
- public String getCallbackHandlerClassName() {
- return callbackHandlerClassName;
- }
-
- public void setCallbackHandlerClassName(String callbackHandlerClassName) {
- this.callbackHandlerClassName = callbackHandlerClassName;
- }
-
- public Class<?> getCallbackHandlerClass() {
- return callbackHandlerClass;
- }
-
- public void setCallbackHandlerClass(Class<?> callbackHandlerClass) {
- this.callbackHandlerClass = callbackHandlerClass;
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- public String getConfigurationName() {
- return configurationName;
- }
-
- public void setConfigurationName(String configurationName) {
- this.configurationName = configurationName;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.java
deleted file mode 100644
index b7736fa817..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyHandler.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.policy.security.jaas;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.security.auth.login.LoginContext;
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.util.PolicyHandler;
-
-/**
- * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationPolicyHandler implements PolicyHandler {
- private static final String jaasPolicy = "JaasPolicy";
- public static final QName policySetQName = new QName(Constants.SCA10_TUSCANY_NS, jaasPolicy);
- private PolicySet applicablePolicySet = null;
-
- public void setUp(Object... context) {
- if (applicablePolicySet != null) {
- }
- }
-
- public void cleanUp(Object... context) {
- }
-
- public void beforeInvoke(Object... context) {
- try {
- JaasAuthenticationPolicy policy = (JaasAuthenticationPolicy)applicablePolicySet.getPolicies().get(0);
- CallbackHandler callbackHandler =
- (CallbackHandler)policy.getCallbackHandlerClass().newInstance();
- LoginContext lc = new LoginContext(policy.getConfigurationName(), callbackHandler);
- lc.login();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- }
-
- public void afterInvoke(Object... context) {
-
- }
-
- public PolicySet getApplicablePolicySet() {
- return applicablePolicySet;
- }
-
- public void setApplicablePolicySet(PolicySet applicablePolicySet) {
- this.applicablePolicySet = applicablePolicySet;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java
deleted file mode 100644
index 8785ec1536..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProcessor.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.security.jaas;
-
-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.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationPolicyProcessor implements StAXArtifactProcessor<JaasAuthenticationPolicy> {
- private static final QName JAAS_AUTHENTICATION_POLICY_QNAME = JaasAuthenticationPolicy.NAME;
- private static final String callbackHandler = "callbackHandler";
- public static final QName CALLBACK_HANDLER_QNAME = new QName(Constants.SCA10_TUSCANY_NS,
- callbackHandler);
- public static final QName CONFIGURATION_QNAME = new QName(Constants.SCA10_TUSCANY_NS,
- "configurationName");
- private Monitor monitor;
-
- public QName getArtifactType() {
- return JAAS_AUTHENTICATION_POLICY_QNAME;
- }
-
- public JaasAuthenticationPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-security-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public JaasAuthenticationPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JaasAuthenticationPolicy policy = new JaasAuthenticationPolicy();
- int event = reader.getEventType();
- QName name = null;
-
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if (name.equals(CALLBACK_HANDLER_QNAME)) {
- String callbackHandlerClassName = reader.getElementText();
- if (callbackHandlerClassName != null) {
- policy.setCallbackHandlerClassName(callbackHandlerClassName.trim());
- }
- }
- if (name.equals(CONFIGURATION_QNAME)) {
- String configurationName = reader.getElementText();
- if (configurationName != null) {
- policy.setConfigurationName(configurationName.trim());
- }
- }
-
- break;
- }
- }
-
- if ( event == END_ELEMENT ) {
- if ( JAAS_AUTHENTICATION_POLICY_QNAME.equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return policy;
- }
-
- public void write(JaasAuthenticationPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- JAAS_AUTHENTICATION_POLICY_QNAME.getLocalPart(),
- JAAS_AUTHENTICATION_POLICY_QNAME.getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
-
- writer.writeEndElement();
- }
-
- public Class<JaasAuthenticationPolicy> getModelType() {
- return JaasAuthenticationPolicy.class;
- }
-
- public void resolve(JaasAuthenticationPolicy policy, ModelResolver resolver) throws ContributionResolveException {
-
- if (policy.getCallbackHandlerClassName() != null) {
- ClassReference classReference = new ClassReference(policy.getCallbackHandlerClassName());
- classReference = resolver.resolveModel(ClassReference.class, classReference);
- Class callbackClass = classReference.getJavaClass();
- if (callbackClass == null) {
- error("ClassNotFoundException", resolver, policy.getCallbackHandlerClassName());
- //throw new ContributionResolveException(new ClassNotFoundException(policy.getCallbackHandlerClassName()));
- } else {
- policy.setCallbackHandlerClass(callbackClass);
- policy.setUnresolved(false);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.java
deleted file mode 100644
index e7529671a6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationPolicyProviderFactory.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.policy.security.jaas;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationPolicyProviderFactory implements PolicyProviderFactory<JaasAuthenticationPolicy> {
-
- public JaasAuthenticationPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- return new JaasAuthenticationImplementationPolicyProvider(component, implementation);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- return null;
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- return new JaasAuthenticationServicePolicyProvider(component, service, binding);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<JaasAuthenticationPolicy> getModelType() {
- return JaasAuthenticationPolicy.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.java
deleted file mode 100644
index 220ebd937f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/java/org/apache/tuscany/sca/policy/security/jaas/JaasAuthenticationServicePolicyProvider.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.policy.security.jaas;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * Policy handler to handle PolicySet containing JaasAuthenticationPolicy instances
- *
- * @version $Rev$ $Date$
- */
-public class JaasAuthenticationServicePolicyProvider implements PolicyProvider {
- private RuntimeComponent component;
- private RuntimeComponentService service;
- private Binding binding;
-
- private List<Operation> operations = new ArrayList<Operation>();
-
- public JaasAuthenticationServicePolicyProvider(RuntimeComponent component, RuntimeComponentService service, Binding binding) {
- super();
- this.component = component;
- this.service = service;
- this.binding = binding;
-
- this.operations.addAll(service.getInterfaceContract().getInterface().getOperations());
- }
-
- private List<JaasAuthenticationPolicy> findPolicies(Operation op) {
- List<JaasAuthenticationPolicy> polices = new ArrayList<JaasAuthenticationPolicy>();
- // FIXME: How do we get a list of effective policySets for a given operation?
- for(Operation operation : operations) {
- if (operation!= null && operation.getName() != null && operation.getName().equals(op.getName())) {
- for (PolicySet ps : operation.getPolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (JaasAuthenticationPolicy.class.isInstance(p)) {
- polices.add((JaasAuthenticationPolicy)p);
- }
- }
- }
- }
- }
-
- if (service instanceof OperationsConfigurator) {
- OperationsConfigurator operationsConfigurator = (OperationsConfigurator)service;
- for (ConfiguredOperation cop : operationsConfigurator.getConfiguredOperations()) {
- if (cop != null && cop.getName() != null && cop.getName().equals(op.getName())) {
- for (PolicySet ps : cop.getApplicablePolicySets()) {
- for (Object p : ps.getPolicies()) {
- if (JaasAuthenticationPolicy.class.isInstance(p)) {
- polices.add((JaasAuthenticationPolicy)p);
- }
- }
- }
- }
- }
- }
-
- List<PolicySet> policySets = service.getPolicySets();
- for (PolicySet ps : policySets) {
- for (Object p : ps.getPolicies()) {
- if (JaasAuthenticationPolicy.class.isInstance(p)) {
- polices.add((JaasAuthenticationPolicy)p);
- }
- }
- }
-
- return polices;
- }
-
- public Interceptor createInterceptor(Operation operation) {
- List<JaasAuthenticationPolicy> policies = findPolicies(operation);
- if (policies == null || policies.isEmpty()) {
- return null;
- } else {
- return new JaasAuthenticationInterceptor(policies);
- }
- }
-
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index d782e7d1a6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#authorization,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#allow,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#permitAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#denyAll,model=org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy
-org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#runAs,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
-org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#securityIdentity,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
-org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#securityIdentity,model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
-org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#jaasAuthentication,model=org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicy
-org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#basicAuthentication,model=org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index 0363fbd981..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,21 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.policy.security.jaas.JaasAuthenticationPolicy
-org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicyProviderFactory;model=org.apache.tuscany.sca.policy.authentication.basic.BasicAuthenticationPolicy
-org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProviderFactory;model=org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index 790424df6b..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.policy.security.SecurityPolicyDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml
deleted file mode 100644
index 516bedeadf..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/definitions.xml
+++ /dev/null
@@ -1,65 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <!-- POLICY SETS -->
- <policySet name="runAs" appliesTo="sca:implementation.java"/>
- <policySet name="allow" appliesTo="sca:implementation.java"/>
- <policySet name="rolesAllowed" appliesTo="sca:implementation.java"/>
- <policySet name="permitAll" appliesTo="sca:implementation.java"/>
- <policySet name="denyAll" appliesTo="sca:implementation.java"/>
-
- <!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="authorization"
- constrains="sca:implementation.java">
- <description>
- Specifying this intent on references requires necessary authentication information
- to be sent along with outgoing messages. Specifying this intent on service requires
- incoming messages to be authenticated
- </description>
- </intent>
-
- <!-- Policy Intents Defined by the SCA Runtime -->
- <intent name="authentication"
- constrains="sca:binding tuscany:binding">
- <description>
- Specifying this intent on references requires necessary authentication information
- to be sent along with outgoing messages. Specifying this intent on service requires
- incoming messages to be authenticated
- </description>
- </intent>
-
- <intent name="confidentiality"
- constrains="sca:binding tuscany:binding">
- <description>
- Specifying this intent requires message exchanged to be encrypted
- </description>
- </intent>
-
- <intent name="integrity"
- constrains="sca:binding tuscany:binding">
- <description>
- Specifying this intent requires message exchanged to be signed
- </description>
- </intent>
-</definitions>
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml
deleted file mode 100644
index 0eadb46d76..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/org/apache/tuscany/sca/policy/security/tuscany_definitions.xml
+++ /dev/null
@@ -1,30 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <intent name="identity" constrains="sca:implementation">
- <description>All invocations are must have an identity set</description>
- </intent>
-
- <intent name="jaasAuthentication" constrains="sca:implementation">
- <description>All invocations to be authenticated</description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/policy-security-validation-messages.properties b/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/policy-security-validation-messages.properties
deleted file mode 100644
index ebb47f2b60..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/main/resources/policy-security-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-RequiredAttributeRolesMissing = Required attribute 'roles' is missing.
-ClassNotFoundException = Class Not Found Exception: {0} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.java
deleted file mode 100644
index 2414fd777e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/test/java/org/apache/tuscany/sca/policy/security/PolicyProcessorTestCase.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.policy.security;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicy;
-import org.apache.tuscany.sca.policy.authorization.AuthorizationPolicyProcessor;
-import org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicy;
-import org.apache.tuscany.sca.policy.identity.SecurityIdentityPolicyProcessor;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyProcessorTestCase {
- private final static List<String> SEQ =
- Arrays.asList("permitAll",
- "allow [r1, r2]",
- "denyAll",
- "runAs admin",
- "useCallerIdentity",
- "permitAll",
- "allow [r1, r2]",
- "denyAll",
- "runAs admin");
-
- @Test
- public void testRead() throws Exception {
- List<String> results = new ArrayList<String>();
- Map<QName, StAXArtifactProcessor> processors = new HashMap<QName, StAXArtifactProcessor>();
- processors.put(AuthorizationPolicy.NAME, new AuthorizationPolicyProcessor(null,null));
- processors.put(SecurityIdentityPolicy.NAME, new SecurityIdentityPolicyProcessor(null,null));
- processors.put(new QName(Constants.SCA10_NS, "allow"), new AuthorizationPolicyProcessor(null,null));
- processors.put(new QName(Constants.SCA10_NS, "permitAll"), new AuthorizationPolicyProcessor(null,null));
- processors.put(new QName(Constants.SCA10_NS, "denyAll"), new AuthorizationPolicyProcessor(null,null));
- processors.put(new QName(Constants.SCA10_NS, "runAs"), new SecurityIdentityPolicyProcessor(null,null));
- InputStream is = getClass().getResourceAsStream("mock_policy_definitions.xml");
- XMLInputFactory factory = XMLInputFactory.newInstance();
- XMLStreamReader reader = factory.createXMLStreamReader(is);
- while (true) {
- int event = reader.getEventType();
- if (event == XMLStreamConstants.START_ELEMENT) {
- if ("policySet".equals(reader.getName().getLocalPart())) {
- reader.nextTag();
- results.add(processors.get(reader.getName()).read(reader).toString());
- }
- }
- if (reader.hasNext()) {
- reader.next();
- } else {
- break;
- }
- }
- Assert.assertEquals(SEQ, results);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml b/branches/sca-java-1.5.1/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml
deleted file mode 100644
index 53d1a581f0..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-security/src/test/resources/org/apache/tuscany/sca/policy/security/mock_policy_definitions.xml
+++ /dev/null
@@ -1,78 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
- <!-- POLICY SETS -->
- <policySet name="ps1" provides="authorization" appliesTo="sca:implementation">
- <authorization>
- <permitAll />
- </authorization>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps2" provides="authorization" appliesTo="sca:implementation">
- <authorization>
- <allow roles="r1 r2" />
- </authorization>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps3" provides="authorization" appliesTo="sca:implementation">
- <authorization>
- <denyAll />
- </authorization>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps4" provides="securityIdentity" appliesTo="sca:implementation">
- <securityIdentity>
- <runAs role="admin" />
- </securityIdentity>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps5" provides="securityIdentity" appliesTo="sca:implementation">
- <securityIdentity>
- <useCallerIdentity />
- </securityIdentity>
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps6" provides="authorization" appliesTo="sca:implementation">
- <permitAll />
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps7" provides="authorization" appliesTo="sca:implementation">
- <allow roles="r1 r2" />
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps8" provides="authorization" appliesTo="sca:implementation">
- <denyAll />
- </policySet>
-
- <!-- POLICY SETS -->
- <policySet name="ps9" provides="securityIdentity" appliesTo="sca:implementation">
- <runAs role="admin" />
- </policySet>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/LICENSE b/branches/sca-java-1.5.1/modules/policy-transaction/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/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-java-1.5.1/modules/policy-transaction/NOTICE b/branches/sca-java-1.5.1/modules/policy-transaction/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/pom.xml b/branches/sca-java-1.5.1/modules/policy-transaction/pom.xml
deleted file mode 100644
index ef373a07c9..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/pom.xml
+++ /dev/null
@@ -1,127 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-transaction</artifactId>
- <name>Apache Tuscany SCA Transaction Policy Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-transaction</artifactId>
- <version>2.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.components</groupId>
- <artifactId>geronimo-connector</artifactId>
- <version>2.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <!--
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>4.1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-ra</artifactId>
- <version>4.1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-jms_1.1_spec</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.3.1.4</version>
- <scope>test</scope>
- </dependency>
- -->
- <!--
- <dependency>
- <groupId>jotm</groupId>
- <artifactId>jotm</artifactId>
- <version>2.0.10</version>
- <exclusions>
- <exclusion>
- <artifactId>jta</artifactId>
- <groupId>javax.transaction</groupId>
- </exclusion>
- <exclusion>
- <artifactId>connector</artifactId>
- <groupId>javax.resource</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- -->
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.transaction</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.transaction*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.java
deleted file mode 100644
index 8a242924ee..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/IncompatibleIntentException.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.policy.transaction;
-
-/**
- * @version $Rev$ $Date$
- */
-public class IncompatibleIntentException extends Exception {
- private static final long serialVersionUID = -2993825019200280397L;
-
- public IncompatibleIntentException() {
- super();
- }
-
- public IncompatibleIntentException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public IncompatibleIntentException(String message) {
- super(message);
- }
-
- public IncompatibleIntentException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.java
deleted file mode 100644
index 3c11fef865..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionImplementationPolicyProvider.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.policy.transaction;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionImplementationPolicyProvider implements PolicyProvider {
- private TransactionManagerHelper helper;
- private List<PolicySet> policySets;
-
- public TransactionImplementationPolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
- super();
- this.helper = helper;
- this.policySets = attachPoint.getApplicablePolicySets();
- }
-
- public Interceptor createInterceptor(Operation operation) {
- for (PolicySet policySet : policySets) {
- for (Object p : policySet.getPolicies()) {
- if (p instanceof TransactionPolicy) {
- TransactionInterceptor interceptor =
- new TransactionInterceptor(helper, false, (TransactionPolicy)p, null);
- return interceptor;
- }
- }
- }
- return null;
- }
-
- public String getPhase() {
- return Phase.IMPLEMENTATION_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.java
deleted file mode 100644
index b3e90c23cd..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionIntent.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.policy.transaction;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public enum TransactionIntent {
- managedTransactionLocal, managedTransactionGlobal, noManagedTransaction, propagatesTransacton, suspendsTransaction, transactedOneWay, immediateOneWay
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.java
deleted file mode 100644
index 0de98592cb..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionInterceptor.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.policy.transaction;
-
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Invoker;
-import org.apache.tuscany.sca.invocation.Message;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionInterceptor implements Interceptor {
- private Invoker next;
- private TransactionManagerHelper helper;
- private boolean outbound;
- private TransactionPolicy interactionPolicy;
- private TransactionPolicy implementationPolicy;
-
- public TransactionInterceptor(TransactionManagerHelper helper,
- boolean outbound,
- TransactionPolicy interactionPolicy,
- TransactionPolicy implementationPolicy) {
- super();
- this.helper = helper;
- this.outbound = outbound;
- this.interactionPolicy = interactionPolicy;
- this.implementationPolicy = implementationPolicy;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
- */
- public Invoker getNext() {
- return next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
- */
- public void setNext(Invoker next) {
- this.next = next;
- }
-
- /**
- * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
- */
- public Message invoke(Message msg) {
- TransactionalInvocation invocation = new TransactionalInvocation(next, msg);
-
- Message result = null;
- if (msg.getOperation().isNonBlocking()) {
-
- }
- TransactionIntent interactionIntent = TransactionIntent.propagatesTransacton;
- if (interactionPolicy != null) {
- if (interactionPolicy.getAction() == TransactionPolicy.Action.PROPAGATE) {
- interactionIntent = TransactionIntent.propagatesTransacton;
- } else {
- interactionIntent = TransactionIntent.suspendsTransaction;
- }
- }
- TransactionIntent implementationIntent = TransactionIntent.managedTransactionGlobal;
- if (implementationPolicy != null) {
- switch (implementationPolicy.getAction()) {
- case REQUIRE_GLOBAL:
- implementationIntent = TransactionIntent.managedTransactionGlobal;
- break;
- case REQUIRE_LOCAL:
- implementationIntent = TransactionIntent.managedTransactionLocal;
- break;
- default:
- implementationIntent = TransactionIntent.noManagedTransaction;
- break;
- }
- }
- try {
- if (outbound) {
- result = helper.handlesOutbound(interactionIntent, implementationIntent, invocation);
- } else {
- result = helper.handlesInbound(interactionIntent, implementationIntent, invocation);
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return result;
- }
-
- private static class TransactionalInvocation implements TransactionalAction<Message> {
- private final Invoker invoker;
- private final Message message;
-
- public TransactionalInvocation(Invoker invoker, Message message) {
- super();
- this.invoker = invoker;
- this.message = message;
- }
-
- public Message run() throws Exception {
- return invoker.invoke(message);
- }
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
deleted file mode 100644
index defe12967e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelper.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction;
-
-import java.lang.reflect.InvocationTargetException;
-
-import javax.transaction.HeuristicMixedException;
-import javax.transaction.HeuristicRollbackException;
-import javax.transaction.InvalidTransactionException;
-import javax.transaction.NotSupportedException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.SystemException;
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionManagerHelper {
- // private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
-
- private TransactionManager tm;
-
- public TransactionManagerHelper(TransactionManager tm) {
- super();
- this.tm = tm;
- }
-
- public Transaction managedGlobalTransactionPreInvoke() throws SystemException, NotSupportedException {
- int status = tm.getStatus();
- if (status == Status.STATUS_COMMITTED || status == Status.STATUS_NO_TRANSACTION
- || status == Status.STATUS_ROLLEDBACK) {
- tm.begin();
- return tm.getTransaction();
- }
- return null;
- }
-
- public void managedGlobalTransactionPostInvoke(Transaction created, boolean rollback)
- throws InvalidTransactionException, IllegalStateException, SystemException, SecurityException,
- HeuristicMixedException, HeuristicRollbackException, RollbackException {
- if (created != null) {
- int status = created.getStatus();
- if (status == Status.STATUS_MARKED_ROLLBACK) {
- created.rollback();
- } else if (status == Status.STATUS_ACTIVE) {
- if (rollback) {
- created.rollback();
- } else {
- created.commit();
- }
- }
- }
- }
-
- public Transaction suspendsTransactionPreInvoke() throws SystemException {
- if (tm.getTransaction() != null) {
- return tm.suspend();
- } else {
- return null;
- }
- }
-
- public void suspendsTransactionPostInvoke(Transaction suspended) throws InvalidTransactionException,
- IllegalStateException, SystemException {
- if (suspended != null) {
- tm.resume(suspended);
- }
- }
-
- public TransactionManager getTransactionManager() {
- return tm;
- }
-
- public void setTransactionManager(TransactionManager tm) {
- this.tm = tm;
- }
-
- public void validateOneway(TransactionIntent onewayIntent, TransactionIntent implIntent)
- throws IncompatibleIntentException {
- if (onewayIntent == TransactionIntent.transactedOneWay) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
- }
- }
- }
-
- public void validateInbound(TransactionIntent serviceIntent, TransactionIntent implIntent)
- throws IncompatibleIntentException {
- if (serviceIntent == TransactionIntent.propagatesTransacton) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
- }
- }
- }
-
- public void validateOutbound(TransactionIntent referenceIntent, TransactionIntent implIntent)
- throws IncompatibleIntentException {
- if (referenceIntent == TransactionIntent.propagatesTransacton) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
- }
- }
- }
-
- public <T> T handlesOutbound(TransactionIntent referenceIntent,
- TransactionIntent implIntent,
- TransactionalAction<T> action) throws Exception {
-
- if (implIntent == null) {
- implIntent = TransactionIntent.noManagedTransaction;
- }
-
- if (referenceIntent == TransactionIntent.propagatesTransacton) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(referenceIntent + "<-X->" + implIntent);
- } else {
- // propagates the current TX
- return run(action);
- }
- } else if (referenceIntent == TransactionIntent.suspendsTransaction) {
- Transaction tx = suspendsTransactionPreInvoke();
- try {
- return run(action);
- } finally {
- suspendsTransactionPostInvoke(tx);
- }
- } else {
- return run(action);
- }
- }
-
- private <T> T run(TransactionalAction<T> action) throws Exception {
- // Make sure a global TX is in place
- Transaction tx = managedGlobalTransactionPreInvoke();
- boolean rollback = false;
- try {
- return action.run();
- } catch (InvocationTargetException e) {
- throw e;
- } catch (Throwable e) {
- rollback = true;
- if (e instanceof Error) {
- throw (Error)e;
- } else if (e instanceof RuntimeException) {
- throw (RuntimeException)e;
- } else {
- throw (Exception)e;
- }
- } finally {
- managedGlobalTransactionPostInvoke(tx, rollback);
- }
- }
-
- public <T> T handlesInbound(TransactionIntent serviceIntent,
- TransactionIntent implIntent,
- TransactionalAction<T> action) throws Exception {
- if (serviceIntent == null && implIntent == null) {
- return run(action);
- }
-
- if (implIntent == null) {
- implIntent = TransactionIntent.noManagedTransaction;
- }
-
- if (serviceIntent == TransactionIntent.propagatesTransacton) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(serviceIntent + "<-X->" + implIntent);
- } else {
- return run(action);
- }
- } else if (serviceIntent == TransactionIntent.suspendsTransaction) {
- Transaction tx1 = suspendsTransactionPreInvoke();
- try {
- if (implIntent == TransactionIntent.managedTransactionGlobal) {
- return run(action);
- } else {
- return action.run();
- }
- } finally {
- suspendsTransactionPostInvoke(tx1);
- }
- } else {
- if (implIntent == TransactionIntent.managedTransactionGlobal) {
- // Start a new TX
- return run(action);
- } else {
- return action.run();
- }
- }
- }
-
- public <T> void handlesOneWay(TransactionIntent onewayIntent,
- TransactionIntent implIntent,
- TransactionalAction<T> action) throws Exception {
- if (implIntent == null) {
- implIntent = TransactionIntent.noManagedTransaction;
- }
-
- if (onewayIntent == null) {
- // Assume transactedOneWay
- run(action);
- return;
- }
-
- if (onewayIntent == TransactionIntent.transactedOneWay) {
- if (implIntent != TransactionIntent.managedTransactionGlobal) {
- throw new IncompatibleIntentException(onewayIntent + "<-X->" + implIntent);
- } else {
- run(action);
- return;
- }
- } else {
- // TransactionIntent.immediateOneWay
- Transaction tx = suspendsTransactionPreInvoke();
- try {
- run(action);
- return;
- } finally {
- suspendsTransactionPostInvoke(tx);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java
deleted file mode 100644
index 31beab4fca..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerWrapper.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction;
-
-import java.io.File;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.geronimo.transaction.log.HOWLLog;
-import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
-import org.apache.geronimo.transaction.manager.XidFactory;
-import org.apache.geronimo.transaction.manager.XidFactoryImpl;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionManagerWrapper {
- private TransactionManager transactionManager;
- private HOWLLog howlLog;
-
- private String logFileDir = "target/logs";
- private String bufferClassName = "org.objectweb.howl.log.BlockLogBuffer";
- private int bufferSizeKBytes = 32;
- private boolean checksumEnabled = true;
- private boolean adler32Checksum = true;
- private int flushSleepTimeMilliseconds = 50;
- private String logFileExt = "log";
- private String logFileName = "transaction";
- private int maxBlocksPerFile = -1;
- private int maxLogFiles = 2;
- private int maxBuffers = 0;
- private int minBuffers = 4;
- private int threadsWaitingForceThreshold = -1;
- private File serverBaseDir = new File(System.getProperty("basedir", System.getProperty("user.dir")));
-
- public TransactionManagerWrapper() {
- super();
- }
-
- public void start() {
- try {
- XidFactory xidFactory = new XidFactoryImpl();
- howlLog =
- new HOWLLog(bufferClassName, bufferSizeKBytes, checksumEnabled, adler32Checksum,
- flushSleepTimeMilliseconds, logFileDir, logFileExt, logFileName, maxBlocksPerFile,
- maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold, xidFactory,
- serverBaseDir);
-
- howlLog.doStart();
- transactionManager = new GeronimoTransactionManager(1200, xidFactory, howlLog);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
- */
- public void stop() {
- try {
- if (howlLog != null) {
- howlLog.doStop();
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
- public TransactionManager getTransactionManager() {
- return transactionManager;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
deleted file mode 100644
index 3339f2e338..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionModuleActivator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionModuleActivator implements ModuleActivator {
- private TransactionManagerWrapper wrapper;
-
- /**
- * @see org.apache.tuscany.sca.core.ModuleActivator#start(org.apache.tuscany.sca.core.ExtensionPointRegistry)
- */
- public void start(ExtensionPointRegistry registry) {
- if (registry != null) {
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- TransactionManager transactionManager = utilities.getUtility(TransactionManager.class);
- if (transactionManager != null) {
- // The transaction manage is provided by the hosting environment
-// RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
-// registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
-// TransactionManagerHelper helper = new TransactionManagerHelper(transactionManager);
-// wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
- return;
- }
- }
- try {
- wrapper = new TransactionManagerWrapper();
- wrapper.start();
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- if (registry != null) {
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- utilities.addUtility(wrapper.getTransactionManager());
-// RuntimeWireProcessorExtensionPoint wireProcessorExtensionPoint =
-// registry.getExtensionPoint(RuntimeWireProcessorExtensionPoint.class);
-// TransactionManagerHelper helper = new TransactionManagerHelper(wrapper.getTransactionManager());
-// wireProcessorExtensionPoint.addWireProcessor(new TransactionRuntimeWireProcessor(helper));
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.core.ModuleActivator#stop(org.apache.tuscany.sca.core.ExtensionPointRegistry)
- */
- public void stop(ExtensionPointRegistry registry) {
- try {
- if (wrapper != null) {
- wrapper.stop();
- wrapper = null;
- }
- if (registry != null && wrapper != null) {
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- utilities.removeUtility(wrapper.getTransactionManager());
- }
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.java
deleted file mode 100644
index a13748f232..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicy.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.policy.transaction;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- * The model for Tuscany transaction policy
- *
- * @version $Rev$ $Date$
- */
-public interface TransactionPolicy extends Policy {
- QName NAME = new QName(Constants.SCA10_TUSCANY_NS, "transactionPolicy");
-
- enum Action {
- PROPAGATE, SUSPEND, REQUIRE_GLOBAL, REQUIRE_LOCAL, REQUIRE_NONE
- };
-
- int getTransactionTimeout();
-
- void setTransactionTimeout(int seconds);
-
- void setAction(Action action);
-
- Action getAction();
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.java
deleted file mode 100644
index 7b10a7d568..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyDefinitionsProvider.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.policy.transaction;
-
-import java.net.URI;
-import java.net.URL;
-
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.definitions.SCADefinitions;
-import org.apache.tuscany.sca.definitions.util.SCADefinitionsUtil;
-import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
-import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
-
-/**
- * Provider for Policy Intents and PolicySet definitions related to transaction
- *
- * @version $Rev$ $Date$
- */
-public class TransactionPolicyDefinitionsProvider implements SCADefinitionsProvider {
- private static final String scaDefinitionsFile = "definitions.xml";
- private static final String tuscanyDefinitionsFile = "tuscany_definitions.xml";
- private URLArtifactProcessor urlArtifactProcessor;
-
- public TransactionPolicyDefinitionsProvider(ExtensionPointRegistry registry) {
- URLArtifactProcessorExtensionPoint documentProcessors =
- registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
- }
-
- public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
-
- try {
- SCADefinitions scaTransactionPolicyDefns = null;
- SCADefinitions tuscanyTransactionPolicyDefns = null;
-
- URI uri = new URI(scaDefinitionsFile);
- URL defintionsFileUrl = getClass().getResource(scaDefinitionsFile);
- scaTransactionPolicyDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, defintionsFileUrl);
-
- uri = new URI(tuscanyDefinitionsFile);
- defintionsFileUrl = getClass().getResource(tuscanyDefinitionsFile);
- tuscanyTransactionPolicyDefns = (SCADefinitions)urlArtifactProcessor.read(null, uri, defintionsFileUrl);
-
- SCADefinitionsUtil.aggregateSCADefinitions(tuscanyTransactionPolicyDefns, scaTransactionPolicyDefns);
-
- return scaTransactionPolicyDefns;
- } catch (Exception e) {
- throw new SCADefinitionsProviderException(e);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.java
deleted file mode 100644
index f178876a72..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyImpl.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.policy.transaction;
-
-import javax.xml.namespace.QName;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionPolicyImpl implements TransactionPolicy {
- private boolean unresolved;
- private int transactionTimeout = 1200;
- private Action action = Action.PROPAGATE;
-
- public int getTransactionTimeout() {
- return transactionTimeout;
- }
-
- public void setTransactionTimeout(int transactionTimeout) {
- this.transactionTimeout = transactionTimeout;
- }
-
- public Action getAction() {
- return action;
- }
-
- public void setAction(Action policy) {
- this.action = policy;
- }
-
- public QName getSchemaName() {
- return NAME;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.java
deleted file mode 100644
index 0579890a42..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProcessor.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.policy.transaction;
-
-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.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionPolicyProcessor implements StAXArtifactProcessor<TransactionPolicy> {
- public static final String TIMEOUT = "transactionTimeout";
- public static final String ACTION = "action";
-
- public QName getArtifactType() {
- return TransactionPolicy.NAME;
- }
-
- public TransactionPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
- public TransactionPolicy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- TransactionPolicy txPolicy = new TransactionPolicyImpl();
- int event = reader.getEventType();
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT: {
- String timeout = reader.getAttributeValue(null, TIMEOUT);
- if (timeout != null) {
- txPolicy.setTransactionTimeout(Integer.parseInt(timeout));
- }
- String action = reader.getAttributeValue(null, ACTION);
- if (action != null) {
- txPolicy.setAction(TransactionPolicy.Action.valueOf(action));
- }
- break;
- }
- }
-
- if (event == END_ELEMENT) {
- if (TransactionPolicy.NAME.equals(reader.getName())) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
-
- return txPolicy;
- }
-
- public void write(TransactionPolicy policy, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<TransactionPolicy> getModelType() {
- return TransactionPolicy.class;
- }
-
- public void resolve(TransactionPolicy policy, ModelResolver resolver) throws ContributionResolveException {
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
deleted file mode 100644
index be97090378..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionPolicyProviderFactory.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction;
-
-import javax.transaction.TransactionManager;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Implementation;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-import org.apache.tuscany.sca.provider.PolicyProviderFactory;
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
-import org.apache.tuscany.sca.runtime.RuntimeComponentService;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionPolicyProviderFactory implements PolicyProviderFactory<TransactionPolicy> {
- private TransactionManagerHelper helper;
-
- public TransactionPolicyProviderFactory(ExtensionPointRegistry registry) {
- super();
- UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
- TransactionManager tm = utilities.getUtility(TransactionManager.class);
- this.helper = new TransactionManagerHelper(tm);
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
- */
- public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component, Implementation implementation) {
- if (component instanceof PolicySetAttachPoint) {
- return new TransactionImplementationPolicyProvider(helper, (PolicySetAttachPoint)component);
- } else {
- return null;
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createReferencePolicyProvider(RuntimeComponent component,
- RuntimeComponentReference reference,
- Binding binding) {
- if (binding instanceof PolicySetAttachPoint) {
- return new TransactionReferencePolicyProvider(helper, (PolicySetAttachPoint)binding);
- } else {
- return null;
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
- */
- public PolicyProvider createServicePolicyProvider(RuntimeComponent component,
- RuntimeComponentService service,
- Binding binding) {
- if (binding instanceof PolicySetAttachPoint) {
- return new TransactionServicePolicyProvider(helper, (PolicySetAttachPoint)binding);
- } else {
- return null;
- }
- }
-
- /**
- * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
- */
- public Class<TransactionPolicy> getModelType() {
- return TransactionPolicy.class;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.java
deleted file mode 100644
index 0795a4e5cf..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionReferencePolicyProvider.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.policy.transaction;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionReferencePolicyProvider implements PolicyProvider {
- private TransactionManagerHelper helper;
- private List<PolicySet> policySets;
-
- public TransactionReferencePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
- super();
- this.helper = helper;
- this.policySets = attachPoint.getApplicablePolicySets();
- }
-
- public Interceptor createInterceptor(Operation operation) {
- for (PolicySet policySet : policySets) {
- for (Object p : policySet.getPolicies()) {
- if (p instanceof TransactionPolicy) {
- TransactionInterceptor interceptor =
- new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
- return interceptor;
- }
- }
- }
- return null;
- }
-
- public String getPhase() {
- return Phase.REFERENCE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.java
deleted file mode 100644
index 9f9088a380..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionServicePolicyProvider.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.policy.transaction;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.interfacedef.Operation;
-import org.apache.tuscany.sca.invocation.Interceptor;
-import org.apache.tuscany.sca.invocation.Phase;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-import org.apache.tuscany.sca.provider.PolicyProvider;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionServicePolicyProvider implements PolicyProvider {
- private TransactionManagerHelper helper;
- private List<PolicySet> policySets;
-
- public TransactionServicePolicyProvider(TransactionManagerHelper helper, PolicySetAttachPoint attachPoint) {
- super();
- this.helper = helper;
- this.policySets = attachPoint.getApplicablePolicySets();
- }
-
- public Interceptor createInterceptor(Operation operation) {
- for (PolicySet policySet : policySets) {
- for (Object p : policySet.getPolicies()) {
- if (p instanceof TransactionPolicy) {
- TransactionInterceptor interceptor =
- new TransactionInterceptor(helper, true, (TransactionPolicy)p, null);
- return interceptor;
- }
- }
- }
- return null;
- }
-
- public String getPhase() {
- return Phase.SERVICE_POLICY;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.java
deleted file mode 100644
index 5a7ae5c4cc..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/java/org/apache/tuscany/sca/policy/transaction/TransactionalAction.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.policy.transaction;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface TransactionalAction<T> {
- /**
- * @return
- * @throws Exception
- */
- T run() throws Exception;
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 1d034e23a2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.transaction.TransactionPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#transactionPolicy,model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 9a35d62cad..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.policy.transaction.TransactionModuleActivator
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
deleted file mode 100644
index eeec814f60..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the policy extension
-org.apache.tuscany.sca.policy.transaction.TransactionPolicyProviderFactory;model=org.apache.tuscany.sca.policy.transaction.TransactionPolicy
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
deleted file mode 100644
index e9d9fab519..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for SCA Definitions Providers
-org.apache.tuscany.sca.policy.transaction.TransactionPolicyDefinitionsProvider \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/log4j.properties b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/log4j.properties
deleted file mode 100644
index 698ee41d7e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/log4j.properties
+++ /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.
-#
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=INFO, CONSOLE
-
-# CONSOLE is set to be a ConsoleAppender.
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-
-
-# Print only messages of level WARN or above in the package com.foo.
-log4j.logger.org.apache.tuscany=INFO \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml
deleted file mode 100644
index ff51b131b7..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/definitions.xml
+++ /dev/null
@@ -1,66 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <intent name="managedTransaction" constrains="implementation">
- <description>Used to indicate the transaction environment desired by a component implementation.</description>
- </intent>
- <intent name="managedTransaction.global">
- <description>
- Used to indicate that a component implementation requires a managed global transaction.
- </description>
- </intent>
- <intent name="managedTransaction.local">
- <description>
- Used to indicate that a component implementation requires a managed local transaction.
- </description>
- </intent>
- <intent name="noManagedTransaction" constrains="implementation">
- <description>
- Used to indicate that a component implementation will manage its own transaction resources.
- </description>
- </intent>
- <intent name="propagatesTransaction" constrains="binding">
- <description>
- Used to indicate that a reference will propagate any client transaction or that a service will be dispatched
- under any received transaction.
- </description>
- </intent>
- <intent name="suspendsTransaction" constrains="binding">
- <description>
- Used to indicate that a reference will not propagate any client transaction or that a service will not be
- dispatched under any received transaction.
- </description>
- </intent>
- <intent name="transactedOneWay" constrains="binding">
- <description>
- Used to indicate that the component requires the SCA runtime to transact OneWay send of messages as part of
- any client global transaction or to transact oneWay message receipt as part of any service global
- transaction.
- </description>
- </intent>
- <intent name="immediateOneWay" constrains="binding">
- <description>
- Used to indicate that the component requires the SCA runtime to process the sending or receiving of OneWay
- messages immediately, regardless of any transaction under which the sending/receiving component runs.
- </description>
- </intent>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml b/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml
deleted file mode 100644
index 324fa03da6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/main/resources/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml
+++ /dev/null
@@ -1,54 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0" xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
-
- <policySet name="ManagedTransactionPolicySet" provides="managedTransaction" appliesTo="implementation">
- <intentMap provides="managedTransaction" default="global">
- <qualifier name="global">
- <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_GLOBAL" />
- </qualifier>
- <qualifier name="local">
- <tuscany:transactionPolicy transactionTimeout="1200" action="REQUIRE_LOCAL" />
- </qualifier>
- </intentMap>
- </policySet>
-
- <policySet name="NoManagedTransactionPolicySet" provides="noManagedTransaction"
- appliesTo="implementation">
- <tuscany:transactionPolicy action="REQUIRE_NONE" />
- </policySet>
-
- <policySet name="PropagatesTransactionPolicySet" provides="propagatesTransaction" appliesTo="binding">
- <tuscany:transactionPolicy action="PROPAGATE" />
- </policySet>
-
- <policySet name="SuspendsTransactionPolicySet" provides="suspendsTransaction" appliesTo="binding">
- <tuscany:transactionPolicy action="SUSPEND" />
- </policySet>
-
- <policySet name="TransactedOneWayPolicySet" provides="transactedOneWay" appliesTo="binding">
- <tuscany:transactionPolicy action="PROPAGATE" />
- </policySet>
-
- <policySet name="ImmediateOneWayPolicySet" provides="immediateOneWay" appliesTo="binding">
- <tuscany:transactionPolicy action="SUSPEND" />
- </policySet>
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
deleted file mode 100644
index e8560d775d..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/PolicyReadTestCase.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.transaction;
-
-import java.io.InputStream;
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-/**
- * Test the reading of ws config params policy.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyReadTestCase extends TestCase {
-
- @Override
- public void setUp() throws Exception {
- }
-
- public void testPolicyReading() throws Exception {
-
- TransactionPolicyProcessor processor = new TransactionPolicyProcessor(null, null);
-
- URL url = getClass().getResource("/org/apache/tuscany/sca/policy/transaction/tuscany_definitions.xml");
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
-
- InputStream urlStream = url.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
-
- TransactionPolicy policy = processor.read(reader);
- assertEquals(1200, policy.getTransactionTimeout());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java b/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
deleted file mode 100644
index 544e0f68c0..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-transaction/src/test/java/org/apache/tuscany/sca/policy/transaction/TransactionManagerHelperTestCase.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.transaction;
-
-import java.util.logging.Logger;
-
-import javax.transaction.Transaction;
-import javax.transaction.TransactionManager;
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import junit.framework.TestCase;
-
-import org.apache.geronimo.transaction.manager.NamedXAResource;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TransactionManagerHelperTestCase extends TestCase {
- private static final Logger logger = Logger.getLogger(TransactionManagerHelper.class.getName());
-
- public static class MockXAResource implements NamedXAResource {
-
- private String rm;
- private String id;
- private int timeout = 1000;
-
- public MockXAResource(String rm, String id) {
- super();
- this.rm = rm;
- this.id = id;
- }
-
- public String getName() {
- return rm + ":" + id;
- }
-
- public void commit(Xid xid, boolean onePhase) throws XAException {
- logger.info(id + ": commit(" + xid + "," + onePhase + ")");
- }
-
- public void end(Xid xid, int flags) throws XAException {
- logger.info(id + ": end(" + xid + "," + toString(flags) + ")");
- }
-
- public void forget(Xid xid) throws XAException {
- logger.info(id + ": forget(" + xid + ")");
- }
-
- public int getTransactionTimeout() throws XAException {
- return timeout;
- }
-
- public boolean isSameRM(XAResource xares) throws XAException {
- if (xares instanceof MockXAResource) {
- MockXAResource res = (MockXAResource)xares;
- return res.rm.endsWith(rm);
- } else {
- return false;
- }
- }
-
- public int prepare(Xid xid) throws XAException {
- logger.info(id + ": prepare(" + xid + ")");
- return XA_OK;
- }
-
- public Xid[] recover(int flag) throws XAException {
- return null;
- }
-
- public void rollback(Xid xid) throws XAException {
- logger.info(id + ": rollback(" + xid + ")");
- }
-
- public boolean setTransactionTimeout(int seconds) throws XAException {
- this.timeout = seconds;
- return true;
- }
-
- public void start(Xid xid, int flags) throws XAException {
- logger.info(id + ": start(" + xid + "," + toString(flags) + ")");
- }
-
- private String toString(int flags) {
- StringBuffer sb = new StringBuffer();
- if ((flags & TMENDRSCAN) != 0) {
- sb.append("TMENDRSCAN ");
- }
- if ((flags & TMFAIL) != 0) {
- sb.append("TMFAIL ");
- }
- if ((flags & TMJOIN) != 0) {
- sb.append("TMJOIN ");
- }
- if ((flags & TMONEPHASE) != 0) {
- sb.append("TMONEPHASE ");
- }
- if ((flags & TMRESUME) != 0) {
- sb.append("TMRESUME ");
- }
- if ((flags & TMSTARTRSCAN) != 0) {
- sb.append("TMSTARTRSCAN ");
- }
- if ((flags & TMSUCCESS) != 0) {
- sb.append("TMSUCCESS ");
- }
- if ((flags & TMSUSPEND) != 0) {
- sb.append("TMSUSPEND ");
- }
- if (sb.length() == 0) {
- sb.append("TMNOFLAGS");
- } else {
- sb.deleteCharAt(sb.length() - 1);
- }
- return sb.toString();
- }
-
- }
-
- public void testHelper() throws Exception {
- TransactionManagerWrapper activator = new TransactionManagerWrapper();
- activator.start();
- TransactionManager tm = activator.getTransactionManager();
- // GeronimoUserTransaction tx = new GeronimoUserTransaction(tm);
- TransactionManagerHelper helper = new TransactionManagerHelper(tm);
-
- // No TX yet
- assertNull(tm.getTransaction());
- Transaction t1 = helper.managedGlobalTransactionPreInvoke();
- // Should create T1
- assertNotNull(t1);
- // The current TX should be T1
- assertSame(t1, tm.getTransaction());
-
- XAResource res1 = new MockXAResource("Derby", "001");
- XAResource res2 = new MockXAResource("DB2", "002");
- tm.getTransaction().enlistResource(res1);
- tm.getTransaction().enlistResource(res2);
-
- Transaction suspended = helper.suspendsTransactionPreInvoke();
- suspended.delistResource(res1, XAResource.TMSUSPEND);
- suspended.delistResource(res2, XAResource.TMSUSPEND);
-
- // T1 is suspended
- assertSame(t1, suspended);
- // No more active TX
- assertNull(tm.getTransaction());
-
- Transaction t2 = helper.managedGlobalTransactionPreInvoke();
- assertNotNull(t2);
- // The current TX should be T2
- assertSame(t2, tm.getTransaction());
-
- XAResource res3 = new MockXAResource("Oracle", "003");
- tm.getTransaction().enlistResource(res3);
-
- tm.getTransaction().delistResource(res3, XAResource.TMSUCCESS);
- tm.rollback();
-
- // Skip post
- // helper.managedGlobalTransactionPostInvoke(t2);
-
- helper.suspendsTransactionPostInvoke(suspended);
- suspended.enlistResource(res1);
- suspended.enlistResource(res2);
- // T1 is now resumed
- assertSame(t1, tm.getTransaction());
-
- helper.managedGlobalTransactionPostInvoke(t1, false);
- assertNotNull(tm.getTransaction());
- assertEquals(6, t1.getStatus());
-
- activator.stop();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/LICENSE b/branches/sca-java-1.5.1/modules/policy-xml-ws/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/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-java-1.5.1/modules/policy-xml-ws/NOTICE b/branches/sca-java-1.5.1/modules/policy-xml-ws/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/pom.xml b/branches/sca-java-1.5.1/modules/policy-xml-ws/pom.xml
deleted file mode 100644
index 8628f6deba..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/pom.xml
+++ /dev/null
@@ -1,142 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-xml-ws</artifactId>
- <name>Apache Tuscany SCA Policy XML WS Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.7</version>
- <exclusions>
- <exclusion>
- <groupId>xerces</groupId>
- <artifactId>xercesImpl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>xml-apis</groupId>
- <artifactId>xml-apis</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.neethi</groupId>
- <artifactId>neethi</artifactId>
- <version>2.0.4</version>
- <exclusions>
- <exclusion>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <version>1.2.7</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.xml.ws</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.xml</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.java
deleted file mode 100644
index 718b68d408..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/java/org/apache/tuscany/sca/policy/xml/ws/WSPolicyProcessor.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.policy.xml.ws;
-
-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.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.neethi.PolicyEngine;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.xml.PolicyConstants;
-
-
-/**
- * Processor for handling xml models of PolicySet definitions
- *
- * @version $Rev$ $Date$
- */
-public class WSPolicyProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<org.apache.neethi.Policy>, PolicyConstants {
- public final static String WS_POLICY_NS = "http://schemas.xmlsoap.org/ws/2004/09/policy";
- public final static String WS_POLICY = "Policy";
-
- public final static QName WS_POLICY_QNAME =new QName(WS_POLICY_NS, WS_POLICY);
-
- public WSPolicyProcessor() {
- //System.out.println(">>>Initializing WSPolicyProcessor");
- }
-
- public WSPolicyProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- //System.out.println(">>>Initializing WSPolicyProcessor");
- }
-
- public QName getArtifactType() {
- return WS_POLICY_QNAME;
- }
-
- public Class<org.apache.neethi.Policy> getModelType() {
- return org.apache.neethi.Policy.class;
- }
-
- public org.apache.neethi.Policy read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- org.apache.neethi.Policy wsPolicy = null;
-
- int event = reader.getEventType();
- if (event == START_ELEMENT) {
- QName name = reader.getName();
- if (WS_POLICY_QNAME.equals(name)) {
- OMElement policyElement = loadElement(reader);
- wsPolicy = PolicyEngine.getPolicy(policyElement);
- }
- }
- return wsPolicy;
- }
-
- public void write(org.apache.neethi.Policy wsPolicy, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write an <sca:policySet>
- writer.writeStartElement(WS_POLICY_NS, WS_POLICY);
-
- //FIXME write proper ws-policy stuff here
-
- writer.writeEndElement();
- }
-
- public void resolve(org.apache.neethi.Policy wsPolicy, ModelResolver resolver) throws ContributionResolveException {
-
- }
-
-
- private OMElement loadElement(XMLStreamReader reader) throws XMLStreamException {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- OMElement head = fac.createOMElement(reader.getName());
- OMElement current = head;
-
- while (true) {
- switch (reader.next()) {
- case XMLStreamConstants.START_ELEMENT:
- QName name = reader.getName();
- OMElement child = fac.createOMElement(name, current);
-
- int count = reader.getNamespaceCount();
- for (int i = 0; i < count; i++) {
- String prefix = reader.getNamespacePrefix(i);
- String ns = reader.getNamespaceURI(i);
- child.declareNamespace(ns, prefix);
- }
-
- if(!"".equals(name.getNamespaceURI())) {
- child.declareNamespace(name.getNamespaceURI(), name.getPrefix());
- }
-
- // add the attributes for this element
- count = reader.getAttributeCount();
- for (int i = 0; i < count; i++) {
- OMNamespace omNs = null;
- String ns = reader.getAttributeNamespace(i);
- String prefix = reader.getAttributePrefix(i);
- String qname = reader.getAttributeLocalName(i);
- String value = reader.getAttributeValue(i);
-
- if ( ns != null ) {
- omNs = fac.createOMNamespace(ns, prefix);
- }
-
- child.addAttribute(qname, value, omNs);
- if (ns != null) {
- child.declareNamespace(ns, prefix);
- }
- }
- current = child;
- break;
- case XMLStreamConstants.CDATA:
- fac.createOMText(current, reader.getText());
- break;
- case XMLStreamConstants.CHARACTERS:
- fac.createOMText(current, reader.getText());
- break;
- case XMLStreamConstants.END_ELEMENT:
- if ( current == head ) {
- return head;
- } else {
- current = (OMElement)current.getParent();
- }
- }
- }
- }
-
-
- }
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 2e11e31fec..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.xml.ws.WSPolicyProcessor;qname=http://schemas.xmlsoap.org/ws/2004/09/policy#Policy,model=org.apache.neethi.Policy
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestModelResolver.java
deleted file mode 100644
index b887257efe..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/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.policy.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-
-
-/**
- * A default implementation of an artifact resolver, based on a map.
- *
- * @version $Rev$ $Date$
- */
-public class TestModelResolver implements ModelResolver {
- private static final long serialVersionUID = -7826976465762296634L;
-
- private Map<Object, Object> map = new HashMap<Object, Object>();
-
- public TestModelResolver() {
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
- Object resolved = map.get(unresolved);
- if (resolved != null) {
-
- // Return the resolved object
- return modelClass.cast(resolved);
-
- } else {
-
- // Return the unresolved object
- return unresolved;
- }
- }
-
- public void addModel(Object resolved) {
- map.put(resolved, resolved);
- }
-
- public Object removeModel(Object resolved) {
- return map.remove(resolved);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java
deleted file mode 100644
index 8c138a57dd..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.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.policy.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
-
- public QName getArtifactType() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
- return new MockPolicyImplOne();
- }
-
- public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<Policy> getModelType() {
- // TODO Auto-generated method stub
- return Policy.class;
- }
-
- public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-
- public class MockPolicyImplOne implements Policy {
- public QName getSchemaName() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.java
deleted file mode 100644
index 13b3c44521..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/java/org/apache/tuscany/sca/policy/xml/WSPolicyProcessorTestCase.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.policy.xml;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.io.StringReader;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.policy.xml.ws.WSPolicyProcessor;
-
-import junit.framework.TestCase;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev$ $Date$
- */
-public class WSPolicyProcessorTestCase extends TestCase {
-
- private static final String VALID_WS_POLICY =
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<definitions xmlns=\"http://www.osoa.org/xmlns/sca/1.0\""
- + " targetNamespace=\"http://test\""
- + " xmlns:test=\"http://test\""
- + " xmlns:sca=\"http://www.osoa.org/xmlns/sca/1.0\">"
- + " "
- + " <policySet name=\"SecureWSPolicy\""
- + " provides=\"test:confidentiality\""
- + " appliesTo=\"sca:binding.ws\""
- + " xmlns=\"http://www.osoa.org/xmlns/sca/1.0\""
- + " xmlns:sp=\"http://schemas.xmlsoap.org/ws/2002/12/secext\""
- + " xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\">"
- + " <wsp:Policy>"
- + " <wsp:ExactlyOne>"
- + " <wsp:All>"
- + " <sp:SecurityToken>"
- + " <sp:TokenType>sp:X509v3</sp:TokenType>"
- + " </sp:SecurityToken>"
- + " <sp:UsernameToken />"
- + " <sp:SignedParts />"
- + " <sp:EncryptedParts>"
- + " <sp:Body />"
- + " </sp:EncryptedParts>"
- + " <sp:TransportBinding>"
- + " <sp:IncludeTimeStamp />"
- + " </sp:TransportBinding>"
- + " </wsp:All>"
- + " </wsp:ExactlyOne>"
- + " </wsp:Policy>"
- + " </policySet>"
- + " </definitions>";
-
- private XMLInputFactory inputFactory;
-
- @Override
- public void setUp() throws Exception {
- inputFactory = XMLInputFactory.newInstance();
-
- }
-
- public void testReadWsPolicy() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_WS_POLICY));
- WSPolicyProcessor processor = new WSPolicyProcessor();
- Object artifact = null;
-
- QName name = null;
- reader.next();
- while ( true ) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT: {
- name = reader.getName();
-
- if(WSPolicyProcessor.WS_POLICY_QNAME.equals(name)) {
- artifact = processor.read(reader);
- }
-
- break;
- }
- }
-
- if ( reader.hasNext() ) {
- reader.next();
- } else {
- break;
- }
- }
- assertNotNull(artifact);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
deleted file mode 100644
index 814476b4f9..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml-ws/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
+++ /dev/null
@@ -1,106 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://test"
- xmlns:test="http://test"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
-<policySet name="SecureWSPolicy"
- provides="test:confidentiality"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:Policy>
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SecurityToken>
- <sp:TokenType>sp:X509v3</sp:TokenType>
- </sp:SecurityToken>
- <sp:UsernameToken />
- <sp:SignedParts />
- <sp:EncryptedParts>
- <sp:Body />
- </sp:EncryptedParts>
- <sp:TransportBinding>
- <sp:IncludeTimeStamp />
- </sp:TransportBinding>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </policySet>
-
-<!-- profile intent -->
- <intent name="reliableMessageProtection"
- constrains="sca:binding"
- requires="test:messageProtection">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <intent name="messageProtection"
- constrains="sca:binding"
- requires="test:confidentiality test:integrity">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
-<!-- simple intent -->
- <intent name="confidentiality"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized users from reading the messages.
- </description>
- </intent>
-
- <intent name="integrity"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized modification of the messages.
- </description>
- </intent>
-
- <intent name="authentication"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding required
- Authentication.
- </description>
- </intent>
-
- <intent name="logging"
- constrains="sca:implementation">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-
- <intent name="tracing"
- constrains="sca:implementation.java">
- <description>
- Need to figure out some description for this
- </description>
- </intent>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/LICENSE b/branches/sca-java-1.5.1/modules/policy-xml/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-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-java-1.5.1/modules/policy-xml/NOTICE b/branches/sca-java-1.5.1/modules/policy-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/pom.xml b/branches/sca-java-1.5.1/modules/policy-xml/pom.xml
deleted file mode 100644
index e290d0f3f7..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/pom.xml
+++ /dev/null
@@ -1,76 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy-xml</artifactId>
- <name>Apache Tuscany SCA Policy XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-policy</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.java
deleted file mode 100644
index d47cbd7dbe..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/BindingTypeProcessor.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.policy.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
-
-
-/**
- * Processor for handling XML models of BindingType meta data definitions
- *
- * @version $Rev$ $Date$
- */
-public class BindingTypeProcessor extends IntentAttachPointTypeProcessor {
-
- public BindingTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- super(policyFactory, intentAttachPointTypeFactory, extensionProcessor, monitor);
- }
-
- public BindingTypeProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- super(modelFactories.getFactory(PolicyFactory.class),
- modelFactories.getFactory(IntentAttachPointTypeFactory.class), extensionProcessor, monitor);
- }
-
- public QName getArtifactType() {
- return BINDING_TYPE_QNAME;
- }
-
- @Override
- protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
- if ( extnType instanceof BindingTypeImpl ) {
- BindingTypeImpl bindingType = (BindingTypeImpl)extnType;
- return resolver.resolveModel(BindingTypeImpl.class, bindingType);
- } else {
- return extnType;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.java
deleted file mode 100644
index 119afa3473..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ImplementationTypeProcessor.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.policy.xml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
-
-
-/**
- * Processor for handling XML models of ImplementationType meta data definitions
- *
- * @version $Rev$ $Date$
- */
-public class ImplementationTypeProcessor extends IntentAttachPointTypeProcessor {
-
- public ImplementationTypeProcessor(PolicyFactory policyFactory, IntentAttachPointTypeFactory intentAttachPointTypeFactory,
- StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- super(policyFactory, intentAttachPointTypeFactory, extensionProcessor, monitor);
- }
-
- public ImplementationTypeProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- super(modelFactories.getFactory(PolicyFactory.class),
- modelFactories.getFactory(IntentAttachPointTypeFactory.class), extensionProcessor, monitor);
- }
-
- public QName getArtifactType() {
- return IMPLEMENTATION_TYPE_QNAME;
- }
-
- @Override
- protected IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
- if ( extnType instanceof ImplementationTypeImpl ) {
- ImplementationTypeImpl implType = (ImplementationTypeImpl)extnType;
- return resolver.resolveModel(ImplementationTypeImpl.class, implType);
- } else {
- return extnType;
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
deleted file mode 100644
index 37e547c620..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/IntentAttachPointTypeProcessor.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
-import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
-
-
-/**
- * Processor for handling XML models of ExtensionType meta data definitions
- *
- * @version $Rev$ $Date$
- */
-abstract class IntentAttachPointTypeProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<IntentAttachPointType>, PolicyConstants {
-
- private IntentAttachPointTypeFactory attachPointTypeFactory;
- private PolicyFactory policyFactory;
- private Monitor monitor;
-
- protected abstract IntentAttachPointType resolveExtensionType(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException;
-
- public IntentAttachPointTypeProcessor(PolicyFactory policyFactory,
- IntentAttachPointTypeFactory attachPointTypeFactory,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.policyFactory = policyFactory;
- this.attachPointTypeFactory = attachPointTypeFactory;
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public IntentAttachPointType read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- QName type = getQName(reader, TYPE);
-
- if ( type != null ) {
- if ( type.getLocalPart().startsWith(BINDING) ) {
- IntentAttachPointType bindingType = attachPointTypeFactory.createBindingType();
- bindingType.setName(type);
- bindingType.setUnresolved(true);
-
- readAlwaysProvidedIntents(bindingType, reader);
- readMayProvideIntents(bindingType, reader);
- return bindingType;
- } else if ( type.getLocalPart().startsWith(IMPLEMENTATION) ) {
- IntentAttachPointType implType = attachPointTypeFactory.createImplementationType();
- implType.setName(type);
- implType.setUnresolved(true);
-
- readAlwaysProvidedIntents(implType, reader);
- readMayProvideIntents(implType, reader);
- return implType;
- } else {
- error("UnrecognizedIntentAttachPointType", reader, type);
- //throw new ContributionReadException("Unrecognized IntentAttachPointType - " + type);
- }
- } else {
- error("RequiredAttributeMissing", reader, TYPE);
- //throw new ContributionReadException("Required attribute '" + TYPE +
- //"' missing from BindingType Definition");
- }
- return null;
- }
-
- private void readAlwaysProvidedIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, ALWAYS_PROVIDES);
- if (value != null) {
- List<Intent> alwaysProvided = extnType.getAlwaysProvidedIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- alwaysProvided.add(intent);
- }
- }
- }
-
- private void readMayProvideIntents(IntentAttachPointType extnType, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, MAY_PROVIDE);
- if (value != null) {
- List<Intent> mayProvide = extnType.getMayProvideIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- mayProvide.add(intent);
- }
- }
- }
-
- public void write(IntentAttachPointType extnType, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write an <sca:bindingType or sca:implementationType>
- if ( extnType instanceof BindingTypeImpl ) {
- writer.writeStartElement(SCA10_NS, BINDING_TYPE);
- } else if ( extnType instanceof ImplementationTypeImpl ) {
- writer.writeStartElement(SCA10_NS, IMPLEMENTATION_TYPE);
- }
-
- writeAlwaysProvidesIntentsAttribute(extnType, writer);
- writeMayProvideIntentsAttribute(extnType, writer);
-
- writer.writeEndElement();
- }
-
- private void writeMayProvideIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
- StringBuffer sb = new StringBuffer();
- for ( Intent intent : extnType.getMayProvideIntents() ) {
- writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
- sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
- sb.append(WHITE_SPACE);
- }
-
- if ( sb.length() > 0 ) {
- writer.writeAttribute(MAY_PROVIDE, sb.toString());
- }
- }
-
- private void writeAlwaysProvidesIntentsAttribute(IntentAttachPointType extnType, XMLStreamWriter writer) throws XMLStreamException {
- StringBuffer sb = new StringBuffer();
- for ( Intent intent : extnType.getAlwaysProvidedIntents() ) {
- writer.writeNamespace(intent.getName().getPrefix(), intent.getName().getNamespaceURI());
- sb.append(intent.getName().getPrefix() + COLON + intent.getName().getLocalPart());
- sb.append(WHITE_SPACE);
- }
-
- if ( sb.length() > 0 ) {
- writer.writeAttribute(ALWAYS_PROVIDES, sb.toString());
-
- }
- }
-
- public void resolve(IntentAttachPointType extnType, ModelResolver resolver) throws ContributionResolveException {
-
- if (extnType != null && extnType.isUnresolved()) {
- resolveAlwaysProvidedIntents(extnType, resolver);
- resolveMayProvideIntents(extnType, resolver);
- extnType.setUnresolved(false);
- //resolveExtensionType(extnType, resolver);
- }
- }
-
- private void resolveAlwaysProvidedIntents(IntentAttachPointType extensionType,
- ModelResolver resolver) throws ContributionResolveException {
- if (extensionType != null) {
- // resolve all provided intents
- List<Intent> alwaysProvided = new ArrayList<Intent>();
- for (Intent providedIntent : extensionType.getAlwaysProvidedIntents()) {
- if (providedIntent.isUnresolved()) {
- providedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (!providedIntent.isUnresolved()) {
- alwaysProvided.add(providedIntent);
- } else {
- error("AlwaysProvidedIntentNotFound", resolver, providedIntent, extensionType);
- //throw new ContributionResolveException("Always Provided Intent - " + providedIntent
- //+ " not found for ExtensionType "
- //+ extensionType);
- }
- } else {
- alwaysProvided.add(providedIntent);
- }
- }
- extensionType.getAlwaysProvidedIntents().clear();
- extensionType.getAlwaysProvidedIntents().addAll(alwaysProvided);
- }
- }
-
- private void resolveMayProvideIntents(IntentAttachPointType extensionType,
- ModelResolver resolver) throws ContributionResolveException {
- if (extensionType != null) {
- // resolve all provided intents
- List<Intent> mayProvide = new ArrayList<Intent>();
- for (Intent providedIntent : extensionType.getMayProvideIntents()) {
- if (providedIntent.isUnresolved()) {
- providedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (!providedIntent.isUnresolved()) {
- mayProvide.add(providedIntent);
- } else {
- error("MayProvideIntentNotFound", resolver, providedIntent, extensionType);
- //throw new ContributionResolveException("May Provide Intent - " + providedIntent
- //+ " not found for ExtensionType "
- //+ extensionType);
- }
- } else {
- mayProvide.add(providedIntent);
- }
- }
- extensionType.getMayProvideIntents().clear();
- extensionType.getMayProvideIntents().addAll(mayProvide);
- }
- }
-
- public Class<IntentAttachPointType> getModelType() {
- return IntentAttachPointType.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
deleted file mode 100644
index 3f1008e9a8..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyConstants.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.xml;
-
-import javax.xml.namespace.QName;
-
-/**
- * constants related to policy framework
- *
- * @version $Rev$ $Date$
- */
-public interface PolicyConstants {
- String WHITE_SPACE = " ";
- String COLON = ":";
- String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
- String TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
- String INTENT = "intent";
- String POLICY_SET = "policySet";
- String POLICY_SET_REFERENCE = "policySetReference";
- String INTENT_MAP = "intentMap";
- String NAME = "name";
- String TARGET_NAMESPACE = "targetNamespace";
- String SCA_DEFINITIONS = "definitions";
- String CONSTRAINS = "constrains";
- String DESCRIPTION = "description";
- String PROVIDES = "provides";
- String APPLIES_TO = "appliesTo";
- String ALWAYS_APPLIES_TO = "alwaysAppliesTo";
- String QUALIFIER = ".";
- String INTENT_MAP_QUALIFIER = "qualifier";
- String REQUIRES = "requires";
- String EXCLUDES = "excludes";
- String DEFAULT = "default";
-
- String ALWAYS_PROVIDES = "alwaysProvides";
- String MAY_PROVIDE = "mayProvide";
- String TYPE = "type";
- String IMPLEMENTATION_TYPE = "implementationType";
- String BINDING_TYPE = "bindingType";
- QName IMPLEMENTATION_TYPE_QNAME = new QName(SCA10_NS, IMPLEMENTATION_TYPE);
- QName BINDING_TYPE_QNAME = new QName(SCA10_NS, BINDING_TYPE);
- String BINDING = "binding";
- String IMPLEMENTATION = "implementation";
-
- QName POLICY_INTENT_QNAME = new QName(SCA10_NS, INTENT);
- QName POLICY_SET_QNAME = new QName(SCA10_NS, POLICY_SET);
- QName POLICY_INTENT_MAP_QNAME = new QName(SCA10_NS, INTENT_MAP);
- QName SCA_DEFINITIONS_QNAME = new QName(SCA10_NS, SCA_DEFINITIONS);
- QName DESCRIPTION_QNAME = new QName(SCA10_NS, DESCRIPTION);
- QName POLICY_INTENT_MAP_QUALIFIER_QNAME = new QName(SCA10_NS, INTENT_MAP_QUALIFIER);
- QName POLICY_SET_REFERENCE_QNAME = new QName(SCA10_NS, POLICY_SET_REFERENCE);
-
- String QUALIFIED_INTENT_CONSTRAINS_ERROR = " - Qualified Intents must not specify 'constrains' attribute";
-
-
-
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
deleted file mode 100644
index 3d14a141e6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
+++ /dev/null
@@ -1,417 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Processor for handling XML models of PolicyIntent definitions
- *
- * @version $Rev$ $Date$
- */
-abstract class PolicyIntentProcessor<T extends Intent> extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<T>, PolicyConstants {
-
- private PolicyFactory policyFactory;
- private Monitor monitor;
-
- public PolicyIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.monitor = monitor;
- }
-
- public PolicyIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
- this.policyFactory = policyFactory;
- this.monitor = monitor;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- Intent policyIntent = null;
- String policyIntentName = reader.getAttributeValue(null, NAME);
- if (policyIntentName == null) {
- error("IntentNameMissing", reader);
- return (T)policyIntent;
- }
-
- // Read an <sca:intent>
- if (reader.getAttributeValue(null, REQUIRES) != null) {
- policyIntent = policyFactory.createProfileIntent();
- } else if ( policyIntentName != null && policyIntentName.indexOf(QUALIFIER) != -1) {
- policyIntent = policyFactory.createQualifiedIntent();
-
- int qualifierIndex = policyIntentName.lastIndexOf(QUALIFIER);
- Intent qualifiableIntent = policyFactory.createIntent();
- qualifiableIntent.setUnresolved(true);
- qualifiableIntent.setName(new QName(policyIntentName.substring(0, qualifierIndex)));
-
- ((QualifiedIntent)policyIntent).setQualifiableIntent(qualifiableIntent);
- } else {
- policyIntent = policyFactory.createIntent();
- }
- policyIntent.setName(new QName(policyIntentName));
-
- if ( policyIntent instanceof ProfileIntent ) {
- readRequiredIntents((ProfileIntent)policyIntent, reader);
- }
- else {
- readExcludedIntents(policyIntent, reader);
- }
-
- readConstrainedArtifacts(policyIntent, reader);
-
- int event = reader.getEventType();
- QName name = null;
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if (DESCRIPTION_QNAME.equals(name)) {
- policyIntent.setDescription(reader.getElementText());
- }
- break;
- }
- }
- if (event == END_ELEMENT && POLICY_INTENT_QNAME.equals(reader.getName())) {
- break;
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- return (T)policyIntent;
- }
-
- public void write(T policyIntent, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
- // Write an <sca:intent>
- writer.writeStartElement(PolicyConstants.SCA10_NS, INTENT);
- writer.writeNamespace(policyIntent.getName().getPrefix(), policyIntent.getName().getNamespaceURI());
- writer.writeAttribute(PolicyConstants.NAME,
- policyIntent.getName().getPrefix() + COLON + policyIntent.getName().getLocalPart());
- if (policyIntent instanceof ProfileIntent) {
- ProfileIntent profileIntent = (ProfileIntent)policyIntent;
- if (profileIntent.getRequiredIntents() != null &&
- profileIntent.getRequiredIntents().size() > 0) {
- StringBuffer sb = new StringBuffer();
- for (Intent requiredIntents : profileIntent.getRequiredIntents()) {
- sb.append(requiredIntents.getName());
- sb.append(" ");
- }
- writer.writeAttribute(PolicyConstants.REQUIRES, sb.toString());
- }
- }
- else {
- if (policyIntent.getExcludedIntents() != null &&
- policyIntent.getExcludedIntents().size() > 0) {
- StringBuffer sb = new StringBuffer();
- for (Intent excludedIntents : policyIntent.getExcludedIntents()) {
- sb.append(excludedIntents.getName());
- sb.append(" ");
- }
- writer.writeAttribute(PolicyConstants.EXCLUDES, sb.toString());
- }
- }
-
- if (!(policyIntent instanceof QualifiedIntent) ) {
- if (policyIntent.getConstrains() != null &&
- policyIntent.getConstrains().size() > 0) {
- StringBuffer sb = new StringBuffer();
- for (QName contrainedArtifact : policyIntent.getConstrains()) {
- sb.append(contrainedArtifact.toString());
- sb.append(" ");
- }
- writer.writeAttribute(CONSTRAINS, sb.toString());
- } else {
- error("ContrainsAttributeMissing", policyIntent, policyIntent.getName());
- //throw new ContributionWriteException("Contrains attribute missing from " +
- //"Policy Intent Definition" + policyIntent.getName());
- }
- }
-
- if ( policyIntent.getDescription() != null && policyIntent.getDescription().length() > 0) {
- writer.writeStartElement(PolicyConstants.SCA10_NS, DESCRIPTION);
- writer.writeCData(policyIntent.getDescription());
- writer.writeEndElement();
- }
-
- writer.writeEndElement();
- }
-
- //FIXME This method is never used
-// private Intent resolveRequiredIntents(ProfileIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
-// boolean isUnresolved = false;
-// //FIXME: Need to check for cyclic references first i.e an A requiring B and then B requiring A...
-// if (policyIntent != null && policyIntent.isUnresolved()) {
-//
-// //resolve all required intents
-// List<Intent> requiredIntents = new ArrayList<Intent>();
-// for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
-// if ( requiredIntent.isUnresolved() ) {
-// //policyIntent.getRequiredIntents().remove(requiredIntent);
-// requiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
-// requiredIntents.add(requiredIntent);
-// if (requiredIntent.isUnresolved()) {
-// isUnresolved = true;
-// }
-// }
-// }
-// policyIntent.getRequiredIntents().clear();
-// policyIntent.getRequiredIntents().addAll(requiredIntents);
-// }
-// policyIntent.setUnresolved(isUnresolved);
-//
-// return policyIntent;
-// }
-
- //FIXME This method is never used
-// private Intent resolveQualifiableIntent(QualifiedIntent policyIntent, ModelResolver resolver) throws ContributionResolveException {
-// boolean isUnresolved = false;
-//
-// if (policyIntent != null && policyIntent.isUnresolved()) {
-// //resolve the qualifiable intent
-// Intent qualifiableIntent =
-// resolver.resolveModel(Intent.class, policyIntent.getQualifiableIntent());
-// policyIntent.setQualifiableIntent(qualifiableIntent);
-// isUnresolved = qualifiableIntent.isUnresolved();
-// }
-// policyIntent.setUnresolved(isUnresolved);
-//
-// return policyIntent;
-// }
-
- private void resolveContrainedArtifacts(Intent policyIntent, ModelResolver resolver) {
- //FIXME : need to figure out this resolution.
- policyIntent.setUnresolved(false);
- }
-
- private void resolveProfileIntent(ProfileIntent policyIntent, ModelResolver resolver)
- throws ContributionResolveException {
- // FIXME: Need to check for cyclic references first i.e an A requiring B
- // and then B requiring A...
- if (policyIntent != null) {
- // resolve all required intents
- List<Intent> requiredIntents = new ArrayList<Intent>();
- for (Intent requiredIntent : policyIntent.getRequiredIntents()) {
- if (requiredIntent.isUnresolved()) {
- Intent resolvedRequiredIntent = resolver.resolveModel(Intent.class, requiredIntent);
- // At this point, when the required intent is not resolved, it does not mean
- // its undeclared, chances are that their dependency are not resolved yet.
- // Lets try to resolve them first.
- if (resolvedRequiredIntent.isUnresolved()) {
- if (resolvedRequiredIntent instanceof ProfileIntent) {
- if ((((ProfileIntent)resolvedRequiredIntent).getRequiredIntents()).contains(policyIntent)) {
- error("CyclicReferenceFound", resolver, requiredIntent, policyIntent);
- return;
- }
- resolveDependent(resolvedRequiredIntent, resolver);
- }
- }
-
- if (!resolvedRequiredIntent.isUnresolved()) {
- requiredIntents.add(resolvedRequiredIntent);
- } else {
- error("RequiredIntentNotFound", resolver, requiredIntent, policyIntent);
- return;
- //throw new ContributionResolveException("Required Intent - " + requiredIntent
- //+ " not found for ProfileIntent " + policyIntent);
- }
- } else {
- requiredIntents.add(requiredIntent);
- }
- }
- policyIntent.getRequiredIntents().clear();
- policyIntent.getRequiredIntents().addAll(requiredIntents);
- }
- }
-
- private void resolveQualifiedIntent(QualifiedIntent policyIntent, ModelResolver resolver)
- throws ContributionResolveException {
- if (policyIntent != null) {
- //resolve the qualifiable intent
- Intent qualifiableIntent = policyIntent.getQualifiableIntent();
- if (qualifiableIntent.isUnresolved()) {
- Intent resolvedQualifiableIntent = resolver.resolveModel(Intent.class, qualifiableIntent);
- // At this point, when the qualifiable intent is not resolved, it does not mean
- // its undeclared, chances are that their dependency are not resolved yet.
- // Lets try to resolve them first.
- if (resolvedQualifiableIntent.isUnresolved()) {
- if (resolvedQualifiableIntent instanceof QualifiedIntent) {
- resolveDependent(resolvedQualifiableIntent, resolver);
- }
- }
-
- if (!resolvedQualifiableIntent.isUnresolved()) {
- policyIntent.setQualifiableIntent(resolvedQualifiableIntent);
- } else {
- error("QualifiableIntentNotFound", resolver, qualifiableIntent, policyIntent);
- //throw new ContributionResolveException("Qualifiable Intent - " + qualifiableIntent
- //+ " not found for QualifiedIntent " + policyIntent);
- }
- }
- }
- }
-
- public void resolveDependent(Intent policyIntent, ModelResolver resolver) throws ContributionResolveException {
- if (policyIntent instanceof ProfileIntent)
- resolveProfileIntent((ProfileIntent)policyIntent, resolver);
-
- if (policyIntent instanceof QualifiedIntent)
- resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
-
- resolveContrainedArtifacts(policyIntent, resolver);
- }
-
- public void resolve(T policyIntent, ModelResolver resolver) throws ContributionResolveException {
- if (policyIntent instanceof ProfileIntent) {
- resolveProfileIntent((ProfileIntent)policyIntent, resolver);
- }
- else {
- resolveExcludedIntents(policyIntent, resolver);
- }
-
- if (policyIntent instanceof QualifiedIntent) {
- resolveQualifiedIntent((QualifiedIntent)policyIntent, resolver);
- }
-
- resolveContrainedArtifacts(policyIntent, resolver);
-
- /* This is too late in the processing
- if ( !policyIntent.isUnresolved() ) {
- resolver.addModel(policyIntent);
- }
- */
- }
-
- public QName getArtifactType() {
- return POLICY_INTENT_QNAME;
- }
-
- private void readConstrainedArtifacts(Intent policyIntent, XMLStreamReader reader) throws ContributionReadException {
- String value = reader.getAttributeValue(null, CONSTRAINS);
- if ( policyIntent instanceof QualifiedIntent && value != null) {
- error("ErrorInPolicyIntentDefinition", policyIntent, policyIntent.getName(), QUALIFIED_INTENT_CONSTRAINS_ERROR);
- //String errorMsg = "Error in PolicyIntent Definition - " + policyIntent.getName() + QUALIFIED_INTENT_CONSTRAINS_ERROR;
- //throw new ContributionReadException(errorMsg);
- } else {
- if (value != null) {
- List<QName> constrainedArtifacts = policyIntent.getConstrains();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- constrainedArtifacts.add(qname);
- }
- }
- }
- }
-
- private void readRequiredIntents(ProfileIntent policyIntent, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, REQUIRES);
- if (value != null) {
- List<Intent> requiredIntents = policyIntent.getRequiredIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- intent.setUnresolved(true);
- requiredIntents.add(intent);
- }
- }
- }
-
- private void readExcludedIntents(Intent policyIntent, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, "excludes");
- if (value != null) {
- List<Intent> excludedIntents = policyIntent.getExcludedIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- intent.setUnresolved(true);
- excludedIntents.add(intent);
- }
- }
- }
-
- private void resolveExcludedIntents(Intent policyIntent, ModelResolver resolver)
- throws ContributionResolveException {
- if (policyIntent != null) {
- // resolve all excluded intents
- List<Intent> excludedIntents = new ArrayList<Intent>();
- for (Intent excludedIntent : policyIntent.getExcludedIntents()) {
- if (excludedIntent.isUnresolved()) {
- Intent resolvedExcludedIntent = resolver.resolveModel(Intent.class, excludedIntent);
- if (!resolvedExcludedIntent.isUnresolved()) {
- excludedIntents.add(resolvedExcludedIntent);
- } else {
- error("ExcludedIntentNotFound", resolver, excludedIntent, policyIntent);
- return;
- //throw new ContributionResolveException("Excluded Intent " + excludedIntent
- //+ " not found for intent " + policyIntent);
- }
- } else {
- excludedIntents.add(excludedIntent);
- }
- }
- policyIntent.getExcludedIntents().clear();
- policyIntent.getExcludedIntents().addAll(excludedIntents);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
deleted file mode 100644
index 6b03d54249..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-
-/**
- * Processor for handling XML models of PolicySet definitions
- *
- * @version $Rev$ $Date$
- */
-public class PolicySetProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<PolicySet>, PolicyConstants {
-
- private PolicyFactory policyFactory;
- private StAXArtifactProcessor<Object> extensionProcessor;
- private XPathFactory xpathFactory = XPathFactory.newInstance();
- private Monitor monitor;
-
- public PolicySetProcessor(ModelFactoryExtensionPoint modelFactories,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- public PolicySetProcessor(PolicyFactory policyFactory,
- StAXArtifactProcessor<Object> extensionProcessor,
- Monitor monitor) {
- this.policyFactory = policyFactory;
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "policy-xml-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public PolicySet read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- PolicySet policySet = null;
-
- String policySetName = reader.getAttributeValue(null, NAME);
- String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
- if (policySetName == null || appliesTo == null) {
- if (policySetName == null)
- error("PolicySetNameMissing", reader);
- if (appliesTo == null)
- error("PolicySetAppliesToMissing", reader);
- return policySet;
- }
-
- policySet = policyFactory.createPolicySet();
- policySet.setName(new QName(policySetName));
- String alwaysAppliesTo = reader.getAttributeValue(TUSCANY_NS, ALWAYS_APPLIES_TO);
-
- //TODO: with 1.0 version of specs the applies to xpath is given related to the immediate
- //parent whereas the runtime evaluates the xpath aginst the composite element. What the runtime
- //is doing is what the future version of the specs could be tending towards. When that happens
- //this 'if' must be deleted
- if ( appliesTo != null && !appliesTo.startsWith("/") ) {
- appliesTo = "//" + appliesTo;
- }
-
- if ( alwaysAppliesTo != null && !alwaysAppliesTo.startsWith("/") ) {
- alwaysAppliesTo = "//" + alwaysAppliesTo;
- }
-
- policySet.setAppliesTo(appliesTo);
- policySet.setAlwaysAppliesTo(alwaysAppliesTo);
-
- XPath path = xpathFactory.newXPath();
- path.setNamespaceContext(reader.getNamespaceContext());
- try {
- if (appliesTo != null) {
- policySet.setAppliesToXPathExpression(path.compile(appliesTo));
- }
- if (alwaysAppliesTo != null) {
- policySet.setAlwaysAppliesToXPathExpression(path.compile(alwaysAppliesTo));
- }
- } catch (XPathExpressionException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", policySet, ce);
- //throw ce;
- }
-
- readProvidedIntents(policySet, reader);
-
- int event = reader.getEventType();
- QName name = null;
- reader.next();
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
- Intent mappedIntent = policyFactory.createIntent();
- String provides = reader.getAttributeValue(null, PROVIDES);
- if (provides != null) {
- mappedIntent.setName(getQName(reader, PROVIDES));
- if ( policySet.getProvidedIntents().contains(mappedIntent) ) {
- readIntentMap(reader, policySet, mappedIntent);
- } else {
- error("IntentNotSpecified", policySet, policySetName);
- //throw new ContributionReadException("Intent Map provides for Intent not specified as provided by parent PolicySet - " + policySetName);
- }
- } else {
- error("IntentMapProvidesMissing", reader, policySetName);
- }
- } else if ( POLICY_SET_REFERENCE_QNAME.equals(name) ) {
- PolicySet referredPolicySet = policyFactory.createPolicySet();
- String referencename = reader.getAttributeValue(null, NAME);
- if (referencename != null) {
- referredPolicySet.setName(getQName(reader, NAME));
- policySet.getReferencedPolicySets().add(referredPolicySet);
- } else {
- error("PolicySetReferenceNameMissing", reader, policySetName);
- }
- } /*else if ( WS_POLICY_QNAME.equals(name) ) {
- OMElement policyElement = loadElement(reader);
- org.apache.neethi.Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
- policySet.getPolicies().add(wsPolicy);
- } */ else {
- Object extension = extensionProcessor.read(reader);
- if ( extension != null ) {
- policySet.getPolicies().add(extension);
- }
- }
- break;
- }
- }
- if ( event == END_ELEMENT ) {
- if ( POLICY_SET_QNAME.equals(reader.getName()) ) {
- break;
- }
- }
-
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- return policySet;
- }
-
-
- public void readIntentMap(XMLStreamReader reader, PolicySet policySet, Intent mappedIntent) throws ContributionReadException {
- QName name = reader.getName();
- Map<Intent, List<Object>> mappedPolicies = policySet.getMappedPolicies();
- if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
- //Intent mappedIntent = policyFactory.createIntent();
- //mappedIntent.setName(getQName(reader, PROVIDES));
- String defaultQualifier = getString(reader, DEFAULT);
-
- String qualifierName = null;
- String qualfiedIntentName = null;
- Intent qualifiedIntent = null;
-
- int event = reader.getEventType();
- try {
- reader.next();
- while (reader.hasNext()) {
- event = reader.getEventType();
- switch (event) {
- case START_ELEMENT : {
- name = reader.getName();
- if ( POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
- qualifierName = getString(reader, NAME);
- if (qualifierName != null) {
- qualfiedIntentName = mappedIntent.getName().getLocalPart() +
- QUALIFIER + qualifierName;
- qualifiedIntent = policyFactory.createIntent();
- qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
- qualfiedIntentName));
- } else {
- error("QualifierNameMissing", reader, policySet.getName());
- }
- } else if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
- QName providedIntent = getQName(reader, PROVIDES);
- if ( qualifierName.equals(providedIntent.getLocalPart()) ) {
- readIntentMap(reader, policySet, qualifiedIntent);
- } else {
- error("IntentMapDoesNotMatch", providedIntent, providedIntent, qualifierName, policySet);
- //throw new ContributionReadException("Intent provided by IntentMap " +
- //providedIntent + " does not match parent qualifier " + qualifierName +
- //" in policyset - " + policySet);
- }
- }/* else if ( WS_POLICY_QNAME.equals(name) ) {
- OMElement policyElement = loadElement(reader);
- Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
- policySet.getPolicies().add(wsPolicy);
-
- List<Object> policyList = mappedPolicies.get(qualifiedIntent);
- if ( policyList == null ) {
- policyList = new ArrayList<Object>();
- mappedPolicies.put(qualifiedIntent, policyList);
-
- if (qualifierName.equals(defaultQualifier)) {
- mappedPolicies.put(mappedIntent, policyList);
- }
- }
- policyList.add((Policy)wsPolicy);
- }*/ else {
- Object extension = extensionProcessor.read(reader);
- if ( extension != null && qualifiedIntent != null) {
- List<Object> policyList = mappedPolicies.get(qualifiedIntent);
- if ( policyList == null ) {
- policyList = new ArrayList<Object>();
- mappedPolicies.put(qualifiedIntent, policyList);
-
- if (qualifierName.equals(defaultQualifier)) {
- mappedPolicies.put(mappedIntent, policyList);
- }
- }
- policyList.add(extension);
- }
- }
- break;
- }
- case END_ELEMENT : {
- if ( POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
- if ( defaultQualifier != null ) {
- String qualifiedIntentName = mappedIntent.getName().getLocalPart() + QUALIFIER + defaultQualifier;
- Intent defaultQualifiedIntent = policyFactory.createIntent();
- defaultQualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
- qualifiedIntentName));
- List<Object> policyList = mappedPolicies.get(defaultQualifiedIntent);
- if ( policyList != null ) {
- mappedPolicies.put(mappedIntent, policyList);
- } else {
- error("UnableToMapPolicies", mappedPolicies, mappedIntent, policySet);
- //throw new ContributionReadException("Unable to map policies for default qualifier in IntentMap for - " +
- //mappedIntent + " in policy set - " + policySet);
- }
- defaultQualifier = null;
- }
- }
- break;
- }
- }
- if ( event == END_ELEMENT && POLICY_INTENT_MAP_QNAME.equals(reader.getName()) ) {
- break;
- }
- //Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", reader, ce);
- throw ce;
- }
- }
- }
-
- public void write(PolicySet policySet, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write an <sca:policySet>
- writer.writeStartElement(SCA10_NS, POLICY_SET);
- writer.writeNamespace(policySet.getName().getPrefix(), policySet.getName().getNamespaceURI());
- writer.writeAttribute(NAME,
- policySet.getName().getPrefix() + COLON + policySet.getName().getLocalPart());
- writer.writeAttribute(APPLIES_TO, policySet.getAppliesTo());
- writer.writeAttribute(TUSCANY_NS, ALWAYS_APPLIES_TO, policySet.getAlwaysAppliesTo());
-
- writeProvidedIntents(policySet, writer);
-
- writer.writeEndElement();
- }
-
- private void readProvidedIntents(PolicySet policySet, XMLStreamReader reader) {
- String value = reader.getAttributeValue(null, PROVIDES);
- if (value != null) {
- List<Intent> providedIntents = policySet.getProvidedIntents();
- for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();) {
- QName qname = getQNameValue(reader, tokens.nextToken());
- Intent intent = policyFactory.createIntent();
- intent.setName(qname);
- providedIntents.add(intent);
- }
- }
- }
-
- private void writeProvidedIntents(PolicySet policySet, XMLStreamWriter writer) throws XMLStreamException {
- if (policySet.getProvidedIntents() != null &&
- policySet.getProvidedIntents().size() > 0) {
- StringBuffer sb = new StringBuffer();
- for (Intent providedIntents : policySet.getProvidedIntents()) {
- sb.append(providedIntents.getName());
- sb.append(" ");
- }
- writer.writeAttribute(PolicyConstants.PROVIDES, sb.toString());
- }
- }
-
- private void resolvePolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
- boolean unresolved = false;
- if (policySet != null) {
- for ( Object o : policySet.getPolicies() ) {
- extensionProcessor.resolve(o, resolver);
- /*if ( o instanceof Policy && ((Policy)o).isUnresolved() ) {
- unresolved = true;
- }*/
- }
- policySet.setUnresolved(unresolved);
- }
- }
-
-
-
- public QName getArtifactType() {
- return POLICY_SET_QNAME;
- }
-
- public Class<PolicySet> getModelType() {
- return PolicySet.class;
- }
-
- private void resolveProvidedIntents(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
- if (policySet != null) {
- //resolve all provided intents
- List<Intent> providedIntents = new ArrayList<Intent>();
- for (Intent providedIntent : policySet.getProvidedIntents()) {
- if (providedIntent.isUnresolved()) {
- Intent resolvedProvidedIntent = resolver.resolveModel(Intent.class, providedIntent);
- if (!resolvedProvidedIntent.isUnresolved()) {
- providedIntents.add(resolvedProvidedIntent);
- } else {
- error("ProvidedIntentNotFound", policySet, providedIntent, policySet);
- return;
- //throw new ContributionResolveException("Provided Intent - " + providedIntent
- //+ " not found for PolicySet " + policySet);
- }
- } else {
- providedIntents.add(providedIntent);
- }
- }
- policySet.getProvidedIntents().clear();
- policySet.getProvidedIntents().addAll(providedIntents);
- }
- }
-
- private void resolveIntentsInMappedPolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
- Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
- for (Map.Entry<Intent, List<Object>> entry : policySet.getMappedPolicies().entrySet()) {
- Intent mappedIntent = entry.getKey();
- if (mappedIntent.isUnresolved()) {
- Intent resolvedMappedIntent = resolver.resolveModel(Intent.class, mappedIntent);
- if (!resolvedMappedIntent.isUnresolved()) {
- mappedPolicies.put(resolvedMappedIntent, entry.getValue());
- } else {
- error("MappedIntentNotFound", policySet, mappedIntent, policySet);
- return;
- //throw new ContributionResolveException("Mapped Intent - " + mappedIntent
- //+ " not found for PolicySet " + policySet);
- }
- } else {
- mappedPolicies.put(mappedIntent, entry.getValue());
- }
- }
-
- policySet.getMappedPolicies().clear();
- policySet.getMappedPolicies().putAll(mappedPolicies);
- }
-
- private void resolveReferredPolicySets(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
-
- List<PolicySet> referredPolicySets = new ArrayList<PolicySet>();
- for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
- if (referredPolicySet.isUnresolved()) {
- PolicySet resolvedReferredPolicySet = resolver.resolveModel(PolicySet.class, referredPolicySet);
- if (!resolvedReferredPolicySet.isUnresolved()) {
- referredPolicySets.add(resolvedReferredPolicySet);
- } else {
- error("ReferredPolicySetNotFound", policySet, referredPolicySet, policySet);
- return;
- //throw new ContributionResolveException("Referred PolicySet - " + referredPolicySet
- //+ "not found for PolicySet - " + policySet);
- }
- } else {
- referredPolicySets.add(referredPolicySet);
- }
- }
- policySet.getReferencedPolicySets().clear();
- policySet.getReferencedPolicySets().addAll(referredPolicySets);
- }
-
- private void includeReferredPolicySets(PolicySet policySet, PolicySet referredPolicySet) {
- for (PolicySet furtherReferredPolicySet : referredPolicySet.getReferencedPolicySets()) {
- includeReferredPolicySets(referredPolicySet, furtherReferredPolicySet);
- }
- policySet.getPolicies().addAll(referredPolicySet.getPolicies());
- policySet.getMappedPolicies().putAll(referredPolicySet.getMappedPolicies());
- }
-
- public void resolve(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException {
- resolveProvidedIntents(policySet, resolver);
- resolveIntentsInMappedPolicies(policySet, resolver);
- resolveReferredPolicySets(policySet, resolver);
-
- for (PolicySet referredPolicySet : policySet.getReferencedPolicySets()) {
- includeReferredPolicySets(policySet, referredPolicySet);
- }
-
- if ( policySet.isUnresolved() ) {
- //resolve the policy attachments
- resolvePolicies(policySet, resolver);
-
- /*if ( !policySet.isUnresolved() ) {
- resolver.addModel(policySet);
- }*/
- }
- }
- }
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.java
deleted file mode 100644
index 7c205292b0..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/ProfileIntentProcessor.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.policy.xml;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-
-/**
- * Processor for handling XML models of PolicyIntent definitions that are ProfileIntents
- *
- * @version $Rev$ $Date$
- */
-public class ProfileIntentProcessor extends PolicyIntentProcessor<ProfileIntent> {
-
- public ProfileIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
- super(policyFactory, monitor);
- }
-
- public ProfileIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- super(modelFactories, monitor);
- }
-
- public Class<ProfileIntent> getModelType() {
- return ProfileIntent.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.java
deleted file mode 100644
index abe80e2a54..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/QualifiedIntentProcessor.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.policy.xml;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Processor for handling XML models of PolicyIntent definitions that are QualifiedIntents
- *
- * @version $Rev$ $Date$
- */
-public class QualifiedIntentProcessor extends PolicyIntentProcessor<QualifiedIntent> {
-
- public QualifiedIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- super(modelFactories, monitor);
- }
-
- public QualifiedIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
- super(policyFactory, monitor);
- }
-
- public Class<QualifiedIntent> getModelType() {
- return QualifiedIntent.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.java
deleted file mode 100644
index 73795349c1..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/SimpleIntentProcessor.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.policy.xml;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * Processor for handling XML models of PolicyIntent definitions
- *
- * @version $Rev$ $Date$
- */
-public class SimpleIntentProcessor extends PolicyIntentProcessor<Intent> {
-
- public SimpleIntentProcessor(PolicyFactory policyFactory, Monitor monitor) {
- super(policyFactory, monitor);
- }
-
- public SimpleIntentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- super(modelFactories, monitor);
- }
-
- public Class<Intent> getModelType() {
- return Intent.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index c41a0cd01f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,24 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.policy.xml.BindingTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#bindingType,model=org.apache.tuscany.sca.policy.IntentAttachPointType
-org.apache.tuscany.sca.policy.xml.ImplementationTypeProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementationType,model=org.apache.tuscany.sca.policy.IntentAttachPointType
-org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.Intent
-org.apache.tuscany.sca.policy.xml.PolicySetProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#policySet,model=org.apache.tuscany.sca.policy.PolicySet
-org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.ProfileIntent
-org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#intent,model=org.apache.tuscany.sca.policy.QualifiedIntent
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
deleted file mode 100644
index 40107bb11e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
+++ /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.
-#
-#
-ReferredPolicySetNotFound = Referred PolicySet - {0} not found for PolicySet - {1}
-MappedIntentNotFound = Mapped Intent - {0} not found for PolicySet {1}
-ProvidedIntentNotFound = Provided Intent - {0} not found for PolicySet {1}
-UnableToMapPolicies = Unable to map policies for default qualifier in IntentMap for - {0} in policy set - {1}
-IntentMapDoesNotMatch = Intent provided by IntentMap {0} does not match parent qualifier {1} in policyset - {2}
-IntentNotSpecified = Intent Map provides for Intent not specified as provided by parent PolicySet - {0}
-ContrainsAttributeMissing = Constrains attribute missing from Policy Intent Definition {0}
-RequiredIntentNotFound = Required Intent - {0} not found for ProfileIntent {1}
-QualifiableIntentNotFound = Qualifiable Intent - {0} not found for QualifiedIntent {1}
-ErrorInPolicyIntentDefinition = Error in PolicyIntent Definition - {0} {1}
-ExcludedIntentNotFound = Excluded Intent {0} not found for intent {1}
-UnrecognizedIntentAttachPointType = Unrecognized IntentAttachPointType - {0}
-RequiredAttributeMissing = Required attribute {0} missing from BindingType Definition
-AlwaysProvidedIntentNotFound = Always Provided Intent - {0} not found for ExtensionType {1}
-MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
-ContributionReadException = ContributionReadException occurred due to: {0}
-CyclicReferenceFound = Cyclic reference detected in required attributes of ProfileIntents {0} and {1}
-IntentNameMissing = Required attribute "name" missing for Intent Definition
-PolicySetReferenceNameMissing = Required attribute "name" missing for PolicySetReference in PolicySet : {0}
-PolicySetNameMissing = Required attribute "name" missing for PolicySet Definition
-PolicySetAppliesToMissing = Required attribute "appliesTo" missing for PolicySet Definition
-IntentMapProvidesMissing = Required attribute "provides" missing for IntentMap in PolicySet : {0}
-QualifierNameMissing = Required attribute "name" missing for qualifier definition in PolicySet : {0}
-
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java b/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
deleted file mode 100644
index c9fad18157..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/ReadDocumentTestCase.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.xml;
-
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-import org.apache.tuscany.sca.policy.impl.BindingTypeImpl;
-import org.apache.tuscany.sca.policy.impl.ImplementationTypeImpl;
-
-/**
- * Test reading SCA XML assembly documents.
- *
- * @version $Rev: 551296 $ $Date: 2007-06-28 01:18:35 +0530 (Thu, 28 Jun 2007) $
- */
-public class ReadDocumentTestCase extends TestCase {
-
- private ModelResolver resolver;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- private static final QName elementToProcess = new QName("http://www.osoa.org/xmlns/sca/1.0", "implementationType");
-
- private Map<QName, Intent> intentTable = new Hashtable<QName, Intent>();
- private Map<QName, PolicySet> policySetTable = new Hashtable<QName, PolicySet>();
- private Map<QName, IntentAttachPointType> bindingTypesTable = new Hashtable<QName, IntentAttachPointType>();
- private Map<QName, IntentAttachPointType> implTypesTable = new Hashtable<QName, IntentAttachPointType>();
- private static final String scaNamespace = "http://www.osoa.org/xmlns/sca/1.0";
- private static final String namespace = "http://test";
-
- private static final QName confidentiality = new QName(namespace, "confidentiality");
- private static final QName integrity = new QName(namespace, "integrity");
- private static final QName messageProtection = new QName(namespace, "messageProtection");
- private static final QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- private static final QName confidentiality_message = new QName(namespace, "confidentiality.message");
- private static final QName secureReliablePolicy = new QName(namespace, "SecureReliablePolicy");
- private static final QName secureMessagingPolicies = new QName(namespace, "SecureMessagingPolicies");
- private static final QName securityPolicy = new QName(namespace, "SecurityPolicy");
- private static final QName basicAuthMsgProtSecurity = new QName(namespace, "BasicAuthMsgProtSecurity");
- private static final QName wsBinding = new QName(scaNamespace, "binding.ws");
- private static final QName javaImpl = new QName(scaNamespace, "implementation.java");
-
-
- @Override
- public void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- resolver = new DefaultModelResolver();
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- staxProcessors.addArtifactProcessor(new TestPolicyProcessor());
-
- URL url = getClass().getResource("test_definitions.xml");
- InputStream urlStream = url.openStream();
- XMLStreamReader reader = inputFactory.createXMLStreamReader(urlStream);
- reader.next();
-
- //position on the right element qname to get processed
- while(reader.hasNext()) {
- reader.next();
- int event = reader.getEventType();
- if(event == START_ELEMENT && reader.getName().equals(elementToProcess)) {
- break;
- }
- }
- while ( true ) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT: {
- Object artifact = staxProcessor.read(reader);
- if ( artifact instanceof PolicySet ) {
- PolicySet policySet = (PolicySet)artifact;
- policySet.setName(new QName(namespace, policySet.getName().getLocalPart()));
- policySetTable.put(policySet.getName(), policySet);
- } else if ( artifact instanceof Intent ) {
- Intent intent = (Intent)artifact;
- intent.setName(new QName(namespace, intent.getName().getLocalPart()));
- if ( intent instanceof QualifiedIntent ) {
- ((QualifiedIntent)intent).getQualifiableIntent().
- setName(new QName(namespace,
- ((QualifiedIntent)intent).getQualifiableIntent().getName().getLocalPart()));
- }
- intentTable.put(intent.getName(), intent);
- } else if ( artifact instanceof BindingTypeImpl ) {
- IntentAttachPointType bindingType = (IntentAttachPointType)artifact;
- bindingTypesTable.put(bindingType.getName(), bindingType);
- } else if ( artifact instanceof ImplementationTypeImpl ) {
- IntentAttachPointType implType = (IntentAttachPointType)artifact;
- implTypesTable.put(implType.getName(), implType);
- }
-
- if ( artifact != null ) {
- resolver.addModel(artifact);
- }
-
- break;
- }
- }
- if ( reader.hasNext() ) {
- reader.next();
- } else {
- break;
- }
- }
- urlStream.close();
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testReadSCADefinitions() throws Exception {
- assertNotNull(intentTable.get(confidentiality));
- assertNotNull(intentTable.get(messageProtection));
- assertNotNull(intentTable.get(confidentiality_transport));
- assertTrue(intentTable.get(confidentiality).getDescription().length() > 0 );
-
- assertNotNull(policySetTable.get(secureReliablePolicy));
- assertTrue(policySetTable.get(secureReliablePolicy).getProvidedIntents().size() == 2);
- assertTrue(policySetTable.get(secureReliablePolicy).getPolicies().size() == 2);
-
- assertNotNull(policySetTable.get(secureMessagingPolicies));
- assertEquals(policySetTable.get(secureMessagingPolicies).getMappedPolicies().size(), 3);
-
- assertEquals(bindingTypesTable.size(), 1);
- assertNotNull(bindingTypesTable.get(wsBinding));
- assertEquals(implTypesTable.size(), 1);
- assertNotNull(implTypesTable.get(javaImpl));
- }
-
- public void testResolution() throws Exception {
- assertTrue(intentTable.get(messageProtection) instanceof ProfileIntent);
- ProfileIntent profileIntent = (ProfileIntent)intentTable.get(new QName(namespace, "messageProtection"));
- assertNull(profileIntent.getRequiredIntents().get(0).getDescription());
-
- QName confidentiality_transport = new QName(namespace, "confidentiality.transport");
- assertTrue(intentTable.get(confidentiality_transport) instanceof QualifiedIntent);
- QualifiedIntent qualifiedIntent = (QualifiedIntent)intentTable.get(new QName(namespace, "confidentiality.transport"));
- assertNull(qualifiedIntent.getQualifiableIntent().getDescription());
-
- PolicySet secureReliablePolicySet = policySetTable.get(secureReliablePolicy);
- PolicySet secureMessagingPolicySet = policySetTable.get(secureMessagingPolicies);
- PolicySet securityPolicySet = policySetTable.get(securityPolicy);
-
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
- assertTrue(secureMessagingPolicySet.isUnresolved());
- assertEquals(securityPolicySet.getMappedPolicies().size(), 5);
-
- //testing to ensure that inclusion of referred policy sets has not happened
- PolicySet basicAuthMsgProtSecurityPolicySet = policySetTable.get(basicAuthMsgProtSecurity);
- assertTrue(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertTrue(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
-
- IntentAttachPointType wsBindingType = bindingTypesTable.get(wsBinding);
- assertNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
-
- IntentAttachPointType javaImplType = implTypesTable.get(javaImpl);
- assertNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNull(javaImplType.getMayProvideIntents().get(0).getDescription());
-
- List<Intent> simpleIntents = new ArrayList<Intent>();
- List<ProfileIntent> profileIntents = new ArrayList<ProfileIntent>();
- List<QualifiedIntent> qualifiedIntents = new ArrayList<QualifiedIntent>();
-
- for (Intent intent : intentTable.values()) {
- if (intent instanceof ProfileIntent)
- profileIntents.add((ProfileIntent)intent);
- else if (intent instanceof QualifiedIntent)
- qualifiedIntents.add((QualifiedIntent)intent);
- else simpleIntents.add(intent);
- }
-
- for (Intent intent : simpleIntents)
- staxProcessor.resolve(intent, resolver);
-
- for (ProfileIntent intent : profileIntents)
- staxProcessor.resolve(intent, resolver);
-
- for (QualifiedIntent intent : qualifiedIntents)
- staxProcessor.resolve(intent, resolver);
-
- for ( PolicySet policySet : policySetTable.values() ) {
- if (policySet.getReferencedPolicySets().isEmpty())
- staxProcessor.resolve(policySet, resolver);
- }
-
- for ( PolicySet policySet : policySetTable.values() ) {
- if (!policySet.getReferencedPolicySets().isEmpty())
- staxProcessor.resolve(policySet, resolver);
- }
-
- for ( IntentAttachPointType bindingType : bindingTypesTable.values() ) {
- staxProcessor.resolve(bindingType, resolver);
- }
-
- for ( IntentAttachPointType implType : implTypesTable.values() ) {
- staxProcessor.resolve(implType, resolver);
- }
-
- //testing if policy intents have been linked have property been linked up
- assertNotNull(profileIntent.getRequiredIntents().get(0).getDescription());
- assertNotNull(qualifiedIntent.getQualifiableIntent().getDescription());
- assertEquals(secureReliablePolicySet.getProvidedIntents().get(1).getName(), integrity);
- assertNotNull(secureReliablePolicySet.getProvidedIntents().get(1).getDescription());
-
- //testing if policysets have been properly linked up with intents
- assertFalse(secureMessagingPolicySet.isUnresolved());
- assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
- assertNotNull(secureMessagingPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
-
- //testing if intent maps have been properly mapped to policies
- assertFalse(securityPolicySet.isUnresolved());
- assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality)));
- assertNotNull(securityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_message)));
-
- //testing for inclusion of referred policysets
- assertFalse(basicAuthMsgProtSecurityPolicySet.getPolicies().isEmpty());
- assertFalse(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().isEmpty());
- assertNotNull(basicAuthMsgProtSecurityPolicySet.getMappedPolicies().get(intentTable.get(confidentiality_transport)));
-
- assertNotNull(wsBindingType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(wsBindingType.getMayProvideIntents().get(0).getDescription());
-
- assertNotNull(javaImplType.getAlwaysProvidedIntents().get(0).getDescription());
- assertNotNull(javaImplType.getMayProvideIntents().get(0).getDescription());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java b/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.java
deleted file mode 100644
index ce5b204787..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/test/java/org/apache/tuscany/sca/policy/xml/TestPolicyProcessor.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.policy.xml;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.policy.Policy;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class TestPolicyProcessor implements StAXArtifactProcessor<Policy> {
-
- public QName getArtifactType() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public Policy read(XMLStreamReader arg0) throws ContributionReadException, XMLStreamException {
- return new MockPolicyImplOne();
- }
-
- public void write(Policy arg0, XMLStreamWriter arg1) throws ContributionWriteException,
- XMLStreamException {
- }
-
- public Class<Policy> getModelType() {
- // TODO Auto-generated method stub
- return Policy.class;
- }
-
- public void resolve(Policy arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-
- public class MockPolicyImplOne implements Policy {
- public QName getSchemaName() {
- return new QName("http://schemas.xmlsoap.org/ws/2004/09/policy", "PolicyAttachment");
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml b/branches/sca-java-1.5.1/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
deleted file mode 100644
index b51a6fba98..0000000000
--- a/branches/sca-java-1.5.1/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
+++ /dev/null
@@ -1,255 +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.
--->
-<definitions xmlns="http://www.osoa.org/xmlns/sca/1.0"
- targetNamespace="http://test"
- xmlns:test="http://test"
- xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
-
-<!-- Extension Types Metadata -->
-<implementationType type="sca:implementation.java" alwaysProvides="test:logging"
- mayProvide="test:tracing"/>
-<bindingType type="sca:binding.ws" alwaysProvides="test:confidentiality"
- mayProvide="test:integrity"/>
-
-<!-- Intents and Policysets to assume targetnamespace -->
-<intent name="TestIntentOne"
- constrains="sca:binding">
- <description>
- Test Intent
- </description>
- </intent>
-
- <intent name="TestIntentTwo"
- constrains="sca:binding"
- requires="test:TestIntentOne">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <policySet name="TestPolicySetOne"
- provides="test:TestIntentOne"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
-
- <!-- qualified intents -->
- <intent name="confidentiality.transport" />
- <intent name="confidentiality.message" />
- <intent name="confidentiality.message.whole" />
- <intent name="confidentiality.message.body" />
-
- <!-- POLICY SETS -->
- <policySet name="SecureReliablePolicy"
- provides="test:confidentiality.transport test:integrity"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "basic authentication" -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for
- "reliability" -->
- </wsp:PolicyAttachment>
- </policySet>
-
- <policySet name="SecureMessagingPolicies"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport" alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message" alternative" -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="SecurityPolicy"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
- <intentMap provides="test:confidentiality" default="message">
- <qualifier name="message">
- <intentMap provides="message" default="whole">
- <qualifier name="body">
- <wsp:PolicyAttachment>
- <!-- policy attachment for body encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="whole">
- <wsp:PolicyAttachment>
- <!-- policy attachment for whole message encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
- </qualifier>
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy attachment for transport encryption -->
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="BasicAuthMsgProtSecurity"
- provides="test:authentication test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0">
- <policySetReference name="test:AuthenticationPolicies"/>
- <policySetReference name="test:ConfidentialityPolicies"/>
-</policySet>
-
-<policySet name="AuthenticationPolicies"
- provides="test:authentication"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "basic
- authentication" -->
- </wsp:PolicyAttachment>
-</policySet>
-
-<policySet name="ConfidentialityPolicies"
- provides="test:confidentiality"
- appliesTo="binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <intentMap provides="test:confidentiality" default="transport">
- <qualifier name="transport">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "transport"
- alternative -->
- </wsp:PolicyAttachment>
- <wsp:PolicyAttachment>...</wsp:PolicyAttachment>
- </qualifier>
- <qualifier name="message">
- <wsp:PolicyAttachment>
- <!-- policy expression and policy subject for "message"
- alternative" -->...
- </wsp:PolicyAttachment>
- </qualifier>
- </intentMap>
-</policySet>
-
-<policySet name="SecureWSPolicy"
- provides="test:confidentiality"
- appliesTo="sca:binding.ws"
- xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
- <wsp:Policy>
- <wsp:ExactlyOne>
- <wsp:All>
- <sp:SecurityToken>
- <sp:TokenType>sp:X509v3</sp:TokenType>
- </sp:SecurityToken>
- <sp:UsernameToken />
- <sp:SignedParts />
- <sp:EncryptedParts>
- <sp:Body />
- </sp:EncryptedParts>
- <sp:TransportBinding>
- <sp:IncludeTimeStamp />
- </sp:TransportBinding>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
- </policySet>
-
-<!-- profile intent -->
- <intent name="reliableMessageProtection"
- constrains="sca:binding"
- requires="test:messageProtection">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
- <intent name="messageProtection"
- constrains="sca:binding"
- requires="test:confidentiality test:integrity">
- <description>
- Protect messages from unauthorized reading or modification
- </description>
- </intent>
-
-<!-- simple intent -->
- <intent name="confidentiality"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized users from reading the messages.
- </description>
- </intent>
-
- <intent name="integrity"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding must prevent
- unauthorized modification of the messages.
- </description>
- </intent>
-
- <intent name="authentication"
- constrains="sca:binding">
- <description>
- Communitcation thro this binding required
- Authentication.
- </description>
- </intent>
-
- <intent name="logging"
- constrains="sca:implementation">
- <description>
- All messages to and from this implementation must be logged
- </description>
- </intent>
-
- <intent name="tracing"
- constrains="sca:implementation.java">
- <description>
- Need to figure out some description for this
- </description>
- </intent>
-
-</definitions> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy/LICENSE b/branches/sca-java-1.5.1/modules/policy/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/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-java-1.5.1/modules/policy/NOTICE b/branches/sca-java-1.5.1/modules/policy/NOTICE
deleted file mode 100644
index 644a49d98b..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/NOTICE
+++ /dev/null
@@ -1,5 +0,0 @@
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/policy/pom.xml b/branches/sca-java-1.5.1/modules/policy/pom.xml
deleted file mode 100644
index 84eac6ac61..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/pom.xml
+++ /dev/null
@@ -1,58 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-policy</artifactId>
- <name>Apache Tuscany SCA Policy Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-extensibility</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.policy</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.policy*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.java
deleted file mode 100644
index 6ca4fe72ec..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultIntentAttachPointTypeFactory.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.policy;
-
-import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
-
-/**
- * Default implementation for IntentAttachPointTypeFactory
- *
- * @version $Rev$ $Date$
- */
-public class DefaultIntentAttachPointTypeFactory extends IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory{
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.java
deleted file mode 100644
index 2da41675a1..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/DefaultPolicyFactory.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.policy;
-
-import org.apache.tuscany.sca.policy.impl.PolicyFactoryImpl;
-
-/**
- * A factory for the policy model.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultPolicyFactory extends PolicyFactoryImpl implements PolicyFactory {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.java
deleted file mode 100644
index 22f328f643..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Intent.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.policy;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * Represents a policy intent. See the Policy Framework specification for a
- * description of this element.
- *
- * @version $Rev$ $Date$
- */
-public interface Intent {
-
- /**
- * Returns the intent name.
- *
- * @return the intent name
- */
- QName getName();
-
- /**
- * Sets the intent name
- *
- * @param name the intent name
- */
- void setName(QName name);
-
- /**
- * Get the intent domain (the root intent name before any qualifiers)
- * @return the domain
- */
- String getDomain();
-
- /**
- * Get the intent qualifiers
- * @return the domain
- */
- String[] getQualifiedNames();
-
- /**
- * Returns the list of operations that this intent applies to.
- *
- * @return
- */
- //List<Operation> getOperations();
-
- /**
- * Returns the list of SCA constructs that this intent is meant to
- * configure.
- *
- * @return the list of SCA constructs that this intent is meant to configure
- */
- List<QName> getConstrains();
-
- /**
- * Returns the list of intents which are mutually exclusive with this intent.
- *
- * @return the list of mutually exclusive intents.
- */
- List<Intent> getExcludedIntents();
-
- /**
- * Returns the list of children qualified intents.
- *
- * @return the list of children qualified intents.
- */
- List<Intent> getQualifiedIntents();
-
- /**
- * Returns the intent description.
- *
- * @return the intent description
- */
- String getDescription();
-
- /**
- * Sets the intent description.
- *
- * @param description the intent description
- */
- void setDescription(String description);
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java
deleted file mode 100644
index bf2cfca924..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPoint.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-import java.util.List;
-
-/**
- * Base interface for all assembly model objects that can be have policy intents
- * attached to them.
- *
- * @version $Rev$ $Date$
- */
-public interface IntentAttachPoint {
-
- /**
- * Returns a list of policy intents. See the Policy Framework specification
- * for a description of this attribute.
- *
- * @return a list of policy intents.
- */
- List<Intent> getRequiredIntents();
-
-
- /**
- * Returns the type of the attach point such as a BindingType or an ImplementationType and so on
- * @return
- */
- IntentAttachPointType getType();
-
- /**
- *
- * Sets the type of the attach point such as a BindingType or an ImplementationType and so on
- * @param type
- */
- void setType(IntentAttachPointType type);
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.java
deleted file mode 100644
index 6db529c7f0..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointType.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.policy;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * Base interface for representing the model type of assembly model objects that can be have policy intents
- * attached to them.
- *
- * @version $Rev$ $Date$
- */
-public interface IntentAttachPointType {
-
- /**
- * Returns the name of the extension type defined by this instance e.g. implementation.java, binding.ws
- * @return the extension type QName
- */
- QName getName();
-
- /**
- * Sets the name of the extension type
- * @param type the name of the extension type
- */
- void setName(QName type);
-
- /**
- * Returns the list of names of policy intents that will always be provided by this Extension Type
- * @return list of Policy Intent names
- */
- List<Intent> getAlwaysProvidedIntents();
-
- /**
- * Returns the list of names of policy intents that may be provided by this Extension Type thro
- * appropriate configuration
- * @return list of Policy Intent names
- */
- List<Intent> getMayProvideIntents();
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.java
deleted file mode 100644
index ee67006875..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentAttachPointTypeFactory.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.policy;
-
-/**
- * Factory interface for creating extension types meta data
- *
- * @version $Rev$ $Date$
- */
-public interface IntentAttachPointTypeFactory {
-
- /**
- * Creates an ImplementationTypeImpl instance to hold metadata related to
- * a particular implementation extension in the SCA Domain
- *
- * @return an instance of IntentAttachPointType
- */
- IntentAttachPointType createImplementationType();
-
- /**
- * Creates an BindingTypeImpl instance to hold metadata related to
- * a particular binding extension in the SCA Domain
- *
- * @return an instance of IntentAttachPointType
- */
- IntentAttachPointType createBindingType();
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
deleted file mode 100644
index 1b225bc918..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/IntentMap.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-import java.util.List;
-
-/**
- * Represents a policy intent map. See the Policy Framework specification for a
- * description of this element.
- *
- * @version $Rev$ $Date$
- */
-public interface IntentMap {
-
- /**
- * Returns the intent realized by this intent map.
- *
- * @return the intent realized by this intent map
- */
- Intent getProvidedIntent();
-
- /**
- * Sets the intent realized by this intent map.
- *
- * @param providedIntent the intent realized by this intent map
- */
- void setProvidedIntent(Intent providedIntent);
-
- /**
- * Returns the default qualified intent map.
- *
- * @return the default qualified intent map
- */
- IntentMap getDefaultQualifiedIntentMap();
-
- /**
- * Sets the default qualified intent map.
- *
- * @param defaultQualifiedIntentMap the default qualified intent map
- */
- void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap);
-
- /**
- * Returns the list of children qualified intent maps.
- *
- * @return
- */
- List<IntentMap> getQualifiedIntentMaps();
-
- /**
- * Returns the list of concrete policies, either WS-Policy policy
- * attachments, policy references, or policies expressed in another policy
- * language.
- *
- * @return the list of concrete policies
- */
- List<Object> getPolicies();
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.java
deleted file mode 100644
index c6393e2ada..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/Policy.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.policy;
-
-import javax.xml.namespace.QName;
-
-/**
- * Interface that will abstract various types of policy specifications
- * and attachments for example WS-Policy
- *
- * @version $Rev$ $Date$
- */
-public interface Policy {
- QName getSchemaName();
- void setUnresolved(boolean unresolved);
- boolean isUnresolved();
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java
deleted file mode 100644
index 65c39803d2..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyContext.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy;
-
-import java.util.List;
-
-/**
- * A context container for policies.
- *
- * @version $Rev$ $Date$
- */
-public interface PolicyContext {
- List<Intent> getIntents(Object key);
- List<PolicySet> getPolicySets(Object key);
- void addIntents(Object key, List<Intent> intents);
- void addPolicySets(Object key, List<PolicySet> policySets);
- void addIntent(Object key, Intent intent);
- void addPolicySet(Object key, PolicySet policySet);
- void clearIntents(Object key);
- void clearPolicySets(Object key);
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
deleted file mode 100644
index 49bcbae1ae..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicyFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-/**
- * A factory for the policy model.
- *
- * @version $Rev$ $Date$
- */
-public interface PolicyFactory {
-
- /**
- * Create a new intent.
- *
- * @return a new intent
- */
- Intent createIntent();
-
- /**
- * Create a new policy set.
- *
- * @return a new policy set
- */
- PolicySet createPolicySet();
-
- /**
- * Create a new intent map.
- *
- * @return a new intent map
- */
- IntentMap createIntentMap();
-
- /**
- * create a new Profile Intent
- *
- * @return a ProfileIntent instance
- */
- ProfileIntent createProfileIntent();
-
- /**
- * create a new QualifiedIntent
- *
- * @return a QualifiedIntent instance
- */
- QualifiedIntent createQualifiedIntent();
-
- /**
- * create a new PolicySetReference
- *
- * @return a PolicySetReference instance
- */
- PolicySetReference createPolicySetReference();
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.java
deleted file mode 100644
index b16072c214..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySet.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.policy;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathExpression;
-
-/**
- * Represents a policy set. See the Policy Framework specification for a
- * description of this element.
- *
- * @version $Rev$ $Date$
- */
-public interface PolicySet {
-
- /**
- * Returns the intent name.
- *
- * @return the intent name
- */
- QName getName();
-
- /**
- * Sets the intent name
- *
- * @param name the intent name
- */
- void setName(QName name);
-
- /**
- * Returns the list of operations that this policy set applies to.
- *
- * @return
- */
- //List<Operation> getOperations();
- /**
- * Returns the list of
- *
- * @return
- */
- List<PolicySet> getReferencedPolicySets();
-
- /**
- * Returns the list of provided intents
- *
- * @return
- */
- List<Intent> getProvidedIntents();
-
- /**
- * Returns the list of concrete policies, either WS-Policy policy
- * attachments, policy references, or policies expressed in another policy
- * language.
- *
- * @return the list of concrete policies
- */
- List<Object> getPolicies();
-
- /**
- * Returns true if the model element is unresolved.
- *
- * @return true if the model element is unresolved.
- */
- boolean isUnresolved();
-
- /**
- * Sets whether the model element is unresolved.
- *
- * @param unresolved whether the model element is unresolved
- */
- void setUnresolved(boolean unresolved);
-
- /**
- * Returns the XPath expression that is to be used to evaluate
- * if this PolicySet applies to specific attachment point
- *
- * @return the XPath expression
- */
- String getAppliesTo();
-
- /**
- * Sets the XPath expression that is to be used to evaluate
- * if this PolicySet applies to specific attachment point
- *
- */
- void setAppliesTo(String xpath);
-
- /**
- * Returns the policies / policy attachments provided thro intent maps
- *
- * @return
- */
- Map<Intent, List<Object>> getMappedPolicies();
-
- /**
- * Gets the XPath expression that is to be used to evaluate
- * the SCA Artifacts that this policyset will always apply to
- * immaterial of an intent declared on the SCA Artifact
- *
- * @return the XPath expression
- */
- String getAlwaysAppliesTo();
-
- /**
- * Sets the XPath expression that is to be used to evaluate
- * the SCA Artifacts that this policyset will always apply to
- * immaterial of an intent declared on the SCA Artifact
- *
- */
- void setAlwaysAppliesTo(String xpath);
-
- /**
- * Get the XPath expression for the appliesTo attribute
- * @return the XPath expression for the appliesTo attribute
- */
- XPathExpression getAppliesToXPathExpression();
-
- /**
- * Set the XPath expression for the appliesTo attribute
- * @param xpathExpression the XPath expression for the appliesTo attribute
- */
- void setAppliesToXPathExpression(XPathExpression xpathExpression);
-
- /**
- * Get the XPath expression for the alwaysAppliesTo attribute
- * @return the XPath expression for the alwaysAppliesTo attribute
- */
- XPathExpression getAlwaysAppliesToXPathExpression();
-
- /**
- * Set the XPath expression for the alwaysAppliesTo attribute
- * @param xpathExpression the XPath expression for the alwaysAppliesTo attribute
- */
- void setAlwaysAppliesToXPathExpression(XPathExpression xpathExpression);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java
deleted file mode 100644
index f4156fc2e6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetAttachPoint.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-import java.util.List;
-
-/**
- * Base interface for all assembly model objects that can have policy sets
- * attached to them.
- *
- * @version $Rev$ $Date$
- */
-public interface PolicySetAttachPoint extends IntentAttachPoint {
-
- /**
- * Returns a list of policy sets. See the Policy Framework specification for
- * a description of this attribute.
- *
- * @return a list of policy sets.
- */
- List<PolicySet> getPolicySets();
-
-
- /**
- * Returns a list of policy sets defined in the domain, that are applicable to this
- * PolicySetAttachPoint. An applicable PolicySet is one that include this PolicySetAttachPoint
- * as part of its 'appliesTo' XPath attribute.
- *
- * @return a list of policy sets applicable to this PolicySetAttachPoint
- */
- List<PolicySet> getApplicablePolicySets();
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.java
deleted file mode 100644
index caa0d04fe3..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/PolicySetReference.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.policy;
-
-import javax.xml.namespace.QName;
-
-/**
- * Interface that abstracts a PolicySet Reference
- *
- * @version $Rev$ $Date$
- */
-public interface PolicySetReference {
-
- /**
- * Returns the name of the policyset being referred to
- *
- * @return the QName of the referred policyset
- */
- QName getReferredPolicySetName();
-
- /**
- * @param refPolicySetName the name of the policyset being referred to
- *
- */
- void setReferredPolicySetName(QName refPolicySetName);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.java
deleted file mode 100644
index 28ff9d09d3..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/ProfileIntent.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.policy;
-
-import java.util.List;
-
-/**
- * Interface that abstracts a profile intent
- *
- * @version $Rev$ $Date$
- */
-public interface ProfileIntent extends Intent {
- /**
- * Returns the list of required intents.
- *
- * @return the list of required intents
- */
- List<Intent> getRequiredIntents();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.java
deleted file mode 100644
index 0f43221dd6..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/QualifiedIntent.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.policy;
-
-/**
- * Abstracts a qualified policy intent
- *
- * @version $Rev$ $Date$
- */
-public interface QualifiedIntent extends Intent {
-
- /**
- * Returns the intent qualified by this intent
- *
- * @return
- */
- Intent getQualifiableIntent();
-
- /**
- * sets the qualifiable intent for this Qualified intent instance
- *
- * @param qualifiableIntent
- */
- void setQualifiableIntent(Intent qualifiableIntent);
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
deleted file mode 100644
index 0f8b1ae00a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-
-/**
- * Concrete implementation for a BindingType
- *
- * @version $Rev$ $Date$
- */
-public class BindingTypeImpl implements IntentAttachPointType {
-
- private List<Intent> alwaysProvides = new ArrayList<Intent>();
- private List<Intent> mayProvides = new ArrayList<Intent>();
- private QName typeName;
- private boolean unResolved = true;
-
- public List<Intent> getAlwaysProvidedIntents() {
- return alwaysProvides;
- }
-
- public List<Intent> getMayProvideIntents() {
- return mayProvides;
- }
-
- public QName getName() {
- return typeName;
- }
-
- public void setName(QName type) {
- this.typeName = type;
- }
-
- public boolean isUnresolved() {
- return unResolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unResolved = unresolved;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof BindingTypeImpl ) {
- if (getName() != null) {
- return getName().equals(((BindingTypeImpl)obj).getName());
- } else {
- return ((BindingTypeImpl)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return ( this.typeName != null ) ? getName().toString() : "null";
- }
-}
-; \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
deleted file mode 100644
index 7861fd79f9..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.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.policy.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-
-/**
- * Concrete implementation for a Implementation Type
- *
- * @version $Rev$ $Date$
- */
-public class ImplementationTypeImpl implements IntentAttachPointType {
- private List<Intent> alwaysProvides = new ArrayList<Intent>();
- private List<Intent> mayProvides = new ArrayList<Intent>();
- private QName typeName;
- private boolean unResolved = true;
-
- public List<Intent> getAlwaysProvidedIntents() {
- return alwaysProvides;
- }
-
- public List<Intent> getMayProvideIntents() {
- return mayProvides;
- }
-
- public QName getName() {
- return typeName;
- }
-
- public void setName(QName type) {
- this.typeName = type;
- }
-
- public boolean isUnresolved() {
- return unResolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unResolved = unresolved;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof ImplementationTypeImpl ) {
- if (getName() != null) {
- return getName().equals(((ImplementationTypeImpl)obj).getName());
- } else {
- return ((ImplementationTypeImpl)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return ( this.typeName != null ) ? getName().toString() : "null";
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java
deleted file mode 100644
index aa6e27c240..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentAttachPointTypeFactoryImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
-
-/**
- * Default implementation for IntentAttachPointTypeFactory
- *
- * @version $Rev$ $Date$
- */
-public class IntentAttachPointTypeFactoryImpl implements IntentAttachPointTypeFactory {
-
- public IntentAttachPointType createBindingType() {
- return new BindingTypeImpl();
- }
-
- public IntentAttachPointType createImplementationType() {
- return new ImplementationTypeImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
deleted file mode 100644
index 2d6bd0eb6f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentImpl.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-
-/**
- * Represents a policy intent.
- *
- * @version $Rev$ $Date$
- */
-public class IntentImpl implements Intent {
-
- private static final String QUALIFIED_SEPARATOR = ".";
- private static final String DOMAIN_SEPARATOR = ".";
- private QName name;
- //private List<Operation> operations = new ArrayList<Operation>();
- private List<QName> constrains = new ArrayList<QName>();
- private String description;
- private List<Intent> qualifiedIntents = new ArrayList<Intent>();
- // private List<Intent> requiredIntents = new ArrayList<Intent>();
- private List<Intent> excludedIntents = new ArrayList<Intent>();
- private boolean unresolved = true;
- private String domain;
- private String[] qualifiedNames;
-
- protected IntentImpl() {
- }
-
- public QName getName() {
- return name;
- }
-
- public void setName(QName name) {
- this.name = name;
- String iname = name.getLocalPart();
- int domainIdx = iname.indexOf(DOMAIN_SEPARATOR);
- if (domainIdx > -1) {
- domain = iname.substring(0, domainIdx);
- String qualifNamesStr = iname.substring(domainIdx + 1);
- String pattern = "\\" + QUALIFIED_SEPARATOR;
- qualifiedNames = qualifNamesStr.split(pattern);
- } else
- domain = iname;
- }
-
- public String getDomain() {
- return domain;
- }
-
- public String[] getQualifiedNames() {
- String[] results = new String[qualifiedNames.length];
- System.arraycopy(qualifiedNames, 0, results, 0, qualifiedNames.length);
- return results;
- }
-
- /*public List<Operation> getOperations() {
- return operations;
- }*/
-
- public List<QName> getConstrains() {
- return constrains;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List<Intent> getQualifiedIntents() {
- return qualifiedIntents;
- }
-
- public List<Intent> getExcludedIntents() {
- return excludedIntents;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- QName intentName = getName();
- result = prime * result + ((intentName == null) ? 0 : intentName.hashCode());
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IntentImpl)) {
- return false;
- }
- final IntentImpl other = (IntentImpl)obj;
- if (getName() == null) {
- if (other.getName() != null) {
- return false;
- }
- } else if (!getName().equals(other.getName())) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return String.valueOf(getName());
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java
deleted file mode 100644
index aab03281ba..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/IntentMapImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentMap;
-
-/**
- * Represents an intent map.
- *
- * @version $Rev$ $Date$
- */
-public class IntentMapImpl implements IntentMap {
-
- private boolean unresolved;
- private IntentMap defaultQualifiedIntentMap;
- private List<Object> policies;
- private Intent providedIntent;
- private List<IntentMap> qualifiedIntentMaps;
-
- protected IntentMapImpl() {
- }
-
- public IntentMap getDefaultQualifiedIntentMap() {
- return defaultQualifiedIntentMap;
- }
-
- public List<Object> getPolicies() {
- return policies;
- }
-
- public Intent getProvidedIntent() {
- return providedIntent;
- }
-
- public List<IntentMap> getQualifiedIntentMaps() {
- return qualifiedIntentMaps;
- }
-
- public void setDefaultQualifiedIntentMap(IntentMap defaultQualifiedIntentMap) {
- this.defaultQualifiedIntentMap = defaultQualifiedIntentMap;
- }
-
- public void setProvidedIntent(Intent providedIntent) {
- this.providedIntent = providedIntent;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.java
deleted file mode 100644
index a0e2f10f56..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyContextImpl.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.policy.impl;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicyContext;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class PolicyContextImpl implements PolicyContext {
- private Map<Object, List<Intent>> intents = new Hashtable<Object , List<Intent>>();
- private Map<Object, List<PolicySet>> policySets = new Hashtable<Object, List<PolicySet>>();
-
- public void addIntent(Object key, Intent intent) {
- if ( intents.get(key) == null ) {
- intents.put(key, new ArrayList<Intent>());
- }
- intents.get(key).add(intent);
- }
-
- public void addIntents(Object key, List<Intent> intents) {
- if ( this.intents.get(key) == null ) {
- this.intents.put(key, new ArrayList<Intent>());
- }
- this.intents.get(key).addAll(intents);
- }
-
- public void addPolicySet(Object key, PolicySet policySet) {
- if ( policySets.get(key) == null ) {
- policySets.put(key, new ArrayList<PolicySet>());
- }
- policySets.get(key).add(policySet);
- }
-
- public void addPolicySets(Object key, List<PolicySet> policySets) {
- if ( this.policySets.get(key) == null ) {
- this.policySets.put(key, new ArrayList<PolicySet>());
- }
- this.policySets.get(key).addAll(policySets);
- }
-
- public List<Intent> getIntents(Object key) {
- if ( intents.get(key) == null ) {
- intents.put(key, new ArrayList<Intent>());
- }
- return intents.get(key);
- }
-
- public List<PolicySet> getPolicySets(Object key) {
- if ( policySets.get(key) == null ) {
- policySets.put(key, new ArrayList<PolicySet>());
- }
- return policySets.get(key);
- }
-
- public void clearIntents(Object key) {
- if ( intents.get(key) != null ) {
- intents.clear();
- }
- }
-
- public void clearPolicySets(Object key) {
- if ( policySets.get(key) != null ) {
- policySets.clear();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
deleted file mode 100644
index 1db29b835e..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicyFactoryImpl.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentMap;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetReference;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * A factory for the policy model.
- *
- * @version $Rev$ $Date$
- */
-public abstract class PolicyFactoryImpl implements PolicyFactory {
-
- public Intent createIntent() {
- return new IntentImpl();
- }
-
- public PolicySetReference createPolicySetReference() {
- return new PolicySetReferenceImpl();
- }
-
- public PolicySet createPolicySet() {
- return new PolicySetImpl();
- }
-
- public IntentMap createIntentMap() {
- return new IntentMapImpl();
- }
-
- public ProfileIntent createProfileIntent() {
- return new ProfileIntentImpl();
- }
-
- public QualifiedIntent createQualifiedIntent() {
- return new QualifiedIntentImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
deleted file mode 100644
index 179a10cc1a..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetImpl.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.xpath.XPathExpression;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Represents a policy set.
- *
- * @version $Rev$ $Date$
- */
-public class PolicySetImpl implements PolicySet {
-
- private QName name;
- //private List<Operation> operations = new ArrayList<Operation>();
- //private List<QName> appliesTo;
- private String appliesTo;
- private List<Intent> providedIntents = new ArrayList<Intent>();
- private List<PolicySet> referencedPolicySets = new ArrayList<PolicySet>();
- private List<Object> policies = new ArrayList<Object>();
- Map<Intent, List<Object>> mappedPolicies = new Hashtable<Intent, List<Object>>();
- private boolean unresolved = true;
- private String alwaysAppliesTo;
-
- private XPathExpression appliesToXPathExpression;
- private XPathExpression alwaysAppliesToXPathExpression;
-
- public String getAlwaysAppliesTo() {
- return alwaysAppliesTo;
- }
-
- public void setAlwaysAppliesTo(String alwaysAppliesTo) {
- this.alwaysAppliesTo = alwaysAppliesTo;
- }
-
- protected PolicySetImpl() {
- }
-
- public QName getName() {
- return name;
- }
-
- public void setName(QName name) {
- this.name = name;
- }
-
- /*public List<Operation> getOperations() {
- return operations;
- }*/
-
- public String getAppliesTo() {
- return appliesTo;
- }
-
- public void setAppliesTo(String appliesTo) {
- this.appliesTo = appliesTo;
- }
-
- public List<Intent> getProvidedIntents() {
- return providedIntents;
- }
-
- public List<PolicySet> getReferencedPolicySets() {
- return referencedPolicySets;
- }
-
- public List<Object> getPolicies() {
- return policies;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public Map<Intent, List<Object>> getMappedPolicies() {
- return mappedPolicies;
- }
-
- @Override
- public int hashCode() {
- return String.valueOf(getName()).hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- } else if (obj instanceof PolicySet) {
- if (getName() != null) {
- return getName().equals(((PolicySet)obj).getName());
- } else {
- return ((PolicySet)obj).getName() == null;
- }
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return ( this.name != null ) ? getName().toString() : "null";
- }
-
- public XPathExpression getAppliesToXPathExpression() {
- return appliesToXPathExpression;
- }
-
- public void setAppliesToXPathExpression(XPathExpression appliesToXPathExpression) {
- this.appliesToXPathExpression = appliesToXPathExpression;
- }
-
- public XPathExpression getAlwaysAppliesToXPathExpression() {
- return alwaysAppliesToXPathExpression;
- }
-
- public void setAlwaysAppliesToXPathExpression(XPathExpression alwaysAppliesToXPathExpression) {
- this.alwaysAppliesToXPathExpression = alwaysAppliesToXPathExpression;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java
deleted file mode 100644
index 98a116fe7b..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/PolicySetReferenceImpl.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.PolicySetReference;
-
-/**
- * Concrete implementation for a PolicySetReference
- *
- * @version $Rev$ $Date$
- */
-public class PolicySetReferenceImpl implements PolicySetReference {
-
- private QName referredPolicySetName = null;
-
- /*
- * @see org.apache.tuscany.sca.policy.PolicySetReference#getReferredPolicySetName()
- */
- public QName getReferredPolicySetName() {
- return referredPolicySetName;
- }
-
- /*
- * @see org.apache.tuscany.sca.policy.PolicySetReference#setReferredPolicySetName(javax.xml.namespace.QName)
- */
- public void setReferredPolicySetName(QName refPolicySetName) {
- referredPolicySetName = refPolicySetName;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java
deleted file mode 100644
index e5002d2cdc..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ProfileIntentImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-
-/**
- * Concrete implementation for Profile Intent
- *
- * @version $Rev$ $Date$
- */
-public class ProfileIntentImpl extends IntentImpl implements ProfileIntent {
- private List<Intent> requiredIntents = new ArrayList<Intent>();
-
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java
deleted file mode 100644
index d6f65b1788..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/QualifiedIntentImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy.impl;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.QualifiedIntent;
-
-/**
- * Models a concrete implementation of a Qualified Intent
- *
- * @version $Rev$ $Date$
- */
-public class QualifiedIntentImpl extends IntentImpl implements QualifiedIntent {
- private Intent qualifiableIntent = null;
-
- public Intent getQualifiableIntent() {
- return qualifiableIntent;
- }
-
- public void setQualifiableIntent(Intent qualifiableIntent) {
- this.qualifiableIntent = qualifiableIntent;
- }
-
- @Override
- public List<QName> getConstrains() {
- return getQualifiableIntent().getConstrains();
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
deleted file mode 100644
index 2e4c6a9d78..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyComputationUtils.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.util;
-
-import static javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
-
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.ProfileIntent;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * Utility methods used during computation of PolicyIntents and PolicySets sets
- *
- * @version $Rev$ $Date$
- */
-public class PolicyComputationUtils {
- private static final String POLICYSET_PREFIX = "tp_";
- private static final String APPLICABLE_POLICYSET_ATTR_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
- private static final String APPLICABLE_POLICYSET_ATTR = "applicablePolicySets";
- private static final String POLICY_SETS_ATTR = "policySets";
- private static final String APPLICABLE_POLICYSET_ATTR_PREFIX = "tuscany";
- private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- /**
- * This method unconditionally adds intents from the source list to the target list.
- * It is used for intermediate intent inheritance between promotion levels
- * (e.g. between a composite service and a component service). It does not check
- * whether there are conflicting (mutually exclusive) intents. This is because
- * promotion cannot override intents. If the resulting target list has conflicting
- * intents, this will be detected later during policy computation.
- */
- public static void addInheritedIntents(List<Intent> sourceList, List<Intent> targetList) {
- if (sourceList != null) {
- targetList.addAll(sourceList);
- }
- }
-
- public static void addInheritedPolicySets(List<PolicySet> sourceList,
- List<PolicySet> targetList,
- boolean checkOverrides) {
- // check overrides is true when policysets are to be copied from
- // componentType to component level
- if (checkOverrides) {
- // aggregate all the provided intents present in the target
- List<Intent> targetProvidedIntents = new ArrayList<Intent>();
- for (PolicySet policySet : targetList) {
- targetProvidedIntents.addAll(policySet.getProvidedIntents());
- }
-
- // for every policy set in the source check if it provides one of
- // the intents that is
- // already provided by the policysets in the destination and do not
- // copy them.
- for (PolicySet policySet : sourceList) {
- for (Intent sourceProvidedIntent : policySet.getProvidedIntents()) {
- if (!targetProvidedIntents.contains(sourceProvidedIntent)) {
- targetList.add(policySet);
- }
- }
- }
- } else {
- targetList.addAll(sourceList);
- }
- }
-
- /**
- * This method is used to inherit intents and policy sets between hierarchical levels
- * within the same composite (e.g. between a component and its services and references).
- * In this case the source intents and policy sets provide defaults which are inherited
- * into the target lists only when there is no conflict. For example consider a component
- * with 3 references. The component level requires intent 'propagatesTransaction'.
- * Reference 1 and 2 do not specify an intent, but reference 3 requires 'suspendsTransaction'.
- * In this case the 'propagatesTransaction' intent is inherited by reference 1 and 2
- * but not by reference 3.
- */
- public static void addDefaultPolicies(List<Intent> sourceIntents,
- List<PolicySet> sourcePolicySets,
- List<Intent> targetIntents,
- List<PolicySet> targetPolicySets)
- {
- // form a list of all intents required by the target
- List<Intent> combinedTargetIntents = new ArrayList<Intent>();
- combinedTargetIntents.addAll(findAndExpandProfileIntents(targetIntents));
- for (PolicySet targetPolicySet : targetPolicySets) {
- combinedTargetIntents.addAll(findAndExpandProfileIntents(targetPolicySet.getProvidedIntents()));
- }
-
- // inherit intents in the source list that do not conflict with intents already in the target list
- for (Intent sourceIntent : findAndExpandProfileIntents(sourceIntents)) {
- boolean conflict = false;
- for (Intent excluded : sourceIntent.getExcludedIntents()) {
- if (combinedTargetIntents.contains(excluded)) {
- conflict = true;
- break;
- }
- }
- if (!conflict) {
- targetIntents.add(sourceIntent);
- }
- }
-
- // inherit policy sets in the source list that do not conflict with policy sets or intents
- // in the target list
- for (PolicySet sourcePolicySet : sourcePolicySets) {
- boolean conflict = false;
- List<Intent> providedIntents = findAndExpandProfileIntents(sourcePolicySet.getProvidedIntents());
- checkConflict: for (Intent intent : providedIntents) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (combinedTargetIntents.contains(excluded)) {
- conflict = true;
- break checkConflict;
- }
- }
- }
- if (!conflict)
- targetPolicySets.add(sourcePolicySet);
- }
-
- }
-
- public static void checkForMutuallyExclusiveIntents(
- List<Intent> intents,
- List<PolicySet> policySets,
- IntentAttachPointType intentAttachPointType,
- String id) throws PolicyValidationException
- {
- // gather all intents (keeping track of where they come from)
- Map<Intent, PolicySet> combinedIntents = new HashMap<Intent,PolicySet>();
- for (PolicySet policySet : policySets) {
- for (Intent providedIntent : findAndExpandProfileIntents(policySet.getProvidedIntents())) {
- combinedIntents.put(providedIntent, policySet);
- }
- }
- for (Intent intent : intents) {
- combinedIntents.put(intent, null);
- }
-
- // check for conflicts
- for (Intent intent : combinedIntents.keySet()) {
- for (Intent excluded : intent.getExcludedIntents()) {
- if (combinedIntents.keySet().contains(excluded)) {
- String sIntent1, sIntent2;
- if (combinedIntents.get(intent) == null)
- sIntent1 = intent.getName().toString();
- else
- sIntent1 = intent.getName().toString() + " in policy set " + combinedIntents.get(intent).getName().toString();
- if (combinedIntents.get(excluded) == null)
- sIntent2 = excluded.getName().toString();
- else
- sIntent2 = excluded.getName().toString() + " in policy set " + combinedIntents.get(excluded).getName().toString();
- throw new PolicyValidationException(
- intentAttachPointType.getName() + " for " + id +
- " uses mutually-exclusive intents " + sIntent1 + " and " + sIntent2);
- }
- }
- }
- }
-
- public static void expandProfileIntents(List<Intent> intents) {
- List<Intent> expandedIntents = null;
- if ( intents.size() > 0 ) {
- expandedIntents = findAndExpandProfileIntents(intents);
- intents.clear();
- intents.addAll(expandedIntents);
- }
- }
-
- public static List<Intent> findAndExpandProfileIntents(List<Intent> intents) {
- List<Intent> expandedIntents = new ArrayList<Intent>();
- for ( Intent intent : intents ) {
- if ( intent instanceof ProfileIntent ) {
- ProfileIntent profileIntent = (ProfileIntent)intent;
- List<Intent> requiredIntents = profileIntent.getRequiredIntents();
- expandedIntents.addAll(findAndExpandProfileIntents(requiredIntents));
- } else {
- expandedIntents.add(intent);
- }
- }
- return expandedIntents;
- }
-
- private static byte[] addApplicablePolicySets(Document doc, Collection<PolicySet> policySets)
- throws XPathExpressionException, TransformerConfigurationException, TransformerException {
-
- for (PolicySet policySet : policySets) {
- if (policySet.getAppliesTo() != null) {
- addApplicablePolicySets(policySet, doc);
- }
-
- if (policySet.getAlwaysAppliesTo() != null) {
- addAlwaysApplicablePolicySets(policySet, doc);
- }
- }
-
- StringWriter sw = new StringWriter();
- final Source domSource = new DOMSource(doc);
- final Result finalResult = new StreamResult(sw);
- final Transformer transformer = TransformerFactory.newInstance().newTransformer();
- // transformer.setOutputProperty("omit-xml-declaration", "yes");
- // Allow priviledged access to let transformers read property files. Requires
- // PropertyPermission in security policy.
- try {
- AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
- public Object run() throws TransformerException {
- transformer.transform(domSource, finalResult);
- return null;
- }
- });
- } catch (PrivilegedActionException e) {
- throw (TransformerException)e.getException();
- }
-
- return sw.toString().getBytes();
- }
-
- private static void addAlwaysApplicablePolicySets(PolicySet policySet,
- Document doc) throws XPathExpressionException {
- XPathExpression expression = policySet.getAlwaysAppliesToXPathExpression();
- NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
-
- if (result != null) {
- for (int counter = 0; counter < result.getLength(); ++counter) {
- Node aResultNode = result.item(counter);
-
- String alwaysApplicablePolicySets = null;
-
- String policySetPrefix =
- declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
- String policySetsAttrPrefix =
- declareNamespace((Element)aResultNode, SCA10_NS);
- if (aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR) != null) {
- alwaysApplicablePolicySets =
- aResultNode.getAttributes().getNamedItem(POLICY_SETS_ATTR).getNodeValue();
- }
-
- if (alwaysApplicablePolicySets != null && alwaysApplicablePolicySets.length() > 0) {
- alwaysApplicablePolicySets =
- alwaysApplicablePolicySets + " "
- + policySetPrefix
- + ":"
- + policySet.getName().getLocalPart();
- } else {
- alwaysApplicablePolicySets =
- policySetPrefix + ":" + policySet.getName().getLocalPart();
- }
-
- ((Element)aResultNode).setAttribute(POLICY_SETS_ATTR, alwaysApplicablePolicySets);
- }
- }
- }
-
- private static void addApplicablePolicySets(PolicySet policySet,
- Document doc) throws XPathExpressionException {
- XPathExpression expression = policySet.getAppliesToXPathExpression();
- NodeList result = (NodeList)expression.evaluate(doc, XPathConstants.NODESET);
-
- if (result != null) {
- for (int counter = 0; counter < result.getLength(); ++counter) {
- Node aResultNode = result.item(counter);
-
- String applicablePolicySets = null;
-
- String policySetPrefix =
- declareNamespace((Element)aResultNode, policySet.getName().getNamespaceURI());
- String appPolicyAttrPrefix =
- declareNamespace((Element)aResultNode,
- APPLICABLE_POLICYSET_ATTR_NS);
- if (aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
- APPLICABLE_POLICYSET_ATTR) != null) {
- applicablePolicySets =
- aResultNode.getAttributes().getNamedItemNS(APPLICABLE_POLICYSET_ATTR_NS,
- APPLICABLE_POLICYSET_ATTR)
- .getNodeValue();
- }
-
- if (applicablePolicySets != null && applicablePolicySets.length() > 0) {
- applicablePolicySets =
- applicablePolicySets + " "
- + policySetPrefix
- + ":"
- + policySet.getName().getLocalPart();
- } else {
- applicablePolicySets =
- policySetPrefix + ":" + policySet.getName().getLocalPart();
- }
-
- ((Element)aResultNode).setAttributeNS(APPLICABLE_POLICYSET_ATTR_NS,
- appPolicyAttrPrefix + ":"
- + APPLICABLE_POLICYSET_ATTR,
- applicablePolicySets);
- }
- }
- }
-
- public static byte[] addApplicablePolicySets(InputStream is, Collection<PolicySet> domainPolicySets, DocumentBuilderFactory documentBuilderFactory) throws Exception {
- documentBuilderFactory.setNamespaceAware(true);
- DocumentBuilder db = documentBuilderFactory.newDocumentBuilder();
- Document doc = db.parse(is);
- is.close();
- return addApplicablePolicySets(doc, domainPolicySets);
- }
-
- private static class DOMNamespaceContext implements NamespaceContext {
- private Node node;
-
- /**
- * @param node
- */
- public DOMNamespaceContext(Node node) {
- super();
- this.node = node;
- }
-
- public String getNamespaceURI(String prefix) {
- return node.lookupNamespaceURI(prefix);
- }
-
- public String getPrefix(String namespaceURI) {
- return node.lookupPrefix(namespaceURI);
- }
-
- public Iterator<?> getPrefixes(String namespaceURI) {
- return null;
- }
-
- }
-
- private static String declareNamespace(Element element, String ns) {
- if (ns == null) {
- ns = "";
- }
- Node node = element;
- String prefix = "";
- boolean declared = false;
- while (node != null && node.getNodeType() == Node.ELEMENT_NODE) {
- if ( node.lookupPrefix(ns) != null ) {
- prefix = node.lookupPrefix(ns);
- declared = true;
- break;
- } else {
- /*NamedNodeMap attrs = node.getAttributes();
- if (attrs == null) {
- break;
- }
- Node attr = attrs.getNamedItem(qname);
- if (attr != null) {
- declared = ns.equals(attr.getNodeValue());
- break;
- }*/
- node = node.getParentNode();
- }
- }
- if (!declared) {
- // Find an available prefix
- for (int i=1; ; i++) {
- prefix = POLICYSET_PREFIX + i;
- if (element.lookupNamespaceURI(prefix) == null) {
- break;
- }
- }
- String qname = "xmlns:" + prefix;
- org.w3c.dom.Attr attr = element.getOwnerDocument().createAttributeNS(XMLNS_ATTRIBUTE_NS_URI, qname);
- attr.setValue(ns);
- element.setAttributeNodeNS(attr);
- }
- return prefix;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java
deleted file mode 100644
index 1f91710f95..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.util;
-
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * @deprecated This interface is replaced by PolicyProviderFactory/PolicyProvider SPIs
- * Handler interface for handling policies defined in policysets
- *
- * @version $Rev$ $Date$
- */
-@Deprecated
-public interface PolicyHandler {
- PolicySet getApplicablePolicySet();
- void setApplicablePolicySet(PolicySet policySet);
- void setUp(Object... context);
- void cleanUp(Object... context);
- void beforeInvoke(Object... context);
- void afterInvoke(Object... context);
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java
deleted file mode 100644
index 3a37ed3c41..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerDefinitionsLoader.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.util;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-
-/**
- * Utility class for loading policy handler definitions from META-INF/services directories
- *
- * @version $Rev$ $Date$
- */
-public class PolicyHandlerDefinitionsLoader {
-
- public static List<PolicyHandlerTuple> loadPolicyHandlerClassnames() {
- // Get the processor service declarations
- Set<ServiceDeclaration> sds;
- try {
- sds = ServiceDiscovery.getInstance().getServiceDeclarations(PolicyHandler.class);
- } catch (IOException e) {
- throw new IllegalStateException(e);
- }
-
- List<PolicyHandlerTuple> handlerTupleList = new ArrayList<PolicyHandlerTuple>();
-
- Map<Object, List<PolicyHandlerTuple>> handlerTuples = new Hashtable<Object, List<PolicyHandlerTuple>>();
- for (ServiceDeclaration sd : sds) {
- Map<String, String> attributes = sd.getAttributes();
- String intentName = attributes.get("intent");
- QName intentQName = getQName(intentName);
- String policyModelClassName = attributes.get("model");
- String appliesTo = attributes.get("appliesTo");
- if ( appliesTo != null && !appliesTo.startsWith("/") ) {
- appliesTo = "//" + appliesTo;
- }
- handlerTupleList.add(new PolicyHandlerTuple(sd, sd.getClassName(), intentQName, policyModelClassName, appliesTo));
- }
-
- return handlerTupleList;
- }
-
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: " + qname);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.java
deleted file mode 100644
index c80e68a0be..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerTuple.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.policy.util;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-
-/**
- * PolicyHanlder tuples stored in policy handler services files
- *
- * @version $Rev$ $Date$
- */
-public class PolicyHandlerTuple {
- private ServiceDeclaration declaration;
- private String policyHandlerClassName;
- private QName providedIntentName;
- private String policyModelClassName;
- private String appliesTo;
-
- public PolicyHandlerTuple(ServiceDeclaration declaration,
- String handlerClassName,
- QName providedIntentName,
- String policyModelClassName,
- String appliesTo) {
- this.declaration = declaration;
- this.policyHandlerClassName = handlerClassName;
- this.providedIntentName = providedIntentName;
- this.policyModelClassName = policyModelClassName;
- this.appliesTo = appliesTo;
- }
-
- public ServiceDeclaration getDeclaration() {
- return declaration;
- }
-
- public void setDeclaration(ServiceDeclaration declaration) {
- this.declaration = declaration;
- }
-
- public String getAppliesTo() {
- return appliesTo;
- }
-
- public void setAppliesTo(String appliesTo) {
- this.appliesTo = appliesTo;
- }
-
-
- public String getPolicyHandlerClassName() {
- return policyHandlerClassName;
- }
- public void setPolicyHandlerClassName(String policyHandlerClassName) {
- this.policyHandlerClassName = policyHandlerClassName;
- }
- public String getPolicyModelClassName() {
- return policyModelClassName;
- }
- public void setPolicyModelClassName(String policyModelClassName) {
- this.policyModelClassName = policyModelClassName;
- }
- public QName getProvidedIntentName() {
- return providedIntentName;
- }
- public void setProvidedIntentName(QName providedIntentName) {
- this.providedIntentName = providedIntentName;
- }
-
- @Override
- public String toString() {
- return policyHandlerClassName + ", " + providedIntentName + ", " + policyModelClassName + ", " + appliesTo;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java
deleted file mode 100644
index 6d6420017f..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyHandlerUtils.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.util;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.PolicySet;
-
-/**
- * Utility methods to deal with PolicyHandlers
- *
- * @version $Rev$ $Date$
- */
-public class PolicyHandlerUtils {
- public static PolicyHandler findPolicyHandler(PolicySet policySet, List<PolicyHandlerTuple> policyHandlerClassNames)
- throws IllegalAccessException, ClassNotFoundException, InstantiationException {
-
- PolicyHandler handler = null;
-
- for (PolicyHandlerTuple handlerTuple : policyHandlerClassNames) {
- //System.out.println(handlerTuple);
- for (Intent intent : policySet.getProvidedIntents()) {
- if (intent.getName().equals(handlerTuple.getProvidedIntentName())) {
- for (Object policy : policySet.getPolicies()) {
- if (policy.getClass().getName().equals(handlerTuple.getPolicyModelClassName())) {
- if (handlerTuple.getAppliesTo() != null) {
- if (handlerTuple.getAppliesTo().equals(policySet.getAppliesTo())) {
- handler = (PolicyHandler)handlerTuple.getDeclaration().loadClass().newInstance();
- handler.setApplicablePolicySet(policySet);
- return handler;
- }
- } else {
- handler = (PolicyHandler)handlerTuple.getDeclaration().loadClass().newInstance();
- handler.setApplicablePolicySet(policySet);
- return handler;
- }
- }
- }
- }
- }
- }
-
- return handler;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java
deleted file mode 100644
index eb97818042..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationException.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.policy.util;
-
-/**
- * Exception to be throw for invalid policy intents / policysets
- *
- * @version $Rev$ $Date$
- */
-public class PolicyValidationException extends Exception {
- private static final long serialVersionUID = 506979037642587755L;
-
- public PolicyValidationException(String message) {
- super(message);
- }
-
- public PolicyValidationException(Throwable e) {
- super(e);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java b/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.java
deleted file mode 100644
index afb3c035ae..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/java/org/apache/tuscany/sca/policy/util/PolicyValidationUtils.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.policy.util;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPoint;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * @version $Rev$ $Date$
- */
-public class PolicyValidationUtils {
-
- public static boolean isConstrained(QName constrained, IntentAttachPointType attachPointType) {
- return (attachPointType != null && attachPointType.getName().getNamespaceURI()
- .equals(constrained.getNamespaceURI()) && attachPointType.getName().getLocalPart()
- .startsWith(constrained.getLocalPart()));
- }
-
- public static void validateIntents(IntentAttachPoint attachPoint,
- IntentAttachPointType attachPointType)
- throws PolicyValidationException {
- boolean found = false;
- if (attachPointType != null) {
- // validate intents specified against the parent (binding /
- // implementation)
- found = false;
- for (Intent intent : attachPoint.getRequiredIntents()) {
- if (!intent.isUnresolved()) {
- for (QName constrained : intent.getConstrains()) {
- if (isConstrained(constrained, attachPointType)) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- throw new PolicyValidationException("Policy Intent '" + intent.getName()
- + "' does not constrain extension type "
- + attachPointType.getName());
- }
- } else {
- throw new PolicyValidationException("Policy Intent '" + intent.getName()
- + "' is not defined in this domain ");
- }
- }
- }
- }
-
- public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint)
- throws PolicyValidationException {
- validatePolicySets(policySetAttachPoint,
- policySetAttachPoint.getType(),
- policySetAttachPoint.getApplicablePolicySets());
- }
-
- public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
- IntentAttachPointType attachPointType)
- throws PolicyValidationException {
- validatePolicySets(policySetAttachPoint,
- attachPointType,
- policySetAttachPoint.getApplicablePolicySets());
- }
-
- public static void validatePolicySets(PolicySetAttachPoint policySetAttachPoint,
- IntentAttachPointType attachPointType,
- List<PolicySet> applicablePolicySets)
- throws PolicyValidationException {
- // Since the applicablePolicySets in a policySetAttachPoint will already
- // have the list of policysets that might ever be applicable to this attachPoint,
- // just check if the defined policysets feature in the list of applicable
- // policysets
- for (PolicySet definedPolicySet : policySetAttachPoint.getPolicySets()) {
- if (!definedPolicySet.isUnresolved()) {
- if (!applicablePolicySets.contains(definedPolicySet)) {
- throw new PolicyValidationException("Policy Set '" + definedPolicySet
- .getName()
- + "' does not apply to extension type "
- + attachPointType.getName());
- }
- } else {
- throw new PolicyValidationException("Policy Set '" + definedPolicySet.getName()
- + "' is not defined in this domain ");
-
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory b/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
deleted file mode 100644
index a0e56c1822..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory
+++ /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.policy.DefaultIntentAttachPointTypeFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory b/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
deleted file mode 100644
index 846b3b24a4..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/main/resources/META-INF/services/org.apache.tuscany.sca.policy.PolicyFactory
+++ /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.policy.DefaultPolicyFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java b/branches/sca-java-1.5.1/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java
deleted file mode 100644
index 636ff5ab45..0000000000
--- a/branches/sca-java-1.5.1/modules/policy/src/test/java/org/apache/tuscany/sca/policy/PolicyFactoryTestCase.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.policy;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-/**
- * Test building of policy model instances using the policy factory.
- *
- * @version $Rev$ $Date$
- */
-public class PolicyFactoryTestCase extends TestCase {
-
- PolicyFactory factory;
-
- @Override
- public void setUp() throws Exception {
- factory = new DefaultPolicyFactory();
- }
-
- public void testCreateIntent() {
- Intent intent = factory.createIntent();
- intent.setName(new QName("http://test", "reliability"));
- assertEquals(intent.getName(), new QName("http://test", "reliability"));
- }
-
- public void testCreatePolicySet() {
- PolicySet policySet = factory.createPolicySet();
- policySet.setName(new QName("http://test", "reliability"));
- assertEquals(policySet.getName(), new QName("http://test", "reliability"));
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/pom.xml b/branches/sca-java-1.5.1/modules/pom.xml
deleted file mode 100644
index 844a0834ab..0000000000
--- a/branches/sca-java-1.5.1/modules/pom.xml
+++ /dev/null
@@ -1,234 +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-sca</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-modules</artifactId>
- <packaging>pom</packaging>
- <name>Apache Tuscany SCA Implementation Modules</name>
-
- <properties>
- <tuscany.version>1.5</tuscany.version>
- </properties>
-
- <profiles>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>assembly</module>
- <module>assembly-xml</module>
- <module>assembly-xsd</module>
- <module>binding-corba</module>
- <module>binding-corba-runtime</module>
- <module>binding-dwr</module>
- <module>binding-ejb</module>
- <module>binding-ejb-runtime</module>
- <module>binding-atom</module>
- <module>binding-atom-js</module>
- <module>binding-atom-js-dojo</module>
- <module>binding-atom-abdera</module>
- <module>binding-gdata</module>
- <module>binding-gdata-runtime</module>
- <module>binding-http</module>
- <module>binding-http-runtime</module>
- <module>binding-http-jsonrpc</module>
- <module>binding-http-jsonrpc-runtime</module>
- <module>binding-jms</module>
- <module>binding-jms-runtime</module>
- <module>binding-jms-policy</module>
- <module>binding-jsonrpc</module>
- <module>binding-jsonrpc-js</module>
- <module>binding-jsonrpc-js-dojo</module>
- <module>binding-jsonrpc-runtime</module>
- <module>binding-notification</module>
- <module>binding-rmi</module>
- <module>binding-rmi-runtime</module>
- <module>binding-rss</module>
- <module>binding-rss-rome</module>
- <module>binding-sca</module>
- <module>binding-sca-axis2</module>
- <module>binding-sca-corba</module>
- <module>binding-sca-xml</module>
- <module>binding-ws</module>
- <module>binding-ws-axis2</module>
- <module>binding-ws-axis2-policy</module>
- <module>binding-ws-wsdlgen</module>
- <module>binding-ws-xml</module>
- <module>contribution</module>
- <module>contribution-groovy</module>
- <module>contribution-namespace</module>
- <module>contribution-java</module>
- <module>contribution-impl</module>
- <module>contribution-osgi</module>
- <module>contribution-resource</module>
- <module>contribution-xml</module>
- <module>contribution-jee</module>
- <module>contribution-jee-impl</module>
- <module>core</module>
- <module>core-databinding</module>
- <module>core-spi</module>
- <module>data-api</module>
- <module>databinding</module>
- <module>databinding-axiom</module>
- <module>databinding-jaxb</module>
- <module>databinding-jaxb-axiom</module>
- <module>databinding-sdo</module>
- <module>databinding-sdo-axiom</module>
- <module>databinding-json</module>
- <module>databinding-saxon</module>
- <module>databinding-xmlbeans</module>
- <module>databinding-fastinfoset</module>
- <module>definitions</module>
- <module>definitions-xml</module>
- <module>domain-manager</module>
- <module>endpoint</module>
- <module>extensibility</module>
- <module>extensibility-osgi</module>
- <module>extension-helper</module>
- <module>host-corba</module>
- <module>host-corba-jee</module>
- <module>host-corba-jse</module>
- <module>host-corba-jse-tns</module>
- <module>host-embedded</module>
- <module>host-http</module>
- <module>host-jms</module>
- <module>host-jms-asf</module>
- <module>host-jetty</module>
- <module>host-rmi</module>
- <module>host-tomcat</module>
- <module>host-webapp</module>
- <module>interface</module>
- <module>interface-java</module>
- <module>interface-java-jaxws</module>
- <module>interface-java-xml</module>
- <module>interface-wsdl</module>
- <module>interface-wsdl-xml</module>
- <module>implementation-bpel</module>
- <module>implementation-bpel-ode</module>
- <module>implementation-ejb</module>
- <module>implementation-java</module>
- <module>implementation-java-xml</module>
- <module>implementation-java-runtime</module>
- <module>implementation-jee</module>
- <module>implementation-node</module>
- <module>implementation-node-runtime</module>
- <module>implementation-notification</module>
- <module>implementation-osgi</module>
- <module>implementation-resource</module>
- <module>implementation-resource-runtime</module>
- <module>implementation-script</module>
- <module>implementation-spring</module>
- <module>implementation-spring-runtime</module>
- <module>implementation-web</module>
- <module>implementation-web-runtime</module>
- <module>implementation-widget</module>
- <module>implementation-widget-runtime</module>
- <module>implementation-widget-runtime-tuscany</module>
- <module>implementation-widget-runtime-dojo</module>
- <module>implementation-xquery</module>
- <module>monitor</module>
- <module>node-api</module>
- <module>node-impl</module>
- <module>node-launcher</module>
- <module>node-launcher-osgi</module>
- <module>node-manager</module>
- <module>osgi-runtime</module>
- <module>policy</module>
- <module>policy-xml</module>
- <module>policy-xml-ws</module>
- <module>policy-logging</module>
- <module>policy-reliability</module>
- <module>policy-security</module>
- <module>policy-security-geronimo</module>
- <module>policy-security-http</module>
- <module>policy-security-jsr250</module>
- <module>policy-transaction</module>
- <module>sca-api</module>
- <module>sca-api-extension</module>
- <module>web-javascript</module>
- <module>web-javascript-dojo</module>
- <module>workspace</module>
- <module>workspace-impl</module>
- <module>workspace-xml</module>
- <module>workspace-manager</module>
- <module>xsd</module>
- <module>xsd-xml</module>
- <module>tracing-aspectj</module>
- </modules>
- </profile>
-
- </profiles>
-
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymock</artifactId>
- <version>2.4</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifestFile>
- ${project.build.outputDirectory}/META-INF/MANIFEST.MF
- </manifestFile>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>1.4.3</version>
- <extensions>true</extensions>
- <executions>
- <execution>
- <id>bundle-manifest</id>
- <phase>process-classes</phase>
- <goals>
- <goal>manifest</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/sca-api-extension/LICENSE b/branches/sca-java-1.5.1/modules/sca-api-extension/LICENSE
deleted file mode 100644
index d645695673..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api-extension/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, 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-java-1.5.1/modules/sca-api-extension/NOTICE b/branches/sca-java-1.5.1/modules/sca-api-extension/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api-extension/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api-extension/pom.xml b/branches/sca-java-1.5.1/modules/sca-api-extension/pom.xml
deleted file mode 100644
index d153e39869..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api-extension/pom.xml
+++ /dev/null
@@ -1,62 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api-extension</artifactId>
- <name>Apache Tuscany SCA API Extension</name>
-
- <description>Extensions to the API classes for the Service Component Architecture</description>
- <packaging>jar</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>1.5</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.api</Bundle-SymbolicName>
- <Bundle-Description>${pom.description}</Bundle-Description>
- <Export-Package>org.osoa.sca*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/sca-api-extension/src/main/java/org/apache/tuscany/sca/api/ComponentContextExtension.java b/branches/sca-java-1.5.1/modules/sca-api-extension/src/main/java/org/apache/tuscany/sca/api/ComponentContextExtension.java
deleted file mode 100644
index 578df9e017..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api-extension/src/main/java/org/apache/tuscany/sca/api/ComponentContextExtension.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.api;
-
-import java.util.Collection;
-
-import org.osoa.sca.ComponentContext;
-import org.osoa.sca.ServiceReference;
-
-/**
- * An extension of the OSOA ComponentContext that provides access to collections
- * of references.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentContextExtension extends ComponentContext {
-
-
- /* ******************** Contribution for issue TUSCANY-2281 ******************** */
-
- /**
- * Returns a Collection of typed service proxies for a business interface type and a reference name.
- * @param businessInterface the interface that will be used to invoke the service
- * @param referenceName the name of the reference
- * @param <B> the Java type of the business interface for the reference
- * @return a Collection of objects that implements the business interface
- */
- <B> Collection<B> getServices(Class<B> businessInterface, String referenceName);
-
-
- /**
- * Returns a Collection of typed service reference for a business interface type and a reference name.
- * @param businessInterface the interface that will be used to invoke the service
- * @param referenceName the name of the reference
- * @param <B> the Java type of the business interface for the reference
- * @return a Collection of objects that implements the business interface
- */
- <B> Collection<ServiceReference<B>> getServiceReferences(Class<B> businessInterface, String referenceName);
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/LICENSE b/branches/sca-java-1.5.1/modules/sca-api/LICENSE
deleted file mode 100644
index 617c69079b..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/LICENSE
+++ /dev/null
@@ -1,243 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-===============================================================================
-
-Apache Tuscany SCA for Java Subcomponents
-=========================================:
-
-The Tuscany SCA for Java release includes a number of subcomponents with
-separate copyright notices and license terms. Your use of the source
-code for the these subcomponents is subject to the terms and
-conditions of the following licenses.
-
-===============================================================================
-The module sca-api includes a number of files under the following license:
-
-Permission to copy, display and distribute the Service Component Architecture Specification and/or
-portions thereof, without modification, in any medium without fee or royalty is hereby granted, provided
-that you include the following on ALL copies of the Service Component Architecture Specification, or
-portions thereof, that you make:
-
-1. A link or URL to the Service Component Architecture Specification at this location:
- http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
-
-2. The full text of the copyright notice as shown in the Service Component Architecture Specification.
-
-BEA, Cape Clear, IBM, Interface21, IONA, Oracle, Primeton, Progress Software, Red Hat, Rogue Wave,
-SAP, Siemens, Software AG., Sun, Sybase, TIBCO (collectively, the "Authors") agree to grant you a
-royalty-free license, under reasonable, non-discriminatory terms and conditions to patents that they deem
-necessary to implement the Service Component Architecture Specification.
-THE Service Component Architecture SPECIFICATION IS PROVIDED "AS IS," AND THE
-AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
-REGARDING THIS SPECIFICATION AND THE IMPLEMENTATION OF ITS CONTENTS,
-INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
-PARTICULAR PURPOSE, NON-INFRINGEMENT OR TITLE.
-THE AUTHORS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL
-OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATING TO ANY USE OR
-DISTRIBUTION OF THE Service Components Architecture SPECIFICATION.
-The name and trademarks of the Authors may NOT be used in any manner, including advertising or
-publicity pertaining to the Service Component Architecture Specification or its contents without specific,
-
-
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api/NOTICE b/branches/sca-java-1.5.1/modules/sca-api/NOTICE
deleted file mode 100644
index 12fdd031e7..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/NOTICE
+++ /dev/null
@@ -1,13 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product also includes software under the Service Component Architecture specification license
-(see the LICENSE file contained in this distribution) with the following copyright
-
-(c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
-37 Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
-38 Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api/pom.xml b/branches/sca-java-1.5.1/modules/sca-api/pom.xml
deleted file mode 100644
index f0405f7b70..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/pom.xml
+++ /dev/null
@@ -1,54 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <name>Apache Tuscany SCA API</name>
-
- <description>API classes for the Service Component Architecture</description>
- <packaging>jar</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>1.4</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.api</Bundle-SymbolicName>
- <Bundle-Description>${pom.description}</Bundle-Description>
- <Export-Package>org.osoa.sca*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java
deleted file mode 100644
index 7f6756bcbd..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/CallableReference.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-/**
- * Common superclass for references that can be passed between components.
- *
- * @version $Rev$ $Date$
- * @param <B> the Java interface associated with this reference
- */
-public interface CallableReference<B> {
- /**
- * Returns a type-safe reference to the target of this reference.
- * The instance returned is guaranteed to implement the business interface for this reference
- * but may not be a proxy as defined by java.lang.reflect.Proxy.
- *
- * @return a proxy to the target that implements the business interface associated with this reference
- */
- B getService();
-
- /**
- * Returns the Java class for the business interface associated with this reference.
- *
- * @return the Class for the business interface associated with this reference
- */
- Class<B> getBusinessInterface();
-
- /**
- * Returns true if this reference is conversational.
- *
- * @return true if this reference is conversational
- */
- boolean isConversational();
-
- /**
- * Returns the conversation associated with this reference.
- * Returns null if no conversation is currently active.
- *
- * @return the conversation associated with this reference; may be null
- */
- Conversation getConversation();
-
- /**
- * Returns the callback ID.
- *
- * @return the callback ID
- */
- Object getCallbackID();
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java
deleted file mode 100644
index 52290a4bba..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ComponentContext.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-import java.util.Collection;
-
-/**
- * Interface providing programmatic access to a component's SCA context as an alternative to injection.
- * It provides access to reference and property values for the component and provides a mechanism for
- * obtaining a reference to a service that can be passed to other components.
- * <p/>
- * SCA components obtain an instance of this interface through injection. Non-SCA client code may also
- * obtain an instance through runtime-specific mechanisms.
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentContext {
- /**
- * Returns the absolute URI of the component within the SCA Domain.
- *
- * @return the absolute URI of the component
- */
- String getURI();
-
- /**
- * Cast a type-safe reference to a CallableReference.
- * Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service
- * then a ServiceReference will be returned, if the target refers to a callback then a CallableReference
- * will be returned.
- *
- * @param target a reference proxy provided by the SCA runtime
- * @param <B> the Java type of the business interface for the reference
- * @param <R> the type of reference to be returned
- * @return a CallableReference equivalent for the proxy
- * @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime
- */
- <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
-
- /**
- * Returns a proxy for a reference defined by this component.
- *
- * @param businessInterface the interface that will be used to invoke the service
- * @param referenceName the name of the reference
- * @param <B> the Java type of the business interface for the reference
- * @return an object that implements the business interface
- */
- <B> B getService(Class<B> businessInterface, String referenceName);
-
- /**
- * Returns a ServiceReference for a reference defined by this component.
- *
- * @param businessInterface the interface that will be used to invoke the service
- * @param referenceName the name of the reference
- * @param <B> the Java type of the business interface for the reference
- * @return a ServiceReference for the designated reference
- */
- <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
-
- /**
- * Returns the value of an SCA property defined by this component.
- *
- * @param type the Java type to be returned for the property
- * @param propertyName the name of the property whose value should be returned
- * @param <B> the Java type of the property
- * @return the property value
- */
- <B> B getProperty(Class<B> type, String propertyName);
-
- /**
- * Returns a ServiceReference that can be used to invoke this component over the default service.
- *
- * @param businessInterface the interface that will be used to invoke the service
- * @param <B> the Java type of the business interface for the reference
- * @return a ServiceReference that will invoke this component
- */
- <B> ServiceReference<B> createSelfReference(Class<B> businessInterface);
-
- /**
- * Returns a ServiceReference that can be used to invoke this component over the designated service.
- *
- * @param businessInterface the interface that will be used to invoke the service
- * @param serviceName the name of the service to invoke
- * @param <B> the Java type of the business interface for the reference
- * @return a ServiceReference that will invoke this component
- */
- <B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName);
-
- /**
- * Returns the context for the current SCA service request, or null if there is no current request
- * or if the context is unavailable.
- *
- * @return the SCA request context; may be null
- */
- RequestContext getRequestContext();
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Constants.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Constants.java
deleted file mode 100644
index b1b2af8048..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Constants.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.osoa.sca;
-
-/**
- * @version $Rev$ $Date$
- */
-public interface Constants {
- /**
- * Namespace for intents.
- */
- String SCA_NS = "http://www.osoa.org/xmlns/sca/1.0";
-
- /**
- * Prefix form of the namespace that can be prepended to intent declarations.
- */
- String SCA_PREFIX = '{' + SCA_NS + '}';
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java
deleted file mode 100644
index 12733a7bd2..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/Conversation.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-/**
- * Interface representing a Conversation providing access to the conversation id and and a mechanism
- * to terminate the conversation.
- *
- * @version $Rev$ $Date$
- */
-public interface Conversation {
- /**
- * Returns the identifier for this conversation.
- * If a user-defined identity had been supplied for this reference then its value will be returned;
- * otherwise the identity generated by the system when the conversation was initiated will be returned.
- *
- * @return the identifier for this conversation
- */
- Object getConversationID();
-
- /**
- * End this conversation.
- */
- void end();
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java
deleted file mode 100644
index 2e3b71fd1c..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ConversationEndedException.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-/**
- * Exception thrown to indicate the conversation being used for a stateful interaction has been ended.
- *
- * @version $Rev$ $Date$
- */
-public class ConversationEndedException extends ServiceRuntimeException {
- private static final long serialVersionUID = 3734864942222558406L;
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @see ServiceRuntimeException
- */
- public ConversationEndedException() {
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param message passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public ConversationEndedException(String message) {
- super(message);
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param message passed to ServiceRuntimeException
- * @param cause passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public ConversationEndedException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param cause passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public ConversationEndedException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
deleted file mode 100644
index 0a0c2afff9..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/NoRegisteredCallbackException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-/**
- * Exception thrown to indicate that no callback has been registered
- * when interacting with a service.
- *
- * @version $Rev$ $Date$
- */
-public class NoRegisteredCallbackException extends ServiceRuntimeException {
- private static final long serialVersionUID = 3734864942222558406L;
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @see ServiceRuntimeException
- */
- public NoRegisteredCallbackException() {
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param message passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public NoRegisteredCallbackException(String message) {
- super(message);
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param message passed to ServiceRuntimeException
- * @param cause passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public NoRegisteredCallbackException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Override constructor from ServiceRuntimeException.
- *
- * @param cause passed to ServiceRuntimeException
- * @see ServiceRuntimeException
- */
- public NoRegisteredCallbackException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java
deleted file mode 100644
index cdcfa9a791..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/RequestContext.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-import javax.security.auth.Subject;
-
-/**
- * Interface that provides information on the current request.
- *
- * @version $Rev$ $Date$
- */
-public interface RequestContext {
- /**
- * Returns the JAAS Subject of the current request.
- *
- * @return the Subject of the current request
- */
- Subject getSecuritySubject();
-
- /**
- * Returns the name of the service that was invoked.
- *
- * @return the name of the service that was invoked
- */
- String getServiceName();
-
- /**
- * Returns a CallableReference for the service that was invoked by the caller.
- *
- * @param <B> the Java type of the business interface for the reference
- * @return a CallableReference for the service that was invoked by the caller
- */
- <B> CallableReference<B> getServiceReference();
-
- /**
- * Returns a type-safe reference to the callback provided by the caller.
- *
- * @param <CB> the Java type of the business interface for the callback
- * @return a type-safe reference to the callback provided by the caller
- */
- <CB> CB getCallback();
-
- /**
- * Returns a CallableReference to the callback provided by the caller.
- *
- * @param <CB> the Java type of the business interface for the callback
- * @return a CallableReference to the callback provided by the caller
- */
- <CB> CallableReference<CB> getCallbackReference();
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java
deleted file mode 100644
index 8da6bcd1f3..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceReference.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-
-/**
- * A ServiceReference represents a client's perspective of a reference to another service.
- *
- * @version $Rev$ $Date$
- * @param <B> the Java interface associated with this reference
- */
-public interface ServiceReference<B> extends CallableReference<B> {
- /**
- * Returns the id supplied by the user that will be associated with conversations initiated through this reference.
- *
- * @return the id to associated with any conversation initiated through this reference
- */
- Object getConversationID();
-
- /**
- * Set the id to associate with any conversation started through this reference.
- * If the value supplied is null then the id will be generated by the implementation.
- *
- * @param conversationId the user-defined id to associated with a conversation
- * @throws IllegalStateException if a conversation is currently associated with this reference
- */
- void setConversationID(Object conversationId) throws IllegalStateException;
-
- /**
- * Sets the callback ID.
- *
- * @param callbackID the callback ID
- */
- void setCallbackID(Object callbackID);
-
- /**
- * Returns the callback object.
- *
- * @return the callback object
- */
- Object getCallback();
-
- /**
- * Sets the callback object.
- *
- * @param callback the callback object
- */
- void setCallback(Object callback);
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java
deleted file mode 100644
index 70f5f904a4..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceRuntimeException.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-
-/**
- * Base for Exceptions that may be raised by an SCA runtime and which typical
- * application code is not expected to be able to handle.
- *
- * @version $Rev$ $Date$
- */
-public class ServiceRuntimeException extends RuntimeException {
- private static final long serialVersionUID = -3876058842262557092L;
-
- /**
- * Override constructor from RuntimeException.
- *
- * @see RuntimeException
- */
- public ServiceRuntimeException() {
- }
-
- /**
- * Override constructor from RuntimeException.
- *
- * @param message passed to RuntimeException
- * @see RuntimeException
- */
- public ServiceRuntimeException(String message) {
- super(message);
- }
-
- /**
- * Override constructor from RuntimeException.
- *
- * @param message passed to RuntimeException
- * @param cause passed to RuntimeException
- * @see RuntimeException
- */
- public ServiceRuntimeException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * Override constructor from RuntimeException.
- *
- * @param cause passed to RuntimeException
- * @see RuntimeException
- */
- public ServiceRuntimeException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java
deleted file mode 100644
index dd6b1c3242..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/ServiceUnavailableException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca;
-
-/**
- * Exception used to indicate that a runtime exception occurred during the invocation of and external service.
- *
- * @version $Rev$ $Date$
- */
-public class ServiceUnavailableException extends ServiceRuntimeException {
-
- private static final long serialVersionUID = -5869397223249401047L;
-
- /**
- * Constructs a new ServiceUnavailableException.
- */
- public ServiceUnavailableException() {
- super((Throwable) null);
- }
-
- /**
- * Constructs a new ServiceUnavailableException with the specified detail message.
- *
- * @param message The detail message (which is saved to later retrieval by the getMessage() method).
- */
- public ServiceUnavailableException(String message) {
- super(message);
- }
-
- /**
- * Constructs a new ServiceUnavailableException with the specified cause.
- *
- * @param cause The cause (which is saved to later retrieval by the getCause() method).
- */
- public ServiceUnavailableException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Constructs a new ServiceUnavailableException with the specified detail message and cause.
- *
- * @param message The message (which is saved to later retrieval by the getMessage() method).
- * @param cause The cause (which is saved to later retrieval by the getCause() method).
- */
- public ServiceUnavailableException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
deleted file mode 100644
index 556dd4e68e..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/AllowsPassByReference.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation on a method that indicates that its parameters may safely
- * be passed by reference. The annotation may also be placed on an interface
- * or class to indicate that all declared methods support this optimization.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE, METHOD})
-@Retention(RUNTIME)
-public @interface AllowsPassByReference {
-}
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java
deleted file mode 100644
index f7fca41212..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Authentication.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static org.osoa.sca.Constants.SCA_PREFIX;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation denoting the intent that service operations require authentication.
- * <p/>
- * Applied to the injection site (field, method or constructor parameter) for a reference,
- * it indicates that all invocations through that reference require authentication.
- * <p/>
- * Applied to a interface method on a service contract, it indicates that all invocations
- * of that service operation require authentication; applied to the type of a service contract,
- * it indicates that all service operations on that interface require authentication.
- * <p/>
- * Applied to a method on an implementation class, it indicates that all invocations that
- * are dispatched to that implementation method (through any service) require authentication.
- * Applied to a interface implemented by an implementation class, it indicates that all
- * invocations that are dispatched to the implementation method for that interface operation
- * require authentication.
- * <p/>
- * Applied to an implementation class, it indicates that all invocations of that implementation
- * and that all invocations made by that implementation require authentication.
- *
- * @version $Rev$ $Date$
- */
-@Inherited
-@Target({TYPE, FIELD, METHOD, PARAMETER})
-@Retention(RUNTIME)
-@Intent(Authentication.AUTHENTICATION)
-public @interface Authentication {
- String AUTHENTICATION = SCA_PREFIX + "authentication";
- String AUTHENTICATION_MESSAGE = AUTHENTICATION + "message";
- String AUTHENTICATION_TRANSPORT = AUTHENTICATION + "transport";
-
- /**
- * List of authentication qualifiers (such as "message" or "transport").
- *
- * @return authentication qualifiers
- */
- @Qualifier
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java
deleted file mode 100644
index 0ee613fdcb..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Callback.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * When placed on a service interface, this annotation specifies the interface
- * to be used for callbacks.
- * <p/>
- * When placed on a method or field, this annotation denotes the injection
- * site to be used for a callback reference.
- * <p/>
- * There is a error in the 1.00 draft spec in the declaration of this interface.
- * The form defined here is a proposed correction for that error.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE, METHOD, FIELD})
-@Retention(RUNTIME)
-public @interface Callback {
- /**
- * The Class of the associated callback interface.
- *
- * @return the associated callback interface
- */
- Class<?> value() default Void.class;
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java
deleted file mode 100644
index bc73d22c9d..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ComponentName.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a field or method that is used to inject the component's name.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD, FIELD})
-@Retention(RUNTIME)
-public @interface ComponentName {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java
deleted file mode 100644
index 25ade6f091..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Confidentiality.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static org.osoa.sca.Constants.SCA_PREFIX;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation denoting the intent that service operations require confidentiality.
- * <p/>
- * Applied to the injection site (field, method or constructor parameter) for a reference,
- * it indicates that all invocations through that reference require confidentiality.
- * <p/>
- * Applied to a interface method on a service contract, it indicates that all invocations
- * of that service operation require confidentiality; applied to the type of a service contract,
- * it indicates that all service operations on that interface require confidentiality.
- * <p/>
- * Applied to a method on an implementation class, it indicates that all invocations that
- * are dispatched to that implementation method (through any service) require confidentiality.
- * Applied to a interface implemented by an implementation class, it indicates that all
- * invocations that are dispatched to the implementation method for that interface operation
- * require confidentiality.
- * <p/>
- * Applied to an implementation class, it indicates that all invocations of that implementation
- * and that all invocations made by that implementation require confidentiality.
- *
- * @version $Rev$ $Date$
- */
-@Inherited
-@Target({TYPE, FIELD, METHOD, PARAMETER})
-@Retention(RUNTIME)
-@Intent(Confidentiality.CONFIDENTIALITY)
-public @interface Confidentiality {
- String CONFIDENTIALITY = SCA_PREFIX + "confidentiality";
- String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message";
- String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport";
-
- /**
- * List of confidentiality qualifiers (such as "message" or "transport").
- *
- * @return confidentiality qualifiers
- */
- @Qualifier
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java
deleted file mode 100644
index bc09c8ccdd..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Constructor.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Used to indicate the constructor the runtime is to use when instantiating a component implementation instance
- *
- * @version $Rev$ $Date$
- */
-@Target(CONSTRUCTOR)
-@Retention(RUNTIME)
-public @interface Constructor {
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java
deleted file mode 100644
index baacb2f520..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Context.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a field or setter method that is used to inject an SCA context.
- * The type of context injected is determined by the type of the field or the parameter
- * to the setter method and is typically a ComponentContext or RequestContext.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD, FIELD})
-@Retention(RUNTIME)
-public @interface Context {
-}
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
deleted file mode 100644
index e9fcfee2d3..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationAttributes.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate the characteristics of a conversation.
- *
- * @version $Rev$ $Date$
- */
-@Target(ElementType.TYPE)
-@Retention(RUNTIME)
-public @interface ConversationAttributes {
- /**
- * The maximum time that can pass between operations in a single conversation. If this time is exceeded the
- * container may end the conversation.
- *
- * @return the maximum time that can pass between operations in a single conversation
- */
- String maxIdleTime() default "";
-
- /**
- * The maximum time that a conversation may remain active. If this time is exceeded the container may end the
- * conversation.
- *
- * @return the maximum time that a conversation may remain active
- */
- String maxAge() default "";
-
- /**
- * If true, indicates that only the user that initiated the conversation has the authority to continue it.
- *
- * @return true if only the user that initiated the conversation has the authority to continue it
- */
- boolean singlePrincipal() default false;
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java
deleted file mode 100644
index b2f6f17129..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/ConversationID.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a field or method that is used to inject the conversation ID.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD, FIELD})
-@Retention(RUNTIME)
-public @interface ConversationID {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java
deleted file mode 100644
index f0350f8ff5..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Conversational.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Used on a Java interface to denote a conversational service contract.
- * <p/>
- * The draft spec erroneously defines the targets for this as {TYPE, METHOD, FIELD}
- * but this annotation is only applicable to interfaces.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface Conversational {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java
deleted file mode 100644
index d65558653b..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Destroy.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a method that will be called by the container when the
- * scope defined for the local service ends.
- *
- * @version $Rev$ $Date$
- */
-@Target(METHOD)
-@Retention(RUNTIME)
-public @interface Destroy {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java
deleted file mode 100644
index 21bf986705..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EagerInit.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate an instance should be eagerly initialized.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface EagerInit {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java
deleted file mode 100644
index c65ff5838f..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/EndsConversation.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a method ends a conversation.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD})
-@Retention(RUNTIME)
-public @interface EndsConversation {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java
deleted file mode 100644
index d610e21d64..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Init.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a method that will be called by the container when the scope defined for the local
- * service begins.
- *
- * @version $Rev$ $Date$
- */
-@Target(METHOD)
-@Retention(RUNTIME)
-public @interface Init {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java
deleted file mode 100644
index a8cf28475b..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Integrity.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import static org.osoa.sca.Constants.SCA_PREFIX;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation denoting the intent that service operations require integrity.
- * <p/>
- * Applied to the injection site (field, method or constructor parameter) for a reference,
- * it indicates that all invocations through that reference require integrity.
- * <p/>
- * Applied to a interface method on a service contract, it indicates that all invocations
- * of that service operation require integrity; applied to the type of a service contract,
- * it indicates that all service operations on that interface require integrity.
- * <p/>
- * Applied to a method on an implementation class, it indicates that all invocations that
- * are dispatched to that implementation method (through any service) require integrity.
- * Applied to a interface implemented by an implementation class, it indicates that all
- * invocations that are dispatched to the implementation method for that interface operation
- * require integrity.
- * <p/>
- * Applied to an implementation class, it indicates that all invocations of that implementation
- * and that all invocations made by that implementation require integrity.
- *
- * @version $Rev$ $Date$
- */
-@Inherited
-@Target({TYPE, FIELD, METHOD, PARAMETER})
-@Retention(RUNTIME)
-@Intent(Integrity.INTEGRITY)
-public @interface Integrity {
- String INTEGRITY = SCA_PREFIX + "integrity";
- String INTEGRITY_MESSAGE = INTEGRITY + "message";
- String INTEGRITY_TRANSPORT = INTEGRITY + "transport";
-
- /**
- * List of integrity qualifiers (such as "message" or "transport").
- *
- * @return integrity qualifiers
- */
- @Qualifier
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java
deleted file mode 100644
index fc925aa402..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Intent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation that can be applied to annotations that describe SCA intents.
- * Adding this annotation allows SCA runtimes to automatically detect user-defined intents.
- * <p/>
- * Applications must specify a value, a pairing of targetNamespace and localPort, or both.
- * If both value and pairing are supplied they must define the name qualified name.
- *
- * @version $Rev$ $Date$
- */
-@Target({ANNOTATION_TYPE})
-@Retention(RUNTIME)
-public @interface Intent {
- /**
- * The qualified name of the intent, in the form defined by {@link javax.xml.namespace.QName#toString}.
- *
- * @return the qualified name of the intent
- */
- String value() default "";
-
- /**
- * The XML namespace for the intent.
- *
- * @return the XML namespace for the intent
- */
- String targetNamespace() default "";
-
- /**
- * The name of the intent within its namespace.
- *
- * @return name of the intent within its namespace
- */
- String localPart() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java
deleted file mode 100644
index eaf9e3207c..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/OneWay.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation on a method that indicates that the method is non-blocking and communication
- * with the service provider may use buffer the requests and send them at some later time.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD})
-@Retention(RUNTIME)
-public @interface OneWay {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java
deleted file mode 100644
index b22a6a840c..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/PolicySets.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation that allows application of SCA Policy Sets.
- * <p/>
- * Each policy set is specified using its XML QName in the form defined by {@link javax.xml.namespace.QName#toString()}.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE, FIELD, METHOD, PARAMETER})
-@Retention(RUNTIME)
-public @interface PolicySets {
- /**
- * Returns the policy sets to be applied.
- *
- * @return the policy sets to be applied
- */
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java
deleted file mode 100644
index 71af35634d..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Property.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a constructor parameter, field or method that is
- * used to inject a configuration property value.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD, FIELD, PARAMETER})
-@Retention(RUNTIME)
-public @interface Property {
- /**
- * The name of the property. If not specified then the name will be derived
- * from the annotated field or method.
- *
- * @return the name of the property
- */
- String name() default "";
-
- /**
- * Indicates whether a value for the property must be provided.
- *
- * @return true if a value must be provided
- */
- boolean required() default false;
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java
deleted file mode 100644
index 44388bea74..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Qualifier.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation that can be applied to an attribute of an @Intent annotation to indicate the
- * attribute provides qualifiers for the intent.
- *
- * @version $Rev$ $Date$
- */
-@Target(METHOD)
-@Retention(RUNTIME)
-public @interface Qualifier {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java
deleted file mode 100644
index 4d71b3f357..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Reference.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a constructor parameter, field or method that is used to inject a reference.
- *
- * @version $Rev$ $Date$
- */
-@Target({METHOD, FIELD, PARAMETER})
-@Retention(RUNTIME)
-public @interface Reference {
- /**
- * The name of the reference. If not specified then the name will be derived from the annotated field or method.
- *
- * @return the name of the reference
- */
- String name() default "";
-
- /**
- * Indicates if a reference must be specified.
- *
- * @return true if a reference must be specified
- */
- boolean required() default true;
-}
-
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java
deleted file mode 100644
index 53d58b7dc1..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Remotable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a Java interface as remotable.
- * Remotable interfaces use pass-by-value semantics, can be published as entry points
- * and used for external services.
- *
- * @version $Rev$ $Date$
- */
-@Target(TYPE)
-@Retention(RUNTIME)
-public @interface Remotable {
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java
deleted file mode 100644
index 3af699de07..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Requires.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation that allows the attachment of any intent to a Java Class or interface or to members of that
- * class such as methods, fields or constructor parameters.
- * <p/>
- * Intents are specified as XML QNames in the representation defined by
- * {@link javax.xml.namespace.QName#toString()}. Intents may be qualified with one or more
- * suffixes separated by a "." such as:
- * <ul>
- * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality</li>
- * <li>{http://www.osoa.org/xmlns/sca/1.0}confidentiality.message</li>
- * </ul>
- * This annotation supports general purpose intents specified as strings. Users may also define
- * specific intents using the {@link @org.osoa.sca.annotations.Intent} annotation.
- *
- * @version $Rev$ $Date$
- */
-@Inherited
-@Retention(RUNTIME)
-@Target({TYPE, METHOD, FIELD, PARAMETER})
-public @interface Requires {
- /**
- * Returns the attached intents.
- *
- * @return the attached intents
- */
- String[] value() default "";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java
deleted file mode 100644
index cd88df1128..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Scope.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate a scoped service.
- * <p/>
- * The spec refers to but does not describe an eager() attribute; this is an error in the draft.
- *
- * @version $Rev$ $Date$
- */
-@Target(TYPE)
-@Retention(RUNTIME)
-public @interface Scope {
- /**
- * The name of the scope. Values currently defined by the specification are:
- * <ul>
- * <li>STATELESS (default)</li>
- * <li>REQUEST</li>
- * <li>CONVERSATION</li>
- * <li>COMPOSITE</li>
- * </ul>
- *
- * @return the name of the scope
- */
- String value() default "STATELESS";
-}
diff --git a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java b/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java
deleted file mode 100644
index 62f4abdbee..0000000000
--- a/branches/sca-java-1.5.1/modules/sca-api/src/main/java/org/osoa/sca/annotations/Service.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * (c) Copyright BEA Systems, Inc., Cape Clear Software, International Business Machines Corp, Interface21, IONA Technologies,
- * Oracle, Primeton Technologies, Progress Software, Red Hat, Rogue Wave Software, SAP AG., Siemens AG., Software AG., Sybase
- * Inc., TIBCO Software Inc., 2005, 2007. All rights reserved.
- *
- * see http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- */
-package org.osoa.sca.annotations;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Annotation used to indicate the service interfaces exposed by a Java class.
- *
- * @version $Rev$ $Date$
- */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface Service {
- /**
- * Array of interfaces that should be exposed as services.
- *
- * @return a list of interfaces that should be exposed as services
- */
- Class<?>[] interfaces() default {};
-
- /**
- * Shortcut allowing a single interface to be exposed.
- *
- * @return a single service interfaces to be exposed
- */
- Class<?> value() default Void.class;
-}
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/LICENSE b/branches/sca-java-1.5.1/modules/tracing-aspectj/LICENSE
deleted file mode 100644
index 6e529a25c4..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/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-java-1.5.1/modules/tracing-aspectj/NOTICE b/branches/sca-java-1.5.1/modules/tracing-aspectj/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/launcher.bat b/branches/sca-java-1.5.1/modules/tracing-aspectj/launcher.bat
deleted file mode 100644
index d50ec6513d..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/launcher.bat
+++ /dev/null
@@ -1,22 +0,0 @@
-@echo off
-REM Licensed to the Apache Software Foundation (ASF) under one
-REM or more contributor license agreements. See the NOTICE file
-REM distributed with this work for additional information
-REM regarding copyright ownership. The ASF licenses this file
-REM to you under the Apache License, Version 2.0 (the
-REM "License"); you may not use this file except in compliance
-REM with the License. You may obtain a copy of the License at
-REM
-REM http://www.apache.org/licenses/LICENSE-2.0
-REM
-REM Unless required by applicable law or agreed to in writing,
-REM software distributed under the License is distributed on an
-REM # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-REM KIND, either express or implied. See the License for the
-REM specific language governing permissions and limitations
-REM under the License.
-
-set TUSCANY_HOME=C:\Apache\tuscany-sca-1.3
-set ASPECTJ_WEAVER=%HOMEPATH%\.m2\repository\org\aspectj\aspectjweaver\1.6.1\aspectjweaver-1.6.1.jar
-set CP=%ASPECTJ_WEAVER%;%TUSCANY_HOME%\lib\tuscany-sca-manifest.jar;%TUSCANY_HOME%\samples\calculator\target\sample-calculator.jar
-java -javaagent:"%ASPECTJ_WEAVER%" -cp "%CP%;target\classes" calculator.CalculatorClient \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/pom.xml b/branches/sca-java-1.5.1/modules/tracing-aspectj/pom.xml
deleted file mode 100644
index 394ce4e1e1..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/pom.xml
+++ /dev/null
@@ -1,120 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-tracing-aspectj</artifactId>
- <name>Apache Tuscany SCA AOP-based Logging and Tracing</name>
- <dependencies>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>1.6.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjlib</artifactId>
- <version>1.6.2</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>1.6.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <plugins>
- <!-- Copy the aspectjweaver jar to avoid surefire problems for
- directorites with space -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>copy</id>
- <phase>process-sources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>1.6.2</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>${project.build.directory}/dependency
- </outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <!-- surefire plugin configuration -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4.3</version>
- <configuration>
- <includes>
- <include>**/*TestCase.java</include>
- </includes>
- <reportFormat>brief</reportFormat>
- <useFile>false</useFile>
- <forkMode>once</forkMode>
- <!-- I hit a bug in maven-surefire-plugin
- http://jira.codehaus.org/browse/SUREFIRE-128 -->
- <argLine>-ea -Xmx128m -javaagent:target/dependency/aspectjweaver-1.6.2.jar</argLine>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-Version>1.4</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.tracing.aspect</Bundle-SymbolicName>
- <Bundle-Description>${pom.description}</Bundle-Description>
- <Export-Package></Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <!-- http://jira.codehaus.org/browse/MECLIPSE-544 -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <configuration>
- <ajdtVersion>none</ajdtVersion>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.java
deleted file mode 100644
index 630bcb285b..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/LoggingAspect.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.aspectj;
-
-import java.util.Arrays;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.AfterReturning;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * LoggingAspect performs standard logging of method signatures, arguments, and
- * return values. All Tuscany methods, constructors, and statics are logged.
- * @version $Rev$ $Date$
- */
-@Aspect
-public class LoggingAspect {
- @Pointcut("call(* org.apache.tuscany.sca..*(..)) && (!within(org.apache.tuscany.sca.aspectj.*Aspect))")
- public void anyMethodCall() {
- }
-
- @Pointcut("execution(* org.apache.tuscany.sca..*(..)) && (!within(org.apache.tuscany.sca.aspectj.*Aspect))")
- public void anyMethodExecution() {
- }
-
- @Pointcut("call(* java.util.logging.Logger.info(..))")
- public void anyLogCall() {
- }
-
- @Pointcut("cflow(anyMethodExecution()) && anyLogCall()")
- public void anyLog() {
- }
-
- @Pointcut("call(org.apache.tuscany.sca..*.new(..))")
- public void anyConstructor() {
- }
-
- // e.g. org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper
- @Pointcut("staticinitialization(org.apache.tuscany.sca.implementation..*)")
- public void anyStatic() {
- }
-
- @Before("anyMethodCall()")
- public void before(JoinPoint jp) {
- // System.out.println("Logging anyMethodCall before jp=" + jp);
- // System.out.println("Logging anyMethodCall before jp.getSourceLocation=" + jp.getSourceLocation());
- // System.out.println("Logging anyMethodCall before jp.getThis=" + jp.getThis());
- // System.out.println("Logging anyMethodCall before jp.getTarget=" + jp.getTarget());
- System.out.println("Logging Before anyMethodCall jp.getSignature=" + jp.getSignature());
- java.lang.Object[] args = jp.getArgs();
- if (( args != null ) && ( args.length > 0 )) {
- System.out.println("Logging Before anyMethodCall jp.getArgs=" + Arrays.asList(args));
- }
- }
-
- @AfterReturning(pointcut = "anyMethodCall()", returning = "result")
- public void afterReturning(JoinPoint jp, Object result) {
- // Note that result is null for methods with void return.
- System.out.println("Logging AfterReturning anyMethodCall jp=" + jp + ", result=" + result);
- }
-
- @AfterThrowing(pointcut = "anyMethodCall()", throwing = "t")
- public void afterThrowing(JoinPoint jp, Throwable t) {
- System.out.println("Logging AfterThrowing anyMethodCall jp=" + jp + ", t=" + t);
- }
-
- @Before("anyConstructor()")
- public void beforeConstructor(JoinPoint jp) {
- System.out.println("Logging Before anyConstructor jp.getSignature=" + jp.getSignature());
- java.lang.Object[] args = jp.getArgs();
- if (( args != null ) && ( args.length > 0 )) {
- System.out.println("Logging Before anyConstructor jp.getArgs=" + Arrays.asList(args));
- }
- }
-
- @Before("anyStatic()")
- public void beforeStatic(JoinPoint jp) {
- System.out.println("Logging Before anyStatic before jp=" + jp);
- System.out.println("Logging anyMethodCall before jp.getSourceLocation=" + jp.getSourceLocation());
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java
deleted file mode 100644
index 965cfa5b5d..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/SimpleTracingAspect.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.aspectj;
-
-import java.util.Arrays;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * SimpleTraceAspect performs tracing of method signatures, arguments, and
- * return values. All Tuscany methods, constructors, and statics are traced.
- *
- * @version $Rev$ $Date$
- */
-@Aspect
-public class SimpleTracingAspect extends TracingAspect {
-
- @Pointcut("execution(public * org.apache.tuscany.sca..*.*(..))")
- // @Pointcut("call(* org.apache.tuscany.sca..*(..))")
- protected void entry() {
- }
-
- @Pointcut("within(org.apache.tuscany.sca..*) && !within(org.apache.tuscany.sca.aspectj..*Aspect)")
- protected void withinScope() {
- }
-
- @Override
- protected void startLog() {
- System.out.println(">>> ----------------------------------------------------");
- }
-
- @Override
- protected void completeLog() {
- System.out.println("<<< ----------------------------------------------------");
- }
-
- @Override
- protected void logEnter(JoinPoint jp) {
- System.out.println("> logEnter jp.getSignature=" + jp.getSignature());
- java.lang.Object[] args = jp.getArgs();
- if (( args != null ) && ( args.length > 0 )) {
- // See http://www.eclipse.org/aspectj/doc/released/progguide/pitfalls-infiniteLoops.html
- // System.out.println("Logging anyMethodCall before jp.getArgs=" + Arrays.asList(args));
- System.out.print(" logEnter jp.getArgs(" + args.length + ")=[" );
- for ( int i = 0; i < args.length; i++ ){
- if ( i > 0 ) System.out.print( ",");
- System.out.print( args[ i ]);
- }
- System.out.println("]" );
- }
- }
-
- @Override
- protected void logExit(JoinPoint jp, Object result) {
- // Note that result is null for methods with void return.
- System.out.println("< logExit jp.getSignature=" + jp.getSignature() +", result=" + result );
- }
-
- @Override
- protected void logThrowable(JoinPoint jp, Throwable throwable) {
- while ( throwable.getCause() != null )
- throwable = throwable.getCause();
- System.out.println("! logThrowable jp.getSignature=" + jp.getSignature() + ", throwable=" + throwable);
- // System.out.println("! logThowable stackTrace=" );
- // throwable.printStackTrace( System.out );
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java
deleted file mode 100644
index 262742e867..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TimingAspect.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.aspectj;
-
-import java.util.Arrays;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.AfterReturning;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * The TimingAspect is used to perform timing metrics on various calls.
- * The Pointcut "timedCall" is not defined here, but rather in the aop.xml
- * configuration file. You may provide a point cut to state which type
- * of call you would like timed and reported in the output files.
- *
- * @version $Rev$ $Date$
- */
-@Aspect
-public abstract class TimingAspect {
- // Abstract pointcut. Pointcut is defined in aop.xml file.
- @Pointcut
- public void timedCall() {
- }
-
- @Around("timedCall()")
- public Object timedSection(ProceedingJoinPoint jp) throws Throwable {
- System.out.println("Timing Around timedSection jp=" + jp);
- long start = System.currentTimeMillis();
- try {
- return jp.proceed();
- } finally {
- long end = System.currentTimeMillis();
- System.out.println("Timing Around timedSection Roundtrip is " + (end - start) + "ms for jp.getSignature=" + jp.getSignature());
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TracingAspect.java b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TracingAspect.java
deleted file mode 100644
index 0178ebdb6e..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/java/org/apache/tuscany/sca/aspectj/TracingAspect.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.aspectj;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.AfterReturning;
-import org.aspectj.lang.annotation.AfterThrowing;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-
-/**
- * @version $Rev$ $Date$
- */
-
-@Aspect
-public abstract class TracingAspect {
-
- @Pointcut("")
- protected abstract void entry();
-
- @Pointcut("")
- protected abstract void withinScope();
-
- @Pointcut("call(* java..*.*(..))")
- protected void exit() {
- }
-
- @Pointcut("entry() && !cflowbelow(entry())")
- void start() {
- }
-
- // @Pointcut("withinScope() && cflow(entry()) && !cflow(exit()) && !within(org.apache.tuscany.sca.aspectj.*Aspect) && !within(*.toString)")
- @Pointcut("withinScope() && entry()")
- // @Pointcut("withinScope() && entry()&& !cflow(execution(String toString())")
- void trace() {
- }
-
- @Pointcut("!handler(*) && !preinitialization(new(..))")
- protected void supportsAfterAdvice() {
- }
-
- @Before("start()")
- public void beforeStart() {
- startLog();
- }
-
- @Before("trace() && supportsAfterAdvice()")
- public void beforeTrace(JoinPoint jp) {
- logEnter(jp);
- }
-
- @AfterReturning(pointcut = "trace() && supportsAfterAdvice()", returning = "result")
- public void afterReturning(JoinPoint jp, Object result) {
- logExit(jp, result);
- }
-
- @AfterThrowing(pointcut = "trace() && supportsAfterAdvice()", throwing = "e")
- public void afterThrowing(JoinPoint jp, Throwable e) {
- logThrowable(jp, e);
- }
-
- @After("start()")
- public void afterStart() {
- completeLog();
- }
-
- protected abstract void logEnter(JoinPoint jp);
- protected abstract void logExit(JoinPoint jp, Object result);
- protected abstract void logThrowable(JoinPoint jp, Throwable throwable);
-
- protected abstract void startLog();
- protected abstract void completeLog();
-}
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml
deleted file mode 100644
index c5b623d27f..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/main/resources/META-INF/aop.xml
+++ /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.
--->
-<aspectj>
-
- <aspects>
- <!-- Uncomment either of these two aspects to perform standard logging -->
- <!-- or standard tracing on the Tuscany runtime. -->
- <!-- <aspect name="org.apache.tuscany.sca.aspectj.SimpleTracingAspect" /> -->
- <!-- <aspect name="org.apache.tuscany.sca.aspectj.LoggingAspect" /> -->
-
- <!-- Following is a concrete-aspect that defines the point cut for -->
- <!-- the TimingAspect. Which ever calls you define in this pointcut -->
- <!-- will be timed and displayed in the logs. -->
- <concrete-aspect name="org.apache.tuscany.sca.aspectj.UserTimingAspect"
- extends="org.apache.tuscany.sca.aspectj.TimingAspect"
- precedence="org.apache.tuscany.sca.aspectj.UserTimingAspect, *">
- <pointcut name="timedCall"
- expression="call(* java.util.logging.Logger.info(..))"/>
- </concrete-aspect>
- </aspects>
-
- <!--weaver options="-verbose -debug -showWeaveInfo"-->
- <weaver options="-verbose">
- <include within="org.apache.tuscany.sca..*" />
- </weaver>
-
-</aspectj>
diff --git a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/test/java/org/apache/tuscany/sca/aspectj/TracingTestCase.java b/branches/sca-java-1.5.1/modules/tracing-aspectj/src/test/java/org/apache/tuscany/sca/aspectj/TracingTestCase.java
deleted file mode 100644
index 7b76faaf36..0000000000
--- a/branches/sca-java-1.5.1/modules/tracing-aspectj/src/test/java/org/apache/tuscany/sca/aspectj/TracingTestCase.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.aspectj;
-
-import java.util.logging.Logger;
-
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class TracingTestCase {
-
- @Test
- public void testAOP() {
- Logger log = Logger.getLogger(getClass().getName());
- System.out.println("doSomething()");
- log.info("Hello, Log");
- }
-
- public static void main(String[] args) {
- new TracingTestCase().testAOP();
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/LICENSE b/branches/sca-java-1.5.1/modules/web-javascript-dojo/LICENSE
deleted file mode 100644
index 422e5f7033..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/LICENSE
+++ /dev/null
@@ -1,238 +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.
-
-
-==========================================================================
-
-dojotoolkit V1.3.0:
-
-The "New" BSD License:
-**********************
-
-Copyright (c) 2005, The Dojo Foundation
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of the Dojo Foundation nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-================================================================================
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/NOTICE b/branches/sca-java-1.5.1/modules/web-javascript-dojo/NOTICE
deleted file mode 100644
index c11317f24d..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/NOTICE
+++ /dev/null
@@ -1,11 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-This product includes dojotoolkit files (http://dojotoolkit.org/) under the
-"New" BSD License (see the LICENSE file contained in this distribution) under the
-following copyright
- Copyright (c) 2005, The Dojo Foundation. All rights reserved.
-
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/build-dojo.xml b/branches/sca-java-1.5.1/modules/web-javascript-dojo/build-dojo.xml
deleted file mode 100644
index f029ed7e87..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/build-dojo.xml
+++ /dev/null
@@ -1,92 +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 name="DojoZipInstaller">
-
-
- <property name="dojo.version" value="1.3.0"/>
- <property name="unpack.location" value="${basedir}/src/main/resources/dojo"/>
-
-
- <target name="check-dojo-installed">
- <condition property="already.installed" >
- <available file="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
- </condition>
- <condition property="maven.suffix" value="">
- <os family="unix"/>
- </condition>
- <condition property="maven.suffix" value=".bat">
- <os family="windows"/>
- </condition>
- </target>
-
-
- <target name="check-dojo-unpacked">
- <condition property="already.unpacked" >
- <available file="${unpack.location}"/>
- </condition>
- </target>
-
- <target name="install-dojo" depends="check-dojo-installed" unless="already.installed">
- <mkdir dir="${basedir}/target/dojo-download/"/>
- <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
- dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
- verbose="true"
- usetimestamp="true"/>
- <exec executable="mvn${maven.suffix}" dir="${basedir}" failonerror="false">
- <arg line="install:install-file -DgroupId=dojo -DartifactId=dojo -Dversion=${dojo.version} -Dpackaging=zip -DgeneratePom=true -Dfile=${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"/>
- </exec>
- </target>
-
- <target name="install-dojo-nomaven" depends="check-dojo-installed" unless="already.installed">
- <mkdir dir="${basedir}/target/dojo-download/"/>
- <get src="http://download.dojotoolkit.org/release-${dojo.version}/dojo-release-${dojo.version}.zip"
- dest="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
- verbose="true"
- usetimestamp="true"/>
- <copy file="${basedir}/target/dojo-download/dojo-release-${dojo.version}.zip"
- tofile="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"/>
- </target>
-
-
- <target name="unpack-dojo-files" depends="check-dojo-installed, check-dojo-unpacked" unless="already.unpacked">
- <fail message="dojo zip file not installed in local repository: ${localRepository}" unless="already.installed"/>
- <mkdir dir="${basedir}/target/dojo-unpack-temp/"/>
- <unzip src="${localRepository}/dojo/dojo/${dojo.version}/dojo-${dojo.version}.zip"
- dest="${basedir}/target/dojo-unpack-temp/"
- overwrite="false">
- <patternset>
- <include name="dojo-release-${dojo.version}/dojo/**"/>
- <exclude name="dojo-release-${dojo.version}/dojo/tests/**"/>
- <exclude name="dojo-release-${dojo.version}/dijit/**"/>
- <exclude name="dojo-release-${dojo.version}/dojox/**"/>
- <exclude name="dojo-release-${dojo.version}/util/**"/>
- </patternset>
- </unzip>
- <move file="${basedir}/target/dojo-unpack-temp/dojo-release-${dojo.version}"
- tofile="${unpack.location}"
- verbose="true"/>
- <delete dir="${basedir}/target/dojo-unpack-temp/"/>
- </target>
-
-
- <target name="clean-dojo-files">
- <delete dir="${unpack.location}"/>
- </target>
-</project>
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/pom.xml b/branches/sca-java-1.5.1/modules/web-javascript-dojo/pom.xml
deleted file mode 100644
index 9c9a9fcb25..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/pom.xml
+++ /dev/null
@@ -1,125 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-web-javascript-dojo</artifactId>
- <name>Apache Tuscany SCA Web JavaScript for DOJO</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-http</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version> <!-- to keep compatible with older servlet containers -->
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <!-- version>1.1</version -->
- <dependencies>
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant-trax</artifactId>
- <version>1.6.5</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>install-dojo</id>
- <phase>validate</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-dojo.xml" target="install-dojo">
- <property name="localRepository" value="${settings.localRepository}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- <execution>
- <id>copy-dojo-files</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-dojo.xml" target="unpack-dojo-files">
- <property name="localRepository" value="${settings.localRepository}"/>
- <property name="artifactId" value="${artifactId}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- <execution>
- <id>clean-dojo-files</id>
- <phase>clean</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant antfile="./build-dojo.xml" target="clean-dojo-files">
- <property name="localRepository" value="${settings.localRepository}"/>
- <property name="artifactId" value="${artifactId}"/>
- </ant>
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java b/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java
deleted file mode 100644
index 987ef466fc..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoModuleActivator.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript.dojo;
-
-import java.net.URI;
-
-import javax.servlet.Servlet;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ModuleActivator;
-import org.apache.tuscany.sca.host.http.ServletHost;
-import org.apache.tuscany.sca.host.http.ServletHostExtensionPoint;
-
-public class DojoModuleActivator implements ModuleActivator {
- private static final String dojoBaseUri = URI.create("/dojo").toString();
- private static final String dojoUri = URI.create("/dojo/*").toString();
-
- private static final String tuscanyBaseUri = URI.create("/tuscany").toString();
- private static final String tuscanyUri = URI.create("/tuscany/*").toString();
-
- private ServletHost servletHost;
-
- public void start(ExtensionPointRegistry registry) {
- ServletHostExtensionPoint servletHosts = registry.getExtensionPoint(ServletHostExtensionPoint.class);
- this.servletHost = servletHosts.getServletHosts().get(0);
-
- if (servletHost == null) {
- throw new IllegalStateException("Can't find ServletHost reference !");
- }
-
- Servlet servlet = null;
-
- servlet = servletHost.getServletMapping(dojoBaseUri);
- if(servlet == null) {
- DojoResourceServlet baseResourceServlet = new DojoResourceServlet();
- servletHost.addServletMapping(dojoBaseUri, baseResourceServlet);
-
- DojoResourceServlet resourceServlet = new DojoResourceServlet();
- servletHost.addServletMapping(dojoUri, resourceServlet);
- }
-
- servlet = servletHost.getServletMapping(tuscanyBaseUri);
- if(servlet == null) {
- DojoResourceServlet baseResourceServlet = new DojoResourceServlet();
- servletHost.addServletMapping(tuscanyBaseUri, baseResourceServlet);
-
- DojoResourceServlet resourceServlet = new DojoResourceServlet();
- servletHost.addServletMapping(tuscanyUri, resourceServlet);
- }
-
- }
-
- public void stop(ExtensionPointRegistry registry) {
- Servlet servlet = servletHost.getServletMapping(dojoBaseUri);
- if(servlet != null) {
- servletHost.removeServletMapping(dojoBaseUri);
- servletHost.removeServletMapping(dojoUri);
-
- servletHost.removeServletMapping(tuscanyBaseUri);
- servletHost.removeServletMapping(tuscanyUri);
- }
-
- servletHost = null;
-
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoResourceServlet.java b/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoResourceServlet.java
deleted file mode 100644
index 86d04a05b5..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/java/org/apache/tuscany/sca/web/javascript/dojo/DojoResourceServlet.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript.dojo;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URLDecoder;
-
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-
-/**
- * A Resource servlet used to serve dojo files
- *
- * @version $Rev$ $Date$
- */
-public class DojoResourceServlet extends HttpServlet {
- private static final long serialVersionUID = -4743631858548812340L;
-
- public DojoResourceServlet() {
-
- }
-
-
- @Override
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
- String path = URLDecoder.decode(request.getRequestURI(), "UTF-8");
-
- if( path.startsWith("/dojo")) {
- //this is a workaround where we need to have dojo files in its own folder
- //to avoid clean target to clean other non dojo resources
- path = "dojo" + path;
- } else if( path.startsWith("/")) {
- path = path.substring(1);
- }
-
- // Write the response from the service implementation to the response
- // output stream
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(path);
- if(is != null) {
- OutputStream os = response.getOutputStream();
- byte[] buffer = new byte[2048];
- for (;;) {
- int n = is.read(buffer);
- if (n <= 0)
- break;
- os.write(buffer, 0, n);
- }
- os.flush();
- os.close();
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator b/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
deleted file mode 100644
index 34edcb5199..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
+++ /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.
-# Implementation class for the ModuleActivator
-org.apache.tuscany.sca.web.javascript.dojo.DojoModuleActivator;priority=9999
diff --git a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/tuscany/AtomService.js b/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/tuscany/AtomService.js
deleted file mode 100644
index 7b8943ba3b..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript-dojo/src/main/resources/tuscany/AtomService.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-dojo.provide("tuscany.AtomService");
-dojo.declare("tuscany.AtomService", null, {
- url:null,
- contentType: "application/atom+xml" /*application/atom+json*/,
- contentHandler: "xml" /*json*/,
-
- constructor: function(args){
- //summary:
- //url : Take a string as a url that points to the atom feed
- //contentType : Take the contentType to use when retrieving the atom feed
-
- if(args){
- var argUrl;
- var argContentType;
-
- if( dojo.isArray(args) ) {
- argUrl = args[0];
- argContentType = args[1];
- } else {
- argUrl = args;
- }
-
- //if the arg is a string, we assume it is a url to the atom feed
- if( (dojo.isString(argUrl)) || (argUrl instanceof dojo._Url)){
- if (argUrl instanceof dojo._Url){
- this.url = argUrl + "";
- }else{
- this.url = argUrl;
- }
- }
-
- if(argContentType) {
- if(dojo.isString(argContentType)) {
- if (argContentType == "application/atom+xml") {
- this.contentType = argContentType;
- this.contentHandler = "xml";
- } else if (argContentType == "application/atom+json") {
- this.contentType = argContentType;
- this.contentHandler = "json";
- }
- }
- }
- }
- },
-
- get: function(id /*string*/) {
- //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
- var xhrArgs = {
- url: this.url + "/" + id,
- handleAs: this.contentHandler,
- headers: {"Accept": this.contentType}
- };
-
- //Call the asynchronous xhrGet
- var deferred = dojo.xhrGet(xhrArgs);
-
- deferred.addErrback(function(error){
- alert("An unexpected error occurred: " + error);
- });
-
- return deferred;
- },
-
-
- post: function( entry /*entry object*/) {
- //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
- var xhrArgs = {
- url: this.url,
- handleAs: this.contentHandler,
- headers: {"Accept": this.contentType,
- "Content-Type": this.contentType},
- postData: entry
- };
-
- //Call the asynchronous xhrGet
- var deferred = dojo.xhrPost(xhrArgs);
-
- deferred.addErrback(function(error){
- alert("An unexpected error occurred: " + error);
- });
-
- return deferred;
- },
-
- put: function(id /*string*/, entry /*entry object*/) {
- //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
- var xhrArgs = {
- url: this.url + "/" + id,
- handleAs: this.contentHandler,
- headers: {"Accept": this.contentType,
- "Content-Type": this.contentType},
- postData: entry
- };
-
- //Call the asynchronous xhrGet
- var deferred = dojo.xhrPut(xhrArgs);
-
- deferred.addErrback(function(error){
- alert("An unexpected error occurred: " + error);
- });
-
- return deferred;
- },
-
- del: function(id /*string*/) {
- //The parameters to pass to xhrGet, the url, how to handle it, and the callbacks.
- var xhrArgs = {
- url: this.url + "/" + id,
- handleAs: this.contentHandler,
- headers: {"Accept": this.contentType}
- };
-
- //Call the asynchronous xhrGet
- var deferred = dojo.xhrDelete(xhrArgs);
-
- deferred.addErrback(function(error){
- alert("An unexpected error occurred: " + error);
- });
-
-
- return deferred;
- }
-});
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/LICENSE b/branches/sca-java-1.5.1/modules/web-javascript/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/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-java-1.5.1/modules/web-javascript/NOTICE b/branches/sca-java-1.5.1/modules/web-javascript/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/pom.xml b/branches/sca-java-1.5.1/modules/web-javascript/pom.xml
deleted file mode 100644
index 3d0b4d5c62..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/pom.xml
+++ /dev/null
@@ -1,67 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>tuscany-web-javascript</artifactId>
- <name>Apache Tuscany SCA Web JavaScript</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-core</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.core.web</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.core.web</Export-Package>
- <Import-Package>org.apache.tuscany.sca.assembly.xml;version="1.4", *</Import-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGenerator.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGenerator.java
deleted file mode 100644
index adfe449912..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGenerator.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.web.javascript;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.runtime.RuntimeComponent;
-
-
-/**
- * Widget component script generator interface
- * This generates the necessary JavaScript client code into a single JavaScript per component
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentJavaScriptGenerator {
-
- /**
- * Return the QName that identify the Component script generator
- * This is used to identify different generators supporting different JavaScript frameworks
- *
- * @return The QName
- */
- QName getQName();
-
- /**
- * Generate the Java Script code for a given component
- * - generate/append client proxyies as needed
- * - generate tuscany namespace as needed
- * - generate properties for JavaScript injection
- * - generate references for JavaScript injection
- *
- * @param component The SCA Component to be used
- * @param pw A Print Writer where the script should be written to
- * @throws IOException
- */
- void generateJavaScriptCode(RuntimeComponent component, PrintWriter pw) throws IOException;
-
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGeneratorExtensionPoint.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGeneratorExtensionPoint.java
deleted file mode 100644
index ac160d7d1a..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/ComponentJavaScriptGeneratorExtensionPoint.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.web.javascript;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-/**
- * Widget component script generator extension pointinterface
- *
- * @version $Rev$ $Date$
- */
-public interface ComponentJavaScriptGeneratorExtensionPoint {
-
- /**
- * Add a component script generator
- * @param componentScriptGenerator
- */
- void addComponentJavaScriptGenerator(ComponentJavaScriptGenerator componentScriptGenerator);
-
- /**
- * Remove a component script generator
- * @param componentScriptGenerator
- */
- void removeComponentJavaScriptGenerator(ComponentJavaScriptGenerator componentScriptGenerator);
-
- /**
- * Get a component scrpt generator instance based on QName
- * @param bindingName
- * @return
- */
- ComponentJavaScriptGenerator getComponentJavaScriptGenerator(QName bindingName);
-
- /**
- * Get a list of component script generator instances
- */
- List<ComponentJavaScriptGenerator> getComponentJavaScriptGenerators();
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java
deleted file mode 100644
index 79ddab1c60..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultComponentJavaScriptGeneratorExtensionPoint.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-
-/**
- * Default extension point for widget component script generator
- *
- * @version $Rev$ $Date$
- */
-public class DefaultComponentJavaScriptGeneratorExtensionPoint implements ComponentJavaScriptGeneratorExtensionPoint {
- private final List<ComponentJavaScriptGenerator> generators = new ArrayList<ComponentJavaScriptGenerator>();
- private final Map<QName, ComponentJavaScriptGenerator> generatorsByQName = new HashMap<QName, ComponentJavaScriptGenerator>();
-
- private ExtensionPointRegistry extensionPoints;
- private Monitor monitor = null;
-
- private boolean loaded = false;
-
- public DefaultComponentJavaScriptGeneratorExtensionPoint(ExtensionPointRegistry extensionPoints) {
- this.extensionPoints = extensionPoints;
-
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "web-javascript-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public void addComponentJavaScriptGenerator(ComponentJavaScriptGenerator componentScriptGenerator) {
- if (componentScriptGenerator.getQName() != null) {
- generatorsByQName.put(componentScriptGenerator.getQName(), componentScriptGenerator);
- }
-
- generators.add(componentScriptGenerator);
- }
-
- public void removeComponentJavaScriptGenerator(ComponentJavaScriptGenerator componentScriptGenerator) {
- if (componentScriptGenerator.getQName() != null) {
- generatorsByQName.remove(componentScriptGenerator.getQName());
- }
-
- generators.remove(componentScriptGenerator);
- }
-
-
- public ComponentJavaScriptGenerator getComponentJavaScriptGenerator(QName bindingName) {
- loadFactories();
- return generatorsByQName.get(bindingName);
- }
-
- public List<ComponentJavaScriptGenerator> getComponentJavaScriptGenerators() {
- loadFactories();
- return this.generators;
- }
-
- /**
- * Private Utility methods
- */
-
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- @SuppressWarnings("unchecked")
- private synchronized void loadFactories() {
- if (loaded) {
- return;
- }
-
- // Get the proxy factories declarations
- Set<ServiceDeclaration> factoryDeclarations = null;
- try {
- factoryDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(ComponentJavaScriptGenerator.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", factoryDeclarations, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration : factoryDeclarations) {
- // Create a factory, and register it
- ComponentJavaScriptGenerator generator = null;
- try {
- Class generatorClass = processorDeclaration.loadClass();
-
- Constructor<ComponentJavaScriptGenerator> constructor = generatorClass.getConstructor(ExtensionPointRegistry.class);
- generator = constructor.newInstance(extensionPoints);
-
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", generator, ie);
- throw ie;
- }
-
- addComponentJavaScriptGenerator(generator);
- }
-
- loaded = true;
- }
-
-
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java
deleted file mode 100644
index 6ec7577d52..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/DefaultJavascriptProxyFactoryExtensionPoint.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.extensibility.ServiceDeclaration;
-import org.apache.tuscany.sca.extensibility.ServiceDiscovery;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-
-/**
- * Default extension point for javascript proxy factories
- *
- * @version $Rev$ $Date$
- */
-public class DefaultJavascriptProxyFactoryExtensionPoint implements JavascriptProxyFactoryExtensionPoint {
- private final Map<QName, JavascriptProxyFactory> factoriesByQName = new HashMap<QName, JavascriptProxyFactory>();
- private final Map<Class<?>, JavascriptProxyFactory> factoriesByType = new HashMap<Class<?>, JavascriptProxyFactory>();
-
- private Monitor monitor = null;
-
- private boolean loaded = false;
-
- public DefaultJavascriptProxyFactoryExtensionPoint(ExtensionPointRegistry extensionPoints) {
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = utilities.getUtility(MonitorFactory.class);
- if (monitorFactory != null) {
- this.monitor = monitorFactory.createMonitor();
- }
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "web-javascript-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public void addProxyFactory(JavascriptProxyFactory javascriptProxyfactory) {
- if (javascriptProxyfactory.getModelType() != null) {
- factoriesByType.put(javascriptProxyfactory.getModelType(), javascriptProxyfactory);
- }
- if (javascriptProxyfactory.getQName() != null) {
- factoriesByQName.put(javascriptProxyfactory.getQName(), javascriptProxyfactory);
- }
- }
-
- public void removeProxyFactory(JavascriptProxyFactory javascriptProxyfactory) {
- if (javascriptProxyfactory.getModelType() != null) {
- factoriesByType.remove(javascriptProxyfactory.getModelType());
- }
- if (javascriptProxyfactory.getQName() != null) {
- factoriesByQName.remove(javascriptProxyfactory.getQName());
- }
- }
-
- public JavascriptProxyFactory getProxyFactory(QName bindingName) {
- loadFactories();
- return factoriesByQName.get(bindingName);
- }
-
- public JavascriptProxyFactory getProxyFactory(Class<?> bindingType) {
- loadFactories();
- Class<?>[] classes = bindingType.getInterfaces();
- for (Class<?> c : classes) {
- JavascriptProxyFactory proxyFactory = factoriesByType.get(c);
- if (proxyFactory != null) {
- return proxyFactory;
- }
- }
-
- //here we didn't find the proxy factory for the biding
- JavascriptProxyFactory factory = null;
- if (bindingType.isInterface()) {
- // Dynamically load a factory class declared under META-INF/services
- try {
- Class<?> factoryClass = ServiceDiscovery.getInstance().loadFirstServiceClass(bindingType);
- if (factoryClass != null) {
-
- try {
- // Default empty constructor
- Constructor<?> constructor = factoryClass.getConstructor();
- factory = (JavascriptProxyFactory) constructor.newInstance();
- } catch (NoSuchMethodException e) {
-
- // Constructor taking the model factory extension point
- Constructor<?> constructor = factoryClass.getConstructor(ModelFactoryExtensionPoint.class);
- factory = (JavascriptProxyFactory) constructor.newInstance(this);
- }
-
- // Cache the loaded factory
- addProxyFactory(factory);
- }
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
- } else {
-
- // Call the newInstance static method on the factory abstract class
- try {
- factory = (JavascriptProxyFactory) ServiceDiscovery.getInstance().newFactoryClassInstance(bindingType);
- } catch (Exception e) {
- throw new IllegalArgumentException(e);
- }
-
- // Cache the factory
- addProxyFactory(factory);
- }
-
- return factory;
- }
-
- /**
- * Private Utility methods
- */
-
- /**
- * Returns a QName object from a QName expressed as {ns}name
- * or ns#name.
- *
- * @param qname
- * @return
- */
- private static QName getQName(String qname) {
- if (qname == null) {
- return null;
- }
- qname = qname.trim();
- if (qname.startsWith("{")) {
- int h = qname.indexOf('}');
- if (h != -1) {
- return new QName(qname.substring(1, h), qname.substring(h + 1));
- }
- } else {
- int h = qname.indexOf('#');
- if (h != -1) {
- return new QName(qname.substring(0, h), qname.substring(h + 1));
- }
- }
- throw new IllegalArgumentException("Invalid qname: "+qname);
- }
-
- /**
- * Lazily load artifact processors registered in the extension point.
- */
- private synchronized void loadFactories() {
- if (loaded) {
- return;
- }
-
- // Get the proxy factories declarations
- Set<ServiceDeclaration> factoryDeclarations = null;
- try {
- factoryDeclarations = ServiceDiscovery.getInstance().getServiceDeclarations(JavascriptProxyFactory.class);
- } catch (IOException e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", factoryDeclarations, ie);
- throw ie;
- }
-
- for (ServiceDeclaration processorDeclaration : factoryDeclarations) {
- Map<String, String> attributes = processorDeclaration.getAttributes();
-
- // Load a StAX artifact processor
-
- // Get the model QName
- QName artifactType = getQName(attributes.get("qname"));
-
- // Get the model class name
- String modelTypeName = attributes.get("model");
-
- // Create a factory, and register it
- JavascriptProxyFactory proxyFactory = null;
- try {
- proxyFactory = (JavascriptProxyFactory) processorDeclaration.loadClass().newInstance();
- } catch (Exception e) {
- IllegalStateException ie = new IllegalStateException(e);
- error("IllegalStateException", proxyFactory, ie);
- throw ie;
- }
-
- addProxyFactory(proxyFactory);
- }
-
- loaded = true;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactory.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactory.java
deleted file mode 100644
index 10455ef764..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactory.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.ComponentReference;
-
-/**
- * Javascript Proxy Factory used to allow Web related bindings to generate
- * client js proxyies
- *
- * @version $Rev$ $Date$
- */
-public interface JavascriptProxyFactory {
-
- /**
- * The binding model type associated with this factory
- * @return the binding model type
- */
- Class<?> getModelType();
-
- /**
- * The binding qname associated with this factory
- * @return the binding qname
- */
- QName getQName();
-
- /**
- * Get the Javascript proxy client file name
- * @return the javascript file name
- */
- String getJavascriptProxyFile();
-
- /**
- * Get the Javascript proxy client contents as a stream
- * @return
- */
- InputStream getJavascriptProxyFileAsStream() throws IOException;
-
-
- /**
- * Create a JavaScript Proxy for a given reference
- * @param componentReference The reference
- * @return the javascript proxy code
- * @throws IOException
- */
- String createJavascriptReference(ComponentReference componentReference) throws IOException;
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactoryExtensionPoint.java b/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactoryExtensionPoint.java
deleted file mode 100644
index bf0e6e0526..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/java/org/apache/tuscany/sca/web/javascript/JavascriptProxyFactoryExtensionPoint.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.web.javascript;
-
-import javax.xml.namespace.QName;
-
-public interface JavascriptProxyFactoryExtensionPoint {
- /**
- * Add Javascript proxy factory
- *
- * @param javascriptProxyfactory The Javascript proxy factory
- */
- void addProxyFactory(JavascriptProxyFactory javascriptProxyfactory);
-
- /**
- * Remove Javascript proxy factory
- *
- * @param javascriptProxyfactory The Javascript proxy fatory
- */
- void removeProxyFactory(JavascriptProxyFactory javascriptProxyfactory);
-
- /**
- * Returns the Javascript proxy factory associated with the given QName
- * @param bindingName
- * @return
- */
- JavascriptProxyFactory getProxyFactory(QName bindingName);
-
- /**
- * Returns the Javascript proxy factory associated with the given Type
- * @param bindingType
- * @return
- */
- JavascriptProxyFactory getProxyFactory(Class<?> bindingType);
-}
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGeneratorExtensionPoint b/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGeneratorExtensionPoint
deleted file mode 100644
index 6a28e3481d..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.ComponentJavaScriptGeneratorExtensionPoint
+++ /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.web.javascript.DefaultComponentJavaScriptGeneratorExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint b/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint
deleted file mode 100644
index 95a7cecd2b..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/META-INF/services/org.apache.tuscany.sca.web.javascript.JavascriptProxyFactoryExtensionPoint
+++ /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.web.javascript.DefaultJavascriptProxyFactoryExtensionPoint
diff --git a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/web-javascript-validation-messages.properties b/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/web-javascript-validation-messages.properties
deleted file mode 100644
index dbc7317653..0000000000
--- a/branches/sca-java-1.5.1/modules/web-javascript/src/main/resources/web-javascript-validation-messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-IllegalArgumentException = Invalid qname: {0}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/LICENSE b/branches/sca-java-1.5.1/modules/workspace-impl/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/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-java-1.5.1/modules/workspace-impl/NOTICE b/branches/sca-java-1.5.1/modules/workspace-impl/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/pom.xml b/branches/sca-java-1.5.1/modules/workspace-impl/pom.xml
deleted file mode 100644
index 9a83ae72e0..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/pom.xml
+++ /dev/null
@@ -1,83 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-workspace-impl</artifactId>
- <name>Apache Tuscany SCA Domain Workspace Implementation</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.workspace.impl</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.workspace*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java
deleted file mode 100644
index ebfc77f5e3..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderImpl.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.builder.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.resolver.DefaultImportModelResolver;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
-
-/**
- * A contribution dependency builder.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionDependencyBuilderImpl implements ContributionDependencyBuilder {
- private static final Logger logger = Logger.getLogger(ContributionDependencyBuilderImpl.class.getName());
-
- private Monitor monitor;
-
- /**
- * Constructs a new ContributionDependencyBuilder.
- */
- public ContributionDependencyBuilderImpl(Monitor monitor) {
-
- this.monitor = monitor;
- }
-
- /**
- * Calculate the set of contributions that a contribution depends on.
- * @param contribution
- * @param workspace
- * @return
- */
- public List<Contribution> buildContributionDependencies(Contribution contribution, Workspace workspace) {
- List<Contribution> dependencies = new ArrayList<Contribution>();
- Set<Contribution> set = new HashSet<Contribution>();
-
- dependencies.add(contribution);
- set.add(contribution);
- addContributionDependencies(contribution, workspace, dependencies, set);
-
- Collections.reverse(dependencies);
- return dependencies;
- }
-
- /**
- * Analyze a contribution and add its dependencies to the given dependency set.
- * @param contribution
- * @param workspace
- * @param dependencies
- * @param set
- */
- private void addContributionDependencies(Contribution contribution, Workspace workspace, List<Contribution> dependencies, Set<Contribution> set) {
-
- // Go through the contribution imports
- for (Import import_: contribution.getImports()) {
- boolean resolved = false;
-
- // Go through all contribution candidates and their exports
- List<Export> matchingExports = new ArrayList<Export>();
- for (Contribution dependency: workspace.getContributions()) {
- if (dependency == contribution) {
- // Do not self import
- continue;
- }
- for (Export export: dependency.getExports()) {
-
- // If an export from a contribution matches the import in hand
- // add that contribution to the dependency set
- if (import_.match(export)) {
- resolved = true;
- matchingExports.add(export);
-
- if (!set.contains(dependency)) {
- set.add(dependency);
- dependencies.add(dependency);
-
- // Now add the dependencies of that contribution
- addContributionDependencies(dependency, workspace, dependencies, set);
- }
- }
- }
- }
-
- if (resolved) {
-
- // Initialize the import's model resolver with a delegating model
- // resolver which will delegate to the matching exports
- import_.setModelResolver(new DefaultImportModelResolver(matchingExports));
-
- } else {
- // Record import resolution issue
- if (!(import_ instanceof DefaultImport)) {
- warning("UnresolvedImport", import_, import_);
- }
- }
- }
- }
-
- /**
- * Report a warning.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(getClass().getName(), "workspace-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
deleted file mode 100644
index 4aa619aa3f..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionContentProcessor.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.workspace.processor.impl;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
-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.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner;
-import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
-
-/**
- * URLArtifactProcessor that handles contribution files and the artifacts they contain
- * and returns a contribution model.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionContentProcessor implements URLArtifactProcessor<Contribution>{
- private ExtensionPointRegistry extensionPoints;
- private ContributionFactory contributionFactory;
- private ModelResolverExtensionPoint modelResolvers;
- private ModelFactoryExtensionPoint modelFactories;
- private URLArtifactProcessor<Object> artifactProcessor;
- private StAXArtifactProcessor<Object> extensionProcessor;
- private UtilityExtensionPoint utilities;
- private Monitor monitor = null;
- private ModelResolver policyDefinitionsResolver = null;
- private List<SCADefinitions> policyDefinitions = null;
-
- public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
- this.extensionPoints = extensionPoints;
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- hackResolvers(modelResolvers);
- this.monitor = monitor;
- URLArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- this.artifactProcessor = new ExtensibleURLArtifactProcessor(artifactProcessors, this.monitor);
-
- // Get and initialize artifact processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- this.extensionProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- }
-
- public ContributionContentProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor,
- ModelResolver policyDefinitionsResolver, List<SCADefinitions> policyDefinitions) {
- this(extensionPoints, monitor);
- this.policyDefinitionsResolver = policyDefinitionsResolver;
- this.policyDefinitions = policyDefinitions;
- }
-
- /*
- public ContributionContentProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers,
- URLArtifactProcessor<Object> artifactProcessor, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- this.modelFactories = modelFactories;
- this.modelResolvers = modelResolvers;
- hackResolvers(modelResolvers);
- this.artifactProcessor = artifactProcessor;
- this.extensionProcessor = extensionProcessor;
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- this.monitor = monitor;
- }
- */
-
- public String getArtifactType() {
- return ".contribution/content";
- }
-
- public Class<Contribution> getModelType() {
- return Contribution.class;
- }
-
- public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
-
- // Create contribution model
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(contributionURI.toString());
- contribution.setLocation(contributionURL.toString());
- ModelResolver modelResolver;
- if (policyDefinitionsResolver != null) {
- modelResolver = new ExtensibleModelResolver(contribution, extensionPoints, modelResolvers, modelFactories, policyDefinitionsResolver);
- } else {
- modelResolver = new ExtensibleModelResolver(contribution, extensionPoints);
- }
- contribution.setModelResolver(modelResolver);
- contribution.setUnresolved(true);
-
- // Create a contribution scanner
- ContributionScanner scanner;
- if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
- scanner = new DirectoryContributionScanner();
- } else {
- scanner = new JarContributionScanner();
- }
-
- // Scan the contribution and list the artifacts contained in it
- List<Artifact> artifacts = contribution.getArtifacts();
- boolean contributionMetadata = false;
- List<String> artifactURIs = scanner.getArtifacts(contributionURL);
- for (String artifactURI: artifactURIs) {
- URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
-
- // Add the deployed artifact model to the contribution
- Artifact artifact = this.contributionFactory.createArtifact();
- artifact.setURI(artifactURI);
- artifact.setLocation(artifactURL.toString());
- artifacts.add(artifact);
- modelResolver.addModel(artifact);
-
- // Read each artifact
- Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
- if (model != null) {
- artifact.setModel(model);
-
- // Add the loaded model to the model resolver
- modelResolver.addModel(model);
-
- // Add policy definitions to the list of policy definitions
- if (policyDefinitionsResolver != null) {
- addPolicyDefinitions(model);
- }
-
- // Merge contribution metadata into the contribution model
- if (model instanceof ContributionMetadata) {
- contributionMetadata = true;
- ContributionMetadata c = (ContributionMetadata)model;
- contribution.getImports().addAll(c.getImports());
- contribution.getExports().addAll(c.getExports());
- contribution.getDeployables().addAll(c.getDeployables());
- contribution.getExtensions().addAll(c.getExtensions());
- contribution.getAttributeExtensions().addAll(c.getAttributeExtensions());
- }
- }
- }
-
- // If no sca-contribution.xml file was provided then just consider
- // all composites in the contribution as deployables
- if (!contributionMetadata) {
- for (Artifact artifact: artifacts) {
- if (artifact.getModel() instanceof Composite) {
- contribution.getDeployables().add((Composite)artifact.getModel());
- }
- }
-
- // Add default contribution import and export
- DefaultImport defaultImport = contributionFactory.createDefaultImport();
- defaultImport.setModelResolver(new DefaultModelResolver());
- contribution.getImports().add(defaultImport);
- DefaultExport defaultExport = contributionFactory.createDefaultExport();
- contribution.getExports().add(defaultExport);
- }
-
- return contribution;
- }
-
- public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the contribution model itself
- ModelResolver contributionResolver = contribution.getModelResolver();
- contribution.setUnresolved(false);
- contributionResolver.addModel(contribution);
-
- // Resolve imports and exports
- for (Export export: contribution.getExports()) {
- if (export instanceof DefaultExport) {
-
- // Initialize the default export's resolver
- export.setModelResolver(contributionResolver);
-
- } else {
- extensionProcessor.resolve(export, contributionResolver);
- }
- }
- for (Import import_: contribution.getImports()) {
- extensionProcessor.resolve(import_, contributionResolver);
- }
-
- // Resolve all artifact models
- for (Artifact artifact : contribution.getArtifacts()) {
- Object model = artifact.getModel();
- if (model != null) {
- try {
- artifactProcessor.resolve(model, contributionResolver);
- } catch (ContributionResolveException e) {
- throw e;
- } catch (Exception e) {
- throw new ContributionResolveException(e);
- }
- }
- }
-
- // Resolve deployable composites
- List<Composite> deployables = contribution.getDeployables();
- for (int i = 0, n = deployables.size(); i < n; i++) {
- Composite deployable = deployables.get(i);
- Composite resolved = (Composite)contributionResolver.resolveModel(Composite.class, deployable);
- if (resolved != deployable) {
- deployables.set(i, resolved);
- }
- }
- }
-
- /**
- * FIXME Temporary hack for testing the ClassLoaderModelResolver.
- *
- * @param modelResolvers
- */
- private static void hackResolvers(ModelResolverExtensionPoint modelResolvers) {
- Class<?> resolverClass = modelResolvers.getResolver(ClassReference.class);
- if (resolverClass==null || !resolverClass.getName().equals("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver")) {
- try {
- Class<?> loaderResolverClass = Class.forName("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver", true, ContributionContentProcessor.class.getClassLoader());
- modelResolvers.addResolver(ClassReference.class, (Class<? extends ModelResolver>)loaderResolverClass);
- } catch (ClassNotFoundException e) {
- }
- }
- }
-
- /**
- * The following code was copied from ContributionServiceImpl to fix TUSCANY-3171
- *
- * @param model
- */
- private void addPolicyDefinitions(Object model) {
-
- // Add policy definitions to the list of policy definitions
- if (model instanceof SCADefinitions) {
- policyDefinitions.add((SCADefinitions)model);
-
- SCADefinitions definitions = (SCADefinitions)model;
- for (Intent intent : definitions.getPolicyIntents() ) {
- policyDefinitionsResolver.addModel(intent);
- }
-
- for (PolicySet policySet : definitions.getPolicySets() ) {
- policyDefinitionsResolver.addModel(policySet);
- }
-
- for (IntentAttachPointType attachPointType : definitions.getBindingTypes() ) {
- policyDefinitionsResolver.addModel(attachPointType);
- }
-
- for (IntentAttachPointType attachPointType : definitions.getImplementationTypes() ) {
- policyDefinitionsResolver.addModel(attachPointType);
- }
- for (Object binding : definitions.getBindings() ) {
- policyDefinitionsResolver.addModel(binding);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
deleted file mode 100644
index d7a05ff532..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/processor/impl/ContributionInfoProcessor.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tuscany.sca.workspace.processor.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.List;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ContributionMetadata;
-import org.apache.tuscany.sca.contribution.DefaultExport;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ClassReference;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolverExtensionPoint;
-import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.workspace.scanner.impl.DirectoryContributionScanner;
-import org.apache.tuscany.sca.workspace.scanner.impl.JarContributionScanner;
-
-/**
- * URLArtifactProcessor that handles contribution files and returns a contribution
- * info model.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionInfoProcessor implements URLArtifactProcessor<Contribution>{
- private ExtensionPointRegistry extensionPoints;
- private ContributionFactory contributionFactory;
- private ModelResolverExtensionPoint modelResolvers;
- private ModelFactoryExtensionPoint modelFactories;
- private URLArtifactProcessorExtensionPoint artifactProcessors;
- private URLArtifactProcessor<Object> artifactProcessor;
- private StAXArtifactProcessor<Object> extensionProcessor;
-
- public ContributionInfoProcessor(ExtensionPointRegistry extensionPoints, Monitor monitor) {
- this.extensionPoints = extensionPoints;
- this.modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- this.modelResolvers = extensionPoints.getExtensionPoint(ModelResolverExtensionPoint.class);
- hackResolvers(modelResolvers);
- URLArtifactProcessorExtensionPoint artifactProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- this.artifactProcessors = artifactProcessors;
- this.artifactProcessor = new ExtensibleURLArtifactProcessor(artifactProcessors, monitor);
- // Get and initialize artifact processors
- StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
- XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);
- this.extensionProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, outputFactory, monitor);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- }
-
- /*
- public ContributionInfoProcessor(ModelFactoryExtensionPoint modelFactories, ModelResolverExtensionPoint modelResolvers, URLArtifactProcessor<Object> artifactProcessor) {
- this.modelFactories = modelFactories;
- this.modelResolvers = modelResolvers;
- hackResolvers(modelResolvers);
- this.artifactProcessor = artifactProcessor;
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- }
- */
-
- public String getArtifactType() {
- return ".contribution/info";
- }
-
- public Class<Contribution> getModelType() {
- return null;
- }
-
- public Contribution read(URL parentURL, URI contributionURI, URL contributionURL) throws ContributionReadException {
-
- // Create contribution model
- Contribution contribution = contributionFactory.createContribution();
- contribution.setURI(contributionURI.toString());
- contribution.setLocation(contributionURL.toString());
- ModelResolver modelResolver = new ExtensibleModelResolver(contribution, extensionPoints);
- contribution.setModelResolver(modelResolver);
- contribution.setUnresolved(true);
-
- // Create a contribution scanner
- ContributionScanner scanner;
- if ("file".equals(contributionURL.getProtocol()) && new File(contributionURL.getFile()).isDirectory()) {
- scanner = new DirectoryContributionScanner();
- } else {
- scanner = new JarContributionScanner();
- }
-
- // Read generated and user sca-contribution.xml files
- boolean contributionMetadata = false;
- for (String path: new String[]{
- Contribution.SCA_CONTRIBUTION_GENERATED_META,
- Contribution.SCA_CONTRIBUTION_META}) {
- URL url = scanner.getArtifactURL(contributionURL, path);
- try {
- // Check if the file actually exists before trying to read it
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- InputStream is = connection.getInputStream();
- is.close();
- } catch (IOException e) {
- continue;
- }
- contributionMetadata = true;
-
- // Read the sca-contribution.xml file
- ContributionMetadata c = (ContributionMetadata)artifactProcessor.read(contributionURL, URI.create(path), url);
- contribution.getImports().addAll(c.getImports());
- contribution.getExports().addAll(c.getExports());
- contribution.getDeployables().addAll(c.getDeployables());
- contribution.getExtensions().addAll(c.getExtensions());
- contribution.getAttributeExtensions().addAll(c.getAttributeExtensions());
- }
-
- // If no sca-contribution.xml file was provided then consider
- // all composites in the contribution as deployables, and also
- // read any files that are explicitly asssigned artifact processors
- // as they are likely to provide relevant metadata info
- if (!contributionMetadata) {
- List<String> artifactURIs;
- try {
- artifactURIs = scanner.getArtifacts(contributionURL);
- } catch (ContributionReadException e) {
- artifactURIs = null;
- }
- if (artifactURIs != null) {
- for (String artifactURI: artifactURIs) {
- boolean read = false;
- if (artifactURI.endsWith(".composite")) {
- read = true;
- } else {
- int s= artifactURI.lastIndexOf("/");
- String fileName = artifactURI.substring(s + 1);
- if (artifactProcessors.getProcessor(fileName) != null) {
- read = true;
- }
- }
- if (read) {
- URL artifactURL = scanner.getArtifactURL(contributionURL, artifactURI);
-
- // Read each artifact
- Object model = artifactProcessor.read(contributionURL, URI.create(artifactURI), artifactURL);
-
- // In the absence of more info, consider all composites as deployable
- if (model instanceof Composite) {
- contribution.getDeployables().add((Composite)model);
- }
- }
- }
- }
-
- // Add default contribution import and export
- DefaultImport defaultImport = contributionFactory.createDefaultImport();
- defaultImport.setModelResolver(new DefaultModelResolver());
- contribution.getImports().add(defaultImport);
- DefaultExport defaultExport = contributionFactory.createDefaultExport();
- contribution.getExports().add(defaultExport);
- }
-
- return contribution;
- }
-
- public void resolve(Contribution contribution, ModelResolver resolver) throws ContributionResolveException {
-
- // Mark the contribution model resolved
- ModelResolver contributionResolver = contribution.getModelResolver();
- contribution.setUnresolved(false);
- contributionResolver.addModel(contribution);
-
- // Resolve imports and exports
- for (Export export: contribution.getExports()) {
- if (export instanceof DefaultExport) {
-
- // Initialize the default export's resolver
- export.setModelResolver(contributionResolver);
-
- } else {
- extensionProcessor.resolve(export, contributionResolver);
- }
- }
- for (Import import_: contribution.getImports()) {
- extensionProcessor.resolve(import_, contributionResolver);
- }
-
- }
-
- /**
- * FIXME Temporary hack for testing the ClassLoaderModelResolver.
- *
- * @param modelResolvers
- */
- private static void hackResolvers(ModelResolverExtensionPoint modelResolvers) {
- Class<?> resolverClass = modelResolvers.getResolver(ClassReference.class);
- if (resolverClass==null || !resolverClass.getName().equals("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver")) {
- try {
- Class<?> loaderResolverClass = Class.forName("org.apache.tuscany.sca.contribution.java.impl.ClassLoaderModelResolver", true, ContributionContentProcessor.class.getClassLoader());
- modelResolvers.addResolver(ClassReference.class, (Class<? extends ModelResolver>)loaderResolverClass);
- } catch (ClassNotFoundException e) {
- }
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.java
deleted file mode 100644
index 45ba8c0609..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/DirectoryContributionScanner.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.workspace.scanner.impl;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * Folder contribution processor.
- *
- * @version $Rev$ $Date$
- */
-public class DirectoryContributionScanner implements ContributionScanner {
-
- public DirectoryContributionScanner() {
- }
-
- public String getContributionType() {
- return "application/vnd.tuscany.folder";
- }
-
- public URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException {
- File directory = directory(contributionURL);
- File file = new File(directory, artifact);
- try {
- return file.toURI().toURL();
- } catch (MalformedURLException e) {
- throw new ContributionReadException(e);
- }
- }
-
- public List<String> getArtifacts(URL contributionURL) throws ContributionReadException {
- File directory = directory(contributionURL);
- List<String> artifacts = new ArrayList<String>();
- try {
- traverse(artifacts, directory, directory);
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
- return artifacts;
- }
-
- /**
- * Recursively traverse a root directory
- *
- * @param fileList
- * @param file
- * @param root
- * @throws IOException
- */
- private static void traverse(List<String> fileList, File file, File root) throws IOException {
- if (file.isFile()) {
- fileList.add(root.toURI().relativize(file.toURI()).toString());
- } else if (file.isDirectory()) {
- String uri = root.toURI().relativize(file.toURI()).toString();
- if (uri.endsWith("/")) {
- uri = uri.substring(0, uri.length() - 1);
- }
- fileList.add(uri);
-
- File[] files = file.listFiles();
- for (File f: files) {
- if (!f.getName().startsWith(".")) {
- traverse(fileList, f, root);
- }
- }
- }
- }
-
- private static File directory(URL url) throws ContributionReadException {
- File file;
- try {
- file = new File(url.toURI());
- } catch (URISyntaxException e) {
- throw new ContributionReadException(e);
- }
- if (!file.exists() || !file.isDirectory()) {
- throw new ContributionReadException(url.toString());
- }
- return file;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.java
deleted file mode 100644
index 9dd1b3a15b..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/java/org/apache/tuscany/sca/workspace/scanner/impl/JarContributionScanner.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.workspace.scanner.impl;
-
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-
-import org.apache.tuscany.sca.contribution.scanner.ContributionScanner;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-
-/**
- * JAR Contribution processor.
- *
- * @version $Rev$ $Date$
- */
-public class JarContributionScanner implements ContributionScanner {
-
- public JarContributionScanner() {
- }
-
- public String getContributionType() {
- return "application/x-compressed";
- }
-
- public URL getArtifactURL(URL contributionURL, String artifact) throws ContributionReadException {
- try {
- URL url;
- if (contributionURL.toString().startsWith("jar:")) {
- url = new URL(contributionURL, artifact.toString());
- } else {
- url = new URL("jar:" + contributionURL.toExternalForm() + "!/" + artifact);
- }
- return url;
- } catch (MalformedURLException e) {
- throw new ContributionReadException(e);
- }
- }
-
- public List<String> getArtifacts(URL contributionURL) throws ContributionReadException {
-
- // Assume the URL references a JAR file
- try {
- URLConnection connection = contributionURL.openConnection();
- connection.setUseCaches(false);
- JarInputStream jar = new JarInputStream(connection.getInputStream());
- try {
- Set<String> names = new HashSet<String>();
- while (true) {
- JarEntry entry = jar.getNextJarEntry();
- if (entry == null) {
- // EOF
- break;
- }
-
- String name = entry.getName();
- if (name.length() != 0 && !name.startsWith(".")) {
-
- // Trim trailing /
- if (name.endsWith("/")) {
- name = name.substring(0, name.length() - 1);
- }
-
- // Add the entry name
- if (!names.contains(name)) {
- names.add(name);
-
- // Add parent folder names to the list too
- for (;;) {
- int s = name.lastIndexOf('/');
- if (s == -1) {
- name = "";
- } else {
- name = name.substring(0, s);
- }
- if (name.length() != 0 && !names.contains(name)) {
- names.add(name);
- } else {
- break;
- }
- }
- }
- }
- }
-
- // Return list of URIs
- List<String> artifacts = new ArrayList<String>(names);
- return artifacts;
-
- } finally {
- jar.close();
- }
- } catch (IOException e) {
- throw new ContributionReadException(e);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 41d0ebe27d..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.workspace.processor.impl.ContributionContentProcessor;type=.contribution/content,model=org.apache.tuscany.sca.contribution.Contribution
-org.apache.tuscany.sca.workspace.processor.impl.ContributionInfoProcessor;type=.contribution/info
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages.properties b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages.properties
deleted file mode 100644
index 0c07a3a30f..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-
-UnresolvedImport = Unresolved import: Import = {0}
diff --git a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages_it.properties b/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages_it.properties
deleted file mode 100644
index 2e8326c062..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/main/resources/workspace-validation-messages_it.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT 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-java-1.5.1/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java b/branches/sca-java-1.5.1/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java
deleted file mode 100644
index f7b6b35679..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-impl/src/test/java/org/apache/tuscany/sca/workspace/builder/impl/ContributionDependencyBuilderTestCase.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.builder.impl;
-
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceExport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImport;
-import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory;
-import org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl;
-import org.apache.tuscany.sca.workspace.DefaultWorkspaceFactory;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-
-/**
- * Test the contribution dependency analyzer.
- *
- * @version $Rev$ $Date$
- */
-public class ContributionDependencyBuilderTestCase extends TestCase {
-
- private ContributionFactory contributionFactory;
- private WorkspaceFactory workspaceFactory;
- private NamespaceImportExportFactory importExportFactory;
-
- @Override
- public void setUp() throws Exception {
- contributionFactory = new DefaultContributionFactory();
- workspaceFactory = new DefaultWorkspaceFactory();
- importExportFactory = new NamespaceImportExportFactoryImpl();
- }
-
- @Override
- public void tearDown() throws Exception {
- }
-
- public void testAnalyze() {
- Workspace workspace = workspaceFactory.createWorkspace();
- Contribution importer = contributionFactory.createContribution();
- importer.setURI("importer");
- workspace.getContributions().add(importer);
- NamespaceImport import_ = importExportFactory.createNamespaceImport();
- import_.setNamespace("http://foo");
- importer.getImports().add(import_);
-
- Contribution imported = contributionFactory.createContribution();
- imported.setURI("imported");
- workspace.getContributions().add(imported);
- NamespaceExport export = importExportFactory.createNamespaceExport();
- export.setNamespace("http://foo");
- imported.getExports().add(export);
- import_ = importExportFactory.createNamespaceImport();
- import_.setNamespace("http://bar");
- imported.getImports().add(import_);
-
- Contribution imported2 = contributionFactory.createContribution();
- imported2.setURI("imported2");
- workspace.getContributions().add(imported2);
- export = importExportFactory.createNamespaceExport();
- export.setNamespace("http://bar");
- imported2.getExports().add(export);
-
- Contribution another = contributionFactory.createContribution();
- another.setURI("another");
- workspace.getContributions().add(another);
- export = importExportFactory.createNamespaceExport();
- export.setNamespace("http://another");
- another.getExports().add(export);
-
- ContributionDependencyBuilderImpl analyzer = new ContributionDependencyBuilderImpl(null);
- List<Contribution> dependencies = analyzer.buildContributionDependencies(importer, workspace);
- assertTrue(dependencies.size() == 3);
- assertTrue(dependencies.contains(importer));
- assertTrue(dependencies.contains(imported));
- assertTrue(dependencies.contains(imported2));
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-manager/LICENSE b/branches/sca-java-1.5.1/modules/workspace-manager/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-manager/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-java-1.5.1/modules/workspace-manager/NOTICE b/branches/sca-java-1.5.1/modules/workspace-manager/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-manager/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/workspace-manager/pom.xml b/branches/sca-java-1.5.1/modules/workspace-manager/pom.xml
deleted file mode 100644
index c13ba26e2c..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-manager/pom.xml
+++ /dev/null
@@ -1,88 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-workspace-manager</artifactId>
- <name>Apache Tuscany SCA Domain Workspace Manager</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-sca-api</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-host-embedded</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.workspace</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.workspace*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/WorkspaceManager.java b/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/WorkspaceManager.java
deleted file mode 100644
index 0ea82f8e86..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/WorkspaceManager.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.manager;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.manager.impl.WorkspaceManagerImpl;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * This workspace manager class provides an SPI for firing up the Tuscany runtime
- * and for providing access to the Tuscany ExtensionPointRegsitry. With a reference to the
- * registry you can add new extension points programmatically before starting the runtime.
- * Once the runtime is started you can read contributions, create a workspace, populate it
- * and then resolve it.
- *
- * A workspace is a collection of contributions. A workspace populated
- * with one or more contribution models can be resolved to ensure
- * that all referenced artifacts are located. When more than one contribution
- * model is present resolution takes into account the import and export relationships
- * between contributions.
- */
-public abstract class WorkspaceManager {
-
- /**
- * Get a new instance of the WorkspaceManager. Each call will create a
- * distinct instance.
- *
- * @return workspace manager
- */
- public static WorkspaceManager newInstance() throws ServiceRuntimeException{
- try {
- // replace with service discovery lookup?
- return new WorkspaceManagerImpl();
- } catch(Exception ex){
- throw new ServiceRuntimeException(ex);
- }
- }
-
- /**
- * If you want to add new extensions to the extension point
- * registry and have the runtime take notice of them you need
- * to do this before calling start
- */
- public abstract ExtensionPointRegistry getRegistry();
-
- /**
- * Starting the runtime creates the extensible model processors and
- * resolvers based on the extension points currently found in the
- * extension point registry.
- */
- public abstract void start() throws ServiceRuntimeException;
-
- /**
- * Remove any resources being held by the runtime
- */
- public abstract void stop() throws ServiceRuntimeException;
-
- /**
- * Create an empty workspace
- *
- * @return workspace
- */
- public abstract Workspace createWorkspace() throws ServiceRuntimeException;
-
- /**
- * Create a contribution model by reading from the specified location URL
- *
- * @param name the URI that's given to the contribution
- * @param location the URL of the contribution to be read
- */
- public abstract Contribution readContribution(String name, String location) throws ServiceRuntimeException;
-
- /**
- * Add a contribution to a workspace
- *
- * @param workspace the workspace to be extended
- * @param contribution the contribution to be added
- */
- public abstract void addContributionToWorkspace(Workspace workspace, Contribution contribution) throws ServiceRuntimeException;
-
- /**
- * Resolve all of the contributions in the workspace
- *
- * @param workspace
- */
- public abstract void resolveWorkspace(Workspace workspace) throws ServiceRuntimeException;
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/impl/WorkspaceManagerImpl.java b/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/impl/WorkspaceManagerImpl.java
deleted file mode 100644
index f95f74ab2c..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-manager/src/main/java/org/apache/tuscany/sca/workspace/manager/impl/WorkspaceManagerImpl.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.manager.impl;
-
-import java.io.File;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.host.embedded.impl.ReallySmallRuntime;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-import org.apache.tuscany.sca.workspace.builder.ContributionDependencyBuilder;
-import org.apache.tuscany.sca.workspace.builder.impl.ContributionDependencyBuilderImpl;
-import org.apache.tuscany.sca.workspace.manager.WorkspaceManager;
-import org.osoa.sca.ServiceRuntimeException;
-
-/**
- * This workspace manager class provides an SPI for firing up the Tuscany runtime
- * and for providing access to the Tuscany ExtensionPointRegsitry. With a reference to the
- * registry you can add new extension points programmatically before starting the runtime.
- * Once the runtime is started you can read contributions, create a workspace, populate it
- * and then resolve it.
- *
- * A workspace is a collection of contributions. A workspace populated
- * with one or more contribution models can be resolved to ensure
- * that all referenced artifacts are located. When more than one contribution
- * model is present resolution takes into account the import and export relationships
- * between contributions.
- */
-public class WorkspaceManagerImpl extends WorkspaceManager {
-
- private ReallySmallRuntime runtime;
-
- private ModelFactoryExtensionPoint modelFactories;
- private URLArtifactProcessorExtensionPoint artifactProcessorExtensions;
- private UtilityExtensionPoint utilities;
-
- private WorkspaceFactory workspaceFactory;
- private URLArtifactProcessor<Contribution> contributionProcessor;
- private ContributionDependencyBuilder contributionDependencyBuilder;
- private MonitorFactory monitorFactory;
- private Monitor monitor;
-
- public WorkspaceManagerImpl() throws ServiceRuntimeException{
- try {
- runtime = new ReallySmallRuntime(Thread.currentThread().getContextClassLoader());
-
- ExtensionPointRegistry registry = getRegistry();
-
- modelFactories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
- artifactProcessorExtensions = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
-
- workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
- contributionProcessor = artifactProcessorExtensions.getProcessor(Contribution.class);
- monitorFactory = utilities.getUtility(MonitorFactory.class);
- monitor = monitorFactory.createMonitor();
-
- contributionDependencyBuilder = new ContributionDependencyBuilderImpl(monitor);
-
- } catch(Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- public ExtensionPointRegistry getRegistry(){
- return runtime.getExtensionPointRegistry();
- }
-
- public void start() throws ServiceRuntimeException {
- try {
- runtime.start();
- } catch(Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- public void stop() throws ServiceRuntimeException{
- try {
- runtime.stop();
- } catch(Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- public Workspace createWorkspace(){
- Workspace workspace = workspaceFactory.createWorkspace();
-
- workspace.setModelResolver(new ExtensibleModelResolver(workspace, getRegistry()));
-
- return workspace;
- }
-
-
- public Contribution readContribution(String name, String location) throws ServiceRuntimeException{
- try {
- Contribution returnContribution =
- contributionProcessor.read(null,
- URI.create(name),
- new File(location).toURI().toURL());
-
- analyzeProblems();
-
- return returnContribution;
-
- } catch (Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- public void addContributionToWorkspace(Workspace workspace, Contribution contribution) throws ServiceRuntimeException{
- try {
-
- workspace.getContributions().add(contribution);
-
-
- } catch (Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- public void resolveWorkspace(Workspace workspace) throws ServiceRuntimeException {
- try {
- // an algorithm to resolve contributions given their dependencies
- // need to look at the one from 2.x as this one expects contributions
- // to be presented in the right order
- Set<Contribution> resolved = new HashSet<Contribution>();
- for (Contribution contribution: workspace.getContributions()) {
- List<Contribution> dependencies = contributionDependencyBuilder.buildContributionDependencies(contribution, workspace);
-
- // Resolve contributions
- for (Contribution dependency: dependencies) {
- if (!resolved.contains(dependency)) {
- resolved.add(dependency);
- contributionProcessor.resolve(contribution, workspace.getModelResolver());
- }
- }
- }
-
- analyzeProblems();
-
- } catch (Exception ex) {
- throw new ServiceRuntimeException(ex);
- }
- }
-
- private void analyzeProblems() throws Exception {
-
- for (Problem problem : monitor.getProblems()) {
- if ((problem.getSeverity() == Severity.ERROR) && (!problem.getMessageId().equals("SchemaError"))) {
- if (problem.getCause() != null) {
- throw problem.getCause();
- } else {
- throw new ServiceRuntimeException(problem.toString());
- }
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/LICENSE b/branches/sca-java-1.5.1/modules/workspace-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-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-java-1.5.1/modules/workspace-xml/NOTICE b/branches/sca-java-1.5.1/modules/workspace-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/pom.xml b/branches/sca-java-1.5.1/modules/workspace-xml/pom.xml
deleted file mode 100644
index c0a1a74fe5..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/pom.xml
+++ /dev/null
@@ -1,70 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-workspace-xml</artifactId>
- <name>Apache Tuscany SCA Domain Workspace XML Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-workspace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- <version>3.2.4</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.workspace.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.workspace.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java b/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java
deleted file mode 100644
index d7fc32a1a7..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceDocumentProcessor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.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.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.workspace.Workspace;
-
-/**
- * A contribution workspace document processor.
- *
- * @version $Rev$ $Date$
- */
-public class WorkspaceDocumentProcessor implements URLArtifactProcessor<Workspace> {
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- /**
- * Constructs a new componentType processor.
- * @param factory
- * @param policyFactory
- * @param registry
- */
- public WorkspaceDocumentProcessor(StAXArtifactProcessor<Object> staxProcessor,
- XMLInputFactory inputFactory,
- Monitor monitor) {
- this.staxProcessor = staxProcessor;
- this.inputFactory = inputFactory;
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "workspace-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public Workspace 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 workspace model
- Workspace workspace = (Workspace)staxProcessor.read(reader);
- if (workspace != null) {
- workspace.setURI(uri.toString());
- }
-
- return workspace;
-
- } catch (XMLStreamException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", inputFactory, ce);
- throw ce;
- } catch (IOException e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", staxProcessor, ce);
- throw ce;
- } finally {
- try {
- if (urlStream != null) {
- urlStream.close();
- urlStream = null;
- }
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
-
- public void resolve(Workspace workspace, ModelResolver resolver) throws ContributionResolveException {
- staxProcessor.resolve(workspace, resolver);
- }
-
- public String getArtifactType() {
- return ".workspace";
- }
-
- public Class<Workspace> getModelType() {
- return Workspace.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java b/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java
deleted file mode 100644
index d0665a4ec8..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/java/org/apache/tuscany/sca/workspace/xml/WorkspaceProcessor.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.xml;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.List;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-
-/**
- * A contribution workspace processor.
- *
- * @version $Rev$ $Date$
- */
-public class WorkspaceProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<Workspace> {
-
- private static final String SCA10_TUSCANY_NS = "http://tuscany.apache.org/xmlns/sca/1.0";
- private static final QName WORKSPACE_QNAME = new QName(SCA10_TUSCANY_NS, "workspace");
- private static final QName CONTRIBUTION_QNAME = new QName(SCA10_TUSCANY_NS, "contribution");
- private static final String URI = "uri";
- private static final String LOCATION = "location";
-
- private WorkspaceFactory workspaceFactory;
- private ContributionFactory contributionFactory;
-
- /**
- * Constructs a new contribution workspace processor.
- *
- * @param contributionFactory
- * @param extensionProcessor
- */
- public WorkspaceProcessor(WorkspaceFactory workspaceFactory, ContributionFactory contributionFactory, StAXArtifactProcessor<Object> extensionProcessor) {
- this.workspaceFactory = workspaceFactory;
- this.contributionFactory = contributionFactory;
- }
-
- /**
- * Constructs a new contribution workspace processor.
- *
- * @param modelFactories
- * @param extensionProcessor
- */
- public WorkspaceProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- this.workspaceFactory = modelFactories.getFactory(WorkspaceFactory.class);
- this.contributionFactory = modelFactories.getFactory(ContributionFactory.class);
- }
-
- public Workspace read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
-
- Workspace workspace = null;
- Contribution contribution = null;
-
- // Read the workspace document
- while (reader.hasNext()) {
- int event = reader.getEventType();
- switch (event) {
- case START_ELEMENT:
- QName name = reader.getName();
-
- if (WORKSPACE_QNAME.equals(name)) {
-
- // Read a <workspace>
- workspace = workspaceFactory.createWorkspace();
- workspace.setUnresolved(true);
-
- } else if (CONTRIBUTION_QNAME.equals(name)) {
-
- // Read a <contribution>
- contribution = contributionFactory.createContribution();
- contribution.setURI(getString(reader, URI));
- contribution.setLocation(getString(reader, LOCATION));
- contribution.setUnresolved(true);
- workspace.getContributions().add(contribution);
- }
- break;
-
- case END_ELEMENT:
- name = reader.getName();
-
- // Clear current state when reading reaching end element
- if (CONTRIBUTION_QNAME.equals(name)) {
- contribution = null;
- }
- break;
- }
-
- // Read the next element
- if (reader.hasNext()) {
- reader.next();
- }
- }
- return workspace;
- }
-
- public void write(Workspace workspace, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
-
- // Write <workspace> element
- writeStartDocument(writer, WORKSPACE_QNAME);
-
- // Write <contribution> elements
- for (Contribution contribution: workspace.getContributions()) {
- writeStart(writer, CONTRIBUTION_QNAME,
- new XAttr(URI, contribution.getURI()), new XAttr(LOCATION, contribution.getLocation()));
- writeEnd(writer);
- }
-
- writeEndDocument(writer);
- }
-
- public void resolve(Workspace workspace, ModelResolver resolver) throws ContributionResolveException {
-
- // Resolve the contributions referenced by the workspace
- List<Contribution> contributions = workspace.getContributions();
- for (int i = 0, n = contributions.size(); i < n; i++) {
- Contribution contribution = contributions.get(i);
- Contribution resolved = resolver.resolveModel(Contribution.class, contribution);
- if (resolved != contribution) {
- contributions.set(i, resolved);
- }
- }
-
- workspace.setUnresolved(false);
- }
-
- public QName getArtifactType() {
- return WORKSPACE_QNAME;
- }
-
- public Class<Workspace> getModelType() {
- return Workspace.class;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index 9ea7874b52..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.workspace.xml.WorkspaceProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#workspace,model=org.apache.tuscany.sca.workspace.Workspace
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/workspace-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/workspace-xml-validation-messages.properties
deleted file mode 100644
index e054591a31..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/src/main/resources/workspace-xml-validation-messages.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionReadException = ContributionReadException occured due to :
-ContributionResolveException = ContributionResolveException occured due to : \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java b/branches/sca-java-1.5.1/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java
deleted file mode 100644
index 8e4d30e7a0..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace-xml/src/test/java/org/apache/tuscany/sca/workspace/xml/ContributionWorkspaceProcessorTestCase.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.xml;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.workspace.Workspace;
-
-/**
- * Test the workspace processor.
- *
- * @version $Rev$ $Date$
- */
-
-public class ContributionWorkspaceProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">"
- + "<contribution uri=\"uri1\" location=\"location1\"/>"
- + "<contribution uri=\"uri2\" location=\"location2\"/>"
- + "</workspace>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<workspace xmlns=\"http://tuscany.apache.org/xmlns/sca/1.0\">"
- + "<contribution uri=\"uri1\" location=\"location1\"/>"
- + "<contribution uri=\"uri2\" location=\"location2\"/>"
- + "</contribution>"
- + "</workspace>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, null);
- }
-
- public void testRead() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML));
- Workspace workspace = (Workspace)staxProcessor.read(reader);
- assertNotNull(workspace);
- assertEquals(2, workspace.getContributions().size());
- assertEquals("uri2", workspace.getContributions().get(1).getURI());
- assertEquals("location2", workspace.getContributions().get(1).getLocation());
- }
-
- public void testReadInvalid() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML));
- try {
- staxProcessor.read(reader);
- fail("InvalidException should have been thrown");
- } catch (XMLStreamException e) {
- assertTrue(true);
- }
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/LICENSE b/branches/sca-java-1.5.1/modules/workspace/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/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-java-1.5.1/modules/workspace/NOTICE b/branches/sca-java-1.5.1/modules/workspace/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/workspace/pom.xml b/branches/sca-java-1.5.1/modules/workspace/pom.xml
deleted file mode 100644
index 27fd71edd0..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/pom.xml
+++ /dev/null
@@ -1,64 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-workspace</artifactId>
- <name>Apache Tuscany SCA Domain Workspace Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.workspace</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.workspace*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java
deleted file mode 100644
index e895669d23..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/DefaultWorkspaceFactory.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace;
-
-import org.apache.tuscany.sca.workspace.impl.WorkspaceFactoryImpl;
-
-
-/**
- * Default implementation of a contribution workspace model factory.
- *
- * @version $Rev$ $Date$
- */
-public class DefaultWorkspaceFactory extends WorkspaceFactoryImpl {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java
deleted file mode 100644
index 66f38afec7..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/Workspace.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-
-/**
- * A workspace containing contributions.
- *
- * @version $Rev$ $Date$
- */
-public interface Workspace extends Contribution {
-
- /**
- * Returns the list of contributions in the workspace.
- * @return the list of contributions
- */
- List<Contribution> getContributions();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.java
deleted file mode 100644
index 2656068bea..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/WorkspaceFactory.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.workspace;
-
-
-
-/**
- * A factory for the contribution workspace model.
- *
- * @version $Rev$ $Date$
- */
-public interface WorkspaceFactory {
-
- /**
- * Create a new contribution workspace model object.
- * @return
- */
- Workspace createWorkspace();
-} \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.java
deleted file mode 100644
index 6fab700243..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/builder/ContributionDependencyBuilder.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.workspace.builder;
-
-import java.util.List;
-
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.workspace.Workspace;
-
-/**
- * A contribution dependency builder.
- *
- * @version $Rev$ $Date$
- */
-public interface ContributionDependencyBuilder {
-
- /**
- * Build the set of contributions that a contribution depends on.
- * @param workspace
- * @param contribution
- * @return
- */
- List<Contribution> buildContributionDependencies(Contribution contribution, Workspace workspace);
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.java
deleted file mode 100644
index e41cc3ea83..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceFactoryImpl.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.workspace.impl;
-
-import org.apache.tuscany.sca.workspace.Workspace;
-import org.apache.tuscany.sca.workspace.WorkspaceFactory;
-
-
-/**
- * Default implementation of a contribution workspace model factory.
- *
- * @version $Rev$ $Date$
- */
-public class WorkspaceFactoryImpl implements WorkspaceFactory {
-
- protected WorkspaceFactoryImpl() {
- }
-
- public Workspace createWorkspace() {
- return new WorkspaceImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java b/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java
deleted file mode 100644
index 9e242613eb..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/java/org/apache/tuscany/sca/workspace/impl/WorkspaceImpl.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.workspace.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.impl.ExtensibleImpl;
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.Export;
-import org.apache.tuscany.sca.contribution.Import;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.workspace.Workspace;
-
-/**
- * WorkspaceImpl
- *
- * @version $Rev$ $Date$
- */
-class WorkspaceImpl extends ExtensibleImpl implements Workspace {
-
- private List<Contribution> contributions = new ArrayList<Contribution>();
- private String location;
- private String uri;
- private Object model;
- private byte[] contents;
- private boolean unresolved;
- private ModelResolver modelResolver;
-
- /**
- * Constructs a new workspace.
- */
- WorkspaceImpl() {
- }
-
- public String getLocation() {
- return location;
- }
-
- public Object getModel() {
- return model;
- }
-
- public String getURI() {
- return uri;
- }
-
- public void setLocation(String location) {
- this.location = location;
- }
-
- public void setModel(Object model) {
- this.model = model;
- }
-
- public byte[] getContents() {
- return contents;
- }
-
- public void setContents(byte[] contents) {
- this.contents = contents;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public List<Contribution> getContributions() {
- return contributions;
- }
-
- public List<Artifact> getArtifacts() {
- return (List<Artifact>)(Object)contributions;
- }
-
- public ClassLoader getClassLoader() {
- //FIXME Remove later
- return null;
- }
-
- public void setClassLoader(ClassLoader classLoader) {
- //FIXME Remove later
- }
-
- public List<Composite> getDeployables() {
- List<Composite> deployables = new ArrayList<Composite>();
- for (Contribution contribution: contributions) {
- deployables.addAll(contribution.getDeployables());
- }
- return deployables;
- }
-
- public List<Export> getExports() {
- List<Export> exports = new ArrayList<Export>();
- for (Contribution contribution: contributions) {
- exports.addAll(contribution.getExports());
- }
- return exports;
- }
-
- public List<Import> getImports() {
- List<Import> imports = new ArrayList<Import>();
- for (Contribution contribution: contributions) {
- imports.addAll(contribution.getImports());
- }
- return imports;
- }
-
- public ModelResolver getModelResolver() {
- return modelResolver;
- }
-
- public void setModelResolver(ModelResolver modelResolver) {
- this.modelResolver = modelResolver;
- }
-
- public String getType() {
- // TODO type only used to determine contribution classloader
- return null;
- }
-
- public void setType(String contributionType) {
- // TODO type only used to determine contribution classloader
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory b/branches/sca-java-1.5.1/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory
deleted file mode 100644
index d390d29d90..0000000000
--- a/branches/sca-java-1.5.1/modules/workspace/src/main/resources/META-INF/services/org.apache.tuscany.sca.workspace.WorkspaceFactory
+++ /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.workspace.DefaultWorkspaceFactory \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/LICENSE b/branches/sca-java-1.5.1/modules/xsd-xml/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-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-java-1.5.1/modules/xsd-xml/NOTICE b/branches/sca-java-1.5.1/modules/xsd-xml/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/pom.xml b/branches/sca-java-1.5.1/modules/xsd-xml/pom.xml
deleted file mode 100644
index 67a0d441b6..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/pom.xml
+++ /dev/null
@@ -1,82 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-xsd-xml</artifactId>
- <name>Apache Tuscany SCA XSD XML Processor</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-namespace</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-contribution-impl</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-xsd</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.xsd.xml</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.xsd.xml*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java
deleted file mode 100644
index a057bbe155..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelper.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd.xml;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.xml.sax.InputSource;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLDocumentHelper {
- public static final QName WSDL11 = new QName("http://schemas.xmlsoap.org/wsdl/", "definitions");
- public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
- public static final QName WSDL20 = new QName("http://www.w3.org/ns/wsdl", "description");
-
- protected static final int BUFFER_SIZE = 256;
-
- /**
- * Detect the XML encoding of the document
- *
- * @param is The input stream
- * @return The encoding
- * @throws IOException
- */
- public static String getEncoding(InputStream is) throws IOException {
- if (!is.markSupported())
- is = new BufferedInputStream(is);
-
- byte[] buffer = readBuffer(is);
- return getXMLEncoding(buffer);
- }
-
- /**
- * Searches the array of bytes to determine the XML encoding.
- */
- protected static String getXMLEncoding(byte[] bytes) {
- String javaEncoding = null;
-
- if (bytes.length >= 4) {
- if (((bytes[0] == -2) && (bytes[1] == -1)) || ((bytes[0] == 0) && (bytes[1] == 60)))
- javaEncoding = "UnicodeBig";
- else if (((bytes[0] == -1) && (bytes[1] == -2)) || ((bytes[0] == 60) && (bytes[1] == 0)))
- javaEncoding = "UnicodeLittle";
- else if ((bytes[0] == -17) && (bytes[1] == -69) && (bytes[2] == -65))
- javaEncoding = "UTF8";
- }
-
- String header = null;
-
- try {
- if (javaEncoding != null)
- header = new String(bytes, 0, bytes.length, javaEncoding);
- else
- header = new String(bytes, 0, bytes.length);
- } catch (UnsupportedEncodingException e) {
- return null;
- }
-
- if (!header.startsWith("<?xml"))
- return "UTF-8";
-
- int endOfXMLPI = header.indexOf("?>");
- int encodingIndex = header.indexOf("encoding", 6);
-
- if ((encodingIndex == -1) || (encodingIndex > endOfXMLPI))
- return "UTF-8";
-
- int firstQuoteIndex = header.indexOf("\"", encodingIndex);
- int lastQuoteIndex;
-
- if ((firstQuoteIndex == -1) || (firstQuoteIndex > endOfXMLPI)) {
- firstQuoteIndex = header.indexOf("'", encodingIndex);
- lastQuoteIndex = header.indexOf("'", firstQuoteIndex + 1);
- } else
- lastQuoteIndex = header.indexOf("\"", firstQuoteIndex + 1);
-
- return header.substring(firstQuoteIndex + 1, lastQuoteIndex);
- }
-
- protected static byte[] readBuffer(InputStream is) throws IOException {
- if (is.available() == 0) {
- return new byte[0];
- }
-
- byte[] buffer = new byte[BUFFER_SIZE];
- is.mark(BUFFER_SIZE);
- int bytesRead = is.read(buffer, 0, BUFFER_SIZE);
- int totalBytesRead = bytesRead;
-
- while (bytesRead != -1 && (totalBytesRead < BUFFER_SIZE)) {
- bytesRead = is.read(buffer, totalBytesRead, BUFFER_SIZE - totalBytesRead);
-
- if (bytesRead != -1)
- totalBytesRead += bytesRead;
- }
-
- if (totalBytesRead < BUFFER_SIZE) {
- byte[] smallerBuffer = new byte[totalBytesRead];
- System.arraycopy(buffer, 0, smallerBuffer, 0, totalBytesRead);
- smallerBuffer = buffer;
- }
-
- is.reset();
- return buffer;
- }
-
- public static InputSource getInputSource(URL url) throws IOException {
- URLConnection connection = url.openConnection();
- connection.setUseCaches(false);
- InputStream is = connection.getInputStream();
- return getInputSource(url, is);
- }
-
- public static InputSource getInputSource(URL url, InputStream is) throws IOException {
- is = new BufferedInputStream(is);
- String encoding = getEncoding(is);
- InputSource inputSource = new InputSource(is);
- inputSource.setEncoding(encoding);
- // [rfeng] Make sure we set the system id as it will be used as the base URI for nested import/include
- inputSource.setSystemId(url.toString());
- return inputSource;
- }
-
- public static String readTargetNamespace(URL doc, QName element, boolean rootOnly, String attribute, XMLInputFactory inputFactory)
- throws IOException, XMLStreamException {
- if (attribute == null) {
- attribute = "targetNamespace";
- }
- URLConnection connection = doc.openConnection();
- connection.setUseCaches(false);
- InputStream is = connection.getInputStream();
- try {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
- int eventType = reader.getEventType();
- while (true) {
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- if (element.equals(reader.getName())) {
- return reader.getAttributeValue(null, attribute);
- } else if (rootOnly) {
- return null;
- }
- }
- if (reader.hasNext()) {
- eventType = reader.next();
- } else {
- break;
- }
- }
- return null;
- } finally {
- is.close();
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java
deleted file mode 100644
index e3042a607d..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessor.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLInputFactory;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-
-/**
- * An ArtifactProcessor for XSD documents.
- *
- * @version $Rev$ $Date$
- */
-public class XSDDocumentProcessor implements URLArtifactProcessor<XSDefinition> {
-
- private XSDFactory factory;
- private XMLInputFactory inputFactory;
- private Monitor monitor;
-
- public XSDDocumentProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- this.factory = modelFactories.getFactory(XSDFactory.class);
- this.inputFactory = modelFactories.getFactory(XMLInputFactory.class);
- this.monitor = monitor;
- }
-
- /**
- * Report a exception.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Exception ex) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "xsd-xml-validation-messages", Severity.ERROR, model, message, ex);
- monitor.problem(problem);
- }
- }
-
- public XSDefinition read(URL contributionURL, URI artifactURI, URL artifactURL) throws ContributionReadException {
- try {
- return indexRead(artifactURL);
- } catch (Exception e) {
- ContributionReadException ce = new ContributionReadException(e);
- error("ContributionReadException", artifactURL, ce);
- throw ce;
- }
- }
-
- public void resolve(XSDefinition model, ModelResolver resolver) throws ContributionResolveException {
- }
-
- public String getArtifactType() {
- return ".xsd";
- }
-
- public Class<XSDefinition> getModelType() {
- return XSDefinition.class;
- }
-
- public static final QName XSD = new QName("http://www.w3.org/2001/XMLSchema", "schema");
-
- protected XSDefinition indexRead(URL doc) throws Exception {
- XSDefinition xsd = factory.createXSDefinition();
- xsd.setUnresolved(true);
- xsd.setNamespace(XMLDocumentHelper.readTargetNamespace(doc, XSD, true, "targetNamespace", inputFactory));
- xsd.setLocation(doc.toURI());
- xsd.setUnresolved(false);
- return xsd;
- }
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
deleted file mode 100644
index fb6e8eac20..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/java/org/apache/tuscany/sca/xsd/xml/XSDModelResolver.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd.xml;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.tuscany.sca.contribution.Artifact;
-import org.apache.tuscany.sca.contribution.Contribution;
-import org.apache.tuscany.sca.contribution.DefaultImport;
-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;
-import org.apache.tuscany.sca.contribution.service.ContributionRuntimeException;
-import org.apache.tuscany.sca.xsd.DefaultXSDFactory;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sca.xsd.impl.XSDefinitionImpl;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaInclude;
-import org.apache.ws.commons.schema.resolver.URIResolver;
-import org.xml.sax.InputSource;
-
-/**
- * A Model Resolver for XSD models.
- *
- * @version $Rev$ $Date$
- */
-public class XSDModelResolver implements ModelResolver {
- private static final String AGGREGATED_XSD = "http://tuscany.apache.org/aggregated.xsd";
- private XSDFactory factory;
- private Contribution contribution;
- private Map<String, List<XSDefinition>> map = new HashMap<String, List<XSDefinition>>();
- private XmlSchemaCollection schemaCollection;
-
- public XSDModelResolver(Contribution contribution, ModelFactoryExtensionPoint modelFactories) {
- this.contribution = contribution;
- this.schemaCollection = new XmlSchemaCollection();
- schemaCollection.setSchemaResolver(new URIResolverImpl(contribution));
- this.factory = new DefaultXSDFactory();
- }
-
- public void addModel(Object resolved) {
- XSDefinition definition = (XSDefinition)resolved;
- List<XSDefinition> list = map.get(definition.getNamespace());
- if (list == null) {
- list = new ArrayList<XSDefinition>();
- map.put(definition.getNamespace(), list);
- }
- list.add(definition);
- }
-
- public Object removeModel(Object resolved) {
- XSDefinition definition = (XSDefinition)resolved;
- List<XSDefinition> list = map.get(definition.getNamespace());
- if (list == null) {
- return null;
- } else {
- return list.remove(definition);
- }
- }
-
- public <T> T resolveModel(Class<T> modelClass, T unresolved) {
-
- XSDefinition definition = (XSDefinition)unresolved;
- String namespace = definition.getNamespace();
-
- // Lookup a definition for the given namespace within the
- // current contribution.
- List<XSDefinition> list = map.get(namespace);
- XSDefinition modelXSD = null;
- if (list != null && definition.getDocument() != null) {
- // Set the document for the inline schema
- int index = list.indexOf(definition);
- if (index != -1) { // a matching (not identical) document was found
- modelXSD = list.get(index);
- modelXSD.setDocument(definition.getDocument());
- }
- }
- if (list == null && definition.getDocument() != null) {
- // Hit for the 1st time
- list = new ArrayList<XSDefinition>();
- list.add(definition);
- map.put(namespace, list);
- }
- XSDefinition resolved = null;
- try {
- resolved = aggregate(list);
- } catch (ContributionRuntimeException e) {
- throw new ContributionRuntimeException(e);
- }
- if (resolved != null && !resolved.isUnresolved()) {
- if (definition.isUnresolved() && definition.getSchema() == null && modelXSD != null) {
- // Update the unresolved model with schema information and mark it
- // resolved. This information in the unresolved model is needed when
- // this method is called by WSDLModelResolver.readInlineSchemas().
- definition.setSchema(modelXSD.getSchema());
- definition.setSchemaCollection(modelXSD.getSchemaCollection());
- definition.setUnresolved(false);
- }
- 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(namespace)) {
-
- // Delegate the resolution to the namespace import resolver
- resolved =
- namespaceImport.getModelResolver().resolveModel(XSDefinition.class, (XSDefinition)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- } else if (import_ instanceof DefaultImport) {
-
- // Delegate the resolution to the default import resolver
- resolved =
- import_.getModelResolver().resolveModel(XSDefinition.class, (XSDefinition)unresolved);
- if (!resolved.isUnresolved()) {
- return modelClass.cast(resolved);
- }
- }
- }
- return modelClass.cast(unresolved);
- }
-
- private void loadOnDemand(XSDefinition definition) throws ContributionRuntimeException {
- if (definition.getSchema() != null) {
- return;
- }
- if (definition.getDocument() != null) {
- String uri = null;
- if (definition.getLocation() != null) {
- uri = definition.getLocation().toString();
- }
- XmlSchema schema = null;
- try {
- schema = schemaCollection.read(definition.getDocument(), uri, null);
- } catch (RuntimeException e) {
- // find original cause of the problem
- Throwable cause = e;
- while (cause.getCause() != null && cause != cause.getCause()) {
- cause = cause.getCause();
- }
- throw new ContributionRuntimeException(cause);
- }
- definition.setSchemaCollection(schemaCollection);
- definition.setSchema(schema);
- definition.setUnresolved(false);
- } else if (definition.getLocation() != null) {
- if (definition.getLocation().getFragment() != null) {
- // It's an inline schema
- // FIXME: We need to trigger the loading of the enclosing WSDL models
- return;
- }
- // Read an XSD document
- XmlSchema schema = null;
- for (XmlSchema d : schemaCollection.getXmlSchemas()) {
- if (isSameNamespace(d.getTargetNamespace(), definition.getNamespace())) {
- if (d.getSourceURI().equals(definition.getLocation().toString())) {
- schema = d;
- break;
- }
- }
- }
- if (schema == null) {
- InputSource xsd = null;
- try {
- xsd = XMLDocumentHelper.getInputSource(definition.getLocation().toURL());
- } catch (IOException e) {
- throw new ContributionRuntimeException(e);
- }
-
- try {
- schema = schemaCollection.read(xsd, null);
- } catch (RuntimeException e) {
- // find original cause of the problem
- Throwable cause = e;
- while (cause.getCause() != null && cause != cause.getCause()) {
- cause = cause.getCause();
- }
- throw new ContributionRuntimeException(cause);
- }
- }
- definition.setSchemaCollection(schemaCollection);
- definition.setSchema(schema);
- }
- }
-
- private boolean isSameNamespace(String ns1, String ns2) {
- if (ns1 == null) {
- return ns2 == null;
- } else {
- return ns1.equals(ns2);
- }
- }
-
- /**
- * Create a facade XmlSchema which includes all the definitions
- *
- * @param definitions A list of the XmlSchema under the same target
- * namespace
- * @return The aggregated XmlSchema
- */
- private XSDefinition aggregate(List<XSDefinition> definitions) throws ContributionRuntimeException {
- if (definitions == null || definitions.size() == 0) {
- return null;
- }
- if (definitions.size() == 1) {
- XSDefinition d = definitions.get(0);
- loadOnDemand(d);
- return d;
- }
- XSDefinition aggregated = factory.createXSDefinition();
- for (XSDefinition d : definitions) {
- loadOnDemand(d);
- }
- String ns = definitions.get(0).getNamespace();
-
- XmlSchema facade = null;
- // Check if the facade XSD is already in the collection
- for (XmlSchema s : schemaCollection.getXmlSchema(AGGREGATED_XSD)) {
- if (ns.equals(s.getTargetNamespace())) {
- facade = s;
- break;
- }
- }
- if (facade == null) {
- // This will add the facade into the collection
- facade = new XmlSchema(ns, AGGREGATED_XSD, schemaCollection);
- }
-
- for (XmlSchema d : schemaCollection.getXmlSchemas()) {
- if (ns.equals(d.getTargetNamespace())) {
- if (d == facade) {
- continue;
- }
- XmlSchemaInclude include = new XmlSchemaInclude();
- include.setSchema(d);
- include.setSourceURI(d.getSourceURI());
- include.setSchemaLocation(d.getSourceURI());
- facade.getIncludes().add(include);
- facade.getItems().add(include);
- }
- }
- aggregated.setUnresolved(true);
- aggregated.setSchema(facade);
- aggregated.setNamespace(ns);
- aggregated.setAggregatedDefinitions(definitions);
- aggregated.setUnresolved(false);
-
- // FIXME: [rfeng] This is hacky
- //definitions.clear();
- //definitions.add(aggregated);
- return aggregated;
- }
-
- /**
- * URI resolver implementation for XML schema
- */
- public static class URIResolverImpl implements URIResolver {
- private Contribution contribution;
-
- public URIResolverImpl(Contribution contribution) {
- this.contribution = contribution;
- }
-
- public InputSource resolveEntity(String targetNamespace, String schemaLocation, String baseUri) {
- try {
- if (schemaLocation == null) {
- return null;
- }
- URL url = null;
- if (schemaLocation.startsWith("/")) {
- // The URI is relative to the contribution
- String uri = schemaLocation.substring(1);
- for (Artifact a : contribution.getArtifacts()) {
- if (a.getURI().equals(uri)) {
- url = new URL(a.getLocation());
- break;
- }
- }
- if (url == null) {
- // URI not found in the contribution; return a default InputSource
- // so that the XmlSchema code will produce a useful diagnostic
- return new InputSource(schemaLocation);
- }
- } else {
- url = new URL(new URL(baseUri), schemaLocation);
- }
- return XMLDocumentHelper.getInputSource(url);
- } catch (IOException e) {
- // If we are not able to resolve the imports using location, then
- // try resolving them using the namespace.
- try {
- for (Artifact artifact : contribution.getArtifacts()) {
- if (artifact.getModel() instanceof XSDefinitionImpl) {
- String artifactNamespace = ((XSDefinitionImpl)artifact.getModel()).getNamespace();
- if (targetNamespace.equals(artifactNamespace)) {
- URL artifactLocation = ((XSDefinitionImpl)artifact.getModel()).getLocation().toURL();
- return XMLDocumentHelper.getInputSource(artifactLocation);
- }
- }
- }
- } catch (IOException ex) {
- // Invalid URI; return a default InputSource so that the
- // XmlSchema code will produce a useful diagnostic
- return new InputSource(schemaLocation);
- }
- // Invalid URI; return a default InputSource so that the
- // XmlSchema code will produce a useful diagnostic
- return new InputSource(schemaLocation);
- }
- }
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
deleted file mode 100644
index 1ec3d27200..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.xsd.xml.XSDDocumentProcessor;type=.xsd,model=org.apache.tuscany.sca.xsd.XSDefinition
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
deleted file mode 100644
index a67ecf063a..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.resolver.ModelResolver
+++ /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.xsd.xml.XSDModelResolver;model=org.apache.tuscany.sca.xsd.XSDefinition
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/xsd-xml-validation-messages.properties b/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/xsd-xml-validation-messages.properties
deleted file mode 100644
index ab50456510..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/main/resources/xsd-xml-validation-messages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-ContributionReadException = ContributionReadException occured due to : {0}
-
-
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java b/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.java
deleted file mode 100644
index f245377d87..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XMLDocumentHelperTestCase.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.xsd.xml;
-
-import java.net.URL;
-
-import javax.xml.stream.XMLInputFactory;
-
-import junit.framework.Assert;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XMLDocumentHelperTestCase {
- private URL xsd;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- xsd = getClass().getResource("/xsd/greeting.xsd");
- }
-
- @Test
- public void testReadTNS() throws Exception {
- String tns = XMLDocumentHelper.readTargetNamespace(xsd, XMLDocumentHelper.XSD, true, null, XMLInputFactory.newInstance());
- Assert.assertEquals("http://greeting", tns);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessorTestCase.java b/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessorTestCase.java
deleted file mode 100644
index 76e6a57c29..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/java/org/apache/tuscany/sca/xsd/xml/XSDDocumentProcessorTestCase.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd.xml;
-
-import java.net.URI;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.Assert;
-
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.ExtensionPointRegistry;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchemaInclude;
-import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
-import org.apache.ws.commons.schema.XmlSchemaType;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @version $Rev$ $Date$
- */
-public class XSDDocumentProcessorTestCase {
- private URLArtifactProcessor<Object> documentProcessor;
- private ModelResolver resolver;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- URLArtifactProcessorExtensionPoint documentProcessors = extensionPoints.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
- documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors, null);
- ModelFactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(ModelFactoryExtensionPoint.class);
- resolver = new XSDModelResolver(null, modelFactories);
- }
-
- @Test
- public void testXSD() throws Exception {
- URL url = getClass().getResource("/xsd/greeting.xsd");
- XSDefinition definition = (XSDefinition)documentProcessor.read(null, URI.create("xsd/greeting.xsd"), url);
- Assert.assertNull(definition.getSchema());
- Assert.assertEquals("http://greeting", definition.getNamespace());
- URL url1 = getClass().getResource("/xsd/name.xsd");
- XSDefinition definition1 = (XSDefinition)documentProcessor.read(null, URI.create("xsd/name.xsd"), url1);
- Assert.assertNull(definition1.getSchema());
- Assert.assertEquals("http://greeting", definition1.getNamespace());
- resolver.addModel(definition);
- XSDefinition resolved = resolver.resolveModel(XSDefinition.class, definition);
- XmlSchemaObjectCollection collection = resolved.getSchema().getIncludes();
- Assert.assertTrue(collection.getCount() == 1);
- XmlSchemaType type =
- ((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
- Assert.assertNotNull(type);
- resolver.addModel(definition1);
- resolved = resolver.resolveModel(XSDefinition.class, definition);
- collection = resolved.getSchema().getIncludes();
- Assert.assertTrue(collection.getCount() == 2);
- XmlSchemaType type1 =
- ((XmlSchemaInclude)collection.getItem(0)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
- XmlSchemaType type2 =
- ((XmlSchemaInclude)collection.getItem(1)).getSchema().getTypeByName(new QName("http://greeting", "Name"));
- Assert.assertTrue(type1 != null || type2 != null);
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/greeting.xsd b/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/greeting.xsd
deleted file mode 100644
index 635ca25bfc..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/greeting.xsd
+++ /dev/null
@@ -1,29 +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.
--->
-<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
- <include schemaLocation="name.xsd" />
- <complexType name="Greeting">
- <sequence>
- <element name="message" type="string" />
- <element name="name" type="Name" />
- </sequence>
- </complexType>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/name.xsd b/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/name.xsd
deleted file mode 100644
index 300de931ec..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd-xml/src/test/resources/xsd/name.xsd
+++ /dev/null
@@ -1,29 +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.
--->
-<schema targetNamespace="http://greeting" xmlns="http://www.w3.org/2001/XMLSchema">
-
- <complexType name="Name">
- <sequence>
- <element name="firstName" type="string" />
- <element name="lastName" type="string" />
- </sequence>
- </complexType>
-
-</schema> \ No newline at end of file
diff --git a/branches/sca-java-1.5.1/modules/xsd/LICENSE b/branches/sca-java-1.5.1/modules/xsd/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/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-java-1.5.1/modules/xsd/NOTICE b/branches/sca-java-1.5.1/modules/xsd/NOTICE
deleted file mode 100644
index 25bb89c9b2..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2009 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5.1/modules/xsd/pom.xml b/branches/sca-java-1.5.1/modules/xsd/pom.xml
deleted file mode 100644
index 54ca106df3..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/pom.xml
+++ /dev/null
@@ -1,79 +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>1.5.1-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-xsd</artifactId>
- <name>Apache Tuscany SCA XSD Model</name>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly</artifactId>
- <version>1.5.1-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.schema</groupId>
- <artifactId>XmlSchema</artifactId>
- <version>1.4.2</version>
- </dependency>
- </dependencies>
-
- <repositories>
- <!-- Apache repository for Web Services artifacts -->
- <repository>
- <id>apache.ws.zone</id>
- <name>Apache WS Zone Repository</name>
- <url>http://ws.zones.apache.org/repository2</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.xsd</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.xsd*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/DefaultXSDFactory.java b/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/DefaultXSDFactory.java
deleted file mode 100644
index 92dce98fa1..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/DefaultXSDFactory.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.xsd;
-
-import org.apache.tuscany.sca.xsd.impl.XSDFactoryImpl;
-
-/**
- * A factory for XSD definitions
- *
- * @version $Rev$ $Date$
- */
-public class DefaultXSDFactory extends XSDFactoryImpl implements XSDFactory {
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDFactory.java b/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDFactory.java
deleted file mode 100644
index 08a1c8dd63..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDFactory.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.xsd;
-
-/**
- * Factory for XSD definitions
- *
- * @version $Rev$ $Date$
- */
-public interface XSDFactory {
-
- /**
- * Creates a new XML Schema definition.
- *
- * @return a new XML Schema definition
- */
- XSDefinition createXSDefinition();
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDefinition.java b/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDefinition.java
deleted file mode 100644
index 9a973cd095..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/XSDefinition.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd;
-
-import java.net.URI;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.Base;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaType;
-import org.w3c.dom.Document;
-
-/**
- * Represents an XML Schema definition.
- *
- * @version $Rev: 633545 $ $Date: 2008-03-04 16:52:24 +0000 (Tue, 04 Mar 2008) $
- */
-public interface XSDefinition extends Base {
- XmlSchemaCollection getSchemaCollection();
-
- void setSchemaCollection(XmlSchemaCollection schemaCollection);
-
- /**
- * Returns the XmlSchema definition model
- * @return the XmlSchema definition model
- */
- XmlSchema getSchema();
-
- /**
- * Sets the XmlSchema definition model
- * @param definition the XmlSchema definition model
- */
- void setSchema(XmlSchema definition);
-
- /**
- * Returns the namespace of this XmlSchema definition.
- * @return the namespace of this XmlSchema definition
- */
- String getNamespace();
-
- /**
- * Sets the namespace of this XmlSchema definition.
- * @param namespace the namespace of this XmlSchema definition
- */
- void setNamespace(String namespace);
-
- /**
- * Get the location of the XSD
- * @return
- */
- URI getLocation();
-
- /**
- * Set the location of the XSD
- * @param uri
- */
- void setLocation(URI uri);
-
- /**
- * Get the DOM representation of the XSD
- * @return
- */
- Document getDocument();
-
- /**
- * Set the DOM representation of the XSD
- * @param document
- */
- void setDocument(Document document);
-
- /**
- * Get an XSD element by QName
- * @param name The element name
- * @return The XSD element
- */
- XmlSchemaElement getXmlSchemaElement(QName name);
-
- /**
- * Get an XSD type by QName
- * @param name The type name
- * @return The XSD type
- */
- XmlSchemaType getXmlSchemaType(QName name);
-
- /**
- * Get the aggregated definitions for a facade XSDefinition
- * @return The aggregated definitions, or null if not a facade
- */
- List<XSDefinition> getAggregatedDefinitions();
-
- /**
- * Set the aggregated definitions for a facade XSDefinition
- * @param name The aggregated definitions
- */
- void setAggregatedDefinitions(List<XSDefinition> definitions);
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDFactoryImpl.java b/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDFactoryImpl.java
deleted file mode 100644
index 60ff6b6fd9..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDFactoryImpl.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.xsd.impl;
-
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sca.xsd.XSDFactory;
-
-/**
- * A factory for XSD definitions
- *
- * @version $Rev$ $Date$
- */
-public abstract class XSDFactoryImpl implements XSDFactory {
-
- public XSDefinition createXSDefinition() {
- return new XSDefinitionImpl();
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDefinitionImpl.java b/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDefinitionImpl.java
deleted file mode 100644
index e57cbee8b8..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/java/org/apache/tuscany/sca/xsd/impl/XSDefinitionImpl.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.xsd.impl;
-
-import java.net.URI;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.ws.commons.schema.XmlSchema;
-import org.apache.ws.commons.schema.XmlSchemaCollection;
-import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaImport;
-import org.apache.ws.commons.schema.XmlSchemaInclude;
-import org.apache.ws.commons.schema.XmlSchemaObject;
-import org.apache.ws.commons.schema.XmlSchemaType;
-import org.w3c.dom.Document;
-
-/**
- * Represents a XML schema definition.
- *
- * @version $Rev: 582399 $ $Date: 2007-10-05 22:28:30 +0100 (Fri, 05 Oct 2007) $
- */
-public class XSDefinitionImpl implements XSDefinition {
- private XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
- private XmlSchema schema;
- private String namespace;
- private URI location;
- private Document document;
- private boolean unresolved;
- private List<XSDefinition> definitions;
-
- public XSDefinitionImpl() {
- }
-
- public XmlSchema getSchema() {
- return schema;
- }
-
- public void setSchema(XmlSchema definition) {
- this.schema = definition;
- }
-
- public boolean isUnresolved() {
- return unresolved;
- }
-
- public void setUnresolved(boolean undefined) {
- this.unresolved = undefined;
- }
-
- public String getNamespace() {
- if (isUnresolved()) {
- return namespace;
- } else if (schema != null) {
- return schema.getTargetNamespace();
- } else {
- return namespace;
- }
- }
-
- public void setNamespace(String namespace) {
- if (!isUnresolved()) {
- throw new IllegalStateException();
- } else {
- this.namespace = namespace;
- }
- }
-
- /**
- * @return the location
- */
- public URI getLocation() {
- return location;
- }
-
- /**
- * @param location the location to set
- */
- public void setLocation(URI location) {
- this.location = location;
- }
-
- /**
- * @return the document
- */
- public Document getDocument() {
- return document;
- }
-
- /**
- * @param document the document to set
- */
- public void setDocument(Document document) {
- this.document = document;
- }
-
- /**
- * @return the schemaCollection
- */
- public XmlSchemaCollection getSchemaCollection() {
- return schemaCollection;
- }
-
- /**
- * @param schemaCollection the schemaCollection to set
- */
- public void setSchemaCollection(XmlSchemaCollection schemaCollection) {
- this.schemaCollection = schemaCollection;
- }
-
- /**
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((location == null) ? 0 : location.hashCode());
- result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
- return result;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (!(obj instanceof XSDefinitionImpl))
- return false;
- final XSDefinitionImpl other = (XSDefinitionImpl)obj;
- if (location == null) {
- if (other.location != null)
- return false;
- } else if (!location.equals(other.location))
- return false;
- if (namespace == null) {
- if (other.namespace != null)
- return false;
- } else if (!namespace.equals(other.namespace))
- return false;
- return true;
- }
-
- public static <T extends XmlSchemaObject> T getXmlSchemaObject(XmlSchema schema, QName name, Class<T> type) {
- if (schema != null) {
- XmlSchemaObject object = null;
- if (type == XmlSchemaElement.class) {
- object = schema.getElementByName(name);
- } else if (type == XmlSchemaType.class) {
- object = schema.getTypeByName(name);
- }
- if (object != null) {
- return type.cast(object);
- }
- for (Iterator i = schema.getIncludes().getIterator(); i.hasNext();) {
- XmlSchemaObject obj = (XmlSchemaObject)i.next();
- XmlSchema ext = null;
- if (obj instanceof XmlSchemaInclude) {
- ext = ((XmlSchemaInclude)obj).getSchema();
- }
- if (obj instanceof XmlSchemaImport) {
- ext = ((XmlSchemaImport)obj).getSchema();
- }
- object = getXmlSchemaObject(ext, name, type);
- if (object != null) {
- return type.cast(object);
- }
- }
- }
- return null;
- }
-
- public XmlSchemaElement getXmlSchemaElement(QName name) {
- if (schema != null) {
- XmlSchemaElement element = getXmlSchemaObject(schema, name, XmlSchemaElement.class);
- if (element != null) {
- return element;
- }
- }
-
- if (schemaCollection != null) {
- return schemaCollection.getElementByQName(name);
- }
- return null;
- }
-
- public XmlSchemaType getXmlSchemaType(QName name) {
- if (schema != null) {
- XmlSchemaType type = getXmlSchemaObject(schema, name, XmlSchemaType.class);
- if (type != null) {
- return type;
- }
- }
- if (schemaCollection != null) {
- return schemaCollection.getTypeByQName(name);
- }
- return null;
- }
-
- public List<XSDefinition> getAggregatedDefinitions() {
- return definitions;
- }
-
- public void setAggregatedDefinitions(List<XSDefinition> definitions) {
- this.definitions = definitions;
- }
-
-}
diff --git a/branches/sca-java-1.5.1/modules/xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.xsd.XSDFactory b/branches/sca-java-1.5.1/modules/xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.xsd.XSDFactory
deleted file mode 100644
index ca06127c06..0000000000
--- a/branches/sca-java-1.5.1/modules/xsd/src/main/resources/META-INF/services/org.apache.tuscany.sca.xsd.XSDFactory
+++ /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.xsd.DefaultXSDFactory \ No newline at end of file